mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
arm: caches: protect dram_bank_mmu_setup access to bi_dram
Add protection in dram_bank_mmu_setup() to avoid access to bd->bi_dram before relocation. This patch allow to use the generic weak function dram_bank_mmu_setup to activate the MMU and the data cache in SPL or in U-Boot before relocation, when bd->bi_dram is not yet initialized. In this cases, the MMU must be initialized explicitly with mmu_set_region_dcache_behaviour function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
committed by
Tom Rini
parent
f8dc7f2f18
commit
c8ec1e3ff5
@@ -91,6 +91,10 @@ __weak void dram_bank_mmu_setup(int bank)
|
|||||||
bd_t *bd = gd->bd;
|
bd_t *bd = gd->bd;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* bd->bi_dram is available only after relocation */
|
||||||
|
if ((gd->flags & GD_FLG_RELOC) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
debug("%s: bank: %d\n", __func__, bank);
|
debug("%s: bank: %d\n", __func__, bank);
|
||||||
for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT;
|
for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT;
|
||||||
i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) +
|
i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) +
|
||||||
|
Reference in New Issue
Block a user