Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/4xx: Simple platform for the ISS 4xx simulator

This is a trivial 4xx plaform that uses the new simple bsp from
Josh and is handy to use in simulators such as ISS or even Mambo
who don't properly implement most of the actual devices in the
SoC but really only the core.

Signed-off-by: Torez Smith <lnxtorez@linux.vnet.ibm.com>
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

authored by

Torez Smith and committed by
Josh Boyer
b4e8c8dd 221c185d

+533 -1
+4 -1
arch/powerpc/boot/Makefile
··· 44 44 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 45 45 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 46 46 $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 47 + $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 47 48 $(obj)/virtex405-head.o: BOOTAFLAGS += -mcpu=405 48 49 49 50 ··· 78 77 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 79 78 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ 80 79 cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \ 81 - gamecube-head.S gamecube.c wii-head.S wii.c 80 + gamecube-head.S gamecube.c wii-head.S wii.c treeboot-iss4xx.c 82 81 src-boot := $(src-wlib) $(src-plat) empty.c 83 82 84 83 src-boot := $(addprefix $(obj)/, $(src-boot)) ··· 207 206 image-$(CONFIG_KATMAI) += cuImage.katmai 208 207 image-$(CONFIG_WARP) += cuImage.warp 209 208 image-$(CONFIG_YOSEMITE) += cuImage.yosemite 209 + image-$(CONFIG_ISS4xx) += treeImage.iss4xx \ 210 + treeImage.iss4xx-mpic 210 211 211 212 # Board ports in arch/powerpc/platform/8xx/Kconfig 212 213 image-$(CONFIG_MPC86XADS) += cuImage.mpc866ads
+155
arch/powerpc/boot/dts/iss4xx-mpic.dts
··· 1 + /* 2 + * Device Tree Source for IBM Embedded PPC 476 Platform 3 + * 4 + * Copyright 2010 Torez Smith, IBM Corporation. 5 + * 6 + * Based on earlier code: 7 + * Copyright (c) 2006, 2007 IBM Corp. 8 + * Josh Boyer <jwboyer@linux.vnet.ibm.com>, David Gibson <dwg@au1.ibm.com> 9 + * 10 + * This file is licensed under the terms of the GNU General Public 11 + * License version 2. This program is licensed "as is" without 12 + * any warranty of any kind, whether express or implied. 13 + */ 14 + 15 + /dts-v1/; 16 + 17 + /memreserve/ 0x01f00000 0x00100000; 18 + 19 + / { 20 + #address-cells = <2>; 21 + #size-cells = <1>; 22 + model = "ibm,iss-4xx"; 23 + compatible = "ibm,iss-4xx"; 24 + dcr-parent = <&{/cpus/cpu@0}>; 25 + 26 + aliases { 27 + serial0 = &UART0; 28 + }; 29 + 30 + cpus { 31 + #address-cells = <1>; 32 + #size-cells = <0>; 33 + 34 + cpu@0 { 35 + device_type = "cpu"; 36 + model = "PowerPC,4xx"; // real CPU changed in sim 37 + reg = <0>; 38 + clock-frequency = <100000000>; // 100Mhz :-) 39 + timebase-frequency = <100000000>; 40 + i-cache-line-size = <32>; 41 + d-cache-line-size = <32>; 42 + i-cache-size = <32768>; 43 + d-cache-size = <32768>; 44 + dcr-controller; 45 + dcr-access-method = "native"; 46 + status = "ok"; 47 + }; 48 + cpu@1 { 49 + device_type = "cpu"; 50 + model = "PowerPC,4xx"; // real CPU changed in sim 51 + reg = <1>; 52 + clock-frequency = <100000000>; // 100Mhz :-) 53 + timebase-frequency = <100000000>; 54 + i-cache-line-size = <32>; 55 + d-cache-line-size = <32>; 56 + i-cache-size = <32768>; 57 + d-cache-size = <32768>; 58 + dcr-controller; 59 + dcr-access-method = "native"; 60 + status = "disabled"; 61 + enable-method = "spin-table"; 62 + cpu-release-addr = <0 0x01f00100>; 63 + }; 64 + cpu@2 { 65 + device_type = "cpu"; 66 + model = "PowerPC,4xx"; // real CPU changed in sim 67 + reg = <2>; 68 + clock-frequency = <100000000>; // 100Mhz :-) 69 + timebase-frequency = <100000000>; 70 + i-cache-line-size = <32>; 71 + d-cache-line-size = <32>; 72 + i-cache-size = <32768>; 73 + d-cache-size = <32768>; 74 + dcr-controller; 75 + dcr-access-method = "native"; 76 + status = "disabled"; 77 + enable-method = "spin-table"; 78 + cpu-release-addr = <0 0x01f00200>; 79 + }; 80 + cpu@3 { 81 + device_type = "cpu"; 82 + model = "PowerPC,4xx"; // real CPU changed in sim 83 + reg = <3>; 84 + clock-frequency = <100000000>; // 100Mhz :-) 85 + timebase-frequency = <100000000>; 86 + i-cache-line-size = <32>; 87 + d-cache-line-size = <32>; 88 + i-cache-size = <32768>; 89 + d-cache-size = <32768>; 90 + dcr-controller; 91 + dcr-access-method = "native"; 92 + status = "disabled"; 93 + enable-method = "spin-table"; 94 + cpu-release-addr = <0 0x01f00300>; 95 + }; 96 + }; 97 + 98 + memory { 99 + device_type = "memory"; 100 + reg = <0x00000000 0x00000000 0x00000000>; // Filled in by zImage 101 + 102 + }; 103 + 104 + MPIC: interrupt-controller { 105 + compatible = "chrp,open-pic"; 106 + interrupt-controller; 107 + dcr-reg = <0xffc00000 0x00030000>; 108 + #address-cells = <0>; 109 + #size-cells = <0>; 110 + #interrupt-cells = <2>; 111 + 112 + }; 113 + 114 + plb { 115 + compatible = "ibm,plb-4xx", "ibm,plb4"; /* Could be PLB6, doesn't matter */ 116 + #address-cells = <2>; 117 + #size-cells = <1>; 118 + ranges; 119 + clock-frequency = <0>; // Filled in by zImage 120 + 121 + POB0: opb { 122 + compatible = "ibm,opb-4xx", "ibm,opb"; 123 + #address-cells = <1>; 124 + #size-cells = <1>; 125 + /* Wish there was a nicer way of specifying a full 32-bit 126 + range */ 127 + ranges = <0x00000000 0x00000001 0x00000000 0x80000000 128 + 0x80000000 0x00000001 0x80000000 0x80000000>; 129 + clock-frequency = <0>; // Filled in by zImage 130 + UART0: serial@40000200 { 131 + device_type = "serial"; 132 + compatible = "ns16550a"; 133 + reg = <0x40000200 0x00000008>; 134 + virtual-reg = <0xe0000200>; 135 + clock-frequency = <11059200>; 136 + current-speed = <115200>; 137 + interrupt-parent = <&MPIC>; 138 + interrupts = <0x0 0x2>; 139 + }; 140 + }; 141 + }; 142 + 143 + nvrtc { 144 + compatible = "ds1743-nvram", "ds1743", "rtc-ds1743"; 145 + reg = <0 0xEF703000 0x2000>; 146 + }; 147 + iss-block { 148 + compatible = "ibm,iss-sim-block-device"; 149 + reg = <0 0xEF701000 0x1000>; 150 + }; 151 + 152 + chosen { 153 + linux,stdout-path = "/plb/opb/serial@40000200"; 154 + }; 155 + };
+116
arch/powerpc/boot/dts/iss4xx.dts
··· 1 + /* 2 + * Device Tree Source for IBM Embedded PPC 476 Platform 3 + * 4 + * Copyright 2010 Torez Smith, IBM Corporation. 5 + * 6 + * Based on earlier code: 7 + * Copyright (c) 2006, 2007 IBM Corp. 8 + * Josh Boyer <jwboyer@linux.vnet.ibm.com>, David Gibson <dwg@au1.ibm.com> 9 + * 10 + * This file is licensed under the terms of the GNU General Public 11 + * License version 2. This program is licensed "as is" without 12 + * any warranty of any kind, whether express or implied. 13 + */ 14 + 15 + /dts-v1/; 16 + 17 + / { 18 + #address-cells = <2>; 19 + #size-cells = <1>; 20 + model = "ibm,iss-4xx"; 21 + compatible = "ibm,iss-4xx"; 22 + dcr-parent = <&{/cpus/cpu@0}>; 23 + 24 + aliases { 25 + serial0 = &UART0; 26 + }; 27 + 28 + cpus { 29 + #address-cells = <1>; 30 + #size-cells = <0>; 31 + 32 + cpu@0 { 33 + device_type = "cpu"; 34 + model = "PowerPC,4xx"; // real CPU changed in sim 35 + reg = <0x00000000>; 36 + clock-frequency = <100000000>; // 100Mhz :-) 37 + timebase-frequency = <100000000>; 38 + i-cache-line-size = <32>; // may need fixup in sim 39 + d-cache-line-size = <32>; // may need fixup in sim 40 + i-cache-size = <32768>; /* may need fixup in sim */ 41 + d-cache-size = <32768>; /* may need fixup in sim */ 42 + dcr-controller; 43 + dcr-access-method = "native"; 44 + }; 45 + }; 46 + 47 + memory { 48 + device_type = "memory"; 49 + reg = <0x00000000 0x00000000 0x00000000>; // Filled in by zImage 50 + }; 51 + 52 + UIC0: interrupt-controller0 { 53 + compatible = "ibm,uic-4xx", "ibm,uic"; 54 + interrupt-controller; 55 + cell-index = <0>; 56 + dcr-reg = <0x0c0 0x009>; 57 + #address-cells = <0>; 58 + #size-cells = <0>; 59 + #interrupt-cells = <2>; 60 + 61 + }; 62 + 63 + UIC1: interrupt-controller1 { 64 + compatible = "ibm,uic-4xx", "ibm,uic"; 65 + interrupt-controller; 66 + cell-index = <1>; 67 + dcr-reg = <0x0d0 0x009>; 68 + #address-cells = <0>; 69 + #size-cells = <0>; 70 + #interrupt-cells = <2>; 71 + interrupts = <0x1e 0x4 0x1f 0x4>; /* cascade */ 72 + interrupt-parent = <&UIC0>; 73 + }; 74 + 75 + plb { 76 + compatible = "ibm,plb-4xx", "ibm,plb4"; /* Could be PLB6, doesn't matter */ 77 + #address-cells = <2>; 78 + #size-cells = <1>; 79 + ranges; 80 + clock-frequency = <0>; // Filled in by zImage 81 + 82 + POB0: opb { 83 + compatible = "ibm,opb-4xx", "ibm,opb"; 84 + #address-cells = <1>; 85 + #size-cells = <1>; 86 + /* Wish there was a nicer way of specifying a full 32-bit 87 + range */ 88 + ranges = <0x00000000 0x00000001 0x00000000 0x80000000 89 + 0x80000000 0x00000001 0x80000000 0x80000000>; 90 + clock-frequency = <0>; // Filled in by zImage 91 + UART0: serial@40000200 { 92 + device_type = "serial"; 93 + compatible = "ns16550a"; 94 + reg = <0x40000200 0x00000008>; 95 + virtual-reg = <0xe0000200>; 96 + clock-frequency = <11059200>; 97 + current-speed = <115200>; 98 + interrupt-parent = <&UIC0>; 99 + interrupts = <0x0 0x4>; 100 + }; 101 + }; 102 + }; 103 + 104 + nvrtc { 105 + compatible = "ds1743-nvram", "ds1743", "rtc-ds1743"; 106 + reg = <0 0xEF703000 0x2000>; 107 + }; 108 + iss-block { 109 + compatible = "ibm,iss-sim-block-device"; 110 + reg = <0 0xEF701000 0x1000>; 111 + }; 112 + 113 + chosen { 114 + linux,stdout-path = "/plb/opb/serial@40000200"; 115 + }; 116 + };
+56
arch/powerpc/boot/treeboot-iss4xx.c
··· 1 + /* 2 + * Copyright 2010 Ben. Herrenschmidt, IBM Corporation. 3 + * 4 + * Based on earlier code: 5 + * Copyright (C) Paul Mackerras 1997. 6 + * 7 + * Matt Porter <mporter@kernel.crashing.org> 8 + * Copyright 2002-2005 MontaVista Software Inc. 9 + * 10 + * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 11 + * Copyright (c) 2003, 2004 Zultys Technologies 12 + * 13 + * Copyright 2007 David Gibson, IBM Corporation. 14 + * 15 + * This program is free software; you can redistribute it and/or 16 + * modify it under the terms of the GNU General Public License 17 + * as published by the Free Software Foundation; either version 18 + * 2 of the License, or (at your option) any later version. 19 + */ 20 + #include <stdarg.h> 21 + #include <stddef.h> 22 + #include "types.h" 23 + #include "elf.h" 24 + #include "string.h" 25 + #include "stdio.h" 26 + #include "page.h" 27 + #include "ops.h" 28 + #include "reg.h" 29 + #include "io.h" 30 + #include "dcr.h" 31 + #include "4xx.h" 32 + #include "44x.h" 33 + #include "libfdt.h" 34 + 35 + BSS_STACK(4096); 36 + 37 + static void iss_4xx_fixups(void) 38 + { 39 + ibm4xx_sdram_fixup_memsize(); 40 + } 41 + 42 + #define SPRN_PIR 0x11E /* Processor Indentification Register */ 43 + void platform_init(void) 44 + { 45 + unsigned long end_of_ram = 0x08000000; 46 + unsigned long avail_ram = end_of_ram - (unsigned long)_end; 47 + u32 pir_reg; 48 + 49 + simple_alloc_init(_end, avail_ram, 128, 64); 50 + platform_ops.fixups = iss_4xx_fixups; 51 + platform_ops.exit = ibm44x_dbcr_reset; 52 + pir_reg = mfspr(SPRN_PIR); 53 + fdt_set_boot_cpuid_phys(_dtb_start, pir_reg); 54 + fdt_init(_dtb_start); 55 + serial_console_init(); 56 + }
+3
arch/powerpc/boot/wrapper
··· 241 241 link_address='0x600000' 242 242 platformo="$object/$platform-head.o $object/$platform.o" 243 243 ;; 244 + treeboot-iss4xx-mpic) 245 + platformo="$object/treeboot-iss4xx.o" 246 + ;; 244 247 esac 245 248 246 249 vmz="$tmpdir/`basename \"$kernel\"`.$ext"
+3
arch/powerpc/include/asm/reg.h
··· 854 854 #define PVR_8245 0x80811014 855 855 #define PVR_8260 PVR_8240 856 856 857 + /* 476 Simulator seems to currently have the PVR of the 602... */ 858 + #define PVR_476_ISS 0x00052000 859 + 857 860 /* 64-bit processors */ 858 861 /* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ 859 862 #define PV_NORTHSTAR 0x0033
+15
arch/powerpc/kernel/cputable.c
··· 1715 1715 .machine_check = machine_check_47x, 1716 1716 .platform = "ppc470", 1717 1717 }, 1718 + { /* 476 iss */ 1719 + .pvr_mask = 0xffff0000, 1720 + .pvr_value = 0x00050000, 1721 + .cpu_name = "476", 1722 + .cpu_features = CPU_FTRS_47X, 1723 + .cpu_user_features = COMMON_USER_BOOKE | 1724 + PPC_FEATURE_HAS_FPU, 1725 + .cpu_user_features = COMMON_USER_BOOKE, 1726 + .mmu_features = MMU_FTR_TYPE_47x | 1727 + MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL, 1728 + .icache_bsize = 32, 1729 + .dcache_bsize = 128, 1730 + .machine_check = machine_check_47x, 1731 + .platform = "ppc470", 1732 + }, 1718 1733 { /* default match */ 1719 1734 .pvr_mask = 0x00000000, 1720 1735 .pvr_value = 0x00000000,
+2
arch/powerpc/kernel/head_44x.S
··· 715 715 srwi r3,r3,16 716 716 cmplwi cr0,r3,PVR_476@h 717 717 beq head_start_47x 718 + cmplwi cr0,r3,PVR_476_ISS@h 719 + beq head_start_47x 718 720 #endif /* CONFIG_PPC_47x */ 719 721 720 722 /*
+11
arch/powerpc/platforms/44x/Kconfig
··· 160 160 help 161 161 This option enables support for the AMCC PPC440EP evaluation board. 162 162 163 + config ISS4xx 164 + bool "ISS 4xx Simulator" 165 + depends on (44x || 40x) 166 + default n 167 + select 405GP if 40x 168 + select 440GP if 44x && !PPC_47x 169 + select PPC_FPU 170 + select OF_RTC 171 + help 172 + This option enables support for the IBM ISS simulation environment 173 + 163 174 #config LUAN 164 175 # bool "Luan" 165 176 # depends on 44x
+1
arch/powerpc/platforms/44x/Makefile
··· 5 5 obj-$(CONFIG_WARP) += warp.o 6 6 obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o 7 7 obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o 8 + obj-$(CONFIG_ISS4xx) += iss4xx.o
+167
arch/powerpc/platforms/44x/iss4xx.c
··· 1 + /* 2 + * PPC476 board specific routines 3 + * 4 + * Copyright 2010 Torez Smith, IBM Corporation. 5 + * 6 + * Based on earlier code: 7 + * Matt Porter <mporter@kernel.crashing.org> 8 + * Copyright 2002-2005 MontaVista Software Inc. 9 + * 10 + * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 11 + * Copyright (c) 2003-2005 Zultys Technologies 12 + * 13 + * Rewritten and ported to the merged powerpc tree: 14 + * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation. 15 + * 16 + * This program is free software; you can redistribute it and/or modify it 17 + * under the terms of the GNU General Public License as published by the 18 + * Free Software Foundation; either version 2 of the License, or (at your 19 + * option) any later version. 20 + */ 21 + 22 + #include <linux/init.h> 23 + #include <linux/of_platform.h> 24 + #include <linux/rtc.h> 25 + 26 + #include <asm/machdep.h> 27 + #include <asm/prom.h> 28 + #include <asm/udbg.h> 29 + #include <asm/time.h> 30 + #include <asm/uic.h> 31 + #include <asm/ppc4xx.h> 32 + #include <asm/mpic.h> 33 + #include <asm/mmu.h> 34 + 35 + static __initdata struct of_device_id iss4xx_of_bus[] = { 36 + { .compatible = "ibm,plb4", }, 37 + { .compatible = "ibm,plb6", }, 38 + { .compatible = "ibm,opb", }, 39 + { .compatible = "ibm,ebc", }, 40 + {}, 41 + }; 42 + 43 + static int __init iss4xx_device_probe(void) 44 + { 45 + of_platform_bus_probe(NULL, iss4xx_of_bus, NULL); 46 + of_instantiate_rtc(); 47 + 48 + return 0; 49 + } 50 + machine_device_initcall(iss4xx, iss4xx_device_probe); 51 + 52 + /* We can have either UICs or MPICs */ 53 + static void __init iss4xx_init_irq(void) 54 + { 55 + struct device_node *np; 56 + 57 + /* Find top level interrupt controller */ 58 + for_each_node_with_property(np, "interrupt-controller") { 59 + if (of_get_property(np, "interrupts", NULL) == NULL) 60 + break; 61 + } 62 + if (np == NULL) 63 + panic("Can't find top level interrupt controller"); 64 + 65 + /* Check type and do appropriate initialization */ 66 + if (of_device_is_compatible(np, "ibm,uic")) { 67 + uic_init_tree(); 68 + ppc_md.get_irq = uic_get_irq; 69 + #ifdef CONFIG_MPIC 70 + } else if (of_device_is_compatible(np, "chrp,open-pic")) { 71 + /* The MPIC driver will get everything it needs from the 72 + * device-tree, just pass 0 to all arguments 73 + */ 74 + struct mpic *mpic = mpic_alloc(np, 0, MPIC_PRIMARY, 0, 0, 75 + " MPIC "); 76 + BUG_ON(mpic == NULL); 77 + mpic_init(mpic); 78 + ppc_md.get_irq = mpic_get_irq; 79 + #endif 80 + } else 81 + panic("Unrecognized top level interrupt controller"); 82 + } 83 + 84 + #ifdef CONFIG_SMP 85 + static void __cpuinit smp_iss4xx_setup_cpu(int cpu) 86 + { 87 + mpic_setup_this_cpu(); 88 + } 89 + 90 + static void __cpuinit smp_iss4xx_kick_cpu(int cpu) 91 + { 92 + struct device_node *cpunode = of_get_cpu_node(cpu, NULL); 93 + const u64 *spin_table_addr_prop; 94 + u32 *spin_table; 95 + extern void start_secondary_47x(void); 96 + 97 + BUG_ON(cpunode == NULL); 98 + 99 + /* Assume spin table. We could test for the enable-method in 100 + * the device-tree but currently there's little point as it's 101 + * our only supported method 102 + */ 103 + spin_table_addr_prop = of_get_property(cpunode, "cpu-release-addr", 104 + NULL); 105 + if (spin_table_addr_prop == NULL) { 106 + pr_err("CPU%d: Can't start, missing cpu-release-addr !\n", cpu); 107 + return; 108 + } 109 + 110 + /* Assume it's mapped as part of the linear mapping. This is a bit 111 + * fishy but will work fine for now 112 + */ 113 + spin_table = (u32 *)__va(*spin_table_addr_prop); 114 + pr_debug("CPU%d: Spin table mapped at %p\n", cpu, spin_table); 115 + 116 + spin_table[3] = cpu; 117 + smp_wmb(); 118 + spin_table[1] = __pa(start_secondary_47x); 119 + mb(); 120 + } 121 + 122 + static struct smp_ops_t iss_smp_ops = { 123 + .probe = smp_mpic_probe, 124 + .message_pass = smp_mpic_message_pass, 125 + .setup_cpu = smp_iss4xx_setup_cpu, 126 + .kick_cpu = smp_iss4xx_kick_cpu, 127 + .give_timebase = smp_generic_give_timebase, 128 + .take_timebase = smp_generic_take_timebase, 129 + }; 130 + 131 + static void __init iss4xx_smp_init(void) 132 + { 133 + if (mmu_has_feature(MMU_FTR_TYPE_47x)) 134 + smp_ops = &iss_smp_ops; 135 + } 136 + 137 + #else /* CONFIG_SMP */ 138 + static void __init iss4xx_smp_init(void) { } 139 + #endif /* CONFIG_SMP */ 140 + 141 + static void __init iss4xx_setup_arch(void) 142 + { 143 + iss4xx_smp_init(); 144 + } 145 + 146 + /* 147 + * Called very early, MMU is off, device-tree isn't unflattened 148 + */ 149 + static int __init iss4xx_probe(void) 150 + { 151 + unsigned long root = of_get_flat_dt_root(); 152 + 153 + if (!of_flat_dt_is_compatible(root, "ibm,iss-4xx")) 154 + return 0; 155 + 156 + return 1; 157 + } 158 + 159 + define_machine(iss4xx) { 160 + .name = "ISS-4xx", 161 + .probe = iss4xx_probe, 162 + .progress = udbg_progress, 163 + .init_IRQ = iss4xx_init_irq, 164 + .setup_arch = iss4xx_setup_arch, 165 + .restart = ppc4xx_reset_system, 166 + .calibrate_decr = generic_calibrate_decr, 167 + };