linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/23] OMAP USB Host cleanup
@ 2012-12-10 10:20 Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros Roger Quadros
                   ` (23 more replies)
  0 siblings, 24 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Hi,

This patchset addresses the following

- Avoid addressing clocks one by one by name and use a for loop + bunch
  of cleanups.
- Get number of channels/ports dynamically either from revision register
  or from platform data. Avoids getting clocks that are not present.
- Add OMAP5 and HSIC mode (Not tested)

v4:
- Added appropriate maintainers in to/cc
- minor print message fix in patch 23 to maintain consistency

v3:
- Rebased on arm-soc/for-next commit f979306c4d38d213c6977aaf3b1115e8ded71e3a
- Rearranged patch that get rids of cpu_is_omap..() macros
- Coding style fixes

v2:
- Clocks are allocated dynamically based on number of ports available
on the platform
- Reduced console spam if non critical clocks are not found on the platform.
- Get rid of cpu_is_.. macros from USB host driver.

cheers,
-roger

---
Roger Quadros (23):
  mfd: omap-usb-host: get rid of cpu_is_omap..() macros
  mfd: omap-usb-tll: Avoid creating copy of platform data
  mfd: omap-usb-tll: Fix channel count detection
  mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
  mfd: omap-usb-tll: Clean up clock handling
  mfd: omap-usb-tll: introduce and use mode_needs_tll()
  mfd: omap-usb-tll: Check for missing platform data in probe
  mfd: omap-usb-tll: Fix error message
  mfd: omap-usb-tll: serialize access to TLL device
  mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
  mfd: omap_usb_host: Avoid creating copy of platform_data
  mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap()
  mfd: omap-usb-host: know about number of ports from revision register
  mfd: omap-usb-host: override number of ports from platform data
  mfd: omap-usb-host: cleanup clock management code
  ARM: OMAP2+: clock data: Merge utmi_px_gfclk into
    usb_host_hs_utmi_px_clk
  mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
  mfd: omap-usb-host: Get rid of unnecessary spinlock
  mfd: omap-usb-host: clean up omap_usbhs_init()
  USB: ehci-omap: Don't free gpios that we didn't request
  ARM: OMAP3: clock data: get rid of unused USB host clock aliases and
    dummies
  ARM: OMAP4: clock data: get rid of unused USB host clock aliases
  mfd: omap-usb-host: Don't spam console on clk_set_parent failure

 arch/arm/mach-omap2/cclock3xxx_data.c  |   13 -
 arch/arm/mach-omap2/cclock44xx_data.c  |   55 +++--
 arch/arm/mach-omap2/usb-host.c         |    5 +
 arch/arm/mach-omap2/usb.h              |    1 +
 drivers/mfd/omap-usb-host.c            |  474 ++++++++++++++++++--------------
 drivers/mfd/omap-usb-tll.c             |  244 +++++++++--------
 drivers/usb/host/ehci-omap.c           |    8 -
 include/linux/platform_data/usb-omap.h |    4 +
 8 files changed, 451 insertions(+), 353 deletions(-)

-- 
1.7.4.1


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

* [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-13 21:49   ` Tony Lindgren
  2012-12-10 10:20 ` [PATCH v4 02/23] mfd: omap-usb-tll: Avoid creating copy of platform data Roger Quadros
                   ` (22 subsequent siblings)
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Instead of using cpu_is_omap..() macros in the device driver we
rely on information provided in the platform data.

The only information we need is whether the USB Host module has
a single ULPI bypass control bit for all ports or individual bypass
control bits for each port. OMAP3 REV2.1 and earlier have the former.

Signed-off-by: Roger Quadros <rogerq@ti.com>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/usb-host.c         |    4 ++++
 drivers/mfd/omap-usb-host.c            |    2 +-
 include/linux/platform_data/usb-omap.h |    3 +++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index d1dbe12..2e44e8a 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -508,6 +508,10 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 	if (cpu_is_omap34xx()) {
 		setup_ehci_io_mux(pdata->port_mode);
 		setup_ohci_io_mux(pdata->port_mode);
+
+		if (omap_rev() <= OMAP3430_REV_ES2_1)
+			usbhs_data.single_ulpi_bypass = true;
+
 	} else if (cpu_is_omap44xx()) {
 		setup_4430ehci_io_mux(pdata->port_mode);
 		setup_4430ohci_io_mux(pdata->port_mode);
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index cebfe0a..fe7906b 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -384,7 +384,7 @@ static void omap_usbhs_init(struct device *dev)
 			reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS;
 
 		/* Bypass the TLL module for PHY mode operation */
-		if (cpu_is_omap3430() && (omap_rev() <= OMAP3430_REV_ES2_1)) {
+		if (pdata->single_ulpi_bypass) {
 			dev_dbg(dev, "OMAP3 ES version <= ES2.1\n");
 			if (is_ehci_phy_mode(pdata->port_mode[0]) ||
 				is_ehci_phy_mode(pdata->port_mode[1]) ||
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
index 8570bcf..ef65b67 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -59,6 +59,9 @@ struct usbhs_omap_platform_data {
 
 	struct ehci_hcd_omap_platform_data	*ehci_data;
 	struct ohci_hcd_omap_platform_data	*ohci_data;
+
+	/* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
+	unsigned				single_ulpi_bypass:1;
 };
 
 /*-------------------------------------------------------------------------*/
-- 
1.7.4.1


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

* [PATCH v4 02/23] mfd: omap-usb-tll: Avoid creating copy of platform data
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 03/23] mfd: omap-usb-tll: Fix channel count detection Roger Quadros
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Just a pointer to the platform data should suffice.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 drivers/mfd/omap-usb-tll.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0db0dfa..18fefdb 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -98,7 +98,7 @@
 struct usbtll_omap {
 	struct clk				*usbtll_p1_fck;
 	struct clk				*usbtll_p2_fck;
-	struct usbtll_omap_platform_data	platdata;
+	struct usbtll_omap_platform_data	*pdata;
 	/* secure the register updates */
 	spinlock_t				lock;
 };
@@ -223,8 +223,7 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 
 	spin_lock_init(&tll->lock);
 
-	for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
-		tll->platdata.port_mode[i] = pdata->port_mode[i];
+	tll->pdata = pdata;
 
 	tll->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
 	if (IS_ERR(tll->usbtll_p1_fck)) {
@@ -362,7 +361,7 @@ static int __devexit usbtll_omap_remove(struct platform_device *pdev)
 static int usbtll_runtime_resume(struct device *dev)
 {
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
-	struct usbtll_omap_platform_data	*pdata = &tll->platdata;
+	struct usbtll_omap_platform_data	*pdata = tll->pdata;
 	unsigned long				flags;
 
 	dev_dbg(dev, "usbtll_runtime_resume\n");
@@ -388,7 +387,7 @@ static int usbtll_runtime_resume(struct device *dev)
 static int usbtll_runtime_suspend(struct device *dev)
 {
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
-	struct usbtll_omap_platform_data	*pdata = &tll->platdata;
+	struct usbtll_omap_platform_data	*pdata = tll->pdata;
 	unsigned long				flags;
 
 	dev_dbg(dev, "usbtll_runtime_suspend\n");
-- 
1.7.4.1


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

* [PATCH v4 03/23] mfd: omap-usb-tll: Fix channel count detection
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 02/23] mfd: omap-usb-tll: Avoid creating copy of platform data Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 04/23] mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path Roger Quadros
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Fix channel count detecion for REV2. Also, don't give up
if we don't recognize the IP Revision. We assume the default
number of channels (i.e. 3) for unrecognized IPs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 18fefdb..e67cafc 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -98,6 +98,7 @@
 struct usbtll_omap {
 	struct clk				*usbtll_p1_fck;
 	struct clk				*usbtll_p2_fck;
+	int					nch;	/* num. of channels */
 	struct usbtll_omap_platform_data	*pdata;
 	/* secure the register updates */
 	spinlock_t				lock;
@@ -210,7 +211,7 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	unsigned				reg;
 	unsigned long				flags;
 	int					ret = 0;
-	int					i, ver, count;
+	int					i, ver;
 
 	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
 
@@ -262,16 +263,18 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	ver =  usbtll_read(base, OMAP_USBTLL_REVISION);
 	switch (ver) {
 	case OMAP_USBTLL_REV1:
-	case OMAP_USBTLL_REV2:
-		count = OMAP_TLL_CHANNEL_COUNT;
+		tll->nch = OMAP_TLL_CHANNEL_COUNT;
 		break;
+	case OMAP_USBTLL_REV2:
 	case OMAP_USBTLL_REV3:
-		count = OMAP_REV2_TLL_CHANNEL_COUNT;
+		tll->nch = OMAP_REV2_TLL_CHANNEL_COUNT;
 		break;
 	default:
-		dev_err(dev, "TLL version failed\n");
-		ret = -ENODEV;
-		goto err_ioremap;
+		tll->nch = OMAP_TLL_CHANNEL_COUNT;
+		dev_dbg(dev,
+		 "USB TLL Rev : 0x%x not recognized, assuming %d channels\n",
+			ver, tll->nch);
+		break;
 	}
 
 	if (is_ehci_tll_mode(pdata->port_mode[0]) ||
@@ -291,7 +294,7 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		usbtll_write(base, OMAP_TLL_SHARED_CONF, reg);
 
 		/* Enable channels now */
-		for (i = 0; i < count; i++) {
+		for (i = 0; i < tll->nch; i++) {
 			reg = usbtll_read(base,	OMAP_TLL_CHANNEL_CONF(i));
 
 			if (is_ohci_port(pdata->port_mode[i])) {
@@ -319,7 +322,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		}
 	}
 
-err_ioremap:
 	spin_unlock_irqrestore(&tll->lock, flags);
 	iounmap(base);
 	pm_runtime_put_sync(dev);
-- 
1.7.4.1


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

* [PATCH v4 04/23] mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (2 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 03/23] mfd: omap-usb-tll: Fix channel count detection Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 05/23] mfd: omap-usb-tll: Clean up clock handling Roger Quadros
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Use devm_ variants of kzalloc() and ioremap(). Simplify the error path.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   37 +++++++++++--------------------------
 1 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index e67cafc..828207f 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -215,11 +215,10 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 
 	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
 
-	tll = kzalloc(sizeof(struct usbtll_omap), GFP_KERNEL);
+	tll = devm_kzalloc(dev, sizeof(struct usbtll_omap), GFP_KERNEL);
 	if (!tll) {
 		dev_err(dev, "Memory allocation failed\n");
-		ret = -ENOMEM;
-		goto end;
+		return -ENOMEM;
 	}
 
 	spin_lock_init(&tll->lock);
@@ -230,28 +229,21 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	if (IS_ERR(tll->usbtll_p1_fck)) {
 		ret = PTR_ERR(tll->usbtll_p1_fck);
 		dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
-		goto err_tll;
+		return ret;
 	}
 
 	tll->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
 	if (IS_ERR(tll->usbtll_p2_fck)) {
 		ret = PTR_ERR(tll->usbtll_p2_fck);
 		dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
-		goto err_usbtll_p1_fck;
+		goto err_p2_fck;
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(dev, "usb tll get resource failed\n");
-		ret = -ENODEV;
-		goto err_usbtll_p2_fck;
-	}
-
-	base = ioremap(res->start, resource_size(res));
+	base = devm_request_and_ioremap(dev, res);
 	if (!base) {
-		dev_err(dev, "TLL ioremap failed\n");
-		ret = -ENOMEM;
-		goto err_usbtll_p2_fck;
+		ret = -EADDRNOTAVAIL;
+		goto err_res;
 	}
 
 	platform_set_drvdata(pdev, tll);
@@ -323,23 +315,17 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	}
 
 	spin_unlock_irqrestore(&tll->lock, flags);
-	iounmap(base);
 	pm_runtime_put_sync(dev);
 	tll_pdev = pdev;
-	if (!ret)
-		goto end;
-	pm_runtime_disable(dev);
 
-err_usbtll_p2_fck:
+	return 0;
+
+err_res:
 	clk_put(tll->usbtll_p2_fck);
 
-err_usbtll_p1_fck:
+err_p2_fck:
 	clk_put(tll->usbtll_p1_fck);
 
-err_tll:
-	kfree(tll);
-
-end:
 	return ret;
 }
 
@@ -356,7 +342,6 @@ static int __devexit usbtll_omap_remove(struct platform_device *pdev)
 	clk_put(tll->usbtll_p2_fck);
 	clk_put(tll->usbtll_p1_fck);
 	pm_runtime_disable(&pdev->dev);
-	kfree(tll);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH v4 05/23] mfd: omap-usb-tll: Clean up clock handling
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (3 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 04/23] mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 06/23] mfd: omap-usb-tll: introduce and use mode_needs_tll() Roger Quadros
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Every channel has a functional clock that is similarly named.
It makes sense to use a for loop to manage these clocks as OMAPs
can come with up to 3 channels.

Dynamically allocate and get channel clocks depending on the
number of clocks avaiable on the platform.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   93 +++++++++++++++++++++++++++-----------------
 1 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 828207f..7d0f6cf 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -96,10 +96,9 @@
 #define is_ehci_tll_mode(x)	(x == OMAP_EHCI_PORT_MODE_TLL)
 
 struct usbtll_omap {
-	struct clk				*usbtll_p1_fck;
-	struct clk				*usbtll_p2_fck;
 	int					nch;	/* num. of channels */
 	struct usbtll_omap_platform_data	*pdata;
+	struct clk				**ch_clk;
 	/* secure the register updates */
 	spinlock_t				lock;
 };
@@ -225,26 +224,10 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 
 	tll->pdata = pdata;
 
-	tll->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
-	if (IS_ERR(tll->usbtll_p1_fck)) {
-		ret = PTR_ERR(tll->usbtll_p1_fck);
-		dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
-		return ret;
-	}
-
-	tll->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
-	if (IS_ERR(tll->usbtll_p2_fck)) {
-		ret = PTR_ERR(tll->usbtll_p2_fck);
-		dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
-		goto err_p2_fck;
-	}
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_request_and_ioremap(dev, res);
-	if (!base) {
-		ret = -EADDRNOTAVAIL;
-		goto err_res;
-	}
+	if (!base)
+		return -EADDRNOTAVAIL;
 
 	platform_set_drvdata(pdev, tll);
 	pm_runtime_enable(dev);
@@ -269,6 +252,32 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		break;
 	}
 
+	spin_unlock_irqrestore(&tll->lock, flags);
+
+	tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk * [tll->nch]),
+						GFP_KERNEL);
+	if (!tll->ch_clk) {
+		ret = -ENOMEM;
+		dev_err(dev, "Couldn't allocate memory for channel clocks\n");
+		goto err_clk_alloc;
+	}
+
+	spin_lock_irqsave(&tll->lock, flags);
+
+	for (i = 0; i < tll->nch; i++) {
+		char clkname[] = "usb_tll_hs_usb_chx_clk";
+		struct clk *fck;
+
+		snprintf(clkname, sizeof(clkname),
+					"usb_tll_hs_usb_ch%d_clk", i);
+		fck = clk_get(dev, clkname);
+
+		if (IS_ERR(fck))
+			dev_dbg(dev, "can't get clock : %s\n", clkname);
+		else
+			tll->ch_clk[i] = fck;
+	}
+
 	if (is_ehci_tll_mode(pdata->port_mode[0]) ||
 	    is_ehci_tll_mode(pdata->port_mode[1]) ||
 	    is_ehci_tll_mode(pdata->port_mode[2]) ||
@@ -320,11 +329,9 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_res:
-	clk_put(tll->usbtll_p2_fck);
-
-err_p2_fck:
-	clk_put(tll->usbtll_p1_fck);
+err_clk_alloc:
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
 
 	return ret;
 }
@@ -338,9 +345,11 @@ err_p2_fck:
 static int __devexit usbtll_omap_remove(struct platform_device *pdev)
 {
 	struct usbtll_omap *tll = platform_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < tll->nch; i++)
+		clk_put(tll->ch_clk[i]);
 
-	clk_put(tll->usbtll_p2_fck);
-	clk_put(tll->usbtll_p1_fck);
 	pm_runtime_disable(&pdev->dev);
 	return 0;
 }
@@ -350,6 +359,7 @@ static int usbtll_runtime_resume(struct device *dev)
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
 	struct usbtll_omap_platform_data	*pdata = tll->pdata;
 	unsigned long				flags;
+	int i;
 
 	dev_dbg(dev, "usbtll_runtime_resume\n");
 
@@ -360,11 +370,20 @@ static int usbtll_runtime_resume(struct device *dev)
 
 	spin_lock_irqsave(&tll->lock, flags);
 
-	if (is_ehci_tll_mode(pdata->port_mode[0]))
-		clk_enable(tll->usbtll_p1_fck);
+	for (i = 0; i < tll->nch; i++) {
+		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+			int r;
 
-	if (is_ehci_tll_mode(pdata->port_mode[1]))
-		clk_enable(tll->usbtll_p2_fck);
+			if (!tll->ch_clk[i])
+				continue;
+
+			r = clk_enable(tll->ch_clk[i]);
+			if (r) {
+				dev_err(dev,
+				 "Error enabling ch %d clock: %d\n", i, r);
+			}
+		}
+	}
 
 	spin_unlock_irqrestore(&tll->lock, flags);
 
@@ -376,6 +395,7 @@ static int usbtll_runtime_suspend(struct device *dev)
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
 	struct usbtll_omap_platform_data	*pdata = tll->pdata;
 	unsigned long				flags;
+	int i;
 
 	dev_dbg(dev, "usbtll_runtime_suspend\n");
 
@@ -386,11 +406,12 @@ static int usbtll_runtime_suspend(struct device *dev)
 
 	spin_lock_irqsave(&tll->lock, flags);
 
-	if (is_ehci_tll_mode(pdata->port_mode[0]))
-		clk_disable(tll->usbtll_p1_fck);
-
-	if (is_ehci_tll_mode(pdata->port_mode[1]))
-		clk_disable(tll->usbtll_p2_fck);
+	for (i = 0; i < tll->nch; i++) {
+		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+			if (tll->ch_clk[i])
+				clk_disable(tll->ch_clk[i]);
+		}
+	}
 
 	spin_unlock_irqrestore(&tll->lock, flags);
 
-- 
1.7.4.1


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

* [PATCH v4 06/23] mfd: omap-usb-tll: introduce and use mode_needs_tll()
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (4 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 05/23] mfd: omap-usb-tll: Clean up clock handling Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 07/23] mfd: omap-usb-tll: Check for missing platform data in probe Roger Quadros
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

This is a handy macro to check if the port requires the
USB TLL module or not. Use it to Enable the TLL module and manage
the clocks.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 7d0f6cf..07370a3 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -95,6 +95,10 @@
 
 #define is_ehci_tll_mode(x)	(x == OMAP_EHCI_PORT_MODE_TLL)
 
+/* only PHY and UNUSED modes don't need TLL */
+#define omap_usb_mode_needs_tll(x)	((x != OMAP_USBHS_PORT_MODE_UNUSED) &&\
+					 (x != OMAP_EHCI_PORT_MODE_PHY))
+
 struct usbtll_omap {
 	int					nch;	/* num. of channels */
 	struct usbtll_omap_platform_data	*pdata;
@@ -211,6 +215,7 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	unsigned long				flags;
 	int					ret = 0;
 	int					i, ver;
+	bool needs_tll;
 
 	dev_dbg(dev, "starting TI HSUSB TLL Controller\n");
 
@@ -278,12 +283,11 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 			tll->ch_clk[i] = fck;
 	}
 
-	if (is_ehci_tll_mode(pdata->port_mode[0]) ||
-	    is_ehci_tll_mode(pdata->port_mode[1]) ||
-	    is_ehci_tll_mode(pdata->port_mode[2]) ||
-	    is_ohci_port(pdata->port_mode[0]) ||
-	    is_ohci_port(pdata->port_mode[1]) ||
-	    is_ohci_port(pdata->port_mode[2])) {
+	needs_tll = false;
+	for (i = 0; i < tll->nch; i++)
+		needs_tll |= omap_usb_mode_needs_tll(pdata->port_mode[i]);
+
+	if (needs_tll) {
 
 		/* Program Common TLL register */
 		reg = usbtll_read(base, OMAP_TLL_SHARED_CONF);
@@ -371,7 +375,7 @@ static int usbtll_runtime_resume(struct device *dev)
 	spin_lock_irqsave(&tll->lock, flags);
 
 	for (i = 0; i < tll->nch; i++) {
-		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
 			int r;
 
 			if (!tll->ch_clk[i])
@@ -407,7 +411,7 @@ static int usbtll_runtime_suspend(struct device *dev)
 	spin_lock_irqsave(&tll->lock, flags);
 
 	for (i = 0; i < tll->nch; i++) {
-		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
 			if (tll->ch_clk[i])
 				clk_disable(tll->ch_clk[i]);
 		}
-- 
1.7.4.1


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

* [PATCH v4 07/23] mfd: omap-usb-tll: Check for missing platform data in probe
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (5 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 06/23] mfd: omap-usb-tll: introduce and use mode_needs_tll() Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 08/23] mfd: omap-usb-tll: Fix error message Roger Quadros
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

No need to check for missing platform data in runtime_suspend/resume
as it makes more sense to do it in the probe function.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 07370a3..8b596e0 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -225,6 +225,11 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	if (!pdata) {
+		dev_err(dev, "Platform data missing\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&tll->lock);
 
 	tll->pdata = pdata;
@@ -367,11 +372,6 @@ static int usbtll_runtime_resume(struct device *dev)
 
 	dev_dbg(dev, "usbtll_runtime_resume\n");
 
-	if (!pdata) {
-		dev_dbg(dev, "missing platform_data\n");
-		return  -ENODEV;
-	}
-
 	spin_lock_irqsave(&tll->lock, flags);
 
 	for (i = 0; i < tll->nch; i++) {
@@ -403,11 +403,6 @@ static int usbtll_runtime_suspend(struct device *dev)
 
 	dev_dbg(dev, "usbtll_runtime_suspend\n");
 
-	if (!pdata) {
-		dev_dbg(dev, "missing platform_data\n");
-		return  -ENODEV;
-	}
-
 	spin_lock_irqsave(&tll->lock, flags);
 
 	for (i = 0; i < tll->nch; i++) {
-- 
1.7.4.1


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

* [PATCH v4 08/23] mfd: omap-usb-tll: Fix error message
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (6 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 07/23] mfd: omap-usb-tll: Check for missing platform data in probe Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 09/23] mfd: omap-usb-tll: serialize access to TLL device Roger Quadros
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

omap_enable/disable_tll() can fail if TLL device is not
initialized. It could be due to multiple reasons and not only
due to missing platform data.

Also make local variables static and use 'struct device *'
instead of 'struct platform_device *' for global reference.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 8b596e0..38d0532 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -109,8 +109,8 @@ struct usbtll_omap {
 
 /*-------------------------------------------------------------------------*/
 
-const char usbtll_driver_name[] = USBTLL_DRIVER_NAME;
-struct platform_device	*tll_pdev;
+static const char usbtll_driver_name[] = USBTLL_DRIVER_NAME;
+static struct device	*tll_dev;
 
 /*-------------------------------------------------------------------------*/
 
@@ -334,7 +334,8 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 
 	spin_unlock_irqrestore(&tll->lock, flags);
 	pm_runtime_put_sync(dev);
-	tll_pdev = pdev;
+	/* only after this can omap_tll_enable/disable work */
+	tll_dev = dev;
 
 	return 0;
 
@@ -356,6 +357,8 @@ static int __devexit usbtll_omap_remove(struct platform_device *pdev)
 	struct usbtll_omap *tll = platform_get_drvdata(pdev);
 	int i;
 
+	tll_dev = NULL;
+
 	for (i = 0; i < tll->nch; i++)
 		clk_put(tll->ch_clk[i]);
 
@@ -435,21 +438,21 @@ static struct platform_driver usbtll_omap_driver = {
 
 int omap_tll_enable(void)
 {
-	if (!tll_pdev) {
-		pr_err("missing omap usbhs tll platform_data\n");
+	if (!tll_dev) {
+		pr_err("%s: OMAP USB TLL not initialized\n", __func__);
 		return  -ENODEV;
 	}
-	return pm_runtime_get_sync(&tll_pdev->dev);
+	return pm_runtime_get_sync(tll_dev);
 }
 EXPORT_SYMBOL_GPL(omap_tll_enable);
 
 int omap_tll_disable(void)
 {
-	if (!tll_pdev) {
-		pr_err("missing omap usbhs tll platform_data\n");
+	if (!tll_dev) {
+		pr_err("%s: OMAP USB TLL not initialized\n", __func__);
 		return  -ENODEV;
 	}
-	return pm_runtime_put_sync(&tll_pdev->dev);
+	return pm_runtime_put_sync(tll_dev);
 }
 EXPORT_SYMBOL_GPL(omap_tll_disable);
 
-- 
1.7.4.1


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

* [PATCH v4 09/23] mfd: omap-usb-tll: serialize access to TLL device
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (7 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 08/23] mfd: omap-usb-tll: Fix error message Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 10/23] mfd: omap-usb-tll: Add OMAP5 revision and HSIC support Roger Quadros
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Get rid of the unnecessary spin_lock_irqsave/restore() as there is
no interrupt handler for this driver. Instead we serialize access
to tll_dev using a global spinlock.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   53 ++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 38d0532..7b4afd0 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -103,14 +103,13 @@ struct usbtll_omap {
 	int					nch;	/* num. of channels */
 	struct usbtll_omap_platform_data	*pdata;
 	struct clk				**ch_clk;
-	/* secure the register updates */
-	spinlock_t				lock;
 };
 
 /*-------------------------------------------------------------------------*/
 
 static const char usbtll_driver_name[] = USBTLL_DRIVER_NAME;
 static struct device	*tll_dev;
+static DEFINE_SPINLOCK(tll_lock);	/* serialize access to tll_dev */
 
 /*-------------------------------------------------------------------------*/
 
@@ -212,7 +211,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	struct resource				*res;
 	struct usbtll_omap			*tll;
 	unsigned				reg;
-	unsigned long				flags;
 	int					ret = 0;
 	int					i, ver;
 	bool needs_tll;
@@ -230,8 +228,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	spin_lock_init(&tll->lock);
-
 	tll->pdata = pdata;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -243,8 +239,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 	pm_runtime_get_sync(dev);
 
-	spin_lock_irqsave(&tll->lock, flags);
-
 	ver =  usbtll_read(base, OMAP_USBTLL_REVISION);
 	switch (ver) {
 	case OMAP_USBTLL_REV1:
@@ -262,8 +256,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		break;
 	}
 
-	spin_unlock_irqrestore(&tll->lock, flags);
-
 	tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk * [tll->nch]),
 						GFP_KERNEL);
 	if (!tll->ch_clk) {
@@ -272,8 +264,6 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		goto err_clk_alloc;
 	}
 
-	spin_lock_irqsave(&tll->lock, flags);
-
 	for (i = 0; i < tll->nch; i++) {
 		char clkname[] = "usb_tll_hs_usb_chx_clk";
 		struct clk *fck;
@@ -332,10 +322,11 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 		}
 	}
 
-	spin_unlock_irqrestore(&tll->lock, flags);
 	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;
 
@@ -357,7 +348,9 @@ static int __devexit 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++)
 		clk_put(tll->ch_clk[i]);
@@ -370,13 +363,10 @@ static int usbtll_runtime_resume(struct device *dev)
 {
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
 	struct usbtll_omap_platform_data	*pdata = tll->pdata;
-	unsigned long				flags;
 	int i;
 
 	dev_dbg(dev, "usbtll_runtime_resume\n");
 
-	spin_lock_irqsave(&tll->lock, flags);
-
 	for (i = 0; i < tll->nch; i++) {
 		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
 			int r;
@@ -392,8 +382,6 @@ static int usbtll_runtime_resume(struct device *dev)
 		}
 	}
 
-	spin_unlock_irqrestore(&tll->lock, flags);
-
 	return 0;
 }
 
@@ -401,13 +389,10 @@ static int usbtll_runtime_suspend(struct device *dev)
 {
 	struct usbtll_omap			*tll = dev_get_drvdata(dev);
 	struct usbtll_omap_platform_data	*pdata = tll->pdata;
-	unsigned long				flags;
 	int i;
 
 	dev_dbg(dev, "usbtll_runtime_suspend\n");
 
-	spin_lock_irqsave(&tll->lock, flags);
-
 	for (i = 0; i < tll->nch; i++) {
 		if (omap_usb_mode_needs_tll(pdata->port_mode[i])) {
 			if (tll->ch_clk[i])
@@ -415,8 +400,6 @@ static int usbtll_runtime_suspend(struct device *dev)
 		}
 	}
 
-	spin_unlock_irqrestore(&tll->lock, flags);
-
 	return 0;
 }
 
@@ -438,21 +421,39 @@ static struct platform_driver usbtll_omap_driver = {
 
 int omap_tll_enable(void)
 {
+	int ret;
+
+	spin_lock(&tll_lock);
+
 	if (!tll_dev) {
 		pr_err("%s: OMAP USB TLL not initialized\n", __func__);
-		return  -ENODEV;
+		ret = -ENODEV;
+	} else {
+		ret = pm_runtime_get_sync(tll_dev);
 	}
-	return pm_runtime_get_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__);
-		return  -ENODEV;
+		ret = -ENODEV;
+	} else {
+		ret = pm_runtime_put_sync(tll_dev);
 	}
-	return pm_runtime_put_sync(tll_dev);
+
+	spin_unlock(&tll_lock);
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(omap_tll_disable);
 
-- 
1.7.4.1


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

* [PATCH v4 10/23] mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (8 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 09/23] mfd: omap-usb-tll: serialize access to TLL device Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 11/23] mfd: omap_usb_host: Avoid creating copy of platform_data Roger Quadros
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

The TLL module on OMAP5 has 3 channels.
HSIC mode requires the TLL channel to be in Transparent UTMI mode.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-tll.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 7b4afd0..ecc6a62 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -54,10 +54,13 @@
 
 #define	OMAP_TLL_CHANNEL_CONF(num)			(0x040 + 0x004 * num)
 #define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT		24
+#define OMAP_TLL_CHANNEL_CONF_DRVVBUS			(1 << 16)
+#define OMAP_TLL_CHANNEL_CONF_CHRGVBUS			(1 << 15)
 #define	OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF		(1 << 11)
 #define	OMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE		(1 << 10)
 #define	OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE		(1 << 9)
 #define	OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE		(1 << 8)
+#define OMAP_TLL_CHANNEL_CONF_MODE_TRANSPARENT_UTMI	(2 << 1)
 #define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS		(1 << 1)
 #define	OMAP_TLL_CHANNEL_CONF_CHANEN			(1 << 0)
 
@@ -92,6 +95,7 @@
 #define OMAP_USBTLL_REV1		0x00000015	/* OMAP3 */
 #define OMAP_USBTLL_REV2		0x00000018	/* OMAP 3630 */
 #define OMAP_USBTLL_REV3		0x00000004	/* OMAP4 */
+#define OMAP_USBTLL_REV4		0x00000006	/* OMAP5 */
 
 #define is_ehci_tll_mode(x)	(x == OMAP_EHCI_PORT_MODE_TLL)
 
@@ -242,6 +246,7 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 	ver =  usbtll_read(base, OMAP_USBTLL_REVISION);
 	switch (ver) {
 	case OMAP_USBTLL_REV1:
+	case OMAP_USBTLL_REV4:
 		tll->nch = OMAP_TLL_CHANNEL_COUNT;
 		break;
 	case OMAP_USBTLL_REV2:
@@ -310,6 +315,15 @@ static int __devinit usbtll_omap_probe(struct platform_device *pdev)
 				reg &= ~(OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE
 					| OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF
 					| OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE);
+			} else if (pdata->port_mode[i] ==
+					OMAP_EHCI_PORT_MODE_HSIC) {
+				/*
+				 * HSIC Mode requires UTMI port configurations
+				 */
+				reg |= OMAP_TLL_CHANNEL_CONF_DRVVBUS
+				 | OMAP_TLL_CHANNEL_CONF_CHRGVBUS
+				 | OMAP_TLL_CHANNEL_CONF_MODE_TRANSPARENT_UTMI
+				 | OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF;
 			} else {
 				continue;
 			}
-- 
1.7.4.1


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

* [PATCH v4 11/23] mfd: omap_usb_host: Avoid creating copy of platform_data
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (9 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 10/23] mfd: omap-usb-tll: Add OMAP5 revision and HSIC support Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 12/23] mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap() Roger Quadros
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

We can just hold the pointer to the platform data instead
of creating a copy of it.

Also get rid of the unnecessary missing platform data checks
in runtime_suspend/resume. We are already checking for missing
platform data in probe.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
 drivers/mfd/omap-usb-host.c |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index fe7906b..8b8f1da 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -103,7 +103,7 @@ struct usbhs_hcd_omap {
 
 	void __iomem			*uhh_base;
 
-	struct usbhs_omap_platform_data	platdata;
+	struct usbhs_omap_platform_data	*pdata;
 
 	u32				usbhs_rev;
 	spinlock_t			lock;
@@ -195,8 +195,8 @@ static int omap_usbhs_alloc_children(struct platform_device *pdev)
 	int					ret;
 
 	omap = platform_get_drvdata(pdev);
-	ehci_data = omap->platdata.ehci_data;
-	ohci_data = omap->platdata.ohci_data;
+	ehci_data = omap->pdata->ehci_data;
+	ohci_data = omap->pdata->ohci_data;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
 	if (!res) {
@@ -279,16 +279,11 @@ static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
 static int usbhs_runtime_resume(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data	*pdata = &omap->platdata;
 	unsigned long			flags;
+	struct usbhs_omap_platform_data *pdata = omap->pdata;
 
 	dev_dbg(dev, "usbhs_runtime_resume\n");
 
-	if (!pdata) {
-		dev_dbg(dev, "missing platform_data\n");
-		return  -ENODEV;
-	}
-
 	omap_tll_enable();
 	spin_lock_irqsave(&omap->lock, flags);
 
@@ -311,16 +306,11 @@ static int usbhs_runtime_resume(struct device *dev)
 static int usbhs_runtime_suspend(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data	*pdata = &omap->platdata;
 	unsigned long			flags;
+	struct usbhs_omap_platform_data *pdata = omap->pdata;
 
 	dev_dbg(dev, "usbhs_runtime_suspend\n");
 
-	if (!pdata) {
-		dev_dbg(dev, "missing platform_data\n");
-		return  -ENODEV;
-	}
-
 	spin_lock_irqsave(&omap->lock, flags);
 
 	if (is_ehci_tll_mode(pdata->port_mode[0]))
@@ -343,7 +333,7 @@ static int usbhs_runtime_suspend(struct device *dev)
 static void omap_usbhs_init(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data	*pdata = &omap->platdata;
+	struct usbhs_omap_platform_data	*pdata = omap->pdata;
 	unsigned long			flags;
 	unsigned			reg;
 
@@ -450,7 +440,7 @@ static void omap_usbhs_init(struct device *dev)
 static void omap_usbhs_deinit(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	struct usbhs_omap_platform_data	*pdata = &omap->platdata;
+	struct usbhs_omap_platform_data	*pdata = omap->pdata;
 
 	if (pdata->ehci_data->phy_reset) {
 		if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
@@ -491,11 +481,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 	spin_lock_init(&omap->lock);
 
-	for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
-		omap->platdata.port_mode[i] = pdata->port_mode[i];
-
-	omap->platdata.ehci_data = pdata->ehci_data;
-	omap->platdata.ohci_data = pdata->ohci_data;
+	omap->pdata = pdata;
 
 	pm_runtime_enable(dev);
 
-- 
1.7.4.1


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

* [PATCH v4 12/23] mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap()
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (10 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 11/23] mfd: omap_usb_host: Avoid creating copy of platform_data Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 13/23] mfd: omap-usb-host: know about number of ports from revision register Roger Quadros
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Use devm_ variants of kzalloc and ioremap. Also clean up error path.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 8b8f1da..13a3e8c 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -468,17 +468,20 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 	if (!pdata) {
 		dev_err(dev, "Missing platform data\n");
-		ret = -ENOMEM;
-		goto end_probe;
+		return -ENODEV;
 	}
 
-	omap = kzalloc(sizeof(*omap), GFP_KERNEL);
+	omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
 	if (!omap) {
 		dev_err(dev, "Memory allocation failed\n");
-		ret = -ENOMEM;
-		goto end_probe;
+		return -ENOMEM;
 	}
 
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
+	omap->uhh_base = devm_request_and_ioremap(dev, res);
+	if (!omap->uhh_base)
+		return -EADDRNOTAVAIL;
+
 	spin_lock_init(&omap->lock);
 
 	omap->pdata = pdata;
@@ -576,20 +579,6 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 				"failed error:%d\n", ret);
 	}
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
-	if (!res) {
-		dev_err(dev, "UHH EHCI get resource failed\n");
-		ret = -ENODEV;
-		goto err_init_60m_fclk;
-	}
-
-	omap->uhh_base = ioremap(res->start, resource_size(res));
-	if (!omap->uhh_base) {
-		dev_err(dev, "UHH ioremap failed\n");
-		ret = -ENOMEM;
-		goto err_init_60m_fclk;
-	}
-
 	platform_set_drvdata(pdev, omap);
 
 	omap_usbhs_init(dev);
@@ -599,13 +588,10 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 		goto err_alloc;
 	}
 
-	goto end_probe;
+	return 0;
 
 err_alloc:
 	omap_usbhs_deinit(&pdev->dev);
-	iounmap(omap->uhh_base);
-
-err_init_60m_fclk:
 	clk_put(omap->init_60m_fclk);
 
 err_usbhost_p2_fck:
@@ -629,9 +615,7 @@ err_utmi_p1_fck:
 err_end:
 	clk_put(omap->ehci_logic_fck);
 	pm_runtime_disable(dev);
-	kfree(omap);
 
-end_probe:
 	return ret;
 }
 
@@ -646,7 +630,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
 	struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
 
 	omap_usbhs_deinit(&pdev->dev);
-	iounmap(omap->uhh_base);
 	clk_put(omap->init_60m_fclk);
 	clk_put(omap->usbhost_p2_fck);
 	clk_put(omap->usbhost_p1_fck);
@@ -656,7 +639,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
 	clk_put(omap->utmi_p1_fck);
 	clk_put(omap->ehci_logic_fck);
 	pm_runtime_disable(&pdev->dev);
-	kfree(omap);
 
 	return 0;
 }
-- 
1.7.4.1


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

* [PATCH v4 13/23] mfd: omap-usb-host: know about number of ports from revision register
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (11 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 12/23] mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap() Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 14/23] mfd: omap-usb-host: override number of ports from platform data Roger Quadros
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

The revision register should tell us how many ports are present.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 13a3e8c..9c23a08 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -92,6 +92,8 @@
 
 
 struct usbhs_hcd_omap {
+	int				nports;
+
 	struct clk			*xclk60mhsp1_ck;
 	struct clk			*xclk60mhsp2_ck;
 	struct clk			*utmi_p1_fck;
@@ -354,8 +356,6 @@ static void omap_usbhs_init(struct device *dev)
 
 	pm_runtime_get_sync(dev);
 	spin_lock_irqsave(&omap->lock, flags);
-	omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
-	dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
 
 	reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
 	/* setup ULPI bypass and burst configurations */
@@ -488,8 +488,32 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 
+	platform_set_drvdata(pdev, omap);
+	pm_runtime_get_sync(dev);
 
-	for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
+	omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
+
+	/* we need to call runtime suspend before we update omap->nports
+	 * to prevent unbalanced clk_disable()
+	 */
+	pm_runtime_put_sync(dev);
+
+	switch (omap->usbhs_rev) {
+	case OMAP_USBHS_REV1:
+		omap->nports = 3;
+		break;
+	case OMAP_USBHS_REV2:
+		omap->nports = 2;
+		break;
+	default:
+		omap->nports = OMAP3_HS_USB_PORTS;
+		dev_dbg(dev,
+		  "USB HOST Rev : 0x%d not recognized, assuming %d ports\n",
+		   omap->usbhs_rev, omap->nports);
+		break;
+	}
+
+	for (i = 0; i < omap->nports; i++)
 		if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
 			is_ehci_hsic_mode(i)) {
 			omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
@@ -579,8 +603,6 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 				"failed error:%d\n", ret);
 	}
 
-	platform_set_drvdata(pdev, omap);
-
 	omap_usbhs_init(dev);
 	ret = omap_usbhs_alloc_children(pdev);
 	if (ret) {
-- 
1.7.4.1


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

* [PATCH v4 14/23] mfd: omap-usb-host: override number of ports from platform data
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (12 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 13/23] mfd: omap-usb-host: know about number of ports from revision register Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 15/23] mfd: omap-usb-host: cleanup clock management code Roger Quadros
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Both OMAP4 and 5 exhibit the same revision ID in the REVISION register
but they have different number of ports i.e. 2 and 3 respectively.
So we can't rely on REVISION register for number of ports on OMAP5
and depend on platform data (or device tree) instead.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/mach-omap2/usb-host.c         |    1 +
 arch/arm/mach-omap2/usb.h              |    1 +
 drivers/mfd/omap-usb-host.c            |   34 +++++++++++++++++++------------
 include/linux/platform_data/usb-omap.h |    1 +
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 2e44e8a..ee8c473 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -504,6 +504,7 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 	ohci_data.es2_compatibility = pdata->es2_compatibility;
 	usbhs_data.ehci_data = &ehci_data;
 	usbhs_data.ohci_data = &ohci_data;
+	usbhs_data.nports = pdata->nports;
 
 	if (cpu_is_omap34xx()) {
 		setup_ehci_io_mux(pdata->port_mode);
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
index 9b986ea..7dc0f04 100644
--- a/arch/arm/mach-omap2/usb.h
+++ b/arch/arm/mach-omap2/usb.h
@@ -54,6 +54,7 @@
 #define USBPHY_DATA_POLARITY	(1 << 23)
 
 struct usbhs_omap_board_data {
+	int				nports;
 	enum usbhs_omap_port_mode	port_mode[OMAP3_HS_USB_PORTS];
 
 	/* have to be valid if phy_reset is true and portx is in phy mode */
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 9c23a08..714b2f1 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -498,19 +498,27 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	 */
 	pm_runtime_put_sync(dev);
 
-	switch (omap->usbhs_rev) {
-	case OMAP_USBHS_REV1:
-		omap->nports = 3;
-		break;
-	case OMAP_USBHS_REV2:
-		omap->nports = 2;
-		break;
-	default:
-		omap->nports = OMAP3_HS_USB_PORTS;
-		dev_dbg(dev,
-		  "USB HOST Rev : 0x%d not recognized, assuming %d ports\n",
-		   omap->usbhs_rev, omap->nports);
-		break;
+	/*
+	 * If platform data contains nports then use that
+	 * else make out number of ports from USBHS revision
+	 */
+	if (pdata->nports) {
+		omap->nports = pdata->nports;
+	} else {
+		switch (omap->usbhs_rev) {
+		case OMAP_USBHS_REV1:
+			omap->nports = 3;
+			break;
+		case OMAP_USBHS_REV2:
+			omap->nports = 2;
+			break;
+		default:
+			omap->nports = OMAP3_HS_USB_PORTS;
+			dev_dbg(dev,
+			"USB HOST Rev:0x%d not recognized, assuming %d ports\n",
+				omap->usbhs_rev, omap->nports);
+			break;
+		}
 	}
 
 	for (i = 0; i < omap->nports; i++)
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
index ef65b67..57707c7 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -55,6 +55,7 @@ struct ohci_hcd_omap_platform_data {
 };
 
 struct usbhs_omap_platform_data {
+	int					nports;
 	enum usbhs_omap_port_mode		port_mode[OMAP3_HS_USB_PORTS];
 
 	struct ehci_hcd_omap_platform_data	*ehci_data;
-- 
1.7.4.1


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

* [PATCH v4 15/23] mfd: omap-usb-host: cleanup clock management code
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (13 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 14/23] mfd: omap-usb-host: override number of ports from platform data Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk Roger Quadros
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

All ports have similarly named port clocks so we can
bunch them into a port data structure and use for loop
to enable/disable the clocks.

Dynamically allocate and get clocks based on number of ports
available on the platform

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 714b2f1..6294f13 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -93,13 +93,10 @@
 
 struct usbhs_hcd_omap {
 	int				nports;
+	struct clk			**utmi_clk;
 
 	struct clk			*xclk60mhsp1_ck;
 	struct clk			*xclk60mhsp2_ck;
-	struct clk			*utmi_p1_fck;
-	struct clk			*usbhost_p1_fck;
-	struct clk			*utmi_p2_fck;
-	struct clk			*usbhost_p2_fck;
 	struct clk			*init_60m_fclk;
 	struct clk			*ehci_logic_fck;
 
@@ -283,6 +280,7 @@ static int usbhs_runtime_resume(struct device *dev)
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
 	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
+	int i, r;
 
 	dev_dbg(dev, "usbhs_runtime_resume\n");
 
@@ -292,13 +290,18 @@ static int usbhs_runtime_resume(struct device *dev)
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_enable(omap->ehci_logic_fck);
 
-	if (is_ehci_tll_mode(pdata->port_mode[0]))
-		clk_enable(omap->usbhost_p1_fck);
-	if (is_ehci_tll_mode(pdata->port_mode[1]))
-		clk_enable(omap->usbhost_p2_fck);
-
-	clk_enable(omap->utmi_p1_fck);
-	clk_enable(omap->utmi_p2_fck);
+	for (i = 0; i < omap->nports; i++) {
+		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+			if (omap->utmi_clk[i]) {
+				r = clk_enable(omap->utmi_clk[i]);
+				if (r) {
+					dev_err(dev,
+					 "Can't enable port %d clk : %d\n",
+					 i, r);
+				}
+			}
+		}
+	}
 
 	spin_unlock_irqrestore(&omap->lock, flags);
 
@@ -310,18 +313,18 @@ static int usbhs_runtime_suspend(struct device *dev)
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
 	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
+	int i;
 
 	dev_dbg(dev, "usbhs_runtime_suspend\n");
 
 	spin_lock_irqsave(&omap->lock, flags);
 
-	if (is_ehci_tll_mode(pdata->port_mode[0]))
-		clk_disable(omap->usbhost_p1_fck);
-	if (is_ehci_tll_mode(pdata->port_mode[1]))
-		clk_disable(omap->usbhost_p2_fck);
-
-	clk_disable(omap->utmi_p2_fck);
-	clk_disable(omap->utmi_p1_fck);
+	for (i = 0; i < omap->nports; i++) {
+		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+			if (omap->utmi_clk[i])
+				clk_disable(omap->utmi_clk[i]);
+		}
+	}
 
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_disable(omap->ehci_logic_fck);
@@ -465,6 +468,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	struct resource			*res;
 	int				ret = 0;
 	int				i;
+	bool				need_logic_fck;
 
 	if (!pdata) {
 		dev_err(dev, "Missing platform data\n");
@@ -521,76 +525,79 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 		}
 	}
 
-	for (i = 0; i < omap->nports; i++)
+	i = sizeof(struct clk *) * omap->nports;
+	omap->utmi_clk = devm_kzalloc(dev, i, GFP_KERNEL);
+	if (!omap->utmi_clk) {
+		dev_err(dev, "Memory allocation failed\n");
+		ret = -ENOMEM;
+		goto err_mem;
+	}
+
+	need_logic_fck = false;
+	for (i = 0; i < omap->nports; i++) {
 		if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
-			is_ehci_hsic_mode(i)) {
-			omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
-			if (IS_ERR(omap->ehci_logic_fck)) {
-				ret = PTR_ERR(omap->ehci_logic_fck);
-				dev_warn(dev, "ehci_logic_fck failed:%d\n",
-					 ret);
-			}
-			break;
-		}
+			is_ehci_hsic_mode(i))
+				need_logic_fck |= true;
+	}
 
-	omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
-	if (IS_ERR(omap->utmi_p1_fck)) {
-		ret = PTR_ERR(omap->utmi_p1_fck);
-		dev_err(dev, "utmi_p1_gfclk failed error:%d\n",	ret);
-		goto err_end;
+	if (need_logic_fck) {
+		omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
+		if (IS_ERR(omap->ehci_logic_fck)) {
+			ret = PTR_ERR(omap->ehci_logic_fck);
+			dev_dbg(dev, "ehci_logic_fck failed:%d\n", ret);
+		}
 	}
 
 	omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
 	if (IS_ERR(omap->xclk60mhsp1_ck)) {
 		ret = PTR_ERR(omap->xclk60mhsp1_ck);
 		dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
-		goto err_utmi_p1_fck;
-	}
-
-	omap->utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
-	if (IS_ERR(omap->utmi_p2_fck)) {
-		ret = PTR_ERR(omap->utmi_p2_fck);
-		dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
-		goto err_xclk60mhsp1_ck;
+		goto err_xclk60mhsp1;
 	}
 
 	omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
 	if (IS_ERR(omap->xclk60mhsp2_ck)) {
 		ret = PTR_ERR(omap->xclk60mhsp2_ck);
 		dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
-		goto err_utmi_p2_fck;
-	}
-
-	omap->usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
-	if (IS_ERR(omap->usbhost_p1_fck)) {
-		ret = PTR_ERR(omap->usbhost_p1_fck);
-		dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
-		goto err_xclk60mhsp2_ck;
-	}
-
-	omap->usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
-	if (IS_ERR(omap->usbhost_p2_fck)) {
-		ret = PTR_ERR(omap->usbhost_p2_fck);
-		dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
-		goto err_usbhost_p1_fck;
+		goto err_xclk60mhsp2;
 	}
 
 	omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
 	if (IS_ERR(omap->init_60m_fclk)) {
 		ret = PTR_ERR(omap->init_60m_fclk);
 		dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
-		goto err_usbhost_p2_fck;
+		goto err_init60m;
+	}
+
+	for (i = 0; i < omap->nports; i++) {
+		struct clk *pclk;
+		char clkname[] = "usb_host_hs_utmi_px_clk";
+
+		/* clock names are indexed from 1*/
+		snprintf(clkname, sizeof(clkname),
+				"usb_host_hs_utmi_p%d_clk", i + 1);
+
+		/* If a clock is not found we won't bail out as not all
+		 * platforms have all clocks and we can function without
+		 * them
+		 */
+		pclk = clk_get(dev, clkname);
+		if (IS_ERR(pclk))
+			dev_dbg(dev, "Failed to get clock : %s : %ld\n",
+				clkname, PTR_ERR(pclk));
+		else
+			omap->utmi_clk[i] = pclk;
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[0])) {
 		/* for OMAP3 , the clk set paretn fails */
-		ret = clk_set_parent(omap->utmi_p1_fck,
+		ret = clk_set_parent(omap->utmi_clk[0],
 					omap->xclk60mhsp1_ck);
 		if (ret != 0)
 			dev_err(dev, "xclk60mhsp1_ck set parent"
 				"failed error:%d\n", ret);
 	} else if (is_ehci_tll_mode(pdata->port_mode[0])) {
-		ret = clk_set_parent(omap->utmi_p1_fck,
+		ret = clk_set_parent(omap->utmi_clk[0],
 					omap->init_60m_fclk);
 		if (ret != 0)
 			dev_err(dev, "init_60m_fclk set parent"
@@ -598,13 +605,13 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[1])) {
-		ret = clk_set_parent(omap->utmi_p2_fck,
+		ret = clk_set_parent(omap->utmi_clk[1],
 					omap->xclk60mhsp2_ck);
 		if (ret != 0)
 			dev_err(dev, "xclk60mhsp2_ck set parent"
 					"failed error:%d\n", ret);
 	} else if (is_ehci_tll_mode(pdata->port_mode[1])) {
-		ret = clk_set_parent(omap->utmi_p2_fck,
+		ret = clk_set_parent(omap->utmi_clk[1],
 						omap->init_60m_fclk);
 		if (ret != 0)
 			dev_err(dev, "init_60m_fclk set parent"
@@ -622,28 +629,21 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 err_alloc:
 	omap_usbhs_deinit(&pdev->dev);
-	clk_put(omap->init_60m_fclk);
 
-err_usbhost_p2_fck:
-	clk_put(omap->usbhost_p2_fck);
+	for (i = 0; i < omap->nports; i++)
+		clk_put(omap->utmi_clk[i]);
 
-err_usbhost_p1_fck:
-	clk_put(omap->usbhost_p1_fck);
+	clk_put(omap->init_60m_fclk);
 
-err_xclk60mhsp2_ck:
+err_init60m:
 	clk_put(omap->xclk60mhsp2_ck);
 
-err_utmi_p2_fck:
-	clk_put(omap->utmi_p2_fck);
-
-err_xclk60mhsp1_ck:
+err_xclk60mhsp2:
 	clk_put(omap->xclk60mhsp1_ck);
 
-err_utmi_p1_fck:
-	clk_put(omap->utmi_p1_fck);
-
-err_end:
+err_xclk60mhsp1:
 	clk_put(omap->ehci_logic_fck);
+err_mem:
 	pm_runtime_disable(dev);
 
 	return ret;
@@ -658,15 +658,16 @@ err_end:
 static int __devexit usbhs_omap_remove(struct platform_device *pdev)
 {
 	struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
+	int i;
 
 	omap_usbhs_deinit(&pdev->dev);
+
+	for (i = 0; i < omap->nports; i++)
+		clk_put(omap->utmi_clk[i]);
+
 	clk_put(omap->init_60m_fclk);
-	clk_put(omap->usbhost_p2_fck);
-	clk_put(omap->usbhost_p1_fck);
 	clk_put(omap->xclk60mhsp2_ck);
-	clk_put(omap->utmi_p2_fck);
 	clk_put(omap->xclk60mhsp1_ck);
-	clk_put(omap->utmi_p1_fck);
 	clk_put(omap->ehci_logic_fck);
 	pm_runtime_disable(&pdev->dev);
 
-- 
1.7.4.1


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

* [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (14 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 15/23] mfd: omap-usb-host: cleanup clock management code Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-14 18:28   ` Tony Lindgren
  2012-12-10 10:20 ` [PATCH v4 17/23] mfd: omap-usb-host: Manage HSIC clocks for HSIC mode Roger Quadros
                   ` (7 subsequent siblings)
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

There is no such clock as utmi_p1_gfclk. It is only a clock selector
bit to select th the parent of usb_host_hs_utmi_p1_clk.
So we get rid of utmi_p1_gfclk and utmi_p2_gfclk by merging them into
usb_host_hs_utmi_p1_clk and usb_host_hs_utmi_p2_clk respectively.

CC: Paul Walmsley <paul@pwsan.com>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Benoit Cousson <b-cousson@ti.com>
CC: Mike Turquette <mturquette@gmail.com>

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/mach-omap2/cclock3xxx_data.c |    2 -
 arch/arm/mach-omap2/cclock44xx_data.c |   47 +++++++++++++++++++++++----------
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index bdf3948..5655414 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3392,8 +3392,6 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK("usbhs_omap",	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK(NULL,	"utmi_p1_gfclk",	&dummy_ck,	CK_3XXX),
-	CLK(NULL,	"utmi_p2_gfclk",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"xclk60mhsp1_ck",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"xclk60mhsp2_ck",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&dummy_ck,	CK_3XXX),
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index aa56c3e..74535fe 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -1366,31 +1366,52 @@ static struct clk_hw_omap usb_host_fs_fck_hw = {
 DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
 		  usb_host_fs_fck_ops);
 
+static const struct clk_ops utmi_clk_ops = {
+	.enable		= &omap2_dflt_clk_enable,
+	.disable	= &omap2_dflt_clk_disable,
+	.is_enabled	= &omap2_dflt_clk_is_enabled,
+	.recalc_rate	= &omap2_clksel_recalc,
+	.get_parent	= &omap2_clksel_find_parent_index,
+	.set_parent	= &omap2_clksel_set_parent,
+};
+
 static const char *utmi_p1_gfclk_parents[] = {
 	"init_60m_fclk", "xclk60mhsp1_ck",
 };
 
-DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
-	       OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
-	       OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
-	       0x0, NULL);
+static const struct clksel utmi_p1_clk_mux_sel[] = {
+	{ .parent = &init_60m_fclk, .rates = div_1_0_rates },
+	{ .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
+	{ .parent = NULL },
+};
 
-DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
+/* Merged utmi_p1_gfclk into usb_host_hs_utmi_p1_clk */
+DEFINE_CLK_OMAP_MUX_GATE(usb_host_hs_utmi_p1_clk, "l3_init_clkdm",
+		utmi_p1_clk_mux_sel,
+		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
+		OMAP4430_CLKSEL_UTMI_P1_MASK,
 		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
-		OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
+		OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, NULL,
+		utmi_p1_gfclk_parents, utmi_clk_ops);
 
 static const char *utmi_p2_gfclk_parents[] = {
 	"init_60m_fclk", "xclk60mhsp2_ck",
 };
 
-DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
-	       OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
-	       OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
-	       0x0, NULL);
+static const struct clksel utmi_p2_clk_mux_sel[] = {
+	{ .parent = &init_60m_fclk, .rates = div_1_0_rates },
+	{ .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
+	{ .parent = NULL },
+};
 
-DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
+/* Merged utmi_p2_gfclk into usb_host_hs_utmi_p2_clk */
+DEFINE_CLK_OMAP_MUX_GATE(usb_host_hs_utmi_p2_clk, "l3_init_clkdm",
+		utmi_p2_clk_mux_sel,
+		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
+		OMAP4430_CLKSEL_UTMI_P2_MASK,
 		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
-		OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
+		OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, NULL,
+		utmi_p2_gfclk_parents, utmi_clk_ops);
 
 DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
 		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
@@ -1838,9 +1859,7 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"uart4_fck",			&uart4_fck,	CK_443X),
 	CLK(NULL,	"usb_host_fs_fck",		&usb_host_fs_fck,	CK_443X),
 	CLK("usbhs_omap",	"fs_fck",		&usb_host_fs_fck,	CK_443X),
-	CLK(NULL,	"utmi_p1_gfclk",		&utmi_p1_gfclk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&usb_host_hs_utmi_p1_clk,	CK_443X),
-	CLK(NULL,	"utmi_p2_gfclk",		&utmi_p2_gfclk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p2_clk",	&usb_host_hs_utmi_p2_clk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p3_clk",	&usb_host_hs_utmi_p3_clk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_hsic480m_p1_clk",	&usb_host_hs_hsic480m_p1_clk,	CK_443X),
-- 
1.7.4.1


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

* [PATCH v4 17/23] mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (15 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 18/23] mfd: omap-usb-host: Get rid of unnecessary spinlock Roger Quadros
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

Enable the optional HSIC clocks (60MHz and 480MHz) for the ports
that are configured in HSIC mode.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 6294f13..90dbd17 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -94,6 +94,8 @@
 struct usbhs_hcd_omap {
 	int				nports;
 	struct clk			**utmi_clk;
+	struct clk			**hsic60m_clk;
+	struct clk			**hsic480m_clk;
 
 	struct clk			*xclk60mhsp1_ck;
 	struct clk			*xclk60mhsp2_ck;
@@ -291,7 +293,28 @@ static int usbhs_runtime_resume(struct device *dev)
 		clk_enable(omap->ehci_logic_fck);
 
 	for (i = 0; i < omap->nports; i++) {
-		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+		switch (pdata->port_mode[i]) {
+		case OMAP_EHCI_PORT_MODE_HSIC:
+			if (omap->hsic60m_clk[i]) {
+				r = clk_enable(omap->hsic60m_clk[i]);
+				if (r) {
+					dev_err(dev,
+					 "Can't enable port %d hsic60m clk:%d\n",
+					 i, r);
+				}
+			}
+
+			if (omap->hsic480m_clk[i]) {
+				r = clk_enable(omap->hsic480m_clk[i]);
+				if (r) {
+					dev_err(dev,
+					 "Can't enable port %d hsic480m clk:%d\n",
+					 i, r);
+				}
+			}
+		/* Fall through as HSIC mode needs utmi_clk */
+
+		case OMAP_EHCI_PORT_MODE_TLL:
 			if (omap->utmi_clk[i]) {
 				r = clk_enable(omap->utmi_clk[i]);
 				if (r) {
@@ -300,6 +323,9 @@ static int usbhs_runtime_resume(struct device *dev)
 					 i, r);
 				}
 			}
+			break;
+		default:
+			break;
 		}
 	}
 
@@ -320,9 +346,21 @@ static int usbhs_runtime_suspend(struct device *dev)
 	spin_lock_irqsave(&omap->lock, flags);
 
 	for (i = 0; i < omap->nports; i++) {
-		if (is_ehci_tll_mode(pdata->port_mode[i])) {
+		switch (pdata->port_mode[i]) {
+		case OMAP_EHCI_PORT_MODE_HSIC:
+			if (omap->hsic60m_clk[i])
+				clk_disable(omap->hsic60m_clk[i]);
+
+			if (omap->hsic480m_clk[i])
+				clk_disable(omap->hsic480m_clk[i]);
+		/* Fall through as utmi_clks were used in HSIC mode */
+
+		case OMAP_EHCI_PORT_MODE_TLL:
 			if (omap->utmi_clk[i])
 				clk_disable(omap->utmi_clk[i]);
+			break;
+		default:
+			break;
 		}
 	}
 
@@ -527,7 +565,10 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 	i = sizeof(struct clk *) * omap->nports;
 	omap->utmi_clk = devm_kzalloc(dev, i, GFP_KERNEL);
-	if (!omap->utmi_clk) {
+	omap->hsic480m_clk = devm_kzalloc(dev, i, GFP_KERNEL);
+	omap->hsic60m_clk = devm_kzalloc(dev, i, GFP_KERNEL);
+
+	if (!omap->utmi_clk || !omap->hsic480m_clk || !omap->hsic60m_clk) {
 		dev_err(dev, "Memory allocation failed\n");
 		ret = -ENOMEM;
 		goto err_mem;
@@ -571,7 +612,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 
 	for (i = 0; i < omap->nports; i++) {
 		struct clk *pclk;
-		char clkname[] = "usb_host_hs_utmi_px_clk";
+		char clkname[] = "usb_host_hs_hsic480m_px_clk";
 
 		/* clock names are indexed from 1*/
 		snprintf(clkname, sizeof(clkname),
@@ -587,6 +628,24 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 				clkname, PTR_ERR(pclk));
 		else
 			omap->utmi_clk[i] = pclk;
+
+		snprintf(clkname, sizeof(clkname),
+				"usb_host_hs_hsic480m_p%d_clk", i + 1);
+		pclk = clk_get(dev, clkname);
+		if (IS_ERR(pclk))
+			dev_dbg(dev, "Failed to get clock : %s : %ld\n",
+				clkname, PTR_ERR(pclk));
+		else
+			omap->hsic480m_clk[i] = pclk;
+
+		snprintf(clkname, sizeof(clkname),
+				"usb_host_hs_hsic60m_p%d_clk", i + 1);
+		pclk = clk_get(dev, clkname);
+		if (IS_ERR(pclk))
+			dev_dbg(dev, "Failed to get clock : %s : %ld\n",
+				clkname, PTR_ERR(pclk));
+		else
+			omap->hsic60m_clk[i] = pclk;
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[0])) {
@@ -630,8 +689,11 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 err_alloc:
 	omap_usbhs_deinit(&pdev->dev);
 
-	for (i = 0; i < omap->nports; i++)
+	for (i = 0; i < omap->nports; i++) {
 		clk_put(omap->utmi_clk[i]);
+		clk_put(omap->hsic60m_clk[i]);
+		clk_put(omap->hsic480m_clk[i]);
+	}
 
 	clk_put(omap->init_60m_fclk);
 
@@ -662,8 +724,11 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
 
 	omap_usbhs_deinit(&pdev->dev);
 
-	for (i = 0; i < omap->nports; i++)
+	for (i = 0; i < omap->nports; i++) {
 		clk_put(omap->utmi_clk[i]);
+		clk_put(omap->hsic60m_clk[i]);
+		clk_put(omap->hsic480m_clk[i]);
+	}
 
 	clk_put(omap->init_60m_fclk);
 	clk_put(omap->xclk60mhsp2_ck);
-- 
1.7.4.1


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

* [PATCH v4 18/23] mfd: omap-usb-host: Get rid of unnecessary spinlock
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (16 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 17/23] mfd: omap-usb-host: Manage HSIC clocks for HSIC mode Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 19/23] mfd: omap-usb-host: clean up omap_usbhs_init() Roger Quadros
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

The driver does not have an interrupt handler and
we don't really need a spinlock, so get rid of it.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 90dbd17..289b356 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -23,7 +23,6 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
-#include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <plat/cpu.h>
 #include <linux/platform_device.h>
@@ -107,7 +106,6 @@ struct usbhs_hcd_omap {
 	struct usbhs_omap_platform_data	*pdata;
 
 	u32				usbhs_rev;
-	spinlock_t			lock;
 };
 /*-------------------------------------------------------------------------*/
 
@@ -280,14 +278,12 @@ static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
 static int usbhs_runtime_resume(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
 	int i, r;
 
 	dev_dbg(dev, "usbhs_runtime_resume\n");
 
 	omap_tll_enable();
-	spin_lock_irqsave(&omap->lock, flags);
 
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_enable(omap->ehci_logic_fck);
@@ -329,22 +325,17 @@ static int usbhs_runtime_resume(struct device *dev)
 		}
 	}
 
-	spin_unlock_irqrestore(&omap->lock, flags);
-
 	return 0;
 }
 
 static int usbhs_runtime_suspend(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
 	int i;
 
 	dev_dbg(dev, "usbhs_runtime_suspend\n");
 
-	spin_lock_irqsave(&omap->lock, flags);
-
 	for (i = 0; i < omap->nports; i++) {
 		switch (pdata->port_mode[i]) {
 		case OMAP_EHCI_PORT_MODE_HSIC:
@@ -367,7 +358,6 @@ static int usbhs_runtime_suspend(struct device *dev)
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_disable(omap->ehci_logic_fck);
 
-	spin_unlock_irqrestore(&omap->lock, flags);
 	omap_tll_disable();
 
 	return 0;
@@ -377,7 +367,6 @@ static void omap_usbhs_init(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
 	struct usbhs_omap_platform_data	*pdata = omap->pdata;
-	unsigned long			flags;
 	unsigned			reg;
 
 	dev_dbg(dev, "starting TI HSUSB Controller\n");
@@ -396,7 +385,6 @@ static void omap_usbhs_init(struct device *dev)
 	}
 
 	pm_runtime_get_sync(dev);
-	spin_lock_irqsave(&omap->lock, flags);
 
 	reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
 	/* setup ULPI bypass and burst configurations */
@@ -459,8 +447,6 @@ static void omap_usbhs_init(struct device *dev)
 	usbhs_write(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
 	dev_dbg(dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
 
-	spin_unlock_irqrestore(&omap->lock, flags);
-
 	pm_runtime_put_sync(dev);
 	if (pdata->ehci_data->phy_reset) {
 		/* Hold the PHY in RESET for enough time till
@@ -524,8 +510,6 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	if (!omap->uhh_base)
 		return -EADDRNOTAVAIL;
 
-	spin_lock_init(&omap->lock);
-
 	omap->pdata = pdata;
 
 	pm_runtime_enable(dev);
-- 
1.7.4.1


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

* [PATCH v4 19/23] mfd: omap-usb-host: clean up omap_usbhs_init()
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (17 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 18/23] mfd: omap-usb-host: Get rid of unnecessary spinlock Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 20/23] USB: ehci-omap: Don't free gpios that we didn't request Roger Quadros
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

We split initializing revision 1 and revision 2 into different
functions. Initialization is now done dynamically so that only
the number of ports available on the system are initialized.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 289b356..0bb54393 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -363,6 +363,75 @@ static int usbhs_runtime_suspend(struct device *dev)
 	return 0;
 }
 
+static unsigned omap_usbhs_rev1_hostconfig(struct usbhs_hcd_omap *omap,
+						unsigned reg)
+{
+	struct usbhs_omap_platform_data	*pdata = omap->pdata;
+	int i;
+
+	for (i = 0; i < omap->nports; i++) {
+		switch (pdata->port_mode[i]) {
+		case OMAP_USBHS_PORT_MODE_UNUSED:
+			reg &= ~(OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS << i);
+			break;
+		case OMAP_EHCI_PORT_MODE_PHY:
+			if (pdata->single_ulpi_bypass)
+				break;
+
+			if (i == 0)
+				reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
+			else
+				reg &= ~(OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS
+								<< (i-1));
+			break;
+		default:
+			if (pdata->single_ulpi_bypass)
+				break;
+
+			if (i == 0)
+				reg |= OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
+			else
+				reg |= OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS
+								<< (i-1);
+			break;
+		}
+	}
+
+	if (pdata->single_ulpi_bypass) {
+		/* bypass ULPI only if none of the ports use PHY mode */
+		reg |= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
+
+		for (i = 0; i < omap->nports; i++) {
+			if (is_ehci_phy_mode(pdata->port_mode[i])) {
+				reg &= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
+				break;
+			}
+		}
+	}
+
+	return reg;
+}
+
+static unsigned omap_usbhs_rev2_hostconfig(struct usbhs_hcd_omap *omap,
+						unsigned reg)
+{
+	struct usbhs_omap_platform_data	*pdata = omap->pdata;
+	int i;
+
+	for (i = 0; i < omap->nports; i++) {
+		/* Clear port mode fields for PHY mode */
+		reg &= ~(OMAP4_P1_MODE_CLEAR << 2 * i);
+
+		if (is_ehci_tll_mode(pdata->port_mode[i]) ||
+				(is_ohci_port(pdata->port_mode[i])))
+			reg |= OMAP4_P1_MODE_TLL << 2 * i;
+		else if (is_ehci_hsic_mode(pdata->port_mode[i]))
+			reg |= OMAP4_P1_MODE_HSIC << 2 * i;
+	}
+
+	return reg;
+}
+
 static void omap_usbhs_init(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
@@ -394,55 +463,10 @@ static void omap_usbhs_init(struct device *dev)
 	reg |= OMAP4_UHH_HOSTCONFIG_APP_START_CLK;
 	reg &= ~OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN;
 
-	if (is_omap_usbhs_rev1(omap)) {
-		if (pdata->port_mode[0] == OMAP_USBHS_PORT_MODE_UNUSED)
-			reg &= ~OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS;
-		if (pdata->port_mode[1] == OMAP_USBHS_PORT_MODE_UNUSED)
-			reg &= ~OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS;
-		if (pdata->port_mode[2] == OMAP_USBHS_PORT_MODE_UNUSED)
-			reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS;
-
-		/* Bypass the TLL module for PHY mode operation */
-		if (pdata->single_ulpi_bypass) {
-			dev_dbg(dev, "OMAP3 ES version <= ES2.1\n");
-			if (is_ehci_phy_mode(pdata->port_mode[0]) ||
-				is_ehci_phy_mode(pdata->port_mode[1]) ||
-					is_ehci_phy_mode(pdata->port_mode[2]))
-				reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
-			else
-				reg |= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
-		} else {
-			dev_dbg(dev, "OMAP3 ES version > ES2.1\n");
-			if (is_ehci_phy_mode(pdata->port_mode[0]))
-				reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
-			else
-				reg |= OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
-			if (is_ehci_phy_mode(pdata->port_mode[1]))
-				reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS;
-			else
-				reg |= OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS;
-			if (is_ehci_phy_mode(pdata->port_mode[2]))
-				reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS;
-			else
-				reg |= OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS;
-		}
-	} else if (is_omap_usbhs_rev2(omap)) {
-		/* Clear port mode fields for PHY mode*/
-		reg &= ~OMAP4_P1_MODE_CLEAR;
-		reg &= ~OMAP4_P2_MODE_CLEAR;
-
-		if (is_ehci_tll_mode(pdata->port_mode[0]) ||
-			(is_ohci_port(pdata->port_mode[0])))
-			reg |= OMAP4_P1_MODE_TLL;
-		else if (is_ehci_hsic_mode(pdata->port_mode[0]))
-			reg |= OMAP4_P1_MODE_HSIC;
-
-		if (is_ehci_tll_mode(pdata->port_mode[1]) ||
-			(is_ohci_port(pdata->port_mode[1])))
-			reg |= OMAP4_P2_MODE_TLL;
-		else if (is_ehci_hsic_mode(pdata->port_mode[1]))
-			reg |= OMAP4_P2_MODE_HSIC;
-	}
+	if (is_omap_usbhs_rev1(omap))
+		reg = omap_usbhs_rev1_hostconfig(omap, reg);
+	else if (is_omap_usbhs_rev2(omap))
+		reg = omap_usbhs_rev2_hostconfig(omap, reg);
 
 	usbhs_write(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
 	dev_dbg(dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
-- 
1.7.4.1


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

* [PATCH v4 20/23] USB: ehci-omap: Don't free gpios that we didn't request
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (18 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 19/23] mfd: omap-usb-host: clean up omap_usbhs_init() Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 10:20 ` [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies Roger Quadros
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

This driver does not request any gpios so don't free them.
Fixes L3 bus error on multiple modprobe/rmmod of ehci_hcd
with ehci-omap in use.

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

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 0d5ac36..9f7441b 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -291,7 +291,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
 {
 	struct device *dev				= &pdev->dev;
 	struct usb_hcd *hcd				= dev_get_drvdata(dev);
-	struct ehci_hcd_omap_platform_data *pdata	= dev->platform_data;
 
 	usb_remove_hcd(hcd);
 	disable_put_regulator(dev->platform_data);
@@ -301,13 +300,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
 
-	if (pdata->phy_reset) {
-		if (gpio_is_valid(pdata->reset_gpio_port[0]))
-			gpio_free(pdata->reset_gpio_port[0]);
-
-		if (gpio_is_valid(pdata->reset_gpio_port[1]))
-			gpio_free(pdata->reset_gpio_port[1]);
-	}
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (19 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 20/23] USB: ehci-omap: Don't free gpios that we didn't request Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 17:24   ` Paul Walmsley
  2012-12-10 10:20 ` [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases Roger Quadros
                   ` (2 subsequent siblings)
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

We don't need multiple aliases for the OMAP USB host clocks and neither
the dummy clocks so remove them.

CC: Paul Walmsley <paul@pwsan.com>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Benoit Cousson <b-cousson@ti.com>
CC: Mike Turquette <mturquette@gmail.com>

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/mach-omap2/cclock3xxx_data.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 5655414..8b9d109 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3289,8 +3289,6 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"cpefuse_fck",	&cpefuse_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"ts_fck",	&ts_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"usbtll_fck",	&usbtll_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK("usbhs_omap",	"usbtll_fck",	&usbtll_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK("usbhs_tll",	"usbtll_fck",	&usbtll_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"core_96m_fck",	&core_96m_fck,	CK_3XXX),
 	CLK(NULL,	"mmchs3_fck",	&mmchs3_fck,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"mmchs2_fck",	&mmchs2_fck,	CK_3XXX),
@@ -3327,8 +3325,6 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"pka_ick",	&pka_ick,	CK_34XX | CK_36XX),
 	CLK(NULL,	"core_l4_ick",	&core_l4_ick,	CK_3XXX),
 	CLK(NULL,	"usbtll_ick",	&usbtll_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK("usbhs_omap",	"usbtll_ick",	&usbtll_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK("usbhs_tll",	"usbtll_ick",	&usbtll_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK("omap_hsmmc.2",	"ick",	&mmchs3_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"mmchs3_ick",	&mmchs3_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"icr_ick",	&icr_ick,	CK_34XX | CK_36XX),
@@ -3391,15 +3387,8 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-	CLK("usbhs_omap",	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
 	CLK(NULL,	"xclk60mhsp1_ck",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"xclk60mhsp2_ck",	&dummy_ck,	CK_3XXX),
-	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&dummy_ck,	CK_3XXX),
-	CLK(NULL,	"usb_host_hs_utmi_p2_clk",	&dummy_ck,	CK_3XXX),
-	CLK("usbhs_omap",	"usb_tll_hs_usb_ch0_clk",	&dummy_ck,	CK_3XXX),
-	CLK("usbhs_omap",	"usb_tll_hs_usb_ch1_clk",	&dummy_ck,	CK_3XXX),
-	CLK("usbhs_tll",	"usb_tll_hs_usb_ch0_clk",	&dummy_ck,	CK_3XXX),
-	CLK("usbhs_tll",	"usb_tll_hs_usb_ch1_clk",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"init_60m_fclk",	&dummy_ck,	CK_3XXX),
 	CLK(NULL,	"usim_fck",	&usim_fck,	CK_3430ES2PLUS | CK_36XX),
 	CLK(NULL,	"gpt1_fck",	&gpt1_fck,	CK_3XXX),
-- 
1.7.4.1


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

* [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (20 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 17:26   ` Paul Walmsley
  2012-12-10 10:20 ` [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure Roger Quadros
  2012-12-13 10:44 ` [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

We don't need multiple aliases for the OMAP USB host clocks so remove them.

CC: Paul Walmsley <paul@pwsan.com>
CC: Rajendra Nayak <rnayak@ti.com>
CC: Benoit Cousson <b-cousson@ti.com>
CC: Mike Turquette <mturquette@gmail.com>

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/mach-omap2/cclock44xx_data.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index 74535fe..5a27244 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -1858,7 +1858,6 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"uart3_fck",			&uart3_fck,	CK_443X),
 	CLK(NULL,	"uart4_fck",			&uart4_fck,	CK_443X),
 	CLK(NULL,	"usb_host_fs_fck",		&usb_host_fs_fck,	CK_443X),
-	CLK("usbhs_omap",	"fs_fck",		&usb_host_fs_fck,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&usb_host_hs_utmi_p1_clk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p2_clk",	&usb_host_hs_utmi_p2_clk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_utmi_p3_clk",	&usb_host_hs_utmi_p3_clk,	CK_443X),
@@ -1868,7 +1867,6 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"usb_host_hs_hsic480m_p2_clk",	&usb_host_hs_hsic480m_p2_clk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_func48mclk",	&usb_host_hs_func48mclk,	CK_443X),
 	CLK(NULL,	"usb_host_hs_fck",		&usb_host_hs_fck,	CK_443X),
-	CLK("usbhs_omap",	"hs_fck",		&usb_host_hs_fck,	CK_443X),
 	CLK(NULL,	"otg_60m_gfclk",		&otg_60m_gfclk,	CK_443X),
 	CLK(NULL,	"usb_otg_hs_xclk",		&usb_otg_hs_xclk,	CK_443X),
 	CLK(NULL,	"usb_otg_hs_ick",		&usb_otg_hs_ick,	CK_443X),
@@ -1878,8 +1876,6 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"usb_tll_hs_usb_ch0_clk",	&usb_tll_hs_usb_ch0_clk,	CK_443X),
 	CLK(NULL,	"usb_tll_hs_usb_ch1_clk",	&usb_tll_hs_usb_ch1_clk,	CK_443X),
 	CLK(NULL,	"usb_tll_hs_ick",		&usb_tll_hs_ick,	CK_443X),
-	CLK("usbhs_omap",	"usbtll_ick",		&usb_tll_hs_ick,	CK_443X),
-	CLK("usbhs_tll",	"usbtll_ick",		&usb_tll_hs_ick,	CK_443X),
 	CLK(NULL,	"usim_ck",			&usim_ck,	CK_443X),
 	CLK(NULL,	"usim_fclk",			&usim_fclk,	CK_443X),
 	CLK(NULL,	"usim_fck",			&usim_fck,	CK_443X),
@@ -1930,9 +1926,7 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"uart2_ick",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"uart3_ick",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"uart4_ick",			&dummy_ck,	CK_443X),
-	CLK("usbhs_omap",	"usbhost_ick",		&dummy_ck,		CK_443X),
-	CLK("usbhs_omap",	"usbtll_fck",		&dummy_ck,	CK_443X),
-	CLK("usbhs_tll",	"usbtll_fck",		&dummy_ck,	CK_443X),
+	CLK(NULL,	"usbhost_ick",			&dummy_ck,	CK_443X),
 	CLK("omap_wdt",	"ick",				&dummy_ck,	CK_443X),
 	CLK(NULL,	"timer_32k_ck",	&sys_32k_ck,	CK_443X),
 	/* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
-- 
1.7.4.1


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

* [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (21 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases Roger Quadros
@ 2012-12-10 10:20 ` Roger Quadros
  2012-12-10 11:24   ` Rajendra Nayak
  2012-12-13 10:44 ` [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 10:20 UTC (permalink / raw)
  To: balbi, sameo, tony
  Cc: paul, keshava_mgowda, sshtylyov, bjorn, rogerq, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel

clk_set_parent is expected to fail on OMAP3 platforms. We don't
consider that as fatal so don't spam console.

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

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 0bb54393..344ce09 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -657,32 +657,32 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[0])) {
-		/* for OMAP3 , the clk set paretn fails */
+		/* for OMAP3, clk_set_parent fails */
 		ret = clk_set_parent(omap->utmi_clk[0],
 					omap->xclk60mhsp1_ck);
 		if (ret != 0)
-			dev_err(dev, "xclk60mhsp1_ck set parent"
-				"failed error:%d\n", ret);
+			dev_dbg(dev, "xclk60mhsp1_ck set parent failed: %d\n",
+					ret);
 	} else if (is_ehci_tll_mode(pdata->port_mode[0])) {
 		ret = clk_set_parent(omap->utmi_clk[0],
 					omap->init_60m_fclk);
 		if (ret != 0)
-			dev_err(dev, "init_60m_fclk set parent"
-				"failed error:%d\n", ret);
+			dev_dbg(dev, "P0 init_60m_fclk set parent failed: %d\n",
+					ret);
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[1])) {
 		ret = clk_set_parent(omap->utmi_clk[1],
 					omap->xclk60mhsp2_ck);
 		if (ret != 0)
-			dev_err(dev, "xclk60mhsp2_ck set parent"
-					"failed error:%d\n", ret);
+			dev_dbg(dev, "xclk60mhsp2_ck set parent failed: %d\n",
+					ret);
 	} else if (is_ehci_tll_mode(pdata->port_mode[1])) {
 		ret = clk_set_parent(omap->utmi_clk[1],
 						omap->init_60m_fclk);
 		if (ret != 0)
-			dev_err(dev, "init_60m_fclk set parent"
-				"failed error:%d\n", ret);
+			dev_dbg(dev, "P1 init_60m_fclk set parent failed: %d\n",
+					ret);
 	}
 
 	omap_usbhs_init(dev);
-- 
1.7.4.1


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

* Re: [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure
  2012-12-10 10:20 ` [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure Roger Quadros
@ 2012-12-10 11:24   ` Rajendra Nayak
  2012-12-10 11:31     ` Roger Quadros
  0 siblings, 1 reply; 40+ messages in thread
From: Rajendra Nayak @ 2012-12-10 11:24 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, sameo, tony, paul, sshtylyov, linux-usb, linux-kernel,
	keshava_mgowda, linux-arm-kernel, linux-omap, bjorn

On Monday 10 December 2012 03:50 PM, Roger Quadros wrote:
> clk_set_parent is expected to fail on OMAP3 platforms. We don't
> consider that as fatal so don't spam console.

And what if it fails on a non-OMAP3 platform?

>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>   drivers/mfd/omap-usb-host.c |   18 +++++++++---------
>   1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index 0bb54393..344ce09 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -657,32 +657,32 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
>   	}
>
>   	if (is_ehci_phy_mode(pdata->port_mode[0])) {
> -		/* for OMAP3 , the clk set paretn fails */
> +		/* for OMAP3, clk_set_parent fails */
>   		ret = clk_set_parent(omap->utmi_clk[0],
>   					omap->xclk60mhsp1_ck);
>   		if (ret != 0)
> -			dev_err(dev, "xclk60mhsp1_ck set parent"
> -				"failed error:%d\n", ret);
> +			dev_dbg(dev, "xclk60mhsp1_ck set parent failed: %d\n",
> +					ret);
>   	} else if (is_ehci_tll_mode(pdata->port_mode[0])) {
>   		ret = clk_set_parent(omap->utmi_clk[0],
>   					omap->init_60m_fclk);
>   		if (ret != 0)
> -			dev_err(dev, "init_60m_fclk set parent"
> -				"failed error:%d\n", ret);
> +			dev_dbg(dev, "P0 init_60m_fclk set parent failed: %d\n",
> +					ret);
>   	}
>
>   	if (is_ehci_phy_mode(pdata->port_mode[1])) {
>   		ret = clk_set_parent(omap->utmi_clk[1],
>   					omap->xclk60mhsp2_ck);
>   		if (ret != 0)
> -			dev_err(dev, "xclk60mhsp2_ck set parent"
> -					"failed error:%d\n", ret);
> +			dev_dbg(dev, "xclk60mhsp2_ck set parent failed: %d\n",
> +					ret);
>   	} else if (is_ehci_tll_mode(pdata->port_mode[1])) {
>   		ret = clk_set_parent(omap->utmi_clk[1],
>   						omap->init_60m_fclk);
>   		if (ret != 0)
> -			dev_err(dev, "init_60m_fclk set parent"
> -				"failed error:%d\n", ret);
> +			dev_dbg(dev, "P1 init_60m_fclk set parent failed: %d\n",
> +					ret);
>   	}
>
>   	omap_usbhs_init(dev);
>


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

* Re: [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure
  2012-12-10 11:24   ` Rajendra Nayak
@ 2012-12-10 11:31     ` Roger Quadros
  2012-12-10 14:38       ` Felipe Balbi
  0 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-10 11:31 UTC (permalink / raw)
  To: Rajendra Nayak
  Cc: balbi, sameo, tony, paul, sshtylyov, linux-usb, linux-kernel,
	keshava_mgowda, linux-arm-kernel, linux-omap, bjorn

On 12/10/2012 01:24 PM, Rajendra Nayak wrote:
> On Monday 10 December 2012 03:50 PM, Roger Quadros wrote:
>> clk_set_parent is expected to fail on OMAP3 platforms. We don't
>> consider that as fatal so don't spam console.
> 
> And what if it fails on a non-OMAP3 platform?

The driver just prints a debug message and continues to work just as
before. The USB port will not work for the user in that case. He will
have to enable DEBUG flag to see the debug message. I see this behaviour
better than before where all OMAP3 users see the error message for no
reason.

cheers,
-roger

> 
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>   drivers/mfd/omap-usb-host.c |   18 +++++++++---------
>>   1 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
>> index 0bb54393..344ce09 100644
>> --- a/drivers/mfd/omap-usb-host.c
>> +++ b/drivers/mfd/omap-usb-host.c
>> @@ -657,32 +657,32 @@ static int __devinit usbhs_omap_probe(struct
>> platform_device *pdev)
>>       }
>>
>>       if (is_ehci_phy_mode(pdata->port_mode[0])) {
>> -        /* for OMAP3 , the clk set paretn fails */
>> +        /* for OMAP3, clk_set_parent fails */
>>           ret = clk_set_parent(omap->utmi_clk[0],
>>                       omap->xclk60mhsp1_ck);
>>           if (ret != 0)
>> -            dev_err(dev, "xclk60mhsp1_ck set parent"
>> -                "failed error:%d\n", ret);
>> +            dev_dbg(dev, "xclk60mhsp1_ck set parent failed: %d\n",
>> +                    ret);
>>       } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
>>           ret = clk_set_parent(omap->utmi_clk[0],
>>                       omap->init_60m_fclk);
>>           if (ret != 0)
>> -            dev_err(dev, "init_60m_fclk set parent"
>> -                "failed error:%d\n", ret);
>> +            dev_dbg(dev, "P0 init_60m_fclk set parent failed: %d\n",
>> +                    ret);
>>       }
>>
>>       if (is_ehci_phy_mode(pdata->port_mode[1])) {
>>           ret = clk_set_parent(omap->utmi_clk[1],
>>                       omap->xclk60mhsp2_ck);
>>           if (ret != 0)
>> -            dev_err(dev, "xclk60mhsp2_ck set parent"
>> -                    "failed error:%d\n", ret);
>> +            dev_dbg(dev, "xclk60mhsp2_ck set parent failed: %d\n",
>> +                    ret);
>>       } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
>>           ret = clk_set_parent(omap->utmi_clk[1],
>>                           omap->init_60m_fclk);
>>           if (ret != 0)
>> -            dev_err(dev, "init_60m_fclk set parent"
>> -                "failed error:%d\n", ret);
>> +            dev_dbg(dev, "P1 init_60m_fclk set parent failed: %d\n",
>> +                    ret);
>>       }
>>
>>       omap_usbhs_init(dev);
>>
> 


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

* Re: [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure
  2012-12-10 11:31     ` Roger Quadros
@ 2012-12-10 14:38       ` Felipe Balbi
  0 siblings, 0 replies; 40+ messages in thread
From: Felipe Balbi @ 2012-12-10 14:38 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Rajendra Nayak, balbi, sameo, tony, paul, sshtylyov, linux-usb,
	linux-kernel, keshava_mgowda, linux-arm-kernel, linux-omap,
	bjorn

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

On Mon, Dec 10, 2012 at 01:31:22PM +0200, Roger Quadros wrote:
> On 12/10/2012 01:24 PM, Rajendra Nayak wrote:
> > On Monday 10 December 2012 03:50 PM, Roger Quadros wrote:
> >> clk_set_parent is expected to fail on OMAP3 platforms. We don't
> >> consider that as fatal so don't spam console.
> > 
> > And what if it fails on a non-OMAP3 platform?
> 
> The driver just prints a debug message and continues to work just as
> before. The USB port will not work for the user in that case. He will
> have to enable DEBUG flag to see the debug message. I see this behaviour
> better than before where all OMAP3 users see the error message for no
> reason.

I agree with Roger here.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies
  2012-12-10 10:20 ` [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies Roger Quadros
@ 2012-12-10 17:24   ` Paul Walmsley
  0 siblings, 0 replies; 40+ messages in thread
From: Paul Walmsley @ 2012-12-10 17:24 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, sameo, tony, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

On Mon, 10 Dec 2012, Roger Quadros wrote:

> We don't need multiple aliases for the OMAP USB host clocks and neither
> the dummy clocks so remove them.
> 
> CC: Paul Walmsley <paul@pwsan.com>
> CC: Rajendra Nayak <rnayak@ti.com>
> CC: Benoit Cousson <b-cousson@ti.com>
> CC: Mike Turquette <mturquette@gmail.com>
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Acked-by: Paul Walmsley <paul@pwsan.com>


- Paul

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

* Re: [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases
  2012-12-10 10:20 ` [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases Roger Quadros
@ 2012-12-10 17:26   ` Paul Walmsley
  0 siblings, 0 replies; 40+ messages in thread
From: Paul Walmsley @ 2012-12-10 17:26 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, sameo, tony, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

On Mon, 10 Dec 2012, Roger Quadros wrote:

> We don't need multiple aliases for the OMAP USB host clocks so remove them.
> 
> CC: Paul Walmsley <paul@pwsan.com>
> CC: Rajendra Nayak <rnayak@ti.com>
> CC: Benoit Cousson <b-cousson@ti.com>
> CC: Mike Turquette <mturquette@gmail.com>
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Acked-by: Paul Walmsley <paul@pwsan.com>


- Paul

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

* Re: [PATCH v4 00/23] OMAP USB Host cleanup
  2012-12-13 10:44 ` [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
@ 2012-12-13 10:40   ` Felipe Balbi
  0 siblings, 0 replies; 40+ messages in thread
From: Felipe Balbi @ 2012-12-13 10:40 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, sameo, tony, paul, keshava_mgowda, sshtylyov, bjorn,
	linux-usb, linux-omap, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Hi,

On Thu, Dec 13, 2012 at 12:44:22PM +0200, Roger Quadros wrote:
> Hi Samuel & Felipe,
> 
> How can we proceed with this patchset?
> 
> You can use the below pull request.

there are patches under arch/arm/ which need Tony's Acked-by, if we get
those, then sure, go ahead ;-)

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH v4 00/23] OMAP USB Host cleanup
  2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
                   ` (22 preceding siblings ...)
  2012-12-10 10:20 ` [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure Roger Quadros
@ 2012-12-13 10:44 ` Roger Quadros
  2012-12-13 10:40   ` Felipe Balbi
  23 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-13 10:44 UTC (permalink / raw)
  To: balbi, sameo
  Cc: Roger Quadros, tony, paul, keshava_mgowda, sshtylyov, bjorn,
	linux-usb, linux-omap, linux-arm-kernel, linux-kernel

Hi Samuel & Felipe,

How can we proceed with this patchset?

You can use the below pull request.

The following changes since commit 47f46768d3a3866bff7164649dab499bf5d8ed81:

  Merge branch 'next/soc' into for-next (2012-12-07 16:35:14 -0800)

are available in the git repository at:

  git@github.com:rogerq/linux.git arm-for-next-usbhost6


It is known to fix the following warnings on arm-soc/for-next

[    1.608428] WARNING: at drivers/clk/clk.c:512 __clk_enable+0x94/0xa0()
[    0.608428] Modules linked in:
[    0.608459] [<c001b254>] (unwind_backtrace+0x0/0xf0) from
[<c003fdd4>] (warn_slowpath_common+0x4c/0x64)
[    0.608459] [<c003fdd4>] (warn_slowpath_common+0x4c/0x64) from
[<c003fe08>] (warn_slowpath_null+0x1c/0x24)
[    0.608489] [<c003fe08>] (warn_slowpath_null+0x1c/0x24) from
[<c03f05d8>] (__clk_enable+0x94/0xa0)
[    0.608489] [<c03f05d8>] (__clk_enable+0x94/0xa0) from [<c03f0604>]
(clk_enable+0x20/0x3c)
[    0.608520] [<c03f0604>] (clk_enable+0x20/0x3c) from [<c031f480>]
(usbhs_runtime_resume+0x68/0xa4)
[    0.608520] [<c031f480>] (usbhs_runtime_resume+0x68/0xa4) from
[<c030c9a0>] (pm_generic_runtime_resume+0x2c/0x38)
[    0.608551] [<c030c9a0>] (pm_generic_runtime_resume+0x2c/0x38) from
[<c0310134>] (__rpm_callback+0x2c/0x60)
[    0.608581] [<c0310134>] (__rpm_callback+0x2c/0x60) from [<c0311060>]
(rpm_resume+0x39c/0x60c)
[    0.608581] [<c0311060>] (rpm_resume+0x39c/0x60c) from [<c0311538>]
(__pm_runtime_resume+0x48/0x60)
[    0.608612] [<c0311538>] (__pm_runtime_resume+0x48/0x60) from
[<c04b8260>] (usbhs_omap_probe+0x3a8/0x858)
[    0.608612] [<c04b8260>] (usbhs_omap_probe+0x3a8/0x858) from
[<c0309c70>] (platform_drv_probe+0x18/0x1c)
[    0.608642] [<c0309c70>] (platform_drv_probe+0x18/0x1c) from
[<c03089f4>] (driver_probe_device+0x74/0x218)
[    0.608642] [<c03089f4>] (driver_probe_device+0x74/0x218) from
[<c0308c2c>] (__driver_attach+0x94/0x98)
[    0.608673] [<c0308c2c>] (__driver_attach+0x94/0x98) from
[<c0307188>] (bus_for_each_dev+0x4c/0x80)
[    0.608673] [<c0307188>] (bus_for_each_dev+0x4c/0x80) from
[<c0308224>] (bus_add_driver+0x174/0x240)
[    0.608703] [<c0308224>] (bus_add_driver+0x174/0x240) from
[<c03090f8>] (driver_register+0x78/0x14c)
[    0.608703] [<c03090f8>] (driver_register+0x78/0x14c) from
[<c0309e5c>] (platform_driver_probe+0x18/0x9c)
[    0.608734] [<c0309e5c>] (platform_driver_probe+0x18/0x9c) from
[<c0008774>] (do_one_initcall+0xfc/0x168)
[    0.608734] [<c0008774>] (do_one_initcall+0xfc/0x168) from
[<c04b2014>] (kernel_init+0x120/0x2cc)
[    0.608764] [<c04b2014>] (kernel_init+0x120/0x2cc) from [<c00137f0>]
(ret_from_fork+0x14/0x24)
[    0.608764] ---[ end trace f627315b3f056ecc ]---
[    0.608795] ------------[ cut here ]------------
[    0.608795] WARNING: at drivers/clk/clk.c:471 clk_disable+0x20/0x34()
[    0.608825] Modules linked in:
[    0.608825] [<c001b254>] (unwind_backtrace+0x0/0xf0) from
[<c003fdd4>] (warn_slowpath_common+0x4c/0x64)
[    0.608856] [<c003fdd4>] (warn_slowpath_common+0x4c/0x64) from
[<c003fe08>] (warn_slowpath_null+0x1c/0x24)
[    0.608856] [<c003fe08>] (warn_slowpath_null+0x1c/0x24) from
[<c03f0530>] (clk_disable+0x20/0x34)
[    0.608886] [<c03f0530>] (clk_disable+0x20/0x34) from [<c031f500>]
(usbhs_runtime_suspend+0x44/0xa4)
[    0.608917] [<c031f500>] (usbhs_runtime_suspend+0x44/0xa4) from
[<c030c968>] (pm_generic_runtime_suspend+0x2c/0x38)
[    0.608917] [<c030c968>] (pm_generic_runtime_suspend+0x2c/0x38) from
[<c002b120>] (_od_runtime_suspend+0xc/0x24)
[    0.608947] [<c002b120>] (_od_runtime_suspend+0xc/0x24) from
[<c0310134>] (__rpm_callback+0x2c/0x60)
[    0.608947] [<c0310134>] (__rpm_callback+0x2c/0x60) from [<c03104a4>]
(rpm_suspend+0xf4/0x59c)
[    0.608978] [<c03104a4>] (rpm_suspend+0xf4/0x59c) from [<c03118f8>]
(__pm_runtime_suspend+0x5c/0x80)
[    0.609008] [<c03118f8>] (__pm_runtime_suspend+0x5c/0x80) from
[<c030cde0>] (pm_generic_runtime_idle+0x44/0x50)
[    0.609008] [<c030cde0>] (pm_generic_runtime_idle+0x44/0x50) from
[<c0310134>] (__rpm_callback+0x2c/0x60)
[    0.609039] [<c0310134>] (__rpm_callback+0x2c/0x60) from [<c0310aa8>]
(rpm_idle+0xf0/0x21c)
[    0.609039] [<c0310aa8>] (rpm_idle+0xf0/0x21c) from [<c0310ca0>]
(__pm_runtime_idle+0x5c/0x80)
[    0.609069] [<c0310ca0>] (__pm_runtime_idle+0x5c/0x80) from
[<c04b83c0>] (usbhs_omap_probe+0x508/0x858)
[    0.609069] [<c04b83c0>] (usbhs_omap_probe+0x508/0x858) from
[<c0309c70>] (platform_drv_probe+0x18/0x1c)
[    0.609100] [<c0309c70>] (platform_drv_probe+0x18/0x1c) from
[<c03089f4>] (driver_probe_device+0x74/0x218)
[    0.609100] [<c03089f4>] (driver_probe_device+0x74/0x218) from
[<c0308c2c>] (__driver_attach+0x94/0x98)
[    0.609130] [<c0308c2c>] (__driver_attach+0x94/0x98) from
[<c0307188>] (bus_for_each_dev+0x4c/0x80)
[    0.609130] [<c0307188>] (bus_for_each_dev+0x4c/0x80) from
[<c0308224>] (bus_add_driver+0x174/0x240)
[    0.609161] [<c0308224>] (bus_add_driver+0x174/0x240) from
[<c03090f8>] (driver_register+0x78/0x14c)
[    0.609161] [<c03090f8>] (driver_register+0x78/0x14c) from
[<c0309e5c>] (platform_driver_probe+0x18/0x9c)
[    0.609191] [<c0309e5c>] (platform_driver_probe+0x18/0x9c) from
[<c0008774>] (do_one_initcall+0xfc/0x168)
[    0.609191] [<c0008774>] (do_one_initcall+0xfc/0x168) from
[<c04b2014>] (kernel_init+0x120/0x2cc)
[    0.609222] [<c04b2014>] (kernel_init+0x120/0x2cc) from [<c00137f0>]
(ret_from_fork+0x14/0x24)
[    0.609222] ---[ end trace f627315b3f056ecd ]---


cheers,
-roger

On 12/10/2012 12:20 PM, Roger Quadros wrote:
> Hi,
> 
> This patchset addresses the following
> 
> - Avoid addressing clocks one by one by name and use a for loop + bunch
>   of cleanups.
> - Get number of channels/ports dynamically either from revision register
>   or from platform data. Avoids getting clocks that are not present.
> - Add OMAP5 and HSIC mode (Not tested)
> 
> v4:
> - Added appropriate maintainers in to/cc
> - minor print message fix in patch 23 to maintain consistency
> 
> v3:
> - Rebased on arm-soc/for-next commit f979306c4d38d213c6977aaf3b1115e8ded71e3a
> - Rearranged patch that get rids of cpu_is_omap..() macros
> - Coding style fixes
> 
> v2:
> - Clocks are allocated dynamically based on number of ports available
> on the platform
> - Reduced console spam if non critical clocks are not found on the platform.
> - Get rid of cpu_is_.. macros from USB host driver.
> 
> cheers,
> -roger
> 
> ---
> Roger Quadros (23):
>   mfd: omap-usb-host: get rid of cpu_is_omap..() macros
>   mfd: omap-usb-tll: Avoid creating copy of platform data
>   mfd: omap-usb-tll: Fix channel count detection
>   mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path
>   mfd: omap-usb-tll: Clean up clock handling
>   mfd: omap-usb-tll: introduce and use mode_needs_tll()
>   mfd: omap-usb-tll: Check for missing platform data in probe
>   mfd: omap-usb-tll: Fix error message
>   mfd: omap-usb-tll: serialize access to TLL device
>   mfd: omap-usb-tll: Add OMAP5 revision and HSIC support
>   mfd: omap_usb_host: Avoid creating copy of platform_data
>   mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap()
>   mfd: omap-usb-host: know about number of ports from revision register
>   mfd: omap-usb-host: override number of ports from platform data
>   mfd: omap-usb-host: cleanup clock management code
>   ARM: OMAP2+: clock data: Merge utmi_px_gfclk into
>     usb_host_hs_utmi_px_clk
>   mfd: omap-usb-host: Manage HSIC clocks for HSIC mode
>   mfd: omap-usb-host: Get rid of unnecessary spinlock
>   mfd: omap-usb-host: clean up omap_usbhs_init()
>   USB: ehci-omap: Don't free gpios that we didn't request
>   ARM: OMAP3: clock data: get rid of unused USB host clock aliases and
>     dummies
>   ARM: OMAP4: clock data: get rid of unused USB host clock aliases
>   mfd: omap-usb-host: Don't spam console on clk_set_parent failure
> 
>  arch/arm/mach-omap2/cclock3xxx_data.c  |   13 -
>  arch/arm/mach-omap2/cclock44xx_data.c  |   55 +++--
>  arch/arm/mach-omap2/usb-host.c         |    5 +
>  arch/arm/mach-omap2/usb.h              |    1 +
>  drivers/mfd/omap-usb-host.c            |  474 ++++++++++++++++++--------------
>  drivers/mfd/omap-usb-tll.c             |  244 +++++++++--------
>  drivers/usb/host/ehci-omap.c           |    8 -
>  include/linux/platform_data/usb-omap.h |    4 +
>  8 files changed, 451 insertions(+), 353 deletions(-)
> 


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

* Re: [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros
  2012-12-10 10:20 ` [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros Roger Quadros
@ 2012-12-13 21:49   ` Tony Lindgren
  2012-12-14  0:54     ` Samuel Ortiz
  0 siblings, 1 reply; 40+ messages in thread
From: Tony Lindgren @ 2012-12-13 21:49 UTC (permalink / raw)
  To: sameo
  Cc: balbi, sameo, paul, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Roger Quadros

Hi Samuel,

* Roger Quadros <rogerq@ti.com> [121210 02:23]:
> Instead of using cpu_is_omap..() macros in the device driver we
> rely on information provided in the platform data.
> 
> The only information we need is whether the USB Host module has
> a single ULPI bypass control bit for all ports or individual bypass
> control bits for each port. OMAP3 REV2.1 and earlier have the former.

I'd like to apply this patch as a fix so I can finally nuke plat/cpu.h
for omaps by -rc1 before more drivers start using it again.

That is assuming nobody else is planning on merging this series for
v3.8 presumably. Want to ack this one?

Regards,

Tony


> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> CC: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/usb-host.c         |    4 ++++
>  drivers/mfd/omap-usb-host.c            |    2 +-
>  include/linux/platform_data/usb-omap.h |    3 +++
>  3 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
> index d1dbe12..2e44e8a 100644
> --- a/arch/arm/mach-omap2/usb-host.c
> +++ b/arch/arm/mach-omap2/usb-host.c
> @@ -508,6 +508,10 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  	if (cpu_is_omap34xx()) {
>  		setup_ehci_io_mux(pdata->port_mode);
>  		setup_ohci_io_mux(pdata->port_mode);
> +
> +		if (omap_rev() <= OMAP3430_REV_ES2_1)
> +			usbhs_data.single_ulpi_bypass = true;
> +
>  	} else if (cpu_is_omap44xx()) {
>  		setup_4430ehci_io_mux(pdata->port_mode);
>  		setup_4430ohci_io_mux(pdata->port_mode);
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index cebfe0a..fe7906b 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -384,7 +384,7 @@ static void omap_usbhs_init(struct device *dev)
>  			reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS;
>  
>  		/* Bypass the TLL module for PHY mode operation */
> -		if (cpu_is_omap3430() && (omap_rev() <= OMAP3430_REV_ES2_1)) {
> +		if (pdata->single_ulpi_bypass) {
>  			dev_dbg(dev, "OMAP3 ES version <= ES2.1\n");
>  			if (is_ehci_phy_mode(pdata->port_mode[0]) ||
>  				is_ehci_phy_mode(pdata->port_mode[1]) ||
> diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
> index 8570bcf..ef65b67 100644
> --- a/include/linux/platform_data/usb-omap.h
> +++ b/include/linux/platform_data/usb-omap.h
> @@ -59,6 +59,9 @@ struct usbhs_omap_platform_data {
>  
>  	struct ehci_hcd_omap_platform_data	*ehci_data;
>  	struct ohci_hcd_omap_platform_data	*ohci_data;
> +
> +	/* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
> +	unsigned				single_ulpi_bypass:1;
>  };
>  
>  /*-------------------------------------------------------------------------*/
> -- 
> 1.7.4.1
> 

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

* Re: [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros
  2012-12-13 21:49   ` Tony Lindgren
@ 2012-12-14  0:54     ` Samuel Ortiz
  2012-12-14 18:30       ` Tony Lindgren
  0 siblings, 1 reply; 40+ messages in thread
From: Samuel Ortiz @ 2012-12-14  0:54 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: balbi, paul, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Roger Quadros

Hi Tony,

On Thu, Dec 13, 2012 at 01:49:49PM -0800, Tony Lindgren wrote:
> Hi Samuel,
> 
> * Roger Quadros <rogerq@ti.com> [121210 02:23]:
> > Instead of using cpu_is_omap..() macros in the device driver we
> > rely on information provided in the platform data.
> > 
> > The only information we need is whether the USB Host module has
> > a single ULPI bypass control bit for all ports or individual bypass
> > control bits for each port. OMAP3 REV2.1 and earlier have the former.
> 
> I'd like to apply this patch as a fix so I can finally nuke plat/cpu.h
> for omaps by -rc1 before more drivers start using it again.
> 
> That is assuming nobody else is planning on merging this series for
> v3.8 presumably. 
This should go into 3.9, yes.


> Want to ack this one?
Looks fine to me:
Acked-by: Samuel Ortiz <sameo@linux.intel.com>

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-10 10:20 ` [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk Roger Quadros
@ 2012-12-14 18:28   ` Tony Lindgren
  2012-12-14 18:44     ` Paul Walmsley
  0 siblings, 1 reply; 40+ messages in thread
From: Tony Lindgren @ 2012-12-14 18:28 UTC (permalink / raw)
  To: Roger Quadros
  Cc: balbi, sameo, paul, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Benoit Cousson, Mike Turquette

* Roger Quadros <rogerq@ti.com> [121210 02:23]:
> There is no such clock as utmi_p1_gfclk. It is only a clock selector
> bit to select th the parent of usb_host_hs_utmi_p1_clk.
> So we get rid of utmi_p1_gfclk and utmi_p2_gfclk by merging them into
> usb_host_hs_utmi_p1_clk and usb_host_hs_utmi_p2_clk respectively.
> 
> CC: Paul Walmsley <paul@pwsan.com>
> CC: Rajendra Nayak <rnayak@ti.com>
> CC: Benoit Cousson <b-cousson@ti.com>
> CC: Mike Turquette <mturquette@gmail.com>

Paul, what about this patch? Looks like you've acked the other
clock patches in this series but not this one?

Regards,

Tony
 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  arch/arm/mach-omap2/cclock3xxx_data.c |    2 -
>  arch/arm/mach-omap2/cclock44xx_data.c |   47 +++++++++++++++++++++++----------
>  2 files changed, 33 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
> index bdf3948..5655414 100644
> --- a/arch/arm/mach-omap2/cclock3xxx_data.c
> +++ b/arch/arm/mach-omap2/cclock3xxx_data.c
> @@ -3392,8 +3392,6 @@ static struct omap_clk omap3xxx_clks[] = {
>  	CLK(NULL,	"usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
>  	CLK(NULL,	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
>  	CLK("usbhs_omap",	"usbhost_ick",	&usbhost_ick,	CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
> -	CLK(NULL,	"utmi_p1_gfclk",	&dummy_ck,	CK_3XXX),
> -	CLK(NULL,	"utmi_p2_gfclk",	&dummy_ck,	CK_3XXX),
>  	CLK(NULL,	"xclk60mhsp1_ck",	&dummy_ck,	CK_3XXX),
>  	CLK(NULL,	"xclk60mhsp2_ck",	&dummy_ck,	CK_3XXX),
>  	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&dummy_ck,	CK_3XXX),
> diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
> index aa56c3e..74535fe 100644
> --- a/arch/arm/mach-omap2/cclock44xx_data.c
> +++ b/arch/arm/mach-omap2/cclock44xx_data.c
> @@ -1366,31 +1366,52 @@ static struct clk_hw_omap usb_host_fs_fck_hw = {
>  DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
>  		  usb_host_fs_fck_ops);
>  
> +static const struct clk_ops utmi_clk_ops = {
> +	.enable		= &omap2_dflt_clk_enable,
> +	.disable	= &omap2_dflt_clk_disable,
> +	.is_enabled	= &omap2_dflt_clk_is_enabled,
> +	.recalc_rate	= &omap2_clksel_recalc,
> +	.get_parent	= &omap2_clksel_find_parent_index,
> +	.set_parent	= &omap2_clksel_set_parent,
> +};
> +
>  static const char *utmi_p1_gfclk_parents[] = {
>  	"init_60m_fclk", "xclk60mhsp1_ck",
>  };
>  
> -DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
> -	       OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> -	       OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
> -	       0x0, NULL);
> +static const struct clksel utmi_p1_clk_mux_sel[] = {
> +	{ .parent = &init_60m_fclk, .rates = div_1_0_rates },
> +	{ .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
> +	{ .parent = NULL },
> +};
>  
> -DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
> +/* Merged utmi_p1_gfclk into usb_host_hs_utmi_p1_clk */
> +DEFINE_CLK_OMAP_MUX_GATE(usb_host_hs_utmi_p1_clk, "l3_init_clkdm",
> +		utmi_p1_clk_mux_sel,
> +		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> +		OMAP4430_CLKSEL_UTMI_P1_MASK,
>  		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> -		OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
> +		OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, NULL,
> +		utmi_p1_gfclk_parents, utmi_clk_ops);
>  
>  static const char *utmi_p2_gfclk_parents[] = {
>  	"init_60m_fclk", "xclk60mhsp2_ck",
>  };
>  
> -DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
> -	       OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> -	       OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
> -	       0x0, NULL);
> +static const struct clksel utmi_p2_clk_mux_sel[] = {
> +	{ .parent = &init_60m_fclk, .rates = div_1_0_rates },
> +	{ .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
> +	{ .parent = NULL },
> +};
>  
> -DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
> +/* Merged utmi_p2_gfclk into usb_host_hs_utmi_p2_clk */
> +DEFINE_CLK_OMAP_MUX_GATE(usb_host_hs_utmi_p2_clk, "l3_init_clkdm",
> +		utmi_p2_clk_mux_sel,
> +		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> +		OMAP4430_CLKSEL_UTMI_P2_MASK,
>  		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> -		OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
> +		OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, NULL,
> +		utmi_p2_gfclk_parents, utmi_clk_ops);
>  
>  DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
>  		OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
> @@ -1838,9 +1859,7 @@ static struct omap_clk omap44xx_clks[] = {
>  	CLK(NULL,	"uart4_fck",			&uart4_fck,	CK_443X),
>  	CLK(NULL,	"usb_host_fs_fck",		&usb_host_fs_fck,	CK_443X),
>  	CLK("usbhs_omap",	"fs_fck",		&usb_host_fs_fck,	CK_443X),
> -	CLK(NULL,	"utmi_p1_gfclk",		&utmi_p1_gfclk,	CK_443X),
>  	CLK(NULL,	"usb_host_hs_utmi_p1_clk",	&usb_host_hs_utmi_p1_clk,	CK_443X),
> -	CLK(NULL,	"utmi_p2_gfclk",		&utmi_p2_gfclk,	CK_443X),
>  	CLK(NULL,	"usb_host_hs_utmi_p2_clk",	&usb_host_hs_utmi_p2_clk,	CK_443X),
>  	CLK(NULL,	"usb_host_hs_utmi_p3_clk",	&usb_host_hs_utmi_p3_clk,	CK_443X),
>  	CLK(NULL,	"usb_host_hs_hsic480m_p1_clk",	&usb_host_hs_hsic480m_p1_clk,	CK_443X),
> -- 
> 1.7.4.1
> 

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

* Re: [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros
  2012-12-14  0:54     ` Samuel Ortiz
@ 2012-12-14 18:30       ` Tony Lindgren
  0 siblings, 0 replies; 40+ messages in thread
From: Tony Lindgren @ 2012-12-14 18:30 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: balbi, paul, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Roger Quadros

* Samuel Ortiz <sameo@linux.intel.com> [121213 16:57]:
> Hi Tony,
> 
> On Thu, Dec 13, 2012 at 01:49:49PM -0800, Tony Lindgren wrote:
> > Hi Samuel,
> > 
> > * Roger Quadros <rogerq@ti.com> [121210 02:23]:
> > > Instead of using cpu_is_omap..() macros in the device driver we
> > > rely on information provided in the platform data.
> > > 
> > > The only information we need is whether the USB Host module has
> > > a single ULPI bypass control bit for all ports or individual bypass
> > > control bits for each port. OMAP3 REV2.1 and earlier have the former.
> > 
> > I'd like to apply this patch as a fix so I can finally nuke plat/cpu.h
> > for omaps by -rc1 before more drivers start using it again.
> > 
> > That is assuming nobody else is planning on merging this series for
> > v3.8 presumably. 
> This should go into 3.9, yes.

OK looks like you have all the necessary acks except for one
clock change. I replied to that one. 
 
> > Want to ack this one?
> Looks fine to me:
> Acked-by: Samuel Ortiz <sameo@linux.intel.com>

Thanks, I'll queue that one and then after -rc1 hopefully
you have all the necessary acks to queue this one via your
mfd tree.

Regards,

Tony

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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-14 18:28   ` Tony Lindgren
@ 2012-12-14 18:44     ` Paul Walmsley
  2012-12-17  8:13       ` Benoit Cousson
  0 siblings, 1 reply; 40+ messages in thread
From: Paul Walmsley @ 2012-12-14 18:44 UTC (permalink / raw)
  To: Tony Lindgren, Roger Quadros, Benoit Cousson
  Cc: balbi, sameo, keshava_mgowda, sshtylyov, bjorn, linux-usb,
	linux-omap, linux-arm-kernel, linux-kernel, Rajendra Nayak,
	Mike Turquette

[-- Attachment #1: Type: TEXT/PLAIN, Size: 635 bytes --]

Hi

On Fri, 14 Dec 2012, Tony Lindgren wrote:

> Paul, what about this patch? Looks like you've acked the other clock 
> patches in this series but not this one?

I commented on it briefly here:

https://patchwork.kernel.org/patch/1838111/

Maybe Benoît could comment here, but it looks to me (based on a 
superficial look at the hardware clock tree data) that these clock nodes 
should exist.  In an ideal world, we'd be able to get back to the 
autogeneration of this clock data.

Roger, is it a requirement for the driver to remove these clock nodes, or 
is it possible to stick with the existing nodes?


- Paul

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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-14 18:44     ` Paul Walmsley
@ 2012-12-17  8:13       ` Benoit Cousson
  2012-12-17 16:13         ` Roger Quadros
  0 siblings, 1 reply; 40+ messages in thread
From: Benoit Cousson @ 2012-12-17  8:13 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: Tony Lindgren, Roger Quadros, balbi, sameo, keshava_mgowda,
	sshtylyov, bjorn, linux-usb, linux-omap, linux-arm-kernel,
	linux-kernel, Rajendra Nayak, Mike Turquette

Hi,

On 12/14/2012 07:44 PM, Paul Walmsley wrote:
> Hi
> 
> On Fri, 14 Dec 2012, Tony Lindgren wrote:
> 
>> Paul, what about this patch? Looks like you've acked the other clock 
>> patches in this series but not this one?
> 
> I commented on it briefly here:
> 
> https://patchwork.kernel.org/patch/1838111/
> 
> Maybe Benoît could comment here, but it looks to me (based on a 
> superficial look at the hardware clock tree data) that these clock nodes 
> should exist.  In an ideal world, we'd be able to get back to the 
> autogeneration of this clock data.

I'm not sure to understand either the rational for that patch. What the
point of merging the two nodes?
I mean, we can do it, but AFAIR, we have always decided to use atomic
node instead of big nodes that handle everything.

Regards,
Benoit


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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-17  8:13       ` Benoit Cousson
@ 2012-12-17 16:13         ` Roger Quadros
  2012-12-17 16:27           ` Benoit Cousson
  0 siblings, 1 reply; 40+ messages in thread
From: Roger Quadros @ 2012-12-17 16:13 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: Paul Walmsley, Tony Lindgren, balbi, sameo, keshava_mgowda,
	sshtylyov, bjorn, linux-usb, linux-omap, linux-arm-kernel,
	linux-kernel, Rajendra Nayak, Mike Turquette

On 12/17/2012 10:13 AM, Benoit Cousson wrote:
> Hi,
> 
> On 12/14/2012 07:44 PM, Paul Walmsley wrote:
>> Hi
>>
>> On Fri, 14 Dec 2012, Tony Lindgren wrote:
>>
>>> Paul, what about this patch? Looks like you've acked the other clock 
>>> patches in this series but not this one?
>>
>> I commented on it briefly here:
>>
>> https://patchwork.kernel.org/patch/1838111/
>>
>> Maybe Benoît could comment here, but it looks to me (based on a 
>> superficial look at the hardware clock tree data) that these clock nodes 
>> should exist.  In an ideal world, we'd be able to get back to the 
>> autogeneration of this clock data.
> 
> I'm not sure to understand either the rational for that patch. What the
> point of merging the two nodes?
> I mean, we can do it, but AFAIR, we have always decided to use atomic
> node instead of big nodes that handle everything.
>

I can see a similar thing done for mcbsp clocks (e.g. /* Merged
func_mcbsp1_gfclk into mcbsp1 */), mmc clocks, timer clocks, mcasp
clock, and sgx clock. i.e. The clock sel (mux) is combined with clock
gate. I don't see why USB host has to be done differently.

Were exceptions made for the above clocks in the auto generation code?

The problem from driver point of view is that it has to manage an
additional clock per port. Not a big deal, but I thought it could be
avoided.

regards,
-roger



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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-17 16:13         ` Roger Quadros
@ 2012-12-17 16:27           ` Benoit Cousson
  2012-12-17 21:03             ` Paul Walmsley
  0 siblings, 1 reply; 40+ messages in thread
From: Benoit Cousson @ 2012-12-17 16:27 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Paul Walmsley, Tony Lindgren, balbi, sameo, keshava_mgowda,
	sshtylyov, bjorn, linux-usb, linux-omap, linux-arm-kernel,
	linux-kernel, Rajendra Nayak, Mike Turquette

On 12/17/2012 05:13 PM, Roger Quadros wrote:
> On 12/17/2012 10:13 AM, Benoit Cousson wrote:
>> Hi,
>>
>> On 12/14/2012 07:44 PM, Paul Walmsley wrote:
>>> Hi
>>>
>>> On Fri, 14 Dec 2012, Tony Lindgren wrote:
>>>
>>>> Paul, what about this patch? Looks like you've acked the other clock 
>>>> patches in this series but not this one?
>>>
>>> I commented on it briefly here:
>>>
>>> https://patchwork.kernel.org/patch/1838111/
>>>
>>> Maybe Benoît could comment here, but it looks to me (based on a 
>>> superficial look at the hardware clock tree data) that these clock nodes 
>>> should exist.  In an ideal world, we'd be able to get back to the 
>>> autogeneration of this clock data.
>>
>> I'm not sure to understand either the rational for that patch. What the
>> point of merging the two nodes?
>> I mean, we can do it, but AFAIR, we have always decided to use atomic
>> node instead of big nodes that handle everything.
>>
> 
> I can see a similar thing done for mcbsp clocks (e.g. /* Merged
> func_mcbsp1_gfclk into mcbsp1 */), mmc clocks, timer clocks, mcasp
> clock, and sgx clock. i.e. The clock sel (mux) is combined with clock
> gate. I don't see why USB host has to be done differently.

Hehe, well, in fact USB is using the right approach, the others are the
exceptions :-)

It was done for legacy reason but should disappear once the modulemode
will be be removed from the clock nodes.

> Were exceptions made for the above clocks in the auto generation code?
> 
> The problem from driver point of view is that it has to manage an
> additional clock per port. Not a big deal, but I thought it could be
> avoided.

In theory, the driver should just managed the mux. The modulemode being
managed already by hwmod.

Regards,
Benoit


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

* Re: [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk
  2012-12-17 16:27           ` Benoit Cousson
@ 2012-12-17 21:03             ` Paul Walmsley
  0 siblings, 0 replies; 40+ messages in thread
From: Paul Walmsley @ 2012-12-17 21:03 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: Roger Quadros, Tony Lindgren, balbi, sameo, keshava_mgowda,
	sshtylyov, bjorn, linux-usb, linux-omap, linux-arm-kernel,
	linux-kernel, Rajendra Nayak, Mike Turquette

On Mon, 17 Dec 2012, Benoit Cousson wrote:

> It was done for legacy reason but should disappear once the modulemode
> will be be removed from the clock nodes.

Here's a start at taking care of the low-hanging fruit:

http://marc.info/?l=linux-omap&m=135577685007813&w=2

Only lightly tested, so tests with Kconfigs with lots of OMAP drivers 
enabled would be appreciated.


- Paul

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

end of thread, other threads:[~2012-12-17 21:03 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-10 10:20 [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
2012-12-10 10:20 ` [PATCH v4 01/23] mfd: omap-usb-host: get rid of cpu_is_omap..() macros Roger Quadros
2012-12-13 21:49   ` Tony Lindgren
2012-12-14  0:54     ` Samuel Ortiz
2012-12-14 18:30       ` Tony Lindgren
2012-12-10 10:20 ` [PATCH v4 02/23] mfd: omap-usb-tll: Avoid creating copy of platform data Roger Quadros
2012-12-10 10:20 ` [PATCH v4 03/23] mfd: omap-usb-tll: Fix channel count detection Roger Quadros
2012-12-10 10:20 ` [PATCH v4 04/23] mfd: omap-usb-tll: Use devm_kzalloc/ioremap and clean up error path Roger Quadros
2012-12-10 10:20 ` [PATCH v4 05/23] mfd: omap-usb-tll: Clean up clock handling Roger Quadros
2012-12-10 10:20 ` [PATCH v4 06/23] mfd: omap-usb-tll: introduce and use mode_needs_tll() Roger Quadros
2012-12-10 10:20 ` [PATCH v4 07/23] mfd: omap-usb-tll: Check for missing platform data in probe Roger Quadros
2012-12-10 10:20 ` [PATCH v4 08/23] mfd: omap-usb-tll: Fix error message Roger Quadros
2012-12-10 10:20 ` [PATCH v4 09/23] mfd: omap-usb-tll: serialize access to TLL device Roger Quadros
2012-12-10 10:20 ` [PATCH v4 10/23] mfd: omap-usb-tll: Add OMAP5 revision and HSIC support Roger Quadros
2012-12-10 10:20 ` [PATCH v4 11/23] mfd: omap_usb_host: Avoid creating copy of platform_data Roger Quadros
2012-12-10 10:20 ` [PATCH v4 12/23] mfd: omap-usb-host: Use devm_kzalloc() and devm_request_and_ioremap() Roger Quadros
2012-12-10 10:20 ` [PATCH v4 13/23] mfd: omap-usb-host: know about number of ports from revision register Roger Quadros
2012-12-10 10:20 ` [PATCH v4 14/23] mfd: omap-usb-host: override number of ports from platform data Roger Quadros
2012-12-10 10:20 ` [PATCH v4 15/23] mfd: omap-usb-host: cleanup clock management code Roger Quadros
2012-12-10 10:20 ` [PATCH v4 16/23] ARM: OMAP2+: clock data: Merge utmi_px_gfclk into usb_host_hs_utmi_px_clk Roger Quadros
2012-12-14 18:28   ` Tony Lindgren
2012-12-14 18:44     ` Paul Walmsley
2012-12-17  8:13       ` Benoit Cousson
2012-12-17 16:13         ` Roger Quadros
2012-12-17 16:27           ` Benoit Cousson
2012-12-17 21:03             ` Paul Walmsley
2012-12-10 10:20 ` [PATCH v4 17/23] mfd: omap-usb-host: Manage HSIC clocks for HSIC mode Roger Quadros
2012-12-10 10:20 ` [PATCH v4 18/23] mfd: omap-usb-host: Get rid of unnecessary spinlock Roger Quadros
2012-12-10 10:20 ` [PATCH v4 19/23] mfd: omap-usb-host: clean up omap_usbhs_init() Roger Quadros
2012-12-10 10:20 ` [PATCH v4 20/23] USB: ehci-omap: Don't free gpios that we didn't request Roger Quadros
2012-12-10 10:20 ` [PATCH v4 21/23] ARM: OMAP3: clock data: get rid of unused USB host clock aliases and dummies Roger Quadros
2012-12-10 17:24   ` Paul Walmsley
2012-12-10 10:20 ` [PATCH v4 22/23] ARM: OMAP4: clock data: get rid of unused USB host clock aliases Roger Quadros
2012-12-10 17:26   ` Paul Walmsley
2012-12-10 10:20 ` [PATCH v4 23/23] mfd: omap-usb-host: Don't spam console on clk_set_parent failure Roger Quadros
2012-12-10 11:24   ` Rajendra Nayak
2012-12-10 11:31     ` Roger Quadros
2012-12-10 14:38       ` Felipe Balbi
2012-12-13 10:44 ` [PATCH v4 00/23] OMAP USB Host cleanup Roger Quadros
2012-12-13 10:40   ` Felipe Balbi

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