blob: 8d5fae9a976b6558ad78883c639960bf18cc0e18 [file] [log] [blame]
Giulio Benetti77eb9a92020-01-10 15:51:47 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019
4 * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
5 */
6
7#include <common.h>
Simon Glass691d7192020-05-10 11:40:02 -06008#include <init.h>
Giulio Benetti77eb9a92020-01-10 15:51:47 +01009#include <asm/io.h>
10#include <asm/armv7_mpu.h>
11
12int arch_cpu_init(void)
13{
14 int i;
15
16 struct mpu_region_config imxrt1050_region_config[] = {
17 { 0x00000000, REGION_0, XN_DIS, PRIV_RW_USR_RW,
18 STRONG_ORDER, REGION_4GB },
19 { PHYS_SDRAM, REGION_1, XN_DIS, PRIV_RW_USR_RW,
20 O_I_WB_RD_WR_ALLOC, (ffs(PHYS_SDRAM_SIZE) - 2) },
21 { DMAMEM_BASE,
22 REGION_2, XN_DIS, PRIV_RW_USR_RW,
23 STRONG_ORDER, (ffs(DMAMEM_SZ_ALL) - 2) },
24 };
25
26 /*
27 * Configure the memory protection unit (MPU) to allow full access to
28 * the whole 4GB address space.
29 */
30 disable_mpu();
31 for (i = 0; i < ARRAY_SIZE(imxrt1050_region_config); i++)
32 mpu_config(&imxrt1050_region_config[i]);
33 enable_mpu();
34
35 return 0;
36}