aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c2
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c87
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c2
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c115
5 files changed, 108 insertions, 99 deletions
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 25f41cd2d33a..00c535806647 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -115,7 +115,6 @@ void __init mpc85xx_ds_pic_init(void)
115 115
116#ifdef CONFIG_PCI 116#ifdef CONFIG_PCI
117static int primary_phb_addr; 117static int primary_phb_addr;
118extern int uses_fsl_uli_m1575;
119extern int uli_exclude_device(struct pci_controller *hose, 118extern int uli_exclude_device(struct pci_controller *hose,
120 u_char bus, u_char devfn); 119 u_char bus, u_char devfn);
121 120
@@ -161,7 +160,6 @@ static void __init mpc85xx_ds_setup_arch(void)
161 } 160 }
162 } 161 }
163 162
164 uses_fsl_uli_m1575 = 1;
165 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 163 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
166#endif 164#endif
167 165
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 8ce10b233cde..9355a5269431 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -27,6 +27,7 @@ config SBC8641D
27config MPC8610_HPCD 27config MPC8610_HPCD
28 bool "Freescale MPC8610 HPCD" 28 bool "Freescale MPC8610 HPCD"
29 select DEFAULT_UIMAGE 29 select DEFAULT_UIMAGE
30 select FSL_ULI1575
30 help 31 help
31 This option enables support for the MPC8610 HPCD board. 32 This option enables support for the MPC8610 HPCD board.
32 33
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 30725302884a..5eedb710896e 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -58,93 +58,6 @@ static int __init mpc8610_declare_of_platform_devices(void)
58} 58}
59machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); 59machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);
60 60
61#ifdef CONFIG_PCI
62static void __devinit quirk_uli1575(struct pci_dev *dev)
63{
64 u32 temp32;
65
66 /* Disable INTx */
67 pci_read_config_dword(dev, 0x48, &temp32);
68 pci_write_config_dword(dev, 0x48, (temp32 | 1<<26));
69
70 /* Enable sideband interrupt */
71 pci_read_config_dword(dev, 0x90, &temp32);
72 pci_write_config_dword(dev, 0x90, (temp32 | 1<<22));
73}
74
75static void __devinit quirk_uli5288(struct pci_dev *dev)
76{
77 unsigned char c;
78 unsigned short temp;
79
80 /* Interrupt Disable, Needed when SATA disabled */
81 pci_read_config_word(dev, PCI_COMMAND, &temp);
82 temp |= 1<<10;
83 pci_write_config_word(dev, PCI_COMMAND, temp);
84
85 pci_read_config_byte(dev, 0x83, &c);
86 c |= 0x80;
87 pci_write_config_byte(dev, 0x83, c);
88
89 pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01);
90 pci_write_config_byte(dev, PCI_CLASS_DEVICE, 0x06);
91
92 pci_read_config_byte(dev, 0x83, &c);
93 c &= 0x7f;
94 pci_write_config_byte(dev, 0x83, c);
95}
96
97/*
98 * Since 8259PIC was disabled on the board, the IDE device can not
99 * use the legacy IRQ, we need to let the IDE device work under
100 * native mode and use the interrupt line like other PCI devices.
101 * IRQ14 is a sideband interrupt from IDE device to CPU and we use this
102 * as the interrupt for IDE device.
103 */
104static void __devinit quirk_uli5229(struct pci_dev *dev)
105{
106 unsigned char c;
107
108 pci_read_config_byte(dev, 0x4b, &c);
109 c |= 0x10;
110 pci_write_config_byte(dev, 0x4b, c);
111}
112
113/*
114 * SATA interrupt pin bug fix
115 * There's a chip bug for 5288, The interrupt pin should be 2,
116 * not the read only value 1, So it use INTB#, not INTA# which
117 * actually used by the IDE device 5229.
118 * As of this bug, during the PCI initialization, 5288 read the
119 * irq of IDE device from the device tree, this function fix this
120 * bug by re-assigning a correct irq to 5288.
121 *
122 */
123static void __devinit final_uli5288(struct pci_dev *dev)
124{
125 struct pci_controller *hose = pci_bus_to_host(dev->bus);
126 struct device_node *hosenode = hose ? hose->dn : NULL;
127 struct of_irq oirq;
128 int virq, pin = 2;
129 u32 laddr[3];
130
131 if (!hosenode)
132 return;
133
134 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
135 laddr[1] = laddr[2] = 0;
136 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
137 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
138 oirq.size);
139 dev->irq = virq;
140}
141
142DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
143DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
144DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
145DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, final_uli5288);
146#endif /* CONFIG_PCI */
147
148#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 61#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
149 62
150static u32 get_busfreq(void) 63static u32 get_busfreq(void)
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 7916599c9126..f712d9c0991b 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -45,7 +45,6 @@
45#endif 45#endif
46 46
47#ifdef CONFIG_PCI 47#ifdef CONFIG_PCI
48extern int uses_fsl_uli_m1575;
49extern int uli_exclude_device(struct pci_controller *hose, 48extern int uli_exclude_device(struct pci_controller *hose,
50 u_char bus, u_char devfn); 49 u_char bus, u_char devfn);
51 50
@@ -87,7 +86,6 @@ mpc86xx_hpcn_setup_arch(void)
87 fsl_add_bridge(np, 0); 86 fsl_add_bridge(np, 0);
88 } 87 }
89 88
90 uses_fsl_uli_m1575 = 1;
91 ppc_md.pci_exclude_device = mpc86xx_exclude_device; 89 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
92 90
93#endif 91#endif
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 756561c51597..ef74a0763ec1 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -51,15 +51,13 @@ u8 uli_pirq_to_irq[8] = {
51 ULI_8259_NONE, /* PIRQH */ 51 ULI_8259_NONE, /* PIRQH */
52}; 52};
53 53
54/* set in board code if you want this quirks to do something */
55int uses_fsl_uli_m1575;
56
57/* Bridge */ 54/* Bridge */
58static void __devinit early_uli5249(struct pci_dev *dev) 55static void __devinit early_uli5249(struct pci_dev *dev)
59{ 56{
60 unsigned char temp; 57 unsigned char temp;
61 58
62 if (!uses_fsl_uli_m1575) 59 if (!machine_is(mpc86xx_hpcn) && !machine_is(mpc8544_ds) &&
60 !machine_is(mpc8572_ds))
63 return; 61 return;
64 62
65 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO | 63 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO |
@@ -82,7 +80,8 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
82{ 80{
83 int i; 81 int i;
84 82
85 if (!uses_fsl_uli_m1575) 83 if (!machine_is(mpc86xx_hpcn) && !machine_is(mpc8544_ds) &&
84 !machine_is(mpc8572_ds))
86 return; 85 return;
87 86
88 /* 87 /*
@@ -150,7 +149,8 @@ static void __devinit quirk_final_uli1575(struct pci_dev *dev)
150 * IRQ 14: Edge 149 * IRQ 14: Edge
151 * IRQ 15: Edge 150 * IRQ 15: Edge
152 */ 151 */
153 if (!uses_fsl_uli_m1575) 152 if (!machine_is(mpc86xx_hpcn) && !machine_is(mpc8544_ds) &&
153 !machine_is(mpc8572_ds))
154 return; 154 return;
155 155
156 outb(0xfa, 0x4d0); 156 outb(0xfa, 0x4d0);
@@ -176,7 +176,8 @@ static void __devinit quirk_uli5288(struct pci_dev *dev)
176 unsigned char c; 176 unsigned char c;
177 unsigned int d; 177 unsigned int d;
178 178
179 if (!uses_fsl_uli_m1575) 179 if (!machine_is(mpc86xx_hpcn) && !machine_is(mpc8544_ds) &&
180 !machine_is(mpc8572_ds))
180 return; 181 return;
181 182
182 /* read/write lock */ 183 /* read/write lock */
@@ -200,7 +201,8 @@ static void __devinit quirk_uli5229(struct pci_dev *dev)
200{ 201{
201 unsigned short temp; 202 unsigned short temp;
202 203
203 if (!uses_fsl_uli_m1575) 204 if (!machine_is(mpc86xx_hpcn) && !machine_is(mpc8544_ds) &&
205 !machine_is(mpc8572_ds))
204 return; 206 return;
205 207
206 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE | 208 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE |
@@ -238,6 +240,103 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
238DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249); 240DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
239DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575); 241DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
240 242
243static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev)
244{
245 u32 temp32;
246
247 if (!machine_is(mpc86xx_hpcd))
248 return;
249
250 /* Disable INTx */
251 pci_read_config_dword(dev, 0x48, &temp32);
252 pci_write_config_dword(dev, 0x48, (temp32 | 1<<26));
253
254 /* Enable sideband interrupt */
255 pci_read_config_dword(dev, 0x90, &temp32);
256 pci_write_config_dword(dev, 0x90, (temp32 | 1<<22));
257}
258
259static void __devinit hpcd_quirk_uli5288(struct pci_dev *dev)
260{
261 unsigned char c;
262 unsigned short temp;
263
264 if (!machine_is(mpc86xx_hpcd))
265 return;
266
267 /* Interrupt Disable, Needed when SATA disabled */
268 pci_read_config_word(dev, PCI_COMMAND, &temp);
269 temp |= 1<<10;
270 pci_write_config_word(dev, PCI_COMMAND, temp);
271
272 pci_read_config_byte(dev, 0x83, &c);
273 c |= 0x80;
274 pci_write_config_byte(dev, 0x83, c);
275
276 pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01);
277 pci_write_config_byte(dev, PCI_CLASS_DEVICE, 0x06);
278
279 pci_read_config_byte(dev, 0x83, &c);
280 c &= 0x7f;
281 pci_write_config_byte(dev, 0x83, c);
282}
283
284/*
285 * Since 8259PIC was disabled on the board, the IDE device can not
286 * use the legacy IRQ, we need to let the IDE device work under
287 * native mode and use the interrupt line like other PCI devices.
288 * IRQ14 is a sideband interrupt from IDE device to CPU and we use this
289 * as the interrupt for IDE device.
290 */
291static void __devinit hpcd_quirk_uli5229(struct pci_dev *dev)
292{
293 unsigned char c;
294
295 if (!machine_is(mpc86xx_hpcd))
296 return;
297
298 pci_read_config_byte(dev, 0x4b, &c);
299 c |= 0x10;
300 pci_write_config_byte(dev, 0x4b, c);
301}
302
303/*
304 * SATA interrupt pin bug fix
305 * There's a chip bug for 5288, The interrupt pin should be 2,
306 * not the read only value 1, So it use INTB#, not INTA# which
307 * actually used by the IDE device 5229.
308 * As of this bug, during the PCI initialization, 5288 read the
309 * irq of IDE device from the device tree, this function fix this
310 * bug by re-assigning a correct irq to 5288.
311 *
312 */
313static void __devinit hpcd_final_uli5288(struct pci_dev *dev)
314{
315 struct pci_controller *hose = pci_bus_to_host(dev->bus);
316 struct device_node *hosenode = hose ? hose->dn : NULL;
317 struct of_irq oirq;
318 int virq, pin = 2;
319 u32 laddr[3];
320
321 if (!machine_is(mpc86xx_hpcd))
322 return;
323
324 if (!hosenode)
325 return;
326
327 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
328 laddr[1] = laddr[2] = 0;
329 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
330 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
331 oirq.size);
332 dev->irq = virq;
333}
334
335DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
336DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, hpcd_quirk_uli5288);
337DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, hpcd_quirk_uli5229);
338DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
339
241int uli_exclude_device(struct pci_controller *hose, 340int uli_exclude_device(struct pci_controller *hose,
242 u_char bus, u_char devfn) 341 u_char bus, u_char devfn)
243{ 342{