mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-17 04:14:39 +00:00
brcm63xx: allow setting the number of usb host ports for boards
Allow setting the number of available usb host ports for boards with additional sanity checks to allow using the second port on devices where it is available. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 39324
This commit is contained in:
parent
6b3e1c8de6
commit
ef81c6a268
@ -0,0 +1,65 @@
|
||||
From 6ac09efa8f0e189ffe7dd7b0889289de56ee44cc Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sun, 19 Jan 2014 12:18:03 +0100
|
||||
Subject: [PATCH] USB: EHCI: allow limiting ports for ehci-platform
|
||||
|
||||
In the same way as the ohci platform driver allows limiting ports,
|
||||
enable the same for ehci. This prevents a mismatch in the available
|
||||
ports between ehci/ohci on USB 2.0 controllers.
|
||||
|
||||
This is needed if the USB host controller always reports the maximum
|
||||
number of ports regardless of the number of available ports (because
|
||||
one might be set to be usb device).
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/usb/host/ehci-hcd.c | 4 ++++
|
||||
drivers/usb/host/ehci-platform.c | 2 ++
|
||||
drivers/usb/host/ehci.h | 1 +
|
||||
include/linux/usb/ehci_pdriver.h | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
--- a/drivers/usb/host/ehci-hcd.c
|
||||
+++ b/drivers/usb/host/ehci-hcd.c
|
||||
@@ -661,6 +661,10 @@ int ehci_setup(struct usb_hcd *hcd)
|
||||
|
||||
/* cache this readonly data; minimize chip reads */
|
||||
ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
|
||||
+ if (ehci->num_ports) {
|
||||
+ ehci->hcs_params &= ~0xf; /* bits 3:0, ports on HC */
|
||||
+ ehci->hcs_params |= ehci->num_ports;
|
||||
+ }
|
||||
|
||||
ehci->sbrn = HCD_USB2;
|
||||
|
||||
--- a/drivers/usb/host/ehci-platform.c
|
||||
+++ b/drivers/usb/host/ehci-platform.c
|
||||
@@ -48,6 +48,8 @@ static int ehci_platform_reset(struct us
|
||||
ehci->big_endian_desc = pdata->big_endian_desc;
|
||||
ehci->big_endian_mmio = pdata->big_endian_mmio;
|
||||
ehci->ignore_oc = pdata->ignore_oc;
|
||||
+ if (pdata->num_ports && pdata->num_ports <= 15)
|
||||
+ ehci->num_ports = pdata->num_ports;
|
||||
|
||||
ehci->caps = hcd->regs + pdata->caps_offset;
|
||||
retval = ehci_setup(hcd);
|
||||
--- a/drivers/usb/host/ehci.h
|
||||
+++ b/drivers/usb/host/ehci.h
|
||||
@@ -188,6 +188,7 @@ struct ehci_hcd { /* one per controlle
|
||||
u32 command;
|
||||
|
||||
/* SILICON QUIRKS */
|
||||
+ unsigned int num_ports;
|
||||
unsigned no_selective_suspend:1;
|
||||
unsigned has_fsl_port_bug:1; /* FreeScale */
|
||||
unsigned big_endian_mmio:1;
|
||||
--- a/include/linux/usb/ehci_pdriver.h
|
||||
+++ b/include/linux/usb/ehci_pdriver.h
|
||||
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
struct usb_ehci_pdata {
|
||||
int caps_offset;
|
||||
+ unsigned int num_ports;
|
||||
unsigned has_tt:1;
|
||||
unsigned has_synopsys_hc_bug:1;
|
||||
unsigned big_endian_desc:1;
|
@ -0,0 +1,107 @@
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
@@ -42,6 +42,7 @@ struct board_info {
|
||||
|
||||
/* USB config */
|
||||
struct bcm63xx_usbd_platform_data usbd;
|
||||
+ unsigned int num_usbh_ports:2;
|
||||
|
||||
/* DSP config */
|
||||
struct bcm63xx_dsp_platform_data dsp;
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef BCM63XX_DEV_USB_EHCI_H_
|
||||
#define BCM63XX_DEV_USB_EHCI_H_
|
||||
|
||||
-int bcm63xx_ehci_register(void);
|
||||
+int bcm63xx_ehci_register(unsigned int num_ports);
|
||||
|
||||
#endif /* BCM63XX_DEV_USB_EHCI_H_ */
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef BCM63XX_DEV_USB_OHCI_H_
|
||||
#define BCM63XX_DEV_USB_OHCI_H_
|
||||
|
||||
-int bcm63xx_ohci_register(void);
|
||||
+int bcm63xx_ohci_register(unsigned int num_ports);
|
||||
|
||||
#endif /* BCM63XX_DEV_USB_OHCI_H_ */
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -965,6 +965,7 @@ int __init board_register_devices(void)
|
||||
{
|
||||
int button_count = 0;
|
||||
int led_count = 0;
|
||||
+ int usbh_ports = 0;
|
||||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -987,14 +988,21 @@ int __init board_register_devices(void)
|
||||
!bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
|
||||
bcm63xx_enetsw_register(&board.enetsw);
|
||||
|
||||
+ if ((board.has_ohci0 || board.has_ehci0)) {
|
||||
+ usbh_ports = board.num_usbh_ports;
|
||||
+
|
||||
+ if (!usbh_ports || WARN_ON(usbh_ports > 1 && board.has_usbd))
|
||||
+ usbh_ports = 1;
|
||||
+ }
|
||||
+
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
if (board.has_ehci0)
|
||||
- bcm63xx_ehci_register();
|
||||
+ bcm63xx_ehci_register(usbh_ports);
|
||||
|
||||
if (board.has_ohci0)
|
||||
- bcm63xx_ohci_register();
|
||||
+ bcm63xx_ohci_register(usbh_ports);
|
||||
|
||||
if (board.has_dsp)
|
||||
bcm63xx_dsp_register(&board.dsp);
|
||||
--- a/arch/mips/bcm63xx/dev-usb-ehci.c
|
||||
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
|
||||
@@ -79,12 +79,14 @@ static struct platform_device bcm63xx_eh
|
||||
},
|
||||
};
|
||||
|
||||
-int __init bcm63xx_ehci_register(void)
|
||||
+int __init bcm63xx_ehci_register(unsigned int num_ports)
|
||||
{
|
||||
if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() &&
|
||||
!BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268())
|
||||
return 0;
|
||||
|
||||
+ bcm63xx_ehci_pdata.num_ports = num_ports;
|
||||
+
|
||||
ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
|
||||
ehci_resources[0].end = ehci_resources[0].start;
|
||||
ehci_resources[0].end += RSET_EHCI_SIZE - 1;
|
||||
--- a/arch/mips/bcm63xx/dev-usb-ohci.c
|
||||
+++ b/arch/mips/bcm63xx/dev-usb-ohci.c
|
||||
@@ -62,7 +62,6 @@ static struct usb_ohci_pdata bcm63xx_ohc
|
||||
.big_endian_desc = 1,
|
||||
.big_endian_mmio = 1,
|
||||
.no_big_frame_no = 1,
|
||||
- .num_ports = 1,
|
||||
.power_on = bcm63xx_ohci_power_on,
|
||||
.power_off = bcm63xx_ohci_power_off,
|
||||
.power_suspend = bcm63xx_ohci_power_off,
|
||||
@@ -80,11 +79,13 @@ static struct platform_device bcm63xx_oh
|
||||
},
|
||||
};
|
||||
|
||||
-int __init bcm63xx_ohci_register(void)
|
||||
+int __init bcm63xx_ohci_register(unsigned int num_ports)
|
||||
{
|
||||
if (BCMCPU_IS_6345() || BCMCPU_IS_6338())
|
||||
return -ENODEV;
|
||||
|
||||
+ bcm63xx_ohci_pdata.num_ports = num_ports;
|
||||
+
|
||||
ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0);
|
||||
ohci_resources[0].end = ohci_resources[0].start;
|
||||
ohci_resources[0].end += RSET_OHCI_SIZE - 1;
|
@ -18,15 +18,15 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
||||
|
||||
#include <uapi/linux/bcm933xx_hcs.h>
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
@@ -967,6 +968,7 @@ int __init board_register_devices(void)
|
||||
{
|
||||
@@ -968,6 +969,7 @@ int __init board_register_devices(void)
|
||||
int button_count = 0;
|
||||
int led_count = 0;
|
||||
int usbh_ports = 0;
|
||||
+ int i;
|
||||
|
||||
if (board.has_uart0)
|
||||
bcm63xx_uart_register(0);
|
||||
@@ -1005,7 +1007,8 @@ int __init board_register_devices(void)
|
||||
@@ -1013,7 +1015,8 @@ int __init board_register_devices(void)
|
||||
* do this after registering enet devices
|
||||
*/
|
||||
#ifdef CONFIG_SSB_PCIHOST
|
||||
@ -36,7 +36,7 @@ Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data
|
||||
memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
|
||||
if (ssb_arch_register_fallback_sprom(
|
||||
@@ -1052,5 +1055,9 @@ int __init board_register_devices(void)
|
||||
@@ -1060,5 +1063,9 @@ int __init board_register_devices(void)
|
||||
platform_device_register(&bcm63xx_gpio_keys_device);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
|
||||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -1027,7 +1027,7 @@ int __init board_register_devices(void)
|
||||
@@ -1035,7 +1035,7 @@ int __init board_register_devices(void)
|
||||
if (board.num_spis)
|
||||
spi_register_board_info(board.spis, board.num_spis);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
return;
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -1057,7 +1057,8 @@ int __init board_register_devices(void)
|
||||
@@ -1065,7 +1065,8 @@ int __init board_register_devices(void)
|
||||
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -1058,7 +1058,7 @@ int __init board_register_devices(void)
|
||||
@@ -1066,7 +1066,7 @@ int __init board_register_devices(void)
|
||||
/* register any fixups */
|
||||
for (i = 0; i < board.has_caldata; i++)
|
||||
pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset,
|
||||
|
@ -36,7 +36,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
|
||||
|
||||
#include <uapi/linux/bcm933xx_hcs.h>
|
||||
#include <uapi/linux/bcm963xx_tag.h>
|
||||
@@ -1056,9 +1057,19 @@ int __init board_register_devices(void)
|
||||
@@ -1064,9 +1065,19 @@ int __init board_register_devices(void)
|
||||
}
|
||||
|
||||
/* register any fixups */
|
||||
|
Loading…
Reference in New Issue
Block a user