All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform
@ 2013-05-23  6:01 Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 1/9] usb: musb: dsps: enable dual instance support for am33xx platform Ravi Babu
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

This patch set series
        - adds dual musb instances support for am335x platform
        - adds phy-dsps-usb driver based on TI's gs70 driver
        - adds DT bindings for am33xx usb-phy
	- removed references to usb-nop-xceiv from musb

has been verified on tree [1]

[1] git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git

Ravi Babu (9):
  usb: musb: dsps: enable dual instance support for am33xx platform
  usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  arch: arm: omap3: remove unused usb_nop_xceive register API's
  usb: phy: nop: removing unused usb_nop_xceiv_(un_)register API
  usb: phy: dsps: adding usbphy driver for am33xx platform
  usb: musb: dsps: use usb-phy driver API for phy power on/off
  usb: musb: dsps: use get-usb-phy by phandle for multi instance
  usb: phy: dts: Adding usbphy DT bindings for am33xx
  usb: musb: dsp: remove the usb-phy control acess from platform glue

 arch/arm/boot/dts/am33xx.dtsi        |   17 +++
 arch/arm/mach-omap2/board-omap3evm.c |    3 -
 drivers/usb/musb/am35x.c             |    2 -
 drivers/usb/musb/blackfin.c          |    2 -
 drivers/usb/musb/da8xx.c             |    2 -
 drivers/usb/musb/davinci.c           |    3 -
 drivers/usb/musb/musb_dsps.c         |   85 +++----------
 drivers/usb/musb/tusb6010.c          |    3 -
 drivers/usb/phy/Kconfig              |    9 ++
 drivers/usb/phy/Makefile             |    1 +
 drivers/usb/phy/phy-dsps-usb.c       |  236 ++++++++++++++++++++++++++++++++++
 drivers/usb/phy/phy-nop.c            |   21 ---
 include/linux/usb/nop-usb-xceiv.h    |   14 --
 13 files changed, 282 insertions(+), 116 deletions(-)
 create mode 100644 drivers/usb/phy/phy-dsps-usb.c


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

* [PATCH v1 1/9] usb: musb: dsps: enable dual instance support for am33xx platform
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue Ravi Babu
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

The dsps am33xx platform has two instances of musb controller,
enable the support for dual musb instances

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/musb_dsps.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 3a18e44..590dd0b 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -746,7 +746,7 @@ static const struct dsps_musb_wrapper ti81xx_driver_data = {
 	.rxep_bitmap		= (0xfffe << 16),
 	.musb_core_offset	= 0x400,
 	.poll_seconds		= 2,
-	.instances		= 1,
+	.instances		= 2,
 };
 
 static const struct platform_device_id musb_dsps_id_table[] = {
-- 
1.7.0.4


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

* [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 1/9] usb: musb: dsps: enable dual instance support for am33xx platform Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23 14:22   ` Sergei Shtylyov
  2013-05-23  6:01 ` [PATCH v1 3/9] arch: arm: omap3: remove unused usb_nop_xceive register API's Ravi Babu
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

removed unused nop xceiv (un_)register API's from all musb
platform drivers

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/am35x.c     |    2 --
 drivers/usb/musb/blackfin.c  |    2 --
 drivers/usb/musb/da8xx.c     |    2 --
 drivers/usb/musb/davinci.c   |    3 ---
 drivers/usb/musb/musb_dsps.c |    3 ---
 drivers/usb/musb/tusb6010.c  |    3 ---
 6 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 2231850..1074c5e 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -362,7 +362,6 @@ static int am35x_musb_init(struct musb *musb)
 	if (!rev)
 		return -ENODEV;
 
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv))
 		return -EPROBE_DEFER;
@@ -404,7 +403,6 @@ static int am35x_musb_exit(struct musb *musb)
 		data->set_phy_power(0);
 
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 
 	return 0;
 }
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 5e63b16..8e338d4 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -402,7 +402,6 @@ static int bfin_musb_init(struct musb *musb)
 	}
 	gpio_direction_output(musb->config->gpio_vrsel, 0);
 
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv)) {
 		gpio_free(musb->config->gpio_vrsel);
@@ -427,7 +426,6 @@ static int bfin_musb_exit(struct musb *musb)
 	gpio_free(musb->config->gpio_vrsel);
 
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 	return 0;
 }
 
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index ea7e591..11dcb6c 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -419,7 +419,6 @@ static int da8xx_musb_init(struct musb *musb)
 	if (!rev)
 		goto fail;
 
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv)) {
 		ret = -EPROBE_DEFER;
@@ -454,7 +453,6 @@ static int da8xx_musb_exit(struct musb *musb)
 	phy_off();
 
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 
 	return 0;
 }
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index bea6cc3..94bc1fe 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -382,7 +382,6 @@ static int davinci_musb_init(struct musb *musb)
 	u32		revision;
 	int 		ret = -ENODEV;
 
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv)) {
 		ret = -EPROBE_DEFER;
@@ -440,7 +439,6 @@ static int davinci_musb_init(struct musb *musb)
 fail:
 	usb_put_phy(musb->xceiv);
 unregister:
-	usb_nop_xceiv_unregister();
 	return ret;
 }
 
@@ -488,7 +486,6 @@ static int davinci_musb_exit(struct musb *musb)
 	phy_off();
 
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 
 	return 0;
 }
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 590dd0b..14067a1 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -416,7 +416,6 @@ static int dsps_musb_init(struct musb *musb)
 	musb->mregs += wrp->musb_core_offset;
 
 	/* NOP driver needs change if supporting dual instance */
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv))
 		return -EPROBE_DEFER;
@@ -449,7 +448,6 @@ static int dsps_musb_init(struct musb *musb)
 	return 0;
 err0:
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 	return status;
 }
 
@@ -466,7 +464,6 @@ static int dsps_musb_exit(struct musb *musb)
 
 	/* NOP driver needs change if supporting dual instance */
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 
 	return 0;
 }
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 7369ba3..2810d2b 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1066,7 +1066,6 @@ static int tusb_musb_init(struct musb *musb)
 	void __iomem		*sync = NULL;
 	int			ret;
 
-	usb_nop_xceiv_register();
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 	if (IS_ERR_OR_NULL(musb->xceiv))
 		return -EPROBE_DEFER;
@@ -1118,7 +1117,6 @@ done:
 			iounmap(sync);
 
 		usb_put_phy(musb->xceiv);
-		usb_nop_xceiv_unregister();
 	}
 	return ret;
 }
@@ -1134,7 +1132,6 @@ static int tusb_musb_exit(struct musb *musb)
 	iounmap(musb->sync_va);
 
 	usb_put_phy(musb->xceiv);
-	usb_nop_xceiv_unregister();
 	return 0;
 }
 
-- 
1.7.0.4


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

* [PATCH v1 3/9] arch: arm: omap3: remove unused usb_nop_xceive register API's
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 1/9] usb: musb: dsps: enable dual instance support for am33xx platform Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 4/9] usb: phy: nop: removing unused usb_nop_xceiv_(un_)register API Ravi Babu
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

Remove the unused usb_nop_xceiv register(_unregister) usage,
it is recommeded to use DT bindings to use usb-nop-xceiv driver

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 arch/arm/mach-omap2/board-omap3evm.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 48789e0..aa7e515 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -711,9 +711,6 @@ static void __init omap3_evm_init(void)
 	omap_serial_init();
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
 
-	/* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
-	usb_nop_xceiv_register();
-
 	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 		/* enable EHCI VBUS using GPIO22 */
 		omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
-- 
1.7.0.4


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

* [PATCH v1 4/9] usb: phy: nop: removing unused usb_nop_xceiv_(un_)register API
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (2 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 3/9] arch: arm: omap3: remove unused usb_nop_xceive register API's Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 5/9] usb: phy: dsps: adding usbphy driver for am33xx platform Ravi Babu
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

remove the unused the usb_nop_xceiv_register & _unregister API's
from phy-nop driver. The glue platform driver should use DT bindings
use usb-nop-xceiv driver

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/musb_dsps.c      |    1 -
 drivers/usb/phy/phy-nop.c         |   21 ---------------------
 include/linux/usb/nop-usb-xceiv.h |   14 --------------
 3 files changed, 0 insertions(+), 36 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 14067a1..0ecedb3 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -36,7 +36,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
 #include <linux/module.h>
-#include <linux/usb/nop-usb-xceiv.h>
 #include <linux/platform_data/usb-omap.h>
 #include <linux/sizes.h>
 
diff --git a/drivers/usb/phy/phy-nop.c b/drivers/usb/phy/phy-nop.c
index 2b10cc9..52d3fdd 100644
--- a/drivers/usb/phy/phy-nop.c
+++ b/drivers/usb/phy/phy-nop.c
@@ -44,27 +44,6 @@ struct nop_usb_xceiv {
 	struct regulator *reset;
 };
 
-static struct platform_device *pd;
-
-void usb_nop_xceiv_register(void)
-{
-	if (pd)
-		return;
-	pd = platform_device_register_simple("nop_usb_xceiv", -1, NULL, 0);
-	if (!pd) {
-		printk(KERN_ERR "Unable to register usb nop transceiver\n");
-		return;
-	}
-}
-EXPORT_SYMBOL(usb_nop_xceiv_register);
-
-void usb_nop_xceiv_unregister(void)
-{
-	platform_device_unregister(pd);
-	pd = NULL;
-}
-EXPORT_SYMBOL(usb_nop_xceiv_unregister);
-
 static int nop_set_suspend(struct usb_phy *x, int suspend)
 {
 	return 0;
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
index 148d351..b23c942 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -12,18 +12,4 @@ struct nop_usb_xceiv_platform_data {
 	unsigned int needs_reset:1;
 };
 
-#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
-/* sometimes transceivers are accessed only through e.g. ULPI */
-extern void usb_nop_xceiv_register(void);
-extern void usb_nop_xceiv_unregister(void);
-#else
-static inline void usb_nop_xceiv_register(void)
-{
-}
-
-static inline void usb_nop_xceiv_unregister(void)
-{
-}
-#endif
-
 #endif /* __LINUX_USB_NOP_XCEIV_H */
-- 
1.7.0.4


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

* [PATCH v1 5/9] usb: phy: dsps: adding usbphy driver for am33xx platform
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (3 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 4/9] usb: phy: nop: removing unused usb_nop_xceiv_(un_)register API Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 6/9] usb: musb: dsps: use usb-phy driver API for phy power on/off Ravi Babu
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

Adds usb-phy driver support for am33xx platform, the host/device
peripheral controller shall get this phy object to control the phy
operations.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/phy/Kconfig        |    9 ++
 drivers/usb/phy/Makefile       |    1 +
 drivers/usb/phy/phy-dsps-usb.c |  236 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 246 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/phy/phy-dsps-usb.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 372db48..b55c265 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -85,6 +85,15 @@ config OMAP_USB3
 	  This driver interacts with the "OMAP Control USB Driver" to power
 	  on/off the PHY.
 
+config DSPS_USB2PHY
+	tristate "DSPS USB2 PHY Driver"
+	depends on SOC_AM33XX
+	help
+	  Enable this to support the transceiver that is part of SOC. This
+	  phy supports all LS/FS/HS speed and also supports OTG functionality.
+	  The USB OTG controller communicates with this phy through stand UTMI
+	  interface.
+
 config SAMSUNG_USBPHY
 	tristate "Samsung USB PHY Driver"
 	help
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 33863c0..0b16fb3 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_NOP_USB_XCEIV)		+= phy-nop.o
 obj-$(CONFIG_OMAP_CONTROL_USB)		+= phy-omap-control.o
 obj-$(CONFIG_OMAP_USB2)			+= phy-omap-usb2.o
 obj-$(CONFIG_OMAP_USB3)			+= phy-omap-usb3.o
+obj-$(CONFIG_DSPS_USB2PHY)		+= phy-dsps-usb.o
 obj-$(CONFIG_SAMSUNG_USBPHY)		+= phy-samsung-usb.o
 obj-$(CONFIG_SAMSUNG_USB2PHY)		+= phy-samsung-usb2.o
 obj-$(CONFIG_SAMSUNG_USB3PHY)		+= phy-samsung-usb3.o
diff --git a/drivers/usb/phy/phy-dsps-usb.c b/drivers/usb/phy/phy-dsps-usb.c
new file mode 100644
index 0000000..aae97b3
--- /dev/null
+++ b/drivers/usb/phy/phy-dsps-usb.c
@@ -0,0 +1,236 @@
+/*
+ * phy-dsps-usb.c - TI gs70 based usb phy driver used by usb controller
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/io.h>
+#include <linux/usb/omap_usb.h>
+#include <linux/usb/phy_companion.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/pm_runtime.h>
+#include <linux/delay.h>
+#include <linux/usb/phy.h>
+
+struct dsps_phy {
+	struct usb_phy phy;
+	struct device *dev;
+	struct platform_device *pdev;
+	void __iomem *phy_ctrl;
+	void __iomem *phy_wkup;
+	u8	is_suspended:1;
+	int	id;
+};
+
+#define DSPS_USBPHY_CM_PWRDN		(1 << 0)
+#define DSPS_USBPHY_OTG_PWRDN		(1 << 1)
+#define DSPS_USBPHY_OTGVDET_EN		(1 << 19)
+#define DSPS_USBPHY_OTGSESSEND_EN	(1 << 20)
+#define DSPS_USB0_WKUP_CTRL_ENABLE	(1 << 0)
+#define DSPS_USB1_WKUP_CTRL_ENABLE	(1 << 8)
+#define phy_to_dspsphy(x)	container_of((x), struct dsps_phy, phy)
+
+static void dsps_usbphy_power(struct usb_phy *phy, bool is_on)
+{
+	struct dsps_phy *dsps_phy = phy_to_dspsphy(phy);
+	u32 val;
+
+	val = readl(dsps_phy->phy_ctrl);
+
+	if (is_on) {
+		val &= ~(DSPS_USBPHY_CM_PWRDN | DSPS_USBPHY_OTG_PWRDN);
+		val |= DSPS_USBPHY_OTGVDET_EN |
+			DSPS_USBPHY_OTGSESSEND_EN;
+	} else
+		val |= DSPS_USBPHY_CM_PWRDN | DSPS_USBPHY_OTG_PWRDN;
+
+	writel(val, dsps_phy->phy_ctrl);
+}
+
+static void dsps_usbphy_wakeup(struct usb_phy *phy, bool enable)
+{
+	struct dsps_phy *dsps_phy = phy_to_dspsphy(phy);
+	int id = dsps_phy->id;
+	u32 val, wkup_flag;
+
+	val = readl(dsps_phy->phy_wkup);
+	wkup_flag = id ? DSPS_USB1_WKUP_CTRL_ENABLE :
+			DSPS_USB0_WKUP_CTRL_ENABLE;
+
+	if (enable)
+		val |= wkup_flag;
+	else
+		val &= ~wkup_flag;
+
+	writel(val, dsps_phy->phy_wkup);
+}
+
+static int dsps_usbphy_suspend(struct usb_phy *x, int suspend)
+{
+	struct dsps_phy *dsps_phy = phy_to_dspsphy(x);
+
+	if (suspend) {
+		if (!pm_runtime_suspended(&dsps_phy->pdev->dev))
+			pm_runtime_put(&dsps_phy->pdev->dev);
+	} else if (!suspend)
+		pm_runtime_get(&dsps_phy->pdev->dev);
+
+	return 0;
+}
+
+static int dsps_usbphy_init(struct usb_phy *phy)
+{
+	/* enable the phy */
+	dsps_usbphy_power(phy, 1);
+
+	return 0;
+}
+
+static void dsps_usbphy_shutdown(struct usb_phy *phy)
+{
+	/* disable the phy */
+	dsps_usbphy_power(phy, 0);
+}
+
+static int dsps_usbphy_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct dsps_phy	*phy;
+	struct usb_otg *otg;
+	struct resource *res;
+
+	phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy) {
+		dev_err(&pdev->dev, "unable to allocate memory for USB2 PHY\n");
+		return -ENOMEM;
+	}
+
+	otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
+	if (!otg) {
+		dev_err(&pdev->dev, "unable to allocate memory for USB OTG\n");
+		return -ENOMEM;
+	}
+
+	phy->dev		= &pdev->dev;
+	phy->pdev		= pdev;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl");
+	phy->phy_ctrl = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->phy_ctrl))
+		return PTR_ERR(phy->phy_ctrl);
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_wkup");
+	phy->phy_wkup = ioremap(res->start, resource_size(res));
+	if (IS_ERR(phy->phy_wkup))
+		return PTR_ERR(phy->phy_wkup);
+
+	if (np)
+		of_property_read_u32(np, "id", &phy->id);
+
+	phy->phy.dev		= phy->dev;
+	phy->phy.label		= "dsps-usbphy";
+	phy->phy.otg		= otg;
+	phy->phy.type		= USB_PHY_TYPE_USB2;
+	phy->phy.init		= dsps_usbphy_init;
+	phy->phy.shutdown	= dsps_usbphy_shutdown;
+	phy->phy.set_suspend	= dsps_usbphy_suspend;
+	otg->phy		= &phy->phy;
+
+	usb_add_phy_dev(&phy->phy);
+
+	platform_set_drvdata(pdev, phy);
+
+	pm_runtime_enable(phy->dev);
+
+	return 0;
+}
+
+static int dsps_usbphy_remove(struct platform_device *pdev)
+{
+	struct dsps_phy	*phy = platform_get_drvdata(pdev);
+
+	dsps_usbphy_power(&phy->phy, 0);
+	iounmap(phy->phy_wkup);
+	usb_remove_phy(&phy->phy);
+
+	if (!pm_runtime_suspended(&pdev->dev))
+		pm_runtime_put(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_RUNTIME
+
+static int dsps_usbphy_runtime_suspend(struct device *dev)
+{
+	struct dsps_phy	*dsps_phy = dev_get_drvdata(dev);
+
+	/* suspend usb-phy */
+	dsps_usbphy_power(&dsps_phy->phy, 0);
+	dsps_phy->is_suspended = 1;
+
+	return 0;
+}
+
+static int dsps_usbphy_runtime_resume(struct device *dev)
+{
+	struct dsps_phy	*dsps_phy = dev_get_drvdata(dev);
+
+	/* resume usb-phy */
+	dsps_usbphy_power(&dsps_phy->phy, 1);
+	dsps_phy->is_suspended = 0;
+
+	return 0;
+}
+
+static const struct dev_pm_ops dsps_usbphy_pm_ops = {
+	SET_RUNTIME_PM_OPS(dsps_usbphy_runtime_suspend,
+			dsps_usbphy_runtime_resume, NULL)
+};
+
+#define DEV_PM_OPS     (&dsps_usbphy_pm_ops)
+#else
+#define DEV_PM_OPS     NULL
+#endif
+
+#ifdef CONFIG_OF
+static const struct of_device_id dsps_usbphy_id_table[] = {
+	{ .compatible = "ti,dsps-usbphy" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, dsps_usbphy_id_table);
+#endif
+
+static struct platform_driver dsps_usbphy_driver = {
+	.probe		= dsps_usbphy_probe,
+	.remove		= dsps_usbphy_remove,
+	.driver		= {
+		.name	= "dsps-usbphy",
+		.owner	= THIS_MODULE,
+		.pm	= DEV_PM_OPS,
+		.of_match_table = of_match_ptr(dsps_usbphy_id_table),
+	},
+};
+
+module_platform_driver(dsps_usbphy_driver);
+
+MODULE_ALIAS("platform: dsps_usbphy");
+MODULE_AUTHOR("Ravi Babu <ravibabu@ti.com>");
+MODULE_DESCRIPTION("dsps USB2 phy driver");
+MODULE_LICENSE("GPL v2");
-- 
1.7.0.4


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

* [PATCH v1 6/9] usb: musb: dsps: use usb-phy driver API for phy power on/off
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (4 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 5/9] usb: phy: dsps: adding usbphy driver for am33xx platform Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23  6:01 ` [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance Ravi Babu
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

use usb-phy driver API for powering on/off phy and removed
usage of the phy control access in platform glue driver.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/musb_dsps.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 0ecedb3..0096aad 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -36,6 +36,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
 #include <linux/module.h>
+#include <linux/usb/phy.h>
 #include <linux/platform_data/usb-omap.h>
 #include <linux/sizes.h>
 
@@ -432,7 +433,7 @@ static int dsps_musb_init(struct musb *musb)
 	dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
 
 	/* Start the on-chip PHY and its PLL. */
-	musb_dsps_phy_control(glue, pdev->id, 1);
+	usb_phy_init(musb->xceiv);
 
 	musb->isr = dsps_interrupt;
 
@@ -459,10 +460,7 @@ static int dsps_musb_exit(struct musb *musb)
 	del_timer_sync(&glue->timer[pdev->id]);
 
 	/* Shutdown the on-chip PHY and its PLL. */
-	musb_dsps_phy_control(glue, pdev->id, 0);
-
-	/* NOP driver needs change if supporting dual instance */
-	usb_put_phy(musb->xceiv);
+	usb_phy_shutdown(musb->xceiv);
 
 	return 0;
 }
@@ -690,10 +688,13 @@ static int dsps_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev->parent);
 	struct dsps_glue *glue = platform_get_drvdata(pdev);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct musb *musb;
 	int i;
 
-	for (i = 0; i < wrp->instances; i++)
-		musb_dsps_phy_control(glue, i, 0);
+	for (i = 0; i < wrp->instances; i++) {
+		musb = dev_get_drvdata(&glue->musb[i]->dev);
+		usb_phy_set_suspend(musb->xceiv, 1);
+	}
 
 	return 0;
 }
@@ -703,10 +704,13 @@ static int dsps_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev->parent);
 	struct dsps_glue *glue = platform_get_drvdata(pdev);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct musb *musb;
 	int i;
 
-	for (i = 0; i < wrp->instances; i++)
-		musb_dsps_phy_control(glue, i, 1);
+	for (i = 0; i < wrp->instances; i++) {
+		musb = dev_get_drvdata(&glue->musb[i]->dev);
+		usb_phy_set_suspend(musb->xceiv, 0);
+	}
 
 	return 0;
 }
-- 
1.7.0.4


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

* [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (5 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 6/9] usb: musb: dsps: use usb-phy driver API for phy power on/off Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23 14:25   ` Sergei Shtylyov
  2013-05-23  6:01 ` [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx Ravi Babu
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

In case of mutli instance support, use get-phy object using phandle
to return to repsective phy xceiv object for each instance

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/musb_dsps.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 0096aad..0d8581b 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -416,7 +416,11 @@ static int dsps_musb_init(struct musb *musb)
 	musb->mregs += wrp->musb_core_offset;
 
 	/* NOP driver needs change if supporting dual instance */
-	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+	if (dev->parent->of_node)
+		musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent,
+				"usb-phy", pdev->id);
+	else
+		musb->xceiv = devm_usb_get_phy_dev(dev, pdev->id);
 	if (IS_ERR_OR_NULL(musb->xceiv))
 		return -EPROBE_DEFER;
 
-- 
1.7.0.4


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

* [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (6 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-23 14:27   ` Sergei Shtylyov
  2013-05-23  6:01 ` [PATCH v1 9/9] usb: musb: dsp: remove the usb-phy control acess from platform glue Ravi Babu
  2013-05-28 17:39 ` [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Felipe Balbi
  9 siblings, 1 reply; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

The am33xx platforms suppors dual musb instance which need two instances
of usb-phy. Add dual instance usb-phy DT bindings for am333x platform.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 arch/arm/boot/dts/am33xx.dtsi |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 0957645..b0b4deb 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -322,6 +322,22 @@
 			status = "disabled";
 		};
 
+		phy1: usbphy-gs70@44e10620 {
+			compatible = "ti,dsps-usbphy";
+			reg = <0x44e10620 0x8
+			       0x44e10648 0x4>;
+			reg-names = "phy_ctrl","phy_wkup";
+			id = <0>;
+		};
+
+		phy2: usbphy-gs70@44e10628 {
+			compatible = "ti,dsps-usbphy";
+			reg = <0x44e10628 0x8
+			       0x44e10648 0x4>;
+			reg-names = "phy_ctrl","phy_wkup";
+			id = <1>;
+		};
+
 		usb@47400000 {
 			compatible = "ti,musb-am33xx";
 			reg = <0x47400000 0x1000	/* usbss */
@@ -337,6 +353,7 @@
 			port1-mode = <3>;
 			power = <250>;
 			ti,hwmods = "usb_otg_hs";
+			usb-phy = <&phy1>, <&phy2>;
 		};
 
 		mac: ethernet@4a100000 {
-- 
1.7.0.4


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

* [PATCH v1 9/9] usb: musb: dsp: remove the usb-phy control acess from platform glue
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (7 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx Ravi Babu
@ 2013-05-23  6:01 ` Ravi Babu
  2013-05-28 17:39 ` [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Felipe Balbi
  9 siblings, 0 replies; 24+ messages in thread
From: Ravi Babu @ 2013-05-23  6:01 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: balbi, Ravi Babu

Remove usb-phy control access from platform glue, after moving
usb-phy controls to saperate phy-dsps-usb driver.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 drivers/usb/musb/musb_dsps.c |   51 ------------------------------------------
 1 files changed, 0 insertions(+), 51 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 0d8581b..958c6b6 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -123,49 +123,8 @@ struct dsps_glue {
 	const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
 	struct timer_list timer[2];	/* otg_workaround timer */
 	unsigned long last_timer[2];    /* last timer data for each instance */
-	u32 __iomem *usb_ctrl[2];
 };
 
-#define	DSPS_AM33XX_CONTROL_MODULE_PHYS_0	0x44e10620
-#define	DSPS_AM33XX_CONTROL_MODULE_PHYS_1	0x44e10628
-
-static const resource_size_t dsps_control_module_phys[] = {
-	DSPS_AM33XX_CONTROL_MODULE_PHYS_0,
-	DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
-};
-
-#define USBPHY_CM_PWRDN		(1 << 0)
-#define USBPHY_OTG_PWRDN	(1 << 1)
-#define USBPHY_OTGVDET_EN	(1 << 19)
-#define USBPHY_OTGSESSEND_EN	(1 << 20)
-
-/**
- * musb_dsps_phy_control - phy on/off
- * @glue: struct dsps_glue *
- * @id: musb instance
- * @on: flag for phy to be switched on or off
- *
- * This is to enable the PHY using usb_ctrl register in system control
- * module space.
- *
- * XXX: This function will be removed once we have a seperate driver for
- * control module
- */
-static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
-{
-	u32 usbphycfg;
-
-	usbphycfg = readl(glue->usb_ctrl[id]);
-
-	if (on) {
-		usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
-		usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
-	} else {
-		usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
-	}
-
-	writel(usbphycfg, glue->usb_ctrl[id]);
-}
 /**
  * dsps_musb_enable - enable interrupts
  */
@@ -494,16 +453,6 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
 	char res_name[11];
 	int ret;
 
-	resources[0].start = dsps_control_module_phys[id];
-	resources[0].end = resources[0].start + SZ_4 - 1;
-	resources[0].flags = IORESOURCE_MEM;
-
-	glue->usb_ctrl[id] = devm_ioremap_resource(&pdev->dev, resources);
-	if (IS_ERR(glue->usb_ctrl[id])) {
-		ret = PTR_ERR(glue->usb_ctrl[id]);
-		goto err0;
-	}
-
 	/* first resource is for usbss, so start index from 1 */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1);
 	if (!res) {
-- 
1.7.0.4


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

* Re: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-23  6:01 ` [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue Ravi Babu
@ 2013-05-23 14:22   ` Sergei Shtylyov
  2013-05-23 17:07     ` B, Ravi
  0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-23 14:22 UTC (permalink / raw)
  To: Ravi Babu; +Cc: linux-usb, linux-kernel, balbi

Hello.

On 23-05-2013 10:01, Ravi Babu wrote:

> removed unused nop xceiv (un_)register API's from all musb
> platform drivers

    Since when are they unused?

> Signed-off-by: Ravi Babu <ravibabu@ti.com>

WBR, Sergei


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

* Re: [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance
  2013-05-23  6:01 ` [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance Ravi Babu
@ 2013-05-23 14:25   ` Sergei Shtylyov
  2013-05-23 17:09     ` B, Ravi
  0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-23 14:25 UTC (permalink / raw)
  To: Ravi Babu; +Cc: linux-usb, linux-kernel, balbi

On 23-05-2013 10:01, Ravi Babu wrote:

> In case of mutli instance support, use get-phy object using phandle
> to return to repsective phy xceiv object for each instance

    Only "respective" and s/xceiv/transceiver/.

> Signed-off-by: Ravi Babu <ravibabu@ti.com>

WBR, Sergei


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

* Re: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-23  6:01 ` [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx Ravi Babu
@ 2013-05-23 14:27   ` Sergei Shtylyov
  2013-05-23 17:13     ` B, Ravi
  0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-23 14:27 UTC (permalink / raw)
  To: Ravi Babu; +Cc: linux-usb, linux-kernel, balbi

On 23-05-2013 10:01, Ravi Babu wrote:

> The am33xx platforms suppors dual musb instance which need two instances
> of usb-phy. Add dual instance usb-phy DT bindings for am333x platform.

> Signed-off-by: Ravi Babu <ravibabu@ti.com>
> ---
>   arch/arm/boot/dts/am33xx.dtsi |   17 +++++++++++++++++
>   1 files changed, 17 insertions(+), 0 deletions(-)

> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
> index 0957645..b0b4deb 100644
> --- a/arch/arm/boot/dts/am33xx.dtsi
> +++ b/arch/arm/boot/dts/am33xx.dtsi
> @@ -322,6 +322,22 @@
>   			status = "disabled";
>   		};
>
> +		phy1: usbphy-gs70@44e10620 {
> +			compatible = "ti,dsps-usbphy";
> +			reg = <0x44e10620 0x8
> +			       0x44e10648 0x4>;
> +			reg-names = "phy_ctrl","phy_wkup";
> +			id = <0>;
> +		};
> +
> +		phy2: usbphy-gs70@44e10628 {
> +			compatible = "ti,dsps-usbphy";
> +			reg = <0x44e10628 0x8
> +			       0x44e10648 0x4>;

    The second register conflicts with phy1.

WBR, Sergei


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

* RE: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-23 14:22   ` Sergei Shtylyov
@ 2013-05-23 17:07     ` B, Ravi
  2013-05-23 18:21       ` Sergei Shtylyov
  0 siblings, 1 reply; 24+ messages in thread
From: B, Ravi @ 2013-05-23 17:07 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Sergei

> Subject: Re: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
> Hello.
> On 23-05-2013 10:01, Ravi Babu wrote:

>> removed unused nop xceiv (un_)register API's from all musb
>> platform drivers

>    Since when are they unused?

Please refer to commit id 662dca54 : usb: otg: support for multiple transceivers by a single controller.
Usb_get_phy() is used to get the of phy used by controller, phy bindings are done through DT. 

>> Signed-off-by: Ravi Babu <ravibabu@ti.com>

--
Ravi B

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

* RE: [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance
  2013-05-23 14:25   ` Sergei Shtylyov
@ 2013-05-23 17:09     ` B, Ravi
  0 siblings, 0 replies; 24+ messages in thread
From: B, Ravi @ 2013-05-23 17:09 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-kernel, Balbi, Felipe

> Subject: Re: [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance

> On 23-05-2013 10:01, Ravi Babu wrote:

>> In case of mutli instance support, use get-phy object using phandle to 
>> return to repsective phy xceiv object for each instance

>   Only "respective" and s/xceiv/transceiver/.

Ok. 

>> Signed-off-by: Ravi Babu <ravibabu@ti.com>

--
Ravi B

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

* RE: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-23 14:27   ` Sergei Shtylyov
@ 2013-05-23 17:13     ` B, Ravi
  2013-05-23 18:18       ` Sergei Shtylyov
  0 siblings, 1 reply; 24+ messages in thread
From: B, Ravi @ 2013-05-23 17:13 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Sergei

>>
>> +		phy1: usbphy-gs70@44e10620 {
>> +			compatible = "ti,dsps-usbphy";
>> +			reg = <0x44e10620 0x8
>> +			       0x44e10648 0x4>;
>> +			reg-names = "phy_ctrl","phy_wkup";
>> +			id = <0>;
>> +		};
>> +
>> +		phy2: usbphy-gs70@44e10628 {
>> +			compatible = "ti,dsps-usbphy";
>> +			reg = <0x44e10628 0x8
>> +			       0x44e10648 0x4>;

> The second register conflicts with phy1.

The two instances of phy uses common phy wakeup register.

--
Ravi B

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

* Re: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-23 17:13     ` B, Ravi
@ 2013-05-23 18:18       ` Sergei Shtylyov
  2013-05-24  5:34         ` B, Ravi
  0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-23 18:18 UTC (permalink / raw)
  To: B, Ravi; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Hello.

On 05/23/2013 09:13 PM, B, Ravi wrote:

>
>>> +		phy1: usbphy-gs70@44e10620 {
>>> +			compatible = "ti,dsps-usbphy";
>>> +			reg = <0x44e10620 0x8
>>> +			       0x44e10648 0x4>;
>>> +			reg-names = "phy_ctrl","phy_wkup";
>>> +			id = <0>;
>>> +		};
>>> +
>>> +		phy2: usbphy-gs70@44e10628 {
>>> +			compatible = "ti,dsps-usbphy";
>>> +			reg = <0x44e10628 0x8
>>> +			       0x44e10648 0x4>;
>> The second register conflicts with phy1.
> The two instances of phy uses common phy wakeup register.

     That's why there is a resource conflict. Have you actually tried to 
instantiate the devices out of such tree?
This register should be declared somewhere above the PHYs I think...

> --
> Ravi B

WBR, Sergei


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

* Re: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-23 17:07     ` B, Ravi
@ 2013-05-23 18:21       ` Sergei Shtylyov
  2013-05-24  5:34         ` B, Ravi
  0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-23 18:21 UTC (permalink / raw)
  To: B, Ravi; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Hello.

On 05/23/2013 09:07 PM, B, Ravi wrote:

>>> removed unused nop xceiv (un_)register API's from all musb
>>> platform drivers
>>     Since when are they unused?
> Please refer to commit id 662dca54 : usb: otg: support for multiple transceivers by a single controller.
> Usb_get_phy() is used to get the of phy used by controller, phy bindings are done through DT.

    Why are you sure that all these platforms support DT (in all 
configurations)?
It seems to me that you're simply breaking the patched glue layers with 
this patch.
I'll let Felipe decide the fate of this patch though...

>
>>> Signed-off-by: Ravi Babu <ravibabu@ti.com>
> --
> Ravi B

WBR, Sergei


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

* RE: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-23 18:18       ` Sergei Shtylyov
@ 2013-05-24  5:34         ` B, Ravi
  2013-06-01 14:39           ` Sergei Shtylyov
  0 siblings, 1 reply; 24+ messages in thread
From: B, Ravi @ 2013-05-24  5:34 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Subject: Re: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx

Hello.

On 05/23/2013 09:13 PM, B, Ravi wrote:

>
>>> +		phy1: usbphy-gs70@44e10620 {
>>> +			compatible = "ti,dsps-usbphy";
>>> +			reg = <0x44e10620 0x8
>>> +			       0x44e10648 0x4>;
>>> +			reg-names = "phy_ctrl","phy_wkup";
>>> +			id = <0>;
>>> +		};
>>> +
>>> +		phy2: usbphy-gs70@44e10628 {
>>> +			compatible = "ti,dsps-usbphy";
>>> +			reg = <0x44e10628 0x8
>>> +			       0x44e10648 0x4>;
>> The second register conflicts with phy1.
> The two instances of phy uses common phy wakeup register.

>>     That's why there is a resource conflict. Have you actually tried to instantiate the devices out of such tree?
>>This register should be declared somewhere above the PHYs I think...

I did not face any problem with this, I have tested both instances of phy used by dual instance controller, worked fine. 
What do you suggest, in case of common register which both phy have to use this for wakeup functionality.  
The DT should support this.  What do you suggest in such case?

--
Ravi B


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

* RE: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-23 18:21       ` Sergei Shtylyov
@ 2013-05-24  5:34         ` B, Ravi
  2013-05-24 14:41           ` Sergei Shtylyov
  0 siblings, 1 reply; 24+ messages in thread
From: B, Ravi @ 2013-05-24  5:34 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-usb, linux-kernel, Balbi, Felipe


Subject: Re: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue

Hello.

On 05/23/2013 09:07 PM, B, Ravi wrote:

>>> removed unused nop xceiv (un_)register API's from all musb platform 
>>> drivers
>>     Since when are they unused?
> Please refer to commit id 662dca54 : usb: otg: support for multiple transceivers by a single controller.
> Usb_get_phy() is used to get the of phy used by controller, phy bindings are done through DT.

>    Why are you sure that all these platforms support DT (in all configurations)?
> It seems to me that you're simply breaking the patched glue layers with this patch.
> I'll let Felipe decide the fate of this patch though...

You are correct, the bindings of phy and controller need not to done through DT alone, there is a saperate API
Phy API's available for such bindings done in respective board platform files. 

>
>>> Signed-off-by: Ravi Babu <ravibabu@ti.com>
> --
> Ravi B

WBR, Sergei


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

* Re: [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue
  2013-05-24  5:34         ` B, Ravi
@ 2013-05-24 14:41           ` Sergei Shtylyov
  0 siblings, 0 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2013-05-24 14:41 UTC (permalink / raw)
  To: B, Ravi; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Hello.

On 24-05-2013 9:34, B, Ravi wrote:

>>>> removed unused nop xceiv (un_)register API's from all musb platform
>>>> drivers

>>>      Since when are they unused?

>> Please refer to commit id 662dca54 : usb: otg: support for multiple transceivers by a single controller.
>> Usb_get_phy() is used to get the of phy used by controller, phy bindings are done through DT.

>>     Why are you sure that all these platforms support DT (in all configurations)?
>> It seems to me that you're simply breaking the patched glue layers with this patch.
>> I'll let Felipe decide the fate of this patch though...

> You are correct, the bindings of phy and controller need not to done through DT alone, there is a saperate API
> Phy API's available for such bindings done in respective board platform files.

    I don't see any such code in e.g. DaVinci/DA8xx platform files.

>>>> Signed-off-by: Ravi Babu <ravibabu@ti.com>
>> --
>> Ravi B

WBR, Sergei


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

* Re: [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform
  2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
                   ` (8 preceding siblings ...)
  2013-05-23  6:01 ` [PATCH v1 9/9] usb: musb: dsp: remove the usb-phy control acess from platform glue Ravi Babu
@ 2013-05-28 17:39 ` Felipe Balbi
  2013-05-29  3:46   ` B, Ravi
  9 siblings, 1 reply; 24+ messages in thread
From: Felipe Balbi @ 2013-05-28 17:39 UTC (permalink / raw)
  To: Ravi Babu; +Cc: linux-usb, linux-kernel, balbi

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

Hi,

On Thu, May 23, 2013 at 11:31:19AM +0530, Ravi Babu wrote:
> This patch set series
>         - adds dual musb instances support for am335x platform
>         - adds phy-dsps-usb driver based on TI's gs70 driver
>         - adds DT bindings for am33xx usb-phy
> 	- removed references to usb-nop-xceiv from musb

as Sergei pointed out, this would break some DaVinci/DA8xx platforms, so
I'm dropping from it from my queue.

-- 
balbi

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

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

* RE: [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform
  2013-05-28 17:39 ` [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Felipe Balbi
@ 2013-05-29  3:46   ` B, Ravi
  0 siblings, 0 replies; 24+ messages in thread
From: B, Ravi @ 2013-05-29  3:46 UTC (permalink / raw)
  To: Balbi, Felipe; +Cc: linux-usb, linux-kernel

Felipe

> Subject: Re: [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform

> Hi,

>On Thu, May 23, 2013 at 11:31:19AM +0530, Ravi Babu wrote:
>> This patch set series
>>         - adds dual musb instances support for am335x platform
>>         - adds phy-dsps-usb driver based on TI's gs70 driver
>>         - adds DT bindings for am33xx usb-phy
>> 	- removed references to usb-nop-xceiv from musb

>as Sergei pointed out, this would break some DaVinci/DA8xx platforms, so I'm dropping from it from my queue.

As I understand, already all musb glue platform drivers(dsps/davinci/da8xx) are changed to new usb_get_phy() API set.  
Currently the mainline code snippet as shown.

dsps/davinci/da8xx/xxx_musb_init() {
...
        usb_nop_xceiv_register() 
..
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv)) {
                ret = -EPROBE_DEFER;
                goto fail;
        }
..
}
Because of this all glue xxx_musb_init() will fail to get the phy without the phy-bindings for each controller. 
Without this patch series am335x musb will fail to get usb_phy(). Similarly phy support to be added for all davinci/da8xx
platform also. The usb_nop_xciev_xx() is dummy unused API here and hence removed from all glue in this patch series.

1) dsps platforms (am335x/dm81xx) series uses TI gs70 based phy 
	This patch adds support for ths dsps phy driver at drivers/usb/phy/usb-dsps-phy.c 
2) omapl13x/da8xx series of soc uses different phy
	Separate phy driver need to be added at drivers/usb/phy/usb-da8xx-phy.c
3) similarly all davinci series of soc uses separate TI-phy 
	Separate phy driver need to added at drivers/usb/phy/usb-davinci-phy.c

The bindings of the respective usb-phy and controller need to done in DT or non-DT way.  
I can add usb-phy support for davinci/da8xx platform in similar way.

---
Ravi B

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

* Re: [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx
  2013-05-24  5:34         ` B, Ravi
@ 2013-06-01 14:39           ` Sergei Shtylyov
  0 siblings, 0 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2013-06-01 14:39 UTC (permalink / raw)
  To: B, Ravi; +Cc: linux-usb, linux-kernel, Balbi, Felipe

Hello.

On 24-05-2013 9:34, B, Ravi wrote:

>>>> +		phy1: usbphy-gs70@44e10620 {
>>>> +			compatible = "ti,dsps-usbphy";
>>>> +			reg = <0x44e10620 0x8
>>>> +			       0x44e10648 0x4>;
>>>> +			reg-names = "phy_ctrl","phy_wkup";
>>>> +			id = <0>;
>>>> +		};
>>>> +
>>>> +		phy2: usbphy-gs70@44e10628 {
>>>> +			compatible = "ti,dsps-usbphy";
>>>> +			reg = <0x44e10628 0x8
>>>> +			       0x44e10648 0x4>;
>>> The second register conflicts with phy1.

>> The two instances of phy uses common phy wakeup register.

>>>      That's why there is a resource conflict. Have you actually tried to instantiate the devices out of such tree?
>>> This register should be declared somewhere above the PHYs I think...

> I did not face any problem with this, I have tested both instances of phy used by dual instance controller, worked fine.

    How your /proc/iomem looks like with that?

> What do you suggest, in case of common register which both phy have to use this for wakeup functionality.
> The DT should support this.  What do you suggest in such case?

    I'd probably have to create a third device for this shared register...

> --
> Ravi B

WBR, Sergei



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

end of thread, other threads:[~2013-06-01 14:39 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-23  6:01 [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Ravi Babu
2013-05-23  6:01 ` [PATCH v1 1/9] usb: musb: dsps: enable dual instance support for am33xx platform Ravi Babu
2013-05-23  6:01 ` [PATCH v1 2/9] usb: musb: nop: remove unused nop_xceiv_(un)register APIs from glue Ravi Babu
2013-05-23 14:22   ` Sergei Shtylyov
2013-05-23 17:07     ` B, Ravi
2013-05-23 18:21       ` Sergei Shtylyov
2013-05-24  5:34         ` B, Ravi
2013-05-24 14:41           ` Sergei Shtylyov
2013-05-23  6:01 ` [PATCH v1 3/9] arch: arm: omap3: remove unused usb_nop_xceive register API's Ravi Babu
2013-05-23  6:01 ` [PATCH v1 4/9] usb: phy: nop: removing unused usb_nop_xceiv_(un_)register API Ravi Babu
2013-05-23  6:01 ` [PATCH v1 5/9] usb: phy: dsps: adding usbphy driver for am33xx platform Ravi Babu
2013-05-23  6:01 ` [PATCH v1 6/9] usb: musb: dsps: use usb-phy driver API for phy power on/off Ravi Babu
2013-05-23  6:01 ` [PATCH v1 7/9] usb: musb: dsps: use get-usb-phy by phandle for multi instance Ravi Babu
2013-05-23 14:25   ` Sergei Shtylyov
2013-05-23 17:09     ` B, Ravi
2013-05-23  6:01 ` [PATCH v1 8/9] usb: phy: dts: Adding usbphy DT bindings for am33xx Ravi Babu
2013-05-23 14:27   ` Sergei Shtylyov
2013-05-23 17:13     ` B, Ravi
2013-05-23 18:18       ` Sergei Shtylyov
2013-05-24  5:34         ` B, Ravi
2013-06-01 14:39           ` Sergei Shtylyov
2013-05-23  6:01 ` [PATCH v1 9/9] usb: musb: dsp: remove the usb-phy control acess from platform glue Ravi Babu
2013-05-28 17:39 ` [PATCH v1 0/9] adding dual instance and usb-phy support for am335x platform Felipe Balbi
2013-05-29  3:46   ` B, Ravi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.