aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Chivers <schivers@mandarin.aust.csc.com>2014-01-08 21:01:22 -0500
committerScott Wood <scottwood@freescale.com>2014-01-09 18:52:20 -0500
commitbe2019816e4dcdb02493da332b65a8b68b70106c (patch)
treeb2c47559961832b8a0ad35cccdd7676df08d90cb
parentbbead78c06e0ddda3cc53f81ecdaa2062a56247a (diff)
powerpc/embedded6xx: Add support for Motorola/Emerson MVME5100
Add support for the Motorola/Emerson MVME5100 Single Board Computer. The MVME5100 is a 6U form factor VME64 computer with: - A single MPC7410 or MPC750 CPU - A HAWK Processor Host Bridge (CPU to PCI) and MultiProcessor Interrupt Controller (MPIC) - Up to 500Mb of onboard memory - A M48T37 Real Time Clock (RTC) and Non-Volatile Memory chip - Two 16550 compatible UARTS - Two Intel E100 Fast Ethernets - Two PCI Mezzanine Card (PMC) Slots - PPCBug Firmware The HAWK PHB/MPIC is compatible with the MPC10x devices. There is no onboard disk support. This is usually provided by installing a PMC in first PMC slot. This patch revives the board support, it was present in early 2.6 series kernels. The board support in those days was by Matt Porter of MontaVista Software. CSC Australia has around 31 of these boards in service. The kernel in use for the boards is based on 2.6.31. The boards are operated without disks from a file server. This patch is based on linux-3.13-rc2 and has been boot tested. Only boards with 512 Mb of memory are known to work. Signed-off-by: Stephen Chivers <schivers@csc.com> Tested-by: Alessio Igor Bogani <alessio.bogani@elettra.eu> Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r--arch/powerpc/boot/Makefile3
-rw-r--r--arch/powerpc/boot/dts/mvme5100.dts185
-rw-r--r--arch/powerpc/boot/mvme5100.c27
-rwxr-xr-xarch/powerpc/boot/wrapper4
-rw-r--r--arch/powerpc/configs/mvme5100_defconfig144
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig13
-rw-r--r--arch/powerpc/platforms/embedded6xx/Makefile1
-rw-r--r--arch/powerpc/platforms/embedded6xx/mvme5100.c221
8 files changed, 596 insertions, 2 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index ca7f08cc4afd..cd9ea99f9fdc 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -95,7 +95,7 @@ src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
95src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \ 95src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
96 cuboot-c2k.c gamecube-head.S \ 96 cuboot-c2k.c gamecube-head.S \
97 gamecube.c wii-head.S wii.c holly.c \ 97 gamecube.c wii-head.S wii.c holly.c \
98 prpmc2800.c 98 prpmc2800.c fixed-head.S mvme5100.c
99src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 99src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
100src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c 100src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c 101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
@@ -286,6 +286,7 @@ image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2
286image-$(CONFIG_PPC_C2K) += cuImage.c2k 286image-$(CONFIG_PPC_C2K) += cuImage.c2k
287image-$(CONFIG_GAMECUBE) += dtbImage.gamecube 287image-$(CONFIG_GAMECUBE) += dtbImage.gamecube
288image-$(CONFIG_WII) += dtbImage.wii 288image-$(CONFIG_WII) += dtbImage.wii
289image-$(CONFIG_MVME5100) += dtbImage.mvme5100
289 290
290# Board port in arch/powerpc/platform/amigaone/Kconfig 291# Board port in arch/powerpc/platform/amigaone/Kconfig
291image-$(CONFIG_AMIGAONE) += cuImage.amigaone 292image-$(CONFIG_AMIGAONE) += cuImage.amigaone
diff --git a/arch/powerpc/boot/dts/mvme5100.dts b/arch/powerpc/boot/dts/mvme5100.dts
new file mode 100644
index 000000000000..1ecb341a232a
--- /dev/null
+++ b/arch/powerpc/boot/dts/mvme5100.dts
@@ -0,0 +1,185 @@
1/*
2 * Device Tree Source for Motorola/Emerson MVME5100.
3 *
4 * Copyright 2013 CSC Australia Pty. Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without
8 * any warranty of any kind, whether express or implied.
9 */
10
11/dts-v1/;
12
13/ {
14 model = "MVME5100";
15 compatible = "MVME5100";
16 #address-cells = <1>;
17 #size-cells = <1>;
18
19 aliases {
20 serial0 = &serial0;
21 pci0 = &pci0;
22 };
23
24 cpus {
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 PowerPC,7410 {
29 device_type = "cpu";
30 reg = <0x0>;
31 /* Following required by dtc but not used */
32 d-cache-line-size = <32>;
33 i-cache-line-size = <32>;
34 i-cache-size = <32768>;
35 d-cache-size = <32768>;
36 timebase-frequency = <25000000>;
37 clock-frequency = <500000000>;
38 bus-frequency = <100000000>;
39 };
40 };
41
42 memory {
43 device_type = "memory";
44 reg = <0x0 0x20000000>;
45 };
46
47 hawk@fef80000 {
48 #address-cells = <1>;
49 #size-cells = <1>;
50 compatible = "hawk-bridge", "simple-bus";
51 ranges = <0x0 0xfef80000 0x10000>;
52 reg = <0xfef80000 0x10000>;
53
54 serial0: serial@8000 {
55 device_type = "serial";
56 compatible = "ns16550";
57 reg = <0x8000 0x80>;
58 reg-shift = <4>;
59 clock-frequency = <1843200>;
60 current-speed = <9600>;
61 interrupts = <1 1>; // IRQ1 Level Active Low.
62 interrupt-parent = <&mpic>;
63 };
64
65 serial1: serial@8200 {
66 device_type = "serial";
67 compatible = "ns16550";
68 reg = <0x8200 0x80>;
69 reg-shift = <4>;
70 clock-frequency = <1843200>;
71 current-speed = <9600>;
72 interrupts = <1 1>; // IRQ1 Level Active Low.
73 interrupt-parent = <&mpic>;
74 };
75
76 mpic: interrupt-controller@f3f80000 {
77 #interrupt-cells = <2>;
78 #address-cells = <0>;
79 device_type = "open-pic";
80 compatible = "chrp,open-pic";
81 interrupt-controller;
82 reg = <0xf3f80000 0x40000>;
83 };
84 };
85
86 pci0: pci@feff0000 {
87 #address-cells = <3>;
88 #size-cells = <2>;
89 #interrupt-cells = <1>;
90 device_type = "pci";
91 compatible = "hawk-pci";
92 reg = <0xfec00000 0x400000>;
93 8259-interrupt-acknowledge = <0xfeff0030>;
94 ranges = <0x1000000 0x0 0x0 0xfe000000 0x0 0x800000
95 0x2000000 0x0 0x80000000 0x80000000 0x0 0x74000000>;
96 bus-range = <0 255>;
97 clock-frequency = <33333333>;
98 interrupt-parent = <&mpic>;
99 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
100 interrupt-map = <
101
102 /*
103 * This definition (IDSEL 11) duplicates the
104 * interrupts definition in the i8259
105 * interrupt controller below.
106 *
107 * Do not change the interrupt sense/polarity from
108 * 0x2 to anything else, doing so will cause endless
109 * "spurious" i8259 interrupts to be fielded.
110 */
111 // IDSEL 11 - iPMC712 PCI/ISA Bridge
112 0x5800 0x0 0x0 0x1 &mpic 0x0 0x2
113 0x5800 0x0 0x0 0x2 &mpic 0x0 0x2
114 0x5800 0x0 0x0 0x3 &mpic 0x0 0x2
115 0x5800 0x0 0x0 0x4 &mpic 0x0 0x2
116
117 /* IDSEL 12 - Not Used */
118
119 /* IDSEL 13 - Universe VME Bridge */
120 0x6800 0x0 0x0 0x1 &mpic 0x5 0x1
121 0x6800 0x0 0x0 0x2 &mpic 0x6 0x1
122 0x6800 0x0 0x0 0x3 &mpic 0x7 0x1
123 0x6800 0x0 0x0 0x4 &mpic 0x8 0x1
124
125 /* IDSEL 14 - ENET 1 */
126 0x7000 0x0 0x0 0x1 &mpic 0x2 0x1
127
128 /* IDSEL 15 - Not Used */
129
130 /* IDSEL 16 - PMC Slot 1 */
131 0x8000 0x0 0x0 0x1 &mpic 0x9 0x1
132 0x8000 0x0 0x0 0x2 &mpic 0xa 0x1
133 0x8000 0x0 0x0 0x3 &mpic 0xb 0x1
134 0x8000 0x0 0x0 0x4 &mpic 0xc 0x1
135
136 /* IDSEL 17 - PMC Slot 2 */
137 0x8800 0x0 0x0 0x1 &mpic 0xc 0x1
138 0x8800 0x0 0x0 0x2 &mpic 0x9 0x1
139 0x8800 0x0 0x0 0x3 &mpic 0xa 0x1
140 0x8800 0x0 0x0 0x4 &mpic 0xb 0x1
141
142 /* IDSEL 18 - Not Used */
143
144 /* IDSEL 19 - ENET 2 */
145 0x9800 0x0 0x0 0x1 &mpic 0xd 0x1
146
147 /* IDSEL 20 - PMCSPAN (PCI-X) */
148 0xa000 0x0 0x0 0x1 &mpic 0x9 0x1
149 0xa000 0x0 0x0 0x2 &mpic 0xa 0x1
150 0xa000 0x0 0x0 0x3 &mpic 0xb 0x1
151 0xa000 0x0 0x0 0x4 &mpic 0xc 0x1
152
153 >;
154
155 isa {
156 #address-cells = <2>;
157 #size-cells = <1>;
158 #interrupt-cells = <2>;
159 device_type = "isa";
160 compatible = "isa";
161 ranges = <0x00000001 0 0x01000000 0 0x00000000 0x00001000>;
162 interrupt-parent = <&i8259>;
163
164 i8259: interrupt-controller@20 {
165 #interrupt-cells = <2>;
166 #address-cells = <0>;
167 interrupts = <0 2>;
168 device_type = "interrupt-controller";
169 compatible = "chrp,iic";
170 interrupt-controller;
171 reg = <1 0x00000020 0x00000002
172 1 0x000000a0 0x00000002
173 1 0x000004d0 0x00000002>;
174 interrupt-parent = <&mpic>;
175 };
176
177 };
178
179 };
180
181 chosen {
182 linux,stdout-path = &serial0;
183 };
184
185};
diff --git a/arch/powerpc/boot/mvme5100.c b/arch/powerpc/boot/mvme5100.c
new file mode 100644
index 000000000000..cb865f83c60b
--- /dev/null
+++ b/arch/powerpc/boot/mvme5100.c
@@ -0,0 +1,27 @@
1/*
2 * Motorola/Emerson MVME5100 with PPCBug firmware.
3 *
4 * Author: Stephen Chivers <schivers@csc.com>
5 *
6 * Copyright 2013 CSC Australia Pty. Ltd.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 */
13#include "types.h"
14#include "ops.h"
15#include "io.h"
16
17BSS_STACK(4096);
18
19void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
20{
21 u32 heapsize;
22
23 heapsize = 0x8000000 - (u32)_end; /* 128M */
24 simple_alloc_init(_end, heapsize, 32, 64);
25 fdt_init(_dtb_start);
26 serial_console_init();
27}
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 2e1af74a64be..d27a25518b01 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -265,6 +265,10 @@ epapr)
265 link_address='0x20000000' 265 link_address='0x20000000'
266 pie=-pie 266 pie=-pie
267 ;; 267 ;;
268mvme5100)
269 platformo="$object/fixed-head.o $object/mvme5100.o"
270 binary=y
271 ;;
268esac 272esac
269 273
270vmz="$tmpdir/`basename \"$kernel\"`.$ext" 274vmz="$tmpdir/`basename \"$kernel\"`.$ext"
diff --git a/arch/powerpc/configs/mvme5100_defconfig b/arch/powerpc/configs/mvme5100_defconfig
new file mode 100644
index 000000000000..93c7752e2dbb
--- /dev/null
+++ b/arch/powerpc/configs/mvme5100_defconfig
@@ -0,0 +1,144 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14
8# CONFIG_UTS_NS is not set
9# CONFIG_IPC_NS is not set
10# CONFIG_PID_NS is not set
11# CONFIG_NET_NS is not set
12CONFIG_CC_OPTIMIZE_FOR_SIZE=y
13# CONFIG_COMPAT_BRK is not set
14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y
16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_PPC_CHRP is not set
18# CONFIG_PPC_PMAC is not set
19CONFIG_EMBEDDED6xx=y
20CONFIG_MVME5100=y
21CONFIG_KVM_GUEST=y
22CONFIG_HZ_100=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_COMPACTION is not set
25CONFIG_CMDLINE_BOOL=y
26CONFIG_CMDLINE="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
27CONFIG_NET=y
28CONFIG_PACKET=y
29CONFIG_UNIX=y
30CONFIG_INET=y
31CONFIG_IP_MULTICAST=y
32CONFIG_IP_PNP=y
33CONFIG_IP_PNP_DHCP=y
34CONFIG_IP_PNP_BOOTP=y
35# CONFIG_INET_LRO is not set
36# CONFIG_IPV6 is not set
37CONFIG_NETFILTER=y
38CONFIG_NF_CONNTRACK=m
39CONFIG_NF_CT_PROTO_SCTP=m
40CONFIG_NF_CONNTRACK_AMANDA=m
41CONFIG_NF_CONNTRACK_FTP=m
42CONFIG_NF_CONNTRACK_H323=m
43CONFIG_NF_CONNTRACK_IRC=m
44CONFIG_NF_CONNTRACK_NETBIOS_NS=m
45CONFIG_NF_CONNTRACK_PPTP=m
46CONFIG_NF_CONNTRACK_SIP=m
47CONFIG_NF_CONNTRACK_TFTP=m
48CONFIG_NETFILTER_XT_MATCH_MAC=m
49CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
50CONFIG_NETFILTER_XT_MATCH_STATE=m
51CONFIG_NF_CONNTRACK_IPV4=m
52CONFIG_IP_NF_IPTABLES=m
53CONFIG_IP_NF_FILTER=m
54CONFIG_IP_NF_TARGET_REJECT=m
55CONFIG_IP_NF_MANGLE=m
56CONFIG_IP_NF_TARGET_ECN=m
57CONFIG_IP_NF_TARGET_TTL=m
58CONFIG_IP_NF_RAW=m
59CONFIG_IP_NF_ARPTABLES=m
60CONFIG_IP_NF_ARPFILTER=m
61CONFIG_IP_NF_ARP_MANGLE=m
62CONFIG_LAPB=m
63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
64CONFIG_PROC_DEVICETREE=y
65CONFIG_BLK_DEV_LOOP=y
66CONFIG_BLK_DEV_RAM=y
67CONFIG_BLK_DEV_RAM_COUNT=2
68CONFIG_BLK_DEV_RAM_SIZE=8192
69CONFIG_EEPROM_LEGACY=m
70CONFIG_NETDEVICES=y
71CONFIG_TUN=m
72# CONFIG_NET_VENDOR_3COM is not set
73CONFIG_E100=y
74# CONFIG_WLAN is not set
75# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
76# CONFIG_INPUT_KEYBOARD is not set
77# CONFIG_INPUT_MOUSE is not set
78# CONFIG_SERIO is not set
79CONFIG_SERIAL_8250=y
80CONFIG_SERIAL_8250_CONSOLE=y
81CONFIG_SERIAL_8250_NR_UARTS=10
82CONFIG_SERIAL_8250_EXTENDED=y
83CONFIG_SERIAL_8250_MANY_PORTS=y
84CONFIG_SERIAL_8250_SHARE_IRQ=y
85CONFIG_SERIAL_OF_PLATFORM=y
86CONFIG_HW_RANDOM=y
87CONFIG_I2C=y
88CONFIG_I2C_CHARDEV=y
89CONFIG_I2C_MPC=y
90# CONFIG_HWMON is not set
91CONFIG_VIDEO_OUTPUT_CONTROL=m
92# CONFIG_VGA_CONSOLE is not set
93# CONFIG_HID is not set
94# CONFIG_USB_SUPPORT is not set
95# CONFIG_IOMMU_SUPPORT is not set
96CONFIG_VME_BUS=m
97CONFIG_VME_CA91CX42=m
98CONFIG_EXT2_FS=m
99CONFIG_EXT3_FS=m
100# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
101CONFIG_XFS_FS=m
102CONFIG_ISO9660_FS=m
103CONFIG_JOLIET=y
104CONFIG_ZISOFS=y
105CONFIG_UDF_FS=m
106CONFIG_MSDOS_FS=m
107CONFIG_VFAT_FS=m
108CONFIG_PROC_KCORE=y
109CONFIG_TMPFS=y
110CONFIG_NFS_FS=y
111CONFIG_NFS_V3_ACL=y
112CONFIG_NFS_V4=y
113CONFIG_ROOT_NFS=y
114CONFIG_NFSD=m
115CONFIG_NFSD_V3=y
116CONFIG_CIFS=m
117CONFIG_NLS=y
118CONFIG_NLS_CODEPAGE_437=m
119CONFIG_NLS_CODEPAGE_932=m
120CONFIG_NLS_ISO8859_1=m
121CONFIG_NLS_UTF8=m
122CONFIG_CRC_CCITT=m
123CONFIG_CRC_T10DIF=y
124CONFIG_XZ_DEC=y
125CONFIG_XZ_DEC_X86=y
126CONFIG_XZ_DEC_IA64=y
127CONFIG_XZ_DEC_ARM=y
128CONFIG_XZ_DEC_ARMTHUMB=y
129CONFIG_XZ_DEC_SPARC=y
130CONFIG_MAGIC_SYSRQ=y
131CONFIG_DEBUG_KERNEL=y
132CONFIG_DETECT_HUNG_TASK=y
133CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
134CONFIG_CRYPTO_CBC=y
135CONFIG_CRYPTO_PCBC=m
136CONFIG_CRYPTO_MD5=y
137CONFIG_CRYPTO_MICHAEL_MIC=m
138CONFIG_CRYPTO_SHA1=m
139CONFIG_CRYPTO_BLOWFISH=m
140CONFIG_CRYPTO_DES=y
141CONFIG_CRYPTO_SERPENT=m
142CONFIG_CRYPTO_TWOFISH=m
143CONFIG_CRYPTO_DEFLATE=m
144# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 302ba43d73a1..6d3c7a9fd047 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -67,6 +67,18 @@ config PPC_C2K
67 This option enables support for the GE Fanuc C2K board (formerly 67 This option enables support for the GE Fanuc C2K board (formerly
68 an SBS board). 68 an SBS board).
69 69
70config MVME5100
71 bool "Motorola/Emerson MVME5100"
72 depends on EMBEDDED6xx
73 select MPIC
74 select PCI
75 select PPC_INDIRECT_PCI
76 select PPC_I8259
77 select PPC_NATIVE
78 help
79 This option enables support for the Motorola (now Emerson) MVME5100
80 board.
81
70config TSI108_BRIDGE 82config TSI108_BRIDGE
71 bool 83 bool
72 select PCI 84 select PCI
@@ -113,4 +125,3 @@ config WII
113 help 125 help
114 Select WII if configuring for the Nintendo Wii. 126 Select WII if configuring for the Nintendo Wii.
115 More information at: <http://gc-linux.sourceforge.net/> 127 More information at: <http://gc-linux.sourceforge.net/>
116
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 66c23e423f40..cdd48d402b93 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_USBGECKO_UDBG) += usbgecko_udbg.o
11obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o 11obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o
12obj-$(CONFIG_GAMECUBE) += gamecube.o 12obj-$(CONFIG_GAMECUBE) += gamecube.o
13obj-$(CONFIG_WII) += wii.o hlwd-pic.o 13obj-$(CONFIG_WII) += wii.o hlwd-pic.o
14obj-$(CONFIG_MVME5100) += mvme5100.o
diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
new file mode 100644
index 000000000000..25e3bfb64efb
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -0,0 +1,221 @@
1/*
2 * Board setup routines for the Motorola/Emerson MVME5100.
3 *
4 * Copyright 2013 CSC Australia Pty. Ltd.
5 *
6 * Based on earlier code by:
7 *
8 * Matt Porter, MontaVista Software Inc.
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * Author: Stephen Chivers <schivers@csc.com>
17 *
18 */
19
20#include <linux/of_platform.h>
21
22#include <asm/i8259.h>
23#include <asm/pci-bridge.h>
24#include <asm/mpic.h>
25#include <asm/prom.h>
26#include <mm/mmu_decl.h>
27#include <asm/udbg.h>
28
29#define HAWK_MPIC_SIZE 0x00040000U
30#define MVME5100_PCI_MEM_OFFSET 0x00000000
31
32/* Board register addresses. */
33#define BOARD_STATUS_REG 0xfef88080
34#define BOARD_MODFAIL_REG 0xfef88090
35#define BOARD_MODRST_REG 0xfef880a0
36#define BOARD_TBEN_REG 0xfef880c0
37#define BOARD_SW_READ_REG 0xfef880e0
38#define BOARD_GEO_ADDR_REG 0xfef880e8
39#define BOARD_EXT_FEATURE1_REG 0xfef880f0
40#define BOARD_EXT_FEATURE2_REG 0xfef88100
41
42static phys_addr_t pci_membase;
43static u_char *restart;
44
45static void mvme5100_8259_cascade(unsigned int irq, struct irq_desc *desc)
46{
47 struct irq_chip *chip = irq_desc_get_chip(desc);
48 unsigned int cascade_irq = i8259_irq();
49
50 if (cascade_irq != NO_IRQ)
51 generic_handle_irq(cascade_irq);
52
53 chip->irq_eoi(&desc->irq_data);
54}
55
56static void __init mvme5100_pic_init(void)
57{
58 struct mpic *mpic;
59 struct device_node *np;
60 struct device_node *cp = NULL;
61 unsigned int cirq;
62 unsigned long intack = 0;
63 const u32 *prop = NULL;
64
65 np = of_find_node_by_type(NULL, "open-pic");
66 if (!np) {
67 pr_err("Could not find open-pic node\n");
68 return;
69 }
70
71 mpic = mpic_alloc(np, pci_membase, 0, 16, 256, " OpenPIC ");
72
73 BUG_ON(mpic == NULL);
74 of_node_put(np);
75
76 mpic_assign_isu(mpic, 0, pci_membase + 0x10000);
77
78 mpic_init(mpic);
79
80 cp = of_find_compatible_node(NULL, NULL, "chrp,iic");
81 if (cp == NULL) {
82 pr_warn("mvme5100_pic_init: couldn't find i8259\n");
83 return;
84 }
85
86 cirq = irq_of_parse_and_map(cp, 0);
87 if (cirq == NO_IRQ) {
88 pr_warn("mvme5100_pic_init: no cascade interrupt?\n");
89 return;
90 }
91
92 np = of_find_compatible_node(NULL, "pci", "mpc10x-pci");
93 if (np) {
94 prop = of_get_property(np, "8259-interrupt-acknowledge", NULL);
95
96 if (prop)
97 intack = prop[0];
98
99 of_node_put(np);
100 }
101
102 if (intack)
103 pr_debug("mvme5100_pic_init: PCI 8259 intack at 0x%016lx\n",
104 intack);
105
106 i8259_init(cp, intack);
107 of_node_put(cp);
108 irq_set_chained_handler(cirq, mvme5100_8259_cascade);
109}
110
111static int __init mvme5100_add_bridge(struct device_node *dev)
112{
113 const int *bus_range;
114 int len;
115 struct pci_controller *hose;
116 unsigned short devid;
117
118 pr_info("Adding PCI host bridge %s\n", dev->full_name);
119
120 bus_range = of_get_property(dev, "bus-range", &len);
121
122 hose = pcibios_alloc_controller(dev);
123 if (hose == NULL)
124 return -ENOMEM;
125
126 hose->first_busno = bus_range ? bus_range[0] : 0;
127 hose->last_busno = bus_range ? bus_range[1] : 0xff;
128
129 setup_indirect_pci(hose, 0xfe000cf8, 0xfe000cfc, 0);
130
131 pci_process_bridge_OF_ranges(hose, dev, 1);
132
133 early_read_config_word(hose, 0, 0, PCI_DEVICE_ID, &devid);
134
135 if (devid != PCI_DEVICE_ID_MOTOROLA_HAWK) {
136 pr_err("HAWK PHB not present?\n");
137 return 0;
138 }
139
140 early_read_config_dword(hose, 0, 0, PCI_BASE_ADDRESS_1, &pci_membase);
141
142 if (pci_membase == 0) {
143 pr_err("HAWK PHB mibar not correctly set?\n");
144 return 0;
145 }
146
147 pr_info("mvme5100_pic_init: pci_membase: %x\n", pci_membase);
148
149 return 0;
150}
151
152static struct of_device_id mvme5100_of_bus_ids[] __initdata = {
153 { .compatible = "hawk-bridge", },
154 {},
155};
156
157/*
158 * Setup the architecture
159 */
160static void __init mvme5100_setup_arch(void)
161{
162 struct device_node *np;
163
164 if (ppc_md.progress)
165 ppc_md.progress("mvme5100_setup_arch()", 0);
166
167 for_each_compatible_node(np, "pci", "hawk-pci")
168 mvme5100_add_bridge(np);
169
170 restart = ioremap(BOARD_MODRST_REG, 4);
171}
172
173
174static void mvme5100_show_cpuinfo(struct seq_file *m)
175{
176 seq_puts(m, "Vendor\t\t: Motorola/Emerson\n");
177 seq_puts(m, "Machine\t\t: MVME5100\n");
178}
179
180static void mvme5100_restart(char *cmd)
181{
182
183 local_irq_disable();
184 mtmsr(mfmsr() | MSR_IP);
185
186 out_8((u_char *) restart, 0x01);
187
188 while (1)
189 ;
190}
191
192/*
193 * Called very early, device-tree isn't unflattened
194 */
195static int __init mvme5100_probe(void)
196{
197 unsigned long root = of_get_flat_dt_root();
198
199 return of_flat_dt_is_compatible(root, "MVME5100");
200}
201
202static int __init probe_of_platform_devices(void)
203{
204
205 of_platform_bus_probe(NULL, mvme5100_of_bus_ids, NULL);
206 return 0;
207}
208
209machine_device_initcall(mvme5100, probe_of_platform_devices);
210
211define_machine(mvme5100) {
212 .name = "MVME5100",
213 .probe = mvme5100_probe,
214 .setup_arch = mvme5100_setup_arch,
215 .init_IRQ = mvme5100_pic_init,
216 .show_cpuinfo = mvme5100_show_cpuinfo,
217 .get_irq = mpic_get_irq,
218 .restart = mvme5100_restart,
219 .calibrate_decr = generic_calibrate_decr,
220 .progress = udbg_progress,
221};