Skip to content

Commit 810f49c

Browse files
committed
NXP T2080 Port Refresh
1 parent 5b43fcc commit 810f49c

File tree

6 files changed

+636
-434
lines changed

6 files changed

+636
-434
lines changed

arch.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,13 @@ ifeq ($(ARCH),PPC)
633633
CFLAGS+=-fno-builtin-printf
634634
endif
635635

636+
# Target-specific CPU flags
637+
ifeq ($(TARGET),nxp_t2080)
638+
CFLAGS+=-mcpu=e6500 -mno-altivec
639+
else ifeq ($(TARGET),nxp_t1024)
640+
CFLAGS+=-mcpu=e5500
641+
endif
642+
636643
# Prune unused functions and data
637644
CFLAGS+=-ffunction-sections -fdata-sections
638645
LDFLAGS+=-Wl,--gc-sections

hal/nxp_ppc.h

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
#define USE_LONG_JUMP
102102

103103
#elif defined(TARGET_nxp_t2080)
104-
/* NXP T0280 */
104+
/* NXP T2080 */
105105
#define CORE_E6500
106106
#define CPU_NUMCORES 4
107107
#define CORES_PER_CLUSTER 4
@@ -118,13 +118,16 @@
118118
#define ENABLE_L1_CACHE
119119
#define ENABLE_L2_CACHE
120120

121-
#define L2SRAM_ADDR (0xF8F80000UL) /* L2 as SRAM */
122-
#define L2SRAM_SIZE (256UL * 1024UL)
121+
#define L2SRAM_ADDR (0xF8F00000UL) /* CPC as SRAM (1MB) */
122+
#define L2SRAM_SIZE (1024UL * 1024UL)
123123

124124
#define INITIAL_SRAM_ADDR L2SRAM_ADDR
125-
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_256KB
125+
/* CPC SRAM transactions traverse the CoreNet interconnect, which
126+
* requires a LAW to route them. LAW_TRGT_DDR_1 is used as a routing
127+
* target; the CPC intercepts the transaction before it reaches DDR. */
128+
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_1MB
126129
#define INITIAL_SRAM_LAW_TRGT LAW_TRGT_DDR_1
127-
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_256K
130+
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_1M
128131

129132
#define ENABLE_INTERRUPTS
130133

@@ -285,20 +288,23 @@
285288
#define CPC_BASE (CCSRBAR + 0x10000)
286289
/* 8.2 CoreNet Platform Cache (CPC) Memory Map */
287290
#define CPCCSR0 (0x000)
291+
#define CPCEWCR0 (0x010)
288292
#define CPCSRCR1 (0x100)
289293
#define CPCSRCR0 (0x104)
294+
#define CPCERRDIS (0xE44)
290295
#define CPCHDBCR0 (0xF00)
291296

292297
#define CPCCSR0_CPCE (0x80000000 >> 0)
293298
#define CPCCSR0_CPCPE (0x80000000 >> 1)
294299
#define CPCCSR0_CPCFI (0x80000000 >> 10)
300+
#define CPCCSR0_CPCFL (0x80000000 >> 20)
295301
#define CPCCSR0_CPCLFC (0x80000000 >> 21)
296-
#define CPCCSR0_SRAM_ENABLE (CPCCSR0_CPCE | CPCCSR0_CPCPE)
297302

298303
#ifdef CORE_E6500
299-
#define CPCSRCR0_SRAMSZ_64 (0x1 << 1) /* ways 14-15 */
300-
#define CPCSRCR0_SRAMSZ_256 (0x3 << 1) /* ways 8-15 */
301-
#define CPCSRCR0_SRAMSZ_512 (0x4 << 1) /* ways 0-15 */
304+
/* T2080: 2MB CPC, 16 ways, 128KB per way */
305+
#define CPCSRCR0_SRAMSZ_256 (0x1 << 1) /* ways 14-15, 256KB */
306+
#define CPCSRCR0_SRAMSZ_1024 (0x3 << 1) /* ways 8-15, 1MB */
307+
#define CPCSRCR0_SRAMSZ_2048 (0x4 << 1) /* ways 0-15, 2MB */
302308
#else /* CORE E5500 */
303309
#define CPCSRCR0_SRAMSZ_64 (0x1 << 1) /* ways 6-7 */
304310
#define CPCSRCR0_SRAMSZ_128 (0x2 << 1) /* ways 4-7 */
@@ -483,13 +489,21 @@
483489

484490
#define SPRN_DBSR 0x130 /* Debug Status Register */
485491
#define SPRN_DEC 0x016 /* Decrement Register */
486-
#define SPRN_TSR 0x3D8 /* Timer Status Register */
487492

488-
#define SPRN_TCR 0x3DA /* Timer Control Register */
493+
#ifdef CORE_E6500
494+
#define SPRN_TSR 0x150 /* Timer Status Register (SPR 336) */
495+
#define SPRN_TCR 0x154 /* Timer Control Register (SPR 340) */
496+
#define SPRN_DEAR 0x03D /* Data Exception Address Register (SPR 61) */
497+
#define SPRN_ESR 0x03E /* Exception Syndrome Register (SPR 62) */
498+
#else
499+
#define SPRN_TSR 0x3D8 /* Timer Status Register */
500+
#define SPRN_TCR 0x3DA /* Timer Control Register */
501+
#define SPRN_DEAR 0x3D5 /* Data Exception Address Register */
502+
#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
503+
#endif
504+
489505
#define TCR_WIE 0x08000000 /* Watchdog Interrupt Enable */
490506
#define TCR_DIE 0x04000000 /* Decrement Interrupt Enable */
491-
492-
#define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
493507
#define SPRN_MCSR 0x23C /* Machine Check Syndrome Register */
494508
#define SPRN_PVR 0x11F /* Processor Version */
495509
#define SPRN_SVR 0x3FF /* System Version */
@@ -524,6 +538,8 @@
524538

525539
#define SRR0 0x01A /* Save/Restore Register 0 */
526540
#define SRR1 0x01B /* Save/Restore Register 1 */
541+
#define SPRN_MCSRR0 0x23A /* Machine Check Save/Restore Register 0 */
542+
#define SPRN_MCSRR1 0x23B /* Machine Check Save/Restore Register 1 */
527543

528544
#define MSR_DS (1<<4) /* Book E Data address space */
529545
#define MSR_IS (1<<5) /* Book E Instruction address space */
@@ -674,6 +690,31 @@ extern void dcache_disable(void);
674690

675691
#else
676692
/* Assembly version */
693+
#ifdef CORE_E6500
694+
/* e6500 has 64-bit MAS registers - must clear upper 32 bits */
695+
#define set_tlb(tlb, esel, epn, rpn, urpn, perms, winge, ts, tsize, iprot, reg) \
696+
lis reg, BOOKE_MAS0(tlb, esel, 0)@h; \
697+
ori reg, reg, BOOKE_MAS0(tlb, esel, 0)@l; \
698+
mtspr MAS0, reg;\
699+
lis reg, BOOKE_MAS1(1, iprot, 0, ts, tsize)@h; \
700+
ori reg, reg, BOOKE_MAS1(1, iprot, 0, ts, tsize)@l; \
701+
mtspr MAS1, reg; \
702+
li reg, 0; \
703+
oris reg, reg, BOOKE_MAS2(epn, winge)@h; \
704+
ori reg, reg, BOOKE_MAS2(epn, winge)@l; \
705+
mtspr MAS2, reg; \
706+
lis reg, BOOKE_MAS3(rpn, 0, perms)@h; \
707+
ori reg, reg, BOOKE_MAS3(rpn, 0, perms)@l; \
708+
mtspr MAS3, reg; \
709+
lis reg, urpn@h; \
710+
ori reg, reg, urpn@l; \
711+
mtspr MAS7, reg; \
712+
isync; \
713+
msync; \
714+
tlbwe; \
715+
isync;
716+
#else
717+
/* e500/e5500 - 32-bit MAS registers */
677718
#define set_tlb(tlb, esel, epn, rpn, urpn, perms, winge, ts, tsize, iprot, reg) \
678719
lis reg, BOOKE_MAS0(tlb, esel, 0)@h; \
679720
ori reg, reg, BOOKE_MAS0(tlb, esel, 0)@l; \
@@ -694,6 +735,7 @@ extern void dcache_disable(void);
694735
msync; \
695736
tlbwe; \
696737
isync;
738+
#endif /* CORE_E6500 */
697739

698740
/* readability helpers for assembly to show register versus decimal */
699741
#define r0 0

0 commit comments

Comments
 (0)