Re: [patch 6/6] Walnut zImage wrapper
On Mon, 24 Sep 2007 09:49:33 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: The addition of treeboot-walnut.c breaks compilation of Linux-2.6 for the lite5200 using the ppc_6xx toolchain of the ELDK 4.1: MODPOST vmlinux.o WARNING: vmlinux.o(.text+0x14): Section mismatch: reference to .init.text:prom_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x28): Section mismatch: reference to .init.text:early_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x340c): Section mismatch: reference to .init.text:machine_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3414): Section mismatch: reference to .init.text:MMU_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x343e): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3442): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') GEN .version CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o LD init/built-in.o LD vmlinux SYSMAP System.map BOOTAS arch/powerpc/boot/string.o BOOTAS arch/powerpc/boot/crt0.o BOOTCC arch/powerpc/boot/stdio.o BOOTCC arch/powerpc/boot/main.o BOOTCC arch/powerpc/boot/flatdevtree.o BOOTCC arch/powerpc/boot/flatdevtree_misc.o BOOTCC arch/powerpc/boot/ns16550.o BOOTCC arch/powerpc/boot/serial.o BOOTCC arch/powerpc/boot/simple_alloc.o BOOTAS arch/powerpc/boot/div64.o BOOTAS arch/powerpc/boot/util.o BOOTCC arch/powerpc/boot/gunzip_util.o BOOTCC arch/powerpc/boot/elf_util.o BOOTCC arch/powerpc/boot/inffast.o BOOTCC arch/powerpc/boot/inflate.o BOOTCC arch/powerpc/boot/inftrees.o BOOTCC arch/powerpc/boot/devtree.o BOOTCC arch/powerpc/boot/oflib.o BOOTCC arch/powerpc/boot/ofconsole.o BOOTCC arch/powerpc/boot/4xx.o BOOTCC arch/powerpc/boot/ebony.o BOOTCC arch/powerpc/boot/mv64x60.o BOOTCC arch/powerpc/boot/mpsc.o BOOTCC arch/powerpc/boot/mv64x60_i2c.o BOOTCC arch/powerpc/boot/cuboot.o BOOTCC arch/powerpc/boot/bamboo.o BOOTAR arch/powerpc/boot/wrapper.a BOOTCC arch/powerpc/boot/of.o BOOTCC arch/powerpc/boot/cuboot-83xx.o BOOTCC arch/powerpc/boot/cuboot-85xx.o BOOTCC arch/powerpc/boot/holly.o BOOTCC arch/powerpc/boot/cuboot-ebony.o BOOTCC arch/powerpc/boot/treeboot-ebony.o BOOTCC arch/powerpc/boot/prpmc2800.o BOOTAS arch/powerpc/boot/ps3-head.o BOOTAS arch/powerpc/boot/ps3-hvcall.o BOOTCC arch/powerpc/boot/ps3.o BOOTCC arch/powerpc/boot/treeboot-bamboo.o BOOTCC arch/powerpc/boot/cuboot-sequoia.o BOOTCC arch/powerpc/boot/treeboot-walnut.o {standard input}: Assembler messages: {standard input}:184: Error: Unrecognized opcode: `mfdcr' {standard input}:185: Error: Unrecognized opcode: `mfdcr' {standard input}:186: Error: Unrecognized opcode: `mfdcr' {standard input}:217: Error: Unrecognized opcode: `mtdcr' make[1]: *** [arch/powerpc/boot/treeboot-walnut.o] Error 1 make: *** [uImage] Error 2 It looks like the ppc_6xx toolchain does not know the opcode above. I wonder why files for other PowerPC sub-archs like 4xx are compiled with the wrong compiler. Have I missed something? No, you haven't missed anything. I need a one line patch to fix it. Could you try the patch below to make sure it works for you? And the WARNING above on Section mismatch looks strange as well (still present in 2.6.23-rc7). Those warnings should be gone with Paul's latest tree. (They will remain for 2.6.23.) josh Pass the correct -mcpu option for treeboot-walnut.o to avoid unrecognized opcodes. Signed-off-by: Josh Boyer [EMAIL PROTECTED] diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index c1582b6..8e6d36b 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -33,6 +33,7 @@ BOOTCFLAGS+= -I$(obj) -I$(srctree)/$(obj) $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 +$(obj)/treeboot-walnut.o: BOOTFLAGS += -mcpu=405 zlib := inffast.c inflate.c inftrees.c zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [patch 6/6] Walnut zImage wrapper
Josh Boyer wrote: On Mon, 24 Sep 2007 09:49:33 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: The addition of treeboot-walnut.c breaks compilation of Linux-2.6 for the lite5200 using the ppc_6xx toolchain of the ELDK 4.1: MODPOST vmlinux.o WARNING: vmlinux.o(.text+0x14): Section mismatch: reference to .init.text:prom_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x28): Section mismatch: reference to .init.text:early_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x340c): Section mismatch: reference to .init.text:machine_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3414): Section mismatch: reference to .init.text:MMU_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x343e): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3442): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') GEN .version CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o LD init/built-in.o LD vmlinux SYSMAP System.map BOOTAS arch/powerpc/boot/string.o BOOTAS arch/powerpc/boot/crt0.o BOOTCC arch/powerpc/boot/stdio.o BOOTCC arch/powerpc/boot/main.o BOOTCC arch/powerpc/boot/flatdevtree.o BOOTCC arch/powerpc/boot/flatdevtree_misc.o BOOTCC arch/powerpc/boot/ns16550.o BOOTCC arch/powerpc/boot/serial.o BOOTCC arch/powerpc/boot/simple_alloc.o BOOTAS arch/powerpc/boot/div64.o BOOTAS arch/powerpc/boot/util.o BOOTCC arch/powerpc/boot/gunzip_util.o BOOTCC arch/powerpc/boot/elf_util.o BOOTCC arch/powerpc/boot/inffast.o BOOTCC arch/powerpc/boot/inflate.o BOOTCC arch/powerpc/boot/inftrees.o BOOTCC arch/powerpc/boot/devtree.o BOOTCC arch/powerpc/boot/oflib.o BOOTCC arch/powerpc/boot/ofconsole.o BOOTCC arch/powerpc/boot/4xx.o BOOTCC arch/powerpc/boot/ebony.o BOOTCC arch/powerpc/boot/mv64x60.o BOOTCC arch/powerpc/boot/mpsc.o BOOTCC arch/powerpc/boot/mv64x60_i2c.o BOOTCC arch/powerpc/boot/cuboot.o BOOTCC arch/powerpc/boot/bamboo.o BOOTAR arch/powerpc/boot/wrapper.a BOOTCC arch/powerpc/boot/of.o BOOTCC arch/powerpc/boot/cuboot-83xx.o BOOTCC arch/powerpc/boot/cuboot-85xx.o BOOTCC arch/powerpc/boot/holly.o BOOTCC arch/powerpc/boot/cuboot-ebony.o BOOTCC arch/powerpc/boot/treeboot-ebony.o BOOTCC arch/powerpc/boot/prpmc2800.o BOOTAS arch/powerpc/boot/ps3-head.o BOOTAS arch/powerpc/boot/ps3-hvcall.o BOOTCC arch/powerpc/boot/ps3.o BOOTCC arch/powerpc/boot/treeboot-bamboo.o BOOTCC arch/powerpc/boot/cuboot-sequoia.o BOOTCC arch/powerpc/boot/treeboot-walnut.o {standard input}: Assembler messages: {standard input}:184: Error: Unrecognized opcode: `mfdcr' {standard input}:185: Error: Unrecognized opcode: `mfdcr' {standard input}:186: Error: Unrecognized opcode: `mfdcr' {standard input}:217: Error: Unrecognized opcode: `mtdcr' make[1]: *** [arch/powerpc/boot/treeboot-walnut.o] Error 1 make: *** [uImage] Error 2 It looks like the ppc_6xx toolchain does not know the opcode above. I wonder why files for other PowerPC sub-archs like 4xx are compiled with the wrong compiler. Have I missed something? No, you haven't missed anything. I need a one line patch to fix it. Could you try the patch below to make sure it works for you? It works for me with one typo corrected (see below). And the WARNING above on Section mismatch looks strange as well (still present in 2.6.23-rc7). Those warnings should be gone with Paul's latest tree. (They will remain for 2.6.23.) OK. Pass the correct -mcpu option for treeboot-walnut.o to avoid unrecognized opcodes. Signed-off-by: Josh Boyer [EMAIL PROTECTED] diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index c1582b6..8e6d36b 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -33,6 +33,7 @@ BOOTCFLAGS+= -I$(obj) -I$(srctree)/$(obj) $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 +$(obj)/treeboot-walnut.o: BOOTFLAGS += -mcpu=405 ^ typo, should be BOOTCFLAGS Thanks. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [patch 6/6] Walnut zImage wrapper
On Mon, 24 Sep 2007 14:20:36 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: Josh Boyer wrote: On Mon, 24 Sep 2007 09:49:33 +0200 Wolfgang Grandegger [EMAIL PROTECTED] wrote: The addition of treeboot-walnut.c breaks compilation of Linux-2.6 for the lite5200 using the ppc_6xx toolchain of the ELDK 4.1: MODPOST vmlinux.o WARNING: vmlinux.o(.text+0x14): Section mismatch: reference to .init.text:prom_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x28): Section mismatch: reference to .init.text:early_init (between '__start' and '__after_mmu_off') WARNING: vmlinux.o(.text+0x340c): Section mismatch: reference to .init.text:machine_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3414): Section mismatch: reference to .init.text:MMU_init (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x343e): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') WARNING: vmlinux.o(.text+0x3442): Section mismatch: reference to .init.text:start_kernel (between 'start_here' and 'set_context') GEN .version CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o LD init/built-in.o LD vmlinux SYSMAP System.map BOOTAS arch/powerpc/boot/string.o BOOTAS arch/powerpc/boot/crt0.o BOOTCC arch/powerpc/boot/stdio.o BOOTCC arch/powerpc/boot/main.o BOOTCC arch/powerpc/boot/flatdevtree.o BOOTCC arch/powerpc/boot/flatdevtree_misc.o BOOTCC arch/powerpc/boot/ns16550.o BOOTCC arch/powerpc/boot/serial.o BOOTCC arch/powerpc/boot/simple_alloc.o BOOTAS arch/powerpc/boot/div64.o BOOTAS arch/powerpc/boot/util.o BOOTCC arch/powerpc/boot/gunzip_util.o BOOTCC arch/powerpc/boot/elf_util.o BOOTCC arch/powerpc/boot/inffast.o BOOTCC arch/powerpc/boot/inflate.o BOOTCC arch/powerpc/boot/inftrees.o BOOTCC arch/powerpc/boot/devtree.o BOOTCC arch/powerpc/boot/oflib.o BOOTCC arch/powerpc/boot/ofconsole.o BOOTCC arch/powerpc/boot/4xx.o BOOTCC arch/powerpc/boot/ebony.o BOOTCC arch/powerpc/boot/mv64x60.o BOOTCC arch/powerpc/boot/mpsc.o BOOTCC arch/powerpc/boot/mv64x60_i2c.o BOOTCC arch/powerpc/boot/cuboot.o BOOTCC arch/powerpc/boot/bamboo.o BOOTAR arch/powerpc/boot/wrapper.a BOOTCC arch/powerpc/boot/of.o BOOTCC arch/powerpc/boot/cuboot-83xx.o BOOTCC arch/powerpc/boot/cuboot-85xx.o BOOTCC arch/powerpc/boot/holly.o BOOTCC arch/powerpc/boot/cuboot-ebony.o BOOTCC arch/powerpc/boot/treeboot-ebony.o BOOTCC arch/powerpc/boot/prpmc2800.o BOOTAS arch/powerpc/boot/ps3-head.o BOOTAS arch/powerpc/boot/ps3-hvcall.o BOOTCC arch/powerpc/boot/ps3.o BOOTCC arch/powerpc/boot/treeboot-bamboo.o BOOTCC arch/powerpc/boot/cuboot-sequoia.o BOOTCC arch/powerpc/boot/treeboot-walnut.o {standard input}: Assembler messages: {standard input}:184: Error: Unrecognized opcode: `mfdcr' {standard input}:185: Error: Unrecognized opcode: `mfdcr' {standard input}:186: Error: Unrecognized opcode: `mfdcr' {standard input}:217: Error: Unrecognized opcode: `mtdcr' make[1]: *** [arch/powerpc/boot/treeboot-walnut.o] Error 1 make: *** [uImage] Error 2 It looks like the ppc_6xx toolchain does not know the opcode above. I wonder why files for other PowerPC sub-archs like 4xx are compiled with the wrong compiler. Have I missed something? No, you haven't missed anything. I need a one line patch to fix it. Could you try the patch below to make sure it works for you? It works for me with one typo corrected (see below). Ah, yes. That's what I get for coding before coffee. Thanks Wolfgang. josh ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [patch 6/6] Walnut zImage wrapper
On Wed, Sep 05, 2007 at 11:36:04AM -0500, Josh Boyer wrote: Updated patch below Add zImage wrapper for walnut board Signed-off-by: Josh Boyer [EMAIL PROTECTED] Acked-by: David Gibson [EMAIL PROTECTED] -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[patch 6/6] Walnut zImage wrapper
Updated patch below Add zImage wrapper for walnut board Signed-off-by: Josh Boyer [EMAIL PROTECTED] --- arch/powerpc/boot/Makefile |3 arch/powerpc/boot/dcr.h |5 + arch/powerpc/boot/treeboot-walnut.c | 131 3 files changed, 138 insertions(+), 1 deletion(-) --- linux-2.6.orig/arch/powerpc/boot/Makefile +++ linux-2.6/arch/powerpc/boot/Makefile @@ -49,7 +49,7 @@ src-wlib := string.S crt0.S stdio.c main src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ - cuboot-pq2.c cuboot-bamboo.c + cuboot-pq2.c cuboot-bamboo.c treeboot-walnut.c src-boot := $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot)) @@ -147,6 +147,7 @@ image-$(CONFIG_PPC_83xx)+= cuImage.83x image-$(CONFIG_PPC_85xx) += cuImage.85xx image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo +image-$(CONFIG_WALNUT) += treeImage.walnut endif # For 32-bit powermacs, build the COFF and miboot images --- /dev/null +++ linux-2.6/arch/powerpc/boot/treeboot-walnut.c @@ -0,0 +1,131 @@ +/* + * Old U-boot compatibility for Walnut + * + * Author: Josh Boyer [EMAIL PROTECTED] + * + * Copyright 2007 IBM Corporation + * Based on cuboot-83xx.c, which is: + * Copyright (c) 2007 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include ops.h +#include stdio.h +#include dcr.h +#include 4xx.h +#include io.h + +BSS_STACK(4096); + +void ibm405gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk) +{ + u32 pllmr = mfdcr(DCRN_CPC0_PLLMR); + u32 cpc0_cr0 = mfdcr(DCRN_405_CPC0_CR0); + u32 cpc0_cr1 = mfdcr(DCRN_405_CPC0_CR1); + u32 cpu, plb, opb, ebc, tb, uart0, uart1, m; + u32 fwdv, fbdv, cbdv, opdv, epdv, udiv; + + fwdv = (8 - ((pllmr 0xe000) 29)); + fbdv = (pllmr 0x1e00) 25; + cbdv = ((pllmr 0x0006) 17) + 1; + opdv = ((pllmr 0x00018000) 15) + 1; + epdv = ((pllmr 0x1800) 13) + 2; + udiv = ((cpc0_cr0 0x3e) 1) + 1; + + m = fwdv * fbdv * cbdv; + + cpu = sysclk * m / fwdv; + plb = cpu / cbdv; + opb = plb / opdv; + ebc = plb / epdv; + + if (cpc0_cr0 0x80) { + /* uart0 uses the external clock */ + uart0 = ser_clk; + } else { + uart0 = cpu / udiv; + } + + if (cpc0_cr0 0x40) { + /* uart1 uses the external clock */ + uart1 = ser_clk; + } else { + uart1 = cpu / udiv; + } + + /* setup the timebase clock to tick at the cpu frequency */ + cpc0_cr1 = cpc0_cr1 ~ 0x0080; + mtdcr(DCRN_CPC0_CR1, cpc0_cr1); + tb = cpu; + + dt_fixup_cpu_clocks(cpu, tb, 0); + dt_fixup_clock(/plb, plb); + dt_fixup_clock(/plb/opb, opb); + dt_fixup_clock(/plb/ebc, ebc); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart0); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart1); +} + +static void walnut_flashsel_fixup(void) +{ + void *devp, *sram; + u32 reg_flash[3] = {0x0, 0x0, 0x8}; + u32 reg_sram[3] = {0x0, 0x0, 0x8}; + u8 *fpga; + u8 fpga_brds1 = 0x0; + + devp = finddevice(/plb/ebc/fpga); + if (!devp) + fatal(Couldn't locate FPGA node\n\r); + + if (getprop(devp, virtual-reg, fpga, sizeof(fpga)) != sizeof(fpga)) + fatal(no virtual-reg property\n\r); + + fpga_brds1 = in_8(fpga); + + devp = finddevice(/plb/ebc/flash); + if (!devp) + fatal(Couldn't locate flash node\n\r); + + if (getprop(devp, reg, reg_flash, sizeof(reg_flash)) != sizeof(reg_flash)) + fatal(flash reg property has unexpected size\n\r); + + sram = finddevice(/plb/ebc/sram); + if (!sram) + fatal(Couldn't locate sram node\n\r); + + if (getprop(sram, reg, reg_sram, sizeof(reg_sram)) != sizeof(reg_sram)) + fatal(sram reg property has unexpected size\n\r); + + if (fpga_brds1 0x1) { + reg_flash[1] ^= 0x8; + reg_sram[1] ^= 0x8; + } + + setprop(devp, reg, reg_flash, sizeof(reg_flash)); + setprop(sram, reg, reg_sram, sizeof(reg_sram)); +} + +static void walnut_fixups(void) +{ + ibm4xx_fixup_memsize(); + ibm405gp_fixup_clocks(, 0xa8c000); + ibm4xx_quiesce_eth((u32 *)0xef600800, NULL); + ibm4xx_fixup_ebc_ranges(/plb/ebc); + walnut_flashsel_fixup(); +} + +void platform_init(void) +{ +
Re: [patch 6/6] Walnut zImage wrapper
On Fri, Aug 31, 2007 at 03:04:55PM -0500, Josh Boyer wrote: Add zImage wrapper for walnut board Signed-off-by: Josh Boyer [EMAIL PROTECTED] [snip] --- /dev/null +++ linux-2.6/arch/powerpc/boot/treeboot-walnut.c @@ -0,0 +1,133 @@ +/* + * Old U-boot compatibility for Walnut + * + * Author: Josh Boyer [EMAIL PROTECTED] + * + * Copyright 2007 IBM Corporation + * Based on cuboot-83xx.c, which is: + * Copyright (c) 2007 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include ops.h +#include stdio.h +#include dcr.h +#include 4xx.h +#include io.h + +BSS_STACK(4096); + +void ibm405gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk) +{ + u32 pllmr = mfdcr(0xb0); Please add #defines for the DCR numbers, rather than using literals. + u32 cpc0_cr0 = mfdcr(0xb1); + u32 cpc0_cr1 = mfdcr(0xb2); + u32 cpu, plb, opb, ebc, tb, uart0, uart1, m; + u32 fwdv, fbdv, cbdv, opdv, epdv, udiv; + + fwdv = (8 - ((pllmr 0xe000) 29)); + fbdv = (pllmr 0x1e00) 25; + cbdv = ((pllmr 0x0006) 17) + 1; + opdv = ((pllmr 0x00018000) 15) + 1; + epdv = ((pllmr 0x1800) 13) + 2; + udiv = ((cpc0_cr0 0x3e) 1) + 1; + + m = fwdv * fbdv * cbdv; + + cpu = sysclk * m / fwdv; + plb = cpu / cbdv; + opb = plb / opdv; + ebc = plb / epdv; + + if (cpc0_cr0 0x80) { + /* uart0 uses the external clock */ + uart0 = ser_clk; + } else { + uart0 = cpu / udiv; + } + + if (cpc0_cr0 0x40) { + /* uart1 uses the external clock */ + uart1 = ser_clk; + } else { + uart1 = cpu / udiv; + } + + /* setup the timebase clock to tick at the cpu frequency */ + cpc0_cr1 = cpc0_cr1 ~ 0x0080; + mtdcr(0xb2, cpc0_cr1); + tb = cpu; + + dt_fixup_cpu_clocks(cpu, tb, 0); + dt_fixup_clock(/plb, plb); + dt_fixup_clock(/plb/opb, opb); + dt_fixup_clock(/plb/ebc, ebc); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart0); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart1); +} + +static void walnut_flashsel_fixup(void) +{ + void *devp, *sram; + u32 reg_flash[3] = {0x0, 0x0, 0x8}; + u32 reg_sram[3] = {0x0, 0x0, 0x8}; + u8 *fpga; + u8 fpga_brds1 = 0x0; + + devp = finddevice(/plb/ebc/fpga); + if (!devp) + fatal(Couldn't locate FPGA node\n\r); + + if (getprop(devp, virtual-reg, fpga, sizeof(fpga)) != sizeof(fpga)) + fatal(no virtual-reg property\n\r); + + fpga_brds1 = in_8(fpga); + + printf(FPGA_BRDS1: %08x\n, fpga_brds1); + + devp = finddevice(/plb/ebc/flash); + if (!devp) + fatal(Couldn't locate flash node\n\r); + + if (getprop(devp, reg, reg_flash, sizeof(reg_flash)) != sizeof(reg_flash)) + fatal(flash reg property has unexpected size\n\r); + + sram = finddevice(/plb/ebc/sram); + if (!sram) + fatal(Couldn't locate sram node\n\r); + + if (getprop(sram, reg, reg_sram, sizeof(reg_sram)) != sizeof(reg_sram)) + fatal(sram reg property has unexpected size\n\r); + + if (fpga_brds1 0x1) { + reg_flash[1] ^= 0x8; + reg_sram[1] ^= 0x8; + } + + setprop(devp, reg, reg_flash, sizeof(reg_flash)); + setprop(sram, reg, reg_sram, sizeof(reg_sram)); +} + +static void walnut_fixups(void) +{ + ibm4xx_fixup_memsize(); + ibm405gp_fixup_clocks(, 0xa8c000); + ibm4xx_quiesce_eth((u32 *)0xef600800, NULL); + ibm4xx_fixup_ebc_ranges(/plb/ebc); + walnut_flashsel_fixup(); +} + +void platform_init(void) +{ + unsigned long end_of_ram = 0x200; + unsigned long avail_ram = end_of_ram - (unsigned long) _end; + + simple_alloc_init(_end, avail_ram, 32, 32); + platform_ops.fixups = walnut_fixups; + platform_ops.exit = ibm40x_dbcr_reset; + ft_init(_dtb_start, _dtb_end - _dtb_start, 32); + serial_console_init(); +} -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[patch 6/6] Walnut zImage wrapper
Add zImage wrapper for walnut board Signed-off-by: Josh Boyer [EMAIL PROTECTED] --- arch/powerpc/boot/Makefile |3 arch/powerpc/boot/treeboot-walnut.c | 133 2 files changed, 135 insertions(+), 1 deletion(-) --- linux-2.6.orig/arch/powerpc/boot/Makefile +++ linux-2.6/arch/powerpc/boot/Makefile @@ -49,7 +49,7 @@ src-wlib := string.S crt0.S stdio.c main src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ cuboot-ebony.c treeboot-ebony.c prpmc2800.c \ ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ - cuboot-pq2.c cuboot-bamboo.c + cuboot-pq2.c cuboot-bamboo.c treeboot-walnut.c src-boot := $(src-wlib) $(src-plat) empty.c src-boot := $(addprefix $(obj)/, $(src-boot)) @@ -147,6 +147,7 @@ image-$(CONFIG_PPC_83xx)+= cuImage.83x image-$(CONFIG_PPC_85xx) += cuImage.85xx image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony image-$(CONFIG_BAMBOO) += treeImage.bamboo cuImage.bamboo +image-$(CONFIG_WALNUT) += treeImage.walnut endif # For 32-bit powermacs, build the COFF and miboot images --- /dev/null +++ linux-2.6/arch/powerpc/boot/treeboot-walnut.c @@ -0,0 +1,133 @@ +/* + * Old U-boot compatibility for Walnut + * + * Author: Josh Boyer [EMAIL PROTECTED] + * + * Copyright 2007 IBM Corporation + * Based on cuboot-83xx.c, which is: + * Copyright (c) 2007 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include ops.h +#include stdio.h +#include dcr.h +#include 4xx.h +#include io.h + +BSS_STACK(4096); + +void ibm405gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk) +{ + u32 pllmr = mfdcr(0xb0); + u32 cpc0_cr0 = mfdcr(0xb1); + u32 cpc0_cr1 = mfdcr(0xb2); + u32 cpu, plb, opb, ebc, tb, uart0, uart1, m; + u32 fwdv, fbdv, cbdv, opdv, epdv, udiv; + + fwdv = (8 - ((pllmr 0xe000) 29)); + fbdv = (pllmr 0x1e00) 25; + cbdv = ((pllmr 0x0006) 17) + 1; + opdv = ((pllmr 0x00018000) 15) + 1; + epdv = ((pllmr 0x1800) 13) + 2; + udiv = ((cpc0_cr0 0x3e) 1) + 1; + + m = fwdv * fbdv * cbdv; + + cpu = sysclk * m / fwdv; + plb = cpu / cbdv; + opb = plb / opdv; + ebc = plb / epdv; + + if (cpc0_cr0 0x80) { + /* uart0 uses the external clock */ + uart0 = ser_clk; + } else { + uart0 = cpu / udiv; + } + + if (cpc0_cr0 0x40) { + /* uart1 uses the external clock */ + uart1 = ser_clk; + } else { + uart1 = cpu / udiv; + } + + /* setup the timebase clock to tick at the cpu frequency */ + cpc0_cr1 = cpc0_cr1 ~ 0x0080; + mtdcr(0xb2, cpc0_cr1); + tb = cpu; + + dt_fixup_cpu_clocks(cpu, tb, 0); + dt_fixup_clock(/plb, plb); + dt_fixup_clock(/plb/opb, opb); + dt_fixup_clock(/plb/ebc, ebc); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart0); + dt_fixup_clock(/plb/opb/[EMAIL PROTECTED], uart1); +} + +static void walnut_flashsel_fixup(void) +{ + void *devp, *sram; + u32 reg_flash[3] = {0x0, 0x0, 0x8}; + u32 reg_sram[3] = {0x0, 0x0, 0x8}; + u8 *fpga; + u8 fpga_brds1 = 0x0; + + devp = finddevice(/plb/ebc/fpga); + if (!devp) + fatal(Couldn't locate FPGA node\n\r); + + if (getprop(devp, virtual-reg, fpga, sizeof(fpga)) != sizeof(fpga)) + fatal(no virtual-reg property\n\r); + + fpga_brds1 = in_8(fpga); + + printf(FPGA_BRDS1: %08x\n, fpga_brds1); + + devp = finddevice(/plb/ebc/flash); + if (!devp) + fatal(Couldn't locate flash node\n\r); + + if (getprop(devp, reg, reg_flash, sizeof(reg_flash)) != sizeof(reg_flash)) + fatal(flash reg property has unexpected size\n\r); + + sram = finddevice(/plb/ebc/sram); + if (!sram) + fatal(Couldn't locate sram node\n\r); + + if (getprop(sram, reg, reg_sram, sizeof(reg_sram)) != sizeof(reg_sram)) + fatal(sram reg property has unexpected size\n\r); + + if (fpga_brds1 0x1) { + reg_flash[1] ^= 0x8; + reg_sram[1] ^= 0x8; + } + + setprop(devp, reg, reg_flash, sizeof(reg_flash)); + setprop(sram, reg, reg_sram, sizeof(reg_sram)); +} + +static void walnut_fixups(void) +{ + ibm4xx_fixup_memsize(); + ibm405gp_fixup_clocks(, 0xa8c000); + ibm4xx_quiesce_eth((u32 *)0xef600800, NULL); + ibm4xx_fixup_ebc_ranges(/plb/ebc); + walnut_flashsel_fixup(); +} + +void platform_init(void) +{ + unsigned long end_of_ram = 0x200; + unsigned long