Skip to content

Commit 3a72cd8

Browse files
committed
Peer review fixes
1 parent b59649a commit 3a72cd8

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

config/examples/nxp-t2080.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ OPTIMIZATION_LEVEL?=1
3838
# NOR Base Address
3939
ARCH_FLASH_OFFSET?=0xEFFE0000
4040

41-
# Flash Sector Size
42-
WOLFBOOT_SECTOR_SIZE?=0x10000
41+
# Flash Sector Size (must match physical NOR erase block: 128 KB)
42+
WOLFBOOT_SECTOR_SIZE?=0x20000
4343

4444
# wolfBoot start address
4545
WOLFBOOT_ORIGIN?=0xEFFE0000

docs/Targets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3266,7 +3266,7 @@ Build: Feb 27 2026 12:27:15
32663266
IFC CSPR0: 0x141 (WP set)
32673267
DDR Test: PASSED
32683268
Ramcode: copied 5584 bytes to DDR, TLB9 remapped
3269-
CPC: Released SRAM, full 2MB L2 cache enabled
3269+
CPC: Released SRAM, full 2MB L3 CPC cache enabled
32703270
Flash: caching enabled (L1+L2+CPC)
32713271
MP: Starting cores (boot page 0x7FFFF000, spin table 0x7FFFE100)
32723272
Internal flash test at 0xEFFA0000

hal/nxp_t2080.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,13 @@ static int RAMFUNCTION hal_flash_status_wait(uint32_t sector, uint32_t timeout_u
590590
uint32_t timeout = 0;
591591
uint16_t read1, read2;
592592

593-
/* Replicate 8-bit AMD toggle bit to both bytes for parallel chips */
593+
/* Replicate 8-bit AMD toggle/error bits to both bytes for parallel chips */
594594
#if FLASH_CFI_WIDTH == 16
595595
uint16_t toggle16 = (AMD_STATUS_TOGGLE << 8) | AMD_STATUS_TOGGLE;
596+
uint16_t error16 = (AMD_STATUS_ERROR << 8) | AMD_STATUS_ERROR;
596597
#else
597598
uint16_t toggle16 = AMD_STATUS_TOGGLE;
599+
uint16_t error16 = AMD_STATUS_ERROR;
598600
#endif
599601

600602
do {
@@ -618,7 +620,7 @@ static int RAMFUNCTION hal_flash_status_wait(uint32_t sector, uint32_t timeout_u
618620
if (((read1 ^ read2) & toggle16) == 0)
619621
break;
620622
/* Check DQ5 (error) on both chips while still toggling */
621-
if (read1 & ((AMD_STATUS_ERROR << 8) | AMD_STATUS_ERROR)) {
623+
if (read1 & error16) {
622624
/* Read one more time to confirm it's not a false DQ5 */
623625
#if FLASH_CFI_WIDTH == 16
624626
read1 = FLASH_IO16_READ(sector, 0);
@@ -811,6 +813,10 @@ extern uint32_t _secondary_start_page;
811813
extern uint32_t _second_half_boot_page;
812814
extern uint32_t _spin_table[];
813815
extern uint32_t _spin_table_addr;
816+
817+
/* DDR address of the spin table, set during hal_mp_init() and reused in
818+
* hal_dts_fixup() for cpu-release-addr fixups. */
819+
static uint32_t g_spin_table_ddr = 0;
814820
extern uint32_t _bootpg_addr;
815821

816822
/* Startup additional cores with spin table and synchronize the timebase.
@@ -950,6 +956,9 @@ static void hal_mp_init(void)
950956
}
951957
flush_cache(second_half_ddr, BOOT_ROM_SIZE);
952958

959+
/* Persist DDR spin-table base for use in hal_dts_fixup() */
960+
g_spin_table_ddr = spin_table_ddr;
961+
953962
/* start cores and wait for them to be enabled */
954963
hal_mp_up(bootpg, spin_table_ddr);
955964
}
@@ -1021,9 +1030,11 @@ int hal_dts_fixup(void* dts_addr)
10211030
}
10221031

10231032
#ifdef ENABLE_MP
1024-
/* calculate location of spin table for core */
1025-
core_spin_table = (uint64_t)((uintptr_t)(
1026-
(uint8_t*)_spin_table + (core * ENTRY_SIZE)));
1033+
/* Calculate DDR address of this core's spin table entry.
1034+
* Must use g_spin_table_ddr (the DDR copy), NOT _spin_table which
1035+
* is the flash/VMA address — Linux writes the release word to this
1036+
* address, and XIP flash is read-only. */
1037+
core_spin_table = (uint64_t)(g_spin_table_ddr + (core * ENTRY_SIZE));
10271038

10281039
fdt_fixup_str(fdt, off, "cpu", "status", (core == 0) ? "okay" : "disabled");
10291040
fdt_fixup_val64(fdt, off, "cpu", "cpu-release-addr", core_spin_table);

0 commit comments

Comments
 (0)