Virtex-4 FX12 Mini-Module support
Hi All,
I'm using the UQ powerpc uclinux code on the
Memec Virtex-4 FX12 Mini-Module Development Kit.
I have attached a patch with our modifications:
- switch to set cache policy (OFF, WriteThru, WriteBack)
- switch to enable PPC405 CPU_213 errata workaround
- cosmetic update to cputable
- view ccr0 register in /proc/cpu
The patch is against:
http://www.itee.uq.edu.au/~pml/uclinux_powerpc/linuxppc-2.4-20051021.tgz
The specific modules/chips we're using have a silicon bug, See the euphemistically named "Solution 13:"
http://www.xilinx.com/xlnx/xil_ans_display.jsp?iLanguageID=1&iCountryID=1&getPagePath=20658
The board boots and runs reliably with the caches OFF. WriteThru and WriteBack caching cause memory corruption and this is why we implemented the cache policy switch.
regards
aidan
____
:wq!
Index: arch/ppc/config.in
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/config.in,v retrieving revision 1.1.1.1
retrieving revision 1.3
ppc/config.in +11 -0
@@ -41,6 +41,13 @@ define_bool CONFIG_4xx y fi +if [ "$CONFIG_40x" = "y" ]; then + choice 'Cache Mode' \ + "OFF CONFIG_CACHE_OFF \ + WriteThru CONFIG_CACHE_WRITETHRU \ + WriteBack CONFIG_CACHE_WRITEBACK" OFF +fi + if [ "$CONFIG_6xx" = "y" ]; then bool 'MPC8260 CPM Support' CONFIG_8260 fi
@@ -365,6 +372,10 @@ define_bool CONFIG_405 y fi + if [ "$CONFIG_XILINX_AUTO" = "y" ]; then + bool 'Virtex-4 cache bug (CPU_213)' CONFIG_VIRTEX4_CPU_213_BUG + fi + if [ "$CONFIG_VIRTEX_II_PRO" = "y" ]; then define_bool CONFIG_XILINX_OCP y define_bool CONFIG_PPC_OCP y
Index: arch/ppc/boot/simple/embed_config.c
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/boot/simple/embed_config.c,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/boot/simple/embed_config.c +1 -1
@@ -895,7 +895,7 @@ bd->bi_enetaddr[2 ] =0x35 ; bd->bi_enetaddr[3 ] =0x00 ; bd->bi_enetaddr[4 ] =0x22 ; - bd->bi_enetaddr[5 ] =0x00 ; + bd->bi_enetaddr[5 ] =0x01 ; } timebase_period_ns =1000000000 / bd->bi_tbfreq; }
Index: arch/ppc/boot/simple/head.S
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/boot/simple/head.S,v retrieving revision 1.1.1.1
retrieving revision 1.3
ppc/boot/simple/head.S +7 -0
@@ -64,6 +64,13 @@ */ #endif +#ifdef CONFIG_VIRTEX4_CPU_213_BUG + /* PPC errata 213: only for Virtex-4 FX */ + mfccr0 r0 + oris r0,r0,0x50000000@h + mtccr0 r0 +#endif + mflr r3 /* Save our actual starting address. */ /* The following functions we call must not modify r3 or r4.....
Index: arch/ppc/kernel/cputable.c
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/kernel/cputable.c,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/kernel/cputable.c +8 -1
@@ -508,7 +508,14 @@0 ,/*__setup_cpu_405 */ }, { /* Xilinx Virtex-II Pro */ -0xffff0000 ,0x20010000 ,"Virtex-II Pro" , +0xfffff000 ,0x20010000 ,"Virtex-II Pro" , +CPU_FTR_SPLIT_ID_CACHE |CPU_FTR_USE_TB |CPU_FTR_CAN_DOZE , +PPC_FEATURE_32 |PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, +32 ,32 , +0 ,/*__setup_cpu_405 */ + }, + { /* Xilinx Virtex-4 FX */ +0xfffff000 ,0x20011000 ,"Virtex-4 FX" ,CPU_FTR_SPLIT_ID_CACHE |CPU_FTR_USE_TB |CPU_FTR_CAN_DOZE ,PPC_FEATURE_32 |PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 32, 32,
Index: arch/ppc/kernel/head_4xx.S
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/kernel/head_4xx.S,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/kernel/head_4xx.S +16 -3
@@ -46,6 +46,19 @@ #define STND_EXC 0 #define CRIT_EXC 1 +#if defined(CONFIG_CACHE_OFF) +#define _PAGE_CACHE _PAGE_NO_CACHE /* TLB_I */ +#warning CONFIG_CACHE_CACHE_OFF is defined +#elif defined(CONFIG_CACHE_WRITETHRU) +#define _PAGE_CACHE _PAGE_WRITETHRU /* TLB_W */ +#warning CONFIG_CACHE_WRITETHRU is defined +#elif defined(CONFIG_CACHE_WRITEBACK) +#define _PAGE_CACHE 0x0 +#warning CONFIG_CACHE_WRITEBACK is defined +#else +#error CONFIG_CACHE_XXX is not defined! +#endif + /* As with the other PowerPC ports, it is expected that when code * execution begins here, the following registers contain valid, yet * optional, information:
@@ -304,7 +317,7 @@ */ li r22, 0x0ce2 andc r21, r21, r22 /* Make sure 20, 21 are zero */ - ori r21, r21, _PAGE_HWEXEC /* make it executable */ + ori r21, r21, _PAGE_HWEXEC|_PAGE_CACHE /* find the TLB index that caused the fault. It has to be here. */
@@ -791,7 +804,7 @@ stw r23, tlb_4xx_index@l(0) 6: - ori r21, r21, _PAGE_HWEXEC /* make it executable */ + ori r21, r21, _PAGE_HWEXEC|_PAGE_CACHE tlbwe r21, r23, TLB_DATA /* Load TLB LO */ /* Create EPN. This is the faulting address plus a static
@@ -1043,7 +1056,7 @@ * matter where they are loaded. */ clrrwi r4,r4,10 /* Mask off the real page number */ - ori r4,r4,(TLB_WR | TLB_EX) /* Set the write and execute bits */ + ori r4,r4,(TLB_WR | TLB_EX | _PAGE_CACHE) /* Set the write and execute bits */ clrrwi r3,r3,10 /* Mask off the effective page number */ ori r3,r3,(TLB_VALID | TLB_PAGESZ(PAGESZ_16M))
Index: arch/ppc/kernel/ppc4xx_setup.c
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/kernel/ppc4xx_setup.c,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/kernel/ppc4xx_setup.c +1 -0
@@ -129,6 +129,7 @@bd_t *bip = (bd_t *) __res;seq_printf (m,"clock\t\t: %ldMHz\n" , (long ) bip->bi_intfreq /1000000 ); +seq_printf (m,"ccr0\t\t: 0x%08x\n" ,mfspr (SPRN_CCR0 ));return 0 ; }
Index: arch/ppc/mm/4xx_mmu.c
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/mm/4xx_mmu.c,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/mm/4xx_mmu.c +11 -0
@@ -78,7 +78,12 @@* handlers (which are run in real-mode). */ +#ifdef CONFIG_CACHE_WRITEBACK mtspr (SPRN_DCWR ,0x00000000 );/* All caching is write-back */ +#endif +#ifdef CONFIG_CACHE_WRITETHRU +mtspr (SPRN_DCWR ,0xffffffff );/* All caching is write-thru */ +#endif /* * Cache instruction and data space where the exception
@@ -92,6 +97,12 @@* without flushing. -- Tom */ +#if defined(CONFIG_CACHE_OFF ) +mtspr (SPRN_DCCR ,0x00000000 ); +mtspr (SPRN_ICCR ,0x00000000 ); +#endif +#if defined(CONFIG_CACHE_WRITETHRU ) || defined(CONFIG_CACHE_WRITEBACK )mtspr (SPRN_DCCR ,0xF0000000 );/* 512 MB of data space at 0x0. */ mtspr (SPRN_ICCR ,0xF0000000 );/* 512 MB of instr. space at 0x0. */ +#endif }
Index: arch/ppc/platforms/xilinx_auto/auto-config.in
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/platforms/xilinx_auto/auto-config.in,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/platforms/xilinx_auto/auto-config.in +123 -121
321 lines not on this page · raw message
Index: arch/ppc/platforms/xilinx_auto/xilinx_auto.c
===================================================================
RCS file: /cvs/linuxppc-2.4/arch/ppc/platforms/xilinx_auto/xilinx_auto.c,v retrieving revision 1.1.1.1
retrieving revision 1.2
ppc/platforms/xilinx_auto/xilinx_auto.c +2 -2
@@ -224,8 +224,8 @@#endif /* Identify the system */ -printk - ("Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc. ([email protected])\n" ); +printk ("Xilinx Auto Virtex-II/Virtex-4, based on:\n" +" Xilinx Virtex-II Pro port (C) 2002 MontaVista Software, Inc. ([email protected])\n" ); }/* Called after board_setup_irq from ppc4xx_init_IRQ(). */