* [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers
@ 2013-01-28 19:06 Florian Fainelli
2013-01-28 19:06 ` [PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay Florian Fainelli
` (12 more replies)
0 siblings, 13 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
Hi all,
This patch series adds support for the Broadcom BCM63xx OHCI and EHCI
integrated controllers. Thanks to the latest developments of the OHCI and
EHCI platform drivers we no longer need a dedicated ohci or ehci driver
stub and can use the generic platform drivers instead.
This serie was initially posted by Maxime Bizon:
http://marc.info/?l=linux-mips&m=126487413022204&w=2
http://marc.info/?l=linux-mips&m=126487415322241&w=2
I would like this serie to go via the MIPS tree to avoid merge conflicts
as it touches code in both arch/mips/ and drivers/usb/.
Patches 11 and 12 have been volontarily splitted so they do not block the
merging of the 10 first patches.
Thanks!
Florian Fainelli (13):
MIPS: BCM63XX: add USB host clock enable delay
MIPS: BCM63XX: add USB device clock enable delay to clock code
MIPS: BCM63XX: move code touching the USB private register
MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code
MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol
MIPS: BCM63XX: add support for the on-chip OHCI controller
MIPS: BCM63XX: register OHCI controller if board enables it
MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
MIPS: BCM63XX: add support for the on-chip EHCI controller
MIPS: BCM63XX: register EHCI controller if board enables it
USB: EHCI: add ignore_oc flag to disable overcurrent checking
MIPS: BCM63XX: EHCI controller does not support overcurrent
MIPS: BCM63XX: update defconfig
arch/mips/bcm63xx/Kconfig | 24 +++-
arch/mips/bcm63xx/Makefile | 2 +-
arch/mips/bcm63xx/boards/board_bcm963xx.c | 8 ++
arch/mips/bcm63xx/clk.c | 10 ++
arch/mips/bcm63xx/dev-usb-ehci.c | 93 ++++++++++++
arch/mips/bcm63xx/dev-usb-ohci.c | 94 ++++++++++++
arch/mips/bcm63xx/usb-common.c | 150 ++++++++++++++++++++
arch/mips/configs/bcm63xx_defconfig | 22 ++-
.../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 +
.../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 +
.../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 11 ++
drivers/usb/gadget/bcm63xx_udc.c | 28 +---
drivers/usb/host/Kconfig | 5 +-
drivers/usb/host/ehci-hcd.c | 2 +-
drivers/usb/host/ehci-hub.c | 4 +-
drivers/usb/host/ehci.h | 1 +
include/linux/usb/ehci_pdriver.h | 1 +
17 files changed, 419 insertions(+), 48 deletions(-)
create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c
create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c
create mode 100644 arch/mips/bcm63xx/usb-common.c
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
--
1.7.10.4
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 02/13] MIPS: BCM63XX: add USB device clock enable delay to clock code Florian Fainelli
` (11 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
Knowledge of the clock setup delay should remain at the clock level (so
it can be clock specific and CPU specific). Add the 100 milliseconds
required clock delay for the USB host clock when it gets enabled.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/clk.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index b9e948d..a39aeb8 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -162,6 +162,11 @@ static void usbh_set(struct clk *clk, int enable)
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
else if (BCMCPU_IS_6368())
bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
+ else
+ return;
+
+ if (enable)
+ msleep(100);
}
static struct clk clk_usbh = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 02/13] MIPS: BCM63XX: add USB device clock enable delay to clock code
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
2013-01-28 19:06 ` [PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register Florian Fainelli
` (10 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch adds the required 10 micro seconds delay to the USB device
clock enable operation. Put this where the correct clock knowledege is,
which is in the clock code, and remove this delay from the bcm63xx_udc
gadget driver where it was before.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/clk.c | 5 +++++
drivers/usb/gadget/bcm63xx_udc.c | 1 -
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index a39aeb8..1f1a6c1 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -182,6 +182,11 @@ static void usbd_set(struct clk *clk, int enable)
bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
else if (BCMCPU_IS_6368())
bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
+ else
+ return;
+
+ if (enable)
+ udelay(10);
}
static struct clk clk_usbd = {
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index 47a4993..ad17533 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -386,7 +386,6 @@ static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled)
if (is_enabled) {
clk_enable(udc->usbh_clk);
clk_enable(udc->usbd_clk);
- udelay(10);
} else {
clk_disable(udc->usbd_clk);
clk_disable(udc->usbh_clk);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
2013-01-28 19:06 ` [PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay Florian Fainelli
2013-01-28 19:06 ` [PATCH 02/13] MIPS: BCM63XX: add USB device clock enable delay to clock code Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 20:41 ` Felipe Balbi
2013-01-28 19:06 ` [PATCH 04/13] MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code Florian Fainelli
` (9 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch moves the code touching the USB private register in the
bcm63xx USB gadget driver to arch/mips/bcm63xx/usb-common.c in
preparation for adding support for OHCI and EHCI host controllers which
will also touch the USB private register.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/Makefile | 2 +-
arch/mips/bcm63xx/usb-common.c | 53 ++++++++++++++++++++
.../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 9 ++++
drivers/usb/gadget/bcm63xx_udc.c | 27 ++--------
4 files changed, 67 insertions(+), 24 deletions(-)
create mode 100644 arch/mips/bcm63xx/usb-common.c
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index ac28073..a085c2b 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
- dev-usb-usbd.o
+ dev-usb-usbd.o usb-common.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += boards/
diff --git a/arch/mips/bcm63xx/usb-common.c b/arch/mips/bcm63xx/usb-common.c
new file mode 100644
index 0000000..b617cf6
--- /dev/null
+++ b/arch/mips/bcm63xx/usb-common.c
@@ -0,0 +1,53 @@
+/*
+ * Broadcom BCM63xx common USB device configuration code
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2012 Kevin Cernekee <cernekee@gmail.com>
+ * Copyright (C) 2012 Broadcom Corporation
+ *
+ */
+#include <linux/export.h>
+
+#include <bcm63xx_cpu.h>
+#include <bcm63xx_regs.h>
+#include <bcm63xx_io.h>
+#include <bcm63xx_usb_priv.h>
+
+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device)
+{
+ u32 val;
+
+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
+ if (is_device) {
+ val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+ } else {
+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+ }
+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+
+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
+ if (is_device)
+ val |= USBH_PRIV_SWAP_USBD_MASK;
+ else
+ val &= ~USBH_PRIV_SWAP_USBD_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG);
+}
+EXPORT_SYMBOL(bcm63xx_usb_host_priv_cfg_set);
+
+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
+{
+ u32 val;
+
+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
+ if (is_on)
+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+ else
+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+}
+EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup);
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
new file mode 100644
index 0000000..f0d4b59
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
@@ -0,0 +1,9 @@
+#ifndef BCM63XX_USB_PRIV_H_
+#define BCM63XX_USB_PRIV_H_
+
+#include <linux/types.h>
+
+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device);
+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on);
+
+#endif /* BCM63XX_USB_PRIV_H_ */
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index ad17533..af450c4 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -41,6 +41,7 @@
#include <bcm63xx_dev_usb_usbd.h>
#include <bcm63xx_io.h>
#include <bcm63xx_regs.h>
+#include <bcm63xx_usb_priv.h>
#define DRV_MODULE_NAME "bcm63xx_udc"
@@ -863,22 +864,7 @@ static void bcm63xx_select_phy_mode(struct bcm63xx_udc *udc, bool is_device)
bcm_gpio_writel(val, GPIO_PINMUX_OTHR_REG);
}
- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
- if (is_device) {
- val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
- } else {
- val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT);
- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
- }
- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
-
- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
- if (is_device)
- val |= USBH_PRIV_SWAP_USBD_MASK;
- else
- val &= ~USBH_PRIV_SWAP_USBD_MASK;
- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG);
+ bcm63xx_usb_priv_select_phy_mode(portmask, is_device);
}
/**
@@ -892,14 +878,9 @@ static void bcm63xx_select_phy_mode(struct bcm63xx_udc *udc, bool is_device)
*/
static void bcm63xx_select_pullup(struct bcm63xx_udc *udc, bool is_on)
{
- u32 val, portmask = BIT(udc->pd->port_no);
+ u32 portmask = BIT(udc->pd->port_no);
- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
- if (is_on)
- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
- else
- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+ bcm63xx_usb_priv_select_pullup(portmask, is_on);
}
/**
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 04/13] MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (2 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 05/13] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol Florian Fainelli
` (8 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch updates the common USB code touching the USB private
registers with the specific bits to properly enable OHCI and EHCI
controllers on BCM63xx SoCs. As a result we now need to protect access
to Read Modify Write sequences using a spinlock because we cannot
guarantee that any of the exposed helper will not be called
concurrently.
Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/usb-common.c | 97 ++++++++++++++++++++
.../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 2 +
2 files changed, 99 insertions(+)
diff --git a/arch/mips/bcm63xx/usb-common.c b/arch/mips/bcm63xx/usb-common.c
index b617cf6..e18ac08 100644
--- a/arch/mips/bcm63xx/usb-common.c
+++ b/arch/mips/bcm63xx/usb-common.c
@@ -5,10 +5,12 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
+ * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
* Copyright (C) 2012 Kevin Cernekee <cernekee@gmail.com>
* Copyright (C) 2012 Broadcom Corporation
*
*/
+#include <linux/spinlock.h>
#include <linux/export.h>
#include <bcm63xx_cpu.h>
@@ -16,9 +18,14 @@
#include <bcm63xx_io.h>
#include <bcm63xx_usb_priv.h>
+static DEFINE_SPINLOCK(usb_priv_reg_lock);
+
void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device)
{
u32 val;
+ unsigned long flags;
+
+ spin_lock_irqsave(&usb_priv_reg_lock, flags);
val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
if (is_device) {
@@ -36,12 +43,17 @@ void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device)
else
val &= ~USBH_PRIV_SWAP_USBD_MASK;
bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG);
+
+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
}
EXPORT_SYMBOL(bcm63xx_usb_host_priv_cfg_set);
void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
{
u32 val;
+ unsigned long flags;
+
+ spin_lock_irqsave(&usb_priv_reg_lock, flags);
val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG);
if (is_on)
@@ -49,5 +61,90 @@ void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on)
else
val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT);
bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG);
+
+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
}
EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup);
+
+/* The following array represents the meaning of the DESC/DATA
+ * endian swapping with respect to the CPU configured endianness
+ *
+ * DATA ENDN mmio descriptor
+ * 0 0 BE invalid
+ * 0 1 BE LE
+ * 1 0 BE BE
+ * 1 1 BE invalid
+ *
+ * Since BCM63XX SoCs are configured to be in big-endian mode
+ * we want configuration at line 3.
+ */
+void bcm63xx_usb_priv_ohci_cfg_set(void)
+{
+ u32 reg;
+ unsigned long flags;
+
+ spin_lock_irqsave(&usb_priv_reg_lock, flags);
+
+ if (BCMCPU_IS_6348())
+ bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG);
+ else if (BCMCPU_IS_6358()) {
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);
+ /*
+ * The magic value comes for the original vendor BSP
+ * and is needed for USB to work. Datasheet does not
+ * help, so the magic value is used as-is.
+ */
+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
+ USBH_PRIV_TEST_6358_REG);
+
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG);
+
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
+ reg |= USBH_PRIV_SETUP_IOC_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
+ }
+
+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
+}
+
+void bcm63xx_usb_priv_ehci_cfg_set(void)
+{
+ u32 reg;
+ unsigned long flags;
+
+ spin_lock_irqsave(&usb_priv_reg_lock, flags);
+
+ if (BCMCPU_IS_6358()) {
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);
+
+ /*
+ * The magic value comes for the original vendor BSP
+ * and is needed for USB to work. Datasheet does not
+ * help, so the magic value is used as-is.
+ */
+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
+ USBH_PRIV_TEST_6358_REG);
+
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG);
+
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
+ reg |= USBH_PRIV_SETUP_IOC_MASK;
+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
+ }
+
+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
+}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
index f0d4b59..e7c01e4 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h
@@ -5,5 +5,7 @@
void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device);
void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on);
+void bcm63xx_usb_priv_ohci_cfg_set(void);
+void bcm63xx_usb_priv_ehci_cfg_set(void);
#endif /* BCM63XX_USB_PRIV_H_ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 05/13] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (3 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 04/13] MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 06/13] MIPS: BCM63XX: add support for the on-chip OHCI controller Florian Fainelli
` (7 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This configuration symbol can be used by CPUs supporting the on-chip
OHCI controller, and ensures that all relevant OHCI-related
configuration options are correctly selected. So far, OHCI support is
available for the 6328, 6348, 6358 and 6358 SoCs.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/Kconfig | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index d03e879..23b1ffd 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -1,33 +1,38 @@
menu "CPU support"
depends on BCM63XX
+config BCM63XX_OHCI
+ bool
+ select USB_ARCH_HAS_OHCI
+ select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
+ select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
+
config BCM63XX_CPU_6328
bool "support 6328 CPU"
select HW_HAS_PCI
+ select BCM63XX_OHCI
config BCM63XX_CPU_6338
bool "support 6338 CPU"
select HW_HAS_PCI
- select USB_ARCH_HAS_OHCI
- select USB_OHCI_BIG_ENDIAN_DESC
- select USB_OHCI_BIG_ENDIAN_MMIO
config BCM63XX_CPU_6345
bool "support 6345 CPU"
- select USB_OHCI_BIG_ENDIAN_DESC
- select USB_OHCI_BIG_ENDIAN_MMIO
config BCM63XX_CPU_6348
bool "support 6348 CPU"
select HW_HAS_PCI
+ select BCM63XX_OHCI
config BCM63XX_CPU_6358
bool "support 6358 CPU"
select HW_HAS_PCI
+ select BCM63XX_OHCI
config BCM63XX_CPU_6368
bool "support 6368 CPU"
select HW_HAS_PCI
+ select BCM63XX_OHCI
endmenu
source "arch/mips/bcm63xx/boards/Kconfig"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 06/13] MIPS: BCM63XX: add support for the on-chip OHCI controller
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (4 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 05/13] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 07/13] MIPS: BCM63XX: register OHCI controller if board enables it Florian Fainelli
` (6 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
Broadcom BCM63XX SoCs include an on-chip OHCI controller which can be
driven by the ohci-platform generic driver by using specific power
on/off/suspend callback to manage clocks and hardware specific
configuration.
Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/Makefile | 2 +-
arch/mips/bcm63xx/dev-usb-ohci.c | 94 ++++++++++++++++++++
.../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 ++
3 files changed, 101 insertions(+), 1 deletion(-)
create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index a085c2b..a2a501a 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
- dev-usb-usbd.o usb-common.o
+ dev-usb-ohci.o dev-usb-usbd.o usb-common.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += boards/
diff --git a/arch/mips/bcm63xx/dev-usb-ohci.c b/arch/mips/bcm63xx/dev-usb-ohci.c
new file mode 100644
index 0000000..b33e397
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-usb-ohci.c
@@ -0,0 +1,94 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+ * Copyright (C) 2013 Florian Fainelli <florian@openwrt.org>
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/usb/ohci_pdriver.h>
+#include <linux/dma-mapping.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+
+#include <bcm63xx_cpu.h>
+#include <bcm63xx_regs.h>
+#include <bcm63xx_io.h>
+#include <bcm63xx_usb_priv.h>
+#include <bcm63xx_dev_usb_ohci.h>
+
+static struct resource ohci_resources[] = {
+ {
+ .start = -1, /* filled at runtime */
+ .end = -1, /* filled at runtime */
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = -1, /* filled at runtime */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ohci_dmamask = DMA_BIT_MASK(32);
+
+static struct clk *usb_host_clock;
+
+static int bcm63xx_ohci_power_on(struct platform_device *pdev)
+{
+ usb_host_clock = clk_get(&pdev->dev, "usbh");
+ if (IS_ERR_OR_NULL(usb_host_clock))
+ return -ENODEV;
+
+ clk_prepare_enable(usb_host_clock);
+
+ bcm63xx_usb_priv_ohci_cfg_set();
+
+ return 0;
+}
+
+static void bcm63xx_ohci_power_off(struct platform_device *pdev)
+{
+ if (!IS_ERR_OR_NULL(usb_host_clock)) {
+ clk_disable_unprepare(usb_host_clock);
+ clk_put(usb_host_clock);
+ }
+}
+
+static struct usb_ohci_pdata bcm63xx_ohci_pdata = {
+ .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,
+};
+
+static struct platform_device bcm63xx_ohci_device = {
+ .name = "ohci-platform",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(ohci_resources),
+ .resource = ohci_resources,
+ .dev = {
+ .platform_data = &bcm63xx_ohci_pdata,
+ .dma_mask = &ohci_dmamask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+int __init bcm63xx_ohci_register(void)
+{
+ if (BCMCPU_IS_6345() || BCMCPU_IS_6338())
+ return -ENODEV;
+
+ 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;
+ ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0);
+
+ return platform_device_register(&bcm63xx_ohci_device);
+}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
new file mode 100644
index 0000000..518a04d
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
@@ -0,0 +1,6 @@
+#ifndef BCM63XX_DEV_USB_OHCI_H_
+#define BCM63XX_DEV_USB_OHCI_H_
+
+int bcm63xx_ohci_register(void);
+
+#endif /* BCM63XX_DEV_USB_OHCI_H_ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 07/13] MIPS: BCM63XX: register OHCI controller if board enables it
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (5 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 06/13] MIPS: BCM63XX: add support for the on-chip OHCI controller Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol Florian Fainelli
` (5 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
BCM63XX-based boards can control the registration of the OHCI controller
by setting their has_ohci0 flag to 1. Handle this in the generic
code dealing with board registration and call the actual helper to
register the OHCI controller.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index ed1949c..9cdc023 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -25,6 +25,7 @@
#include <bcm63xx_dev_flash.h>
#include <bcm63xx_dev_pcmcia.h>
#include <bcm63xx_dev_spi.h>
+#include <bcm63xx_dev_usb_ohci.h>
#include <bcm63xx_dev_usb_usbd.h>
#include <board_bcm963xx.h>
@@ -851,6 +852,9 @@ int __init board_register_devices(void)
if (board.has_usbd)
bcm63xx_usbd_register(&board.usbd);
+ if (board.has_ohci0)
+ bcm63xx_ohci_register();
+
if (board.has_dsp)
bcm63xx_dsp_register(&board.dsp);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (6 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 07/13] MIPS: BCM63XX: register OHCI controller if board enables it Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:29 ` David Daney
2013-01-28 19:06 ` [PATCH 09/13] MIPS: BCM63XX: add support for the on-chip EHCI controller Florian Fainelli
` (4 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This configuration symbol can be used by CPUs supporting the on-chip
EHCI controller, and ensures that all relevant EHCI-related
configuration options are selected. So far BCM6328, BCM6358 and BCM6368
have an EHCI controller and do select this symbol. Update
drivers/usb/host/Kconfig with BCM63XX to update direct unmet
dependencies.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/Kconfig | 9 +++++++++
drivers/usb/host/Kconfig | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index 23b1ffd..b899359 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -7,10 +7,17 @@ config BCM63XX_OHCI
select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
+config BCM63XX_EHCI
+ bool
+ select USB_ARCH_HAS_EHCI
+ select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
+ select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+
config BCM63XX_CPU_6328
bool "support 6328 CPU"
select HW_HAS_PCI
select BCM63XX_OHCI
+ select BCM63XX_EHCI
config BCM63XX_CPU_6338
bool "support 6338 CPU"
@@ -28,11 +35,13 @@ config BCM63XX_CPU_6358
bool "support 6358 CPU"
select HW_HAS_PCI
select BCM63XX_OHCI
+ select BCM63XX_EHCI
config BCM63XX_CPU_6368
bool "support 6368 CPU"
select HW_HAS_PCI
select BCM63XX_OHCI
+ select BCM63XX_EHCI
endmenu
source "arch/mips/bcm63xx/boards/Kconfig"
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d6bb128..e16b2cb 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
PPC_MPC512x || CPU_CAVIUM_OCTEON || \
- PMC_MSP || SPARC_LEON || MIPS_SEAD3)
+ PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
+ BCM63XX)
default y
config USB_EHCI_BIG_ENDIAN_DESC
bool
depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
PPC_MPC512x || PMC_MSP || SPARC_LEON || \
- MIPS_SEAD3)
+ MIPS_SEAD3 || BCM63XX)
default y
config XPS_USB_HCD_XILINX
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 09/13] MIPS: BCM63XX: add support for the on-chip EHCI controller
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (7 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 10/13] MIPS: BCM63XX: register EHCI controller if board enables it Florian Fainelli
` (3 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
Broadcom BCM63XX SoCs include an on-chip EHCI controller which can be
driven by the generic ehci-platform driver by using specific power
on/off/suspend callbacks to manage clocks and hardware specific
configuration.
Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/Makefile | 2 +-
arch/mips/bcm63xx/dev-usb-ehci.c | 92 ++++++++++++++++++++
.../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 ++
3 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c
create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index a2a501a..c3503ae 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
- dev-usb-ohci.o dev-usb-usbd.o usb-common.o
+ dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += boards/
diff --git a/arch/mips/bcm63xx/dev-usb-ehci.c b/arch/mips/bcm63xx/dev-usb-ehci.c
new file mode 100644
index 0000000..0ea7888
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
@@ -0,0 +1,92 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+ * Copyright (C) 2013 Florian Fainelli <florian@openwrt.org>
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/usb/ehci_pdriver.h>
+#include <linux/dma-mapping.h>
+
+#include <bcm63xx_cpu.h>
+#include <bcm63xx_regs.h>
+#include <bcm63xx_io.h>
+#include <bcm63xx_usb_priv.h>
+#include <bcm63xx_dev_usb_ehci.h>
+
+static struct resource ehci_resources[] = {
+ {
+ .start = -1, /* filled at runtime */
+ .end = -1, /* filled at runtime */
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = -1, /* filled at runtime */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ehci_dmamask = DMA_BIT_MASK(32);
+
+static struct clk *usb_host_clock;
+
+static int bcm63xx_ehci_power_on(struct platform_device *pdev)
+{
+ usb_host_clock = clk_get(&pdev->dev, "usbh");
+ if (IS_ERR_OR_NULL(usb_host_clock))
+ return -ENODEV;
+
+ clk_prepare_enable(usb_host_clock);
+
+ bcm63xx_usb_priv_ehci_cfg_set();
+
+ return 0;
+}
+
+static void bcm63xx_ehci_power_off(struct platform_device *pdev)
+{
+ if (!IS_ERR_OR_NULL(usb_host_clock)) {
+ clk_disable_unprepare(usb_host_clock);
+ clk_put(usb_host_clock);
+ }
+}
+
+static struct usb_ehci_pdata bcm63xx_ehci_pdata = {
+ .big_endian_desc = 1,
+ .big_endian_mmio = 1,
+ .power_on = bcm63xx_ehci_power_on,
+ .power_off = bcm63xx_ehci_power_off,
+ .power_suspend = bcm63xx_ehci_power_off,
+};
+
+static struct platform_device bcm63xx_ehci_device = {
+ .name = "ehci-platform",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(ehci_resources),
+ .resource = ehci_resources,
+ .dev = {
+ .platform_data = &bcm63xx_ehci_pdata,
+ .dma_mask = &ehci_dmamask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+int __init bcm63xx_ehci_register(void)
+{
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
+ return 0;
+
+ 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;
+ ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0);
+
+ return platform_device_register(&bcm63xx_ehci_device);
+}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
new file mode 100644
index 0000000..17fb519
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h
@@ -0,0 +1,6 @@
+#ifndef BCM63XX_DEV_USB_EHCI_H_
+#define BCM63XX_DEV_USB_EHCI_H_
+
+int bcm63xx_ehci_register(void);
+
+#endif /* BCM63XX_DEV_USB_EHCI_H_ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 10/13] MIPS: BCM63XX: register EHCI controller if board enables it
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (8 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 09/13] MIPS: BCM63XX: add support for the on-chip EHCI controller Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking Florian Fainelli
` (2 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
BCM63XX-based board can control the registration of the EHCI controller
by setting their has_ehci0 flag to 1. Handle this in the generic
code dealing with board registration and call the actual helper to register
the EHCI controller.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 9cdc023..0ee7ca6 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -25,6 +25,7 @@
#include <bcm63xx_dev_flash.h>
#include <bcm63xx_dev_pcmcia.h>
#include <bcm63xx_dev_spi.h>
+#include <bcm63xx_dev_usb_ehci.h>
#include <bcm63xx_dev_usb_ohci.h>
#include <bcm63xx_dev_usb_usbd.h>
#include <board_bcm963xx.h>
@@ -852,6 +853,9 @@ int __init board_register_devices(void)
if (board.has_usbd)
bcm63xx_usbd_register(&board.usbd);
+ if (board.has_ehci0)
+ bcm63xx_ehci_register();
+
if (board.has_ohci0)
bcm63xx_ohci_register();
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (9 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 10/13] MIPS: BCM63XX: register EHCI controller if board enables it Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 20:08 ` Alan Stern
2013-01-28 19:06 ` [PATCH 12/13] MIPS: BCM63XX: EHCI controller does not support overcurrent Florian Fainelli
2013-01-28 19:06 ` [PATCH 13/13] MIPS: BCM63XX: update defconfig Florian Fainelli
12 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch adds an ignore_oc flag which can be set by EHCI controller
not supporting or wanting to disable overcurrent checking. The EHCI
platform data in include/linux/usb/ehci_pdriver.h is also augmented to
take advantage of this new flag.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
drivers/usb/host/ehci-hcd.c | 2 +-
drivers/usb/host/ehci-hub.c | 4 ++--
drivers/usb/host/ehci.h | 1 +
include/linux/usb/ehci_pdriver.h | 1 +
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c97503b..bd435ac 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
"USB %x.%x started, EHCI %x.%02x%s\n",
((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
temp >> 8, temp & 0xff,
- ignore_oc ? ", overcurrent ignored" : "");
+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
ehci_writel(ehci, INTR_MASK,
&ehci->regs->intr_enable); /* Turn On Interrupts */
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 4ccb97c..c18d4e4 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -611,7 +611,7 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
* always set, seem to clear PORT_OCC and PORT_CSC when writing to
* PORT_POWER; that's surprising, but maybe within-spec.
*/
- if (!ignore_oc)
+ if (!ignore_oc && !ehci->ignore_oc)
mask = PORT_CSC | PORT_PEC | PORT_OCC;
else
mask = PORT_CSC | PORT_PEC;
@@ -825,7 +825,7 @@ static int ehci_hub_control (
if (temp & PORT_PEC)
status |= USB_PORT_STAT_C_ENABLE << 16;
- if ((temp & PORT_OCC) && !ignore_oc){
+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){
status |= USB_PORT_STAT_C_OVERCURRENT << 16;
/*
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 9dadc71..2136479 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -196,6 +196,7 @@ struct ehci_hcd { /* one per controller */
unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/
unsigned has_synopsys_hc_bug:1; /* Synopsys HC */
unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
+ unsigned ignore_oc:1;
/* required for usb32 quirk */
#define OHCI_CTRL_HCFS (3 << 6)
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 99238b0..e2a77d3 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -42,6 +42,7 @@ struct usb_ehci_pdata {
unsigned big_endian_desc:1;
unsigned big_endian_mmio:1;
unsigned no_io_watchdog:1;
+ unsigned ignore_oc:1;
/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 12/13] MIPS: BCM63XX: EHCI controller does not support overcurrent
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (10 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 13/13] MIPS: BCM63XX: update defconfig Florian Fainelli
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch sets the ignore_oc flag for the BCM63XX EHCI controller as it
does not support proper overcurrent reporting.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/dev-usb-ehci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/bcm63xx/dev-usb-ehci.c b/arch/mips/bcm63xx/dev-usb-ehci.c
index 0ea7888..f7b6807 100644
--- a/arch/mips/bcm63xx/dev-usb-ehci.c
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
@@ -61,6 +61,7 @@ static void bcm63xx_ehci_power_off(struct platform_device *pdev)
static struct usb_ehci_pdata bcm63xx_ehci_pdata = {
.big_endian_desc = 1,
.big_endian_mmio = 1,
+ .ignore_oc = 1,
.power_on = bcm63xx_ehci_power_on,
.power_off = bcm63xx_ehci_power_off,
.power_suspend = bcm63xx_ehci_power_off,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 13/13] MIPS: BCM63XX: update defconfig
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
` (11 preceding siblings ...)
2013-01-28 19:06 ` [PATCH 12/13] MIPS: BCM63XX: EHCI controller does not support overcurrent Florian Fainelli
@ 2013-01-28 19:06 ` Florian Fainelli
12 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:06 UTC (permalink / raw)
To: linux-mips
Cc: ralf, jogo, mbizon, cenerkee, linux-usb, stern, gregkh, blogic,
Florian Fainelli
This patch updates the BCM63XX defconfig with the USB OHCI and EHCI host
drivers as well as the USB gadget driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/configs/bcm63xx_defconfig | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index 9190051..a5a2c5f 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -3,15 +3,12 @@ CONFIG_BCM63XX_CPU_6338=y
CONFIG_BCM63XX_CPU_6345=y
CONFIG_BCM63XX_CPU_6348=y
CONFIG_BCM63XX_CPU_6358=y
-CONFIG_NO_HZ=y
# CONFIG_SECCOMP is not set
CONFIG_EXPERIMENTAL=y
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
-CONFIG_TINY_RCU=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+CONFIG_NO_HZ=y
CONFIG_EXPERT=y
-# CONFIG_PCSPKR_PLATFORM is not set
# CONFIG_FUTEX is not set
# CONFIG_EPOLL is not set
# CONFIG_SIGNALFD is not set
@@ -44,36 +41,36 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_INTELEXT=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_PHYSMAP=y
# CONFIG_BLK_DEV is not set
-# CONFIG_MISC_DEVICES is not set
CONFIG_NETDEVICES=y
-CONFIG_BCM63XX_PHY=y
-CONFIG_NET_ETHERNET=y
CONFIG_BCM63XX_ENET=y
-# CONFIG_NETDEV_1000 is not set
-# CONFIG_NETDEV_10000 is not set
+CONFIG_BCM63XX_PHY=y
CONFIG_B43=y
# CONFIG_B43_PHY_LP is not set
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_BCM63XX=y
CONFIG_SERIAL_BCM63XX_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
# CONFIG_VGA_ARB is not set
CONFIG_USB=y
-# CONFIG_USB_DEVICE_CLASS is not set
CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_BCM63XX_UDC=y
+CONFIG_USB_ETH=y
+CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGER_TIMER=y
@@ -84,7 +81,6 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_PROC_KCORE=y
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_MAGIC_SYSRQ=y
-CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0,115200"
# CONFIG_CRYPTO_HW is not set
--
1.7.10.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
2013-01-28 19:06 ` [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol Florian Fainelli
@ 2013-01-28 19:29 ` David Daney
2013-01-28 19:57 ` Florian Fainelli
0 siblings, 1 reply; 26+ messages in thread
From: David Daney @ 2013-01-28 19:29 UTC (permalink / raw)
To: Florian Fainelli, linux-usb, stern, gregkh
Cc: linux-mips, ralf, jogo, mbizon, cenerkee, blogic
On 01/28/2013 11:06 AM, Florian Fainelli wrote:
> This configuration symbol can be used by CPUs supporting the on-chip
> EHCI controller, and ensures that all relevant EHCI-related
> configuration options are selected. So far BCM6328, BCM6358 and BCM6368
> have an EHCI controller and do select this symbol. Update
> drivers/usb/host/Kconfig with BCM63XX to update direct unmet
> dependencies.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> arch/mips/bcm63xx/Kconfig | 9 +++++++++
> drivers/usb/host/Kconfig | 5 +++--
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
> index 23b1ffd..b899359 100644
> --- a/arch/mips/bcm63xx/Kconfig
> +++ b/arch/mips/bcm63xx/Kconfig
> @@ -7,10 +7,17 @@ config BCM63XX_OHCI
> select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
> select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
>
> +config BCM63XX_EHCI
> + bool
> + select USB_ARCH_HAS_EHCI
> + select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
> + select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
> +
> config BCM63XX_CPU_6328
> bool "support 6328 CPU"
> select HW_HAS_PCI
> select BCM63XX_OHCI
> + select BCM63XX_EHCI
[...]
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index d6bb128..e16b2cb 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
> depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
> ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
> PPC_MPC512x || CPU_CAVIUM_OCTEON || \
> - PMC_MSP || SPARC_LEON || MIPS_SEAD3)
> + PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
> + BCM63XX)
> default y
This is a complete mess.
Can we get rid of the 'default y' and all those things after the '&&',
and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?
I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above). But
this doesn't seem sustainable. We should be trying to keep the
configuration information for all this in one spot.
Now you have it spread across two files. One to enable it, and the
other to select it. But do you really need to select it if it defaults
to 'y'
>
> config USB_EHCI_BIG_ENDIAN_DESC
> bool
> depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
> PPC_MPC512x || PMC_MSP || SPARC_LEON || \
> - MIPS_SEAD3)
> + MIPS_SEAD3 || BCM63XX)
> default y
>
Same here.
Thanks,
David (on a mission against Kconfig insanity) Daney
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
2013-01-28 19:29 ` David Daney
@ 2013-01-28 19:57 ` Florian Fainelli
2013-01-28 20:15 ` Alan Stern
0 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 19:57 UTC (permalink / raw)
To: David Daney
Cc: linux-usb, stern, gregkh, linux-mips, ralf, jogo, mbizon, blogic
Le 28/01/2013 20:29, David Daney a écrit :
> On 01/28/2013 11:06 AM, Florian Fainelli wrote:
>> This configuration symbol can be used by CPUs supporting the on-chip
>> EHCI controller, and ensures that all relevant EHCI-related
>> configuration options are selected. So far BCM6328, BCM6358 and BCM6368
>> have an EHCI controller and do select this symbol. Update
>> drivers/usb/host/Kconfig with BCM63XX to update direct unmet
>> dependencies.
>>
>> Signed-off-by: Florian Fainelli <florian@openwrt.org>
>> ---
>> arch/mips/bcm63xx/Kconfig | 9 +++++++++
>> drivers/usb/host/Kconfig | 5 +++--
>> 2 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
>> index 23b1ffd..b899359 100644
>> --- a/arch/mips/bcm63xx/Kconfig
>> +++ b/arch/mips/bcm63xx/Kconfig
>> @@ -7,10 +7,17 @@ config BCM63XX_OHCI
>> select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD
>> select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD
>>
>> +config BCM63XX_EHCI
>> + bool
>> + select USB_ARCH_HAS_EHCI
>> + select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
>> + select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
>> +
>> config BCM63XX_CPU_6328
>> bool "support 6328 CPU"
>> select HW_HAS_PCI
>> select BCM63XX_OHCI
>> + select BCM63XX_EHCI
> [...]
>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> index d6bb128..e16b2cb 100644
>> --- a/drivers/usb/host/Kconfig
>> +++ b/drivers/usb/host/Kconfig
>> @@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
>> depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
>> ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
>> PPC_MPC512x || CPU_CAVIUM_OCTEON || \
>> - PMC_MSP || SPARC_LEON || MIPS_SEAD3)
>> + PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
>> + BCM63XX)
>> default y
>
> This is a complete mess.
>
> Can we get rid of the 'default y' and all those things after the '&&',
> and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?
Yes, pretty much like what exists for OHCI, scales much better.
>
> I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above). But
> this doesn't seem sustainable. We should be trying to keep the
> configuration information for all this in one spot.
>
> Now you have it spread across two files. One to enable it, and the
> other to select it. But do you really need to select it if it defaults
> to 'y'
I do agree with you, but I don't want this patchset to be blocked by the
removal of the depends on (FOO && BAR && ...), but I can send a
preliminary patch for this and get it merged with Greg's tree first.
>
>
>>
>> config USB_EHCI_BIG_ENDIAN_DESC
>> bool
>> depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX ||
>> XPS_USB_HCD_XILINX || \
>> PPC_MPC512x || PMC_MSP || SPARC_LEON || \
>> - MIPS_SEAD3)
>> + MIPS_SEAD3 || BCM63XX)
>> default y
>>
>
>
> Same here.
>
> Thanks,
> David (on a mission against Kconfig insanity) Daney
>
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking
@ 2013-01-28 20:08 ` Alan Stern
0 siblings, 0 replies; 26+ messages in thread
From: Alan Stern @ 2013-01-28 20:08 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, ralf, jogo, mbizon, cenerkee, linux-usb, gregkh,
blogic
On Mon, 28 Jan 2013, Florian Fainelli wrote:
> This patch adds an ignore_oc flag which can be set by EHCI controller
> not supporting or wanting to disable overcurrent checking. The EHCI
> platform data in include/linux/usb/ehci_pdriver.h is also augmented to
> take advantage of this new flag.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> drivers/usb/host/ehci-hcd.c | 2 +-
> drivers/usb/host/ehci-hub.c | 4 ++--
> drivers/usb/host/ehci.h | 1 +
> include/linux/usb/ehci_pdriver.h | 1 +
> 4 files changed, 5 insertions(+), 3 deletions(-)
You forgot to add
ehci->ignore_oc = pdata->ignore_oc;
to ehci_platform_reset(). This makes me wonder: Either the patches
were not tested very well or else the new ignore_oc stuff isn't needed.
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index c97503b..bd435ac 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
> "USB %x.%x started, EHCI %x.%02x%s\n",
> ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
> temp >> 8, temp & 0xff,
> - ignore_oc ? ", overcurrent ignored" : "");
> + (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
You could simplify the code here and other places if you add
ehci->ignore_oc ||= ignore_oc;
to ehci_init(). Then you wouldn't need to test ignore_oc all the time.
Alan Stern
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking
@ 2013-01-28 20:08 ` Alan Stern
0 siblings, 0 replies; 26+ messages in thread
From: Alan Stern @ 2013-01-28 20:08 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, ralf, jogo, mbizon, cenerkee, linux-usb, gregkh,
blogic
On Mon, 28 Jan 2013, Florian Fainelli wrote:
> This patch adds an ignore_oc flag which can be set by EHCI controller
> not supporting or wanting to disable overcurrent checking. The EHCI
> platform data in include/linux/usb/ehci_pdriver.h is also augmented to
> take advantage of this new flag.
>
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> drivers/usb/host/ehci-hcd.c | 2 +-
> drivers/usb/host/ehci-hub.c | 4 ++--
> drivers/usb/host/ehci.h | 1 +
> include/linux/usb/ehci_pdriver.h | 1 +
> 4 files changed, 5 insertions(+), 3 deletions(-)
You forgot to add
ehci->ignore_oc = pdata->ignore_oc;
to ehci_platform_reset(). This makes me wonder: Either the patches
were not tested very well or else the new ignore_oc stuff isn't needed.
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index c97503b..bd435ac 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
> "USB %x.%x started, EHCI %x.%02x%s\n",
> ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
> temp >> 8, temp & 0xff,
> - ignore_oc ? ", overcurrent ignored" : "");
> + (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
You could simplify the code here and other places if you add
ehci->ignore_oc ||= ignore_oc;
to ehci_init(). Then you wouldn't need to test ignore_oc all the time.
Alan Stern
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
@ 2013-01-28 20:15 ` Alan Stern
0 siblings, 0 replies; 26+ messages in thread
From: Alan Stern @ 2013-01-28 20:15 UTC (permalink / raw)
To: Florian Fainelli
Cc: David Daney, linux-usb, gregkh, linux-mips, ralf, jogo, mbizon,
blogic
On Mon, 28 Jan 2013, Florian Fainelli wrote:
> >> --- a/drivers/usb/host/Kconfig
> >> +++ b/drivers/usb/host/Kconfig
> >> @@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
> >> depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
> >> ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
> >> PPC_MPC512x || CPU_CAVIUM_OCTEON || \
> >> - PMC_MSP || SPARC_LEON || MIPS_SEAD3)
> >> + PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
> >> + BCM63XX)
> >> default y
> >
> > This is a complete mess.
> >
> > Can we get rid of the 'default y' and all those things after the '&&',
> > and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?
>
> Yes, pretty much like what exists for OHCI, scales much better.
>
> >
> > I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above). But
> > this doesn't seem sustainable. We should be trying to keep the
> > configuration information for all this in one spot.
> >
> > Now you have it spread across two files. One to enable it, and the
> > other to select it. But do you really need to select it if it defaults
> > to 'y'
>
> I do agree with you, but I don't want this patchset to be blocked by the
> removal of the depends on (FOO && BAR && ...), but I can send a
> preliminary patch for this and get it merged with Greg's tree first.
If you decide to do this, consider the discussion starting here:
http://marc.info/?l=linux-usb&m=135886919810940&w=2
As far as I know, there is no good reason for keeping the
USB_ARCH_HAS_EHCI symbol at all. And the glue drivers can select
USB_EHCI_HCD instead of depending on it.
Alan Stern
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol
@ 2013-01-28 20:15 ` Alan Stern
0 siblings, 0 replies; 26+ messages in thread
From: Alan Stern @ 2013-01-28 20:15 UTC (permalink / raw)
To: Florian Fainelli
Cc: David Daney, linux-usb, gregkh, linux-mips, ralf, jogo, mbizon,
blogic
On Mon, 28 Jan 2013, Florian Fainelli wrote:
> >> --- a/drivers/usb/host/Kconfig
> >> +++ b/drivers/usb/host/Kconfig
> >> @@ -115,14 +115,15 @@ config USB_EHCI_BIG_ENDIAN_MMIO
> >> depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \
> >> ARCH_IXP4XX || XPS_USB_HCD_XILINX || \
> >> PPC_MPC512x || CPU_CAVIUM_OCTEON || \
> >> - PMC_MSP || SPARC_LEON || MIPS_SEAD3)
> >> + PMC_MSP || SPARC_LEON || MIPS_SEAD3 || \
> >> + BCM63XX)
> >> default y
> >
> > This is a complete mess.
> >
> > Can we get rid of the 'default y' and all those things after the '&&',
> > and select USB_EHCI_BIG_ENDIAN_MMIO in the board Kconfig files?
>
> Yes, pretty much like what exists for OHCI, scales much better.
>
> >
> > I am as guilty as anyone here (see || CPU_CAVIUM_OCTEON above). But
> > this doesn't seem sustainable. We should be trying to keep the
> > configuration information for all this in one spot.
> >
> > Now you have it spread across two files. One to enable it, and the
> > other to select it. But do you really need to select it if it defaults
> > to 'y'
>
> I do agree with you, but I don't want this patchset to be blocked by the
> removal of the depends on (FOO && BAR && ...), but I can send a
> preliminary patch for this and get it merged with Greg's tree first.
If you decide to do this, consider the discussion starting here:
http://marc.info/?l=linux-usb&m=135886919810940&w=2
As far as I know, there is no good reason for keeping the
USB_ARCH_HAS_EHCI symbol at all. And the glue drivers can select
USB_EHCI_HCD instead of depending on it.
Alan Stern
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
@ 2013-01-28 20:41 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2013-01-28 20:41 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, ralf, jogo, mbizon, cenerkee, linux-usb, stern,
gregkh, blogic
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Hi,
On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
> diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
> index ad17533..af450c4 100644
> --- a/drivers/usb/gadget/bcm63xx_udc.c
> +++ b/drivers/usb/gadget/bcm63xx_udc.c
> @@ -41,6 +41,7 @@
> #include <bcm63xx_dev_usb_usbd.h>
> #include <bcm63xx_io.h>
> #include <bcm63xx_regs.h>
> +#include <bcm63xx_usb_priv.h>
actually, I want to see this arch dependency vanish. The whole
"phy_mode" stuff should be a PHY driver, care to implement this properly
using the PHY layer ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
@ 2013-01-28 20:41 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2013-01-28 20:41 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, ralf, jogo, mbizon, cenerkee, linux-usb, stern,
gregkh, blogic
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Hi,
On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
> diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
> index ad17533..af450c4 100644
> --- a/drivers/usb/gadget/bcm63xx_udc.c
> +++ b/drivers/usb/gadget/bcm63xx_udc.c
> @@ -41,6 +41,7 @@
> #include <bcm63xx_dev_usb_usbd.h>
> #include <bcm63xx_io.h>
> #include <bcm63xx_regs.h>
> +#include <bcm63xx_usb_priv.h>
actually, I want to see this arch dependency vanish. The whole
"phy_mode" stuff should be a PHY driver, care to implement this properly
using the PHY layer ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking
2013-01-28 20:08 ` Alan Stern
(?)
@ 2013-01-28 20:58 ` Florian Fainelli
-1 siblings, 0 replies; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 20:58 UTC (permalink / raw)
To: Alan Stern; +Cc: linux-mips, ralf, jogo, mbizon, linux-usb, gregkh, blogic
Le 28/01/2013 21:08, Alan Stern a écrit :
> On Mon, 28 Jan 2013, Florian Fainelli wrote:
>
>> This patch adds an ignore_oc flag which can be set by EHCI controller
>> not supporting or wanting to disable overcurrent checking. The EHCI
>> platform data in include/linux/usb/ehci_pdriver.h is also augmented to
>> take advantage of this new flag.
>>
>> Signed-off-by: Florian Fainelli <florian@openwrt.org>
>> ---
>> drivers/usb/host/ehci-hcd.c | 2 +-
>> drivers/usb/host/ehci-hub.c | 4 ++--
>> drivers/usb/host/ehci.h | 1 +
>> include/linux/usb/ehci_pdriver.h | 1 +
>> 4 files changed, 5 insertions(+), 3 deletions(-)
>
> You forgot to add
>
> ehci->ignore_oc = pdata->ignore_oc;
>
> to ehci_platform_reset(). This makes me wonder: Either the patches
> were not tested very well or else the new ignore_oc stuff isn't needed.
ignore_oc is not actually needed for all BCM63xx boards, and mine does
not require it, but that is clearly an oversight, thanks for spotting this.
>
>> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
>> index c97503b..bd435ac 100644
>> --- a/drivers/usb/host/ehci-hcd.c
>> +++ b/drivers/usb/host/ehci-hcd.c
>> @@ -634,7 +634,7 @@ static int ehci_run (struct usb_hcd *hcd)
>> "USB %x.%x started, EHCI %x.%02x%s\n",
>> ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
>> temp >> 8, temp & 0xff,
>> - ignore_oc ? ", overcurrent ignored" : "");
>> + (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
>
> You could simplify the code here and other places if you add
>
> ehci->ignore_oc ||= ignore_oc;
>
> to ehci_init(). Then you wouldn't need to test ignore_oc all the time.
>
> Alan Stern
>
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
2013-01-28 20:41 ` Felipe Balbi
(?)
@ 2013-01-28 21:17 ` Florian Fainelli
2013-01-29 7:37 ` Felipe Balbi
-1 siblings, 1 reply; 26+ messages in thread
From: Florian Fainelli @ 2013-01-28 21:17 UTC (permalink / raw)
To: linux-mips, balbi
Cc: ralf, jogo, mbizon, cernekee, linux-usb, stern, gregkh, blogic
On Monday 28 January 2013 22:41:14 Felipe Balbi wrote:
> Hi,
>
> On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
> > diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
> > index ad17533..af450c4 100644
> > --- a/drivers/usb/gadget/bcm63xx_udc.c
> > +++ b/drivers/usb/gadget/bcm63xx_udc.c
> > @@ -41,6 +41,7 @@
> > #include <bcm63xx_dev_usb_usbd.h>
> > #include <bcm63xx_io.h>
> > #include <bcm63xx_regs.h>
> > +#include <bcm63xx_usb_priv.h>
>
> actually, I want to see this arch dependency vanish. The whole
> "phy_mode" stuff should be a PHY driver, care to implement this properly
> using the PHY layer ?
Ok, but then I won't be able to use the generic OHCI and EHCI platform drivers
because they are not yet aware of clocks, PHY slave device etc... For now I
would like to stick with that since this is also very BCM63xx centric.
Would that be ok with you?
--
Florian
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
@ 2013-01-29 7:37 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2013-01-29 7:37 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, balbi, ralf, jogo, mbizon, cernekee, linux-usb, stern,
gregkh, blogic
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Hi,
On Mon, Jan 28, 2013 at 10:17:15PM +0100, Florian Fainelli wrote:
> On Monday 28 January 2013 22:41:14 Felipe Balbi wrote:
> > Hi,
> >
> > On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
> > > diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
> > > index ad17533..af450c4 100644
> > > --- a/drivers/usb/gadget/bcm63xx_udc.c
> > > +++ b/drivers/usb/gadget/bcm63xx_udc.c
> > > @@ -41,6 +41,7 @@
> > > #include <bcm63xx_dev_usb_usbd.h>
> > > #include <bcm63xx_io.h>
> > > #include <bcm63xx_regs.h>
> > > +#include <bcm63xx_usb_priv.h>
> >
> > actually, I want to see this arch dependency vanish. The whole
> > "phy_mode" stuff should be a PHY driver, care to implement this properly
> > using the PHY layer ?
>
> Ok, but then I won't be able to use the generic OHCI and EHCI platform drivers
> because they are not yet aware of clocks, PHY slave device etc... For now I
> would like to stick with that since this is also very BCM63xx centric.
>
> Would that be ok with you?
sure, but we need to see a move towards making all of this generic and,
perhaps more importantly (at least to me), compilable on all arches so
we can make proper use of linux-next and Fengguang's build systems.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register
@ 2013-01-29 7:37 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2013-01-29 7:37 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-mips, balbi, ralf, jogo, mbizon, cernekee, linux-usb, stern,
gregkh, blogic
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Hi,
On Mon, Jan 28, 2013 at 10:17:15PM +0100, Florian Fainelli wrote:
> On Monday 28 January 2013 22:41:14 Felipe Balbi wrote:
> > Hi,
> >
> > On Mon, Jan 28, 2013 at 08:06:21PM +0100, Florian Fainelli wrote:
> > > diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
> > > index ad17533..af450c4 100644
> > > --- a/drivers/usb/gadget/bcm63xx_udc.c
> > > +++ b/drivers/usb/gadget/bcm63xx_udc.c
> > > @@ -41,6 +41,7 @@
> > > #include <bcm63xx_dev_usb_usbd.h>
> > > #include <bcm63xx_io.h>
> > > #include <bcm63xx_regs.h>
> > > +#include <bcm63xx_usb_priv.h>
> >
> > actually, I want to see this arch dependency vanish. The whole
> > "phy_mode" stuff should be a PHY driver, care to implement this properly
> > using the PHY layer ?
>
> Ok, but then I won't be able to use the generic OHCI and EHCI platform drivers
> because they are not yet aware of clocks, PHY slave device etc... For now I
> would like to stick with that since this is also very BCM63xx centric.
>
> Would that be ok with you?
sure, but we need to see a move towards making all of this generic and,
perhaps more importantly (at least to me), compilable on all arches so
we can make proper use of linux-next and Fengguang's build systems.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2013-01-29 7:38 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 19:06 [PATCH 00/13] MIPS: BCM63XX: support for OHCI and EHCI integrated controllers Florian Fainelli
2013-01-28 19:06 ` [PATCH 01/13] MIPS: BCM63XX: add USB host clock enable delay Florian Fainelli
2013-01-28 19:06 ` [PATCH 02/13] MIPS: BCM63XX: add USB device clock enable delay to clock code Florian Fainelli
2013-01-28 19:06 ` [PATCH 03/13] MIPS: BCM63XX: move code touching the USB private register Florian Fainelli
2013-01-28 20:41 ` Felipe Balbi
2013-01-28 20:41 ` Felipe Balbi
2013-01-28 21:17 ` Florian Fainelli
2013-01-29 7:37 ` Felipe Balbi
2013-01-29 7:37 ` Felipe Balbi
2013-01-28 19:06 ` [PATCH 04/13] MIPS: BCM63XX: add OHCI/EHCI configuration bits to common USB code Florian Fainelli
2013-01-28 19:06 ` [PATCH 05/13] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration symbol Florian Fainelli
2013-01-28 19:06 ` [PATCH 06/13] MIPS: BCM63XX: add support for the on-chip OHCI controller Florian Fainelli
2013-01-28 19:06 ` [PATCH 07/13] MIPS: BCM63XX: register OHCI controller if board enables it Florian Fainelli
2013-01-28 19:06 ` [PATCH 08/13] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration symbol Florian Fainelli
2013-01-28 19:29 ` David Daney
2013-01-28 19:57 ` Florian Fainelli
2013-01-28 20:15 ` Alan Stern
2013-01-28 20:15 ` Alan Stern
2013-01-28 19:06 ` [PATCH 09/13] MIPS: BCM63XX: add support for the on-chip EHCI controller Florian Fainelli
2013-01-28 19:06 ` [PATCH 10/13] MIPS: BCM63XX: register EHCI controller if board enables it Florian Fainelli
2013-01-28 19:06 ` [PATCH 11/13] USB: EHCI: add ignore_oc flag to disable overcurrent checking Florian Fainelli
2013-01-28 20:08 ` Alan Stern
2013-01-28 20:08 ` Alan Stern
2013-01-28 20:58 ` Florian Fainelli
2013-01-28 19:06 ` [PATCH 12/13] MIPS: BCM63XX: EHCI controller does not support overcurrent Florian Fainelli
2013-01-28 19:06 ` [PATCH 13/13] MIPS: BCM63XX: update defconfig Florian Fainelli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.