aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2013-05-08 20:42:13 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-20 02:55:13 -0400
commitab9a4183fddf232a46b6255e0d3da5a09f85ecbd (patch)
treeac02b69da7a19f477e99e8fd2a79658d965f4188
parent70a54a4faec72ee9d12b9c4dfa27bc241deb79a6 (diff)
powerpc: Update currituck pci/usb fixup for new board revision
The currituck board uses a different IRQ for the pci usb host controller depending on the board revision. This patch adds support for newer board revisions by retrieving the board revision from the FPGA and mapping the appropriate IRQ. Signed-off-by: Alistair Popple <alistair@popple.id.au> Acked-by: Tony Breeds <tony@bakeyournoodle.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/boot/dts/currituck.dts5
-rw-r--r--arch/powerpc/platforms/44x/currituck.c39
2 files changed, 42 insertions, 2 deletions
diff --git a/arch/powerpc/boot/dts/currituck.dts b/arch/powerpc/boot/dts/currituck.dts
index b801dd06e573..d2c8a872308e 100644
--- a/arch/powerpc/boot/dts/currituck.dts
+++ b/arch/powerpc/boot/dts/currituck.dts
@@ -103,6 +103,11 @@
103 interrupts = <34 2>; 103 interrupts = <34 2>;
104 }; 104 };
105 105
106 FPGA0: fpga@50000000 {
107 compatible = "ibm,currituck-fpga";
108 reg = <0x50000000 0x4>;
109 };
110
106 IIC0: i2c@00000000 { 111 IIC0: i2c@00000000 {
107 compatible = "ibm,iic-currituck", "ibm,iic"; 112 compatible = "ibm,iic-currituck", "ibm,iic";
108 reg = <0x0 0x00000014>; 113 reg = <0x0 0x00000014>;
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index ecd3890c40d7..c52e1b3c9be5 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -176,13 +176,48 @@ static int __init ppc47x_probe(void)
176 return 1; 176 return 1;
177} 177}
178 178
179static int board_rev = -1;
180static int __init ppc47x_get_board_rev(void)
181{
182 u8 fpga_reg0;
183 void *fpga;
184 struct device_node *np;
185
186 np = of_find_compatible_node(NULL, NULL, "ibm,currituck-fpga");
187 if (!np)
188 goto fail;
189
190 fpga = of_iomap(np, 0);
191 of_node_put(np);
192 if (!fpga)
193 goto fail;
194
195 fpga_reg0 = ioread8(fpga);
196 board_rev = fpga_reg0 & 0x03;
197 pr_info("%s: Found board revision %d\n", __func__, board_rev);
198 iounmap(fpga);
199 return 0;
200
201fail:
202 pr_info("%s: Unable to find board revision\n", __func__);
203 return 0;
204}
205machine_arch_initcall(ppc47x, ppc47x_get_board_rev);
206
179/* Use USB controller should have been hardware swizzled but it wasn't :( */ 207/* Use USB controller should have been hardware swizzled but it wasn't :( */
180static void ppc47x_pci_irq_fixup(struct pci_dev *dev) 208static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
181{ 209{
182 if (dev->vendor == 0x1033 && (dev->device == 0x0035 || 210 if (dev->vendor == 0x1033 && (dev->device == 0x0035 ||
183 dev->device == 0x00e0)) { 211 dev->device == 0x00e0)) {
184 dev->irq = irq_create_mapping(NULL, 47); 212 if (board_rev == 0) {
185 pr_info("%s: Mapping irq 47 %d\n", __func__, dev->irq); 213 dev->irq = irq_create_mapping(NULL, 47);
214 pr_info("%s: Mapping irq %d\n", __func__, dev->irq);
215 } else if (board_rev == 2) {
216 dev->irq = irq_create_mapping(NULL, 49);
217 pr_info("%s: Mapping irq %d\n", __func__, dev->irq);
218 } else {
219 pr_alert("%s: Unknown board revision\n", __func__);
220 }
186 } 221 }
187} 222}
188 223