brcm63xx: 3.10: backport multi-board support
[openwrt.git] / target / linux / brcm63xx / patches-3.10 / 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 @@ -42,6 +42,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 @@ -181,6 +181,7 @@ int __init board_register_devices(void)
34  {
35         int button_count = 0;
36         int led_count = 0;
37 +       int usbh_ports = 0;
38  
39         if (board.has_uart0)
40                 bcm63xx_uart_register(0);
41 @@ -203,14 +204,21 @@ int __init board_register_devices(void)
42             !board_get_mac_address(board.enetsw.mac_addr))
43                 bcm63xx_enetsw_register(&board.enetsw);
44  
45 +       if ((board.has_ohci0 || board.has_ehci0)) {
46 +               usbh_ports = board.num_usbh_ports;
47 +
48 +               if (!usbh_ports || WARN_ON(usbh_ports > 1 && board.has_usbd))
49 +                       usbh_ports = 1;
50 +       }
51 +
52         if (board.has_usbd)
53                 bcm63xx_usbd_register(&board.usbd);
54  
55         if (board.has_ehci0)
56 -               bcm63xx_ehci_register();
57 +               bcm63xx_ehci_register(usbh_ports);
58  
59         if (board.has_ohci0)
60 -               bcm63xx_ohci_register();
61 +               bcm63xx_ohci_register(usbh_ports);
62  
63         if (board.has_dsp)
64                 bcm63xx_dsp_register(&board.dsp);
65 --- a/arch/mips/bcm63xx/dev-usb-ehci.c
66 +++ b/arch/mips/bcm63xx/dev-usb-ehci.c
67 @@ -79,12 +79,14 @@ static struct platform_device bcm63xx_eh
68         },
69  };
70  
71 -int __init bcm63xx_ehci_register(void)
72 +int __init bcm63xx_ehci_register(unsigned int num_ports)
73  {
74         if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() &&
75                 !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268())
76                 return 0;
77  
78 +       bcm63xx_ehci_pdata.num_ports = num_ports;       
79 +
80         ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
81         ehci_resources[0].end = ehci_resources[0].start;
82         ehci_resources[0].end += RSET_EHCI_SIZE - 1;
83 --- a/arch/mips/bcm63xx/dev-usb-ohci.c
84 +++ b/arch/mips/bcm63xx/dev-usb-ohci.c
85 @@ -62,7 +62,6 @@ static struct usb_ohci_pdata bcm63xx_ohc
86         .big_endian_desc        = 1,
87         .big_endian_mmio        = 1,
88         .no_big_frame_no        = 1,
89 -       .num_ports              = 1,
90         .power_on               = bcm63xx_ohci_power_on,
91         .power_off              = bcm63xx_ohci_power_off,
92         .power_suspend          = bcm63xx_ohci_power_off,
93 @@ -80,11 +79,13 @@ static struct platform_device bcm63xx_oh
94         },
95  };
96  
97 -int __init bcm63xx_ohci_register(void)
98 +int __init bcm63xx_ohci_register(unsigned int num_ports)
99  {
100         if (BCMCPU_IS_6345() || BCMCPU_IS_6338())
101                 return -ENODEV;
102  
103 +       bcm63xx_ohci_pdata.num_ports = num_ports;
104 +
105         ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0);
106         ohci_resources[0].end = ohci_resources[0].start;
107         ohci_resources[0].end += RSET_OHCI_SIZE - 1;