diff options
Diffstat (limited to 'arch/powerpc/platforms/86xx')
-rw-r--r-- | arch/powerpc/platforms/86xx/Kconfig | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 216 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/mpc8641_hpcn.h | 21 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 37 |
5 files changed, 235 insertions, 53 deletions
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index 685b2fbbbe00..21d113536b86 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig | |||
@@ -11,6 +11,12 @@ config MPC8641_HPCN | |||
11 | help | 11 | help |
12 | This option enables support for the MPC8641 HPCN board. | 12 | This option enables support for the MPC8641 HPCN board. |
13 | 13 | ||
14 | config MPC8610_HPCD | ||
15 | bool "Freescale MPC8610 HPCD" | ||
16 | select DEFAULT_UIMAGE | ||
17 | help | ||
18 | This option enables support for the MPC8610 HPCD board. | ||
19 | |||
14 | endchoice | 20 | endchoice |
15 | 21 | ||
16 | config MPC8641 | 22 | config MPC8641 |
@@ -19,3 +25,10 @@ config MPC8641 | |||
19 | select PPC_UDBG_16550 | 25 | select PPC_UDBG_16550 |
20 | select MPIC | 26 | select MPIC |
21 | default y if MPC8641_HPCN | 27 | default y if MPC8641_HPCN |
28 | |||
29 | config MPC8610 | ||
30 | bool | ||
31 | select FSL_PCI if PCI | ||
32 | select PPC_UDBG_16550 | ||
33 | select MPIC | ||
34 | default y if MPC8610_HPCD | ||
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile index 3376c7767f2d..c96706327eaa 100644 --- a/arch/powerpc/platforms/86xx/Makefile +++ b/arch/powerpc/platforms/86xx/Makefile | |||
@@ -4,3 +4,4 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_SMP) += mpc86xx_smp.o | 5 | obj-$(CONFIG_SMP) += mpc86xx_smp.o |
6 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o | 6 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o |
7 | obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o | ||
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c new file mode 100644 index 000000000000..6390895e5e92 --- /dev/null +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * MPC8610 HPCD board specific routines | ||
3 | * | ||
4 | * Initial author: Xianghua Xiao <x.xiao@freescale.com> | ||
5 | * Recode: Jason Jin <jason.jin@freescale.com> | ||
6 | * | ||
7 | * Rewrite the interrupt routing. remove the 8259PIC support, | ||
8 | * All the integrated device in ULI use sideband interrupt. | ||
9 | * | ||
10 | * Copyright 2007 Freescale Semiconductor Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <linux/stddef.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/pci.h> | ||
21 | #include <linux/kdev_t.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/seq_file.h> | ||
24 | #include <linux/of.h> | ||
25 | |||
26 | #include <asm/system.h> | ||
27 | #include <asm/time.h> | ||
28 | #include <asm/machdep.h> | ||
29 | #include <asm/pci-bridge.h> | ||
30 | #include <asm/mpc86xx.h> | ||
31 | #include <asm/prom.h> | ||
32 | #include <mm/mmu_decl.h> | ||
33 | #include <asm/udbg.h> | ||
34 | |||
35 | #include <asm/mpic.h> | ||
36 | |||
37 | #include <sysdev/fsl_pci.h> | ||
38 | #include <sysdev/fsl_soc.h> | ||
39 | |||
40 | void __init | ||
41 | mpc86xx_hpcd_init_irq(void) | ||
42 | { | ||
43 | struct mpic *mpic1; | ||
44 | struct device_node *np; | ||
45 | struct resource res; | ||
46 | |||
47 | /* Determine PIC address. */ | ||
48 | np = of_find_node_by_type(NULL, "open-pic"); | ||
49 | if (np == NULL) | ||
50 | return; | ||
51 | of_address_to_resource(np, 0, &res); | ||
52 | |||
53 | /* Alloc mpic structure and per isu has 16 INT entries. */ | ||
54 | mpic1 = mpic_alloc(np, res.start, | ||
55 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | ||
56 | 0, 256, " MPIC "); | ||
57 | BUG_ON(mpic1 == NULL); | ||
58 | |||
59 | mpic_init(mpic1); | ||
60 | } | ||
61 | |||
62 | #ifdef CONFIG_PCI | ||
63 | static void __devinit quirk_uli1575(struct pci_dev *dev) | ||
64 | { | ||
65 | u32 temp32; | ||
66 | |||
67 | /* Disable INTx */ | ||
68 | pci_read_config_dword(dev, 0x48, &temp32); | ||
69 | pci_write_config_dword(dev, 0x48, (temp32 | 1<<26)); | ||
70 | |||
71 | /* Enable sideband interrupt */ | ||
72 | pci_read_config_dword(dev, 0x90, &temp32); | ||
73 | pci_write_config_dword(dev, 0x90, (temp32 | 1<<22)); | ||
74 | } | ||
75 | |||
76 | static void __devinit quirk_uli5288(struct pci_dev *dev) | ||
77 | { | ||
78 | unsigned char c; | ||
79 | unsigned short temp; | ||
80 | |||
81 | /* Interrupt Disable, Needed when SATA disabled */ | ||
82 | pci_read_config_word(dev, PCI_COMMAND, &temp); | ||
83 | temp |= 1<<10; | ||
84 | pci_write_config_word(dev, PCI_COMMAND, temp); | ||
85 | |||
86 | pci_read_config_byte(dev, 0x83, &c); | ||
87 | c |= 0x80; | ||
88 | pci_write_config_byte(dev, 0x83, c); | ||
89 | |||
90 | pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01); | ||
91 | pci_write_config_byte(dev, PCI_CLASS_DEVICE, 0x06); | ||
92 | |||
93 | pci_read_config_byte(dev, 0x83, &c); | ||
94 | c &= 0x7f; | ||
95 | pci_write_config_byte(dev, 0x83, c); | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * Since 8259PIC was disabled on the board, the IDE device can not | ||
100 | * use the legacy IRQ, we need to let the IDE device work under | ||
101 | * native mode and use the interrupt line like other PCI devices. | ||
102 | * IRQ14 is a sideband interrupt from IDE device to CPU and we use this | ||
103 | * as the interrupt for IDE device. | ||
104 | */ | ||
105 | static void __devinit quirk_uli5229(struct pci_dev *dev) | ||
106 | { | ||
107 | unsigned char c; | ||
108 | |||
109 | pci_read_config_byte(dev, 0x4b, &c); | ||
110 | c |= 0x10; | ||
111 | pci_write_config_byte(dev, 0x4b, c); | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * SATA interrupt pin bug fix | ||
116 | * There's a chip bug for 5288, The interrupt pin should be 2, | ||
117 | * not the read only value 1, So it use INTB#, not INTA# which | ||
118 | * actually used by the IDE device 5229. | ||
119 | * As of this bug, during the PCI initialization, 5288 read the | ||
120 | * irq of IDE device from the device tree, this function fix this | ||
121 | * bug by re-assigning a correct irq to 5288. | ||
122 | * | ||
123 | */ | ||
124 | static void __devinit final_uli5288(struct pci_dev *dev) | ||
125 | { | ||
126 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
127 | struct device_node *hosenode = hose ? hose->arch_data : NULL; | ||
128 | struct of_irq oirq; | ||
129 | int virq, pin = 2; | ||
130 | u32 laddr[3]; | ||
131 | |||
132 | if (!hosenode) | ||
133 | return; | ||
134 | |||
135 | laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); | ||
136 | laddr[1] = laddr[2] = 0; | ||
137 | of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); | ||
138 | virq = irq_create_of_mapping(oirq.controller, oirq.specifier, | ||
139 | oirq.size); | ||
140 | dev->irq = virq; | ||
141 | } | ||
142 | |||
143 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575); | ||
144 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288); | ||
145 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229); | ||
146 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, final_uli5288); | ||
147 | #endif /* CONFIG_PCI */ | ||
148 | |||
149 | static void __init | ||
150 | mpc86xx_hpcd_setup_arch(void) | ||
151 | { | ||
152 | #ifdef CONFIG_PCI | ||
153 | struct device_node *np; | ||
154 | #endif | ||
155 | if (ppc_md.progress) | ||
156 | ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0); | ||
157 | |||
158 | #ifdef CONFIG_PCI | ||
159 | for_each_node_by_type(np, "pci") { | ||
160 | if (of_device_is_compatible(np, "fsl,mpc8610-pci") | ||
161 | || of_device_is_compatible(np, "fsl,mpc8641-pcie")) { | ||
162 | struct resource rsrc; | ||
163 | of_address_to_resource(np, 0, &rsrc); | ||
164 | if ((rsrc.start & 0xfffff) == 0xa000) | ||
165 | fsl_add_bridge(np, 1); | ||
166 | else | ||
167 | fsl_add_bridge(np, 0); | ||
168 | } | ||
169 | } | ||
170 | #endif | ||
171 | |||
172 | printk("MPC86xx HPCD board from Freescale Semiconductor\n"); | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * Called very early, device-tree isn't unflattened | ||
177 | */ | ||
178 | static int __init mpc86xx_hpcd_probe(void) | ||
179 | { | ||
180 | unsigned long root = of_get_flat_dt_root(); | ||
181 | |||
182 | if (of_flat_dt_is_compatible(root, "fsl,MPC8610HPCD")) | ||
183 | return 1; /* Looks good */ | ||
184 | |||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | long __init | ||
189 | mpc86xx_time_init(void) | ||
190 | { | ||
191 | unsigned int temp; | ||
192 | |||
193 | /* Set the time base to zero */ | ||
194 | mtspr(SPRN_TBWL, 0); | ||
195 | mtspr(SPRN_TBWU, 0); | ||
196 | |||
197 | temp = mfspr(SPRN_HID0); | ||
198 | temp |= HID0_TBEN; | ||
199 | mtspr(SPRN_HID0, temp); | ||
200 | asm volatile("isync"); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | define_machine(mpc86xx_hpcd) { | ||
206 | .name = "MPC86xx HPCD", | ||
207 | .probe = mpc86xx_hpcd_probe, | ||
208 | .setup_arch = mpc86xx_hpcd_setup_arch, | ||
209 | .init_IRQ = mpc86xx_hpcd_init_irq, | ||
210 | .get_irq = mpic_get_irq, | ||
211 | .restart = fsl_rstcr_restart, | ||
212 | .time_init = mpc86xx_time_init, | ||
213 | .calibrate_decr = generic_calibrate_decr, | ||
214 | .progress = udbg_progress, | ||
215 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, | ||
216 | }; | ||
diff --git a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h deleted file mode 100644 index 41e554c4af94..000000000000 --- a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* | ||
2 | * MPC8641 HPCN board definitions | ||
3 | * | ||
4 | * Copyright 2006 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | * Author: Xianghua Xiao <x.xiao@freescale.com> | ||
12 | */ | ||
13 | |||
14 | #ifndef __MPC8641_HPCN_H__ | ||
15 | #define __MPC8641_HPCN_H__ | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | |||
19 | #define MPC86XX_RSTCR_OFFSET (0xe00b0) /* Reset Control Register */ | ||
20 | |||
21 | #endif /* __MPC8641_HPCN_H__ */ | ||
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 47aafa76c933..32a531aebcb7 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <sysdev/fsl_soc.h> | 35 | #include <sysdev/fsl_soc.h> |
36 | 36 | ||
37 | #include "mpc86xx.h" | 37 | #include "mpc86xx.h" |
38 | #include "mpc8641_hpcn.h" | ||
39 | 38 | ||
40 | #undef DEBUG | 39 | #undef DEBUG |
41 | 40 | ||
@@ -132,25 +131,15 @@ static int mpc86xx_exclude_device(struct pci_controller *hose, | |||
132 | static void __init | 131 | static void __init |
133 | mpc86xx_hpcn_setup_arch(void) | 132 | mpc86xx_hpcn_setup_arch(void) |
134 | { | 133 | { |
134 | #ifdef CONFIG_PCI | ||
135 | struct device_node *np; | 135 | struct device_node *np; |
136 | #endif | ||
136 | 137 | ||
137 | if (ppc_md.progress) | 138 | if (ppc_md.progress) |
138 | ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); | 139 | ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); |
139 | 140 | ||
140 | np = of_find_node_by_type(NULL, "cpu"); | ||
141 | if (np != 0) { | ||
142 | const unsigned int *fp; | ||
143 | |||
144 | fp = of_get_property(np, "clock-frequency", NULL); | ||
145 | if (fp != 0) | ||
146 | loops_per_jiffy = *fp / HZ; | ||
147 | else | ||
148 | loops_per_jiffy = 50000000 / HZ; | ||
149 | of_node_put(np); | ||
150 | } | ||
151 | |||
152 | #ifdef CONFIG_PCI | 141 | #ifdef CONFIG_PCI |
153 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) { | 142 | for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") { |
154 | struct resource rsrc; | 143 | struct resource rsrc; |
155 | of_address_to_resource(np, 0, &rsrc); | 144 | of_address_to_resource(np, 0, &rsrc); |
156 | if ((rsrc.start & 0xfffff) == 0x8000) | 145 | if ((rsrc.start & 0xfffff) == 0x8000) |
@@ -158,6 +147,7 @@ mpc86xx_hpcn_setup_arch(void) | |||
158 | else | 147 | else |
159 | fsl_add_bridge(np, 0); | 148 | fsl_add_bridge(np, 0); |
160 | } | 149 | } |
150 | |||
161 | uses_fsl_uli_m1575 = 1; | 151 | uses_fsl_uli_m1575 = 1; |
162 | ppc_md.pci_exclude_device = mpc86xx_exclude_device; | 152 | ppc_md.pci_exclude_device = mpc86xx_exclude_device; |
163 | 153 | ||
@@ -205,23 +195,6 @@ static int __init mpc86xx_hpcn_probe(void) | |||
205 | return 0; | 195 | return 0; |
206 | } | 196 | } |
207 | 197 | ||
208 | |||
209 | void | ||
210 | mpc86xx_restart(char *cmd) | ||
211 | { | ||
212 | void __iomem *rstcr; | ||
213 | |||
214 | rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100); | ||
215 | |||
216 | local_irq_disable(); | ||
217 | |||
218 | /* Assert reset request to Reset Control Register */ | ||
219 | out_be32(rstcr, 0x2); | ||
220 | |||
221 | /* not reached */ | ||
222 | } | ||
223 | |||
224 | |||
225 | long __init | 198 | long __init |
226 | mpc86xx_time_init(void) | 199 | mpc86xx_time_init(void) |
227 | { | 200 | { |
@@ -246,7 +219,7 @@ define_machine(mpc86xx_hpcn) { | |||
246 | .init_IRQ = mpc86xx_hpcn_init_irq, | 219 | .init_IRQ = mpc86xx_hpcn_init_irq, |
247 | .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo, | 220 | .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo, |
248 | .get_irq = mpic_get_irq, | 221 | .get_irq = mpic_get_irq, |
249 | .restart = mpc86xx_restart, | 222 | .restart = fsl_rstcr_restart, |
250 | .time_init = mpc86xx_time_init, | 223 | .time_init = mpc86xx_time_init, |
251 | .calibrate_decr = generic_calibrate_decr, | 224 | .calibrate_decr = generic_calibrate_decr, |
252 | .progress = udbg_progress, | 225 | .progress = udbg_progress, |