linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] Device tree support for OMAP HS USB Host
@ 2013-02-07 16:02 Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information Roger Quadros
                   ` (13 more replies)
  0 siblings, 14 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Hi,

This patchset adds device tree support for OMAP's High Speed USB Host
subsystem. Board adaptation for Panda and Beagleboard is also provided.

Tested on Beagleboard.

Will not yet work on Pandaboard as PHY clock is not provided in device tree.
We will need to address the PHY clock as per the discussion.
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg84525.html

v2:
- Addressed review comments, hopefully device tree parsing is more
  compliant and robust now.
- Added one new patch to fix omap-ehci module auto loading

The following changes since commit 286752ff5401f4b1675c4c33d13252a96e66bcb3:

  USB: ehci-omap: Select NOP USB transceiver driver (2013-02-07 17:00:54 +0200)

are available in the git repository at:
  git@github.com:rogerq/linux.git usb-next-usbhost16-dt

Roger Quadros (14):
      usb: phy: nop: Add device tree support and binding information
      USB: phy: nop: Defer probe if device needs VCC/RESET
      mfd: omap-usb-tll: move configuration code to omap_tll_init()
      mfd: omap-usb-tll: Add device tree support
      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
      mfd: omap-usb-host: Add device tree support and binding information
      ARM: dts: OMAP4: Add HS USB Host IP nodes
      ARM: dts: omap4-panda: Add USB Host support
      ARM: dts: OMAP3: Add HS USB Host IP nodes
      ARM: dts: omap3-beagle: Add USB Host support
      USB: ehci-omap: Fix autoloading of module

 .../devicetree/bindings/mfd/omap-usb-host.txt      |   80 ++++++++
 .../devicetree/bindings/mfd/omap-usb-tll.txt       |   17 ++
 .../devicetree/bindings/usb/omap-ehci.txt          |   34 +++
 .../devicetree/bindings/usb/omap3-ohci.txt         |   17 ++
 .../devicetree/bindings/usb/usb-nop-xceiv.txt      |   34 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   71 +++++++
 arch/arm/boot/dts/omap3.dtsi                       |   31 +++
 arch/arm/boot/dts/omap4-panda.dts                  |   55 +++++
 arch/arm/boot/dts/omap4.dtsi                       |   30 +++
 drivers/mfd/omap-usb-host.c                        |  167 +++++++++++++++-
 drivers/mfd/omap-usb-tll.c                         |  213 ++++++++++----------
 drivers/mfd/omap-usb.h                             |    5 +-
 drivers/usb/host/ehci-omap.c                       |   46 ++++-
 drivers/usb/host/ohci-omap3.c                      |   24 ++-
 drivers/usb/otg/nop-usb-xceiv.c                    |   47 ++++-
 include/linux/usb/nop-usb-xceiv.h                  |    4 +
 16 files changed, 743 insertions(+), 132 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
 create mode 100644 Documentation/devicetree/bindings/usb/omap-ehci.txt
 create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
 create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-11 11:40   ` Mark Rutland
  2013-02-07 16:02 ` [PATCH v2 02/14] USB: phy: nop: Defer probe if device needs VCC/RESET Roger Quadros
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

The PHY clock, clock rate, VCC regulator and RESET regulator
can now be provided via device tree.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 .../devicetree/bindings/usb/usb-nop-xceiv.txt      |   34 ++++++++++++++++++
 drivers/usb/otg/nop-usb-xceiv.c                    |   36 +++++++++++++++----
 2 files changed, 62 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt

diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
new file mode 100644
index 0000000..d7e2726
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
@@ -0,0 +1,34 @@
+USB NOP PHY
+
+Required properties:
+- compatible: should be usb-nop-xceiv
+
+Optional properties:
+- clocks: phandle to the PHY clock. Use as per Documentation/devicetree
+  /bindings/clock/clock-bindings.txt
+  This property is required if clock-frequency is specified.
+
+- clock-names: Should be "main_clk"
+
+- clock-frequency: the clock frequency (in Hz) that the PHY clock must
+  be configured to.
+
+- vcc-supply: phandle to the regulator that provides RESET to the PHY.
+
+- reset-supply: phandle to the regulator that provides power to the PHY.
+
+Example:
+
+	hsusb1_phy {
+		compatible = "usb-nop-xceiv";
+		clock-frequency = <19200000>;
+		clocks = <&osc 0>;
+		clock-names = "main_clk";
+		vcc-supply = <&hsusb1_vcc_regulator>;
+		reset-supply = <&hsusb1_reset_regulator>;
+	};
+
+hsusb1_phy is a NOP USB PHY device that gets its clock from an oscillator
+and expects that clock to be configured to 19.2MHz by the NOP PHY driver.
+hsusb1_vcc_regulator provides power to the PHY and hsusb1_reset_regulator
+controls RESET.
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index ac027a1..6b7a9a0 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -34,13 +34,15 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
+#include <linux/of.h>
 
 struct nop_usb_xceiv {
-	struct usb_phy		phy;
-	struct device		*dev;
-	struct clk		*clk;
-	struct regulator	*vcc;
-	struct regulator	*reset;
+	struct usb_phy phy;
+	struct device *dev;
+	struct clk *clk;
+	struct regulator *vcc;
+	struct regulator *reset;
+	u32 clk_rate;
 };
 
 static struct platform_device *pd;
@@ -140,6 +142,7 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host)
 
 static int nop_usb_xceiv_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct nop_usb_xceiv_platform_data *pdata = pdev->dev.platform_data;
 	struct nop_usb_xceiv	*nop;
 	enum usb_phy_type	type = USB_PHY_TYPE_USB2;
@@ -153,8 +156,17 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
 	if (!nop->phy.otg)
 		return -ENOMEM;
 
-	if (pdata)
+	if (dev->of_node) {
+		struct device_node *node = dev->of_node;
+		u32 clk_rate;
+
+		if (!of_property_read_u32(node, "clock-frequency", &clk_rate))
+			nop->clk_rate = clk_rate;
+
+	} else if (pdata) {
 		type = pdata->type;
+		nop->clk_rate = pdata->clk_rate;
+	}
 
 	nop->clk = devm_clk_get(&pdev->dev, "main_clk");
 	if (IS_ERR(nop->clk)) {
@@ -162,8 +174,8 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
 					PTR_ERR(nop->clk));
 	}
 
-	if (!IS_ERR(nop->clk) && pdata && pdata->clk_rate) {
-		err = clk_set_rate(nop->clk, pdata->clk_rate);
+	if (!IS_ERR(nop->clk) && nop->clk_rate) {
+		err = clk_set_rate(nop->clk, nop->clk_rate);
 		if (err) {
 			dev_err(&pdev->dev, "Error setting clock rate\n");
 			return err;
@@ -236,12 +248,20 @@ static int nop_usb_xceiv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id nop_xceiv_dt_ids[] = {
+	{ .compatible = "usb-nop-xceiv" },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids);
+
 static struct platform_driver nop_usb_xceiv_driver = {
 	.probe		= nop_usb_xceiv_probe,
 	.remove		= nop_usb_xceiv_remove,
 	.driver		= {
 		.name	= "nop_usb_xceiv",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(nop_xceiv_dt_ids),
 	},
 };
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 02/14] USB: phy: nop: Defer probe if device needs VCC/RESET
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 03/14] mfd: omap-usb-tll: move configuration code to omap_tll_init() Roger Quadros
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Add 2 flags, needs_vcc and needs_reset to platform data.
If the flag is set and the regulator couldn't be found
then we bail out with -EPROBE_DEFER.

For device tree boot we depend on presensce of vcc-supply/
reset-supply properties to decide if we should bail out
with -EPROBE_DEFER or just continue in case the regulator
can't be found.

This is required for proper functionality in cases where the
regulator is needed but is probed later than the PHY device.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/otg/nop-usb-xceiv.c   |   11 +++++++++++
 include/linux/usb/nop-usb-xceiv.h |    4 ++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 6b7a9a0..7b0e8a8 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -43,6 +43,8 @@ struct nop_usb_xceiv {
 	struct regulator *vcc;
 	struct regulator *reset;
 	u32 clk_rate;
+	unsigned int needs_vcc:1;
+	unsigned int needs_reset:1;
 };
 
 static struct platform_device *pd;
@@ -163,9 +165,14 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
 		if (!of_property_read_u32(node, "clock-frequency", &clk_rate))
 			nop->clk_rate = clk_rate;
 
+		nop->needs_vcc = of_property_read_bool(node, "vcc-supply");
+		nop->needs_reset = of_property_read_bool(node, "reset-supply");
+
 	} else if (pdata) {
 		type = pdata->type;
 		nop->clk_rate = pdata->clk_rate;
+		nop->needs_vcc = pdata->needs_vcc;
+		nop->needs_reset = pdata->needs_reset;
 	}
 
 	nop->clk = devm_clk_get(&pdev->dev, "main_clk");
@@ -194,12 +201,16 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev)
 	if (IS_ERR(nop->vcc)) {
 		dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n",
 					PTR_ERR(nop->vcc));
+		if (nop->needs_vcc)
+			return -EPROBE_DEFER;
 	}
 
 	nop->reset = devm_regulator_get(&pdev->dev, "reset");
 	if (IS_ERR(nop->reset)) {
 		dev_dbg(&pdev->dev, "Error getting reset regulator: %ld\n",
 					PTR_ERR(nop->reset));
+		if (nop->needs_reset)
+			return -EPROBE_DEFER;
 	}
 
 	nop->dev		= &pdev->dev;
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
index 3265b61..148d351 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -6,6 +6,10 @@
 struct nop_usb_xceiv_platform_data {
 	enum usb_phy_type type;
 	unsigned long clk_rate;
+
+	/* if set fails with -EPROBE_DEFER if can't get regulator */
+	unsigned int needs_vcc:1;
+	unsigned int needs_reset:1;
 };
 
 #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 03/14] mfd: omap-usb-tll: move configuration code to omap_tll_init()
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 02/14] USB: phy: nop: Defer probe if device needs VCC/RESET Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 04/14] mfd: omap-usb-tll: Add device tree support Roger Quadros
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel, Samuel Ortiz

This is because we want to get rid of platform_data usage from probe().
The only information we need is PORT_MODE, and this can be supplied
to us by the user (i.e. omap-usb-host.c).

We also move channel clock management from runtime PM handlers into
omap_tll_enable/disable().

CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-host.c |    7 +-
 drivers/mfd/omap-usb-tll.c  |  204 +++++++++++++++++++++----------------------
 drivers/mfd/omap-usb.h      |    5 +-
 3 files changed, 107 insertions(+), 109 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 502a779..f8ed08e 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -278,7 +278,7 @@ static int usbhs_runtime_resume(struct device *dev)
 
 	dev_dbg(dev, "usbhs_runtime_resume\n");
 
-	omap_tll_enable();
+	omap_tll_enable(pdata);
 
 	if (!IS_ERR(omap->ehci_logic_fck))
 		clk_enable(omap->ehci_logic_fck);
@@ -353,7 +353,7 @@ static int usbhs_runtime_suspend(struct device *dev)
 	if (!IS_ERR(omap->ehci_logic_fck))
 		clk_disable(omap->ehci_logic_fck);
 
-	omap_tll_disable();
+	omap_tll_disable(pdata);
 
 	return 0;
 }
@@ -499,6 +499,9 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 
 	omap->pdata = pdata;
 
+	/* Initialize the TLL subsystem */
+	omap_tll_init(pdata);
+
 	pm_runtime_enable(dev);
 
 	platform_set_drvdata(pdev, omap);
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0aef1a7..f7d2568 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -1,8 +1,9 @@
 /**
  * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
  *
- * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2012-2013 Texas Instruments Incorporated - http://www.ti.com
  * Author: Keshava Munegowda <keshava_mgowda@ti.com>
+ * Author: Roger Quadros <rogerq@ti.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2  of
@@ -105,8 +106,8 @@
 
 struct usbtll_omap {
 	int					nch;	/* num. of channels */
-	struct usbhs_omap_platform_data		*pdata;
 	struct clk				**ch_clk;
+	void __iomem				*base;
 };
 
 /*-------------------------------------------------------------------------*/
@@ -210,14 +211,10 @@ static unsigned ohci_omap3_fslsmode(enum usbhs_omap_port_mode mode)
 static int usbtll_omap_probe(struct platform_device *pdev)
 {
 	struct device				*dev =  &pdev->dev;
-	struct usbhs_omap_platform_data		*pdata = dev->platform_data;
-	void __iomem				*base;
 	struct resource				*res;
 	struct usbtll_omap			*tll;
-	unsigned				reg;
 	int					ret = 0;
 	int					i, ver;
-	bool needs_tll;
 
 	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
 
@@ -227,16 +224,9 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	if (!pdata) {
-		dev_err(dev, "Platform data missing\n");
-		return -ENODEV;
-	}
-
-	tll->pdata = pdata;
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_request_and_ioremap(dev, res);
-	if (!base) {
+	tll->base = devm_request_and_ioremap(dev, res);
+	if (!tll->base) {
 		ret = -EADDRNOTAVAIL;
 		dev_err(dev, "Resource request/ioremap failed:%d\n", ret);
 		return ret;
@@ -246,7 +236,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);
 
-	ver =  usbtll_read(base, OMAP_USBTLL_REVISION);
+	ver =  usbtll_read(tll->base, OMAP_USBTLL_REVISION);
 	switch (ver) {
 	case OMAP_USBTLL_REV1:
 	case OMAP_USBTLL_REV4:
@@ -283,11 +273,77 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 			dev_dbg(dev, "can't get clock : %s\n", clkname);
 	}
 
+	pm_runtime_put_sync(dev);
+	/* only after this can omap_tll_enable/disable work */
+	spin_lock(&tll_lock);
+	tll_dev = dev;
+	spin_unlock(&tll_lock);
+
+	return 0;
+
+err_clk_alloc:
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
+	return ret;
+}
+
+/**
+ * usbtll_omap_remove - shutdown processing for UHH & TLL HCDs
+ * @pdev: USB Host Controller being removed
+ *
+ * Reverses the effect of usbtll_omap_probe().
+ */
+static int usbtll_omap_remove(struct platform_device *pdev)
+{
+	struct usbtll_omap *tll = platform_get_drvdata(pdev);
+	int i;
+
+	spin_lock(&tll_lock);
+	tll_dev = NULL;
+	spin_unlock(&tll_lock);
+
+	for (i = 0; i < tll->nch; i++)
+		if (!IS_ERR(tll->ch_clk[i]))
+			clk_put(tll->ch_clk[i]);
+
+	pm_runtime_disable(&pdev->dev);
+	return 0;
+}
+
+static struct platform_driver usbtll_omap_driver = {
+	.driver = {
+		.name		= (char *)usbtll_driver_name,
+		.owner		= THIS_MODULE,
+	},
+	.probe		= usbtll_omap_probe,
+	.remove		= usbtll_omap_remove,
+};
+
+int omap_tll_init(struct usbhs_omap_platform_data *pdata)
+{
+	int i;
+	bool needs_tll;
+	unsigned reg;
+	struct usbtll_omap *tll;
+
+	spin_lock(&tll_lock);
+
+	if (!tll_dev) {
+		spin_unlock(&tll_lock);
+		return -ENODEV;
+	}
+
+	tll = dev_get_drvdata(tll_dev);
+
 	needs_tll = false;
 	for (i = 0; i < tll->nch; i++)
 		needs_tll |= omap_usb_mode_needs_tll(pdata->port_mode[i]);
 
+	pm_runtime_get_sync(tll_dev);
+
 	if (needs_tll) {
+		void __iomem *base = tll->base;
 
 		/* Program Common TLL register */
 		reg = usbtll_read(base, OMAP_TLL_SHARED_CONF);
@@ -336,51 +392,29 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 		}
 	}
 
-	pm_runtime_put_sync(dev);
-	/* only after this can omap_tll_enable/disable work */
-	spin_lock(&tll_lock);
-	tll_dev = dev;
+	pm_runtime_put_sync(tll_dev);
+
 	spin_unlock(&tll_lock);
 
 	return 0;
-
-err_clk_alloc:
-	pm_runtime_put_sync(dev);
-	pm_runtime_disable(dev);
-
-	return ret;
 }
+EXPORT_SYMBOL_GPL(omap_tll_init);
 
-/**
- * usbtll_omap_remove - shutdown processing for UHH & TLL HCDs
- * @pdev: USB Host Controller being removed
- *
- * Reverses the effect of usbtll_omap_probe().
- */
-static int usbtll_omap_remove(struct platform_device *pdev)
+int omap_tll_enable(struct usbhs_omap_platform_data *pdata)
 {
-	struct usbtll_omap *tll = platform_get_drvdata(pdev);
 	int i;
+	struct usbtll_omap *tll;
 
 	spin_lock(&tll_lock);
-	tll_dev = NULL;
-	spin_unlock(&tll_lock);
-
-	for (i = 0; i < tll->nch; i++)
-		if (!IS_ERR(tll->ch_clk[i]))
-			clk_put(tll->ch_clk[i]);
 
-	pm_runtime_disable(&pdev->dev);
-	return 0;
-}
+	if (!tll_dev) {
+		spin_unlock(&tll_lock);
+		return -ENODEV;
+	}
 
-static int usbtll_runtime_resume(struct device *dev)
-{
-	struct usbtll_omap			*tll = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data		*pdata = tll->pdata;
-	int i;
+	tll = dev_get_drvdata(tll_dev);
 
-	dev_dbg(dev, "usbtll_runtime_resume\n");
+	pm_runtime_get_sync(tll_dev);
 
 	for (i = 0; i < tll->nch; i++) {
 		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
@@ -391,22 +425,31 @@ static int usbtll_runtime_resume(struct device *dev)
 
 			r = clk_enable(tll->ch_clk[i]);
 			if (r) {
-				dev_err(dev,
+				dev_err(tll_dev,
 				 "Error enabling ch %d clock: %d\n", i, r);
 			}
 		}
 	}
 
+	spin_unlock(&tll_lock);
+
 	return 0;
 }
+EXPORT_SYMBOL_GPL(omap_tll_enable);
 
-static int usbtll_runtime_suspend(struct device *dev)
+int omap_tll_disable(struct usbhs_omap_platform_data *pdata)
 {
-	struct usbtll_omap			*tll = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data		*pdata = tll->pdata;
 	int i;
+	struct usbtll_omap *tll;
+
+	spin_lock(&tll_lock);
+
+	if (!tll_dev) {
+		spin_unlock(&tll_lock);
+		return -ENODEV;
+	}
 
-	dev_dbg(dev, "usbtll_runtime_suspend\n");
+	tll = dev_get_drvdata(tll_dev);
 
 	for (i = 0; i < tll->nch; i++) {
 		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
@@ -415,60 +458,11 @@ static int usbtll_runtime_suspend(struct device *dev)
 		}
 	}
 
-	return 0;
-}
-
-static const struct dev_pm_ops usbtllomap_dev_pm_ops = {
-	SET_RUNTIME_PM_OPS(usbtll_runtime_suspend,
-			   usbtll_runtime_resume,
-			   NULL)
-};
-
-static struct platform_driver usbtll_omap_driver = {
-	.driver = {
-		.name		= (char *)usbtll_driver_name,
-		.owner		= THIS_MODULE,
-		.pm		= &usbtllomap_dev_pm_ops,
-	},
-	.probe		= usbtll_omap_probe,
-	.remove		= usbtll_omap_remove,
-};
-
-int omap_tll_enable(void)
-{
-	int ret;
-
-	spin_lock(&tll_lock);
-
-	if (!tll_dev) {
-		pr_err("%s: OMAP USB TLL not initialized\n", __func__);
-		ret = -ENODEV;
-	} else {
-		ret = pm_runtime_get_sync(tll_dev);
-	}
+	pm_runtime_put_sync(tll_dev);
 
 	spin_unlock(&tll_lock);
 
-	return ret;
-}
-EXPORT_SYMBOL_GPL(omap_tll_enable);
-
-int omap_tll_disable(void)
-{
-	int ret;
-
-	spin_lock(&tll_lock);
-
-	if (!tll_dev) {
-		pr_err("%s: OMAP USB TLL not initialized\n", __func__);
-		ret = -ENODEV;
-	} else {
-		ret = pm_runtime_put_sync(tll_dev);
-	}
-
-	spin_unlock(&tll_lock);
-
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(omap_tll_disable);
 
diff --git a/drivers/mfd/omap-usb.h b/drivers/mfd/omap-usb.h
index 972aa96..2a508b6 100644
--- a/drivers/mfd/omap-usb.h
+++ b/drivers/mfd/omap-usb.h
@@ -1,2 +1,3 @@
-extern int omap_tll_enable(void);
-extern int omap_tll_disable(void);
+extern int omap_tll_init(struct usbhs_omap_platform_data *pdata);
+extern int omap_tll_enable(struct usbhs_omap_platform_data *pdata);
+extern int omap_tll_disable(struct usbhs_omap_platform_data *pdata);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 04/14] mfd: omap-usb-tll: Add device tree support
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (2 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 03/14] mfd: omap-usb-tll: move configuration code to omap_tll_init() Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 05/14] USB: ehci-omap: Get platform resources by index rather than by name Roger Quadros
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel, Samuel Ortiz

Enable this driver to probe in device tree boot.

CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 .../devicetree/bindings/mfd/omap-usb-tll.txt       |   17 +++++++++++++++++
 drivers/mfd/omap-usb-tll.c                         |    9 +++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
new file mode 100644
index 0000000..62fe697
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
@@ -0,0 +1,17 @@
+OMAP HS USB Host TLL (Transceiver-Less Interface)
+
+Required properties:
+
+- compatible : should be "ti,usbhs-tll"
+- reg : should contain one register range i.e. start and length
+- interrupts : should contain the TLL module's interrupt
+- ti,hwmod : must contain "usb_tll_hs"
+
+Example:
+
+	usbhstll: usbhstll@4a062000 {
+		compatible = "ti,usbhs-tll";
+		reg = <0x4a062000 0x1000>;
+		interrupts = <78>;
+		ti,hwmods = "usb_tll_hs";
+	  };
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index f7d2568..f7afb22 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -28,6 +28,7 @@
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_data/usb-omap.h>
+#include <linux/of.h>
 
 #define USBTLL_DRIVER_NAME	"usbhs_tll"
 
@@ -311,10 +312,18 @@ static int usbtll_omap_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id usbtll_omap_dt_ids[] = {
+	{ .compatible = "ti,usbhs-tll" },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, usbtll_omap_dt_ids);
+
 static struct platform_driver usbtll_omap_driver = {
 	.driver = {
 		.name		= (char *)usbtll_driver_name,
 		.owner		= THIS_MODULE,
+		.of_match_table = of_match_ptr(usbtll_omap_dt_ids),
 	},
 	.probe		= usbtll_omap_probe,
 	.remove		= usbtll_omap_remove,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 05/14] USB: ehci-omap: Get platform resources by index rather than by name
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (3 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 04/14] mfd: omap-usb-tll: Add device tree support Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 06/14] USB: ohci-omap3: " Roger Quadros
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Since 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.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/usb/host/ehci-omap.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 0aa12f6..02a7893 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -148,16 +148,15 @@ 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_request_and_ioremap(dev, res);
-	if (!regs) {
+	if (IS_ERR(regs)) {
 		dev_err(dev, "Resource request/ioremap failed\n");
 		return -EADDRNOTAVAIL;
 	}
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 06/14] USB: ohci-omap3: Get platform resources by index rather than by name
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (4 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 05/14] USB: ehci-omap: Get platform resources by index rather than by name Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information Roger Quadros
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Since 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.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/usb/host/ohci-omap3.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index eb35d96..5ed28c5 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -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;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (5 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 06/14] USB: ohci-omap3: " Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-11 11:46   ` Mark Rutland
  2013-02-07 16:02 ` [PATCH v2 08/14] USB: ehci-omap: " Roger Quadros
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Allows the OHCI controller found in OMAP3 and later chips to
be specified via device tree.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
 drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt

diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
new file mode 100644
index 0000000..ad2ace0
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
@@ -0,0 +1,17 @@
+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
+- interrupt-parent: phandle to the interrupt controller
+- interrupts: description of the interrupt line
+
+Example for OMAP4:
+
+usbhsohci: ohci@4a064800 {
+	compatible = "ti,ohci-omap3", "usb-ohci";
+	reg = <0x4a064800 0x400>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 76 0x4>;
+};
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index 5ed28c5..ddfc314 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -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),
 	},
 };
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 08/14] USB: ehci-omap: Add device tree support and binding information
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (6 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-11 11:52   ` Mark Rutland
  2013-02-07 16:02 ` [PATCH v2 09/14] mfd: omap-usb-host: " Roger Quadros
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Allows the OMAP EHCI controller to be specified via device tree.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
 .../devicetree/bindings/usb/omap-ehci.txt          |   34 ++++++++++++++++++
 drivers/usb/host/ehci-omap.c                       |   36 +++++++++++++++++++-
 2 files changed, 69 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-ehci.txt

diff --git a/Documentation/devicetree/bindings/usb/omap-ehci.txt b/Documentation/devicetree/bindings/usb/omap-ehci.txt
new file mode 100644
index 0000000..b00a654
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-ehci.txt
@@ -0,0 +1,34 @@
+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
+- interrupt-parent: phandle to the interrupt controller
+- 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>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 77 0x4>;
+};
+
+&usbhsehci {
+	phys = <&hsusb1_phy 0 &hsusb3_phy>;
+};
+
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 02a7893..a8ce10d 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -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");
@@ -161,6 +176,14 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 		return -EADDRNOTAVAIL;
 	}
 
+	/*
+	 * 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) {
@@ -185,7 +208,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",
@@ -275,6 +301,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,
@@ -283,6 +316,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),
 	}
 };
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 09/14] mfd: omap-usb-host: Add device tree support and binding information
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (7 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 08/14] USB: ehci-omap: " Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-11 12:00   ` Mark Rutland
  2013-02-07 16:02 ` [PATCH v2 10/14] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel, Samuel Ortiz

Allows the OMAP HS USB host controller to be specified
via device tree.

CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 .../devicetree/bindings/mfd/omap-usb-host.txt      |   80 ++++++++++
 drivers/mfd/omap-usb-host.c                        |  160 +++++++++++++++++++-
 2 files changed, 234 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
new file mode 100644
index 0000000..b381fa6
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
@@ -0,0 +1,80 @@
+OMAP HS USB Host
+
+Required properties:
+
+- compatible: should be "ti,usbhs-host"
+- reg: should contain one register range i.e. start and length
+- ti,hwmods: must contain "usb_host_hs"
+
+Optional properties:
+
+- num-ports: number of USB ports. Usually this is automatically detected
+  from the IP's revision register but can be overridden by specifying
+  this property. A maximum of 3 ports are supported at the moment.
+
+- portN-mode: String specifying the port mode for port N, where N can be
+  from 1 to 3. If the port mode is not specified, that port is treated
+  as unused. When specified, it must be one of the following.
+	"ehci-phy",
+        "ehci-tll",
+        "ehci-hsic",
+        "ohci-phy-6pin-datse0",
+        "ohci-phy-6pin-dpdm",
+        "ohci-phy-3pin-datse0",
+        "ohci-phy-4pin-dpdm",
+        "ohci-tll-6pin-datse0",
+        "ohci-tll-6pin-dpdm",
+        "ohci-tll-3pin-datse0",
+        "ohci-tll-4pin-dpdm",
+        "ohci-tll-2pin-datse0",
+        "ohci-tll-2pin-dpdm",
+
+- single-ulpi-bypass: Must be present if the controller contains a single
+  ULPI bypass control bit. e.g. OMAP3 silicon <= ES2.1
+
+Required properties if child node exists:
+
+- #address-cells: Must be 1
+- #size-cells: Must be 1
+- ranges: must be present
+
+Properties for children:
+
+The OMAP HS USB Host subsystem contains EHCI and OHCI controllers.
+See Documentation/devicetree/bindings/usb/omap-ehci.txt and
+omap3-ohci.txt
+
+Example for OMAP4:
+
+usbhshost: usbhshost@4a064000 {
+	compatible = "ti,usbhs-host";
+	reg = <0x4a064000 0x800>;
+	ti,hwmods = "usb_host_hs";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges;
+
+	usbhsohci: ohci@4a064800 {
+		compatible = "ti,ohci-omap3", "usb-ohci";
+		reg = <0x4a064800 0x400>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 76 0x4>;
+	};
+
+	usbhsehci: ehci@4a064c00 {
+		compatible = "ti,ehci-omap", "usb-ehci";
+		reg = <0x4a064c00 0x400>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 77 0x4>;
+	};
+};
+
+&usbhshost {
+	port1-mode = "ehci-phy";
+	port2-mode = "ehci-tll";
+	port3-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <&hsusb1_phy 0 &hsusb3_phy>;
+};
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index f8ed08e..ffc373bc 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -1,8 +1,9 @@
 /**
  * omap-usb-host.c - The USBHS core driver for OMAP EHCI & OHCI
  *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2011-2013 Texas Instruments Incorporated - http://www.ti.com
  * Author: Keshava Munegowda <keshava_mgowda@ti.com>
+ * Author: Roger Quadros <rogerq@ti.com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2  of
@@ -27,6 +28,8 @@
 #include <linux/platform_device.h>
 #include <linux/platform_data/usb-omap.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 
 #include "omap-usb.h"
 
@@ -137,6 +140,49 @@ static inline u8 usbhs_readb(void __iomem *base, u8 reg)
 
 /*-------------------------------------------------------------------------*/
 
+/**
+ * Map 'enum usbhs_omap_port_mode' found in <linux/platform_data/usb-omap.h>
+ * to the device tree binding portN-mode found in
+ * 'Documentation/devicetree/bindings/mfd/omap-usb-host.txt'
+ */
+static const char *port_modes[] = {
+	[OMAP_USBHS_PORT_MODE_UNUSED]	= "",
+	[OMAP_EHCI_PORT_MODE_PHY]	= "ehci-phy",
+	[OMAP_EHCI_PORT_MODE_TLL]	= "ehci-tll",
+	[OMAP_EHCI_PORT_MODE_HSIC]	= "ehci-hsic",
+	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0]	= "ohci-phy-6pin-datse0",
+	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM]	= "ohci-phy-6pin-dpdm",
+	[OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0]	= "ohci-phy-3pin-datse0",
+	[OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM]	= "ohci-phy-4pin-dpdm",
+	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0]	= "ohci-tll-6pin-datse0",
+	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM]	= "ohci-tll-6pin-dpdm",
+	[OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0]	= "ohci-tll-3pin-datse0",
+	[OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM]	= "ohci-tll-4pin-dpdm",
+	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0]	= "ohci-tll-2pin-datse0",
+	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM]	= "ohci-tll-2pin-dpdm",
+};
+
+/**
+ * omap_usbhs_get_dt_port_mode - Get the 'enum usbhs_omap_port_mode'
+ * from the port mode string.
+ * @mode: The port mode string, usually obtained from device tree.
+ *
+ * The function returns the 'enum usbhs_omap_port_mode' that matches the
+ * provided port mode string as per the port_modes table.
+ * If no match is found it returns -ENODEV
+ */
+static const int omap_usbhs_get_dt_port_mode(const char *mode)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(port_modes); i++) {
+		if (!strcasecmp(mode, port_modes[i]))
+			return i;
+	}
+
+	return -ENODEV;
+}
+
 static struct platform_device *omap_usbhs_alloc_child(const char *name,
 			struct resource	*res, int num_resources, void *pdata,
 			size_t pdata_size, struct device *dev)
@@ -464,6 +510,58 @@ static void omap_usbhs_init(struct device *dev)
 	pm_runtime_put_sync(dev);
 }
 
+static int usbhs_omap_get_dt_pdata(struct device *dev,
+					struct usbhs_omap_platform_data *pdata)
+{
+	int ret, i;
+	struct device_node *node = dev->of_node;
+
+	ret = of_property_read_u32(node, "num-ports", &pdata->nports);
+	if (ret)
+		pdata->nports = 0;
+
+	if (pdata->nports > OMAP3_HS_USB_PORTS) {
+		dev_warn(dev, "Too many num_ports:%d in device tree. Max:%d",
+				pdata->nports, OMAP3_HS_USB_PORTS);
+		return -ENODEV;
+	}
+
+	/* get port modes */
+	for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
+		char prop[11];
+		const char *mode;
+
+		pdata->port_mode[i] = OMAP_USBHS_PORT_MODE_UNUSED;
+
+		snprintf(prop, sizeof(prop), "port%d-mode", i + 1);
+		ret = of_property_read_string(node, prop, &mode);
+		if (ret < 0)
+			continue;
+
+		ret = omap_usbhs_get_dt_port_mode(mode);
+		if (ret < 0) {
+			dev_warn(dev, "Invalid port%d-mode \"%s\" in device tree\n",
+					i, mode);
+			return -ENODEV;
+		}
+
+		dev_dbg(dev, "port%d-mode: %s -> %d\n", i, mode, ret);
+		pdata->port_mode[i] = ret;
+	}
+
+	/* get flags */
+	pdata->single_ulpi_bypass = of_property_read_bool(node,
+						"single-ulpi-bypass");
+
+	return 0;
+}
+
+static struct of_device_id usbhs_child_match_table[] = {
+	{ .compatible = "ti,omap-ehci", },
+	{ .compatible = "ti,omap-ohci", },
+	{ }
+};
+
 /**
  * usbhs_omap_probe - initialize TI-based HCDs
  *
@@ -479,18 +577,37 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 	int				i;
 	bool				need_logic_fck;
 
+	if (dev->of_node) {
+		/* For DT boot we populate platform data from OF node */
+		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+
+		ret = usbhs_omap_get_dt_pdata(dev, pdata);
+		if (ret)
+			return ret;
+
+		dev->platform_data = pdata;
+	}
+
 	if (!pdata) {
 		dev_err(dev, "Missing platform data\n");
 		return -ENODEV;
 	}
 
+	if (pdata->nports > OMAP3_HS_USB_PORTS) {
+		dev_info(dev, "Too many num_ports:%d in platform_data. Max:%d",
+				pdata->nports, OMAP3_HS_USB_PORTS);
+		return -ENODEV;
+	}
+
 	omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
 	if (!omap) {
 		dev_err(dev, "Memory allocation failed\n");
 		return -ENOMEM;
 	}
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	omap->uhh_base = devm_request_and_ioremap(dev, res);
 	if (!omap->uhh_base) {
 		dev_err(dev, "Resource request/ioremap failed\n");
@@ -661,10 +778,23 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 	}
 
 	omap_usbhs_init(dev);
-	ret = omap_usbhs_alloc_children(pdev);
-	if (ret) {
-		dev_err(dev, "omap_usbhs_alloc_children failed\n");
-		goto err_alloc;
+
+	if (dev->of_node) {
+		ret = of_platform_populate(dev->of_node,
+				usbhs_child_match_table, NULL, dev);
+
+		if (ret) {
+			dev_err(dev, "Failed to create DT children: %d\n", ret);
+			goto err_alloc;
+		}
+
+	} else {
+		ret = omap_usbhs_alloc_children(pdev);
+		if (ret) {
+			dev_err(dev, "omap_usbhs_alloc_children failed: %d\n",
+						ret);
+			goto err_alloc;
+		}
 	}
 
 	return 0;
@@ -703,6 +833,13 @@ err_mem:
 	return ret;
 }
 
+static int usbhs_omap_remove_child(struct device *dev, void *data)
+{
+	dev_info(dev, "unregistering\n");
+	platform_device_unregister(to_platform_device(dev));
+	return 0;
+}
+
 /**
  * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
  * @pdev: USB Host Controller being removed
@@ -734,6 +871,8 @@ static int usbhs_omap_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 
+	/* remove children */
+	device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
 	return 0;
 }
 
@@ -742,11 +881,20 @@ static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
 	.runtime_resume		= usbhs_runtime_resume,
 };
 
+static const struct of_device_id usbhs_omap_dt_ids[] = {
+	{ .compatible = "ti,usbhs-host" },
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, usbhs_omap_dt_ids);
+
+
 static struct platform_driver usbhs_omap_driver = {
 	.driver = {
 		.name		= (char *)usbhs_driver_name,
 		.owner		= THIS_MODULE,
 		.pm		= &usbhsomap_dev_pm_ops,
+		.of_match_table = of_match_ptr(usbhs_omap_dt_ids),
 	},
 	.remove		= usbhs_omap_remove,
 };
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 10/14] ARM: dts: OMAP4: Add HS USB Host IP nodes
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (8 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 09/14] mfd: omap-usb-host: " Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 11/14] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79..b7db1a2 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,35 @@
 			ti,hwmods = "timer11";
 			ti,timer-pwm;
 		};
+
+		usbhstll: usbhstll@4a062000 {
+			compatible = "ti,usbhs-tll";
+			reg = <0x4a062000 0x1000>;
+			interrupts = <0 78 0x4>;
+			ti,hwmods = "usb_tll_hs";
+		};
+
+		usbhshost: usbhshost@4a064000 {
+			compatible = "ti,usbhs-host";
+			reg = <0x4a064000 0x800>;
+			ti,hwmods = "usb_host_hs";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			usbhsohci: ohci@4a064800 {
+				compatible = "ti,ohci-omap3", "usb-ohci";
+				reg = <0x4a064800 0x400>;
+				interrupt-parent = <&gic>;
+				interrupts = <0 76 0x4>;
+			};
+
+			usbhsehci: ehci@4a064c00 {
+				compatible = "ti,ehci-omap", "usb-ehci";
+				reg = <0x4a064c00 0x400>;
+				interrupt-parent = <&gic>;
+				interrupts = <0 77 0x4>;
+			};
+		};
 	};
 };
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 11/14] ARM: dts: omap4-panda: Add USB Host support
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (9 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 10/14] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 12/14] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Provide the RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for the USB host
pins.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap4-panda.dts |   55 +++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 4122efe..d6e59c7 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -57,6 +57,35 @@
 			"AFML", "Line In",
 			"AFMR", "Line In";
 	};
+
+	/* HS USB Port 1 RESET */
+	hsusb1_reset: hsusb1_reset_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_reset";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio2 30 0>;	/* gpio_62 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Port 1 Power */
+	hsusb1_power: hsusb1_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb1_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio1 1 0>;	/* gpio_1 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Host PHY on PORT 1 */
+	hsusb1_phy: hsusb1_phy {
+		compatible = "usb-nop-xceiv";
+		reset-supply = <&hsusb1_reset>;
+		vcc-supply = <&hsusb1_power>;
+	};
 };
 
 &omap4_pmx_core {
@@ -67,6 +96,7 @@
 			&mcbsp1_pins
 			&dss_hdmi_pins
 			&tpd12s015_pins
+			&hsusbb1_pins
 	>;
 
 	twl6040_pins: pinmux_twl6040_pins {
@@ -110,6 +140,23 @@
 			0x58 0x10b	/* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */
 		>;
 	};
+
+	hsusbb1_pins: pinmux_hsusbb1_pins {
+		pinctrl-single,pins = <
+			0x82 0x10C	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk INPUT | PULLDOWN */
+			0x84 0x4	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+			0x86 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+			0x88 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+			0x8a 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+			0x8c 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+			0x8e 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+			0x90 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+			0x92 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+			0x94 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+			0x96 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+			0x98 0x104	/* USBB1_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+		>;
+	    };
 };
 
 &i2c1 {
@@ -206,3 +253,11 @@
 &twl_usb_comparator {
 	usb-supply = <&vusb>;
 };
+
+&usbhshost {
+	port1-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <&hsusb1_phy>;
+};
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 12/14] ARM: dts: OMAP3: Add HS USB Host IP nodes
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (10 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 11/14] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 13/14] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module Roger Quadros
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Adds device nodes for HS USB Host module, TLL module,
OHCI and EHCI controllers.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap3.dtsi |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc261..a14f74b 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,36 @@
 			ti,timer-alwon;
 			ti,timer-secure;
 		};
+
+		usbhstll: usbhstll@48062000 {
+			compatible = "ti,usbhs-tll";
+			reg = <0x48062000 0x1000>;
+			interrupts = <78>;
+			ti,hwmods = "usb_tll_hs";
+		};
+
+		usbhshost: usbhshost@48064000 {
+			compatible = "ti,usbhs-host";
+			reg = <0x48064000 0x400>;
+			ti,hwmods = "usb_host_hs";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			usbhsohci: ohci@48064400 {
+				compatible = "ti,ohci-omap3", "usb-ohci";
+				reg = <0x48064400 0x400>;
+				interrupt-parent = <&intc>;
+				interrupts = <76>;
+			};
+
+			usbhsehci: ehci@48064800 {
+				compatible = "ti,ehci-omap", "usb-ehci";
+				reg = <0x48064800 0x400>;
+				interrupt-parent = <&intc>;
+				interrupts = <77>;
+			};
+		};
+
 	};
 };
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 13/14] ARM: dts: omap3-beagle: Add USB Host support
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (11 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 12/14] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:02 ` [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module Roger Quadros
  13 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

Provide RESET and Power regulators for the USB PHY,
the USB Host port mode and the PHY device.

Also provide pin multiplexer information for USB host
pins.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/omap3-beagle.dts |   71 ++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index f624dc8..02d23f1 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -38,6 +38,57 @@
 		};
 	};
 
+	/* HS USB Port 2 RESET */
+	hsusb2_reset: hsusb2_reset_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb2_reset";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&gpio5 19 0>;	/* gpio_147 */
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
+
+	/* HS USB Port 2 Power */
+	hsusb2_power: hsusb2_power_reg {
+		compatible = "regulator-fixed";
+		regulator-name = "hsusb2_vbus";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&twl_gpio 18 0>;	/* GPIO LEDA */
+		startup-delay-us = <70000>;
+	};
+
+	/* HS USB Host PHY on PORT 2 */
+	hsusb2_phy: hsusb2_phy {
+		compatible = "usb-nop-xceiv";
+		reset-supply = <&hsusb2_reset>;
+		vcc-supply = <&hsusb2_power>;
+	};
+};
+
+&omap3_pmx_core {
+	pinctrl-names = "default";
+	pinctrl-0 = <
+			&hsusbb2_pins
+	>;
+
+	hsusbb2_pins: pinmux_hsusbb2_pins {
+		pinctrl-single,pins = <
+			0x5c0 0x3  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */
+			0x5c2 0x3  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
+			0x5c4 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
+			0x5c6 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
+			0x5c8 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
+			0x5cA 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
+			0x1a4 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
+			0x1a6 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
+			0x1a8 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
+			0x1aa 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
+			0x1ac 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
+			0x1ae 0x10b  /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
+		>;
+	};
 };
 
 &i2c1 {
@@ -65,3 +116,23 @@
 &mmc3 {
 	status = "disabled";
 };
+
+&usbhshost {
+	port2-mode = "ehci-phy";
+};
+
+&usbhsehci {
+	phys = <0 &hsusb2_phy>;
+};
+
+&twl_gpio {
+	ti,use-leds;
+	/* pullups: BIT(1) */
+	ti,pullups = <0x000002>;
+	/*
+	 * pulldowns:
+	 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
+	 * BIT(15), BIT(16), BIT(17)
+	 */
+	ti,pulldowns = <0x03a1c4>;
+};
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module
  2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
                   ` (12 preceding siblings ...)
  2013-02-07 16:02 ` [PATCH v2 13/14] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
@ 2013-02-07 16:02 ` Roger Quadros
  2013-02-07 16:11   ` Alan Stern
  13 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-07 16:02 UTC (permalink / raw)
  To: tony
  Cc: b-cousson, balbi, gregkh, stern, linux, kishon, mark.rutland,
	rogerq, linux-omap, linux-arm-kernel, linux-kernel

The module alias should be "ehci-omap" and not
"omap-ehci" to match the platform device name.
The omap-ehci module should now autoload correctly.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/ehci-omap.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index a8ce10d..a2d16c0 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -340,9 +340,10 @@ static void __exit ehci_omap_cleanup(void)
 }
 module_exit(ehci_omap_cleanup);
 
-MODULE_ALIAS("platform:omap-ehci");
+MODULE_ALIAS("platform:ehci-omap");
 MODULE_AUTHOR("Texas Instruments, Inc.");
 MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
+MODULE_AUTHOR("Roger Quadros <rogerq@ti.com");
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module
  2013-02-07 16:02 ` [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module Roger Quadros
@ 2013-02-07 16:11   ` Alan Stern
  0 siblings, 0 replies; 25+ messages in thread
From: Alan Stern @ 2013-02-07 16:11 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, linux, kishon, mark.rutland,
	linux-omap, linux-arm-kernel, linux-kernel

On Thu, 7 Feb 2013, Roger Quadros wrote:

> The module alias should be "ehci-omap" and not
> "omap-ehci" to match the platform device name.
> The omap-ehci module should now autoload correctly.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Acked-by: Alan Stern <stern@rowland.harvard.edu>

> ---
>  drivers/usb/host/ehci-omap.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index a8ce10d..a2d16c0 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -340,9 +340,10 @@ static void __exit ehci_omap_cleanup(void)
>  }
>  module_exit(ehci_omap_cleanup);
>  
> -MODULE_ALIAS("platform:omap-ehci");
> +MODULE_ALIAS("platform:ehci-omap");
>  MODULE_AUTHOR("Texas Instruments, Inc.");
>  MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
> +MODULE_AUTHOR("Roger Quadros <rogerq@ti.com");
>  
>  MODULE_DESCRIPTION(DRIVER_DESC);
>  MODULE_LICENSE("GPL");
> 


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information
  2013-02-07 16:02 ` [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information Roger Quadros
@ 2013-02-11 11:40   ` Mark Rutland
  2013-02-11 15:14     ` Roger Quadros
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 11:40 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

Hello,

On Thu, Feb 07, 2013 at 04:02:41PM +0000, Roger Quadros wrote:
> The PHY clock, clock rate, VCC regulator and RESET regulator
> can now be provided via device tree.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> ---
>  .../devicetree/bindings/usb/usb-nop-xceiv.txt      |   34 ++++++++++++++++++
>  drivers/usb/otg/nop-usb-xceiv.c                    |   36 +++++++++++++++----
>  2 files changed, 62 insertions(+), 8 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> new file mode 100644
> index 0000000..d7e2726
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> @@ -0,0 +1,34 @@
> +USB NOP PHY
> +
> +Required properties:
> +- compatible: should be usb-nop-xceiv

This might be better as "linux,usb-no-xceiv", given this is a Linux-specific
'device'.

Saying that, I'm not sure I understand why this device needs to be instantiated
from devicetree. As I understand it from looking at the driver, it's purely a
Linux implementation detail used in the case of autonomous PHYs, and not an
actual piece of hardware or firmware system. I must admit to being unfamiliar
with this area of hardware, have I misunderstood somethign here?

Can we not have drivers for autonomous PHYs initialise/register nop-usb-xceiv?
That way we don't leak Linux implementation details to the outside world, and
the dt can describe purely what's actually present in the system.

[...]

Thanks,
Mark.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information
  2013-02-07 16:02 ` [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information Roger Quadros
@ 2013-02-11 11:46   ` Mark Rutland
  2013-02-11 15:22     ` Roger Quadros
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 11:46 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

On Thu, Feb 07, 2013 at 04:02:47PM +0000, Roger Quadros wrote:
> Allows the OHCI controller found in OMAP3 and later chips to
> be specified via device tree.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
>  .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
>  drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
>  2 files changed, 36 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
> new file mode 100644
> index 0000000..ad2ace0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
> @@ -0,0 +1,17 @@
> +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
> +- interrupt-parent: phandle to the interrupt controller

I'm not sure that needs to be documented as a required property. It's a
standard property, and if it's defined for the parent node, you won't need it
here.

Otherwise, this looks fine to me.

Thanks,
Mark.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 08/14] USB: ehci-omap: Add device tree support and binding information
  2013-02-07 16:02 ` [PATCH v2 08/14] USB: ehci-omap: " Roger Quadros
@ 2013-02-11 11:52   ` Mark Rutland
  0 siblings, 0 replies; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 11:52 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

On Thu, Feb 07, 2013 at 04:02:48PM +0000, Roger Quadros wrote:
> Allows the OMAP EHCI controller to be specified via device tree.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
>  .../devicetree/bindings/usb/omap-ehci.txt          |   34 ++++++++++++++++++
>  drivers/usb/host/ehci-omap.c                       |   36 +++++++++++++++++++-
>  2 files changed, 69 insertions(+), 1 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/usb/omap-ehci.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap-ehci.txt b/Documentation/devicetree/bindings/usb/omap-ehci.txt
> new file mode 100644
> index 0000000..b00a654
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/omap-ehci.txt
> @@ -0,0 +1,34 @@
> +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
> +- interrupt-parent: phandle to the interrupt controller

Same comment as for ohci-omap3 here; I don't think it's necessary to document
this as a required property.

Otherwise, looks good.

Thanks,
Mark.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 09/14] mfd: omap-usb-host: Add device tree support and binding information
  2013-02-07 16:02 ` [PATCH v2 09/14] mfd: omap-usb-host: " Roger Quadros
@ 2013-02-11 12:00   ` Mark Rutland
  2013-02-11 15:24     ` Roger Quadros
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 12:00 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel, Samuel Ortiz

On Thu, Feb 07, 2013 at 04:02:49PM +0000, Roger Quadros wrote:
> Allows the OMAP HS USB host controller to be specified
> via device tree.
> 
> CC: Samuel Ortiz <sameo@linux.intel.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  .../devicetree/bindings/mfd/omap-usb-host.txt      |   80 ++++++++++
>  drivers/mfd/omap-usb-host.c                        |  160 +++++++++++++++++++-
>  2 files changed, 234 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
> new file mode 100644
> index 0000000..b381fa6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
> @@ -0,0 +1,80 @@
> +OMAP HS USB Host
> +
> +Required properties:
> +
> +- compatible: should be "ti,usbhs-host"
> +- reg: should contain one register range i.e. start and length
> +- ti,hwmods: must contain "usb_host_hs"
> +
> +Optional properties:
> +
> +- num-ports: number of USB ports. Usually this is automatically detected
> +  from the IP's revision register but can be overridden by specifying
> +  this property. A maximum of 3 ports are supported at the moment.
> +
> +- portN-mode: String specifying the port mode for port N, where N can be
> +  from 1 to 3. If the port mode is not specified, that port is treated
> +  as unused. When specified, it must be one of the following.
> +	"ehci-phy",
> +        "ehci-tll",
> +        "ehci-hsic",
> +        "ohci-phy-6pin-datse0",
> +        "ohci-phy-6pin-dpdm",
> +        "ohci-phy-3pin-datse0",
> +        "ohci-phy-4pin-dpdm",
> +        "ohci-tll-6pin-datse0",
> +        "ohci-tll-6pin-dpdm",
> +        "ohci-tll-3pin-datse0",
> +        "ohci-tll-4pin-dpdm",
> +        "ohci-tll-2pin-datse0",
> +        "ohci-tll-2pin-dpdm",
> +

[...]

> +/**
> + * Map 'enum usbhs_omap_port_mode' found in <linux/platform_data/usb-omap.h>
> + * to the device tree binding portN-mode found in
> + * 'Documentation/devicetree/bindings/mfd/omap-usb-host.txt'
> + */
> +static const char *port_modes[] = {
> +	[OMAP_USBHS_PORT_MODE_UNUSED]	= "",
> +	[OMAP_EHCI_PORT_MODE_PHY]	= "ehci-phy",
> +	[OMAP_EHCI_PORT_MODE_TLL]	= "ehci-tll",
> +	[OMAP_EHCI_PORT_MODE_HSIC]	= "ehci-hsic",
> +	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0]	= "ohci-phy-6pin-datse0",
> +	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM]	= "ohci-phy-6pin-dpdm",
> +	[OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0]	= "ohci-phy-3pin-datse0",
> +	[OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM]	= "ohci-phy-4pin-dpdm",
> +	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0]	= "ohci-tll-6pin-datse0",
> +	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM]	= "ohci-tll-6pin-dpdm",
> +	[OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0]	= "ohci-tll-3pin-datse0",
> +	[OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM]	= "ohci-tll-4pin-dpdm",
> +	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0]	= "ohci-tll-2pin-datse0",
> +	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM]	= "ohci-tll-2pin-dpdm",
> +};
> +
> +/**
> + * omap_usbhs_get_dt_port_mode - Get the 'enum usbhs_omap_port_mode'
> + * from the port mode string.
> + * @mode: The port mode string, usually obtained from device tree.
> + *
> + * The function returns the 'enum usbhs_omap_port_mode' that matches the
> + * provided port mode string as per the port_modes table.
> + * If no match is found it returns -ENODEV
> + */
> +static const int omap_usbhs_get_dt_port_mode(const char *mode)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(port_modes); i++) {
> +		if (!strcasecmp(mode, port_modes[i]))
> +			return i;
> +	}

Any reason for using strcasecmp rather than strcmp? The binding only specified
lower case versions, and this allows people to write "oHcI-PhY-6PiN-DaTsE0"
with impunity.

Otherwise, this looks fine to me.

Thanks,
Mark.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information
  2013-02-11 11:40   ` Mark Rutland
@ 2013-02-11 15:14     ` Roger Quadros
  2013-02-11 15:31       ` Mark Rutland
  0 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-11 15:14 UTC (permalink / raw)
  To: Mark Rutland
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

On 02/11/2013 01:40 PM, Mark Rutland wrote:
> Hello,
> 
> On Thu, Feb 07, 2013 at 04:02:41PM +0000, Roger Quadros wrote:
>> The PHY clock, clock rate, VCC regulator and RESET regulator
>> can now be provided via device tree.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Acked-by: Felipe Balbi <balbi@ti.com>
>> ---
>>  .../devicetree/bindings/usb/usb-nop-xceiv.txt      |   34 ++++++++++++++++++
>>  drivers/usb/otg/nop-usb-xceiv.c                    |   36 +++++++++++++++----
>>  2 files changed, 62 insertions(+), 8 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
>> new file mode 100644
>> index 0000000..d7e2726
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
>> @@ -0,0 +1,34 @@
>> +USB NOP PHY
>> +
>> +Required properties:
>> +- compatible: should be usb-nop-xceiv
> 
> This might be better as "linux,usb-no-xceiv", given this is a Linux-specific
> 'device'.
> 
> Saying that, I'm not sure I understand why this device needs to be instantiated
> from devicetree. As I understand it from looking at the driver, it's purely a
> Linux implementation detail used in the case of autonomous PHYs, and not an
> actual piece of hardware or firmware system. I must admit to being unfamiliar
> with this area of hardware, have I misunderstood somethign here?

The PHY is a physical device and may need resources like power and clock to be functional.
The only reason that driver is named NOP is that many USB controllers know how to talk to
the standard PHYs and don't need any interface/management software.

The PHY driver you are looking at most likely doesn't have the recent changes I wrote to
manage the PHY clock/reset/power. i.e. patches 3, 4 and 5 in the series
 https://lkml.org/lkml/2013/1/28/275

Before this, the ehci-omap driver was trying to manage the PHY power and reset, which was
wrong.

regards,
-roger

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information
  2013-02-11 11:46   ` Mark Rutland
@ 2013-02-11 15:22     ` Roger Quadros
  2013-02-11 15:32       ` Mark Rutland
  0 siblings, 1 reply; 25+ messages in thread
From: Roger Quadros @ 2013-02-11 15:22 UTC (permalink / raw)
  To: Mark Rutland
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

On 02/11/2013 01:46 PM, Mark Rutland wrote:
> On Thu, Feb 07, 2013 at 04:02:47PM +0000, Roger Quadros wrote:
>> Allows the OHCI controller found in OMAP3 and later chips to
>> be specified via device tree.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>> ---
>>  .../devicetree/bindings/usb/omap3-ohci.txt         |   17 +++++++++++++++++
>>  drivers/usb/host/ohci-omap3.c                      |   19 +++++++++++++++++++
>>  2 files changed, 36 insertions(+), 0 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/usb/omap3-ohci.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap3-ohci.txt b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
>> new file mode 100644
>> index 0000000..ad2ace0
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/omap3-ohci.txt
>> @@ -0,0 +1,17 @@
>> +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
>> +- interrupt-parent: phandle to the interrupt controller
> 
> I'm not sure that needs to be documented as a required property. It's a
> standard property, and if it's defined for the parent node, you won't need it
> here.

The last time I tried without 'interrupt-parent' it complained. Doesn't do it anymore.
Maybe I did something wrong the last time. I'll remove it.

> 
> Otherwise, this looks fine to me.

Thanks. I'll add your reviewed-by tag after addressing the above comment.

cheers,
-roger

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 09/14] mfd: omap-usb-host: Add device tree support and binding information
  2013-02-11 12:00   ` Mark Rutland
@ 2013-02-11 15:24     ` Roger Quadros
  0 siblings, 0 replies; 25+ messages in thread
From: Roger Quadros @ 2013-02-11 15:24 UTC (permalink / raw)
  To: Mark Rutland
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel, Samuel Ortiz

On 02/11/2013 02:00 PM, Mark Rutland wrote:
> On Thu, Feb 07, 2013 at 04:02:49PM +0000, Roger Quadros wrote:
>> Allows the OMAP HS USB host controller to be specified
>> via device tree.
>>
>> CC: Samuel Ortiz <sameo@linux.intel.com>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  .../devicetree/bindings/mfd/omap-usb-host.txt      |   80 ++++++++++
>>  drivers/mfd/omap-usb-host.c                        |  160 +++++++++++++++++++-
>>  2 files changed, 234 insertions(+), 6 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/omap-usb-host.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
>> new file mode 100644
>> index 0000000..b381fa6
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
>> @@ -0,0 +1,80 @@
>> +OMAP HS USB Host
>> +
>> +Required properties:
>> +
>> +- compatible: should be "ti,usbhs-host"
>> +- reg: should contain one register range i.e. start and length
>> +- ti,hwmods: must contain "usb_host_hs"
>> +
>> +Optional properties:
>> +
>> +- num-ports: number of USB ports. Usually this is automatically detected
>> +  from the IP's revision register but can be overridden by specifying
>> +  this property. A maximum of 3 ports are supported at the moment.
>> +
>> +- portN-mode: String specifying the port mode for port N, where N can be
>> +  from 1 to 3. If the port mode is not specified, that port is treated
>> +  as unused. When specified, it must be one of the following.
>> +	"ehci-phy",
>> +        "ehci-tll",
>> +        "ehci-hsic",
>> +        "ohci-phy-6pin-datse0",
>> +        "ohci-phy-6pin-dpdm",
>> +        "ohci-phy-3pin-datse0",
>> +        "ohci-phy-4pin-dpdm",
>> +        "ohci-tll-6pin-datse0",
>> +        "ohci-tll-6pin-dpdm",
>> +        "ohci-tll-3pin-datse0",
>> +        "ohci-tll-4pin-dpdm",
>> +        "ohci-tll-2pin-datse0",
>> +        "ohci-tll-2pin-dpdm",
>> +
> 
> [...]
> 
>> +/**
>> + * Map 'enum usbhs_omap_port_mode' found in <linux/platform_data/usb-omap.h>
>> + * to the device tree binding portN-mode found in
>> + * 'Documentation/devicetree/bindings/mfd/omap-usb-host.txt'
>> + */
>> +static const char *port_modes[] = {
>> +	[OMAP_USBHS_PORT_MODE_UNUSED]	= "",
>> +	[OMAP_EHCI_PORT_MODE_PHY]	= "ehci-phy",
>> +	[OMAP_EHCI_PORT_MODE_TLL]	= "ehci-tll",
>> +	[OMAP_EHCI_PORT_MODE_HSIC]	= "ehci-hsic",
>> +	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0]	= "ohci-phy-6pin-datse0",
>> +	[OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM]	= "ohci-phy-6pin-dpdm",
>> +	[OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0]	= "ohci-phy-3pin-datse0",
>> +	[OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM]	= "ohci-phy-4pin-dpdm",
>> +	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0]	= "ohci-tll-6pin-datse0",
>> +	[OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM]	= "ohci-tll-6pin-dpdm",
>> +	[OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0]	= "ohci-tll-3pin-datse0",
>> +	[OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM]	= "ohci-tll-4pin-dpdm",
>> +	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0]	= "ohci-tll-2pin-datse0",
>> +	[OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM]	= "ohci-tll-2pin-dpdm",
>> +};
>> +
>> +/**
>> + * omap_usbhs_get_dt_port_mode - Get the 'enum usbhs_omap_port_mode'
>> + * from the port mode string.
>> + * @mode: The port mode string, usually obtained from device tree.
>> + *
>> + * The function returns the 'enum usbhs_omap_port_mode' that matches the
>> + * provided port mode string as per the port_modes table.
>> + * If no match is found it returns -ENODEV
>> + */
>> +static const int omap_usbhs_get_dt_port_mode(const char *mode)
>> +{
>> +	int i;
>> +
>> +	for (i = 0; i < ARRAY_SIZE(port_modes); i++) {
>> +		if (!strcasecmp(mode, port_modes[i]))
>> +			return i;
>> +	}
> 
> Any reason for using strcasecmp rather than strcmp? The binding only specified
> lower case versions, and this allows people to write "oHcI-PhY-6PiN-DaTsE0"
> with impunity.

:). No specific reason. I'll change it to strcmp.
> 
> Otherwise, this looks fine to me.

Thanks.

cheers,
-roger


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information
  2013-02-11 15:14     ` Roger Quadros
@ 2013-02-11 15:31       ` Mark Rutland
  0 siblings, 0 replies; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 15:31 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

Hi Roger,

On Mon, Feb 11, 2013 at 03:14:26PM +0000, Roger Quadros wrote:
> On 02/11/2013 01:40 PM, Mark Rutland wrote:
> > Hello,
> > 
> > On Thu, Feb 07, 2013 at 04:02:41PM +0000, Roger Quadros wrote:
> >> The PHY clock, clock rate, VCC regulator and RESET regulator
> >> can now be provided via device tree.
> >>
> >> Signed-off-by: Roger Quadros <rogerq@ti.com>
> >> Acked-by: Felipe Balbi <balbi@ti.com>
> >> ---
> >>  .../devicetree/bindings/usb/usb-nop-xceiv.txt      |   34 ++++++++++++++++++
> >>  drivers/usb/otg/nop-usb-xceiv.c                    |   36 +++++++++++++++----
> >>  2 files changed, 62 insertions(+), 8 deletions(-)
> >>  create mode 100644 Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> >> new file mode 100644
> >> index 0000000..d7e2726
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt
> >> @@ -0,0 +1,34 @@
> >> +USB NOP PHY
> >> +
> >> +Required properties:
> >> +- compatible: should be usb-nop-xceiv
> > 
> > This might be better as "linux,usb-no-xceiv", given this is a Linux-specific
> > 'device'.
> > 
> > Saying that, I'm not sure I understand why this device needs to be instantiated
> > from devicetree. As I understand it from looking at the driver, it's purely a
> > Linux implementation detail used in the case of autonomous PHYs, and not an
> > actual piece of hardware or firmware system. I must admit to being unfamiliar
> > with this area of hardware, have I misunderstood somethign here?
> 
> The PHY is a physical device and may need resources like power and clock to be functional.
> The only reason that driver is named NOP is that many USB controllers know how to talk to
> the standard PHYs and don't need any interface/management software.

Ok. That makes sense. Apologies for the noise.

> 
> The PHY driver you are looking at most likely doesn't have the recent changes I wrote to
> manage the PHY clock/reset/power. i.e. patches 3, 4 and 5 in the series
>  https://lkml.org/lkml/2013/1/28/275
> 
> Before this, the ehci-omap driver was trying to manage the PHY power and reset, which was
> wrong.

Yes. That makes a lot more sense now.

Thanks for the info!

Thanks,
Mark.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information
  2013-02-11 15:22     ` Roger Quadros
@ 2013-02-11 15:32       ` Mark Rutland
  0 siblings, 0 replies; 25+ messages in thread
From: Mark Rutland @ 2013-02-11 15:32 UTC (permalink / raw)
  To: Roger Quadros
  Cc: tony, b-cousson, balbi, gregkh, stern, linux, kishon, linux-omap,
	linux-arm-kernel, linux-kernel

> >> +Required properties:
> >> +
> >> +- compatible: should be "ti,ohci-omap3"
> >> +- reg: should contain one register range i.e. start and length
> >> +- interrupt-parent: phandle to the interrupt controller
> > 
> > I'm not sure that needs to be documented as a required property. It's a
> > standard property, and if it's defined for the parent node, you won't need it
> > here.
> 
> The last time I tried without 'interrupt-parent' it complained. Doesn't do it anymore.
> Maybe I did something wrong the last time. I'll remove it.
> 
> > 
> > Otherwise, this looks fine to me.
> 
> Thanks. I'll add your reviewed-by tag after addressing the above comment.

Sure.

Thanks,
Mark.


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2013-02-11 15:32 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 16:02 [PATCH v2 00/14] Device tree support for OMAP HS USB Host Roger Quadros
2013-02-07 16:02 ` [PATCH v2 01/14] usb: phy: nop: Add device tree support and binding information Roger Quadros
2013-02-11 11:40   ` Mark Rutland
2013-02-11 15:14     ` Roger Quadros
2013-02-11 15:31       ` Mark Rutland
2013-02-07 16:02 ` [PATCH v2 02/14] USB: phy: nop: Defer probe if device needs VCC/RESET Roger Quadros
2013-02-07 16:02 ` [PATCH v2 03/14] mfd: omap-usb-tll: move configuration code to omap_tll_init() Roger Quadros
2013-02-07 16:02 ` [PATCH v2 04/14] mfd: omap-usb-tll: Add device tree support Roger Quadros
2013-02-07 16:02 ` [PATCH v2 05/14] USB: ehci-omap: Get platform resources by index rather than by name Roger Quadros
2013-02-07 16:02 ` [PATCH v2 06/14] USB: ohci-omap3: " Roger Quadros
2013-02-07 16:02 ` [PATCH v2 07/14] USB: ohci-omap3: Add device tree support and binding information Roger Quadros
2013-02-11 11:46   ` Mark Rutland
2013-02-11 15:22     ` Roger Quadros
2013-02-11 15:32       ` Mark Rutland
2013-02-07 16:02 ` [PATCH v2 08/14] USB: ehci-omap: " Roger Quadros
2013-02-11 11:52   ` Mark Rutland
2013-02-07 16:02 ` [PATCH v2 09/14] mfd: omap-usb-host: " Roger Quadros
2013-02-11 12:00   ` Mark Rutland
2013-02-11 15:24     ` Roger Quadros
2013-02-07 16:02 ` [PATCH v2 10/14] ARM: dts: OMAP4: Add HS USB Host IP nodes Roger Quadros
2013-02-07 16:02 ` [PATCH v2 11/14] ARM: dts: omap4-panda: Add USB Host support Roger Quadros
2013-02-07 16:02 ` [PATCH v2 12/14] ARM: dts: OMAP3: Add HS USB Host IP nodes Roger Quadros
2013-02-07 16:02 ` [PATCH v2 13/14] ARM: dts: omap3-beagle: Add USB Host support Roger Quadros
2013-02-07 16:02 ` [PATCH v2 14/14] USB: ehci-omap: Fix autoloading of module Roger Quadros
2013-02-07 16:11   ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).