Skip to content

Commit 8521f6b

Browse files
committed
Progress trying to fix power on issues with L2 cache
1 parent 246b8d2 commit 8521f6b

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

hal/nxp_ppc.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,20 @@
186186
#define CCSRBAR_PHYS_HIGH 0
187187
#endif
188188

189+
/* Early C UART checkpoint helper — uses UART0 already initialized by ASM.
190+
* Safe to call as soon as TLB for CCSR is live (i.e. anywhere in C boot). */
191+
#if defined(DEBUG_UART) && defined(TARGET_nxp_t2080)
192+
static inline void uart_putc_early(char c)
193+
{
194+
volatile uint8_t *lsr = (volatile uint8_t *)(CCSRBAR + 0x11C505UL);
195+
volatile uint8_t *thr = (volatile uint8_t *)(CCSRBAR + 0x11C500UL);
196+
while (!(*lsr & 0x20)) {} /* poll THRE */
197+
*thr = (uint8_t)c;
198+
}
199+
#else
200+
static inline void uart_putc_early(char c) { (void)c; }
201+
#endif
202+
189203
/* DDR */
190204
#ifndef DDR_ADDRESS
191205
#define DDR_ADDRESS 0x00000000UL

hal/nxp_t2080.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,15 @@ void hal_ddr_init(void)
235235
#ifdef ENABLE_DDR
236236
uint32_t reg;
237237

238+
uart_putc_early('Q'); /* checkpoint Q: entered hal_ddr_init */
239+
238240
/* Map LAW for DDR */
239241
set_law(4, 0, DDR_ADDRESS, LAW_TRGT_DDR_1, LAW_SIZE_2GB, 0);
240242

241243
/* If DDR is already enabled then just return */
242244
reg = get32(DDR_SDRAM_CFG);
243245
if (reg & DDR_SDRAM_CFG_MEM_EN) {
246+
uart_putc_early('X'); /* DDR already enabled (Lauterbach?) — early return */
244247
return;
245248
}
246249

@@ -313,11 +316,15 @@ void hal_ddr_init(void)
313316
set32(DDR_SDRAM_CFG, reg | DDR_SDRAM_CFG_MEM_EN);
314317
__asm__ __volatile__("sync;isync");
315318

319+
uart_putc_early('R'); /* checkpoint R: DDR MEM_EN set, polling D_INIT */
320+
316321
/* Wait for data initialization to complete */
317322
while (get32(DDR_SDRAM_CFG_2) & DDR_SDRAM_CFG_2_D_INIT) {
318323
/* busy wait loop - throttle polling */
319324
udelay(10000);
320325
}
326+
327+
uart_putc_early('S'); /* checkpoint S: DDR D_INIT complete */
321328
#endif /* ENABLE_DDR */
322329
}
323330

src/boot_ppc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ void boot_entry_C(void)
128128
volatile const unsigned int *src;
129129
volatile unsigned int *end;
130130

131+
uart_putc_early('I'); /* checkpoint I: entered boot_entry_C */
132+
131133
/* Copy .ramcode section FIRST - to CPC SRAM which is already available.
132134
* This makes RAMFUNCTION code (memcpy, memmove) available before DDR.
133135
* Use volatile to prevent compiler from transforming to memcpy call. */
@@ -149,9 +151,13 @@ void boot_entry_C(void)
149151
}
150152
#endif
151153

154+
uart_putc_early('J'); /* checkpoint J: .ramcode done, entering hal_early_init */
155+
152156
/* Now initialize DDR and other hardware */
153157
hal_early_init();
154158

159+
uart_putc_early('K'); /* checkpoint K: hal_early_init returned */
160+
155161
/* Copy the .data section from flash to DDR.
156162
* Use volatile to prevent the compiler from transforming this loop
157163
* into a memcpy() call. */

0 commit comments

Comments
 (0)