USB: ehci-omap: Device tree support for 3.10
Subsystems (5)
cover USB: ehci-omap: Device tree support for 3.10
Hi Greg,
These patches implement device tree support for the OMAP's EHCI host controller. The corresponding MFD/SoC patches will be sent separately and this set has no dependeny with them.
NOTE: Last 2 patches are new and still need and Ack from Alan Stern. Please accept this set after he has acked them. Thanks.
cheers,
-roger
The following changes since commit f6161aa153581da4a3867a2d1a7caf4be19b6ec9:
Linux 3.9-rc2 (2013-03-10 16:54:19 -0700)
are available in the git repository at:
git://github.com/rogerq/linux.git usbhost-usb-next
Alan Stern (1):
USB: EHCI: split ehci-omap out to a separate driver
Roger Quadros (11):
USB: ehci-omap: Use devm_ioremap_resource()
USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of
suspend
USB: ehci-omap: Remove PHY reset handling code
USB: ehci-omap: Remove PHY regulator handling code
USB: ehci-omap: Select NOP USB transceiver driver
USB: ehci-omap: Get platform resources by index rather than by name
USB: ohci-omap3: Get platform resources by index rather than by name
USB: ohci-omap3: Add device tree support and binding information
USB: ehci-omap: Add device tree support and binding information
USB: ehci-omap: Try to get PHY even if not in PHY mode
USB: ehci-omap: Fix detection in HSIC mode
.../devicetree/bindings/usb/ehci-omap.txt | 32 ++ .../devicetree/bindings/usb/ohci-omap3.txt | 15 + drivers/usb/host/Kconfig | 3 +- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-hcd.c | 6 +- drivers/usb/host/ehci-omap.c | 312 +++++++++----------- drivers/usb/host/ohci-omap3.c | 24 ++- 7 files changed, 214 insertions(+), 179 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ehci-omap.txt create mode 100644 Documentation/devicetree/bindings/usb/ohci-omap3.txt
Signature · 1 line
1.7.4.1
PATCH 1/12 USB: EHCI: split ehci-omap out to a separate driver
From: Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>
This patch (as1645) converts ehci-omap over to the new "ehci-hcd is a library" approach, so that it can coexist peacefully with other EHCI platform drivers and can make use of the private area allocated at the end of struct ehci_hcd.
--- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-hcd.c | 6 +--- drivers/usb/host/ehci-omap.c | 76 +++++++++++++++++++----------------------- 4 files changed, 37 insertions(+), 48 deletions(-)
drivers/usb/host/Kconfig +1 -1
@@ -155,7 +155,7 @@ config USB_EHCI_MXC Variation of ARC USB block used in some Freescale chips. config USB_EHCI_HCD_OMAP - bool "EHCI support for OMAP3 and later chips" + tristate "EHCI support for OMAP3 and later chips" depends on USB_EHCI_HCD && ARCH_OMAP default y ---help---
drivers/usb/host/Makefile +1 -0
@@ -27,6 +27,7 @@ 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 obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o +obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
drivers/usb/host/ehci-hcd.c +1 -5
@@ -1252,11 +1252,6 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_hcd_sh_driver#endif -#ifdef CONFIG_USB_EHCI_HCD_OMAP -#include "ehci-omap.c" -#define PLATFORM_DRIVER ehci_hcd_omap_driver -#endif -#ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
@@ -1346,6 +1341,7 @@ MODULE_LICENSE ("GPL"); !IS_ENABLED (CONFIG_USB_EHCI_HCD_PLATFORM ) && \ !IS_ENABLED (CONFIG_USB_CHIPIDEA_HOST ) && \ !IS_ENABLED (CONFIG_USB_EHCI_MXC ) && \ + !IS_ENABLED (CONFIG_USB_EHCI_HCD_OMAP ) && \ !defined (PLATFORM_DRIVER ) && \ !defined (PS3_SYSTEM_BUS_DRIVER ) && \ !defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-omap.c +34 -42
117 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 2/12 USB: ehci-omap: Use devm_ioremap_resource()
In reply to Roger QuadrosMake use of devm_ioremap_resource() and correct comment.
--- drivers/usb/host/ehci-omap.c | 21 +++++---------------- 1 files changed, 5 insertions(+), 16 deletions(-)
drivers/usb/host/ehci-omap.c +5 -16
@@ -216,23 +216,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ehci" ); -if (!res) { -dev_err (dev,"UHH EHCI get resource failed\n" ); -return -ENODEV ; - } - - regs =ioremap (res->start,resource_size (res)); -if (!regs) { -dev_err (dev,"UHH EHCI ioremap failed\n" ); -return -ENOMEM ; - } + regs =devm_ioremap_resource (dev, res); +if (IS_ERR (regs)) +return PTR_ERR (regs); hcd =usb_create_hcd (&ehci_omap_hc_driver, dev,dev_name (dev));if (!hcd) { -dev_err (dev,"failed to create hcd with err %d\n" , ret); - ret = -ENOMEM ; - goto err_io; +dev_err (dev,"Failed to create HCD\n" ); +return -ENOMEM ; } hcd->rsrc_start = res->start;
@@ -285,8 +277,6 @@ err_pm_runtime:pm_runtime_put_sync (dev);usb_put_hcd (hcd); -err_io: -iounmap (regs);return ret; }
@@ -306,7 +296,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)usb_remove_hcd (hcd);disable_put_regulator (dev->platform_data); -iounmap (hcd->regs);usb_put_hcd (hcd);pm_runtime_put_sync (dev);
Signature · 1 line
1.7.4.1
PATCH 3/12 USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of suspend
In reply to Roger QuadrosFor each port that is in PHY mode we obtain a PHY device using the USB PHY library and put it out of suspend.
It is up to platform code to associate the PHY to the controller's port and it is up to the PHY driver to manage the PHY's resources.
Also remove weird spacing around declarations we come across.
--- drivers/usb/host/ehci-omap.c | 76 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 62 insertions(+), 14 deletions(-)
drivers/usb/host/ehci-omap.c +62 -14
@@ -4,10 +4,11 @@* Bus Glue for the EHCI controllers in OMAP3/4 * Tested on several OMAP3 boards, and OMAP4 Pandaboard * -* Copyright (C) 2007-2011 Texas Instruments, Inc. +* Copyright (C) 2007-2013 Texas Instruments, Inc. * Author: Vikram Pandita <[email protected]> * Author: Anand Gadiyar <[email protected]> * Author: Keshava Munegowda <[email protected]> +* Author: Roger Quadros <[email protected]> * * Copyright (C) 2009 Nokia Corporation * Contact: Felipe Balbi <[email protected]>
@@ -70,6 +71,10 @@ static const char hcd_name[] = "ehci-omap";/*-------------------------------------------------------------------------*/ +struct omap_hcd { +struct usb_phy *phy[OMAP3_HS_USB_PORTS ];/* one PHY for each port */ +int nports; +};static inline void ehci_write (void __iomem *base,u32 reg,u32 val) {
@@ -178,7 +183,8 @@ static void disable_put_regulator(static struct hc_driver __read_mostly ehci_omap_hc_driver;static const struct ehci_driver_overrides ehci_omap_overrides__initdata = { - .reset = omap_ehci_init, + .reset = omap_ehci_init, + .extra_priv_size =sizeof (struct omap_hcd ), };/**
@@ -190,15 +196,16 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {*/ static int ehci_hcd_omap_probe (struct platform_device *pdev) { -struct device *dev = &pdev->dev; -struct usbhs_omap_platform_data *pdata = dev->platform_data; -struct resource *res; -struct usb_hcd *hcd; -void __iomem *regs; -int ret = -ENODEV ; -int irq; -int i; -char supply[7 ]; +struct device *dev = &pdev->dev; +struct usbhs_omap_platform_data *pdata = dev->platform_data; +struct resource *res; +struct usb_hcd *hcd; +void __iomem *regs; +int ret = -ENODEV ; +int irq; +int i; +char supply[7 ]; +struct omap_hcd *omap;if (usb_disabled ())return -ENODEV ;
@@ -231,6 +238,33 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) hcd->rsrc_len =resource_size (res); hcd->regs = regs; + omap = (struct omap_hcd *)hcd_to_ehci (hcd)->priv; + omap->nports = pdata->nports; + +platform_set_drvdata (pdev, hcd); + +/* get the PHY devices if needed */ +for (i =0 ; i < omap->nports ; i++) { +struct usb_phy *phy; + +if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) +continue ; + +/* get the PHY device */ + phy =devm_usb_get_phy_dev (dev, i); +if (IS_ERR (phy) || !phy) { + ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ; +dev_err (dev,"Can't get PHY device for port %d: %d\n" , + i, ret); + goto err_phy; + } + + omap->phy[i] = phy; +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + } +/* get ehci regulator and enable */ for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) {if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) {
@@ -275,6 +309,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) err_pm_runtime:disable_put_regulator (pdata);pm_runtime_put_sync (dev); + +err_phy: +for (i =0 ; i < omap->nports; i++) { +if (omap->phy[i]) +usb_phy_shutdown (omap->phy[i]); + } +usb_put_hcd (hcd);return ret;
@@ -291,13 +332,20 @@ err_pm_runtime:*/ static int ehci_hcd_omap_remove (struct platform_device *pdev) { -struct device *dev = &pdev->dev; -struct usb_hcd *hcd =dev_get_drvdata (dev); +struct device *dev = &pdev->dev; +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct omap_hcd *omap = (struct omap_hcd *)hcd_to_ehci (hcd)->priv; +int i;usb_remove_hcd (hcd);disable_put_regulator (dev->platform_data); -usb_put_hcd (hcd); +for (i =0 ; i < omap->nports; i++) { +if (omap->phy[i]) +usb_phy_shutdown (omap->phy[i]); + } + +usb_put_hcd (hcd);pm_runtime_put_sync (dev);pm_runtime_disable (dev);
Signature · 1 line
1.7.4.1
PATCH 4/12 USB: ehci-omap: Remove PHY reset handling code
In reply to Roger QuadrosReset GPIO handling for the PHY must be done in the PHY driver. We use the PHY helpers instead to reset the PHY.
--- drivers/usb/host/ehci-omap.c | 72 ++++++------------------------------------ 1 files changed, 10 insertions(+), 62 deletions(-)
drivers/usb/host/ehci-omap.c +10 -62
@@ -86,79 +86,27 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)return __raw_readl (base + reg); } - -static void omap_ehci_soft_phy_reset (struct usb_hcd *hcd,u8 port) -{ -unsigned long timeout = jiffies +msecs_to_jiffies (1000 ); -unsigned reg =0 ; - - reg =ULPI_FUNC_CTRL_RESET -/* FUNCTION_CTRL_SET register */ - | (ULPI_SET (ULPI_FUNC_CTRL ) <<EHCI_INSNREG05_ULPI_REGADD_SHIFT ) -/* Write */ - | (2 <<EHCI_INSNREG05_ULPI_OPSEL_SHIFT ) -/* PORTn */ - | ((port +1 ) <<EHCI_INSNREG05_ULPI_PORTSEL_SHIFT ) -/* start ULPI access*/ - | (1 <<EHCI_INSNREG05_ULPI_CONTROL_SHIFT ); - -ehci_write (hcd->regs,EHCI_INSNREG05_ULPI , reg); - -/* Wait for ULPI access completion */ -while ((ehci_read (hcd->regs,EHCI_INSNREG05_ULPI ) - & (1 <<EHCI_INSNREG05_ULPI_CONTROL_SHIFT ))) { -cpu_relax (); - -if (time_after (jiffies, timeout)) { -dev_dbg (hcd->self.controller, -"phy reset operation timed out\n" ); -break ; - } - } -} -static int omap_ehci_init (struct usb_hcd *hcd) { -struct ehci_hcd *ehci =hcd_to_ehci (hcd); -int rc; -struct usbhs_omap_platform_data *pdata; - - pdata = hcd->self.controller->platform_data; +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; +int rc, i;/* Hold PHYs in reset while initializing EHCI controller */ -if (pdata->phy_reset) { -if (gpio_is_valid (pdata->reset_gpio_port[0 ])) -gpio_set_value_cansleep (pdata->reset_gpio_port[0 ],0 ); - -if (gpio_is_valid (pdata->reset_gpio_port[1 ])) -gpio_set_value_cansleep (pdata->reset_gpio_port[1 ],0 ); - -/* Hold the PHY in RESET for enough time till DIR is high */ -udelay (10 ); +for (i =0 ; i < omap->nports; i++) { +if (omap->phy[i]) +usb_phy_shutdown (omap->phy[i]); } -/* Soft reset the PHY using PHY reset command over ULPI */ -if (pdata->port_mode[0 ] ==OMAP_EHCI_PORT_MODE_PHY ) -omap_ehci_soft_phy_reset (hcd,0 ); -if (pdata->port_mode[1 ] ==OMAP_EHCI_PORT_MODE_PHY ) -omap_ehci_soft_phy_reset (hcd,1 ); -/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -if (pdata->phy_reset) { -/* Hold the PHY in RESET for enough time till -* PHY is settled and ready -*/ -udelay (10 ); - -if (gpio_is_valid (pdata->reset_gpio_port[0 ])) -gpio_set_value_cansleep (pdata->reset_gpio_port[0 ],1 ); - -if (gpio_is_valid (pdata->reset_gpio_port[1 ])) -gpio_set_value_cansleep (pdata->reset_gpio_port[1 ],1 ); +/* Bring PHYs out of reset */ +for (i =0 ; i < omap->nports; i++) { +if (omap->phy[i]) +usb_phy_init (omap->phy[i]); }return rc;
Signature · 1 line
1.7.4.1
PATCH 5/12 USB: ehci-omap: Remove PHY regulator handling code
In reply to Roger QuadrosPHY regulator handling must be done in the PHY driver
--- drivers/usb/host/ehci-omap.c | 34 ---------------------------------- 1 files changed, 0 insertions(+), 34 deletions(-)
drivers/usb/host/ehci-omap.c +0 -34
@@ -43,7 +43,6 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/usb/ulpi.h> -#include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> #include <linux/gpio.h> #include <linux/clk.h>
@@ -112,19 +111,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)return rc; } -static void disable_put_regulator ( -struct usbhs_omap_platform_data *pdata) -{ -int i; - -for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) { -if (pdata->regulator[i]) { -regulator_disable (pdata->regulator[i]); -regulator_put (pdata->regulator[i]); - } - } -} -/* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */
@@ -152,7 +138,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)int ret = -ENODEV ;int irq;int i; -char supply[7 ];struct omap_hcd *omap;if (usb_disabled ())
@@ -213,23 +198,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)usb_phy_set_suspend (omap->phy[i],0 ); } -/* get ehci regulator and enable */ -for (i =0 ; i <OMAP3_HS_USB_PORTS ; i++) { -if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) { - pdata->regulator[i] =NULL ; -continue ; - } -snprintf (supply,sizeof (supply),"hsusb%d" , i); - pdata->regulator[i] =regulator_get (dev, supply); -if (IS_ERR (pdata->regulator[i])) { - pdata->regulator[i] =NULL ; -dev_dbg (dev, -"failed to get ehci port%d regulator\n" , i); - }else { -regulator_enable (pdata->regulator[i]); - } - } -pm_runtime_enable (dev);pm_runtime_get_sync (dev);
@@ -255,7 +223,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)return 0 ; err_pm_runtime: -disable_put_regulator (pdata);pm_runtime_put_sync (dev); err_phy:
@@ -286,7 +253,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)int i;usb_remove_hcd (hcd); -disable_put_regulator (dev->platform_data);for (i =0 ; i < omap->nports; i++) {if (omap->phy[i])
Signature · 1 line
1.7.4.1
PATCH 6/12 USB: ehci-omap: Select NOP USB transceiver driver
In reply to Roger QuadrosIn PHY mode we need to have the nop-usb-xceiv transceiver driver to operate, so select it in Kconfig.
--- drivers/usb/host/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/host/Kconfig +1 -0
@@ -157,6 +157,7 @@ config USB_EHCI_MXC config USB_EHCI_HCD_OMAP tristate "EHCI support for OMAP3 and later chips" depends on USB_EHCI_HCD && ARCH_OMAP + select NOP_USB_XCEIV default y ---help--- Enables support for the on-chip EHCI controller on
Signature · 1 line
1.7.4.1
PATCH 7/12 USB: ehci-omap: Get platform resources by index rather than by name
In reply to Roger QuadrosSince there is only one resource per type we don't really need to use resource name to obtain it. This also also makes it easier for device tree adaptation.
--- drivers/usb/host/ehci-omap.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +2 -3
@@ -148,14 +148,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)return -ENODEV ; } - irq =platform_get_irq_byname (pdev,"ehci-irq" ); + irq =platform_get_irq (pdev,0 );if (irq <0 ) {dev_err (dev,"EHCI irq failed\n" );return -ENODEV ; } - res =platform_get_resource_byname (pdev, -IORESOURCE_MEM ,"ehci" ); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); regs =devm_ioremap_resource (dev, res);if (IS_ERR (regs))return PTR_ERR (regs);
Signature · 1 line
1.7.4.1
PATCH 8/12 USB: ohci-omap3: Get platform resources by index rather than by name
In reply to Roger QuadrosSince there is only one resource per type we don't really need to use resource name to obtain it. This also also makes it easier for device tree adaptation.
--- drivers/usb/host/ohci-omap3.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap3.c +2 -3
@@ -141,14 +141,13 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)return -ENODEV ; } - irq =platform_get_irq_byname (pdev,"ohci-irq" ); + irq =platform_get_irq (pdev,0 );if (irq <0 ) {dev_err (dev,"OHCI irq failed\n" );return -ENODEV ; } - res =platform_get_resource_byname (pdev, -IORESOURCE_MEM ,"ohci" ); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {dev_err (dev,"UHH OHCI get resource failed\n" );return -ENOMEM ;
Signature · 1 line
1.7.4.1
PATCH 9/12 USB: ohci-omap3: Add device tree support and binding information
In reply to Roger QuadrosAllows the OHCI controller found in OMAP3 and later chips to be specified via device tree.
--- .../devicetree/bindings/usb/ohci-omap3.txt | 15 +++++++++++++++ drivers/usb/host/ohci-omap3.c | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ohci-omap3.txt
Documentation/devicetree/bindings/usb/ohci-omap3.txt new file +15 -0
@@ -0,0 +1,15 @@ +OMAP HS USB OHCI controller (OMAP3 and later) + +Required properties: + +- compatible: should be "ti,ohci-omap3" +- reg: should contain one register range i.e. start and length +- interrupts: description of the interrupt line + +Example for OMAP4: + +usbhsohci: ohci@4a064800 { + compatible = "ti,ohci-omap3", "usb-ohci"; + reg = <0x4a064800 0x400>; + interrupts = <0 76 0x4>; +};
drivers/usb/host/ohci-omap3.c +19 -0
@@ -31,6 +31,8 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/of.h> +#include <linux/dma-mapping.h> /*-------------------------------------------------------------------------*/
@@ -112,6 +114,8 @@ static const struct hc_driver ohci_omap3_hc_driver = {/*-------------------------------------------------------------------------*/ +static u64 omap_ohci_dma_mask =DMA_BIT_MASK (32 ); +/* * configure so an HC device and id are always provided * always called with process context; sleeping is OK
@@ -159,6 +163,13 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)return -ENOMEM ; } +/* +* Right now device-tree probed devices don't get dma_mask set. +* Since shared usb code relies on it, set it here for now. +* Once we have dma capability bindings this can go away. +*/ +if (!pdev->dev.dma_mask) + pdev->dev.dma_mask = &omap_ohci_dma_mask; hcd =usb_create_hcd (&ohci_omap3_hc_driver, dev,dev_name (dev));
@@ -228,12 +239,20 @@ static void ohci_hcd_omap3_shutdown(struct platform_device *pdev) hcd->driver->shutdown (hcd); } +static const struct of_device_id omap_ohci_dt_ids[] = { + { .compatible ="ti,ohci-omap3" }, + { } +}; + +MODULE_DEVICE_TABLE (of, omap_ohci_dt_ids); +static struct platform_driver ohci_hcd_omap3_driver = { .probe = ohci_hcd_omap3_probe, .remove = ohci_hcd_omap3_remove, .shutdown = ohci_hcd_omap3_shutdown, .driver = { .name ="ohci-omap3" , + .of_match_table =of_match_ptr (omap_ohci_dt_ids), }, };
Signature · 1 line
1.7.4.1
PATCH 10/12 USB: ehci-omap: Add device tree support and binding information
In reply to Roger QuadrosAllows the OMAP EHCI controller to be specified via device tree.
--- .../devicetree/bindings/usb/ehci-omap.txt | 32 +++++++++++++++++ drivers/usb/host/ehci-omap.c | 37 +++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ehci-omap.txt
Documentation/devicetree/bindings/usb/ehci-omap.txt new file +32 -0
@@ -0,0 +1,32 @@ +OMAP HS USB EHCI controller + +This device is usually the child of the omap-usb-host +Documentation/devicetree/bindings/mfd/omap-usb-host.txt + +Required properties: + +- compatible: should be "ti,ehci-omap" +- reg: should contain one register range i.e. start and length +- interrupts: description of the interrupt line + +Optional properties: + +- phys: list of phandles to PHY nodes. + This property is required if at least one of the ports are in + PHY mode i.e. OMAP_EHCI_PORT_MODE_PHY + +To specify the port mode, see +Documentation/devicetree/bindings/mfd/omap-usb-host.txt + +Example for OMAP4: + +usbhsehci: ehci@4a064c00 { + compatible = "ti,ehci-omap", "usb-ehci"; + reg = <0x4a064c00 0x400>; + interrupts = <0 77 0x4>; +}; + +&usbhsehci { + phys = <&hsusb1_phy 0 &hsusb3_phy>; +}; +
drivers/usb/host/ehci-omap.c +36 -1
@@ -48,6 +48,8 @@#include <linux/clk.h> #include <linux/usb.h> #include <linux/usb/hcd.h> +#include <linux/of.h> +#include <linux/dma-mapping.h> #include "ehci.h"
@@ -121,6 +123,8 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = { .extra_priv_size = sizeof(struct omap_hcd), }; +static u64 omap_ehci_dma_mask =DMA_BIT_MASK (32 ); +/** * ehci_hcd_omap_probe - initialize TI-based HCDs *
@@ -148,6 +152,17 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)return -ENODEV ; } +/* For DT boot, get platform data from parent. i.e. usbhshost */ +if (dev->of_node) { + pdata = dev->parent->platform_data; + dev->platform_data = pdata; + } + +if (!pdata) { +dev_err (dev,"Missing platform data\n" ); +return -ENODEV ; + } + irq =platform_get_irq (pdev,0 );if (irq <0 ) {dev_err (dev,"EHCI irq failed\n" );
@@ -159,6 +174,14 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)if (IS_ERR (regs))return PTR_ERR (regs); +/* +* Right now device-tree probed devices don't get dma_mask set. +* Since shared usb code relies on it, set it here for now. +* Once we have dma capability bindings this can go away. +*/ +if (!pdev->dev.dma_mask) + pdev->dev.dma_mask = &omap_ehci_dma_mask; + hcd =usb_create_hcd (&ehci_omap_hc_driver, dev,dev_name (dev));if (!hcd) {
@@ -183,7 +206,10 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)continue ;/* get the PHY device */ - phy =devm_usb_get_phy_dev (dev, i); +if (dev->of_node) + phy =devm_usb_get_phy_by_phandle (dev,"phys" , i); +else + phy =devm_usb_get_phy_dev (dev, i);if (IS_ERR (phy) || !phy) { ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ; dev_err(dev, "Can't get PHY device for port %d: %d\n",
@@ -273,6 +299,13 @@ static void ehci_hcd_omap_shutdown(struct platform_device *pdev) hcd->driver->shutdown (hcd); } +static const struct of_device_id omap_ehci_dt_ids[] = { + { .compatible ="ti,ehci-omap" }, + { } +}; + +MODULE_DEVICE_TABLE (of, omap_ehci_dt_ids); +static struct platform_driver ehci_hcd_omap_driver = { .probe = ehci_hcd_omap_probe, .remove = ehci_hcd_omap_remove,
@@ -281,6 +314,7 @@ static struct platform_driver ehci_hcd_omap_driver = {/*.resume = ehci_hcd_omap_resume, */ .driver = { .name = hcd_name, + .of_match_table = of_match_ptr(omap_ehci_dt_ids), } };
@@ -307,6 +341,7 @@ module_exit(ehci_omap_cleanup);MODULE_ALIAS ("platform:ehci-omap" );MODULE_AUTHOR ("Texas Instruments, Inc." );MODULE_AUTHOR ("Felipe Balbi <[email protected]>" ); +MODULE_AUTHOR ("Roger Quadros <[email protected]>" );MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.4.1
PATCH 11/12 USB: ehci-omap: Try to get PHY even if not in PHY mode
In reply to Roger QuadrosEven when not in PHY mode, the USB device on the port (e.g. HUB) might need resources like RESET which can be modelled as a PHY device. So try to get the PHY device in any case.
--- drivers/usb/host/ehci-omap.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +4 -3
@@ -202,15 +202,16 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)for (i =0 ; i < omap->nports ; i++) {struct usb_phy *phy; -if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) -continue ; -/* get the PHY device */ if (dev->of_node) phy =devm_usb_get_phy_by_phandle (dev,"phys" , i);else phy =devm_usb_get_phy_dev (dev, i);if (IS_ERR (phy) || !phy) { +/* Don't bail out if PHY is not absolutely necessary */ +if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) +continue ; + ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ;dev_err (dev,"Can't get PHY device for port %d: %d\n" , i, ret);
Signature · 1 line
1.7.4.1
Re: [PATCH 11/12] USB: ehci-omap: Try to get PHY even if not in PHY mode
Quoted 6 lines · Roger Quadros
Even when not in PHY mode, the USB device on the port (e.g. HUB) might need resources like RESET which can be modelled as a PHY device. So try to get the PHY device in any case.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <[email protected]>
drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 217
Quoted 13 lines
drivers/usb/host/ehci-omap.c +4
-0/* get the PHY device */ if (dev->of_node) phy =devm_usb_get_phy_by_phandle (dev,"phys" , i);else phy =devm_usb_get_phy_dev (dev, i);if (IS_ERR (phy) || !phy) { +/* Don't bail out if PHY is not absolutely necessary */ +if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) +continue ; + ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ;dev_err (dev,"Can't get PHY device for port %d: %d\n" , i, ret);
Felipe, this is a strange interface. Why do we sometimes get an error-pointer and sometimes get just NULL? Why not always an error-pointer?
Alan Stern
Re: [PATCH 11/12] USB: ehci-omap: Try to get PHY even if not in PHY mode
Quoted 20 lines · Alan Stern
Quoted 6 lines · Roger Quadros
Even when not in PHY mode, the USB device on the port (e.g. HUB) might need resources like RESET which can be modelled as a PHY device. So try to get the PHY device in any case.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>Quoted 9 lines
drivers/usb/host/ehci-omap.c +3
-0/* get the PHY device */ if (dev->of_node) phy =devm_usb_get_phy_by_phandle (dev,"phys" , i);else phy =devm_usb_get_phy_dev (dev, i);if (IS_ERR (phy) || !phy) { +/* Don't bail out if PHY is not absolutely necessary */ +if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) +continue ;
Quoted 8 lines
drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 217
Quoted 4 lines
drivers/usb/host/ehci-omap.c +1
-0+ ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ;dev_err (dev,"Can't get PHY device for port %d: %d\n" , i, ret);Felipe, this is a strange interface. Why do we sometimes get an error-pointer and sometimes get just NULL? Why not always an error-pointer?
looks like we get NULL when PHY layer is disabled. Sounds like an oversight to me. Do you want to send a patch, or do I cook one and put yourself as Reported-by ?
Signature · 1 line
balbi
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
Alan Stern
maintainerRe: [PATCH 11/12] USB: ehci-omap: Try to get PHY even if not in PHY mode
Quoted 13 lines · Felipe Balbi
Quoted 4 lines
Quoted 4 lines
drivers/usb/host/ehci-omap.c +3
-0if (IS_ERR (phy) || !phy) { +/* Don't bail out if PHY is not absolutely necessary */ +if (pdata->port_mode[i] !=OMAP_EHCI_PORT_MODE_PHY ) +continue ;Quoted 8 lines
drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 217
Quoted 4 lines
drivers/usb/host/ehci-omap.c +1
-0+ ret =IS_ERR (phy) ?PTR_ERR (phy) : -ENODEV ;dev_err (dev,"Can't get PHY device for port %d: %d\n" , i, ret);Felipe, this is a strange interface. Why do we sometimes get an error-pointer and sometimes get just NULL? Why not always an error-pointer?
Quoted 3 lines
looks like we get NULL when PHY layer is disabled. Sounds like an oversight to me. Do you want to send a patch, or do I cook one and put yourself as Reported-by ?
You're more familiar with that code. "Reported-by" is good enough for me. :-)
Alan Stern
PATCH 12/12 USB: ehci-omap: Fix detection in HSIC mode
In reply to Roger QuadrosThe HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
--- drivers/usb/host/ehci-omap.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-)
drivers/usb/host/ehci-omap.c +11 -17
@@ -50,6 +50,7 @@#include <linux/usb/hcd.h> #include <linux/of.h> #include <linux/dma-mapping.h> +#include <linux/delay.h> #include "ehci.h"
@@ -90,26 +91,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }
@@ -219,9 +207,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } omap->phy[i] = phy; -usb_phy_init (omap->phy[i]); -/* bring PHY out of suspend */ -usb_phy_set_suspend (omap->phy[i],0 ); }pm_runtime_enable (dev);
@@ -245,6 +230,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_pm_runtime; } +/* Bring PHYs out of reset */ +for (i =0 ; i < omap->nports; i++) { +if (!omap->phy[i]) +continue ; + +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + }return 0 ;
Signature · 1 line
1.7.4.1
Re: [PATCH 12/12] USB: ehci-omap: Fix detection in HSIC mode
Hi,
Quoted 15 lines · Roger Quadros
The HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>--- drivers/usb/host/ehci-omap.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-)drivers/usb/host/ehci-omap.c +0
-0
drivers/usb/host/ehci-omap.c line 53
Quoted 4 lines
drivers/usb/host/ehci-omap.c +1
-0@@ -50,6 +50,7 @@#include <linux/usb/hcd.h> #include <linux/of.h> #include <linux/dma-mapping.h> +#include <linux/delay.h>
not needed here I guess.
Quoted 44 lines
drivers/usb/host/ehci-omap.c +1
-17#include "ehci.h" @@ -90,26 +91,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }@@ -219,9 +207,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } omap->phy[i] = phy; -usb_phy_init (omap->phy[i]); -/* bring PHY out of suspend */ -usb_phy_set_suspend (omap->phy[i],0 ); }pm_runtime_enable (dev);@@ -245,6 +230,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_pm_runtime; }
drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 241
Quoted 10 lines
drivers/usb/host/ehci-omap.c +9
-0+/* Bring PHYs out of reset */ +for (i =0 ; i < omap->nports; i++) { +if (!omap->phy[i]) +continue ; + +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + }
But isn't HSIC supposed to be PHYless devices. Maybe a comment explaining it might be helpful.
Thanks
Kishon
Re: [PATCH 12/12] USB: ehci-omap: Fix detection in HSIC mode
Quoted 13 lines · kishon
Hi,
Quoted 10 lines · Roger Quadros
The HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>--- drivers/usb/host/ehci-omap.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-)
Quoted 11 lines
drivers/usb/host/ehci-omap.c line 53
Quoted 9 lines
drivers/usb/host/ehci-omap.c +1
-0@@ -50,6 +50,7 @@#include <linux/usb/hcd.h> #include <linux/of.h> #include <linux/dma-mapping.h> +#include <linux/delay.h> not needed here I guess.
Right. will remove.
Quoted 45 lines
Quoted 45 lines
drivers/usb/host/ehci-omap.c +1
-17#include "ehci.h" @@ -90,26 +91,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }@@ -219,9 +207,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } omap->phy[i] = phy; -usb_phy_init (omap->phy[i]); -/* bring PHY out of suspend */ -usb_phy_set_suspend (omap->phy[i],0 ); }pm_runtime_enable (dev);@@ -245,6 +230,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_pm_runtime; }
Quoted 12 lines
drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 241
Quoted 9 lines
drivers/usb/host/ehci-omap.c +9
-0+/* Bring PHYs out of reset */ +for (i =0 ; i < omap->nports; i++) { +if (!omap->phy[i]) +continue ; + +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + }But isn't HSIC supposed to be PHYless devices. Maybe a comment explaining it might be helpful.
Yes HSIC is PHYless but they do have reset line between the chips. I'll put a comment.
cheers,
-roger
PATCH v2 12/12 USB: ehci-omap: Fix detection in HSIC mode
In reply to Roger QuadrosThe HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
Also remove outdated TODO list from header.
--- drivers/usb/host/ehci-omap.c | 38 +++++++++++++++----------------------- 1 files changed, 15 insertions(+), 23 deletions(-)
drivers/usb/host/ehci-omap.c +15 -23
@@ -29,12 +29,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -* TODO (last updated Feb 27, 2010): -* - add kernel-doc -* - enable AUTOIDLE -* - add suspend/resume -* - add HSIC and TLL support -* - convert to use hwmod and runtime PM */ #include <linux/kernel.h>
@@ -90,26 +84,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }
@@ -219,9 +200,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } omap->phy[i] = phy; -usb_phy_init (omap->phy[i]); -/* bring PHY out of suspend */ -usb_phy_set_suspend (omap->phy[i],0 ); }pm_runtime_enable (dev);
@@ -245,6 +223,20 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_pm_runtime; } +/* +* Bring PHYs out of reset. +* Even though HSIC mode is a PHY-less mode, the reset +* line exists between the chips and can be modelled +* as a PHY device for reset control. +*/ +for (i =0 ; i < omap->nports; i++) { +if (!omap->phy[i]) +continue ; + +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + }return 0 ;
Signature · 1 line
1.7.4.1
Alan Stern
maintainerRe: [PATCH v2 12/12] USB: ehci-omap: Fix detection in HSIC mode
Quoted 3 lines · Roger Quadros
The HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
This is not a great description of what the patch does. You should say that it moves PHY initialization until after EHCI initialization is complete, instead of initializing the PHYs first, shutting them down again, and then initializing them a second time.
Quoted 42 lines
Also remove outdated TODO list from header.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <[email protected]>--- drivers/usb/host/ehci-omap.c | 38 +++++++++++++++----------------------- 1 files changed, 15 insertions(+), 23 deletions(-)drivers/usb/host/ehci-omap.c +1
-14@@ -29,12 +29,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -* TODO (last updated Feb 27, 2010): -* - add kernel-doc -* - enable AUTOIDLE -* - add suspend/resume -* - add HSIC and TLL support -* - convert to use hwmod and runtime PM */ #include <linux/kernel.h> @@ -90,26 +84,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs;
drivers/usb/host/ehci-omap.c static inline u32 ehci_read(void __iomem *base, u32 reg) · line 95
Quoted 10 lines
drivers/usb/host/ehci-omap.c +0
-6rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }
Now that there's almost nothing left of this function, you can get rid of it completely. Move the assignment to ehci->caps into ehci_hcd_omap_probe() and remove the init entry in the overrides structure.
Alan Stern
Re: [PATCH v2 12/12] USB: ehci-omap: Fix detection in HSIC mode
Quoted 11 lines · Alan Stern
Quoted 3 lines · Roger Quadros
The HSIC devices need to be kept in reset while the EHCI controller is being initialized and only brought out of reset after the initialization is complete, else HSIC devices will not be detected.
This is not a great description of what the patch does. You should say that it moves PHY initialization until after EHCI initialization is complete, instead of initializing the PHYs first, shutting them down again, and then initializing them a second time.
Okay will update the description.
Quoted 44 lines
Quoted 44 lines
Also remove outdated TODO list from header.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>--- drivers/usb/host/ehci-omap.c | 38 +++++++++++++++----------------------- 1 files changed, 15 insertions(+), 23 deletions(-)drivers/usb/host/ehci-omap.c +1
-14@@ -29,12 +29,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -* TODO (last updated Feb 27, 2010): -* - add kernel-doc -* - enable AUTOIDLE -* - add suspend/resume -* - add HSIC and TLL support -* - convert to use hwmod and runtime PM */ #include <linux/kernel.h> @@ -90,26 +84,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd);
Quoted 13 lines
drivers/usb/host/ehci-omap.c static inline u32 ehci_read(void __iomem *base, u32 reg) · line 95
Quoted 8 lines
drivers/usb/host/ehci-omap.c +0
-6-/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }Now that there's almost nothing left of this function, you can get rid of it completely. Move the assignment to
ehci->capsintoehci_hcd_omap_probe()and remove the init entry in the overrides structure.
Right. Sounds good.
cheers,
-roger
PATCH v3 12/13 USB: ehci-omap: Fix detection in HSIC mode
In reply to Roger QuadrosMove PHY initialization until after EHCI initialization is complete, instead of initializing the PHYs first, shutting them down again, and then initializing them a second time.
This fixes HSIC device detection.
--- drivers/usb/host/ehci-omap.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-)
drivers/usb/host/ehci-omap.c +15 -17
@@ -90,26 +90,13 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)static int omap_ehci_init (struct usb_hcd *hcd) {struct ehci_hcd *ehci =hcd_to_ehci (hcd); -struct omap_hcd *omap = (struct omap_hcd *)ehci->priv; -int rc, i; - -/* Hold PHYs in reset while initializing EHCI controller */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_shutdown (omap->phy[i]); - } +int rc;/* we know this is the memory we want, no need to ioremap again */ ehci->caps = hcd->regs; rc =ehci_setup (hcd); -/* Bring PHYs out of reset */ -for (i =0 ; i < omap->nports; i++) { -if (omap->phy[i]) -usb_phy_init (omap->phy[i]); - } -return rc; }
@@ -219,9 +206,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } omap->phy[i] = phy; -usb_phy_init (omap->phy[i]); -/* bring PHY out of suspend */ -usb_phy_set_suspend (omap->phy[i],0 ); }pm_runtime_enable (dev);
@@ -245,6 +229,20 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) goto err_pm_runtime; } +/* +* Bring PHYs out of reset. +* Even though HSIC mode is a PHY-less mode, the reset +* line exists between the chips and can be modelled +* as a PHY device for reset control. +*/ +for (i =0 ; i < omap->nports; i++) { +if (!omap->phy[i]) +continue ; + +usb_phy_init (omap->phy[i]); +/* bring PHY out of suspend */ +usb_phy_set_suspend (omap->phy[i],0 ); + }return 0 ;
Signature · 1 line
1.7.4.1
Re: [PATCH v3 12/13] USB: ehci-omap: Fix detection in HSIC mode
Quoted 8 lines · Roger Quadros
Move PHY initialization until after EHCI initialization is complete, instead of initializing the PHYs first, shutting them down again, and then initializing them a second time.
This fixes HSIC device detection.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <[email protected]>
PATCH 13/13 USB: ehci-omap: Get rid of omap_ehci_init()
In reply to Roger QuadrosAs it does almost nothing, get rid of omap_ehci_init() and move the ehci->caps initialization part into probe().
Also remove the outdated TODO list from header.
--- drivers/usb/host/ehci-omap.c | 21 +-------------------- 1 files changed, 1 insertions(+), 20 deletions(-)
drivers/usb/host/ehci-omap.c +1 -20
@@ -29,12 +29,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -* TODO (last updated Feb 27, 2010): -* - add kernel-doc -* - enable AUTOIDLE -* - add suspend/resume -* - add HSIC and TLL support -* - convert to use hwmod and runtime PM */ #include <linux/kernel.h>
@@ -87,26 +81,12 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)return __raw_readl (base + reg); } -static int omap_ehci_init (struct usb_hcd *hcd) -{ -struct ehci_hcd *ehci =hcd_to_ehci (hcd); -int rc; - -/* we know this is the memory we want, no need to ioremap again */ - ehci->caps = hcd->regs; - - rc =ehci_setup (hcd); - -return rc; -} -/* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */ static struct hc_driver __read_mostly ehci_omap_hc_driver;static const struct ehci_driver_overrides ehci_omap_overrides__initdata = { - .reset = omap_ehci_init, .extra_priv_size =sizeof (struct omap_hcd ), };
@@ -179,6 +159,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len =resource_size (res); hcd->regs = regs; +hcd_to_ehci (hcd)->caps = regs; omap = (struct omap_hcd *)hcd_to_ehci (hcd)->priv; omap->nports = pdata->nports;
Signature · 1 line
1.7.4.1
Re: [PATCH 13/13] USB: ehci-omap: Get rid of omap_ehci_init()
Quoted 7 lines · Roger Quadros
As it does almost nothing, get rid of
omap_ehci_init()and move theehci->capsinitialization part intoprobe().Also remove the outdated TODO list from header.
Signed-off-by Roger Quadros <[email protected]>CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html