brcm63xx: fix external IRQs
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.4 / 350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch
1 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
2 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
3 @@ -41,6 +41,7 @@ struct board_info {
4
5 /* USB config */
6 struct bcm63xx_usbd_platform_data usbd;
7 + unsigned int num_usbh_ports:2;
8
9 /* DSP config */
10 struct bcm63xx_dsp_platform_data dsp;
11 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
12 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
13 @@ -1,6 +1,6 @@
14 #ifndef BCM63XX_DEV_USB_EHCI_H_
15 #define BCM63XX_DEV_USB_EHCI_H_
16
17 -int bcm63xx_ehci_register(void);
18 +int bcm63xx_ehci_register(unsigned int num_ports);
19
20 #endif /* BCM63XX_DEV_USB_EHCI_H_ */
21 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
22 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
23 @@ -1,6 +1,6 @@
24 #ifndef BCM63XX_DEV_USB_OHCI_H_
25 #define BCM63XX_DEV_USB_OHCI_H_
26
27 -int bcm63xx_ohci_register(void);
28 +int bcm63xx_ohci_register(unsigned int num_ports);
29
30 #endif /* BCM63XX_DEV_USB_OHCI_H_ */
31 --- a/arch/mips/bcm63xx/boards/board_common.c
32 +++ b/arch/mips/bcm63xx/boards/board_common.c
33 @@ -167,6 +167,8 @@ static struct platform_device bcm63xx_gp
34 */
35 int __init board_register_devices(void)
36 {
37 + int usbh_ports = 0;
38 +
39 if (board.has_uart0)
40 bcm63xx_uart_register(0);
41
42 @@ -188,14 +190,21 @@ int __init board_register_devices(void)
43 !board_get_mac_address(board.enetsw.mac_addr))
44 bcm63xx_enetsw_register(&board.enetsw);
45
46 + if ((board.has_ohci0 || board.has_ehci0)) {
47 + usbh_ports = board.num_usbh_ports;
48 +
49 + if (!usbh_ports || WARN_ON(usbh_ports > 1 && board.has_usbd))
50 + usbh_ports = 1;
51 + }
52 +
53 if (board.has_usbd)
54 bcm63xx_usbd_register(&board.usbd);
55
56 if (board.has_ehci0)
57 - bcm63xx_ehci_register();
58 + bcm63xx_ehci_register(usbh_ports);
59
60 if (board.has_ohci0)
61 - bcm63xx_ohci_register();
62 + bcm63xx_ohci_register(usbh_ports);
63
64 if (board.has_dsp)
65 bcm63xx_dsp_register(&board.dsp);
66 --- a/arch/mips/bcm63xx/dev-usb-ehci.c
67 +++ b/arch/mips/bcm63xx/dev-usb-ehci.c
68 @@ -79,12 +79,14 @@ static struct platform_device bcm63xx_eh
69 },
70 };
71
72 -int __init bcm63xx_ehci_register(void)
73 +int __init bcm63xx_ehci_register(unsigned int num_ports)
74 {
75 if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() &&
76 !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268())
77 return 0;
78
79 + bcm63xx_ehci_pdata.num_ports = num_ports;
80 +
81 ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
82 ehci_resources[0].end = ehci_resources[0].start;
83 ehci_resources[0].end += RSET_EHCI_SIZE - 1;
84 --- a/arch/mips/bcm63xx/dev-usb-ohci.c
85 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
86 @@ -62,7 +62,6 @@ static struct usb_ohci_pdata bcm63xx_ohc
87 .big_endian_desc = 1,
88 .big_endian_mmio = 1,
89 .no_big_frame_no = 1,
90 - .num_ports = 1,
91 .power_on = bcm63xx_ohci_power_on,
92 .power_off = bcm63xx_ohci_power_off,
93 .power_suspend = bcm63xx_ohci_power_off,
94 @@ -80,11 +79,13 @@ static struct platform_device bcm63xx_oh
95 },
96 };
97
98 -int __init bcm63xx_ohci_register(void)
99 +int __init bcm63xx_ohci_register(unsigned int num_ports)
100 {
101 if (BCMCPU_IS_6345() || BCMCPU_IS_6338())
102 return -ENODEV;
103
104 + bcm63xx_ohci_pdata.num_ports = num_ports;
105 +
106 ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0);
107 ohci_resources[0].end = ohci_resources[0].start;
108 ohci_resources[0].end += RSET_OHCI_SIZE - 1;