Add XHCI, EHCI and OHCI support for Broadcom STB SoS's
Subsystems (6)
Al Cooper
maintainerv4 cover Add XHCI, EHCI and OHCI support for Broadcom STB SoS's
V4 - Rename hcd phy flag "suspend_without_phy_exit" to
"phy_supplies_usb_clock" to more closely reflect the actaual hardware. Add the device tree property "suspend-without-phy-exit" to set the flag. Remove the code that sets the flag in the OHCI, EHCI and XHCI drivers which means that the ohci_platform.c driver can be used without any modifications.
V3 - Based on feedback
- Patch 3/6
In xhci-brcm.h, fixed incorrect function name when CONFIG_USB_XHCI_BRCM is not defined. Found by kbuild test robot.
- Patch 4/6
In ohci-platform.c, use devm_kmemdup() instead of demv_kzalloc().
- Patch 5/6
In ehci-platform.c, use dma_coerce_mask_and_coherent() instead of dma_coerce_mask_and_coherent(). Remove unneeded #ifdef CONFIG_OF.
V2 - Based on feedback, the functionality for XHCI and OHCI was
moved from Broadcom platform drivers into the standard XHCI and OHCI platform drivers. The EHCI functionality still uses a Broadcom EHCI driver because of the workarounds needed for bugs in the EHCI controller.
This adds support for the XHCI, EHCI and OHCI host controllers found in Broadcom STB SoC's. These drivers depend on getting access to the new Broadcom STB USB PHY driver through a device-tree phandle and will fail if the driver is not available.
Al Cooper (5):
dt-bindings: Add Broadcom STB USB support
usb: core: Add ability to skip phy exit on suspend and init on resume
usb: xhci: xhci-plat: Add support for Broadcom STB SoC's
usb: ehci: Add new EHCI driver for Broadcom STB SoC's
usb: host: Add ability to build new Broadcom STB USB drivers
.../devicetree/bindings/usb/brcm,bcm7445-ehci.txt | 24 ++ Documentation/devicetree/bindings/usb/usb-hcd.txt | 3 + Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 + MAINTAINERS | 9 + arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + drivers/usb/core/hcd.c | 8 +- drivers/usb/core/phy.c | 28 +- drivers/usb/core/phy.h | 9 +- drivers/usb/host/Kconfig | 26 ++ drivers/usb/host/Makefile | 18 +- drivers/usb/host/ehci-brcm.c | 286 +++++++++++++++++++++ drivers/usb/host/xhci-brcm.c | 16 ++ drivers/usb/host/xhci-brcm.h | 16 ++ drivers/usb/host/xhci-plat.c | 8 + include/linux/usb/hcd.h | 6 + 16 files changed, 439 insertions(+), 21 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.txt create mode 100644 drivers/usb/host/ehci-brcm.c create mode 100644 drivers/usb/host/xhci-brcm.c create mode 100644 drivers/usb/host/xhci-brcm.h
Signature · 1 line
1.9.0.138.g2de3478
Al Cooper
maintainerPATCH v4 1/5 dt-bindings: Add Broadcom STB USB support
Add DT bindings for Broadcom STB USB EHCI and XHCI drivers. Add "phy-supplies-usb-clock" property description to usb-hcd.txt
NOTE: The OHCI driver is not included because it uses the generic
platform driver.
--- .../devicetree/bindings/usb/brcm,bcm7445-ehci.txt | 24 ++++++++++++++++++++++ Documentation/devicetree/bindings/usb/usb-hcd.txt | 3 +++ Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 + 3 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.txt
Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.txt new file +24 -0
@@ -0,0 +1,24 @@ +Broadcom STB USB EHCI controller + +Required properties: +- compatible: should be "brcm,bcm7445-ehci" +- reg: should contain one register range i.e. start and length +- interrupts: description of the interrupt line +- phys: phandle + phy specifier pair + The specifier should be 0 for the OHCI/EHCI PHY +- phy-supplies-usb-clock: See usb-hcd.txt for details. + +Optional properties: +- clocks: A phandle for the EHCI clock + +Example: + +ehci@f0b00300 { + compatible = "brcm,bcm7445-ehci"; + reg = <0xf0b00300 0xa8>; + interrupts = <0x0 0x5a 0x0>; + interrupt-names = "usb0_ehci_0"; + phys = <&usbphy_0 0x0>; + clocks = <&usb20>; + phy-supplies-usb-clock; +};
Documentation/devicetree/bindings/usb/usb-hcd.txt +3 -0
@@ -2,6 +2,9 @@ Generic USB HCD (Host Controller Device) Properties Optional properties: - phys: a list of all USB PHYs on this HCD +- phy-supplies-usb-clock: boolean, used for SoCs where the PHY supplies + the usb controller clock. This will prevent the PHY exit from being + called on suspend. Example: &usb1 {
Documentation/devicetree/bindings/usb/usb-xhci.txt +1 -0
@@ -21,6 +21,7 @@ Required properties: device - "renesas,rcar-gen3-xhci" for a generic R-Car Gen3 or RZ/G2 compatible device + - "brcm,bcm7445-xhci" for Broadcom STB SoCs - "xhci-platform" (deprecated) When compatible with the generic version, nodes must list the
Signature · 1 line
1.9.0.138.g2de3478
Al Cooper
maintainerPATCH v4 2/5 usb: core: Add ability to skip phy exit on suspend and init on resume
In reply to Al CooperAdd the ability to skip calling the PHY's exit routine on suspend and the PHY's init routine on resume. This is to handle a USB PHY that should have it's power_off function called on suspend but cannot have it's exit function called because on exit it will disable the PHY to the point where all USB clocks are stopped and register accesses to the Host Controllers using the PHY will be disabled and the host drivers will crash.
This is enabled with the HCD flag "phy_supplies_usb_clock" which can be set from any HCD driver or with the device tree property "phy-supplies-usb-clock".
--- drivers/usb/core/hcd.c | 8 ++++---- drivers/usb/core/phy.c | 28 ++++++++++++++++++++-------- drivers/usb/core/phy.h | 9 ++++++--- include/linux/usb/hcd.h | 6 ++++++ 4 files changed, 36 insertions(+), 15 deletions(-)
drivers/usb/core/hcd.c +4 -4
@@ -2249,7 +2249,7 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) hcd->state =HC_STATE_SUSPENDED ;if (!PMSG_IS_AUTO (msg)) -usb_phy_roothub_suspend (hcd->self.sysdev, +usb_phy_roothub_suspend (hcd, hcd->phy_roothub);/* Did we race with a root-hub wakeup event? */
@@ -2290,7 +2290,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) }if (!PMSG_IS_AUTO (msg)) { - status =usb_phy_roothub_resume (hcd->self.sysdev, + status =usb_phy_roothub_resume (hcd, hcd->phy_roothub);if (status)return status;
@@ -2333,7 +2333,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) } }else { hcd->state = old_state; -usb_phy_roothub_suspend (hcd->self.sysdev, hcd->phy_roothub); +usb_phy_roothub_suspend (hcd, hcd->phy_roothub);dev_dbg (&rhdev->dev,"bus %s fail, err %d\n" ,"resume" , status);if (status != -ESHUTDOWN )
@@ -2730,7 +2730,7 @@ int usb_add_hcd(struct usb_hcd *hcd,struct usb_device *rhdev;if (!hcd->skip_phy_initialization &&usb_hcd_is_primary_hcd (hcd)) { - hcd->phy_roothub =usb_phy_roothub_alloc (hcd->self.sysdev); + hcd->phy_roothub =usb_phy_roothub_alloc (hcd);if (IS_ERR (hcd->phy_roothub))return PTR_ERR (hcd->phy_roothub);
drivers/usb/core/phy.c +20 -8
@@ -46,10 +46,11 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index,return 0 ; } -struct usb_phy_roothub *usb_phy_roothub_alloc (struct device *dev) +struct usb_phy_roothub *usb_phy_roothub_alloc (struct usb_hcd *hcd) {struct usb_phy_roothub *phy_roothub;int i, num_phys, err; +struct device *dev = hcd->self.sysdev;if (!IS_ENABLED (CONFIG_GENERIC_PHY ))return NULL ;
@@ -59,6 +60,9 @@ struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev)if (num_phys <=0 )return NULL ; +if (device_property_read_bool (dev,"phy-supplies-usb-clock" )) + hcd->phy_supplies_usb_clock =1 ; + phy_roothub =devm_kzalloc (dev,sizeof (*phy_roothub),GFP_KERNEL );if (!phy_roothub)return ERR_PTR (-ENOMEM );
@@ -162,26 +166,33 @@ void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub) }EXPORT_SYMBOL_GPL (usb_phy_roothub_power_off); -int usb_phy_roothub_suspend (struct device *controller_dev, +int usb_phy_roothub_suspend (struct usb_hcd *hcd,struct usb_phy_roothub *phy_roothub) { +struct device *controller_dev = hcd->self.sysdev; +usb_phy_roothub_power_off (phy_roothub); -/* keep the PHYs initialized so the device can wake up the system */ -if (device_may_wakeup (controller_dev)) +/* +* keep the PHYs initialized so the device can wake up the system +* or if needed to keep the USB clocks enabled. +*/ +if (device_may_wakeup (controller_dev) || hcd->phy_supplies_usb_clock)return 0 ;return usb_phy_roothub_exit (phy_roothub); }EXPORT_SYMBOL_GPL (usb_phy_roothub_suspend); -int usb_phy_roothub_resume (struct device *controller_dev, +int usb_phy_roothub_resume (struct usb_hcd *hcd,struct usb_phy_roothub *phy_roothub) { +struct device *controller_dev = hcd->self.sysdev;int err; -/* if the device can't wake up the system _exit was called */ -if (!device_may_wakeup (controller_dev)) { +/* if _exit was called on suspend */ +if (!device_may_wakeup (controller_dev) && + !hcd->phy_supplies_usb_clock) { err =usb_phy_roothub_init (phy_roothub);if (err)return err;
@@ -190,7 +201,8 @@ int usb_phy_roothub_resume(struct device *controller_dev, err =usb_phy_roothub_power_on (phy_roothub);/* undo _init if _power_on failed */ -if (err && !device_may_wakeup (controller_dev)) +if (err && !device_may_wakeup (controller_dev) + && !hcd->phy_supplies_usb_clock)usb_phy_roothub_exit (phy_roothub);return err;
drivers/usb/core/phy.h +6 -3
@@ -5,13 +5,16 @@* Copyright (C) 2018 Martin Blumenstingl <[email protected]> */ +#include <linux/usb.h> +#include <linux/usb/hcd.h> +#ifndef __USB_CORE_PHY_H_#define __USB_CORE_PHY_H_struct device ;struct usb_phy_roothub ; -struct usb_phy_roothub *usb_phy_roothub_alloc (struct device *dev); +struct usb_phy_roothub *usb_phy_roothub_alloc (struct usb_hcd *hcd);int usb_phy_roothub_init (struct usb_phy_roothub *phy_roothub);int usb_phy_roothub_exit (struct usb_phy_roothub *phy_roothub);
@@ -19,9 +22,9 @@int usb_phy_roothub_power_on (struct usb_phy_roothub *phy_roothub);void usb_phy_roothub_power_off (struct usb_phy_roothub *phy_roothub); -int usb_phy_roothub_suspend (struct device *controller_dev, +int usb_phy_roothub_suspend (struct usb_hcd *hcd,struct usb_phy_roothub *phy_roothub); -int usb_phy_roothub_resume (struct device *controller_dev, +int usb_phy_roothub_resume (struct usb_hcd *hcd,struct usb_phy_roothub *phy_roothub);#endif /* __USB_CORE_PHY_H_ */
include/linux/usb/hcd.h +6 -0
@@ -157,6 +157,12 @@ struct usb_hcd {*/ unsigned skip_phy_initialization:1; +/* +* Some phys supply the USB controller clocks and should not +* have exit called on suspend. +*/ + unsigned phy_supplies_usb_clock:1; +/* The next flag is a stopgap, to be removed when all the HCDs * support the new root-hub polling mechanism. */ unsigned uses_new_polling:1;
Signature · 1 line
1.9.0.138.g2de3478
Al Cooper
maintainerPATCH v4 3/5 usb: xhci: xhci-plat: Add support for Broadcom STB SoC's
In reply to Al CooperAdd support for Broadcom STB SoC's to the xhci platform driver
--- drivers/usb/host/xhci-brcm.c | 16 ++++++++++++++++ drivers/usb/host/xhci-brcm.h | 16 ++++++++++++++++ drivers/usb/host/xhci-plat.c | 8 ++++++++ 3 files changed, 40 insertions(+) create mode 100644 drivers/usb/host/xhci-brcm.c create mode 100644 drivers/usb/host/xhci-brcm.h
drivers/usb/host/xhci-brcm.c new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2018, Broadcom */ + +#include <linux/usb.h> +#include <linux/usb/hcd.h> + +#include "xhci.h" + +int xhci_plat_brcm_init_quirk (struct usb_hcd *hcd) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); + + xhci->quirks |=XHCI_RESET_ON_RESUME ; +return 0 ; +} +
drivers/usb/host/xhci-brcm.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2018, Broadcom */ + +#ifndef _XHCI_BRCM_H +#define _XHCI_BRCM_H + +#if IS_ENABLED (CONFIG_USB_XHCI_BRCM ) +int xhci_plat_brcm_init_quirk (struct usb_hcd *hcd); +#else +static inline int xhci_plat_brcm_init_quirk (struct usb_hcd *hcd) +{ +return 0 ; +} +#endif +#endif /* _XHCI_BRCM_H */ +
drivers/usb/host/xhci-plat.c +8 -0
@@ -24,6 +24,7 @@#include "xhci-plat.h" #include "xhci-mvebu.h" #include "xhci-rcar.h" +#include "xhci-brcm.h" static struct hc_driver __read_mostly xhci_plat_hc_driver;
@@ -112,6 +113,10 @@ static int xhci_plat_start(struct usb_hcd *hcd) .resume_quirk = xhci_rcar_resume_quirk, }; +static const struct xhci_plat_priv xhci_plat_brcm = { + .init_quirk = xhci_plat_brcm_init_quirk +}; +static const struct of_device_id usb_xhci_of_match[] = { { .compatible ="generic-xhci" ,
@@ -144,6 +149,9 @@ static int xhci_plat_start(struct usb_hcd *hcd) }, { .compatible = "renesas,rcar-gen3-xhci", .data = &xhci_plat_renesas_rcar_gen3, + }, { + .compatible = "brcm,bcm7445-xhci", + .data = &xhci_plat_brcm, }, {}, };
Signature · 1 line
1.9.0.138.g2de3478
Al Cooper
maintainerPATCH v4 4/5 usb: ehci: Add new EHCI driver for Broadcom STB SoC's
In reply to Al CooperAdd a new EHCI driver for Broadcom STB SoC's. A new EHCI driver was created instead of adding support to the existing ehci platform driver because of the code required to workaround bugs in the EHCI controller.
--- drivers/usb/host/ehci-brcm.c | 286 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 drivers/usb/host/ehci-brcm.c
drivers/usb/host/ehci-brcm.c new file +286 -0
@@ -0,0 +1,286 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2018, Broadcom */ + +#include <linux/acpi.h> +#include <linux/clk.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/usb.h> +#include <linux/usb/hcd.h> + +#include "ehci.h" + +#define BRCM_DRIVER_DESC "EHCI Broadcom STB driver" + +#define hcd_to_ehci_priv (h) ((struct brcm_priv *)hcd_to_ehci(h)->priv) + +struct brcm_priv { +struct clk *clk; +}; + +static const char brcm_hcd_name[] ="ehci-brcm" ; + +static int (*org_hub_control)(struct usb_hcd *hcd, +u16 typeReq,u16 wValue,u16 wIndex, +char *buf,u16 wLength); + +/* ehci_brcm_wait_for_sof +* Wait for start of next microframe, then wait extra delay microseconds +*/ +static inline void ehci_brcm_wait_for_sof (struct ehci_hcd *ehci,u32 delay) +{ +int frame_idx =ehci_readl (ehci, &ehci->regs->frame_index); + +while (frame_idx ==ehci_readl (ehci, &ehci->regs->frame_index)) + ; +udelay (delay); +} + +/* +* ehci_brcm_hub_control +* Intercept echi-hcd request to complete RESUME and align it to the start +* of the next microframe. +* If RESUME is complete too late in the microframe, host controller +* detects babble on suspended port and resets the port afterwards. +* This s/w workaround allows to avoid this problem. +* See SWLINUX-1909 for more details +*/ +static int ehci_brcm_hub_control ( +struct usb_hcd *hcd, +u16 typeReq, +u16 wValue, +u16 wIndex, +char *buf, +u16 wLength) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +int ports =HCS_N_PORTS (ehci->hcs_params); +u32 __iomem *status_reg = &ehci->regs->port_status[ + (wIndex &0xff ) -1 ]; +unsigned long flags; +int retval, irq_disabled =0 ; + +/* +* RESUME is cleared when GetPortStatus() is called 20ms after start +* of RESUME +*/ +if ((typeReq == GetPortStatus) && + (wIndex && wIndex <= ports) && + ehci->reset_done[wIndex-1 ] && +time_after_eq (jiffies, ehci->reset_done[wIndex-1 ]) && + (ehci_readl (ehci, status_reg) &PORT_RESUME )) { + +/* +* to make sure we are not interrupted until RESUME bit +* is cleared, disable interrupts on current CPU +*/ +ehci_dbg (ehci,"SOF alignment workaround\n" ); + irq_disabled =1 ; +local_irq_save (flags); +ehci_brcm_wait_for_sof (ehci,5 ); + } + retval = (*org_hub_control)(hcd, typeReq, wValue, wIndex, buf, wLength); +if (irq_disabled) +local_irq_restore (flags); +return retval; +} + +static int ehci_brcm_reset (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + + ehci->big_endian_mmio =1 ; + + ehci->caps = (struct ehci_caps *) hcd->regs; + ehci->regs = (struct ehci_regs *) (hcd->regs + +HC_LENGTH (ehci,ehci_readl (ehci, &ehci->caps->hc_capbase))); + +/* This fixes the lockup during reboot due to prior interrupts */ +ehci_writel (ehci,CMD_RESET , &ehci->regs->command); +mdelay (10 ); + +/* +* SWLINUX-1705: Avoid OUT packet underflows during high memory +* bus usage +* port_status[0x0f] = Broadcom-proprietary USB_EHCI_INSNREG00 @ 0x90 +*/ +ehci_writel (ehci,0x00800040 , &ehci->regs->port_status[0x10 ]); +ehci_writel (ehci,0x00000001 , &ehci->regs->port_status[0x12 ]); + +return ehci_setup (hcd); +} + +static struct hc_driver __read_mostly ehci_brcm_hc_driver; + +static const struct ehci_driver_overrides brcm_overrides__initconst = { + + .reset = ehci_brcm_reset, + .extra_priv_size =sizeof (struct brcm_priv ), +}; + +static int ehci_brcm_probe (struct platform_device *pdev) +{ +struct usb_hcd *hcd; +struct resource *res_mem; +struct brcm_priv *priv; +int irq; +int err; + +if (usb_disabled ()) +return -ENODEV ; + + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) +return err; + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +dev_err (&pdev->dev,"no irq provided" ); +return irq; + } + +/* Hook the hub control routine to work around a bug */ +if (org_hub_control ==NULL ) + org_hub_control = ehci_brcm_hc_driver.hub_control; + ehci_brcm_hc_driver.hub_control = ehci_brcm_hub_control; + +/* initialize hcd */ + hcd =usb_create_hcd (&ehci_brcm_hc_driver, + &pdev->dev,dev_name (&pdev->dev)); +if (!hcd) +return -ENOMEM ; + +platform_set_drvdata (pdev, hcd); + priv =hcd_to_ehci_priv (hcd); + + priv->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (priv->clk)) { +dev_err (&pdev->dev,"Clock not found in Device Tree\n" ); + priv->clk =NULL ; + } + err =clk_prepare_enable (priv->clk); +if (err) + goto err_hcd; + + res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + hcd->regs =devm_ioremap_resource (&pdev->dev, res_mem); +if (IS_ERR (hcd->regs)) { + err =PTR_ERR (hcd->regs); + goto err_clk; + } + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len =resource_size (res_mem); + err =usb_add_hcd (hcd, irq,IRQF_SHARED ); +if (err) + goto err_clk; + +device_wakeup_enable (hcd->self.controller); +device_enable_async_suspend (hcd->self.controller); +platform_set_drvdata (pdev, hcd); + +return err; + +err_clk: +clk_disable_unprepare (priv->clk); +err_hcd: +usb_put_hcd (hcd); + +return err; +} + +static int ehci_brcm_remove (struct platform_device *dev) +{ +struct usb_hcd *hcd =platform_get_drvdata (dev); +struct brcm_priv *priv =hcd_to_ehci_priv (hcd); + +usb_remove_hcd (hcd); +clk_disable_unprepare (priv->clk); +usb_put_hcd (hcd); +return 0 ; +} + +#ifdef CONFIG_PM_SLEEP + +static int ehci_brcm_suspend (struct device *dev) +{ +int ret; +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct brcm_priv *priv =hcd_to_ehci_priv (hcd); +bool do_wakeup =device_may_wakeup (dev); + + ret =ehci_suspend (hcd, do_wakeup); +clk_disable_unprepare (priv->clk); +return ret; +} + +static int ehci_brcm_resume (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +struct brcm_priv *priv =hcd_to_ehci_priv (hcd); +int err; + + err =clk_prepare_enable (priv->clk); +if (err) +return err; +/* +* SWLINUX-1705: Avoid OUT packet underflows during high memory +* bus usage +* port_status[0x0f] = Broadcom-proprietary USB_EHCI_INSNREG00 +* @ 0x90 +*/ +ehci_writel (ehci,0x00800040 , &ehci->regs->port_status[0x10 ]); +ehci_writel (ehci,0x00000001 , &ehci->regs->port_status[0x12 ]); + +ehci_resume (hcd, false); +return 0 ; +} +#endif /* CONFIG_PM_SLEEP */ + +static SIMPLE_DEV_PM_OPS(ehci_brcm_pm_ops, ehci_brcm_suspend, + ehci_brcm_resume); + +static const struct of_device_id brcm_ehci_of_match[] = { + { .compatible ="brcm,bcm7445-ehci" , }, + {} +}; + +static struct platform_driver ehci_brcm_driver = { + .probe = ehci_brcm_probe, + .remove = ehci_brcm_remove, + .shutdown = usb_hcd_platform_shutdown, + .driver = { + .owner =THIS_MODULE , + .name ="ehci-brcm" , + .pm = &ehci_brcm_pm_ops, + .of_match_table = brcm_ehci_of_match, + } +}; + +static int __init ehci_brcm_init (void ) +{ +if (usb_disabled ()) +return -ENODEV ; + +pr_info ("%s: " BRCM_DRIVER_DESC "\n" , brcm_hcd_name); + +ehci_init_driver (&ehci_brcm_hc_driver, &brcm_overrides); +return platform_driver_register (&ehci_brcm_driver); +} +module_init (ehci_brcm_init); + +static void __exit ehci_brcm_exit(void) +{ +platform_driver_unregister (&ehci_brcm_driver); +} +module_exit (ehci_brcm_exit); + +MODULE_ALIAS ("platform:ehci-brcm" ); +MODULE_DESCRIPTION (BRCM_DRIVER_DESC ); +MODULE_AUTHOR ("Al Cooper" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
1.9.0.138.g2de3478
Al Cooper
maintainerPATCH v4 5/5 usb: host: Add ability to build new Broadcom STB USB drivers
In reply to Al CooperAdd the build system changes needed to get the Broadcom STB XHCI, EHCI and OHCI functionality working. The link order for XHCI was changed in the Makefile because of the way STB XHCI, EHCI and OHCI controllers share a port which requires that the XHCI driver be initialized first. Also update MAINTAINERS.
--- MAINTAINERS | 9 +++++++++ arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + drivers/usb/host/Kconfig | 26 ++++++++++++++++++++++++++ drivers/usb/host/Makefile | 18 ++++++++++++------ 5 files changed, 49 insertions(+), 6 deletions(-)
MAINTAINERS +9 -0
@@ -2998,6 +2998,15 @@ S: Supported F: drivers/i2c/busses/i2c-brcmstb.c F: Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt +BROADCOM BRCMSTB USB XHCI, EHCI and OHCI DRIVERS +M: Al Cooper <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +F: drivers/usb/host/ehci-brcm.* +F: drivers/usb/host/xhci-brcm.* +F: Documentation/devicetree/bindings/usb/brcm,bcm7445-*.txt + BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER M: Al Cooper <[email protected]> L: [email protected]
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -726,6 +726,7 @@ CONFIG_USB_CHIPIDEA_UDC=y CONFIG_USB_CHIPIDEA_HOST=y CONFIG_USB_ISP1760=y CONFIG_USB_HSIC_USB3503=y +CONFIG_USB_BRCM=y CONFIG_AB8500_USB=y CONFIG_KEYSTONE_USB_PHY=m CONFIG_NOP_USB_XCEIV=m
arch/arm64/configs/defconfig +1 -0
@@ -520,6 +520,7 @@ CONFIG_USB_GADGET=y CONFIG_USB_RENESAS_USBHS_UDC=m CONFIG_USB_RENESAS_USB3=m CONFIG_USB_ULPI_BUS=y +CONFIG_USB_BRCM=y CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_ARMMMCI=y
drivers/usb/host/Kconfig +26 -0
@@ -96,6 +96,32 @@ config USB_XHCI_TEGRA endif # USB_XHCI_HCD +config USB_OHCI_BRCM + tristate + +config USB_EHCI_BRCM + tristate + +config USB_XHCI_BRCM + tristate + +config BRCM_USB_PHY + tristate + +config USB_BRCM + tristate "Broadcom STB USB support" + depends on ARCH_BRCMSTB || COMPILE_TEST + select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD + select USB_EHCI_BRCM if USB_EHCI_HCD + select USB_XHCI_BRCM if USB_XHCI_HCD + select USB_XHCI_PLATFORM if USB_XHCI_HCD + help + Say Y to enable support for XHCI, EHCI and OHCI host controllers + found in Broadcom STB SoC's. + + Disabling this will keep the controllers and corresponding + PHYs powered down. + config USB_EHCI_HCD tristate "EHCI HCD (USB 2.0) support" depends on HAS_DMA && HAS_IOMEM
drivers/usb/host/Makefile +12 -6
@@ -31,6 +31,10 @@ ifneq ($(CONFIG_USB_XHCI_RCAR), ) xhci-plat-hcd-y += xhci-rcar.o endif +ifneq ($(CONFIG_USB_XHCI_BRCM), ) + xhci-plat-hcd-y += xhci-brcm.o +endif + ifneq ($(CONFIG_DEBUG_FS),) xhci-hcd-y += xhci-debugfs.o endif
@@ -39,6 +43,13 @@ obj-$(CONFIG_USB_WHCI_HCD) += whci/ obj-$(CONFIG_USB_PCI) += pci-quirks.o +obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o +obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o +obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o +obj-$(CONFIG_USB_XHCI_HISTB) += xhci-histb.o +obj-$(CONFIG_USB_XHCI_MTK) += xhci-mtk.o +obj-$(CONFIG_USB_XHCI_TEGRA) += xhci-tegra.o + obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
@@ -52,6 +63,7 @@ obj-$(CONFIG_USB_EHCI_EXYNOS) += ehci-exynos.o obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o obj-$(CONFIG_USB_W90X900_EHCI) += ehci-w90x900.o +obj-$(CONFIG_USB_EHCI_BRCM) += ehci-brcm.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
@@ -72,12 +84,6 @@ obj-$(CONFIG_USB_OHCI_HCD_DAVINCI) += ohci-da8xx.o obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o obj-$(CONFIG_USB_FHCI_HCD) += fhci.o -obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o -obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o -obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o -obj-$(CONFIG_USB_XHCI_HISTB) += xhci-histb.o -obj-$(CONFIG_USB_XHCI_MTK) += xhci-mtk.o -obj-$(CONFIG_USB_XHCI_TEGRA) += xhci-tegra.o obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
Signature · 1 line
1.9.0.138.g2de3478
kbuild test robot
build bot[PATCH] usb: host: fix platform_no_drv_owner.cocci warnings
drivers/usb/host/ehci-brcm.c:258:3-8: No need to set .owner here. The core will do it.
From: kbuild test robot <[email protected]>
drivers/usb/host/ehci-brcm.c:258:3-8: No need to set .owner here. The core will do it.
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
---
url: https://github.com/0day-ci/linux/commits/Al-Cooper/Add-XHCI-EHCI-and-OHCI-support-for-Broadcom-STB-SoS-s/20181110-065441 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
ehci-brcm.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/host/ehci-brcm.c +0 -1
@@ -255,7 +255,6 @@ static struct platform_driver ehci_brcm_ .remove = ehci_brcm_remove, .shutdown = usb_hcd_platform_shutdown, .driver = { - .owner = THIS_MODULE, .name = "ehci-brcm", .pm = &ehci_brcm_pm_ops, .of_match_table = brcm_ehci_of_match,
kbuild test robot
build botRe: [PATCH V4 5/5] usb: host: Add ability to build new Broadcom STB USB drivers
In reply to Al CooperI love your patch! Perhaps something to improve:
Hi Al,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v4.20-rc1 next-20181109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Al-Cooper/Add-XHCI-EHCI-and-OHCI-support-for-Broadcom-STB-SoS-s/20181110-065441 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
coccinelle warnings: (new ones prefixed by >>)
>> drivers/usb/host/ehci-brcm.c:258:3-8: No need to set .owner here. The core will do it.
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH V4 1/5] dt-bindings: Add Broadcom STB USB support
In reply to Al CooperQuoted 6 lines · Al Cooper
Add DT bindings for Broadcom STB USB EHCI and XHCI drivers. Add "phy-supplies-usb-clock" property description to usb-hcd.txt
NOTE: The OHCI driver is not included because it uses the generic
platform driver.
Quoted 8 lines
Signed-off-by Al Cooper <[email protected]>--- .../devicetree/bindings/usb/brcm,bcm7445-ehci.txt | 24 ++++++++++++++++++++++ Documentation/devicetree/bindings/usb/usb-hcd.txt | 3 +++ Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 + 3 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.txt