Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alistair Popple and committed by
Benjamin Herrenschmidt
ab9a4183 70a54a4f

+42 -2
+5
arch/powerpc/boot/dts/currituck.dts
··· 103 103 interrupts = <34 2>; 104 104 }; 105 105 106 + FPGA0: fpga@50000000 { 107 + compatible = "ibm,currituck-fpga"; 108 + reg = <0x50000000 0x4>; 109 + }; 110 + 106 111 IIC0: i2c@00000000 { 107 112 compatible = "ibm,iic-currituck", "ibm,iic"; 108 113 reg = <0x0 0x00000014>;
+37 -2
arch/powerpc/platforms/44x/currituck.c
··· 176 176 return 1; 177 177 } 178 178 179 + static int board_rev = -1; 180 + static 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 + 201 + fail: 202 + pr_info("%s: Unable to find board revision\n", __func__); 203 + return 0; 204 + } 205 + machine_arch_initcall(ppc47x, ppc47x_get_board_rev); 206 + 179 207 /* Use USB controller should have been hardware swizzled but it wasn't :( */ 180 208 static void ppc47x_pci_irq_fixup(struct pci_dev *dev) 181 209 { 182 210 if (dev->vendor == 0x1033 && (dev->device == 0x0035 || 183 211 dev->device == 0x00e0)) { 184 - dev->irq = irq_create_mapping(NULL, 47); 185 - pr_info("%s: Mapping irq 47 %d\n", __func__, dev->irq); 212 + if (board_rev == 0) { 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