Skip to content

Commit 0f7c9c5

Browse files
committed
Fixes for NXP T2080 documentation and CSSRBAR (ZD 20843)
1 parent 2aef0ed commit 0f7c9c5

File tree

5 files changed

+128
-48
lines changed

5 files changed

+128
-48
lines changed

docs/Targets.md

Lines changed: 83 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4009,16 +4009,28 @@ Flash factory_custom.bin to NOR base 0xE800_0000
40094009

40104010
## NXP QorIQ T2080 PPC
40114011

4012-
The NXP QorIQ T2080 is a PPC e6500 based processor (four cores). Support has been tested with the NAII 68PPC2.
4012+
The NXP QorIQ T2080 is a PPC e6500 based processor (four cores). Three board
4013+
variants are supported:
4014+
4015+
| Board | Config Define | Oscillator | DDR | NOR Flash |
4016+
|-------|---------------|-----------|-----|-----------|
4017+
| T2080 RDB (default) | _(none)_ | 66.66 MHz | DDR3L SODIMM | 128 MB @ `0xE8000000` |
4018+
| Curtiss-Wright VPX3-152 | `BOARD_CW_VPX3152` | 66.667 MHz | 4 GB DDR3L | 256 MB @ `0xF0000000` |
4019+
| NAII 68PPC2 | `BOARD_NAII_68PPC2` | 100 MHz | 8 GB DDR3 | 128 MB @ `0xE8000000` |
4020+
4021+
> **Note:** The T2080 RDB DDR register values are placeholder stubs (all zeros
4022+
> with TODO comments in `hal/nxp_t2080.h`). DDR initialization will not succeed
4023+
> until you populate them from a U-Boot register dump. The NAII 68PPC2 and
4024+
> CW VPX3-152 DDR configs are populated and tested.
40134025
40144026
Example configuration: [/config/examples/nxp-t2080.config](/config/examples/nxp-t2080.config).
4015-
Stock layout is default; for NAII 68PPC2, uncomment the "# NAII 68PPC2:" lines and comment the stock lines.
4027+
See [Board Selection](#board-selection) below for per-board setup.
40164028

40174029
### Design NXP T2080 PPC
40184030

4019-
The QorIQ requires a Reset Configuration Word (RCW) to define the boot parameters, which resides at the start of the flash (0xE8000000).
4031+
The QorIQ requires a Reset Configuration Word (RCW) to define the boot parameters, which resides at the start of the flash (`0xE8000000` for 128 MB boards, `0xF0000000` for the 256 MB CW VPX3-152).
40204032

4021-
The flash boot entry point is `0xEFFFFFFC`, which is an offset jump to wolfBoot initialization boot code. Initially the PowerPC core enables only a 4KB region to execute from. The initialization code (`src/boot_ppc_start.S`) sets the required CCSR and TLB for memory addressing and jumps to wolfBoot `main()`.
4033+
The flash boot entry point is the last 4 bytes of the NOR flash region (`0xEFFFFFFC` for 128 MB flash, `0xFFFFFFFC` for 256 MB flash), which is an offset jump to wolfBoot initialization boot code. Initially the PowerPC core enables only a 4KB region to execute from. The initialization code (`src/boot_ppc_start.S`) sets the required CCSR and TLB for memory addressing and jumps to wolfBoot `main()`.
40224034

40234035
#### Boot Sequence and Hardware Constraints
40244036

@@ -4041,7 +4053,7 @@ CPC SRAM is unreliable for stores on cold power-on — L1 dirty-line evictions
40414053
through CoreNet to CPC cause bus errors (silent CPU checkstop with `MSR[ME]=0`).
40424054
The fix (matching U-Boot) uses L1 locked D-cache as the initial 16KB stack:
40434055
`dcbz` allocates cache lines without bus reads, `dcbtls` locks them so they
4044-
are never evicted. The locked lines at `L1_CACHE_ADDR` (0xF8E00000) are
4056+
are never evicted. The locked lines at `L1_CACHE_ADDR` (`0xF8E00000`; `0xEE800000` on VPX3-152) are
40454057
entirely core-local. After DDR init in `hal_init()`, the stack relocates to
40464058
DDR and the CPC switches from SRAM to L3 cache mode.
40474059

@@ -4052,9 +4064,16 @@ boot, allowing L1 I-cache to cache instruction fetches while preventing
40524064
speculative prefetch to the IFC. C code switches to `MAS2_I | MAS2_G` during
40534065
flash write/erase (command mode), then `MAS2_M` for full caching afterward.
40544066

4067+
**CCSRBAR Relocation (CW VPX3-152 only)**
4068+
4069+
The default CCSRBAR at `0xFE000000` (16 MB) falls within the VPX3-152's 256 MB
4070+
flash VA range (`0xF0000000``0xFFFFFFFF`). The startup assembly relocates
4071+
CCSRBAR to `0xEF000000` (just below flash). The CPC SRAM and L1 cache addresses
4072+
are also relocated to `0xEE900000`/`0xEE800000` to avoid overlap.
4073+
40554074
**RAMFUNCTION Constraints**
40564075

4057-
The NAII 68PPC2 NOR flash (two S29GL01GS x8 in parallel, 16-bit bus) enters
4076+
The NOR flash (two S29GL01GS x8 in parallel, 16-bit bus) enters
40584077
command mode bank-wide — instruction fetches during program/erase return status
40594078
data instead of code. All flash write/erase functions are marked `RAMFUNCTION`,
40604079
placed in `.ramcode`, copied to DDR, and remapped via TLB9. Key rules:
@@ -4094,30 +4113,38 @@ machine check (exceptions instead of checkstop), debug, and recoverable
40944113
interrupt enable. Branch prediction (BUCSR) is deferred to `hal_init()` after
40954114
DDR stack relocation.
40964115

4097-
**UART Debug Checkpoints (`DEBUG_UART=1`)**
4116+
### Building wolfBoot for NXP T2080 PPC
4117+
4118+
By default wolfBoot will use `powerpc-linux-gnu-` cross-compiler prefix. These tools can be installed with the Debian package `gcc-powerpc-linux-gnu` (`sudo apt install gcc-powerpc-linux-gnu`).
4119+
4120+
#### Board Selection
40984121

4099-
Assembly startup emits characters to UART0 (0xFE11C500, 115200 baud):
4122+
Copy the example config and select your board:
41004123

4124+
**T2080 RDB (default):**
41014125
```
4102-
1 - CPC invalidate start A - L2 cluster enable start
4103-
2 - CPC invalidate done B - L2 cluster enabled
4104-
3 - CPC SRAM configured E - L1 cache setup
4105-
4 - SRAM LAW configured F - L1 I-cache enabled
4106-
5 - Flash TLB configured G - L1 D-cache enabled
4107-
6 - CCSRBAR TLB configured D - Stack ready (L1 locked cache)
4108-
7 - SRAM TLB configured Z - About to jump to C code
4109-
8 - CPC enabled
4126+
cp ./config/examples/nxp-t2080.config .config
41104127
```
41114128

4112-
### Building wolfBoot for NXP T2080 PPC
4129+
**Curtiss-Wright VPX3-152:**
4130+
```
4131+
cp ./config/examples/nxp-t2080.config .config
4132+
```
4133+
Then in `.config`, uncomment `CFLAGS_EXTRA+=-DBOARD_CW_VPX3152` and all lines
4134+
marked with `# CW VPX3-152` (flash offset, SRAM address, origin, partition addresses,
4135+
DTS addresses).
41134136

4114-
By default wolfBoot will use `powerpc-linux-gnu-` cross-compiler prefix. These tools can be installed with the Debian package `gcc-powerpc-linux-gnu` (`sudo apt install gcc-powerpc-linux-gnu`).
4137+
**NAII 68PPC2:**
4138+
```
4139+
cp ./config/examples/nxp-t2080.config .config
4140+
```
4141+
Then in `.config`, uncomment `CFLAGS_EXTRA+=-DBOARD_NAII_68PPC2`.
4142+
4143+
#### Build
41154144

4116-
The `make` creates a `factory.bin` image that can be programmed at `0xE8080000`
4117-
(For NAII 68PPC2, first edit `nxp-t2080.config` to uncomment the NAII 68PPC2 lines.)
4145+
The `make` creates a `factory.bin` image that can be programmed to the application partition address.
41184146

41194147
```
4120-
cp ./config/examples/nxp-t2080.config .config
41214148
make clean
41224149
make keytools
41234150
make
@@ -4146,19 +4173,31 @@ CROSS_COMPILE_PATH=/opt/fsl-qoriq/2.0/sysroots/ppce6500-fsl-linux/usr
41464173

41474174
### Programming NXP T2080 PPC
41484175

4149-
NOR Flash Region: `0xE8000000 - 0xEFFFFFFF` (128 MB)
4176+
NOR Flash Regions:
4177+
- **T2080 RDB / NAII 68PPC2**: `0xE8000000 - 0xEFFFFFFF` (128 MB)
4178+
- **CW VPX3-152**: `0xF0000000 - 0xFFFFFFFF` (256 MB)
41504179

4151-
Flash Layout (with files):
4180+
Flash Layout (T2080 RDB / NAII 68PPC2, 128 MB flash):
41524181

41534182
| Description | File | Address |
41544183
| ----------- | ---- | ------- |
4155-
| Reset Configuration Word (RCW) | `68PPC2_RCW_v0p7.bin` | `0xE8000000` |
4184+
| Reset Configuration Word (RCW) | _(board-specific)_ | `0xE8000000` |
41564185
| Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xE8020000` |
41574186
| Signed Application | `test-app/image_v1_signed.bin` | `0xE8080000` |
4158-
| wolfBoot | `wolfboot.bin` | `0xEFF40000` |
4159-
| Boot Entry Point (with offset jump to init code) | | `0xEFFFFFFC` |
4187+
| wolfBoot | `wolfboot.bin` | `0xEFFE0000` |
4188+
| Boot Entry Point (offset jump to init code) | | `0xEFFFFFFC` |
4189+
4190+
Flash Layout (CW VPX3-152, 256 MB flash):
4191+
4192+
| Description | File | Address |
4193+
| ----------- | ---- | ------- |
4194+
| Reset Configuration Word (RCW) | _(board-specific)_ | `0xF0000000` |
4195+
| Frame Manager Microcode | `fsl_fman_ucode_t2080_r1.0.bin` | `0xF0020000` |
4196+
| Signed Application | `test-app/image_v1_signed.bin` | `0xF0080000` |
4197+
| wolfBoot | `wolfboot.bin` | `0xFFFE0000` |
4198+
| Boot Entry Point (offset jump to init code) | | `0xFFFFFFFC` |
41604199

4161-
Or program the `factory.bin` to `0xE8080000`
4200+
Or program the `factory.bin` to the application partition address.
41624201

41634202
Example Boot Debug Output (with `DEBUG_UART=1`):
41644203

@@ -4197,11 +4236,11 @@ See these TRACE32 demo script files:
41974236
```
41984237
DO flash_cfi.cmm
41994238
4200-
FLASH.ReProgram 0xEFF40000--0xEFFFFFFF /Erase
4201-
Data.LOAD.binary wolfboot.bin 0xEFF40000
4239+
FLASH.ReProgram 0xEFFE0000--0xEFFFFFFF /Erase
4240+
Data.LOAD.binary wolfboot.bin 0xEFFE0000
42024241
FLASH.ReProgram.off
42034242
4204-
Data.LOAD.binary wolfboot.bin 0xEFF40000 /Verify
4243+
Data.LOAD.binary wolfboot.bin 0xEFFE0000 /Verify
42054244
```
42064245

42074246
Note: To disable the flash protection bits use:
@@ -4219,7 +4258,11 @@ Data.Set 0xE8000000 %W 0x9090
42194258
Data.Set 0xE8000000 %W 0x0000
42204259
```
42214260

4222-
#### Flash Programming with CodeWarrior TAP
4261+
#### Flash Programming with CodeWarrior TAP (Experimental)
4262+
4263+
> **Note:** CodeWarrior TAP debugging has not been validated for this target.
4264+
> Lauterbach TRACE32 is the recommended debug probe. The following steps are
4265+
> provided for reference only.
42234266
42244267
In CodeWarrior use the `Flash Programmer` tool (see under Commander View -> Miscellaneous)
42254268
* Connection: "CodeWarrior TAP Connection"
@@ -4231,11 +4274,11 @@ In CodeWarrior use the `Flash Programmer` tool (see under Commander View -> Misc
42314274

42324275
```
42334276
tftp 1000000 wolfboot.bin
4234-
protect off eff40000 +C0000
4235-
erase eff40000 +C0000
4236-
cp.b 1000000 eff40000 C0000
4237-
protect on eff40000 +C0000
4238-
cmp.b 1000000 eff40000 C0000
4277+
protect off effe0000 +20000
4278+
erase effe0000 +20000
4279+
cp.b 1000000 effe0000 20000
4280+
protect on effe0000 +20000
4281+
cmp.b 1000000 effe0000 20000
42394282
```
42404283

42414284
### Debugging NXP T2080 PPC
@@ -4265,9 +4308,11 @@ sYmbol.SourcePATH.SetBaseDir ~/wolfBoot
42654308
Data.LOAD.Elf wolfboot.elf /NoCODE /StripPART "/home/username/wolfBoot/"
42664309
```
42674310

4268-
#### CodeWarrior TAP
4311+
#### CodeWarrior TAP (Experimental)
42694312

4270-
This is an example for debugging the T2080 with CodeWarrior TAP, however we were not successful using it. The Lauterbach is what we ended up using to debug.
4313+
> **Note:** CodeWarrior TAP debugging has not been validated for this target.
4314+
> Lauterbach TRACE32 is the recommended debug probe. The following steps are
4315+
> provided for reference only.
42714316
42724317
Start GDB Proxy:
42734318

hal/nxp_t2080.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ static void hal_reconfigure_cpc_as_cache(void)
300300
*dst++ = *src++;
301301
}
302302

303+
/* Ensure all stores have drained before flushing cache lines */
304+
__asm__ __volatile__("sync" ::: "memory");
305+
303306
/* Flush D-cache and invalidate I-cache for the DDR copy */
304307
flush_cache(DDR_RAMCODE_ADDR, ramcode_size);
305308

@@ -663,6 +666,13 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
663666
int ret = 0;
664667
uint32_t i, sector, offset, nwords;
665668
const uint32_t width_bytes = FLASH_CFI_WIDTH / 8;
669+
uint32_t addr_off = address;
670+
671+
/* Bounds check */
672+
if (addr_off >= FLASH_BASE_ADDR)
673+
addr_off -= FLASH_BASE_ADDR;
674+
if (addr_off + (uint32_t)len > FLASH_BANK_SIZE)
675+
return -1;
666676

667677
/* Enforce alignment to flash bus width */
668678
if ((address % width_bytes) != 0 || (len % width_bytes) != 0) {
@@ -741,6 +751,13 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len)
741751
{
742752
int ret = 0;
743753
uint32_t sector;
754+
uint32_t addr_off = address;
755+
756+
/* Bounds check */
757+
if (addr_off >= FLASH_BASE_ADDR)
758+
addr_off -= FLASH_BASE_ADDR;
759+
if (addr_off + (uint32_t)len > FLASH_BANK_SIZE)
760+
return -1;
744761

745762
/* adjust for flash base */
746763
if (address >= FLASH_BASE_ADDR)
@@ -848,7 +865,7 @@ extern uint32_t _bootpg_addr;
848865
static void hal_mp_up(uint32_t bootpg, uint32_t spin_table_ddr)
849866
{
850867
uint32_t all_cores, active_cores, whoami;
851-
int timeout = 50, i;
868+
int timeout = 10000, i; /* 10000 * 100us = 1s, matches U-Boot convention */
852869

853870
whoami = get32(PIC_WHOAMI); /* Get current running core number */
854871
all_cores = ((1 << CPU_NUMCORES) - 1); /* mask of all cores */
@@ -990,7 +1007,8 @@ static void hal_mp_init(void)
9901007

9911008
void hal_prepare_boot(void)
9921009
{
993-
1010+
/* Intentionally empty: pre-boot cleanup (cache flush, interrupt disable)
1011+
* is handled by boot_ppc.c:do_boot(). */
9941012
}
9951013

9961014
#ifdef MMU

hal/nxp_t2080.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,12 @@ enum ifc_amask_sizes {
395395
#define DDR_ERR_INT_EN_VAL 0x0000001D
396396
#define DDR_ERR_SBE_VAL 0x00010000
397397
#else
398-
/* T2080 RDB: DDR register values */
398+
/* T2080 RDB DDR register values are not yet populated.
399+
* To complete this, boot U-Boot on T2080 RDB and run the register dump
400+
* commands below, then replace the 0x00000000 placeholders with actual values. */
401+
#ifdef ENABLE_DDR
402+
#error "T2080 RDB DDR register values not populated. See TODO comments in nxp_t2080.h. Define BOARD_CW_VPX3152 or BOARD_NAII_68PPC2, or fill in DDR values from a U-Boot register dump."
403+
#endif
399404
/* TODO: Fill ALL values from Phase 1 U-Boot register dump:
400405
* md.l 0xfe008000 4; md.l 0xfe008010 4 (CS BNDS)
401406
* md.l 0xfe008080 4; md.l 0xfe0080c0 4 (CS CONFIG)

src/boot_ppc_mp.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ branch_prediction:
119119
mr r4, r0
120120
mr r5, r4
121121
#endif
122-
slwi r8, r5, 6 /* spin table is padded to 64 bytes */
122+
slwi r8, r5, 6 /* multiply by ENTRY_SIZE (64 bytes) */
123123
/* use r10 for the spin table base address */
124124
add r10, r3, r8
125125

@@ -268,7 +268,7 @@ _second_half_boot_page:
268268
li r8, 3
269269
stw r8, ENTRY_ADDR_LOWER(r10)
270270

271-
/* mask branch address (64MB) to setup tlb */
271+
/* Align branch address to 64MB boundary for TLB mapping below */
272272
rlwinm r12, r4, 0, 0, 5
273273

274274
/* setup registers before jump */
@@ -280,7 +280,7 @@ _second_half_boot_page:
280280
li r4, 0
281281
li r5, 0
282282
li r6, 0
283-
lis r7, (64 * 1024 * 1024)@h
283+
lis r7, (64 * 1024 * 1024)@h /* r7 = IMA size (64MB per ePAPR) */
284284
li r8, 0
285285
li r9, 0
286286

@@ -309,7 +309,7 @@ _second_half_boot_page:
309309
rfi
310310

311311
/* Reserve space for spin table entries */
312-
.align 6 /* 64-bytes */
312+
.align 6 /* 64-byte alignment for spin table entries (ENTRY_SIZE) */
313313
.globl _spin_table
314314
_spin_table:
315315
.space CPU_NUMCORES * ENTRY_SIZE

src/boot_ppc_start.S

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,26 @@ setup_interrupts:
341341
ori r9, r9, (CCSRBAR + 0x1000)@l
342342

343343
create_temp_ccsr:
344-
/* Create a temporary TLB entry for new and old location */
345-
/* CCSRBAR: TLB 0, Entry 0, Supervisor R/W, IG, TS=0, 4KB */
344+
/* Create temporary TLB0 entries for CCSRBAR relocation.
345+
*
346+
* TLB0 on e6500 is 4-way set-associative (2048 entries, 512 sets).
347+
* The "esel" parameter selects the WAY within a set; the SET is
348+
* determined by the virtual address (EPN). These two entries map
349+
* different EPNs (CCSRBAR vs CCSRBAR+0x1000), so they fall in
350+
* different TLB0 sets and do not overwrite each other.
351+
*
352+
* We use different ways (0 and 1) for visual clarity. Both entries
353+
* are cleaned up by the TLB0 flash-invalidate (MMUCSR0) after
354+
* relocation completes. */
355+
356+
/* CCSRBAR new location: TLB0 Way 0, Supervisor R/W, IG, TS=0, 4KB */
346357
set_tlb(0, 0,
347358
CCSRBAR, CCSRBAR, CCSRBAR_PHYS_HIGH,
348359
MAS3_SR | MAS3_SW, MAS2_I | MAS2_G, 0,
349360
BOOKE_PAGESZ_4K, 0, r3);
350361

351-
set_tlb(0, 0,
362+
/* CCSRBAR old location: TLB0 Way 1, Supervisor R/W, IG, TS=0, 4KB */
363+
set_tlb(0, 1,
352364
CCSRBAR + 0x1000, CCSRBAR_DEF, 0,
353365
MAS3_SR | MAS3_SW, MAS2_I | MAS2_G, 0,
354366
BOOKE_PAGESZ_4K, 0, r3);

0 commit comments

Comments
 (0)