diff options
Diffstat (limited to 'arch/powerpc/platforms/embedded6xx')
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Kconfig | 30 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/linkstation.c | 211 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/ls_uart.c | 131 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 94 |
5 files changed, 381 insertions, 86 deletions
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 234a861870a8..ddbe398fbd48 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -74,6 +74,18 @@ config SANDPOINT | |||
74 | Select SANDPOINT if configuring for a Motorola Sandpoint X3 | 74 | Select SANDPOINT if configuring for a Motorola Sandpoint X3 |
75 | (any flavor). | 75 | (any flavor). |
76 | 76 | ||
77 | config LINKSTATION | ||
78 | bool "Linkstation / Kurobox(HG) from Buffalo" | ||
79 | select MPIC | ||
80 | select FSL_SOC | ||
81 | select PPC_UDBG_16550 if SERIAL_8250 | ||
82 | help | ||
83 | Select LINKSTATION if configuring for one of PPC- (MPC8241) | ||
84 | based NAS systems from Buffalo Technology. So far only | ||
85 | KuroboxHG has been tested. In the future classical Kurobox, | ||
86 | Linkstation-I HD-HLAN and HD-HGLAN versions, and PPC-based | ||
87 | Terastation systems should be supported too. | ||
88 | |||
77 | config MPC7448HPC2 | 89 | config MPC7448HPC2 |
78 | bool "Freescale MPC7448HPC2(Taiga)" | 90 | bool "Freescale MPC7448HPC2(Taiga)" |
79 | select TSI108_BRIDGE | 91 | select TSI108_BRIDGE |
@@ -146,15 +158,6 @@ config PQ2FADS | |||
146 | Select PQ2FADS if you wish to configure for a Freescale | 158 | Select PQ2FADS if you wish to configure for a Freescale |
147 | PQ2FADS board (-VR or -ZU). | 159 | PQ2FADS board (-VR or -ZU). |
148 | 160 | ||
149 | config LITE5200 | ||
150 | bool "Freescale LITE5200 / (IceCube)" | ||
151 | select PPC_MPC52xx | ||
152 | help | ||
153 | Support for the LITE5200 dev board for the MPC5200 from Freescale. | ||
154 | This is for the LITE5200 version 2.0 board. Don't know if it changes | ||
155 | much but it's only been tested on this board version. I think this | ||
156 | board is also known as IceCube. | ||
157 | |||
158 | config EV64360 | 161 | config EV64360 |
159 | bool "Marvell-EV64360BP" | 162 | bool "Marvell-EV64360BP" |
160 | help | 163 | help |
@@ -172,9 +175,6 @@ config TQM8xxL | |||
172 | depends on 8xx && (TQM823L || TQM850L || FPS850L || TQM855L || TQM860L) | 175 | depends on 8xx && (TQM823L || TQM850L || FPS850L || TQM855L || TQM860L) |
173 | default y | 176 | default y |
174 | 177 | ||
175 | config PPC_MPC52xx | ||
176 | bool | ||
177 | |||
178 | config 8260 | 178 | config 8260 |
179 | bool "CPM2 Support" if WILLOW | 179 | bool "CPM2 Support" if WILLOW |
180 | depends on 6xx | 180 | depends on 6xx |
@@ -208,7 +208,7 @@ config PPC_GEN550 | |||
208 | depends on SANDPOINT || SPRUCE || PPLUS || \ | 208 | depends on SANDPOINT || SPRUCE || PPLUS || \ |
209 | PRPMC750 || PRPMC800 || LOPEC || \ | 209 | PRPMC750 || PRPMC800 || LOPEC || \ |
210 | (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \ | 210 | (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \ |
211 | 83xx | 211 | 83xx || LINKSTATION |
212 | default y | 212 | default y |
213 | 213 | ||
214 | config FORCE | 214 | config FORCE |
@@ -282,13 +282,13 @@ config EPIC_SERIAL_MODE | |||
282 | 282 | ||
283 | config MPC10X_BRIDGE | 283 | config MPC10X_BRIDGE |
284 | bool | 284 | bool |
285 | depends on POWERPMC250 || LOPEC || SANDPOINT | 285 | depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION |
286 | select PPC_INDIRECT_PCI | 286 | select PPC_INDIRECT_PCI |
287 | default y | 287 | default y |
288 | 288 | ||
289 | config MPC10X_OPENPIC | 289 | config MPC10X_OPENPIC |
290 | bool | 290 | bool |
291 | depends on POWERPMC250 || LOPEC || SANDPOINT | 291 | depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION |
292 | default y | 292 | default y |
293 | 293 | ||
294 | config MPC10X_STORE_GATHERING | 294 | config MPC10X_STORE_GATHERING |
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile index fa499fe59291..d3d11a3cd656 100644 --- a/arch/powerpc/platforms/embedded6xx/Makefile +++ b/arch/powerpc/platforms/embedded6xx/Makefile | |||
@@ -2,3 +2,4 @@ | |||
2 | # Makefile for the 6xx/7xx/7xxxx linux kernel. | 2 | # Makefile for the 6xx/7xx/7xxxx linux kernel. |
3 | # | 3 | # |
4 | obj-$(CONFIG_MPC7448HPC2) += mpc7448_hpc2.o | 4 | obj-$(CONFIG_MPC7448HPC2) += mpc7448_hpc2.o |
5 | obj-$(CONFIG_LINKSTATION) += linkstation.o ls_uart.o | ||
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c new file mode 100644 index 000000000000..61599d919ea8 --- /dev/null +++ b/arch/powerpc/platforms/embedded6xx/linkstation.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * Board setup routines for the Buffalo Linkstation / Kurobox Platform. | ||
3 | * | ||
4 | * Copyright (C) 2006 G. Liakhovetski (g.liakhovetski@gmx.de) | ||
5 | * | ||
6 | * Based on sandpoint.c by Mark A. Greer | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public License | ||
9 | * version 2. This program is licensed "as is" without any warranty of | ||
10 | * any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/pci.h> | ||
15 | #include <linux/initrd.h> | ||
16 | #include <linux/root_dev.h> | ||
17 | #include <linux/mtd/physmap.h> | ||
18 | |||
19 | #include <asm/time.h> | ||
20 | #include <asm/prom.h> | ||
21 | #include <asm/mpic.h> | ||
22 | #include <asm/mpc10x.h> | ||
23 | #include <asm/pci-bridge.h> | ||
24 | |||
25 | static struct mtd_partition linkstation_physmap_partitions[] = { | ||
26 | { | ||
27 | .name = "mtd_firmimg", | ||
28 | .offset = 0x000000, | ||
29 | .size = 0x300000, | ||
30 | }, | ||
31 | { | ||
32 | .name = "mtd_bootcode", | ||
33 | .offset = 0x300000, | ||
34 | .size = 0x070000, | ||
35 | }, | ||
36 | { | ||
37 | .name = "mtd_status", | ||
38 | .offset = 0x370000, | ||
39 | .size = 0x010000, | ||
40 | }, | ||
41 | { | ||
42 | .name = "mtd_conf", | ||
43 | .offset = 0x380000, | ||
44 | .size = 0x080000, | ||
45 | }, | ||
46 | { | ||
47 | .name = "mtd_allflash", | ||
48 | .offset = 0x000000, | ||
49 | .size = 0x400000, | ||
50 | }, | ||
51 | { | ||
52 | .name = "mtd_data", | ||
53 | .offset = 0x310000, | ||
54 | .size = 0x0f0000, | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | static int __init add_bridge(struct device_node *dev) | ||
59 | { | ||
60 | int len; | ||
61 | struct pci_controller *hose; | ||
62 | int *bus_range; | ||
63 | |||
64 | printk("Adding PCI host bridge %s\n", dev->full_name); | ||
65 | |||
66 | bus_range = (int *) get_property(dev, "bus-range", &len); | ||
67 | if (bus_range == NULL || len < 2 * sizeof(int)) | ||
68 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | ||
69 | " bus 0\n", dev->full_name); | ||
70 | |||
71 | hose = pcibios_alloc_controller(); | ||
72 | if (hose == NULL) | ||
73 | return -ENOMEM; | ||
74 | hose->first_busno = bus_range ? bus_range[0] : 0; | ||
75 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | ||
76 | hose->arch_data = dev; | ||
77 | setup_indirect_pci(hose, 0xfec00000, 0xfee00000); | ||
78 | |||
79 | /* Interpret the "ranges" property */ | ||
80 | /* This also maps the I/O region and sets isa_io/mem_base */ | ||
81 | pci_process_bridge_OF_ranges(hose, dev, 1); | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static void __init linkstation_setup_arch(void) | ||
87 | { | ||
88 | struct device_node *np; | ||
89 | #ifdef CONFIG_MTD_PHYSMAP | ||
90 | physmap_set_partitions(linkstation_physmap_partitions, | ||
91 | ARRAY_SIZE(linkstation_physmap_partitions)); | ||
92 | #endif | ||
93 | |||
94 | #ifdef CONFIG_BLK_DEV_INITRD | ||
95 | if (initrd_start) | ||
96 | ROOT_DEV = Root_RAM0; | ||
97 | else | ||
98 | #endif | ||
99 | #ifdef CONFIG_ROOT_NFS | ||
100 | ROOT_DEV = Root_NFS; | ||
101 | #else | ||
102 | ROOT_DEV = Root_HDA1; | ||
103 | #endif | ||
104 | |||
105 | /* Lookup PCI host bridges */ | ||
106 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) | ||
107 | add_bridge(np); | ||
108 | |||
109 | printk(KERN_INFO "BUFFALO Network Attached Storage Series\n"); | ||
110 | printk(KERN_INFO "(C) 2002-2005 BUFFALO INC.\n"); | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * Interrupt setup and service. Interrrupts on the linkstation come | ||
115 | * from the four PCI slots plus onboard 8241 devices: I2C, DUART. | ||
116 | */ | ||
117 | static void __init linkstation_init_IRQ(void) | ||
118 | { | ||
119 | struct mpic *mpic; | ||
120 | struct device_node *dnp; | ||
121 | void *prop; | ||
122 | int size; | ||
123 | phys_addr_t paddr; | ||
124 | |||
125 | dnp = of_find_node_by_type(NULL, "open-pic"); | ||
126 | if (dnp == NULL) | ||
127 | return; | ||
128 | |||
129 | prop = (struct device_node *)get_property(dnp, "reg", &size); | ||
130 | paddr = (phys_addr_t)of_translate_address(dnp, prop); | ||
131 | |||
132 | mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC "); | ||
133 | BUG_ON(mpic == NULL); | ||
134 | |||
135 | /* PCI IRQs */ | ||
136 | mpic_assign_isu(mpic, 0, paddr + 0x10200); | ||
137 | |||
138 | /* I2C */ | ||
139 | mpic_assign_isu(mpic, 1, paddr + 0x11000); | ||
140 | |||
141 | /* ttyS0, ttyS1 */ | ||
142 | mpic_assign_isu(mpic, 2, paddr + 0x11100); | ||
143 | |||
144 | mpic_init(mpic); | ||
145 | } | ||
146 | |||
147 | extern void avr_uart_configure(void); | ||
148 | extern void avr_uart_send(const char); | ||
149 | |||
150 | static void linkstation_restart(char *cmd) | ||
151 | { | ||
152 | local_irq_disable(); | ||
153 | |||
154 | /* Reset system via AVR */ | ||
155 | avr_uart_configure(); | ||
156 | /* Send reboot command */ | ||
157 | avr_uart_send('C'); | ||
158 | |||
159 | for(;;) /* Spin until reset happens */ | ||
160 | avr_uart_send('G'); /* "kick" */ | ||
161 | } | ||
162 | |||
163 | static void linkstation_power_off(void) | ||
164 | { | ||
165 | local_irq_disable(); | ||
166 | |||
167 | /* Power down system via AVR */ | ||
168 | avr_uart_configure(); | ||
169 | /* send shutdown command */ | ||
170 | avr_uart_send('E'); | ||
171 | |||
172 | for(;;) /* Spin until power-off happens */ | ||
173 | avr_uart_send('G'); /* "kick" */ | ||
174 | /* NOTREACHED */ | ||
175 | } | ||
176 | |||
177 | static void linkstation_halt(void) | ||
178 | { | ||
179 | linkstation_power_off(); | ||
180 | /* NOTREACHED */ | ||
181 | } | ||
182 | |||
183 | static void linkstation_show_cpuinfo(struct seq_file *m) | ||
184 | { | ||
185 | seq_printf(m, "vendor\t\t: Buffalo Technology\n"); | ||
186 | seq_printf(m, "machine\t\t: Linkstation I/Kurobox(HG)\n"); | ||
187 | } | ||
188 | |||
189 | static int __init linkstation_probe(void) | ||
190 | { | ||
191 | unsigned long root; | ||
192 | |||
193 | root = of_get_flat_dt_root(); | ||
194 | |||
195 | if (!of_flat_dt_is_compatible(root, "linkstation")) | ||
196 | return 0; | ||
197 | return 1; | ||
198 | } | ||
199 | |||
200 | define_machine(linkstation){ | ||
201 | .name = "Buffalo Linkstation", | ||
202 | .probe = linkstation_probe, | ||
203 | .setup_arch = linkstation_setup_arch, | ||
204 | .init_IRQ = linkstation_init_IRQ, | ||
205 | .show_cpuinfo = linkstation_show_cpuinfo, | ||
206 | .get_irq = mpic_get_irq, | ||
207 | .restart = linkstation_restart, | ||
208 | .power_off = linkstation_power_off, | ||
209 | .halt = linkstation_halt, | ||
210 | .calibrate_decr = generic_calibrate_decr, | ||
211 | }; | ||
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c new file mode 100644 index 000000000000..31bcdae84823 --- /dev/null +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c | |||
@@ -0,0 +1,131 @@ | |||
1 | #include <linux/workqueue.h> | ||
2 | #include <linux/string.h> | ||
3 | #include <linux/delay.h> | ||
4 | #include <linux/serial_reg.h> | ||
5 | #include <linux/serial_8250.h> | ||
6 | #include <asm/io.h> | ||
7 | #include <asm/mpc10x.h> | ||
8 | #include <asm/ppc_sys.h> | ||
9 | #include <asm/prom.h> | ||
10 | #include <asm/termbits.h> | ||
11 | |||
12 | static void __iomem *avr_addr; | ||
13 | static unsigned long avr_clock; | ||
14 | |||
15 | static struct work_struct wd_work; | ||
16 | |||
17 | static void wd_stop(void *unused) | ||
18 | { | ||
19 | const char string[] = "AAAAFFFFJJJJ>>>>VVVV>>>>ZZZZVVVVKKKK"; | ||
20 | int i = 0, rescue = 8; | ||
21 | int len = strlen(string); | ||
22 | |||
23 | while (rescue--) { | ||
24 | int j; | ||
25 | char lsr = in_8(avr_addr + UART_LSR); | ||
26 | |||
27 | if (lsr & (UART_LSR_THRE | UART_LSR_TEMT)) { | ||
28 | for (j = 0; j < 16 && i < len; j++, i++) | ||
29 | out_8(avr_addr + UART_TX, string[i]); | ||
30 | if (i == len) { | ||
31 | /* Read "OK" back: 4ms for the last "KKKK" | ||
32 | plus a couple bytes back */ | ||
33 | msleep(7); | ||
34 | printk("linkstation: disarming the AVR watchdog: "); | ||
35 | while (in_8(avr_addr + UART_LSR) & UART_LSR_DR) | ||
36 | printk("%c", in_8(avr_addr + UART_RX)); | ||
37 | break; | ||
38 | } | ||
39 | } | ||
40 | msleep(17); | ||
41 | } | ||
42 | printk("\n"); | ||
43 | } | ||
44 | |||
45 | #define AVR_QUOT(clock) ((clock) + 8 * 9600) / (16 * 9600) | ||
46 | |||
47 | void avr_uart_configure(void) | ||
48 | { | ||
49 | unsigned char cval = UART_LCR_WLEN8; | ||
50 | unsigned int quot = AVR_QUOT(avr_clock); | ||
51 | |||
52 | if (!avr_addr || !avr_clock) | ||
53 | return; | ||
54 | |||
55 | out_8(avr_addr + UART_LCR, cval); /* initialise UART */ | ||
56 | out_8(avr_addr + UART_MCR, 0); | ||
57 | out_8(avr_addr + UART_IER, 0); | ||
58 | |||
59 | cval |= UART_LCR_STOP | UART_LCR_PARITY | UART_LCR_EPAR; | ||
60 | |||
61 | out_8(avr_addr + UART_LCR, cval); /* Set character format */ | ||
62 | |||
63 | out_8(avr_addr + UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ | ||
64 | out_8(avr_addr + UART_DLL, quot & 0xff); /* LS of divisor */ | ||
65 | out_8(avr_addr + UART_DLM, quot >> 8); /* MS of divisor */ | ||
66 | out_8(avr_addr + UART_LCR, cval); /* reset DLAB */ | ||
67 | out_8(avr_addr + UART_FCR, UART_FCR_ENABLE_FIFO); /* enable FIFO */ | ||
68 | } | ||
69 | |||
70 | void avr_uart_send(const char c) | ||
71 | { | ||
72 | if (!avr_addr || !avr_clock) | ||
73 | return; | ||
74 | |||
75 | out_8(avr_addr + UART_TX, c); | ||
76 | out_8(avr_addr + UART_TX, c); | ||
77 | out_8(avr_addr + UART_TX, c); | ||
78 | out_8(avr_addr + UART_TX, c); | ||
79 | } | ||
80 | |||
81 | static void __init ls_uart_init(void) | ||
82 | { | ||
83 | local_irq_disable(); | ||
84 | |||
85 | #ifndef CONFIG_SERIAL_8250 | ||
86 | out_8(avr_addr + UART_FCR, UART_FCR_ENABLE_FIFO); /* enable FIFO */ | ||
87 | out_8(avr_addr + UART_FCR, UART_FCR_ENABLE_FIFO | | ||
88 | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); /* clear FIFOs */ | ||
89 | out_8(avr_addr + UART_FCR, 0); | ||
90 | out_8(avr_addr + UART_IER, 0); | ||
91 | |||
92 | /* Clear up interrupts */ | ||
93 | (void) in_8(avr_addr + UART_LSR); | ||
94 | (void) in_8(avr_addr + UART_RX); | ||
95 | (void) in_8(avr_addr + UART_IIR); | ||
96 | (void) in_8(avr_addr + UART_MSR); | ||
97 | #endif | ||
98 | avr_uart_configure(); | ||
99 | |||
100 | local_irq_enable(); | ||
101 | } | ||
102 | |||
103 | static int __init ls_uarts_init(void) | ||
104 | { | ||
105 | struct device_node *avr; | ||
106 | phys_addr_t phys_addr; | ||
107 | int len; | ||
108 | |||
109 | avr = of_find_node_by_path("/soc10x/serial@80004500"); | ||
110 | if (!avr) | ||
111 | return -EINVAL; | ||
112 | |||
113 | avr_clock = *(u32*)get_property(avr, "clock-frequency", &len); | ||
114 | phys_addr = ((u32*)get_property(avr, "reg", &len))[0]; | ||
115 | |||
116 | if (!avr_clock || !phys_addr) | ||
117 | return -EINVAL; | ||
118 | |||
119 | avr_addr = ioremap(phys_addr, 32); | ||
120 | if (!avr_addr) | ||
121 | return -EFAULT; | ||
122 | |||
123 | ls_uart_init(); | ||
124 | |||
125 | INIT_WORK(&wd_work, wd_stop, NULL); | ||
126 | schedule_work(&wd_work); | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | late_initcall(ls_uarts_init); | ||
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c index bdb475c65cba..3fcc85f60fbf 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | |||
@@ -60,7 +60,7 @@ pci_dram_offset = MPC7448_HPC2_PCI_MEM_OFFSET; | |||
60 | 60 | ||
61 | extern int tsi108_setup_pci(struct device_node *dev); | 61 | extern int tsi108_setup_pci(struct device_node *dev); |
62 | extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); | 62 | extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); |
63 | extern void tsi108_pci_int_init(void); | 63 | extern void tsi108_pci_int_init(struct device_node *node); |
64 | extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); | 64 | extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); |
65 | 65 | ||
66 | int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) | 66 | int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) |
@@ -71,65 +71,6 @@ int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) | |||
71 | return PCIBIOS_SUCCESSFUL; | 71 | return PCIBIOS_SUCCESSFUL; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* | ||
75 | * find pci slot by devfn in interrupt map of OF tree | ||
76 | */ | ||
77 | u8 find_slot_by_devfn(unsigned int *interrupt_map, unsigned int devfn) | ||
78 | { | ||
79 | int i; | ||
80 | unsigned int tmp; | ||
81 | for (i = 0; i < 4; i++){ | ||
82 | tmp = interrupt_map[i*4*7]; | ||
83 | if ((tmp >> 11) == (devfn >> 3)) | ||
84 | return i; | ||
85 | } | ||
86 | return i; | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Scans the interrupt map for pci device | ||
91 | */ | ||
92 | void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) | ||
93 | { | ||
94 | struct pci_controller *hose; | ||
95 | struct device_node *node; | ||
96 | const unsigned int *interrupt; | ||
97 | int busnr; | ||
98 | int len; | ||
99 | u8 slot; | ||
100 | u8 pin; | ||
101 | |||
102 | /* Lookup the hose */ | ||
103 | busnr = dev->bus->number; | ||
104 | hose = pci_bus_to_hose(busnr); | ||
105 | if (!hose) | ||
106 | printk(KERN_ERR "No pci hose found\n"); | ||
107 | |||
108 | /* Check it has an OF node associated */ | ||
109 | node = (struct device_node *) hose->arch_data; | ||
110 | if (!node) | ||
111 | printk(KERN_ERR "No pci node found\n"); | ||
112 | |||
113 | interrupt = get_property(node, "interrupt-map", &len); | ||
114 | slot = find_slot_by_devfn(interrupt, dev->devfn); | ||
115 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | ||
116 | if (pin == 0 || pin > 4) | ||
117 | pin = 1; | ||
118 | pin--; | ||
119 | dev->irq = interrupt[slot*4*7 + pin*7 + 5]; | ||
120 | DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq); | ||
121 | } | ||
122 | /* temporary pci irq map fixup*/ | ||
123 | |||
124 | void __init mpc7448_hpc2_pcibios_fixup(void) | ||
125 | { | ||
126 | struct pci_dev *dev = NULL; | ||
127 | for_each_pci_dev(dev) { | ||
128 | mpc7448_hpc2_fixup_irq(dev); | ||
129 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | static void __init mpc7448_hpc2_setup_arch(void) | 74 | static void __init mpc7448_hpc2_setup_arch(void) |
134 | { | 75 | { |
135 | struct device_node *cpu; | 76 | struct device_node *cpu; |
@@ -192,9 +133,12 @@ static void __init mpc7448_hpc2_init_IRQ(void) | |||
192 | { | 133 | { |
193 | struct mpic *mpic; | 134 | struct mpic *mpic; |
194 | phys_addr_t mpic_paddr = 0; | 135 | phys_addr_t mpic_paddr = 0; |
136 | struct device_node *tsi_pic; | ||
137 | #ifdef CONFIG_PCI | ||
195 | unsigned int cascade_pci_irq; | 138 | unsigned int cascade_pci_irq; |
196 | struct device_node *tsi_pci; | 139 | struct device_node *tsi_pci; |
197 | struct device_node *tsi_pic; | 140 | struct device_node *cascade_node = NULL; |
141 | #endif | ||
198 | 142 | ||
199 | tsi_pic = of_find_node_by_type(NULL, "open-pic"); | 143 | tsi_pic = of_find_node_by_type(NULL, "open-pic"); |
200 | if (tsi_pic) { | 144 | if (tsi_pic) { |
@@ -208,31 +152,41 @@ static void __init mpc7448_hpc2_init_IRQ(void) | |||
208 | return; | 152 | return; |
209 | } | 153 | } |
210 | 154 | ||
211 | DBG("%s: tsi108pic phys_addr = 0x%x\n", __FUNCTION__, | 155 | DBG("%s: tsi108 pic phys_addr = 0x%x\n", __FUNCTION__, |
212 | (u32) mpic_paddr); | 156 | (u32) mpic_paddr); |
213 | 157 | ||
214 | mpic = mpic_alloc(tsi_pic, mpic_paddr, | 158 | mpic = mpic_alloc(tsi_pic, mpic_paddr, |
215 | MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | | 159 | MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | |
216 | MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, | 160 | MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, |
217 | 0, /* num_sources used */ | 161 | 24, |
218 | 0, /* num_sources used */ | 162 | NR_IRQS-4, /* num_sources used */ |
219 | "Tsi108_PIC"); | 163 | "Tsi108_PIC"); |
220 | 164 | ||
221 | BUG_ON(mpic == NULL); /* XXXX */ | 165 | BUG_ON(mpic == NULL); |
166 | |||
167 | mpic_assign_isu(mpic, 0, mpic_paddr + 0x100); | ||
168 | |||
222 | mpic_init(mpic); | 169 | mpic_init(mpic); |
223 | 170 | ||
171 | #ifdef CONFIG_PCI | ||
224 | tsi_pci = of_find_node_by_type(NULL, "pci"); | 172 | tsi_pci = of_find_node_by_type(NULL, "pci"); |
225 | if (tsi_pci == 0) { | 173 | if (tsi_pci == NULL) { |
226 | printk("%s: No tsi108 pci node found !\n", __FUNCTION__); | 174 | printk("%s: No tsi108 pci node found !\n", __FUNCTION__); |
227 | return; | 175 | return; |
228 | } | 176 | } |
177 | cascade_node = of_find_node_by_type(NULL, "pic-router"); | ||
178 | if (cascade_node == NULL) { | ||
179 | printk("%s: No tsi108 pci cascade node found !\n", __FUNCTION__); | ||
180 | return; | ||
181 | } | ||
229 | 182 | ||
230 | cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); | 183 | cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); |
184 | DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __FUNCTION__, | ||
185 | (u32) cascade_pci_irq); | ||
186 | tsi108_pci_int_init(cascade_node); | ||
231 | set_irq_data(cascade_pci_irq, mpic); | 187 | set_irq_data(cascade_pci_irq, mpic); |
232 | set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade); | 188 | set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade); |
233 | 189 | #endif | |
234 | tsi108_pci_int_init(); | ||
235 | |||
236 | /* Configure MPIC outputs to CPU0 */ | 190 | /* Configure MPIC outputs to CPU0 */ |
237 | tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0); | 191 | tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0); |
238 | of_node_put(tsi_pic); | 192 | of_node_put(tsi_pic); |
@@ -290,7 +244,6 @@ static int mpc7448_machine_check_exception(struct pt_regs *regs) | |||
290 | return 1; | 244 | return 1; |
291 | } | 245 | } |
292 | return 0; | 246 | return 0; |
293 | |||
294 | } | 247 | } |
295 | 248 | ||
296 | define_machine(mpc7448_hpc2){ | 249 | define_machine(mpc7448_hpc2){ |
@@ -300,7 +253,6 @@ define_machine(mpc7448_hpc2){ | |||
300 | .init_IRQ = mpc7448_hpc2_init_IRQ, | 253 | .init_IRQ = mpc7448_hpc2_init_IRQ, |
301 | .show_cpuinfo = mpc7448_hpc2_show_cpuinfo, | 254 | .show_cpuinfo = mpc7448_hpc2_show_cpuinfo, |
302 | .get_irq = mpic_get_irq, | 255 | .get_irq = mpic_get_irq, |
303 | .pcibios_fixup = mpc7448_hpc2_pcibios_fixup, | ||
304 | .restart = mpc7448_hpc2_restart, | 256 | .restart = mpc7448_hpc2_restart, |
305 | .calibrate_decr = generic_calibrate_decr, | 257 | .calibrate_decr = generic_calibrate_decr, |
306 | .machine_check_exception= mpc7448_machine_check_exception, | 258 | .machine_check_exception= mpc7448_machine_check_exception, |