bsp: r5: modified Init_MPU for the case when starting DDR>2GB

This patch modifies mpu settings in Init_MPU to truncate the
DDR size to 2Gb when DDR located at 0x0 is greater than 2GB
in the hdf

Signed-off-by: Kinjal Pravinbhai Patel <patelki@xilinx.com>
Acked-by: Anirudha Sarangi <anirudh@xilinx.com>
This commit is contained in:
Kinjal Pravinbhai Patel 2015-10-08 17:19:44 +05:30 committed by Nava kishore Manne
parent ed9789b2a9
commit 20f9a33b64

View file

@ -130,6 +130,7 @@ void Init_MPU(void)
#ifdef XPAR_PSU_R5_DDR_0_S_AXI_BASEADDR #ifdef XPAR_PSU_R5_DDR_0_S_AXI_BASEADDR
/* If the DDR is present, configure region as per DDR size */ /* If the DDR is present, configure region as per DDR size */
size = (XPAR_PSU_R5_DDR_0_S_AXI_HIGHADDR - XPAR_PSU_R5_DDR_0_S_AXI_BASEADDR) + 1; size = (XPAR_PSU_R5_DDR_0_S_AXI_HIGHADDR - XPAR_PSU_R5_DDR_0_S_AXI_BASEADDR) + 1;
if (size < 0x80000000) {
/* Lookup the size. */ /* Lookup the size. */
for (i = 0; i < sizeof region_size / sizeof region_size[0]; i++) { for (i = 0; i < sizeof region_size / sizeof region_size[0]; i++) {
if (size <= region_size[i].size) { if (size <= region_size[i].size) {
@ -137,6 +138,10 @@ void Init_MPU(void)
break; break;
} }
} }
} else {
/* if the DDR size is > 2GB, truncate it to 2GB */
RegSize = REGION_2G;
}
#else #else
/* For DDRless system, configure region for TCM */ /* For DDRless system, configure region for TCM */
RegSize = REGION_256K; RegSize = REGION_256K;