@@ -200,38 +200,24 @@ static int hal_flash_getid(void)
200200static void hal_flash_init (void )
201201{
202202#ifdef ENABLE_IFC
203- /* IFC - NOR Flash */
204- /* LAW is also set in boot_ppc_start.S:flash_law */
205- set_law (1 , FLASH_BASE_PHYS_HIGH , FLASH_BASE_ADDR , LAW_TRGT_IFC , LAW_SIZE_128MB , 1 );
206-
207- /* NOR IFC Flash Timing Parameters */
208- set32 (IFC_FTIM0 (0 ), (IFC_FTIM0_NOR_TACSE (4 ) |
209- IFC_FTIM0_NOR_TEADC (5 ) |
210- IFC_FTIM0_NOR_TEAHC (5 )));
211- set32 (IFC_FTIM1 (0 ), (IFC_FTIM1_NOR_TACO (53 ) |
212- IFC_FTIM1_NOR_TRAD (26 ) |
213- IFC_FTIM1_NOR_TSEQ (19 )));
214- set32 (IFC_FTIM2 (0 ), (IFC_FTIM2_NOR_TCS (4 ) |
215- IFC_FTIM2_NOR_TCH (4 ) |
216- IFC_FTIM2_NOR_TWPH (14 ) |
217- IFC_FTIM2_NOR_TWP (28 )));
218- set32 (IFC_FTIM3 (0 ), 0 );
219- /* NOR IFC Definitions (CS0) */
220- set32 (IFC_CSPR_EXT (0 ), FLASH_BASE_PHYS_HIGH );
221- set32 (IFC_CSPR (0 ), (IFC_CSPR_PHYS_ADDR (FLASH_BASE_ADDR ) |
222- #if FLASH_CFI_WIDTH == 16
223- IFC_CSPR_PORT_SIZE_16 |
224- #else
225- IFC_CSPR_PORT_SIZE_8 |
226- #endif
227- IFC_CSPR_MSEL_NOR |
228- IFC_CSPR_V ));
229- set32 (IFC_AMASK (0 ), IFC_AMASK_128MB );
230- set32 (IFC_CSOR (0 ), 0x0000000C ); /* TRHZ (80 clocks for read enable high) */
203+ /* IFC CS0 - NOR Flash
204+ * Do NOT reprogram IFC CS0 (CSPR, AMASK, CSOR, FTIM) while executing
205+ * from flash (XIP) with cache-inhibited TLB (MAS2_I|MAS2_G). The boot
206+ * ROM already configured CS0 correctly. Reprogramming CSPR while XIP
207+ * can cause instruction fetch failures because there is no cache to
208+ * serve fetches during the chip-select decode transition.
209+ *
210+ * U-Boot avoids this by using MAS2_W|MAS2_G (write-through, cached)
211+ * during XIP, only switching to MAS2_I|MAS2_G after relocating to RAM.
212+ *
213+ * The LAW is also already set in boot_ppc_start.S:flash_law.
214+ */
231215
232- #ifndef BUILD_LOADER_STAGE1
233- hal_flash_getid ();
234- #endif
216+ /* Note: hal_flash_getid() is disabled because AMD Autoselect mode
217+ * affects the entire flash bank. Since wolfBoot runs XIP from the same
218+ * bank (CS0), entering Autoselect mode crashes instruction fetch.
219+ * Flash write/erase operations will need RAMFUNCTION support.
220+ * TODO: Implement RAMFUNCTION for flash operations on T2080. */
235221#endif /* ENABLE_IFC */
236222}
237223
@@ -578,7 +564,7 @@ void hal_flash_lock(void)
578564/* from boot_ppc_mp.S */
579565extern uint32_t _secondary_start_page ;
580566extern uint32_t _second_half_boot_page ;
581- extern uint32_t _spin_table ;
567+ extern uint32_t _spin_table [] ;
582568extern uint32_t _spin_table_addr ;
583569extern uint32_t _bootpg_addr ;
584570
@@ -593,7 +579,7 @@ static void hal_mp_up(uint32_t bootpg)
593579 active_cores = (1 << whoami ); /* current running cores */
594580
595581 wolfBoot_printf ("MP: Starting cores (boot page %p, spin table %p)\n" ,
596- bootpg , (uint32_t )& _spin_table );
582+ bootpg , (uint32_t )_spin_table );
597583
598584 /* Set the boot page translation register */
599585 set32 (LCC_BSTRH , 0 );
@@ -614,7 +600,7 @@ static void hal_mp_up(uint32_t bootpg)
614600 while (timeout ) {
615601 for (i = 0 ; i < CPU_NUMCORES ; i ++ ) {
616602 uint32_t * entry = (uint32_t * )(
617- (uint8_t * )& _spin_table + (i * ENTRY_SIZE ) + ENTRY_ADDR_LOWER );
603+ (uint8_t * )_spin_table + (i * ENTRY_SIZE ) + ENTRY_ADDR_LOWER );
618604 if (* entry ) {
619605 active_cores |= (1 << i );
620606 }
@@ -651,14 +637,17 @@ static void hal_mp_init(void)
651637 const volatile uint32_t * s ;
652638 volatile uint32_t * d ;
653639
654- /* Assign virtual boot page at end of DDR */
655- bootpg = DDR_ADDRESS + DDR_SIZE - BOOT_ROM_SIZE ;
640+ /* Assign virtual boot page at end of LAW-mapped DDR region.
641+ * DDR LAW maps 2GB (LAW_SIZE_2GB) starting at DDR_ADDRESS.
642+ * DDR_SIZE may exceed 32-bit range (e.g. 8GB), so use the LAW-mapped
643+ * size to ensure bootpg fits in 32 bits and is accessible. */
644+ bootpg = DDR_ADDRESS + 0x80000000UL - BOOT_ROM_SIZE ;
656645
657646 /* Store the boot page address for use by additional CPU cores */
658647 _bootpg_addr = (uint32_t )& _second_half_boot_page ;
659648
660649 /* Store location of spin table for other cores */
661- _spin_table_addr = (uint32_t )& _spin_table ;
650+ _spin_table_addr = (uint32_t )_spin_table ;
662651
663652 /* Flush bootpg before copying to invalidate any stale cache lines */
664653 flush_cache (bootpg , BOOT_ROM_SIZE );
@@ -748,7 +737,7 @@ int hal_dts_fixup(void* dts_addr)
748737 #ifdef ENABLE_MP
749738 /* calculate location of spin table for core */
750739 core_spin_table = (uint64_t )((uintptr_t )(
751- (uint8_t * )& _spin_table + (core * ENTRY_SIZE )));
740+ (uint8_t * )_spin_table + (core * ENTRY_SIZE )));
752741
753742 fdt_fixup_str (fdt , off , "cpu" , "status" , (core == 0 ) ? "okay" : "disabled" );
754743 fdt_fixup_val64 (fdt , off , "cpu" , "cpu-release-addr" , core_spin_table );
0 commit comments