All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv5 00/19] First round in OTG rework
@ 2011-09-26 11:21 Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 01/19] usb: otg: Rename otg_transceiver to usb_phy Heikki Krogerus
                   ` (18 more replies)
  0 siblings, 19 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Hi guys,

One version more with fixes.

Changes since v3:
- Fixes to iMX code from Sascha Hauer

Quick summary:
This introduces struct usb_phy and struct usb_otg that
replace struct otg_transceiver. The transceiver and phy
members from struct otg_transceiver are left in struct
usb_phy and otg specific members are moved to struct
usb_otg.

So the idea is simply to separate USB PHY handling from OTG.


Heikki Krogerus (19):
  usb: otg: Rename otg_transceiver to usb_phy
  usb: otg: Rename usb_otg and usb_xceiv to usb_phy
  usb: otg: Separate otg members from usb_phy
  usb: otg: ab8500: Start using struct usb_otg
  usb: otg: fsl: Start using struct usb_otg
  usb: otg: gpio_vbus: Start using struct usb_otg
  usb: otg: isp1301_omap: Start using struct usb_otg
  usb: otg: msm: Start using struct usb_otg
  usb: otg: langwell: Start using struct usb_otg
  usb: otg: nop: Start using struct usb_otg
  usb: otg: twl4030: Start using struct usb_otg
  usb: otg: twl6030: Start using struct usb_otg
  usb: otg: ulpi: Start using struct usb_otg
  arm: imx: Start using struct usb_otg
  usb: musb: Start using struct usb_otg
  power_supply: Convert all users to new usb_phy
  usb: Convert all users to new usb_phy
  usb: otg: Remove OTG specific members from usb_phy
  usb: otg: Convert all users to pass struct usb_otg for OTG functions

 arch/arm/mach-imx/mx31moboard-devboard.c   |   24 +-
 arch/arm/mach-imx/mx31moboard-marxbot.c    |   24 +-
 arch/arm/mach-pxa/pxa3xx-ulpi.c            |   20 +-
 arch/arm/mach-tegra/include/mach/usb_phy.h |    2 +-
 arch/arm/plat-mxc/include/mach/mxc_ehci.h  |    2 +-
 arch/arm/plat-mxc/include/mach/ulpi.h      |    6 +-
 arch/arm/plat-mxc/ulpi.c                   |    8 +-
 drivers/power/isp1704_charger.c            |  108 ++++---
 drivers/power/pda_power.c                  |   10 +-
 drivers/power/twl4030_charger.c            |   20 +-
 drivers/usb/gadget/ci13xxx_msm.c           |    4 +-
 drivers/usb/gadget/ci13xxx_udc.c           |   17 +-
 drivers/usb/gadget/ci13xxx_udc.h           |    2 +-
 drivers/usb/gadget/fsl_udc_core.c          |    9 +-
 drivers/usb/gadget/fsl_usb2_udc.h          |    2 +-
 drivers/usb/gadget/langwell_udc.c          |   12 +-
 drivers/usb/gadget/langwell_udc.h          |    2 +-
 drivers/usb/gadget/omap_udc.c              |   25 +-
 drivers/usb/gadget/omap_udc.h              |    2 +-
 drivers/usb/gadget/pxa25x_udc.c            |   13 +-
 drivers/usb/gadget/pxa25x_udc.h            |    2 +-
 drivers/usb/gadget/pxa27x_udc.c            |   11 +-
 drivers/usb/gadget/pxa27x_udc.h            |    2 +-
 drivers/usb/host/ehci-fsl.c                |    6 +-
 drivers/usb/host/ehci-hub.c                |    2 +-
 drivers/usb/host/ehci-msm.c                |   14 +-
 drivers/usb/host/ehci-mxc.c                |   12 +-
 drivers/usb/host/ehci-tegra.c              |   14 +-
 drivers/usb/host/ehci.h                    |    2 +-
 drivers/usb/host/ohci-omap.c               |   10 +-
 drivers/usb/host/ohci.h                    |    2 +-
 drivers/usb/musb/am35x.c                   |   42 ++--
 drivers/usb/musb/blackfin.c                |   28 +-
 drivers/usb/musb/da8xx.c                   |   42 ++--
 drivers/usb/musb/davinci.c                 |   33 ++-
 drivers/usb/musb/musb_core.c               |  174 ++++++------
 drivers/usb/musb/musb_core.h               |    2 +-
 drivers/usb/musb/musb_gadget.c             |   63 ++--
 drivers/usb/musb/musb_host.c               |    8 +-
 drivers/usb/musb/musb_virthub.c            |   37 ++--
 drivers/usb/musb/omap2430.c                |   67 +++---
 drivers/usb/musb/tusb6010.c                |   82 +++---
 drivers/usb/musb/ux500.c                   |    8 +-
 drivers/usb/otg/Kconfig                    |    2 +-
 drivers/usb/otg/ab8500-usb.c               |   93 ++++---
 drivers/usb/otg/fsl_otg.c                  |  120 +++++----
 drivers/usb/otg/fsl_otg.h                  |    4 +-
 drivers/usb/otg/gpio_vbus.c                |   61 +++--
 drivers/usb/otg/isp1301_omap.c             |  360 ++++++++++++-----------
 drivers/usb/otg/langwell_otg.c             |  387 +++++++++++++------------
 drivers/usb/otg/msm_otg.c                  |  430 ++++++++++++++--------------
 drivers/usb/otg/nop-usb-xceiv.c            |   66 ++---
 drivers/usb/otg/otg.c                      |   50 ++--
 drivers/usb/otg/otg_fsm.c                  |  174 ++++++------
 drivers/usb/otg/otg_fsm.h                  |    2 +-
 drivers/usb/otg/twl4030-usb.c              |   81 +++---
 drivers/usb/otg/twl6030-usb.c              |  115 ++++----
 drivers/usb/otg/ulpi.c                     |  116 ++++----
 drivers/usb/otg/ulpi_viewport.c            |    6 +-
 include/linux/usb/intel_mid_otg.h          |    8 +-
 include/linux/usb/msm_hsusb.h              |    4 +-
 include/linux/usb/otg.h                    |  200 +++++++------
 include/linux/usb/ulpi.h                   |    4 +-
 63 files changed, 1724 insertions(+), 1534 deletions(-)

-- 
1.7.4.1


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

* [PATCHv5 01/19] usb: otg: Rename otg_transceiver to usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 02/19] usb: otg: Rename usb_otg and usb_xceiv " Heikki Krogerus
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Sascha Hauer

This is the first step in separating USB transceivers from
USB OTG utilities.

Includes fixes to IMX code from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/mx31moboard-devboard.c   |    6 +-
 arch/arm/mach-imx/mx31moboard-marxbot.c    |    6 +-
 arch/arm/mach-pxa/pxa3xx-ulpi.c            |    6 +-
 arch/arm/mach-tegra/include/mach/usb_phy.h |    2 +-
 arch/arm/plat-mxc/include/mach/mxc_ehci.h  |    2 +-
 arch/arm/plat-mxc/include/mach/ulpi.h      |    4 +-
 arch/arm/plat-mxc/ulpi.c                   |    6 +-
 drivers/power/isp1704_charger.c            |    2 +-
 drivers/power/pda_power.c                  |    2 +-
 drivers/power/twl4030_charger.c            |    2 +-
 drivers/usb/gadget/ci13xxx_udc.h           |    2 +-
 drivers/usb/gadget/fsl_usb2_udc.h          |    2 +-
 drivers/usb/gadget/langwell_udc.c          |    2 +-
 drivers/usb/gadget/langwell_udc.h          |    2 +-
 drivers/usb/gadget/omap_udc.c              |    4 +-
 drivers/usb/gadget/omap_udc.h              |    2 +-
 drivers/usb/gadget/pxa25x_udc.h            |    2 +-
 drivers/usb/gadget/pxa27x_udc.h            |    2 +-
 drivers/usb/host/ehci-msm.c                |    2 +-
 drivers/usb/host/ehci-tegra.c              |    2 +-
 drivers/usb/host/ehci.h                    |    2 +-
 drivers/usb/host/ohci.h                    |    2 +-
 drivers/usb/musb/blackfin.c                |    2 +-
 drivers/usb/musb/musb_core.c               |    4 +-
 drivers/usb/musb/musb_core.h               |    2 +-
 drivers/usb/musb/tusb6010.c                |    2 +-
 drivers/usb/otg/Kconfig                    |    2 +-
 drivers/usb/otg/ab8500-usb.c               |   12 ++--
 drivers/usb/otg/fsl_otg.c                  |   18 +++---
 drivers/usb/otg/fsl_otg.h                  |    2 +-
 drivers/usb/otg/gpio_vbus.c                |    8 +-
 drivers/usb/otg/isp1301_omap.c             |   12 ++--
 drivers/usb/otg/langwell_otg.c             |   16 ++--
 drivers/usb/otg/msm_otg.c                  |   54 ++++++++--------
 drivers/usb/otg/nop-usb-xceiv.c            |   10 ++--
 drivers/usb/otg/otg.c                      |    8 +-
 drivers/usb/otg/otg_fsm.h                  |    2 +-
 drivers/usb/otg/twl4030-usb.c              |    8 +-
 drivers/usb/otg/twl6030-usb.c              |   20 +++---
 drivers/usb/otg/ulpi.c                     |   20 +++---
 drivers/usb/otg/ulpi_viewport.c            |    4 +-
 include/linux/usb/intel_mid_otg.h          |    6 +-
 include/linux/usb/msm_hsusb.h              |    2 +-
 include/linux/usb/otg.h                    |   98 ++++++++++++++--------------
 include/linux/usb/ulpi.h                   |    2 +-
 45 files changed, 189 insertions(+), 189 deletions(-)

diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c
index 0aa2536..9cd4a97 100644
--- a/arch/arm/mach-imx/mx31moboard-devboard.c
+++ b/arch/arm/mach-imx/mx31moboard-devboard.c
@@ -158,7 +158,7 @@ static int devboard_usbh1_hw_init(struct platform_device *pdev)
 #define USBH1_VBUSEN_B	IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
 #define USBH1_MODE	IOMUX_TO_GPIO(MX31_PIN_NFALE)
 
-static int devboard_isp1105_init(struct otg_transceiver *otg)
+static int devboard_isp1105_init(struct usb_phy *otg)
 {
 	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
 	if (ret)
@@ -177,7 +177,7 @@ static int devboard_isp1105_init(struct otg_transceiver *otg)
 }
 
 
-static int devboard_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
+static int devboard_isp1105_set_vbus(struct usb_phy *otg, bool on)
 {
 	if (on)
 		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -194,7 +194,7 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 
 static int __init devboard_usbh1_init(void)
 {
-	struct otg_transceiver *otg;
+	struct usb_phy *otg;
 	struct platform_device *pdev;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c
index bb639cb..2be769b 100644
--- a/arch/arm/mach-imx/mx31moboard-marxbot.c
+++ b/arch/arm/mach-imx/mx31moboard-marxbot.c
@@ -272,7 +272,7 @@ static int marxbot_usbh1_hw_init(struct platform_device *pdev)
 #define USBH1_VBUSEN_B	IOMUX_TO_GPIO(MX31_PIN_NFRE_B)
 #define USBH1_MODE	IOMUX_TO_GPIO(MX31_PIN_NFALE)
 
-static int marxbot_isp1105_init(struct otg_transceiver *otg)
+static int marxbot_isp1105_init(struct usb_phy *otg)
 {
 	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
 	if (ret)
@@ -291,7 +291,7 @@ static int marxbot_isp1105_init(struct otg_transceiver *otg)
 }
 
 
-static int marxbot_isp1105_set_vbus(struct otg_transceiver *otg, bool on)
+static int marxbot_isp1105_set_vbus(struct usb_phy *otg, bool on)
 {
 	if (on)
 		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -308,7 +308,7 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 
 static int __init marxbot_usbh1_init(void)
 {
-	struct otg_transceiver *otg;
+	struct usb_phy *otg;
 	struct platform_device *pdev;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index ce7168b..83e185d 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -33,7 +33,7 @@ struct pxa3xx_u2d_ulpi {
 	struct clk		*clk;
 	void __iomem		*mmio_base;
 
-	struct otg_transceiver	*otg;
+	struct usb_phy		*otg;
 	unsigned int		ulpi_mode;
 };
 
@@ -79,7 +79,7 @@ static int pxa310_ulpi_poll(void)
 	return -ETIMEDOUT;
 }
 
-static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg)
+static int pxa310_ulpi_read(struct usb_phy *otg, u32 reg)
 {
 	int err;
 
@@ -98,7 +98,7 @@ static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg)
 	return u2d_readl(U2DOTGUCR) & U2DOTGUCR_RDATA;
 }
 
-static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
+static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 {
 	if (pxa310_ulpi_get_phymode() != SYNCH) {
 		pr_warning("%s: PHY is not in SYNCH mode!\n", __func__);
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h
index d4b8f9e..de1a0f6 100644
--- a/arch/arm/mach-tegra/include/mach/usb_phy.h
+++ b/arch/arm/mach-tegra/include/mach/usb_phy.h
@@ -58,7 +58,7 @@ struct tegra_usb_phy {
 	struct clk *pad_clk;
 	enum tegra_usb_phy_mode mode;
 	void *config;
-	struct otg_transceiver *ulpi;
+	struct usb_phy *ulpi;
 };
 
 struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
diff --git a/arch/arm/plat-mxc/include/mach/mxc_ehci.h b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
index 2c159dc..9ffd1bb 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_ehci.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
@@ -44,7 +44,7 @@ struct mxc_usbh_platform_data {
 	int (*exit)(struct platform_device *pdev);
 
 	unsigned int		 portsc;
-	struct otg_transceiver	*otg;
+	struct usb_phy		*otg;
 };
 
 int mx51_initialize_usb_hw(int port, unsigned int flags);
diff --git a/arch/arm/plat-mxc/include/mach/ulpi.h b/arch/arm/plat-mxc/include/mach/ulpi.h
index f9161c9..d39d94a 100644
--- a/arch/arm/plat-mxc/include/mach/ulpi.h
+++ b/arch/arm/plat-mxc/include/mach/ulpi.h
@@ -2,9 +2,9 @@
 #define __MACH_ULPI_H
 
 #ifdef CONFIG_USB_ULPI
-struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags);
+struct usb_phy *imx_otg_ulpi_create(unsigned int flags);
 #else
-static inline struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags)
+static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
 {
 	return NULL;
 }
diff --git a/arch/arm/plat-mxc/ulpi.c b/arch/arm/plat-mxc/ulpi.c
index 477e45b..8eeeb6b 100644
--- a/arch/arm/plat-mxc/ulpi.c
+++ b/arch/arm/plat-mxc/ulpi.c
@@ -58,7 +58,7 @@ static int ulpi_poll(void __iomem *view, u32 bit)
 	return -ETIMEDOUT;
 }
 
-static int ulpi_read(struct otg_transceiver *otg, u32 reg)
+static int ulpi_read(struct usb_phy *otg, u32 reg)
 {
 	int ret;
 	void __iomem *view = otg->io_priv;
@@ -84,7 +84,7 @@ static int ulpi_read(struct otg_transceiver *otg, u32 reg)
 	return (__raw_readl(view) >> ULPIVW_RDATA_SHIFT) & ULPIVW_RDATA_MASK;
 }
 
-static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
+static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 {
 	int ret;
 	void __iomem *view = otg->io_priv;
@@ -112,7 +112,7 @@ struct otg_io_access_ops mxc_ulpi_access_ops = {
 };
 EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops);
 
-struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags)
+struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
 {
 	return otg_ulpi_create(&mxc_ulpi_access_ops, flags);
 }
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index f6d72b4..9230bdd 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -56,7 +56,7 @@ static u16 isp170x_id[] = {
 struct isp1704_charger {
 	struct device		*dev;
 	struct power_supply	psy;
-	struct otg_transceiver	*otg;
+	struct usb_phy		*otg;
 	struct notifier_block	nb;
 	struct work_struct	work;
 
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 69f8aa3..8f817e6 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -39,7 +39,7 @@ static struct timer_list polling_timer;
 static int polling;
 
 #ifdef CONFIG_USB_OTG_UTILS
-static struct otg_transceiver *transceiver;
+static struct usb_phy *transceiver;
 #endif
 static struct regulator *ac_draw;
 
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 54b9198..b3ead23 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -69,7 +69,7 @@ struct twl4030_bci {
 	struct device		*dev;
 	struct power_supply	ac;
 	struct power_supply	usb;
-	struct otg_transceiver	*transceiver;
+	struct usb_phy		*transceiver;
 	struct notifier_block	otg_nb;
 	struct work_struct	work;
 	int			irq_chg;
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h
index 2370777..3660627 100644
--- a/drivers/usb/gadget/ci13xxx_udc.h
+++ b/drivers/usb/gadget/ci13xxx_udc.h
@@ -136,7 +136,7 @@ struct ci13xxx {
 	struct usb_gadget_driver  *driver;     /* 3rd party gadget driver */
 	struct ci13xxx_udc_driver *udc_driver; /* device controller driver */
 	int                        vbus_active; /* is VBUS active */
-	struct otg_transceiver    *transceiver; /* Transceiver struct */
+	struct usb_phy            *transceiver; /* Transceiver struct */
 };
 
 /******************************************************************************
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h
index 1d51be8..a0041f4 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/fsl_usb2_udc.h
@@ -471,7 +471,7 @@ struct fsl_udc {
 
 	struct usb_ctrlrequest local_setup_buff;
 	spinlock_t lock;
-	struct otg_transceiver *transceiver;
+	struct usb_phy *transceiver;
 	unsigned softconnect:1;
 	unsigned vbus_active:1;
 	unsigned stopped:1;
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index a06e2c2..00ddf29 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -3163,7 +3163,7 @@ static int langwell_udc_probe(struct pci_dev *pdev,
 	dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
 #ifdef	OTG_TRANSCEIVER
-	/* PCI device is already enabled by otg_transceiver driver */
+	/* PCI device is already enabled by usb_phy driver */
 	dev->enabled = 1;
 
 	/* mem region and register base */
diff --git a/drivers/usb/gadget/langwell_udc.h b/drivers/usb/gadget/langwell_udc.h
index f1d9c1b..d7db7ed 100644
--- a/drivers/usb/gadget/langwell_udc.h
+++ b/drivers/usb/gadget/langwell_udc.h
@@ -173,7 +173,7 @@ struct langwell_udc {
 	spinlock_t		lock;	/* device lock */
 	struct langwell_ep	*ep;
 	struct usb_gadget_driver	*driver;
-	struct otg_transceiver	*transceiver;
+	struct usb_phy		*transceiver;
 	u8			dev_addr;
 	u32			usb_state;
 	u32			resume_state;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 740c7da..56d4f47 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2660,7 +2660,7 @@ static void omap_udc_release(struct device *dev)
 }
 
 static int __init
-omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
+omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv)
 {
 	unsigned	tmp, buf;
 
@@ -2799,7 +2799,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
 {
 	int			status = -ENODEV;
 	int			hmc;
-	struct otg_transceiver	*xceiv = NULL;
+	struct usb_phy		*xceiv = NULL;
 	const char		*type = NULL;
 	struct omap_usb_config	*config = pdev->dev.platform_data;
 	struct clk		*dc_clk;
diff --git a/drivers/usb/gadget/omap_udc.h b/drivers/usb/gadget/omap_udc.h
index 29edc51..59d3b22 100644
--- a/drivers/usb/gadget/omap_udc.h
+++ b/drivers/usb/gadget/omap_udc.h
@@ -164,7 +164,7 @@ struct omap_udc {
 	struct omap_ep			ep[32];
 	u16				devstat;
 	u16				clr_halt;
-	struct otg_transceiver		*transceiver;
+	struct usb_phy			*transceiver;
 	struct list_head		iso;
 	unsigned			softconnect:1;
 	unsigned			vbus_active:1;
diff --git a/drivers/usb/gadget/pxa25x_udc.h b/drivers/usb/gadget/pxa25x_udc.h
index f572c56..93da15c 100644
--- a/drivers/usb/gadget/pxa25x_udc.h
+++ b/drivers/usb/gadget/pxa25x_udc.h
@@ -128,7 +128,7 @@ struct pxa25x_udc {
 	struct device				*dev;
 	struct clk				*clk;
 	struct pxa2xx_udc_mach_info		*mach;
-	struct otg_transceiver			*transceiver;
+	struct usb_phy				*transceiver;
 	u64					dma_mask;
 	struct pxa25x_ep			ep [PXA_UDC_NUM_ENDPOINTS];
 
diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h
index b01696e..f4ad833 100644
--- a/drivers/usb/gadget/pxa27x_udc.h
+++ b/drivers/usb/gadget/pxa27x_udc.h
@@ -456,7 +456,7 @@ struct pxa_udc {
 	struct usb_gadget_driver		*driver;
 	struct device				*dev;
 	struct pxa2xx_udc_mach_info		*mach;
-	struct otg_transceiver			*transceiver;
+	struct usb_phy				*transceiver;
 
 	enum ep0_state				ep0state;
 	struct udc_stats			stats;
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 592d5f7..ef7c431 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -32,7 +32,7 @@
 
 #define MSM_USB_BASE (hcd->regs)
 
-static struct otg_transceiver *otg;
+static struct usb_phy *otg;
 
 static int ehci_msm_reset(struct usb_hcd *hcd)
 {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 02b2bfd..4637a29 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -30,7 +30,7 @@ struct tegra_ehci_hcd {
 	struct tegra_usb_phy *phy;
 	struct clk *clk;
 	struct clk *emc_clk;
-	struct otg_transceiver *transceiver;
+	struct usb_phy *transceiver;
 	int host_resumed;
 	int bus_suspended;
 	int port_resuming;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index cc7d337..f3bb5ce 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -168,7 +168,7 @@ struct ehci_hcd {			/* one per controller */
 	/*
 	 * OTG controllers and transceivers need software interaction
 	 */
-	struct otg_transceiver	*transceiver;
+	struct usb_phy	*transceiver;
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 35e5fd6..f5b042c 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -370,7 +370,7 @@ struct ohci_hcd {
 	 * OTG controllers and transceivers need software interaction;
 	 * other external transceivers should be software-transparent
 	 */
-	struct otg_transceiver	*transceiver;
+	struct usb_phy	*transceiver;
 	void (*start_hnp)(struct ohci_hcd *ohci);
 
 	/*
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 5e7cfba..fc8e9ed 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -317,7 +317,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on)
 		musb_readb(musb->mregs, MUSB_DEVCTL));
 }
 
-static int bfin_musb_set_power(struct otg_transceiver *x, unsigned mA)
+static int bfin_musb_set_power(struct usb_phy *x, unsigned mA)
 {
 	return 0;
 }
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 20a2873..b5beb7d 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -131,7 +131,7 @@ static inline struct musb *dev_to_musb(struct device *dev)
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
-static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset)
+static int musb_ulpi_read(struct usb_phy *otg, u32 offset)
 {
 	void __iomem *addr = otg->io_priv;
 	int	i = 0;
@@ -165,7 +165,7 @@ static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset)
 	return musb_readb(addr, MUSB_ULPI_REG_DATA);
 }
 
-static int musb_ulpi_write(struct otg_transceiver *otg,
+static int musb_ulpi_write(struct usb_phy *otg,
 		u32 offset, u32 data)
 {
 	void __iomem *addr = otg->io_priv;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index b3c065a..2168319 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -371,7 +371,7 @@ struct musb {
 	u16			int_rx;
 	u16			int_tx;
 
-	struct otg_transceiver	*xceiv;
+	struct usb_phy		*xceiv;
 
 	int nIrq;
 	unsigned		irq_wake:1;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index ec14801..38d5ce8 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -276,7 +276,7 @@ static struct musb *the_musb;
  * mode), or low power Default-B sessions, something else supplies power.
  * Caller must take care of locking.
  */
-static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
+static int tusb_draw_power(struct usb_phy *x, unsigned mA)
 {
 	struct musb	*musb = the_musb;
 	void __iomem	*tbase = musb->ctrl_base;
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index c66481a..ec61cb4 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -23,7 +23,7 @@ config USB_GPIO_VBUS
 	select USB_OTG_UTILS
 	help
 	  Provides simple GPIO VBUS sensing for controllers with an
-	  internal transceiver via the otg_transceiver interface, and
+	  internal transceiver via the usb_phy interface, and
 	  optionally control of a D+ pullup GPIO as well as a VBUS
 	  current limit regulator.
 
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 07ccea9..99a56af 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -68,7 +68,7 @@ enum ab8500_usb_link_status {
 };
 
 struct ab8500_usb {
-	struct otg_transceiver otg;
+	struct usb_phy otg;
 	struct device *dev;
 	int irq_num_id_rise;
 	int irq_num_id_fall;
@@ -82,7 +82,7 @@ struct ab8500_usb {
 	int rev;
 };
 
-static inline struct ab8500_usb *xceiv_to_ab(struct otg_transceiver *x)
+static inline struct ab8500_usb *xceiv_to_ab(struct usb_phy *x)
 {
 	return container_of(x, struct ab8500_usb, otg);
 }
@@ -269,7 +269,7 @@ static void ab8500_usb_phy_disable_work(struct work_struct *work)
 		ab8500_usb_peri_phy_dis(ab);
 }
 
-static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA)
+static int ab8500_usb_set_power(struct usb_phy *otg, unsigned mA)
 {
 	struct ab8500_usb *ab;
 
@@ -290,13 +290,13 @@ static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA)
  * ab->vbus_draw.
  */
 
-static int ab8500_usb_set_suspend(struct otg_transceiver *x, int suspend)
+static int ab8500_usb_set_suspend(struct usb_phy *x, int suspend)
 {
 	/* TODO */
 	return 0;
 }
 
-static int ab8500_usb_set_peripheral(struct otg_transceiver *otg,
+static int ab8500_usb_set_peripheral(struct usb_phy *otg,
 		struct usb_gadget *gadget)
 {
 	struct ab8500_usb *ab;
@@ -329,7 +329,7 @@ static int ab8500_usb_set_peripheral(struct otg_transceiver *otg,
 	return 0;
 }
 
-static int ab8500_usb_set_host(struct otg_transceiver *otg,
+static int ab8500_usb_set_host(struct usb_phy *otg,
 					struct usb_bus *host)
 {
 	struct ab8500_usb *ab;
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c
index 0f420b2..2f0678d 100644
--- a/drivers/usb/otg/fsl_otg.c
+++ b/drivers/usb/otg/fsl_otg.c
@@ -452,7 +452,7 @@ void otg_reset_controller(void)
 /* Call suspend/resume routines in host driver */
 int fsl_otg_start_host(struct otg_fsm *fsm, int on)
 {
-	struct otg_transceiver *xceiv = fsm->transceiver;
+	struct usb_phy *xceiv = fsm->transceiver;
 	struct device *dev;
 	struct fsl_otg *otg_dev = container_of(xceiv, struct fsl_otg, otg);
 	u32 retval = 0;
@@ -518,7 +518,7 @@ end:
  */
 int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
 {
-	struct otg_transceiver *xceiv = fsm->transceiver;
+	struct usb_phy *xceiv = fsm->transceiver;
 	struct device *dev;
 
 	if (!xceiv->gadget || !xceiv->gadget->dev.parent)
@@ -542,7 +542,7 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
  * Called by initialization code of host driver.  Register host controller
  * to the OTG.  Suspend host for OTG role detection.
  */
-static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host)
+static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
 {
 	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
 
@@ -587,7 +587,7 @@ static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host)
 }
 
 /* Called by initialization code of udc.  Register udc to OTG. */
-static int fsl_otg_set_peripheral(struct otg_transceiver *otg_p,
+static int fsl_otg_set_peripheral(struct usb_phy *otg_p,
 				  struct usb_gadget *gadget)
 {
 	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
@@ -625,7 +625,7 @@ static int fsl_otg_set_peripheral(struct otg_transceiver *otg_p,
 }
 
 /* Set OTG port power, only for B-device */
-static int fsl_otg_set_power(struct otg_transceiver *otg_p, unsigned mA)
+static int fsl_otg_set_power(struct usb_phy *otg_p, unsigned mA)
 {
 	if (!fsl_otg_dev)
 		return -ENODEV;
@@ -658,7 +658,7 @@ static void fsl_otg_event(struct work_struct *work)
 }
 
 /* B-device start SRP */
-static int fsl_otg_start_srp(struct otg_transceiver *otg_p)
+static int fsl_otg_start_srp(struct usb_phy *otg_p)
 {
 	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
 
@@ -673,7 +673,7 @@ static int fsl_otg_start_srp(struct otg_transceiver *otg_p)
 }
 
 /* A_host suspend will call this function to start hnp */
-static int fsl_otg_start_hnp(struct otg_transceiver *otg_p)
+static int fsl_otg_start_hnp(struct usb_phy *otg_p)
 {
 	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
 
@@ -698,7 +698,7 @@ static int fsl_otg_start_hnp(struct otg_transceiver *otg_p)
 irqreturn_t fsl_otg_isr(int irq, void *dev_id)
 {
 	struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm;
-	struct otg_transceiver *otg = &((struct fsl_otg *)dev_id)->otg;
+	struct usb_phy *otg = &((struct fsl_otg *)dev_id)->otg;
 	u32 otg_int_src, otg_sc;
 
 	otg_sc = fsl_readl(&usb_dr_regs->otgsc);
@@ -815,7 +815,7 @@ err:
 int usb_otg_start(struct platform_device *pdev)
 {
 	struct fsl_otg *p_otg;
-	struct otg_transceiver *otg_trans = otg_get_transceiver();
+	struct usb_phy *otg_trans = otg_get_transceiver();
 	struct otg_fsm *fsm;
 	int status;
 	struct resource *res;
diff --git a/drivers/usb/otg/fsl_otg.h b/drivers/usb/otg/fsl_otg.h
index 3f8ef73..caec254 100644
--- a/drivers/usb/otg/fsl_otg.h
+++ b/drivers/usb/otg/fsl_otg.h
@@ -369,7 +369,7 @@ inline struct fsl_otg_timer *otg_timer_initializer
 }
 
 struct fsl_otg {
-	struct otg_transceiver otg;
+	struct usb_phy otg;
 	struct otg_fsm fsm;
 	struct usb_dr_mmap *dr_mem_map;
 	struct delayed_work otg_event;
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 52733d9..5e4c7a0 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -31,7 +31,7 @@
  * Needs to be loaded before the UDC driver that will use it.
  */
 struct gpio_vbus_data {
-	struct otg_transceiver otg;
+	struct usb_phy		otg;
 	struct device          *dev;
 	struct regulator       *vbus_draw;
 	int			vbus_draw_enabled;
@@ -148,7 +148,7 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data)
 /* OTG transceiver interface */
 
 /* bind/unbind the peripheral controller */
-static int gpio_vbus_set_peripheral(struct otg_transceiver *otg,
+static int gpio_vbus_set_peripheral(struct usb_phy *otg,
 				struct usb_gadget *gadget)
 {
 	struct gpio_vbus_data *gpio_vbus;
@@ -188,7 +188,7 @@ static int gpio_vbus_set_peripheral(struct otg_transceiver *otg,
 }
 
 /* effective for B devices, ignored for A-peripheral */
-static int gpio_vbus_set_power(struct otg_transceiver *otg, unsigned mA)
+static int gpio_vbus_set_power(struct usb_phy *otg, unsigned mA)
 {
 	struct gpio_vbus_data *gpio_vbus;
 
@@ -200,7 +200,7 @@ static int gpio_vbus_set_power(struct otg_transceiver *otg, unsigned mA)
 }
 
 /* for non-OTG B devices: set/clear transceiver suspend mode */
-static int gpio_vbus_set_suspend(struct otg_transceiver *otg, int suspend)
+static int gpio_vbus_set_suspend(struct usb_phy *otg, int suspend)
 {
 	struct gpio_vbus_data *gpio_vbus;
 
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index ca9b690..a0250b2 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -52,7 +52,7 @@ MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
 MODULE_LICENSE("GPL");
 
 struct isp1301 {
-	struct otg_transceiver	otg;
+	struct usb_phy		otg;
 	struct i2c_client	*client;
 	void			(*i2c_release)(struct device *dev);
 
@@ -1274,7 +1274,7 @@ static int isp1301_otg_enable(struct isp1301 *isp)
 
 /* add or disable the host device+driver */
 static int
-isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
+isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
 {
 	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 
@@ -1330,7 +1330,7 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
 }
 
 static int
-isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
+isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 {
 	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 #ifndef	CONFIG_USB_OTG
@@ -1399,7 +1399,7 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
 /*-------------------------------------------------------------------------*/
 
 static int
-isp1301_set_power(struct otg_transceiver *dev, unsigned mA)
+isp1301_set_power(struct usb_phy *dev, unsigned mA)
 {
 	if (!the_transceiver)
 		return -ENODEV;
@@ -1409,7 +1409,7 @@ isp1301_set_power(struct otg_transceiver *dev, unsigned mA)
 }
 
 static int
-isp1301_start_srp(struct otg_transceiver *dev)
+isp1301_start_srp(struct usb_phy *dev)
 {
 	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
 	u32		otg_ctrl;
@@ -1436,7 +1436,7 @@ isp1301_start_srp(struct otg_transceiver *dev)
 }
 
 static int
-isp1301_start_hnp(struct otg_transceiver *dev)
+isp1301_start_hnp(struct usb_phy *dev)
 {
 #ifdef	CONFIG_USB_OTG
 	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index f08f784..880cdf2 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -55,11 +55,11 @@ static void langwell_otg_remove(struct pci_dev *pdev);
 static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message);
 static int langwell_otg_resume(struct pci_dev *pdev);
 
-static int langwell_otg_set_host(struct otg_transceiver *otg,
+static int langwell_otg_set_host(struct usb_phy *otg,
 				struct usb_bus *host);
-static int langwell_otg_set_peripheral(struct otg_transceiver *otg,
+static int langwell_otg_set_peripheral(struct usb_phy *otg,
 				struct usb_gadget *gadget);
-static int langwell_otg_start_srp(struct otg_transceiver *otg);
+static int langwell_otg_start_srp(struct usb_phy *otg);
 
 static const struct pci_device_id pci_ids[] = {{
 	.class =        ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
@@ -118,7 +118,7 @@ void langwell_update_transceiver(void)
 }
 EXPORT_SYMBOL(langwell_update_transceiver);
 
-static int langwell_otg_set_host(struct otg_transceiver *otg,
+static int langwell_otg_set_host(struct usb_phy *otg,
 					struct usb_bus *host)
 {
 	otg->host = host;
@@ -126,7 +126,7 @@ static int langwell_otg_set_host(struct otg_transceiver *otg,
 	return 0;
 }
 
-static int langwell_otg_set_peripheral(struct otg_transceiver *otg,
+static int langwell_otg_set_peripheral(struct usb_phy *otg,
 					struct usb_gadget *gadget)
 {
 	otg->gadget = gadget;
@@ -134,14 +134,14 @@ static int langwell_otg_set_peripheral(struct otg_transceiver *otg,
 	return 0;
 }
 
-static int langwell_otg_set_power(struct otg_transceiver *otg,
+static int langwell_otg_set_power(struct usb_phy *otg,
 				unsigned mA)
 {
 	return 0;
 }
 
 /* A-device drives vbus, controlled through IPC commands */
-static int langwell_otg_set_vbus(struct otg_transceiver *otg, bool enabled)
+static int langwell_otg_set_vbus(struct usb_phy *otg, bool enabled)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	u8				sub_id;
@@ -180,7 +180,7 @@ static void langwell_otg_chrg_vbus(int on)
 }
 
 /* Start SRP */
-static int langwell_otg_start_srp(struct otg_transceiver *otg)
+static int langwell_otg_start_srp(struct usb_phy *otg)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index b276f8f..cba4737 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -235,7 +235,7 @@ static int msm_hsusb_ldo_set_mode(int on)
 	return ret < 0 ? ret : 0;
 }
 
-static int ulpi_read(struct otg_transceiver *otg, u32 reg)
+static int ulpi_read(struct usb_phy *otg, u32 reg)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	int cnt = 0;
@@ -260,7 +260,7 @@ static int ulpi_read(struct otg_transceiver *otg, u32 reg)
 	return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT));
 }
 
-static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
+static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	int cnt = 0;
@@ -390,7 +390,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
 }
 
 #define LINK_RESET_TIMEOUT_USEC		(250 * 1000)
-static int msm_otg_reset(struct otg_transceiver *otg)
+static int msm_otg_reset(struct usb_phy *otg)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	struct msm_otg_platform_data *pdata = motg->pdata;
@@ -448,7 +448,7 @@ static int msm_otg_reset(struct otg_transceiver *otg)
 #ifdef CONFIG_PM_SLEEP
 static int msm_otg_suspend(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	struct usb_bus *bus = otg->host;
 	struct msm_otg_platform_data *pdata = motg->pdata;
 	int cnt = 0;
@@ -543,7 +543,7 @@ static int msm_otg_suspend(struct msm_otg *motg)
 
 static int msm_otg_resume(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	struct usb_bus *bus = otg->host;
 	int cnt = 0;
 	unsigned temp;
@@ -627,7 +627,7 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
 	motg->cur_power = mA;
 }
 
-static int msm_otg_set_power(struct otg_transceiver *otg, unsigned mA)
+static int msm_otg_set_power(struct usb_phy *otg, unsigned mA)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 
@@ -644,7 +644,7 @@ static int msm_otg_set_power(struct otg_transceiver *otg, unsigned mA)
 	return 0;
 }
 
-static void msm_otg_start_host(struct otg_transceiver *otg, int on)
+static void msm_otg_start_host(struct usb_phy *otg, int on)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	struct msm_otg_platform_data *pdata = motg->pdata;
@@ -683,7 +683,7 @@ static void msm_otg_start_host(struct otg_transceiver *otg, int on)
 	}
 }
 
-static int msm_otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
+static int msm_otg_set_host(struct usb_phy *otg, struct usb_bus *host)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	struct usb_hcd *hcd;
@@ -729,7 +729,7 @@ static int msm_otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
 	return 0;
 }
 
-static void msm_otg_start_peripheral(struct otg_transceiver *otg, int on)
+static void msm_otg_start_peripheral(struct usb_phy *otg, int on)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
 	struct msm_otg_platform_data *pdata = motg->pdata;
@@ -756,7 +756,7 @@ static void msm_otg_start_peripheral(struct otg_transceiver *otg, int on)
 
 }
 
-static int msm_otg_set_peripheral(struct otg_transceiver *otg,
+static int msm_otg_set_peripheral(struct usb_phy *otg,
 			struct usb_gadget *gadget)
 {
 	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
@@ -800,7 +800,7 @@ static int msm_otg_set_peripheral(struct otg_transceiver *otg,
 
 static bool msm_chg_check_secondary_det(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 	bool ret = false;
 
@@ -821,7 +821,7 @@ static bool msm_chg_check_secondary_det(struct msm_otg *motg)
 
 static void msm_chg_enable_secondary_det(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
@@ -861,7 +861,7 @@ static void msm_chg_enable_secondary_det(struct msm_otg *motg)
 
 static bool msm_chg_check_primary_det(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 	bool ret = false;
 
@@ -882,7 +882,7 @@ static bool msm_chg_check_primary_det(struct msm_otg *motg)
 
 static void msm_chg_enable_primary_det(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
@@ -907,7 +907,7 @@ static void msm_chg_enable_primary_det(struct msm_otg *motg)
 
 static bool msm_chg_check_dcd(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 line_state;
 	bool ret = false;
 
@@ -928,7 +928,7 @@ static bool msm_chg_check_dcd(struct msm_otg *motg)
 
 static void msm_chg_disable_dcd(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
@@ -947,7 +947,7 @@ static void msm_chg_disable_dcd(struct msm_otg *motg)
 
 static void msm_chg_enable_dcd(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
@@ -968,7 +968,7 @@ static void msm_chg_enable_dcd(struct msm_otg *motg)
 
 static void msm_chg_block_on(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 func_ctrl, chg_det;
 
 	/* put the controller in non-driving mode */
@@ -1003,7 +1003,7 @@ static void msm_chg_block_on(struct msm_otg *motg)
 
 static void msm_chg_block_off(struct msm_otg *motg)
 {
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 func_ctrl, chg_det;
 
 	switch (motg->pdata->phy_type) {
@@ -1038,7 +1038,7 @@ static void msm_chg_block_off(struct msm_otg *motg)
 static void msm_chg_detect_work(struct work_struct *w)
 {
 	struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work);
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	bool is_dcd, tmout, vout;
 	unsigned long delay;
 
@@ -1152,7 +1152,7 @@ static void msm_otg_init_sm(struct msm_otg *motg)
 static void msm_otg_sm_work(struct work_struct *w)
 {
 	struct msm_otg *motg = container_of(w, struct msm_otg, sm_work);
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 
 	switch (otg->state) {
 	case OTG_STATE_UNDEFINED:
@@ -1243,7 +1243,7 @@ static void msm_otg_sm_work(struct work_struct *w)
 static irqreturn_t msm_otg_irq(int irq, void *data)
 {
 	struct msm_otg *motg = data;
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	u32 otgsc = 0;
 
 	if (atomic_read(&motg->in_lpm)) {
@@ -1281,7 +1281,7 @@ static irqreturn_t msm_otg_irq(int irq, void *data)
 static int msm_otg_mode_show(struct seq_file *s, void *unused)
 {
 	struct msm_otg *motg = s->private;
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 
 	switch (otg->state) {
 	case OTG_STATE_A_HOST:
@@ -1309,7 +1309,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 	struct seq_file *s = file->private_data;
 	struct msm_otg *motg = s->private;
 	char buf[16];
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	int status = count;
 	enum usb_mode_type req_mode;
 
@@ -1414,7 +1414,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 	int ret = 0;
 	struct resource *res;
 	struct msm_otg *motg;
-	struct otg_transceiver *otg;
+	struct usb_phy *otg;
 
 	dev_info(&pdev->dev, "msm_otg probe\n");
 	if (!pdev->dev.platform_data) {
@@ -1598,7 +1598,7 @@ free_motg:
 static int __devexit msm_otg_remove(struct platform_device *pdev)
 {
 	struct msm_otg *motg = platform_get_drvdata(pdev);
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 	int cnt = 0;
 
 	if (otg->host || otg->gadget)
@@ -1660,7 +1660,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 static int msm_otg_runtime_idle(struct device *dev)
 {
 	struct msm_otg *motg = dev_get_drvdata(dev);
-	struct otg_transceiver *otg = &motg->otg;
+	struct usb_phy *otg = &motg->otg;
 
 	dev_dbg(dev, "OTG runtime idle\n");
 
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index c1e3600..2ab0279 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -33,7 +33,7 @@
 #include <linux/slab.h>
 
 struct nop_usb_xceiv {
-	struct otg_transceiver	otg;
+	struct usb_phy		otg;
 	struct device		*dev;
 };
 
@@ -58,17 +58,17 @@ void usb_nop_xceiv_unregister(void)
 }
 EXPORT_SYMBOL(usb_nop_xceiv_unregister);
 
-static inline struct nop_usb_xceiv *xceiv_to_nop(struct otg_transceiver *x)
+static inline struct nop_usb_xceiv *xceiv_to_nop(struct usb_phy *x)
 {
 	return container_of(x, struct nop_usb_xceiv, otg);
 }
 
-static int nop_set_suspend(struct otg_transceiver *x, int suspend)
+static int nop_set_suspend(struct usb_phy *x, int suspend)
 {
 	return 0;
 }
 
-static int nop_set_peripheral(struct otg_transceiver *x,
+static int nop_set_peripheral(struct usb_phy *x,
 		struct usb_gadget *gadget)
 {
 	struct nop_usb_xceiv *nop;
@@ -88,7 +88,7 @@ static int nop_set_peripheral(struct otg_transceiver *x,
 	return 0;
 }
 
-static int nop_set_host(struct otg_transceiver *x, struct usb_bus *host)
+static int nop_set_host(struct usb_phy *x, struct usb_bus *host)
 {
 	struct nop_usb_xceiv *nop;
 
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index fb7adef..059c487 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -14,7 +14,7 @@
 
 #include <linux/usb/otg.h>
 
-static struct otg_transceiver *xceiv;
+static struct usb_phy *xceiv;
 
 /**
  * otg_get_transceiver - find the (single) OTG transceiver
@@ -25,7 +25,7 @@ static struct otg_transceiver *xceiv;
  *
  * For use by USB host and peripheral drivers.
  */
-struct otg_transceiver *otg_get_transceiver(void)
+struct usb_phy *otg_get_transceiver(void)
 {
 	if (xceiv)
 		get_device(xceiv->dev);
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(otg_get_transceiver);
  *
  * For use by USB host and peripheral drivers.
  */
-void otg_put_transceiver(struct otg_transceiver *x)
+void otg_put_transceiver(struct usb_phy *x)
 {
 	if (x)
 		put_device(x->dev);
@@ -56,7 +56,7 @@ EXPORT_SYMBOL(otg_put_transceiver);
  * coordinate the activities of drivers for host and peripheral
  * controllers, and in some cases for VBUS current regulation.
  */
-int otg_set_transceiver(struct otg_transceiver *x)
+int otg_set_transceiver(struct usb_phy *x)
 {
 	if (xceiv && x)
 		return -EBUSY;
diff --git a/drivers/usb/otg/otg_fsm.h b/drivers/usb/otg/otg_fsm.h
index 0cecf1d..5e589ae 100644
--- a/drivers/usb/otg/otg_fsm.h
+++ b/drivers/usb/otg/otg_fsm.h
@@ -82,7 +82,7 @@ struct otg_fsm {
 	int loc_sof;
 
 	struct otg_fsm_ops *ops;
-	struct otg_transceiver *transceiver;
+	struct usb_phy *transceiver;
 
 	/* Current usb protocol used: 0:undefine; 1:host; 2:client */
 	int protocol;
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 14f66c3..beeecc2 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -144,7 +144,7 @@
 #define GPIO_USB_4PIN_ULPI_2430C	(3 << 0)
 
 struct twl4030_usb {
-	struct otg_transceiver	otg;
+	struct usb_phy		otg;
 	struct device		*dev;
 
 	/* TWL4030 internal USB regulator supplies */
@@ -548,7 +548,7 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
 }
 
-static int twl4030_set_suspend(struct otg_transceiver *x, int suspend)
+static int twl4030_set_suspend(struct usb_phy *x, int suspend)
 {
 	struct twl4030_usb *twl = xceiv_to_twl(x);
 
@@ -560,7 +560,7 @@ static int twl4030_set_suspend(struct otg_transceiver *x, int suspend)
 	return 0;
 }
 
-static int twl4030_set_peripheral(struct otg_transceiver *x,
+static int twl4030_set_peripheral(struct usb_phy *x,
 		struct usb_gadget *gadget)
 {
 	struct twl4030_usb *twl;
@@ -576,7 +576,7 @@ static int twl4030_set_peripheral(struct otg_transceiver *x,
 	return 0;
 }
 
-static int twl4030_set_host(struct otg_transceiver *x, struct usb_bus *host)
+static int twl4030_set_host(struct usb_phy *x, struct usb_bus *host)
 {
 	struct twl4030_usb *twl;
 
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index b4d2c09..e6e63fb 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -87,7 +87,7 @@
 #define	VBUS_DET			BIT(2)
 
 struct twl6030_usb {
-	struct otg_transceiver	otg;
+	struct usb_phy		otg;
 	struct device		*dev;
 
 	/* for vbus reporting with irqs disabled */
@@ -138,7 +138,7 @@ static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address)
 }
 
 /*-------------------------------------------------------------------------*/
-static int twl6030_set_phy_clk(struct otg_transceiver *x, int on)
+static int twl6030_set_phy_clk(struct usb_phy *x, int on)
 {
 	struct twl6030_usb *twl;
 	struct device *dev;
@@ -153,7 +153,7 @@ static int twl6030_set_phy_clk(struct otg_transceiver *x, int on)
 	return 0;
 }
 
-static int twl6030_phy_init(struct otg_transceiver *x)
+static int twl6030_phy_init(struct usb_phy *x)
 {
 	struct twl6030_usb *twl;
 	struct device *dev;
@@ -171,7 +171,7 @@ static int twl6030_phy_init(struct otg_transceiver *x)
 	return 0;
 }
 
-static void twl6030_phy_shutdown(struct otg_transceiver *x)
+static void twl6030_phy_shutdown(struct usb_phy *x)
 {
 	struct twl6030_usb *twl;
 	struct device *dev;
@@ -183,7 +183,7 @@ static void twl6030_phy_shutdown(struct otg_transceiver *x)
 	pdata->phy_power(twl->dev, 0, 0);
 }
 
-static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend)
+static int twl6030_phy_suspend(struct usb_phy *x, int suspend)
 {
 	struct twl6030_usb *twl = xceiv_to_twl(x);
 	struct device *dev = twl->dev;
@@ -194,7 +194,7 @@ static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend)
 	return 0;
 }
 
-static int twl6030_start_srp(struct otg_transceiver *x)
+static int twl6030_start_srp(struct usb_phy *x)
 {
 	struct twl6030_usb *twl = xceiv_to_twl(x);
 
@@ -340,7 +340,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 	return IRQ_HANDLED;
 }
 
-static int twl6030_set_peripheral(struct otg_transceiver *x,
+static int twl6030_set_peripheral(struct usb_phy *x,
 		struct usb_gadget *gadget)
 {
 	struct twl6030_usb *twl;
@@ -356,7 +356,7 @@ static int twl6030_set_peripheral(struct otg_transceiver *x,
 	return 0;
 }
 
-static int twl6030_enable_irq(struct otg_transceiver *x)
+static int twl6030_enable_irq(struct usb_phy *x)
 {
 	struct twl6030_usb *twl = xceiv_to_twl(x);
 
@@ -392,7 +392,7 @@ static void otg_set_vbus_work(struct work_struct *data)
 							CHARGERUSB_CTRL1);
 }
 
-static int twl6030_set_vbus(struct otg_transceiver *x, bool enabled)
+static int twl6030_set_vbus(struct usb_phy *x, bool enabled)
 {
 	struct twl6030_usb *twl = xceiv_to_twl(x);
 
@@ -402,7 +402,7 @@ static int twl6030_set_vbus(struct otg_transceiver *x, bool enabled)
 	return 0;
 }
 
-static int twl6030_set_host(struct otg_transceiver *x, struct usb_bus *host)
+static int twl6030_set_host(struct usb_phy *x, struct usb_bus *host)
 {
 	struct twl6030_usb *twl;
 
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 770d799..abc2339 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -48,7 +48,7 @@ static struct ulpi_info ulpi_ids[] = {
 	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
 };
 
-static int ulpi_set_otg_flags(struct otg_transceiver *otg)
+static int ulpi_set_otg_flags(struct usb_phy *otg)
 {
 	unsigned int flags = ULPI_OTG_CTRL_DP_PULLDOWN |
 			     ULPI_OTG_CTRL_DM_PULLDOWN;
@@ -72,7 +72,7 @@ static int ulpi_set_otg_flags(struct otg_transceiver *otg)
 	return otg_io_write(otg, flags, ULPI_OTG_CTRL);
 }
 
-static int ulpi_set_fc_flags(struct otg_transceiver *otg)
+static int ulpi_set_fc_flags(struct usb_phy *otg)
 {
 	unsigned int flags = 0;
 
@@ -114,7 +114,7 @@ static int ulpi_set_fc_flags(struct otg_transceiver *otg)
 	return otg_io_write(otg, flags, ULPI_FUNC_CTRL);
 }
 
-static int ulpi_set_ic_flags(struct otg_transceiver *otg)
+static int ulpi_set_ic_flags(struct usb_phy *otg)
 {
 	unsigned int flags = 0;
 
@@ -133,7 +133,7 @@ static int ulpi_set_ic_flags(struct otg_transceiver *otg)
 	return otg_io_write(otg, flags, ULPI_IFC_CTRL);
 }
 
-static int ulpi_set_flags(struct otg_transceiver *otg)
+static int ulpi_set_flags(struct usb_phy *otg)
 {
 	int ret;
 
@@ -148,7 +148,7 @@ static int ulpi_set_flags(struct otg_transceiver *otg)
 	return ulpi_set_fc_flags(otg);
 }
 
-static int ulpi_check_integrity(struct otg_transceiver *otg)
+static int ulpi_check_integrity(struct usb_phy *otg)
 {
 	int ret, i;
 	unsigned int val = 0x55;
@@ -174,7 +174,7 @@ static int ulpi_check_integrity(struct otg_transceiver *otg)
 	return 0;
 }
 
-static int ulpi_init(struct otg_transceiver *otg)
+static int ulpi_init(struct usb_phy *otg)
 {
 	int i, vid, pid, ret;
 	u32 ulpi_id = 0;
@@ -205,7 +205,7 @@ static int ulpi_init(struct otg_transceiver *otg)
 	return ulpi_set_flags(otg);
 }
 
-static int ulpi_set_host(struct otg_transceiver *otg, struct usb_bus *host)
+static int ulpi_set_host(struct usb_phy *otg, struct usb_bus *host)
 {
 	unsigned int flags = otg_io_read(otg, ULPI_IFC_CTRL);
 
@@ -230,7 +230,7 @@ static int ulpi_set_host(struct otg_transceiver *otg, struct usb_bus *host)
 	return otg_io_write(otg, flags, ULPI_IFC_CTRL);
 }
 
-static int ulpi_set_vbus(struct otg_transceiver *otg, bool on)
+static int ulpi_set_vbus(struct usb_phy *otg, bool on)
 {
 	unsigned int flags = otg_io_read(otg, ULPI_OTG_CTRL);
 
@@ -247,11 +247,11 @@ static int ulpi_set_vbus(struct otg_transceiver *otg, bool on)
 	return otg_io_write(otg, flags, ULPI_OTG_CTRL);
 }
 
-struct otg_transceiver *
+struct usb_phy *
 otg_ulpi_create(struct otg_io_access_ops *ops,
 		unsigned int flags)
 {
-	struct otg_transceiver *otg;
+	struct usb_phy *otg;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
 	if (!otg)
diff --git a/drivers/usb/otg/ulpi_viewport.c b/drivers/usb/otg/ulpi_viewport.c
index e9a37f9..e7b311b 100644
--- a/drivers/usb/otg/ulpi_viewport.c
+++ b/drivers/usb/otg/ulpi_viewport.c
@@ -40,7 +40,7 @@ static int ulpi_viewport_wait(void __iomem *view, u32 mask)
 	return -ETIMEDOUT;
 }
 
-static int ulpi_viewport_read(struct otg_transceiver *otg, u32 reg)
+static int ulpi_viewport_read(struct usb_phy *otg, u32 reg)
 {
 	int ret;
 	void __iomem *view = otg->io_priv;
@@ -58,7 +58,7 @@ static int ulpi_viewport_read(struct otg_transceiver *otg, u32 reg)
 	return ULPI_VIEW_DATA_READ(readl(view));
 }
 
-static int ulpi_viewport_write(struct otg_transceiver *otg, u32 val, u32 reg)
+static int ulpi_viewport_write(struct usb_phy *otg, u32 val, u32 reg)
 {
 	int ret;
 	void __iomem *view = otg->io_priv;
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
index a0ccf79..756cf55 100644
--- a/include/linux/usb/intel_mid_otg.h
+++ b/include/linux/usb/intel_mid_otg.h
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops {
 /*
  * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
  * with device and host drivers to implement the USB OTG related feature. More
- * function members are added based on otg_transceiver data structure for this
+ * function members are added based on usb_phy data structure for this
  * purpose.
  */
 struct intel_mid_otg_xceiv {
-	struct otg_transceiver	otg;
+	struct usb_phy		otg;
 	struct otg_hsm		hsm;
 
 	/* base address */
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv {
 
 };
 static inline
-struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg)
+struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
 {
 	return container_of(otg, struct intel_mid_otg_xceiv, otg);
 }
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 00311fe..2d3547a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -160,7 +160,7 @@ struct msm_otg_platform_data {
  *               detection process.
  */
 struct msm_otg {
-	struct otg_transceiver otg;
+	struct usb_phy otg;
 	struct msm_otg_platform_data *pdata;
 	int irq;
 	struct clk *clk;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index d87f44f..e0bc557 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,14 +43,14 @@ enum usb_xceiv_events {
 	USB_EVENT_ENUMERATED,   /* gadget driver enumerated */
 };
 
-struct otg_transceiver;
+struct usb_phy;
 
 /* for transceivers connected thru an ULPI interface, the user must
  * provide access ops
  */
 struct otg_io_access_ops {
-	int (*read)(struct otg_transceiver *otg, u32 reg);
-	int (*write)(struct otg_transceiver *otg, u32 val, u32 reg);
+	int (*read)(struct usb_phy *x, u32 reg);
+	int (*write)(struct usb_phy *x, u32 val, u32 reg);
 };
 
 /*
@@ -59,7 +59,7 @@ struct otg_io_access_ops {
  * moment, using the transceiver, ID signal, HNP and sometimes static
  * configuration information (including "board isn't wired for otg").
  */
-struct otg_transceiver {
+struct usb_phy {
 	struct device		*dev;
 	const char		*label;
 	unsigned int		 flags;
@@ -82,40 +82,40 @@ struct otg_transceiver {
 	u16			port_change;
 
 	/* initialize/shutdown the OTG controller */
-	int	(*init)(struct otg_transceiver *otg);
-	void	(*shutdown)(struct otg_transceiver *otg);
+	int	(*init)(struct usb_phy *x);
+	void	(*shutdown)(struct usb_phy *x);
 
 	/* bind/unbind the host controller */
-	int	(*set_host)(struct otg_transceiver *otg,
+	int	(*set_host)(struct usb_phy *x,
 				struct usb_bus *host);
 
 	/* bind/unbind the peripheral controller */
-	int	(*set_peripheral)(struct otg_transceiver *otg,
+	int	(*set_peripheral)(struct usb_phy *x,
 				struct usb_gadget *gadget);
 
 	/* effective for B devices, ignored for A-peripheral */
-	int	(*set_power)(struct otg_transceiver *otg,
+	int	(*set_power)(struct usb_phy *x,
 				unsigned mA);
 
 	/* effective for A-peripheral, ignored for B devices */
-	int	(*set_vbus)(struct otg_transceiver *otg,
+	int	(*set_vbus)(struct usb_phy *x,
 				bool enabled);
 
 	/* for non-OTG B devices: set transceiver into suspend mode */
-	int	(*set_suspend)(struct otg_transceiver *otg,
+	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
 	/* for B devices only:  start session with A-Host */
-	int	(*start_srp)(struct otg_transceiver *otg);
+	int	(*start_srp)(struct usb_phy *x);
 
 	/* start or continue HNP role switch */
-	int	(*start_hnp)(struct otg_transceiver *otg);
+	int	(*start_hnp)(struct usb_phy *x);
 
 };
 
 
 /* for board-specific init logic */
-extern int otg_set_transceiver(struct otg_transceiver *);
+extern int otg_set_transceiver(struct usb_phy *);
 
 #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
 /* sometimes transceivers are accessed only through e.g. ULPI */
@@ -132,50 +132,50 @@ static inline void usb_nop_xceiv_unregister(void)
 #endif
 
 /* helpers for direct access thru low-level io interface */
-static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
+static inline int otg_io_read(struct usb_phy *x, u32 reg)
 {
-	if (otg->io_ops && otg->io_ops->read)
-		return otg->io_ops->read(otg, reg);
+	if (x->io_ops && x->io_ops->read)
+		return x->io_ops->read(x, reg);
 
 	return -EINVAL;
 }
 
-static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg)
+static inline int otg_io_write(struct usb_phy *x, u32 val, u32 reg)
 {
-	if (otg->io_ops && otg->io_ops->write)
-		return otg->io_ops->write(otg, val, reg);
+	if (x->io_ops && x->io_ops->write)
+		return x->io_ops->write(x, val, reg);
 
 	return -EINVAL;
 }
 
 static inline int
-otg_init(struct otg_transceiver *otg)
+otg_init(struct usb_phy *x)
 {
-	if (otg->init)
-		return otg->init(otg);
+	if (x->init)
+		return x->init(x);
 
 	return 0;
 }
 
 static inline void
-otg_shutdown(struct otg_transceiver *otg)
+otg_shutdown(struct usb_phy *x)
 {
-	if (otg->shutdown)
-		otg->shutdown(otg);
+	if (x->shutdown)
+		x->shutdown(x);
 }
 
 /* for usb host and peripheral controller drivers */
 #ifdef CONFIG_USB_OTG_UTILS
-extern struct otg_transceiver *otg_get_transceiver(void);
-extern void otg_put_transceiver(struct otg_transceiver *);
+extern struct usb_phy *otg_get_transceiver(void);
+extern void otg_put_transceiver(struct usb_phy *);
 extern const char *otg_state_string(enum usb_otg_state state);
 #else
-static inline struct otg_transceiver *otg_get_transceiver(void)
+static inline struct usb_phy *otg_get_transceiver(void)
 {
 	return NULL;
 }
 
-static inline void otg_put_transceiver(struct otg_transceiver *x)
+static inline void otg_put_transceiver(struct usb_phy *x)
 {
 }
 
@@ -187,67 +187,67 @@ static inline const char *otg_state_string(enum usb_otg_state state)
 
 /* Context: can sleep */
 static inline int
-otg_start_hnp(struct otg_transceiver *otg)
+otg_start_hnp(struct usb_phy *x)
 {
-	return otg->start_hnp(otg);
+	return x->start_hnp(x);
 }
 
 /* Context: can sleep */
 static inline int
-otg_set_vbus(struct otg_transceiver *otg, bool enabled)
+otg_set_vbus(struct usb_phy *x, bool enabled)
 {
-	return otg->set_vbus(otg, enabled);
+	return x->set_vbus(x, enabled);
 }
 
 /* for HCDs */
 static inline int
-otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
+otg_set_host(struct usb_phy *x, struct usb_bus *host)
 {
-	return otg->set_host(otg, host);
+	return x->set_host(x, host);
 }
 
 /* for usb peripheral controller drivers */
 
 /* Context: can sleep */
 static inline int
-otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
+otg_set_peripheral(struct usb_phy *x, struct usb_gadget *periph)
 {
-	return otg->set_peripheral(otg, periph);
+	return x->set_peripheral(x, periph);
 }
 
 static inline int
-otg_set_power(struct otg_transceiver *otg, unsigned mA)
+otg_set_power(struct usb_phy *x, unsigned mA)
 {
-	return otg->set_power(otg, mA);
+	return x->set_power(x, mA);
 }
 
 /* Context: can sleep */
 static inline int
-otg_set_suspend(struct otg_transceiver *otg, int suspend)
+otg_set_suspend(struct usb_phy *x, int suspend)
 {
-	if (otg->set_suspend != NULL)
-		return otg->set_suspend(otg, suspend);
+	if (x->set_suspend != NULL)
+		return x->set_suspend(x, suspend);
 	else
 		return 0;
 }
 
 static inline int
-otg_start_srp(struct otg_transceiver *otg)
+otg_start_srp(struct usb_phy *x)
 {
-	return otg->start_srp(otg);
+	return x->start_srp(x);
 }
 
 /* notifiers */
 static inline int
-otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
+otg_register_notifier(struct usb_phy *x, struct notifier_block *nb)
 {
-	return atomic_notifier_chain_register(&otg->notifier, nb);
+	return atomic_notifier_chain_register(&x->notifier, nb);
 }
 
 static inline void
-otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
+otg_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
 {
-	atomic_notifier_chain_unregister(&otg->notifier, nb);
+	atomic_notifier_chain_unregister(&x->notifier, nb);
 }
 
 /* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 9595796..51ebf72 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -181,7 +181,7 @@
 
 /*-------------------------------------------------------------------------*/
 
-struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
+struct usb_phy *otg_ulpi_create(struct otg_io_access_ops *ops,
 					unsigned int flags);
 
 #ifdef CONFIG_USB_ULPI_VIEWPORT
-- 
1.7.4.1


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

* [PATCHv5 02/19] usb: otg: Rename usb_otg and usb_xceiv to usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 01/19] usb: otg: Rename otg_transceiver to usb_phy Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 03/19] usb: otg: Separate otg members from usb_phy Heikki Krogerus
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Renames OTG_STATE_* to USB_PHY_STATE_*,
usb_xceiv_event to usb_phy_event and
otg_state_string() to usb_phy_state_string().

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/power/pda_power.c       |    2 +-
 drivers/usb/host/ohci-omap.c    |    2 +-
 drivers/usb/musb/am35x.c        |   33 ++++---
 drivers/usb/musb/blackfin.c     |   22 ++--
 drivers/usb/musb/da8xx.c        |   33 ++++---
 drivers/usb/musb/davinci.c      |   20 ++--
 drivers/usb/musb/musb_core.c    |  151 ++++++++++++++++--------------
 drivers/usb/musb/musb_gadget.c  |   50 +++++-----
 drivers/usb/musb/musb_host.c    |    8 +-
 drivers/usb/musb/musb_virthub.c |   28 +++---
 drivers/usb/musb/omap2430.c     |   30 +++---
 drivers/usb/musb/tusb6010.c     |   60 ++++++------
 drivers/usb/otg/ab8500-usb.c    |   10 +-
 drivers/usb/otg/fsl_otg.c       |   16 ++--
 drivers/usb/otg/fsl_otg.h       |    2 +-
 drivers/usb/otg/gpio_vbus.c     |   10 +-
 drivers/usb/otg/isp1301_omap.c  |  198 ++++++++++++++++++++-------------------
 drivers/usb/otg/langwell_otg.c  |  178 +++++++++++++++++-----------------
 drivers/usb/otg/msm_otg.c       |   62 ++++++------
 drivers/usb/otg/nop-usb-xceiv.c |    4 +-
 drivers/usb/otg/otg.c           |   30 +++---
 drivers/usb/otg/otg_fsm.c       |  152 +++++++++++++++---------------
 drivers/usb/otg/twl4030-usb.c   |   10 +-
 drivers/usb/otg/twl6030-usb.c   |    8 +-
 include/linux/usb/msm_hsusb.h   |    2 +-
 include/linux/usb/otg.h         |   42 ++++----
 26 files changed, 590 insertions(+), 573 deletions(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 8f817e6..60433b7 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -222,7 +222,7 @@ static void polling_timer_func(unsigned long unused)
 #ifdef CONFIG_USB_OTG_UTILS
 static int otg_is_usb_online(void)
 {
-	return (transceiver->state == OTG_STATE_B_PERIPHERAL);
+	return (transceiver->state == USB_PHY_STATE_B_PERIPHERAL);
 }
 #endif
 
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 5645f70..bc45648 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -174,7 +174,7 @@ static void start_hnp(struct ohci_hcd *ohci)
 	otg_start_hnp(ohci->transceiver);
 
 	local_irq_save(flags);
-	ohci->transceiver->state = OTG_STATE_A_SUSPEND;
+	ohci->transceiver->state = USB_PHY_STATE_A_SUSPEND;
 	writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
 	l = omap_readl(OTG_CTRL);
 	l &= ~OTG_A_BUSREQ;
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 08f1d0b6..ee1c43e 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -148,29 +148,29 @@ static void otg_timer(unsigned long _musb)
 	 */
 	devctl = musb_readb(mregs, MUSB_DEVCTL);
 	dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl,
-		otg_state_string(musb->xceiv->state));
+		usb_phy_state_string(musb->xceiv->state));
 
 	spin_lock_irqsave(&musb->lock, flags);
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		devctl &= ~MUSB_DEVCTL_SESSION;
 		musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
 
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 		if (devctl & MUSB_DEVCTL_BDEVICE) {
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			MUSB_DEV_MODE(musb);
 		} else {
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 			MUSB_HST_MODE(musb);
 		}
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
-		musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+	case USB_PHY_STATE_A_WAIT_VFALL:
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG,
 			    MUSB_INTR_VBUSERROR << AM35X_INTR_USB_SHIFT);
 		break;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		if (!is_peripheral_enabled(musb))
 			break;
 
@@ -178,7 +178,7 @@ static void otg_timer(unsigned long _musb)
 		if (devctl & MUSB_DEVCTL_BDEVICE)
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 		else
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 		break;
 	default:
 		break;
@@ -198,9 +198,10 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
 
 	/* Never idle if active, or when VBUS timeout is not set as host */
 	if (musb->is_active || (musb->a_wait_bcon == 0 &&
-				musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
+				musb->xceiv->state ==
+						USB_PHY_STATE_A_WAIT_BCON)) {
 		dev_dbg(musb->controller, "%s active, deleting timer\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		del_timer(&otg_workaround);
 		last_timer = jiffies;
 		return;
@@ -213,7 +214,7 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
 	last_timer = timeout;
 
 	dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		jiffies_to_msecs(timeout - jiffies));
 	mod_timer(&otg_workaround, timeout);
 }
@@ -283,27 +284,27 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
 			 * devctl.
 			 */
 			musb->int_usb &= ~MUSB_INTR_VBUSERROR;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
 			musb->xceiv->default_a = 1;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
 			musb->xceiv->default_a = 0;
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
 
 		/* NOTE: this must complete power-on within 100 ms. */
 		dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
 				drvvbus ? "on" : "off",
-				otg_state_string(musb->xceiv->state),
+				usb_phy_state_string(musb->xceiv->state),
 				err ? " ERROR" : "",
 				devctl);
 		ret = IRQ_HANDLED;
@@ -323,7 +324,7 @@ eoi:
 	}
 
 	/* Poll for ID change */
-	if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE)
+	if (is_otg_enabled(musb) && musb->xceiv->state == USB_PHY_STATE_B_IDLE)
 		mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 
 	spin_unlock_irqrestore(&musb->lock, flags);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index fc8e9ed..2f3e0b0 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -183,8 +183,8 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
 	}
 
 	/* Start sampling ID pin, when plug is removed from MUSB */
-	if ((is_otg_enabled(musb) && (musb->xceiv->state == OTG_STATE_B_IDLE
-		|| musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) ||
+	if ((is_otg_enabled(musb) && (musb->xceiv->state == USB_PHY_STATE_B_IDLE
+		|| musb->xceiv->state == USB_PHY_STATE_A_WAIT_BCON)) ||
 		(musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) {
 		mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
 		musb->a_wait_bcon = TIMER_DELAY;
@@ -204,8 +204,8 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
 	spin_lock_irqsave(&musb->lock, flags);
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_IDLE:
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_IDLE:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		/* Start a new session */
 		val = musb_readw(musb->mregs, MUSB_DEVCTL);
 		val &= ~MUSB_DEVCTL_SESSION;
@@ -217,7 +217,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
 		if (!(val & MUSB_DEVCTL_BDEVICE)) {
 			gpio_set_value(musb->config->gpio_vrsel, 1);
-			musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		} else {
 			gpio_set_value(musb->config->gpio_vrsel, 0);
 			/* Ignore VBUSERROR and SUSPEND IRQ */
@@ -228,13 +228,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
 			val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
 			musb_writeb(musb->mregs, MUSB_INTRUSB, val);
 			if (is_otg_enabled(musb))
-				musb->xceiv->state = OTG_STATE_B_IDLE;
+				musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			else
 				musb_writeb(musb->mregs, MUSB_POWER, MUSB_POWER_HSENAB);
 		}
 		mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
 		break;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 
 		if (!is_peripheral_enabled(musb))
 			break;
@@ -248,7 +248,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
 
 		if (!(val & MUSB_DEVCTL_BDEVICE)) {
 			gpio_set_value(musb->config->gpio_vrsel, 1);
-			musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		} else {
 			gpio_set_value(musb->config->gpio_vrsel, 0);
 
@@ -283,13 +283,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
 		break;
 	default:
 		dev_dbg(musb->controller, "%s state not handled\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		break;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
 
 	dev_dbg(musb->controller, "state is %s\n",
-		otg_state_string(musb->xceiv->state));
+		usb_phy_state_string(musb->xceiv->state));
 }
 
 static void bfin_musb_enable(struct musb *musb)
@@ -313,7 +313,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on)
 
 	dev_dbg(musb->controller, "VBUS %s, devctl %02x "
 		/* otg %3x conf %08x prcm %08x */ "\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		musb_readb(musb->mregs, MUSB_DEVCTL));
 }
 
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 4da7492..fc982fa 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -196,24 +196,24 @@ static void otg_timer(unsigned long _musb)
 	 */
 	devctl = musb_readb(mregs, MUSB_DEVCTL);
 	dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl,
-		otg_state_string(musb->xceiv->state));
+		usb_phy_state_string(musb->xceiv->state));
 
 	spin_lock_irqsave(&musb->lock, flags);
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		devctl &= ~MUSB_DEVCTL_SESSION;
 		musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
 
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 		if (devctl & MUSB_DEVCTL_BDEVICE) {
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			MUSB_DEV_MODE(musb);
 		} else {
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 			MUSB_HST_MODE(musb);
 		}
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		/*
 		 * Wait till VBUS falls below SessionEnd (~0.2 V); the 1.3
 		 * RTL seems to mis-handle session "start" otherwise (or in
@@ -224,11 +224,11 @@ static void otg_timer(unsigned long _musb)
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 			break;
 		}
-		musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		musb_writel(musb->ctrl_base, DA8XX_USB_INTR_SRC_SET_REG,
 			    MUSB_INTR_VBUSERROR << DA8XX_INTR_USB_SHIFT);
 		break;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		if (!is_peripheral_enabled(musb))
 			break;
 
@@ -249,7 +249,7 @@ static void otg_timer(unsigned long _musb)
 		if (devctl & MUSB_DEVCTL_BDEVICE)
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 		else
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 		break;
 	default:
 		break;
@@ -269,9 +269,10 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
 
 	/* Never idle if active, or when VBUS timeout is not set as host */
 	if (musb->is_active || (musb->a_wait_bcon == 0 &&
-				musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
+				musb->xceiv->state ==
+						USB_PHY_STATE_A_WAIT_BCON)) {
 		dev_dbg(musb->controller, "%s active, deleting timer\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		del_timer(&otg_workaround);
 		last_timer = jiffies;
 		return;
@@ -284,7 +285,7 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout)
 	last_timer = timeout;
 
 	dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		jiffies_to_msecs(timeout - jiffies));
 	mod_timer(&otg_workaround, timeout);
 }
@@ -345,26 +346,26 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
 			 * devctl.
 			 */
 			musb->int_usb &= ~MUSB_INTR_VBUSERROR;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
 			musb->xceiv->default_a = 1;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
 			musb->xceiv->default_a = 0;
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
 
 		dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
 				drvvbus ? "on" : "off",
-				otg_state_string(musb->xceiv->state),
+				usb_phy_state_string(musb->xceiv->state),
 				err ? " ERROR" : "",
 				devctl);
 		ret = IRQ_HANDLED;
@@ -379,7 +380,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
 		musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0);
 
 	/* Poll for ID change */
-	if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE)
+	if (is_otg_enabled(musb) && musb->xceiv->state == USB_PHY_STATE_B_IDLE)
 		mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 
 	spin_unlock_irqrestore(&musb->lock, flags);
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 8bdf25a..c1f4998e 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -216,11 +216,11 @@ static void otg_timer(unsigned long _musb)
 	 */
 	devctl = musb_readb(mregs, MUSB_DEVCTL);
 	dev_dbg(musb->controller, "poll devctl %02x (%s)\n", devctl,
-		otg_state_string(musb->xceiv->state));
+		usb_phy_state_string(musb->xceiv->state));
 
 	spin_lock_irqsave(&musb->lock, flags);
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		/* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL
 		 * seems to mis-handle session "start" otherwise (or in our
 		 * case "recover"), in routine "VBUS was valid by the time
@@ -230,11 +230,11 @@ static void otg_timer(unsigned long _musb)
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 			break;
 		}
-		musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG,
 			MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT);
 		break;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		if (!is_peripheral_enabled(musb))
 			break;
 
@@ -255,7 +255,7 @@ static void otg_timer(unsigned long _musb)
 		if (devctl & MUSB_DEVCTL_BDEVICE)
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 		else
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 		break;
 	default:
 		break;
@@ -329,20 +329,20 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
 			 * to stop registering in devctl.
 			 */
 			musb->int_usb &= ~MUSB_INTR_VBUSERROR;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
 			musb->xceiv->default_a = 1;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
 			musb->xceiv->default_a = 0;
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
 
@@ -352,7 +352,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
 		davinci_musb_source_power(musb, drvvbus, 0);
 		dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
 				drvvbus ? "on" : "off",
-				otg_state_string(musb->xceiv->state),
+				usb_phy_state_string(musb->xceiv->state),
 				err ? " ERROR" : "",
 				devctl);
 		retval = IRQ_HANDLED;
@@ -366,7 +366,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
 
 	/* poll for ID change */
 	if (is_otg_enabled(musb)
-			&& musb->xceiv->state == OTG_STATE_B_IDLE)
+			&& musb->xceiv->state == USB_PHY_STATE_B_IDLE)
 		mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
 
 	spin_unlock_irqrestore(&musb->lock, flags);
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b5beb7d..e7c97e6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -338,22 +338,22 @@ void musb_otg_timer_func(unsigned long data)
 
 	spin_lock_irqsave(&musb->lock, flags);
 	switch (musb->xceiv->state) {
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		dev_dbg(musb->controller, "HNP: b_wait_acon timeout; back to b_peripheral\n");
 		musb_g_disconnect(musb);
-		musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+		musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		musb->is_active = 0;
 		break;
-	case OTG_STATE_A_SUSPEND:
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		dev_dbg(musb->controller, "HNP: %s timeout\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		musb_platform_set_vbus(musb, 0);
-		musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 		break;
 	default:
 		dev_dbg(musb->controller, "HNP: Unhandled mode %s\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 	}
 	musb->ignore_disconnect = 0;
 	spin_unlock_irqrestore(&musb->lock, flags);
@@ -368,18 +368,19 @@ void musb_hnp_stop(struct musb *musb)
 	void __iomem	*mbase = musb->mregs;
 	u8	reg;
 
-	dev_dbg(musb->controller, "HNP: stop from %s\n", otg_state_string(musb->xceiv->state));
+	dev_dbg(musb->controller, "HNP: stop from %s\n",
+			usb_phy_state_string(musb->xceiv->state));
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		musb_g_disconnect(musb);
 		dev_dbg(musb->controller, "HNP: back to %s\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		break;
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		dev_dbg(musb->controller, "HNP: Disabling HR\n");
 		hcd->self.is_b_host = 0;
-		musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+		musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		MUSB_DEV_MODE(musb);
 		reg = musb_readb(mbase, MUSB_POWER);
 		reg |= MUSB_POWER_SUSPENDM;
@@ -388,7 +389,7 @@ void musb_hnp_stop(struct musb *musb)
 		break;
 	default:
 		dev_dbg(musb->controller, "HNP: Stopping in unknown state %s\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 	}
 
 	/*
@@ -425,13 +426,14 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 	 */
 	if (int_usb & MUSB_INTR_RESUME) {
 		handled = IRQ_HANDLED;
-		dev_dbg(musb->controller, "RESUME (%s)\n", otg_state_string(musb->xceiv->state));
+		dev_dbg(musb->controller, "RESUME (%s)\n",
+				usb_phy_state_string(musb->xceiv->state));
 
 		if (devctl & MUSB_DEVCTL_HM) {
 			void __iomem *mbase = musb->mregs;
 
 			switch (musb->xceiv->state) {
-			case OTG_STATE_A_SUSPEND:
+			case USB_PHY_STATE_A_SUSPEND:
 				/* remote wakeup?  later, GetPortStatus
 				 * will stop RESUME signaling
 				 */
@@ -453,29 +455,30 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 				musb->rh_timer = jiffies
 						+ msecs_to_jiffies(20);
 
-				musb->xceiv->state = OTG_STATE_A_HOST;
+				musb->xceiv->state = USB_PHY_STATE_A_HOST;
 				musb->is_active = 1;
 				usb_hcd_resume_root_hub(musb_to_hcd(musb));
 				break;
-			case OTG_STATE_B_WAIT_ACON:
-				musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+			case USB_PHY_STATE_B_WAIT_ACON:
+				musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 				musb->is_active = 1;
 				MUSB_DEV_MODE(musb);
 				break;
 			default:
 				WARNING("bogus %s RESUME (%s)\n",
 					"host",
-					otg_state_string(musb->xceiv->state));
+					usb_phy_state_string(
+						musb->xceiv->state));
 			}
 		} else {
 			switch (musb->xceiv->state) {
-			case OTG_STATE_A_SUSPEND:
+			case USB_PHY_STATE_A_SUSPEND:
 				/* possibly DISCONNECT is upcoming */
-				musb->xceiv->state = OTG_STATE_A_HOST;
+				musb->xceiv->state = USB_PHY_STATE_A_HOST;
 				usb_hcd_resume_root_hub(musb_to_hcd(musb));
 				break;
-			case OTG_STATE_B_WAIT_ACON:
-			case OTG_STATE_B_PERIPHERAL:
+			case USB_PHY_STATE_B_WAIT_ACON:
+			case USB_PHY_STATE_B_PERIPHERAL:
 				/* disconnect while suspended?  we may
 				 * not get a disconnect irq...
 				 */
@@ -488,13 +491,14 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 				}
 				musb_g_resume(musb);
 				break;
-			case OTG_STATE_B_IDLE:
+			case USB_PHY_STATE_B_IDLE:
 				musb->int_usb &= ~MUSB_INTR_SUSPEND;
 				break;
 			default:
 				WARNING("bogus %s RESUME (%s)\n",
 					"peripheral",
-					otg_state_string(musb->xceiv->state));
+					usb_phy_state_string(
+						musb->xceiv->state));
 			}
 		}
 	}
@@ -510,7 +514,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		}
 
 		dev_dbg(musb->controller, "SESSION_REQUEST (%s)\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 
 		/* IRQ arrives from ID pin sense or (later, if VBUS power
 		 * is removed) SRP.  responses are time critical:
@@ -521,7 +525,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		 */
 		musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
 		musb->ep0_stage = MUSB_EP0_START;
-		musb->xceiv->state = OTG_STATE_A_IDLE;
+		musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 		MUSB_HST_MODE(musb);
 		musb_platform_set_vbus(musb, 1);
 
@@ -548,15 +552,15 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		 * make trouble here, keeping VBUS < 4.4V ?
 		 */
 		switch (musb->xceiv->state) {
-		case OTG_STATE_A_HOST:
+		case USB_PHY_STATE_A_HOST:
 			/* recovery is dicey once we've gotten past the
 			 * initial stages of enumeration, but if VBUS
 			 * stayed ok at the other end of the link, and
 			 * another reset is due (at least for high speed,
 			 * to redo the chirp etc), it might work OK...
 			 */
-		case OTG_STATE_A_WAIT_BCON:
-		case OTG_STATE_A_WAIT_VRISE:
+		case USB_PHY_STATE_A_WAIT_BCON:
+		case USB_PHY_STATE_A_WAIT_VRISE:
 			if (musb->vbuserr_retry) {
 				void __iomem *mbase = musb->mregs;
 
@@ -575,7 +579,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		}
 
 		dev_dbg(musb->controller, "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n",
-				otg_state_string(musb->xceiv->state),
+				usb_phy_state_string(musb->xceiv->state),
 				devctl,
 				({ char *s;
 				switch (devctl & MUSB_DEVCTL_VBUS) {
@@ -600,11 +604,12 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 
 	if (int_usb & MUSB_INTR_SUSPEND) {
 		dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x power %02x\n",
-			otg_state_string(musb->xceiv->state), devctl, power);
+			usb_phy_state_string(musb->xceiv->state), devctl,
+			power);
 		handled = IRQ_HANDLED;
 
 		switch (musb->xceiv->state) {
-		case OTG_STATE_A_PERIPHERAL:
+		case USB_PHY_STATE_A_PERIPHERAL:
 			/* We also come here if the cable is removed, since
 			 * this silicon doesn't report ID-no-longer-grounded.
 			 *
@@ -620,32 +625,32 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 						? : OTG_TIME_A_WAIT_BCON));
 
 			break;
-		case OTG_STATE_B_IDLE:
+		case USB_PHY_STATE_B_IDLE:
 			if (!musb->is_active)
 				break;
-		case OTG_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_B_PERIPHERAL:
 			musb_g_suspend(musb);
 			musb->is_active = is_otg_enabled(musb)
 					&& musb->xceiv->gadget->b_hnp_enable;
 			if (musb->is_active) {
-				musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
+				musb->xceiv->state = USB_PHY_STATE_B_WAIT_ACON;
 				dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
 				mod_timer(&musb->otg_timer, jiffies
 					+ msecs_to_jiffies(
 							OTG_TIME_B_ASE0_BRST));
 			}
 			break;
-		case OTG_STATE_A_WAIT_BCON:
+		case USB_PHY_STATE_A_WAIT_BCON:
 			if (musb->a_wait_bcon != 0)
 				musb_platform_try_idle(musb, jiffies
 					+ msecs_to_jiffies(musb->a_wait_bcon));
 			break;
-		case OTG_STATE_A_HOST:
-			musb->xceiv->state = OTG_STATE_A_SUSPEND;
+		case USB_PHY_STATE_A_HOST:
+			musb->xceiv->state = USB_PHY_STATE_A_SUSPEND;
 			musb->is_active = is_otg_enabled(musb)
 					&& musb->xceiv->host->b_hnp_enable;
 			break;
-		case OTG_STATE_B_HOST:
+		case USB_PHY_STATE_B_HOST:
 			/* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
 			dev_dbg(musb->controller, "REVISIT: SUSPEND as B_HOST\n");
 			break;
@@ -685,7 +690,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 
 		/* indicate new connection to OTG machine */
 		switch (musb->xceiv->state) {
-		case OTG_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_B_PERIPHERAL:
 			if (int_usb & MUSB_INTR_SUSPEND) {
 				dev_dbg(musb->controller, "HNP: SUSPEND+CONNECT, now b_host\n");
 				int_usb &= ~MUSB_INTR_SUSPEND;
@@ -693,10 +698,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 			} else
 				dev_dbg(musb->controller, "CONNECT as b_peripheral???\n");
 			break;
-		case OTG_STATE_B_WAIT_ACON:
+		case USB_PHY_STATE_B_WAIT_ACON:
 			dev_dbg(musb->controller, "HNP: CONNECT, now b_host\n");
 b_host:
-			musb->xceiv->state = OTG_STATE_B_HOST;
+			musb->xceiv->state = USB_PHY_STATE_B_HOST;
 			hcd->self.is_b_host = 1;
 			musb->ignore_disconnect = 0;
 			del_timer(&musb->otg_timer);
@@ -704,7 +709,7 @@ b_host:
 		default:
 			if ((devctl & MUSB_DEVCTL_VBUS)
 					== (3 << MUSB_DEVCTL_VBUS_SHIFT)) {
-				musb->xceiv->state = OTG_STATE_A_HOST;
+				musb->xceiv->state = USB_PHY_STATE_A_HOST;
 				hcd->self.is_b_host = 0;
 			}
 			break;
@@ -718,25 +723,26 @@ b_host:
 			usb_hcd_resume_root_hub(hcd);
 
 		dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n",
-				otg_state_string(musb->xceiv->state), devctl);
+				usb_phy_state_string(musb->xceiv->state),
+				devctl);
 	}
 
 	if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) {
 		dev_dbg(musb->controller, "DISCONNECT (%s) as %s, devctl %02x\n",
-				otg_state_string(musb->xceiv->state),
+				usb_phy_state_string(musb->xceiv->state),
 				MUSB_MODE(musb), devctl);
 		handled = IRQ_HANDLED;
 
 		switch (musb->xceiv->state) {
-		case OTG_STATE_A_HOST:
-		case OTG_STATE_A_SUSPEND:
+		case USB_PHY_STATE_A_HOST:
+		case USB_PHY_STATE_A_SUSPEND:
 			usb_hcd_resume_root_hub(musb_to_hcd(musb));
 			musb_root_disconnect(musb);
 			if (musb->a_wait_bcon != 0 && is_otg_enabled(musb))
 				musb_platform_try_idle(musb, jiffies
 					+ msecs_to_jiffies(musb->a_wait_bcon));
 			break;
-		case OTG_STATE_B_HOST:
+		case USB_PHY_STATE_B_HOST:
 			/* REVISIT this behaves for "real disconnect"
 			 * cases; make sure the other transitions from
 			 * from B_HOST act right too.  The B_HOST code
@@ -744,23 +750,23 @@ b_host:
 			 */
 			musb_root_disconnect(musb);
 			musb_to_hcd(musb)->self.is_b_host = 0;
-			musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+			musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 			MUSB_DEV_MODE(musb);
 			musb_g_disconnect(musb);
 			break;
-		case OTG_STATE_A_PERIPHERAL:
+		case USB_PHY_STATE_A_PERIPHERAL:
 			musb_hnp_stop(musb);
 			musb_root_disconnect(musb);
 			/* FALLTHROUGH */
-		case OTG_STATE_B_WAIT_ACON:
+		case USB_PHY_STATE_B_WAIT_ACON:
 			/* FALLTHROUGH */
-		case OTG_STATE_B_PERIPHERAL:
-		case OTG_STATE_B_IDLE:
+		case USB_PHY_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_B_IDLE:
 			musb_g_disconnect(musb);
 			break;
 		default:
 			WARNING("unhandled DISCONNECT transition (%s)\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 			break;
 		}
 	}
@@ -786,9 +792,9 @@ b_host:
 			}
 		} else if (is_peripheral_capable()) {
 			dev_dbg(musb->controller, "BUS RESET as %s\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 			switch (musb->xceiv->state) {
-			case OTG_STATE_A_SUSPEND:
+			case USB_PHY_STATE_A_SUSPEND:
 				/* We need to ignore disconnect on suspend
 				 * otherwise tusb 2.0 won't reconnect after a
 				 * power cycle, which breaks otg compliance.
@@ -796,34 +802,37 @@ b_host:
 				musb->ignore_disconnect = 1;
 				musb_g_reset(musb);
 				/* FALLTHROUGH */
-			case OTG_STATE_A_WAIT_BCON:	/* OPT TD.4.7-900ms */
+			case USB_PHY_STATE_A_WAIT_BCON:	/* OPT TD.4.7-900ms */
 				/* never use invalid T(a_wait_bcon) */
 				dev_dbg(musb->controller, "HNP: in %s, %d msec timeout\n",
-					otg_state_string(musb->xceiv->state),
+					usb_phy_state_string(
+						musb->xceiv->state),
 					TA_WAIT_BCON(musb));
 				mod_timer(&musb->otg_timer, jiffies
 					+ msecs_to_jiffies(TA_WAIT_BCON(musb)));
 				break;
-			case OTG_STATE_A_PERIPHERAL:
+			case USB_PHY_STATE_A_PERIPHERAL:
 				musb->ignore_disconnect = 0;
 				del_timer(&musb->otg_timer);
 				musb_g_reset(musb);
 				break;
-			case OTG_STATE_B_WAIT_ACON:
+			case USB_PHY_STATE_B_WAIT_ACON:
 				dev_dbg(musb->controller, "HNP: RESET (%s), to b_peripheral\n",
-					otg_state_string(musb->xceiv->state));
-				musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+					usb_phy_state_string(
+						musb->xceiv->state));
+				musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 				musb_g_reset(musb);
 				break;
-			case OTG_STATE_B_IDLE:
-				musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+			case USB_PHY_STATE_B_IDLE:
+				musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 				/* FALLTHROUGH */
-			case OTG_STATE_B_PERIPHERAL:
+			case USB_PHY_STATE_B_PERIPHERAL:
 				musb_g_reset(musb);
 				break;
 			default:
 				dev_dbg(musb->controller, "Unhandled BUS RESET as %s\n",
-					otg_state_string(musb->xceiv->state));
+					usb_phy_state_string(
+						musb->xceiv->state));
 			}
 		}
 	}
@@ -1649,7 +1658,7 @@ musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
 	int ret = -EINVAL;
 
 	spin_lock_irqsave(&musb->lock, flags);
-	ret = sprintf(buf, "%s\n", otg_state_string(musb->xceiv->state));
+	ret = sprintf(buf, "%s\n", usb_phy_state_string(musb->xceiv->state));
 	spin_unlock_irqrestore(&musb->lock, flags);
 
 	return ret;
@@ -1694,7 +1703,7 @@ musb_vbus_store(struct device *dev, struct device_attribute *attr,
 	spin_lock_irqsave(&musb->lock, flags);
 	/* force T(a_wait_bcon) to be zero/unlimited *OR* valid */
 	musb->a_wait_bcon = val ? max_t(int, val, OTG_TIME_A_WAIT_BCON) : 0 ;
-	if (musb->xceiv->state == OTG_STATE_A_WAIT_BCON)
+	if (musb->xceiv->state == USB_PHY_STATE_A_WAIT_BCON)
 		musb->is_active = 0;
 	musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val));
 	spin_unlock_irqrestore(&musb->lock, flags);
@@ -1985,7 +1994,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
 		MUSB_HST_MODE(musb);
 		musb->xceiv->default_a = 1;
-		musb->xceiv->state = OTG_STATE_A_IDLE;
+		musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 
 		status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
 
@@ -2000,7 +2009,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	} else /* peripheral is enabled */ {
 		MUSB_DEV_MODE(musb);
 		musb->xceiv->default_a = 0;
-		musb->xceiv->state = OTG_STATE_B_IDLE;
+		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 
 		status = musb_gadget_setup(musb);
 
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index e818203..d931058 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1580,7 +1580,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
 	spin_lock_irqsave(&musb->lock, flags);
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		/* NOTE:  OTG state machine doesn't include B_SUSPENDED;
 		 * that's part of the standard usb 1.1 state machine, and
 		 * doesn't affect OTG transitions.
@@ -1588,7 +1588,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
 		if (musb->may_wakeup && musb->is_suspended)
 			break;
 		goto done;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		/* Start SRP ... OTG not required. */
 		devctl = musb_readb(mregs, MUSB_DEVCTL);
 		dev_dbg(musb->controller, "Sending SRP: devctl: %02x\n", devctl);
@@ -1620,7 +1620,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
 		goto done;
 	default:
 		dev_dbg(musb->controller, "Unhandled wake: %s\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		goto done;
 	}
 
@@ -1900,7 +1900,7 @@ static int musb_gadget_start(struct usb_gadget *g,
 	musb->is_active = 1;
 
 	otg_set_peripheral(musb->xceiv, &musb->g);
-	musb->xceiv->state = OTG_STATE_B_IDLE;
+	musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 
 	/*
 	 * FIXME this ignores the softconnect flag.  Drivers are
@@ -2015,7 +2015,7 @@ static int musb_gadget_stop(struct usb_gadget *g,
 
 	(void) musb_gadget_vbus_draw(&musb->g, 0);
 
-	musb->xceiv->state = OTG_STATE_UNDEFINED;
+	musb->xceiv->state = USB_PHY_STATE_UNDEFINED;
 	stop_activity(musb, driver);
 	otg_set_peripheral(musb->xceiv, NULL);
 
@@ -2049,10 +2049,10 @@ void musb_g_resume(struct musb *musb)
 {
 	musb->is_suspended = 0;
 	switch (musb->xceiv->state) {
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		break;
-	case OTG_STATE_B_WAIT_ACON:
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		musb->is_active = 1;
 		if (musb->gadget_driver && musb->gadget_driver->resume) {
 			spin_unlock(&musb->lock);
@@ -2062,7 +2062,7 @@ void musb_g_resume(struct musb *musb)
 		break;
 	default:
 		WARNING("unhandled RESUME transition (%s)\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 	}
 }
 
@@ -2075,11 +2075,11 @@ void musb_g_suspend(struct musb *musb)
 	dev_dbg(musb->controller, "devctl %02x\n", devctl);
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
-			musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+			musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		musb->is_suspended = 1;
 		if (musb->gadget_driver && musb->gadget_driver->suspend) {
 			spin_unlock(&musb->lock);
@@ -2092,7 +2092,7 @@ void musb_g_suspend(struct musb *musb)
 		 * A_PERIPHERAL may need care too
 		 */
 		WARNING("unhandled SUSPEND transition (%s)\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 	}
 }
 
@@ -2126,21 +2126,21 @@ void musb_g_disconnect(struct musb *musb)
 	switch (musb->xceiv->state) {
 	default:
 		dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n",
-			otg_state_string(musb->xceiv->state));
-		musb->xceiv->state = OTG_STATE_A_IDLE;
+			usb_phy_state_string(musb->xceiv->state));
+		musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 		MUSB_HST_MODE(musb);
 		break;
-	case OTG_STATE_A_PERIPHERAL:
-		musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+	case USB_PHY_STATE_A_PERIPHERAL:
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		MUSB_HST_MODE(musb);
 		break;
-	case OTG_STATE_B_WAIT_ACON:
-	case OTG_STATE_B_HOST:
-	case OTG_STATE_B_PERIPHERAL:
-	case OTG_STATE_B_IDLE:
-		musb->xceiv->state = OTG_STATE_B_IDLE;
+	case USB_PHY_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_HOST:
+	case USB_PHY_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_IDLE:
+		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 		break;
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		break;
 	}
 
@@ -2194,10 +2194,10 @@ __acquires(musb->lock)
 	 * or else after HNP, as A-Device
 	 */
 	if (devctl & MUSB_DEVCTL_BDEVICE) {
-		musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
+		musb->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		musb->g.is_a_peripheral = 0;
 	} else if (is_otg_enabled(musb)) {
-		musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
+		musb->xceiv->state = USB_PHY_STATE_A_PERIPHERAL;
 		musb->g.is_a_peripheral = 1;
 	} else
 		WARN_ON(1);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 8b2473f..96c6dd7 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2270,16 +2270,16 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
 		return 0;
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		return 0;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		/* ID could be grounded even if there's no device
 		 * on the other end of the cable.  NOTE that the
 		 * A_WAIT_VRISE timers are messy with MUSB...
 		 */
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 		if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
-			musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		break;
 	default:
 		break;
@@ -2287,7 +2287,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd)
 
 	if (musb->is_active) {
 		WARNING("trying to suspend as %s while active\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 		return -EBUSY;
 	} else
 		return 0;
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index e9f80ad..b36e704 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -78,8 +78,8 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
 
 		musb->port1_status |= USB_PORT_STAT_SUSPEND;
 		switch (musb->xceiv->state) {
-		case OTG_STATE_A_HOST:
-			musb->xceiv->state = OTG_STATE_A_SUSPEND;
+		case USB_PHY_STATE_A_HOST:
+			musb->xceiv->state = USB_PHY_STATE_A_SUSPEND;
 			musb->is_active = is_otg_enabled(musb)
 					&& musb->xceiv->host->b_hnp_enable;
 			if (musb->is_active)
@@ -88,15 +88,15 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
 						OTG_TIME_A_AIDL_BDIS));
 			musb_platform_try_idle(musb, 0);
 			break;
-		case OTG_STATE_B_HOST:
-			musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
+		case USB_PHY_STATE_B_HOST:
+			musb->xceiv->state = USB_PHY_STATE_B_WAIT_ACON;
 			musb->is_active = is_otg_enabled(musb)
 					&& musb->xceiv->host->b_hnp_enable;
 			musb_platform_try_idle(musb, 0);
 			break;
 		default:
 			dev_dbg(musb->controller, "bogus rh suspend? %s\n",
-				otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 		}
 	} else if (power & MUSB_POWER_SUSPENDM) {
 		power &= ~MUSB_POWER_SUSPENDM;
@@ -116,7 +116,7 @@ static void musb_port_reset(struct musb *musb, bool do_reset)
 	u8		power;
 	void __iomem	*mbase = musb->mregs;
 
-	if (musb->xceiv->state == OTG_STATE_B_IDLE) {
+	if (musb->xceiv->state == USB_PHY_STATE_B_IDLE) {
 		dev_dbg(musb->controller, "HNP: Returning from HNP; no hub reset from b_idle\n");
 		musb->port1_status &= ~USB_PORT_STAT_RESET;
 		return;
@@ -186,24 +186,24 @@ void musb_root_disconnect(struct musb *musb)
 	musb->is_active = 0;
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		if (is_otg_enabled(musb)
 				&& musb->xceiv->host->b_hnp_enable) {
-			musb->xceiv->state = OTG_STATE_A_PERIPHERAL;
+			musb->xceiv->state = USB_PHY_STATE_A_PERIPHERAL;
 			musb->g.is_a_peripheral = 1;
 			break;
 		}
 		/* FALLTHROUGH */
-	case OTG_STATE_A_HOST:
-		musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+	case USB_PHY_STATE_A_HOST:
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		musb->is_active = 0;
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
-		musb->xceiv->state = OTG_STATE_B_IDLE;
+	case USB_PHY_STATE_A_WAIT_VFALL:
+		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 		break;
 	default:
 		dev_dbg(musb->controller, "host disconnect (%s)\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 	}
 }
 
@@ -339,7 +339,7 @@ int musb_hub_control(
 			musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
 			usb_hcd_poll_rh_status(musb_to_hcd(musb));
 			/* NOTE: it might really be A_WAIT_BCON ... */
-			musb->xceiv->state = OTG_STATE_A_HOST;
+			musb->xceiv->state = USB_PHY_STATE_A_HOST;
 		}
 
 		put_unaligned(cpu_to_le32(musb->port1_status
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ba85f27..2cd9408 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -57,18 +57,18 @@ static void musb_do_idle(unsigned long _musb)
 	spin_lock_irqsave(&musb->lock, flags);
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 		if (devctl & MUSB_DEVCTL_BDEVICE) {
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			MUSB_DEV_MODE(musb);
 		} else {
-			musb->xceiv->state = OTG_STATE_A_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 			MUSB_HST_MODE(musb);
 		}
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		/* finish RESUME signaling? */
 		if (musb->port1_status & MUSB_PORT_STAT_RESUME) {
 			power = musb_readb(musb->mregs, MUSB_POWER);
@@ -81,15 +81,15 @@ static void musb_do_idle(unsigned long _musb)
 			musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
 			usb_hcd_poll_rh_status(musb_to_hcd(musb));
 			/* NOTE: it might really be A_WAIT_BCON ... */
-			musb->xceiv->state = OTG_STATE_A_HOST;
+			musb->xceiv->state = USB_PHY_STATE_A_HOST;
 		}
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 		if (devctl &  MUSB_DEVCTL_BDEVICE)
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 		else
-			musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 	default:
 		break;
 	}
@@ -107,9 +107,9 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
 
 	/* Never idle if active, or when VBUS timeout is not set as host */
 	if (musb->is_active || ((musb->a_wait_bcon == 0)
-			&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
+			&& (musb->xceiv->state == USB_PHY_STATE_A_WAIT_BCON))) {
 		dev_dbg(musb->controller, "%s active, deleting timer\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		del_timer(&musb_idle_timer);
 		last_timer = jiffies;
 		return;
@@ -126,7 +126,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
 	last_timer = timeout;
 
 	dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		(unsigned long)jiffies_to_msecs(timeout - jiffies));
 	mod_timer(&musb_idle_timer, timeout);
 }
@@ -144,7 +144,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 
 	if (is_on) {
-		if (musb->xceiv->state == OTG_STATE_A_IDLE) {
+		if (musb->xceiv->state == USB_PHY_STATE_A_IDLE) {
 			/* start the session */
 			devctl |= MUSB_DEVCTL_SESSION;
 			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
@@ -169,7 +169,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 		} else {
 			musb->is_active = 1;
 			musb->xceiv->default_a = 1;
-			musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			devctl |= MUSB_DEVCTL_SESSION;
 			MUSB_HST_MODE(musb);
 		}
@@ -181,7 +181,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 		 */
 
 		musb->xceiv->default_a = 0;
-		musb->xceiv->state = OTG_STATE_B_IDLE;
+		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 		devctl &= ~MUSB_DEVCTL_SESSION;
 
 		MUSB_DEV_MODE(musb);
@@ -190,7 +190,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 
 	dev_dbg(musb->controller, "VBUS %s, devctl %02x "
 		/* otg %3x conf %08x prcm %08x */ "\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		musb_readb(musb->mregs, MUSB_DEVCTL));
 }
 
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 38d5ce8..d7cae3d 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -414,15 +414,15 @@ static void musb_do_idle(unsigned long _musb)
 	spin_lock_irqsave(&musb->lock, flags);
 
 	switch (musb->xceiv->state) {
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		if ((musb->a_wait_bcon != 0)
 			&& (musb->idle_timeout == 0
 				|| time_after(jiffies, musb->idle_timeout))) {
 			dev_dbg(musb->controller, "Nothing connected %s, turning off VBUS\n",
-					otg_state_string(musb->xceiv->state));
+				usb_phy_state_string(musb->xceiv->state));
 		}
 		/* FALLTHROUGH */
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		tusb_musb_set_vbus(musb, 0);
 	default:
 		break;
@@ -473,9 +473,9 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
 
 	/* Never idle if active, or when VBUS timeout is not set as host */
 	if (musb->is_active || ((musb->a_wait_bcon == 0)
-			&& (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) {
+			&& (musb->xceiv->state == USB_PHY_STATE_A_WAIT_BCON))) {
 		dev_dbg(musb->controller, "%s active, deleting timer\n",
-			otg_state_string(musb->xceiv->state));
+			usb_phy_state_string(musb->xceiv->state));
 		del_timer(&musb_idle_timer);
 		last_timer = jiffies;
 		return;
@@ -492,7 +492,7 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout)
 	last_timer = timeout;
 
 	dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		(unsigned long)jiffies_to_msecs(timeout - jiffies));
 	mod_timer(&musb_idle_timer, timeout);
 }
@@ -522,7 +522,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 	if (is_on) {
 		timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE);
 		musb->xceiv->default_a = 1;
-		musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
+		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		devctl |= MUSB_DEVCTL_SESSION;
 
 		conf |= TUSB_DEV_CONF_USB_HOST_MODE;
@@ -536,15 +536,15 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 		otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT);
 		if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
 			switch (musb->xceiv->state) {
-			case OTG_STATE_A_WAIT_VRISE:
-			case OTG_STATE_A_WAIT_BCON:
-				musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
+			case USB_PHY_STATE_A_WAIT_VRISE:
+			case USB_PHY_STATE_A_WAIT_BCON:
+				musb->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 				break;
-			case OTG_STATE_A_WAIT_VFALL:
-				musb->xceiv->state = OTG_STATE_A_IDLE;
+			case USB_PHY_STATE_A_WAIT_VFALL:
+				musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 				break;
 			default:
-				musb->xceiv->state = OTG_STATE_A_IDLE;
+				musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 			}
 			musb->is_active = 0;
 			musb->xceiv->default_a = 1;
@@ -552,7 +552,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 		} else {
 			musb->is_active = 0;
 			musb->xceiv->default_a = 0;
-			musb->xceiv->state = OTG_STATE_B_IDLE;
+			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			MUSB_DEV_MODE(musb);
 		}
 
@@ -567,7 +567,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 	musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
 
 	dev_dbg(musb->controller, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n",
-		otg_state_string(musb->xceiv->state),
+		usb_phy_state_string(musb->xceiv->state),
 		musb_readb(musb->mregs, MUSB_DEVCTL),
 		musb_readl(tbase, TUSB_DEV_OTG_STAT),
 		conf, prcm);
@@ -678,24 +678,28 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 
 			if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) {
 				dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n");
-				if (musb->xceiv->state != OTG_STATE_B_IDLE) {
+				if (musb->xceiv->state !=
+						USB_PHY_STATE_B_IDLE) {
 					/* INTR_DISCONNECT can hide... */
-					musb->xceiv->state = OTG_STATE_B_IDLE;
+					musb->xceiv->state =
+						USB_PHY_STATE_B_IDLE;
 					musb->int_usb |= MUSB_INTR_DISCONNECT;
 				}
 				musb->is_active = 0;
 			}
 			dev_dbg(musb->controller, "vbus change, %s, otg %03x\n",
-				otg_state_string(musb->xceiv->state), otg_stat);
+				usb_phy_state_string(musb->xceiv->state),
+				otg_stat);
 			idle_timeout = jiffies + (1 * HZ);
 			schedule_work(&musb->irq_work);
 
 		} else /* A-dev state machine */ {
 			dev_dbg(musb->controller, "vbus change, %s, otg %03x\n",
-				otg_state_string(musb->xceiv->state), otg_stat);
+				usb_phy_state_string(musb->xceiv->state),
+				otg_stat);
 
 			switch (musb->xceiv->state) {
-			case OTG_STATE_A_IDLE:
+			case USB_PHY_STATE_A_IDLE:
 				dev_dbg(musb->controller, "Got SRP, turning on VBUS\n");
 				musb_platform_set_vbus(musb, 1);
 
@@ -712,12 +716,12 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 				idle_timeout = jiffies + (2 * HZ);
 
 				break;
-			case OTG_STATE_A_WAIT_VRISE:
+			case USB_PHY_STATE_A_WAIT_VRISE:
 				/* ignore; A-session-valid < VBUS_VALID/2,
 				 * we monitor this with the timer
 				 */
 				break;
-			case OTG_STATE_A_WAIT_VFALL:
+			case USB_PHY_STATE_A_WAIT_VFALL:
 				/* REVISIT this irq triggers during short
 				 * spikes caused by enumeration ...
 				 */
@@ -741,10 +745,10 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 		u8	devctl;
 
 		dev_dbg(musb->controller, "%s timer, %03x\n",
-			otg_state_string(musb->xceiv->state), otg_stat);
+			usb_phy_state_string(musb->xceiv->state), otg_stat);
 
 		switch (musb->xceiv->state) {
-		case OTG_STATE_A_WAIT_VRISE:
+		case USB_PHY_STATE_A_WAIT_VRISE:
 			/* VBUS has probably been valid for a while now,
 			 * but may well have bounced out of range a bit
 			 */
@@ -755,7 +759,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 					dev_dbg(musb->controller, "devctl %02x\n", devctl);
 					break;
 				}
-				musb->xceiv->state = OTG_STATE_A_WAIT_BCON;
+				musb->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 				musb->is_active = 0;
 				idle_timeout = jiffies
 					+ msecs_to_jiffies(musb->a_wait_bcon);
@@ -765,14 +769,14 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 				tusb_musb_set_vbus(musb, 0);
 			}
 			break;
-		case OTG_STATE_A_WAIT_BCON:
+		case USB_PHY_STATE_A_WAIT_BCON:
 			if (musb->a_wait_bcon != 0)
 				idle_timeout = jiffies
 					+ msecs_to_jiffies(musb->a_wait_bcon);
 			break;
-		case OTG_STATE_A_SUSPEND:
+		case USB_PHY_STATE_A_SUSPEND:
 			break;
-		case OTG_STATE_B_WAIT_ACON:
+		case USB_PHY_STATE_B_WAIT_ACON:
 			break;
 		default:
 			break;
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 99a56af..366c3af 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -153,7 +153,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 	u8 reg;
 	enum ab8500_usb_link_status lsts;
 	void *v = NULL;
-	enum usb_xceiv_events event;
+	enum usb_phy_events event;
 
 	abx500_get_register_interruptible(ab->dev,
 			AB8500_USB,
@@ -169,7 +169,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 		/* TODO: Disable regulators. */
 		ab8500_usb_host_phy_dis(ab);
 		ab8500_usb_peri_phy_dis(ab);
-		ab->otg.state = OTG_STATE_B_IDLE;
+		ab->otg.state = USB_PHY_STATE_B_IDLE;
 		ab->otg.default_a = false;
 		ab->vbus_draw = 0;
 		event = USB_EVENT_NONE;
@@ -195,7 +195,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 			ab8500_usb_host_phy_en(ab);
 			v = ab->otg.host;
 		}
-		ab->otg.state = OTG_STATE_A_IDLE;
+		ab->otg.state = USB_PHY_STATE_A_IDLE;
 		ab->otg.default_a = true;
 		event = USB_EVENT_ID;
 		break;
@@ -317,7 +317,7 @@ static int ab8500_usb_set_peripheral(struct usb_phy *otg,
 		schedule_work(&ab->phy_dis_work);
 	} else {
 		ab->otg.gadget = gadget;
-		ab->otg.state = OTG_STATE_B_IDLE;
+		ab->otg.state = USB_PHY_STATE_B_IDLE;
 
 		/* Phy will not be enabled if cable is already
 		 * plugged-in. Schedule to enable phy.
@@ -492,7 +492,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
 	ab->rev			= rev;
 	ab->otg.dev		= ab->dev;
 	ab->otg.label		= "ab8500";
-	ab->otg.state		= OTG_STATE_UNDEFINED;
+	ab->otg.state		= USB_PHY_STATE_UNDEFINED;
 	ab->otg.set_host	= ab8500_usb_set_host;
 	ab->otg.set_peripheral	= ab8500_usb_set_peripheral;
 	ab->otg.set_suspend	= ab8500_usb_set_suspend;
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c
index 2f0678d..76125f7 100644
--- a/drivers/usb/otg/fsl_otg.c
+++ b/drivers/usb/otg/fsl_otg.c
@@ -275,7 +275,7 @@ void b_srp_end(unsigned long foo)
 	fsl_otg_dischrg_vbus(0);
 	srp_wait_done = 1;
 
-	if ((fsl_otg_dev->otg.state == OTG_STATE_B_SRP_INIT) &&
+	if ((fsl_otg_dev->otg.state == USB_PHY_STATE_B_SRP_INIT) &&
 	    fsl_otg_dev->fsm.b_sess_vld)
 		fsl_otg_dev->fsm.b_srp_done = 1;
 }
@@ -574,7 +574,7 @@ static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
 			/* Mini-A cable connected */
 			struct otg_fsm *fsm = &otg_dev->fsm;
 
-			otg_p->state = OTG_STATE_UNDEFINED;
+			otg_p->state = USB_PHY_STATE_UNDEFINED;
 			fsm->protocol = PROTO_UNDEF;
 		}
 	}
@@ -629,7 +629,7 @@ static int fsl_otg_set_power(struct usb_phy *otg_p, unsigned mA)
 {
 	if (!fsl_otg_dev)
 		return -ENODEV;
-	if (otg_p->state == OTG_STATE_B_PERIPHERAL)
+	if (otg_p->state == USB_PHY_STATE_B_PERIPHERAL)
 		pr_info("FSL OTG: Draw %d mA\n", mA);
 
 	return 0;
@@ -663,7 +663,7 @@ static int fsl_otg_start_srp(struct usb_phy *otg_p)
 	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
 
 	if (!otg_p || otg_dev != fsl_otg_dev
-	    || otg_p->state != OTG_STATE_B_IDLE)
+	    || otg_p->state != USB_PHY_STATE_B_IDLE)
 		return -ENODEV;
 
 	otg_dev->fsm.b_bus_req = 1;
@@ -826,7 +826,7 @@ int usb_otg_start(struct platform_device *pdev)
 	fsm = &p_otg->fsm;
 
 	/* Initialize the state machine structure with default values */
-	SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED);
+	SET_OTG_STATE(otg_trans, USB_PHY_STATE_UNDEFINED);
 	fsm->transceiver = &p_otg->otg;
 
 	/* We don't require predefined MEM/IRQ resource index */
@@ -919,10 +919,10 @@ int usb_otg_start(struct platform_device *pdev)
 	 * Also: record initial state of ID pin
 	 */
 	if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) {
-		p_otg->otg.state = OTG_STATE_UNDEFINED;
+		p_otg->otg.state = USB_PHY_STATE_UNDEFINED;
 		p_otg->fsm.id = 1;
 	} else {
-		p_otg->otg.state = OTG_STATE_A_IDLE;
+		p_otg->otg.state = USB_PHY_STATE_A_IDLE;
 		p_otg->fsm.id = 0;
 	}
 
@@ -978,7 +978,7 @@ static int show_fsl_usb2_otg_state(struct device *dev,
 	/* State */
 	t = scnprintf(next, size,
 		      "OTG state: %s\n\n",
-		      otg_state_string(fsl_otg_dev->otg.state));
+		      usb_phy_state_string(fsl_otg_dev->otg.state));
 	size -= t;
 	next += t;
 
diff --git a/drivers/usb/otg/fsl_otg.h b/drivers/usb/otg/fsl_otg.h
index caec254..33f3997 100644
--- a/drivers/usb/otg/fsl_otg.h
+++ b/drivers/usb/otg/fsl_otg.h
@@ -250,7 +250,7 @@
 /* Wait for B-Connect */
 #define TA_WAIT_BCON	(10000)  /* a_wait_bcon > 1 sec, section: 6.6.5.2
 				  * This is only used to get out of
-				  * OTG_STATE_A_WAIT_BCON state if there was
+				  * USB_PHY_STATE_A_WAIT_BCON state if there was
 				  * no connection for these many milliseconds
 				  */
 
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 5e4c7a0..14f48e8 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -107,7 +107,7 @@ static void gpio_vbus_work(struct work_struct *work)
 	 */
 	gpio = pdata->gpio_pullup;
 	if (is_vbus_powered(pdata)) {
-		gpio_vbus->otg.state = OTG_STATE_B_PERIPHERAL;
+		gpio_vbus->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 		usb_gadget_vbus_connect(gpio_vbus->otg.gadget);
 
 		/* drawing a "unit load" is *always* OK, except for OTG */
@@ -124,7 +124,7 @@ static void gpio_vbus_work(struct work_struct *work)
 		set_vbus_draw(gpio_vbus, 0);
 
 		usb_gadget_vbus_disconnect(gpio_vbus->otg.gadget);
-		gpio_vbus->otg.state = OTG_STATE_B_IDLE;
+		gpio_vbus->otg.state = USB_PHY_STATE_B_IDLE;
 	}
 }
 
@@ -173,7 +173,7 @@ static int gpio_vbus_set_peripheral(struct usb_phy *otg,
 		set_vbus_draw(gpio_vbus, 0);
 
 		usb_gadget_vbus_disconnect(otg->gadget);
-		otg->state = OTG_STATE_UNDEFINED;
+		otg->state = USB_PHY_STATE_UNDEFINED;
 
 		otg->gadget = NULL;
 		return 0;
@@ -194,7 +194,7 @@ static int gpio_vbus_set_power(struct usb_phy *otg, unsigned mA)
 
 	gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
 
-	if (otg->state == OTG_STATE_B_PERIPHERAL)
+	if (otg->state == USB_PHY_STATE_B_PERIPHERAL)
 		set_vbus_draw(gpio_vbus, mA);
 	return 0;
 }
@@ -235,7 +235,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, gpio_vbus);
 	gpio_vbus->dev = &pdev->dev;
 	gpio_vbus->otg.label = "gpio-vbus";
-	gpio_vbus->otg.state = OTG_STATE_UNDEFINED;
+	gpio_vbus->otg.state = USB_PHY_STATE_UNDEFINED;
 	gpio_vbus->otg.set_peripheral = gpio_vbus_set_peripheral;
 	gpio_vbus->otg.set_power = gpio_vbus_set_power;
 	gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend;
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index a0250b2..175922a 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -236,7 +236,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits)
 
 static inline const char *state_name(struct isp1301 *isp)
 {
-	return otg_state_string(isp->otg.state);
+	return usb_phy_state_string(isp->otg.state);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -251,7 +251,7 @@ static inline const char *state_name(struct isp1301 *isp)
 
 static void power_down(struct isp1301 *isp)
 {
-	isp->otg.state = OTG_STATE_UNDEFINED;
+	isp->otg.state = USB_PHY_STATE_UNDEFINED;
 
 	// isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
 	isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
@@ -341,7 +341,7 @@ static void a_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == OTG_STATE_A_IDLE)
+	if (isp->otg.state == USB_PHY_STATE_A_IDLE)
 		return;
 
 	isp->otg.default_a = 1;
@@ -353,7 +353,7 @@ static void a_idle(struct isp1301 *isp, const char *tag)
 		isp->otg.gadget->is_a_peripheral = 1;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = OTG_STATE_A_IDLE;
+	isp->otg.state = USB_PHY_STATE_A_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -365,7 +365,7 @@ static void b_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == OTG_STATE_B_IDLE)
+	if (isp->otg.state == USB_PHY_STATE_B_IDLE)
 		return;
 
 	isp->otg.default_a = 0;
@@ -377,7 +377,7 @@ static void b_idle(struct isp1301 *isp, const char *tag)
 		isp->otg.gadget->is_a_peripheral = 0;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = OTG_STATE_B_IDLE;
+	isp->otg.state = USB_PHY_STATE_B_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -415,7 +415,7 @@ dump_regs(struct isp1301 *isp, const char *label)
 
 static void check_state(struct isp1301 *isp, const char *tag)
 {
-	enum usb_otg_state	state = OTG_STATE_UNDEFINED;
+	enum usb_phy_state	state = USB_PHY_STATE_UNDEFINED;
 	u8			fsm = omap_readw(OTG_TEST) & 0x0ff;
 	unsigned		extra = 0;
 
@@ -423,16 +423,16 @@ static void check_state(struct isp1301 *isp, const char *tag)
 
 	/* default-b */
 	case 0x0:
-		state = OTG_STATE_B_IDLE;
+		state = USB_PHY_STATE_B_IDLE;
 		break;
 	case 0x3:
 	case 0x7:
 		extra = 1;
 	case 0x1:
-		state = OTG_STATE_B_PERIPHERAL;
+		state = USB_PHY_STATE_B_PERIPHERAL;
 		break;
 	case 0x11:
-		state = OTG_STATE_B_SRP_INIT;
+		state = USB_PHY_STATE_B_SRP_INIT;
 		break;
 
 	/* extra dual-role default-b states */
@@ -441,39 +441,39 @@ static void check_state(struct isp1301 *isp, const char *tag)
 	case 0x16:
 		extra = 1;
 	case 0x17:
-		state = OTG_STATE_B_WAIT_ACON;
+		state = USB_PHY_STATE_B_WAIT_ACON;
 		break;
 	case 0x34:
-		state = OTG_STATE_B_HOST;
+		state = USB_PHY_STATE_B_HOST;
 		break;
 
 	/* default-a */
 	case 0x36:
-		state = OTG_STATE_A_IDLE;
+		state = USB_PHY_STATE_A_IDLE;
 		break;
 	case 0x3c:
-		state = OTG_STATE_A_WAIT_VFALL;
+		state = USB_PHY_STATE_A_WAIT_VFALL;
 		break;
 	case 0x7d:
-		state = OTG_STATE_A_VBUS_ERR;
+		state = USB_PHY_STATE_A_VBUS_ERR;
 		break;
 	case 0x9e:
 	case 0x9f:
 		extra = 1;
 	case 0x89:
-		state = OTG_STATE_A_PERIPHERAL;
+		state = USB_PHY_STATE_A_PERIPHERAL;
 		break;
 	case 0xb7:
-		state = OTG_STATE_A_WAIT_VRISE;
+		state = USB_PHY_STATE_A_WAIT_VRISE;
 		break;
 	case 0xb8:
-		state = OTG_STATE_A_WAIT_BCON;
+		state = USB_PHY_STATE_A_WAIT_BCON;
 		break;
 	case 0xb9:
-		state = OTG_STATE_A_HOST;
+		state = USB_PHY_STATE_A_HOST;
 		break;
 	case 0xba:
-		state = OTG_STATE_A_SUSPEND;
+		state = USB_PHY_STATE_A_SUSPEND;
 		break;
 	default:
 		break;
@@ -481,7 +481,7 @@ static void check_state(struct isp1301 *isp, const char *tag)
 	if (isp->otg.state == state && !extra)
 		return;
 	pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
-		otg_state_string(state), fsm, state_name(isp),
+		usb_phy_state_string(state), fsm, state_name(isp),
 		omap_readl(OTG_CTRL));
 }
 
@@ -502,22 +502,22 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
 
 	if (int_src & INTR_SESS_VLD)
 		otg_ctrl |= OTG_ASESSVLD;
-	else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) {
+	else if (isp->otg.state == USB_PHY_STATE_A_WAIT_VFALL) {
 		a_idle(isp, "vfall");
 		otg_ctrl &= ~OTG_CTRL_BITS;
 	}
 	if (int_src & INTR_VBUS_VLD)
 		otg_ctrl |= OTG_VBUSVLD;
 	if (int_src & INTR_ID_GND) {		/* default-A */
-		if (isp->otg.state == OTG_STATE_B_IDLE
-				|| isp->otg.state == OTG_STATE_UNDEFINED) {
+		if (isp->otg.state == USB_PHY_STATE_B_IDLE
+				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
 			a_idle(isp, "init");
 			return;
 		}
 	} else {				/* default-B */
 		otg_ctrl |= OTG_ID;
-		if (isp->otg.state == OTG_STATE_A_IDLE
-				|| isp->otg.state == OTG_STATE_UNDEFINED) {
+		if (isp->otg.state == USB_PHY_STATE_A_IDLE
+				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
 			b_idle(isp, "init");
 			return;
 		}
@@ -552,13 +552,13 @@ static void otg_update_isp(struct isp1301 *isp)
 	otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
 
 	switch (isp->otg.state) {
-	case OTG_STATE_B_IDLE:
-	case OTG_STATE_B_PERIPHERAL:
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_IDLE:
+	case USB_PHY_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_SRP_INIT:
 		if (!(otg_ctrl & OTG_PULLUP)) {
 			// if (otg_ctrl & OTG_B_HNPEN) {
 			if (isp->otg.gadget->b_hnp_enable) {
-				isp->otg.state = OTG_STATE_B_WAIT_ACON;
+				isp->otg.state = USB_PHY_STATE_B_WAIT_ACON;
 				pr_debug("  --> b_wait_acon\n");
 			}
 			goto pulldown;
@@ -567,12 +567,12 @@ pullup:
 		set |= OTG1_DP_PULLUP;
 		clr |= OTG1_DP_PULLDOWN;
 		break;
-	case OTG_STATE_A_SUSPEND:
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		if (otg_ctrl & OTG_PULLUP)
 			goto pullup;
 		/* FALLTHROUGH */
-	// case OTG_STATE_B_WAIT_ACON:
+	/* case USB_PHY_STATE_B_WAIT_ACON: */
 	default:
 pulldown:
 		set |= OTG1_DP_PULLDOWN;
@@ -589,7 +589,7 @@ pulldown:
 		otg_ctrl &= ~OTG_DRV_VBUS;
 
 	switch (isp->otg.state) {
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		if (otg_ctrl & OTG_DRV_VBUS) {
 			set |= OTG1_VBUS_DRV;
 			break;
@@ -598,17 +598,17 @@ pulldown:
 		notresponding(isp);
 
 		/* FALLTHROUGH */
-	case OTG_STATE_A_VBUS_ERR:
-		isp->otg.state = OTG_STATE_A_WAIT_VFALL;
+	case USB_PHY_STATE_A_VBUS_ERR:
+		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 		pr_debug("  --> a_wait_vfall\n");
 		/* FALLTHROUGH */
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		/* FIXME usbcore thinks port power is still on ... */
 		clr |= OTG1_VBUS_DRV;
 		break;
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		if (otg_ctrl & OTG_DRV_VBUS) {
-			isp->otg.state = OTG_STATE_A_WAIT_VRISE;
+			isp->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
 			pr_debug("  --> a_wait_vrise\n");
 		}
 		/* FALLTHROUGH */
@@ -629,16 +629,16 @@ pulldown:
 		u32 l;
 
 		switch (isp->otg.state) {
-		case OTG_STATE_B_IDLE:
+		case USB_PHY_STATE_B_IDLE:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = OTG_STATE_B_PERIPHERAL;
+			isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 			pr_debug("  --> b_peripheral\n");
 			break;
-		case OTG_STATE_A_SUSPEND:
+		case USB_PHY_STATE_A_SUSPEND:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = OTG_STATE_A_PERIPHERAL;
+			isp->otg.state = USB_PHY_STATE_A_PERIPHERAL;
 			pr_debug("  --> a_peripheral\n");
 			break;
 		default:
@@ -675,7 +675,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		 * remote wakeup (SRP, normal) using their own timer
 		 * to give "check cable and A-device" messages.
 		 */
-		if (isp->otg.state == OTG_STATE_B_SRP_INIT)
+		if (isp->otg.state == USB_PHY_STATE_B_SRP_INIT)
 			b_idle(isp, "srp_timeout");
 
 		omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
@@ -693,7 +693,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		omap_writel(otg_ctrl, OTG_CTRL);
 
 		/* subset of b_peripheral()... */
-		isp->otg.state = OTG_STATE_B_PERIPHERAL;
+		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 		pr_debug("  --> b_peripheral\n");
 
 		omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
@@ -706,7 +706,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 
 		isp1301_defer_work(isp, WORK_UPDATE_OTG);
 		switch (isp->otg.state) {
-		case OTG_STATE_A_IDLE:
+		case USB_PHY_STATE_A_IDLE:
 			if (!isp->otg.host)
 				break;
 			isp1301_defer_work(isp, WORK_HOST_RESUME);
@@ -736,7 +736,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = OTG_STATE_A_WAIT_VFALL;
+		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 
 		omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -750,7 +750,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = OTG_STATE_A_VBUS_ERR;
+		isp->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 
 		omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -772,7 +772,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		/* role is peripheral */
 		if (otg_ctrl & OTG_DRIVER_SEL) {
 			switch (isp->otg.state) {
-			case OTG_STATE_A_IDLE:
+			case USB_PHY_STATE_A_IDLE:
 				b_idle(isp, __func__);
 				break;
 			default:
@@ -789,17 +789,18 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 
 			if (isp->otg.host) {
 				switch (isp->otg.state) {
-				case OTG_STATE_B_WAIT_ACON:
-					isp->otg.state = OTG_STATE_B_HOST;
+				case USB_PHY_STATE_B_WAIT_ACON:
+					isp->otg.state = USB_PHY_STATE_B_HOST;
 					pr_debug("  --> b_host\n");
 					kick = 1;
 					break;
-				case OTG_STATE_A_WAIT_BCON:
-					isp->otg.state = OTG_STATE_A_HOST;
+				case USB_PHY_STATE_A_WAIT_BCON:
+					isp->otg.state = USB_PHY_STATE_A_HOST;
 					pr_debug("  --> a_host\n");
 					break;
-				case OTG_STATE_A_PERIPHERAL:
-					isp->otg.state = OTG_STATE_A_WAIT_BCON;
+				case USB_PHY_STATE_A_PERIPHERAL:
+					isp->otg.state =
+						USB_PHY_STATE_A_WAIT_BCON;
 					pr_debug("  --> a_wait_bcon\n");
 					break;
 				default:
@@ -940,7 +941,7 @@ static void b_peripheral(struct isp1301 *isp)
 	/* UDC driver just set OTG_BSESSVLD */
 	isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
 	isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
-	isp->otg.state = OTG_STATE_B_PERIPHERAL;
+	isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 	pr_debug("  --> b_peripheral\n");
 	dump_regs(isp, "2periph");
 #endif
@@ -949,7 +950,7 @@ static void b_peripheral(struct isp1301 *isp)
 static void isp_update_otg(struct isp1301 *isp, u8 stat)
 {
 	u8			isp_stat, isp_bstat;
-	enum usb_otg_state	state = isp->otg.state;
+	enum usb_phy_state	state = isp->otg.state;
 
 	if (stat & INTR_BDIS_ACON)
 		pr_debug("OTG:  BDIS_ACON, %s\n", state_name(isp));
@@ -959,44 +960,45 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 	if (isp_stat & INTR_ID_GND) {
 		if (isp->otg.default_a) {
 			switch (state) {
-			case OTG_STATE_B_IDLE:
+			case USB_PHY_STATE_B_IDLE:
 				a_idle(isp, "idle");
 				/* FALLTHROUGH */
-			case OTG_STATE_A_IDLE:
+			case USB_PHY_STATE_A_IDLE:
 				enable_vbus_source(isp);
 				/* FALLTHROUGH */
-			case OTG_STATE_A_WAIT_VRISE:
-				/* we skip over OTG_STATE_A_WAIT_BCON, since
+			case USB_PHY_STATE_A_WAIT_VRISE:
+				/* we skip over USB_PHY_STATE_A_WAIT_BCON, since
 				 * the HC will transition to A_HOST (or
 				 * A_SUSPEND!) without our noticing except
 				 * when HNP is used.
 				 */
 				if (isp_stat & INTR_VBUS_VLD)
-					isp->otg.state = OTG_STATE_A_HOST;
+					isp->otg.state = USB_PHY_STATE_A_HOST;
 				break;
-			case OTG_STATE_A_WAIT_VFALL:
+			case USB_PHY_STATE_A_WAIT_VFALL:
 				if (!(isp_stat & INTR_SESS_VLD))
 					a_idle(isp, "vfell");
 				break;
 			default:
 				if (!(isp_stat & INTR_VBUS_VLD))
-					isp->otg.state = OTG_STATE_A_VBUS_ERR;
+					isp->otg.state =
+						USB_PHY_STATE_A_VBUS_ERR;
 				break;
 			}
 			isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
 		} else {
 			switch (state) {
-			case OTG_STATE_B_PERIPHERAL:
-			case OTG_STATE_B_HOST:
-			case OTG_STATE_B_WAIT_ACON:
+			case USB_PHY_STATE_B_PERIPHERAL:
+			case USB_PHY_STATE_B_HOST:
+			case USB_PHY_STATE_B_WAIT_ACON:
 				usb_gadget_vbus_disconnect(isp->otg.gadget);
 				break;
 			default:
 				break;
 			}
-			if (state != OTG_STATE_A_IDLE)
+			if (state != USB_PHY_STATE_A_IDLE)
 				a_idle(isp, "id");
-			if (isp->otg.host && state == OTG_STATE_A_IDLE)
+			if (isp->otg.host && state == USB_PHY_STATE_A_IDLE)
 				isp1301_defer_work(isp, WORK_HOST_RESUME);
 			isp_bstat = 0;
 		}
@@ -1009,34 +1011,34 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		if (isp->otg.default_a) {
 			switch (state) {
 			default:
-				isp->otg.state = OTG_STATE_A_WAIT_VFALL;
+				isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 				break;
-			case OTG_STATE_A_WAIT_VFALL:
-				state = OTG_STATE_A_IDLE;
+			case USB_PHY_STATE_A_WAIT_VFALL:
+				state = USB_PHY_STATE_A_IDLE;
 				/* khubd may take a while to notice and
 				 * handle this disconnect, so don't go
 				 * to B_IDLE quite yet.
 				 */
 				break;
-			case OTG_STATE_A_IDLE:
+			case USB_PHY_STATE_A_IDLE:
 				host_suspend(isp);
 				isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
 						MC1_BDIS_ACON_EN);
-				isp->otg.state = OTG_STATE_B_IDLE;
+				isp->otg.state = USB_PHY_STATE_B_IDLE;
 				l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
 				l &= ~OTG_CTRL_BITS;
 				omap_writel(l, OTG_CTRL);
 				break;
-			case OTG_STATE_B_IDLE:
+			case USB_PHY_STATE_B_IDLE:
 				break;
 			}
 		}
 		isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
 
 		switch (isp->otg.state) {
-		case OTG_STATE_B_PERIPHERAL:
-		case OTG_STATE_B_WAIT_ACON:
-		case OTG_STATE_B_HOST:
+		case USB_PHY_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_B_WAIT_ACON:
+		case USB_PHY_STATE_B_HOST:
 			if (likely(isp_bstat & OTG_B_SESS_VLD))
 				break;
 			enable_vbus_draw(isp, 0);
@@ -1049,12 +1051,12 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			dump_regs(isp, __func__);
 #endif
 			/* FALLTHROUGH */
-		case OTG_STATE_B_SRP_INIT:
+		case USB_PHY_STATE_B_SRP_INIT:
 			b_idle(isp, __func__);
 			l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 			omap_writel(l, OTG_CTRL);
 			/* FALLTHROUGH */
-		case OTG_STATE_B_IDLE:
+		case USB_PHY_STATE_B_IDLE:
 			if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) {
 #ifdef	CONFIG_USB_OTG
 				update_otg1(isp, isp_stat);
@@ -1064,7 +1066,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			} else if (!(isp_stat & (INTR_VBUS_VLD|INTR_SESS_VLD)))
 				isp_bstat |= OTG_B_SESS_END;
 			break;
-		case OTG_STATE_A_WAIT_VFALL:
+		case USB_PHY_STATE_A_WAIT_VFALL:
 			break;
 		default:
 			pr_debug("otg: unsupported b-device %s\n",
@@ -1075,7 +1077,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 
 	if (state != isp->otg.state)
 		pr_debug("  isp, %s -> %s\n",
-				otg_state_string(state), state_name(isp));
+				usb_phy_state_string(state), state_name(isp));
 
 #ifdef	CONFIG_USB_OTG
 	/* update the OTG controller state to match the isp1301; may
@@ -1132,9 +1134,9 @@ isp1301_work(struct work_struct *work)
 			 * skip A_WAIT_BCON; same.
 			 */
 			switch (isp->otg.state) {
-			case OTG_STATE_A_WAIT_BCON:
-			case OTG_STATE_A_WAIT_VRISE:
-				isp->otg.state = OTG_STATE_A_HOST;
+			case USB_PHY_STATE_A_WAIT_BCON:
+			case USB_PHY_STATE_A_WAIT_VRISE:
+				isp->otg.state = USB_PHY_STATE_A_HOST;
 				pr_debug("  --> a_host\n");
 				otg_ctrl = omap_readl(OTG_CTRL);
 				otg_ctrl |= OTG_A_BUSREQ;
@@ -1142,13 +1144,13 @@ isp1301_work(struct work_struct *work)
 						& OTG_CTRL_MASK;
 				omap_writel(otg_ctrl, OTG_CTRL);
 				break;
-			case OTG_STATE_B_WAIT_ACON:
-				isp->otg.state = OTG_STATE_B_HOST;
+			case USB_PHY_STATE_B_WAIT_ACON:
+				isp->otg.state = USB_PHY_STATE_B_HOST;
 				pr_debug("  --> b_host (acon)\n");
 				break;
-			case OTG_STATE_B_HOST:
-			case OTG_STATE_B_IDLE:
-			case OTG_STATE_A_IDLE:
+			case USB_PHY_STATE_B_HOST:
+			case USB_PHY_STATE_B_IDLE:
+			case USB_PHY_STATE_A_IDLE:
 				break;
 			default:
 				pr_debug("  host resume in %s\n",
@@ -1368,7 +1370,7 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 	omap_writel(l, OTG_CTRL);
 
 	power_up(isp);
-	isp->otg.state = OTG_STATE_B_IDLE;
+	isp->otg.state = USB_PHY_STATE_B_IDLE;
 
 	if (machine_is_omap_h2() || machine_is_omap_h3())
 		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
@@ -1403,7 +1405,7 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
 {
 	if (!the_transceiver)
 		return -ENODEV;
-	if (dev->state == OTG_STATE_B_PERIPHERAL)
+	if (dev->state == USB_PHY_STATE_B_PERIPHERAL)
 		enable_vbus_draw(the_transceiver, mA);
 	return 0;
 }
@@ -1415,7 +1417,7 @@ isp1301_start_srp(struct usb_phy *dev)
 	u32		otg_ctrl;
 
 	if (!dev || isp != the_transceiver
-			|| isp->otg.state != OTG_STATE_B_IDLE)
+			|| isp->otg.state != USB_PHY_STATE_B_IDLE)
 		return -ENODEV;
 
 	otg_ctrl = omap_readl(OTG_CTRL);
@@ -1425,7 +1427,7 @@ isp1301_start_srp(struct usb_phy *dev)
 	otg_ctrl |= OTG_B_BUSREQ;
 	otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
 	omap_writel(otg_ctrl, OTG_CTRL);
-	isp->otg.state = OTG_STATE_B_SRP_INIT;
+	isp->otg.state = USB_PHY_STATE_B_SRP_INIT;
 
 	pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
 			omap_readl(OTG_CTRL));
@@ -1455,11 +1457,11 @@ isp1301_start_hnp(struct usb_phy *dev)
 	 * So do this part as early as possible...
 	 */
 	switch (isp->otg.state) {
-	case OTG_STATE_B_HOST:
-		isp->otg.state = OTG_STATE_B_PERIPHERAL;
+	case USB_PHY_STATE_B_HOST:
+		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 		/* caller will suspend next */
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 #if 0
 		/* autoconnect mode avoids irq latency bugs */
 		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1,
@@ -1472,7 +1474,7 @@ isp1301_start_hnp(struct usb_phy *dev)
 		omap_writel(l, OTG_CTRL);
 
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		/* initiated by B-Host suspend */
 		break;
 	default:
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index 880cdf2..54ab373 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -683,12 +683,12 @@ static void init_hsm(void)
 		iotg->hsm.id = 1;
 		iotg->otg.default_a = 0;
 		set_client_mode();
-		iotg->otg.state = OTG_STATE_B_IDLE;
+		iotg->otg.state = USB_PHY_STATE_B_IDLE;
 	} else {
 		iotg->hsm.id = 0;
 		iotg->otg.default_a = 1;
 		set_host_mode();
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 	}
 
 	/* set session indicator */
@@ -934,11 +934,11 @@ static void langwell_otg_work(struct work_struct *work)
 	pdev = to_pci_dev(lnw->dev);
 
 	dev_dbg(lnw->dev, "%s: old state = %s\n", __func__,
-			otg_state_string(iotg->otg.state));
+			usb_phy_state_string(iotg->otg.state));
 
 	switch (iotg->otg.state) {
-	case OTG_STATE_UNDEFINED:
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_UNDEFINED:
+	case USB_PHY_STATE_B_IDLE:
 		if (!iotg->hsm.id) {
 			langwell_otg_del_timer(b_srp_init_tmr);
 			del_timer_sync(&lnw->hsm_timer);
@@ -950,7 +950,7 @@ static void langwell_otg_work(struct work_struct *work)
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
 
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.b_sess_vld) {
 			langwell_otg_del_timer(b_srp_init_tmr);
@@ -961,7 +961,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			if (lnw->iotg.start_peripheral) {
 				lnw->iotg.start_peripheral(&lnw->iotg);
-				iotg->otg.state = OTG_STATE_B_PERIPHERAL;
+				iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 			} else
 				dev_dbg(lnw->dev, "client driver not loaded\n");
 
@@ -996,7 +996,7 @@ static void langwell_otg_work(struct work_struct *work)
 			}
 		}
 		break;
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		if (!iotg->hsm.id) {
 			iotg->otg.default_a = 1;
 			iotg->hsm.a_srp_det = 0;
@@ -1006,18 +1006,18 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_chrg_vbus(0);
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.b_sess_vld) {
 			langwell_otg_chrg_vbus(0);
 			if (lnw->iotg.start_peripheral) {
 				lnw->iotg.start_peripheral(&lnw->iotg);
-				iotg->otg.state = OTG_STATE_B_PERIPHERAL;
+				iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 			} else
 				dev_dbg(lnw->dev, "client driver not loaded\n");
 		}
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		if (!iotg->hsm.id) {
 			iotg->otg.default_a = 1;
 			iotg->hsm.a_srp_det = 0;
@@ -1032,7 +1032,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			iotg->hsm.b_hnp_enable = 0;
@@ -1043,7 +1043,7 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 					"client driver has been removed.\n");
 
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		} else if (iotg->hsm.b_bus_req && iotg->otg.gadget &&
 					iotg->otg.gadget->b_hnp_enable &&
 					iotg->hsm.a_bus_suspend) {
@@ -1059,7 +1059,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			if (lnw->iotg.start_host) {
 				lnw->iotg.start_host(&lnw->iotg);
-				iotg->otg.state = OTG_STATE_B_WAIT_ACON;
+				iotg->otg.state = USB_PHY_STATE_B_WAIT_ACON;
 			} else
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
@@ -1069,7 +1069,7 @@ static void langwell_otg_work(struct work_struct *work)
 		}
 		break;
 
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		if (!iotg->hsm.id) {
 			/* delete hsm timer for b_ase0_brst_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1088,7 +1088,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			/* delete hsm timer for b_ase0_brst_tmr */
@@ -1108,13 +1108,13 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		} else if (iotg->hsm.a_conn) {
 			/* delete hsm timer for b_ase0_brst_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
 			langwell_otg_HAAR(0);
-			iotg->otg.state = OTG_STATE_B_HOST;
+			iotg->otg.state = USB_PHY_STATE_B_HOST;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_resume ||
 				iotg->hsm.b_ase0_brst_tmout) {
@@ -1139,11 +1139,11 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 					"client driver not loaded.\n");
 
-			iotg->otg.state = OTG_STATE_B_PERIPHERAL;
+			iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 		}
 		break;
 
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		if (!iotg->hsm.id) {
 			iotg->otg.default_a = 1;
 			iotg->hsm.a_srp_det = 0;
@@ -1158,7 +1158,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			iotg->hsm.b_hnp_enable = 0;
@@ -1173,7 +1173,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		} else if ((!iotg->hsm.b_bus_req) ||
 				(!iotg->hsm.a_conn)) {
 			iotg->hsm.b_bus_req = 0;
@@ -1193,11 +1193,11 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"client driver not loaded.\n");
 
-			iotg->otg.state = OTG_STATE_B_PERIPHERAL;
+			iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
 		}
 		break;
 
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		iotg->otg.default_a = 1;
 		if (iotg->hsm.id) {
 			iotg->otg.default_a = 0;
@@ -1207,7 +1207,7 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_chrg_vbus(0);
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_bus_drop &&
 			(iotg->hsm.a_srp_det || iotg->hsm.a_bus_req)) {
@@ -1219,7 +1219,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->hsm.vbus_srp_up = 0;
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = OTG_STATE_A_WAIT_VRISE;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_bus_drop && iotg->hsm.a_sess_vld) {
 			iotg->hsm.vbus_srp_up = 1;
@@ -1233,14 +1233,14 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->hsm.vbus_srp_up = 0;
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = OTG_STATE_A_WAIT_VRISE;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_sess_vld &&
 				!iotg->hsm.vbus_srp_up) {
 			langwell_otg_phy_low_power(1);
 		}
 		break;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		if (iotg->hsm.id) {
 			langwell_otg_del_timer(a_wait_vrise_tmr);
 			iotg->hsm.b_bus_req = 0;
@@ -1250,7 +1250,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		} else if (iotg->hsm.a_vbus_vld) {
 			langwell_otg_del_timer(a_wait_vrise_tmr);
 			iotg->hsm.b_conn = 0;
@@ -1262,7 +1262,7 @@ static void langwell_otg_work(struct work_struct *work)
 			}
 
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = OTG_STATE_A_WAIT_BCON;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
 		} else if (iotg->hsm.a_wait_vrise_tmout) {
 			iotg->hsm.b_conn = 0;
 			if (iotg->hsm.a_vbus_vld) {
@@ -1274,17 +1274,17 @@ static void langwell_otg_work(struct work_struct *work)
 					break;
 				}
 				langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-				iotg->otg.state = OTG_STATE_A_WAIT_BCON;
+				iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
 			} else {
 
 				/* Turn off VBus */
 				iotg->otg.set_vbus(&iotg->otg, false);
 				langwell_otg_phy_low_power_wait(1);
-				iotg->otg.state = OTG_STATE_A_VBUS_ERR;
+				iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 			}
 		}
 		break;
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		if (iotg->hsm.id) {
 			/* delete hsm timer for a_wait_bcon_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1302,7 +1302,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_vbus_vld) {
 			/* delete hsm timer for a_wait_bcon_tmr */
@@ -1317,7 +1317,7 @@ static void langwell_otg_work(struct work_struct *work)
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_A_VBUS_ERR;
+			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 		} else if (iotg->hsm.a_bus_drop ||
 				(iotg->hsm.a_wait_bcon_tmout &&
 				!iotg->hsm.a_bus_req)) {
@@ -1332,13 +1332,13 @@ static void langwell_otg_work(struct work_struct *work)
 
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = OTG_STATE_A_WAIT_VFALL;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (iotg->hsm.b_conn) {
 			/* delete hsm timer for a_wait_bcon_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
 			iotg->hsm.a_suspend_req = 0;
-			iotg->otg.state = OTG_STATE_A_HOST;
+			iotg->otg.state = USB_PHY_STATE_A_HOST;
 			if (iotg->hsm.a_srp_det && iotg->otg.host &&
 					!iotg->otg.host->b_hnp_enable) {
 				/* SRP capable peripheral-only device */
@@ -1369,7 +1369,7 @@ static void langwell_otg_work(struct work_struct *work)
 				/* clear PHCD to enable HW timer */
 				langwell_otg_phy_low_power(0);
 				langwell_otg_add_timer(a_aidl_bdis_tmr);
-				iotg->otg.state = OTG_STATE_A_SUSPEND;
+				iotg->otg.state = USB_PHY_STATE_A_SUSPEND;
 			} else if (!iotg->hsm.a_bus_req && iotg->otg.host &&
 				!iotg->otg.host->b_hnp_enable) {
 				if (lnw->iotg.stop_host)
@@ -1380,11 +1380,11 @@ static void langwell_otg_work(struct work_struct *work)
 
 				/* Turn off VBus */
 				iotg->otg.set_vbus(&iotg->otg, false);
-				iotg->otg.state = OTG_STATE_A_WAIT_VFALL;
+				iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 			}
 		}
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		if (iotg->hsm.id) {
 			iotg->otg.default_a = 0;
 			iotg->hsm.b_bus_req = 0;
@@ -1399,7 +1399,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_drop ||
 				(iotg->otg.host &&
@@ -1413,7 +1413,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = OTG_STATE_A_WAIT_VFALL;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (!iotg->hsm.a_vbus_vld) {
 			if (lnw->iotg.stop_host)
 				lnw->iotg.stop_host(&lnw->iotg);
@@ -1424,7 +1424,7 @@ static void langwell_otg_work(struct work_struct *work)
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_A_VBUS_ERR;
+			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 		} else if (iotg->otg.host &&
 				iotg->otg.host->b_hnp_enable &&
 				!iotg->hsm.a_bus_req) {
@@ -1449,13 +1449,13 @@ static void langwell_otg_work(struct work_struct *work)
 			/* clear PHCD to enable HW timer */
 			langwell_otg_phy_low_power(0);
 			langwell_otg_add_timer(a_aidl_bdis_tmr);
-			iotg->otg.state = OTG_STATE_A_SUSPEND;
+			iotg->otg.state = USB_PHY_STATE_A_SUSPEND;
 		} else if (!iotg->hsm.b_conn || !iotg->hsm.a_bus_req) {
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = OTG_STATE_A_WAIT_BCON;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
 		}
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		if (iotg->hsm.id) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
 			langwell_otg_HABA(0);
@@ -1473,7 +1473,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_req ||
 				iotg->hsm.b_bus_resume) {
@@ -1482,7 +1482,7 @@ static void langwell_otg_work(struct work_struct *work)
 			free_irq(pdev->irq, iotg->base);
 			iotg->hsm.a_suspend_req = 0;
 			langwell_otg_loc_sof(1);
-			iotg->otg.state = OTG_STATE_A_HOST;
+			iotg->otg.state = USB_PHY_STATE_A_HOST;
 		} else if (iotg->hsm.a_aidl_bdis_tmout ||
 				iotg->hsm.a_bus_drop) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
@@ -1496,7 +1496,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = OTG_STATE_A_WAIT_VFALL;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (!iotg->hsm.b_conn && iotg->otg.host &&
 				iotg->otg.host->b_hnp_enable) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
@@ -1520,7 +1520,7 @@ static void langwell_otg_work(struct work_struct *work)
 					"client driver not loaded.\n");
 
 			langwell_otg_add_ktimer(TB_BUS_SUSPEND_TMR);
-			iotg->otg.state = OTG_STATE_A_PERIPHERAL;
+			iotg->otg.state = USB_PHY_STATE_A_PERIPHERAL;
 			break;
 		} else if (!iotg->hsm.a_vbus_vld) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
@@ -1535,10 +1535,10 @@ static void langwell_otg_work(struct work_struct *work)
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_A_VBUS_ERR;
+			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 		}
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		if (iotg->hsm.id) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1554,7 +1554,7 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_vbus_vld) {
 			/* delete hsm timer for b_bus_suspend_tmr */
@@ -1569,7 +1569,7 @@ static void langwell_otg_work(struct work_struct *work)
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = OTG_STATE_A_VBUS_ERR;
+			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
 		} else if (iotg->hsm.a_bus_drop) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1582,7 +1582,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			/* Turn off VBus */
 			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = OTG_STATE_A_WAIT_VFALL;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (iotg->hsm.b_bus_suspend) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1599,7 +1599,7 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = OTG_STATE_A_WAIT_BCON;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
 		} else if (iotg->hsm.b_bus_suspend_tmout) {
 			u32	val;
 			val = readl(lnw->iotg.base + CI_PORTSC1);
@@ -1618,24 +1618,24 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = OTG_STATE_A_WAIT_BCON;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
 		}
 		break;
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		if (iotg->hsm.id) {
 			iotg->otg.default_a = 0;
 			iotg->hsm.a_clr_err = 0;
 			iotg->hsm.a_srp_det = 0;
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_clr_err) {
 			iotg->hsm.a_clr_err = 0;
 			iotg->hsm.a_srp_det = 0;
 			reset_otg();
 			init_hsm();
-			if (iotg->otg.state == OTG_STATE_A_IDLE)
+			if (iotg->otg.state == USB_PHY_STATE_A_IDLE)
 				langwell_update_transceiver();
 		} else {
 			/* FW will clear PHCD bit when any VBus
@@ -1643,12 +1643,12 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_phy_low_power(1);
 		}
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		if (iotg->hsm.id) {
 			iotg->otg.default_a = 0;
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_B_IDLE;
+			iotg->otg.state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_req) {
 
@@ -1656,12 +1656,12 @@ static void langwell_otg_work(struct work_struct *work)
 			iotg->otg.set_vbus(&iotg->otg, true);
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = OTG_STATE_A_WAIT_VRISE;
+			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
 		} else if (!iotg->hsm.a_sess_vld) {
 			iotg->hsm.a_srp_det = 0;
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = OTG_STATE_A_IDLE;
+			iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		}
 		break;
 	default:
@@ -1669,7 +1669,7 @@ static void langwell_otg_work(struct work_struct *work)
 	}
 
 	dev_dbg(lnw->dev, "%s: new state = %s\n", __func__,
-			otg_state_string(iotg->otg.state));
+			usb_phy_state_string(iotg->otg.state));
 }
 
 static ssize_t
@@ -1755,7 +1755,7 @@ show_hsm(struct device *_dev, struct device_attribute *attr, char *buf)
 		"b_bus_req = \t%d\n"
 		"b_bus_suspend_tmout = \t%d\n"
 		"b_bus_suspend_vld = \t%d\n",
-		otg_state_string(iotg->otg.state),
+		usb_phy_state_string(iotg->otg.state),
 		iotg->hsm.a_bus_resume,
 		iotg->hsm.a_bus_suspend,
 		iotg->hsm.a_conn,
@@ -2043,7 +2043,7 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 	lnw->iotg.otg.set_power = langwell_otg_set_power;
 	lnw->iotg.otg.set_vbus = langwell_otg_set_vbus;
 	lnw->iotg.otg.start_srp = langwell_otg_start_srp;
-	lnw->iotg.otg.state = OTG_STATE_UNDEFINED;
+	lnw->iotg.otg.state = USB_PHY_STATE_UNDEFINED;
 
 	if (otg_set_transceiver(&lnw->iotg.otg)) {
 		dev_dbg(lnw->dev, "can't set transceiver\n");
@@ -2107,7 +2107,7 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 		goto err;
 	}
 
-	if (lnw->iotg.otg.state == OTG_STATE_A_IDLE)
+	if (lnw->iotg.otg.state == USB_PHY_STATE_A_IDLE)
 		langwell_update_transceiver();
 
 	return 0;
@@ -2180,23 +2180,23 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 
 	/* start actions */
 	switch (iotg->otg.state) {
-	case OTG_STATE_A_WAIT_VFALL:
-		iotg->otg.state = OTG_STATE_A_IDLE;
-	case OTG_STATE_A_IDLE:
-	case OTG_STATE_B_IDLE:
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_WAIT_VFALL:
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+	case USB_PHY_STATE_A_IDLE:
+	case USB_PHY_STATE_B_IDLE:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		langwell_otg_del_timer(a_wait_vrise_tmr);
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
 		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		del_timer_sync(&lnw->hsm_timer);
 		if (lnw->iotg.stop_host)
 			lnw->iotg.stop_host(&lnw->iotg);
@@ -2207,10 +2207,10 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 
 		/* Turn off VBus */
 		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		if (lnw->iotg.stop_host)
 			lnw->iotg.stop_host(&lnw->iotg);
 		else
@@ -2221,10 +2221,10 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		/* Turn off VBus */
 		iotg->otg.set_vbus(&iotg->otg, false);
 
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		langwell_otg_del_timer(a_aidl_bdis_tmr);
 		langwell_otg_HABA(0);
 		if (lnw->iotg.stop_host)
@@ -2235,10 +2235,10 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 
 		/* Turn off VBus */
 		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		del_timer_sync(&lnw->hsm_timer);
 
 		if (lnw->iotg.stop_peripheral)
@@ -2250,28 +2250,28 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 
 		/* Turn off VBus */
 		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = OTG_STATE_A_IDLE;
+		iotg->otg.state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		if (lnw->iotg.stop_host)
 			lnw->iotg.stop_host(&lnw->iotg);
 		else
 			dev_dbg(&pdev->dev, "host driver has been removed.\n");
 		iotg->hsm.b_bus_req = 0;
-		iotg->otg.state = OTG_STATE_B_IDLE;
+		iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		if (lnw->iotg.stop_peripheral)
 			lnw->iotg.stop_peripheral(&lnw->iotg);
 		else
 			dev_dbg(&pdev->dev,
 				"client driver has been removed.\n");
-		iotg->otg.state = OTG_STATE_B_IDLE;
+		iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		/* delete hsm timer for b_ase0_brst_tmr */
 		del_timer_sync(&lnw->hsm_timer);
 
@@ -2282,7 +2282,7 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		else
 			dev_dbg(&pdev->dev, "host driver has been removed.\n");
 		iotg->hsm.b_bus_req = 0;
-		iotg->otg.state = OTG_STATE_B_IDLE;
+		iotg->otg.state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	default:
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index cba4737..c468db6 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -666,7 +666,7 @@ static void msm_otg_start_host(struct usb_phy *otg, int on)
 		 * HUB before kicking the host.
 		 */
 		if (pdata->setup_gpio)
-			pdata->setup_gpio(OTG_STATE_A_HOST);
+			pdata->setup_gpio(USB_PHY_STATE_A_HOST);
 #ifdef CONFIG_USB
 		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
 #endif
@@ -677,7 +677,7 @@ static void msm_otg_start_host(struct usb_phy *otg, int on)
 		usb_remove_hcd(hcd);
 #endif
 		if (pdata->setup_gpio)
-			pdata->setup_gpio(OTG_STATE_UNDEFINED);
+			pdata->setup_gpio(USB_PHY_STATE_UNDEFINED);
 		if (pdata->vbus_power)
 			pdata->vbus_power(0);
 	}
@@ -698,11 +698,11 @@ static int msm_otg_set_host(struct usb_phy *otg, struct usb_bus *host)
 	}
 
 	if (!host) {
-		if (otg->state == OTG_STATE_A_HOST) {
+		if (otg->state == USB_PHY_STATE_A_HOST) {
 			pm_runtime_get_sync(otg->dev);
 			msm_otg_start_host(otg, 0);
 			otg->host = NULL;
-			otg->state = OTG_STATE_UNDEFINED;
+			otg->state = USB_PHY_STATE_UNDEFINED;
 			schedule_work(&motg->sm_work);
 		} else {
 			otg->host = NULL;
@@ -745,13 +745,13 @@ static void msm_otg_start_peripheral(struct usb_phy *otg, int on)
 		 * HUB before kicking the gadget.
 		 */
 		if (pdata->setup_gpio)
-			pdata->setup_gpio(OTG_STATE_B_PERIPHERAL);
+			pdata->setup_gpio(USB_PHY_STATE_B_PERIPHERAL);
 		usb_gadget_vbus_connect(otg->gadget);
 	} else {
 		dev_dbg(otg->dev, "gadget off\n");
 		usb_gadget_vbus_disconnect(otg->gadget);
 		if (pdata->setup_gpio)
-			pdata->setup_gpio(OTG_STATE_UNDEFINED);
+			pdata->setup_gpio(USB_PHY_STATE_UNDEFINED);
 	}
 
 }
@@ -771,11 +771,11 @@ static int msm_otg_set_peripheral(struct usb_phy *otg,
 	}
 
 	if (!gadget) {
-		if (otg->state == OTG_STATE_B_PERIPHERAL) {
+		if (otg->state == USB_PHY_STATE_B_PERIPHERAL) {
 			pm_runtime_get_sync(otg->dev);
 			msm_otg_start_peripheral(otg, 0);
 			otg->gadget = NULL;
-			otg->state = OTG_STATE_UNDEFINED;
+			otg->state = USB_PHY_STATE_UNDEFINED;
 			schedule_work(&motg->sm_work);
 		} else {
 			otg->gadget = NULL;
@@ -1155,19 +1155,19 @@ static void msm_otg_sm_work(struct work_struct *w)
 	struct usb_phy *otg = &motg->otg;
 
 	switch (otg->state) {
-	case OTG_STATE_UNDEFINED:
-		dev_dbg(otg->dev, "OTG_STATE_UNDEFINED state\n");
+	case USB_PHY_STATE_UNDEFINED:
+		dev_dbg(otg->dev, "USB_PHY_STATE_UNDEFINED state\n");
 		msm_otg_reset(otg);
 		msm_otg_init_sm(motg);
-		otg->state = OTG_STATE_B_IDLE;
+		otg->state = USB_PHY_STATE_B_IDLE;
 		/* FALL THROUGH */
-	case OTG_STATE_B_IDLE:
-		dev_dbg(otg->dev, "OTG_STATE_B_IDLE state\n");
+	case USB_PHY_STATE_B_IDLE:
+		dev_dbg(otg->dev, "USB_PHY_STATE_B_IDLE state\n");
 		if (!test_bit(ID, &motg->inputs) && otg->host) {
 			/* disable BSV bit */
 			writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC);
 			msm_otg_start_host(otg, 1);
-			otg->state = OTG_STATE_A_HOST;
+			otg->state = USB_PHY_STATE_A_HOST;
 		} else if (test_bit(B_SESS_VLD, &motg->inputs)) {
 			switch (motg->chg_state) {
 			case USB_CHG_STATE_UNDEFINED:
@@ -1183,12 +1183,12 @@ static void msm_otg_sm_work(struct work_struct *w)
 					msm_otg_notify_charger(motg,
 							IDEV_CHG_MAX);
 					msm_otg_start_peripheral(otg, 1);
-					otg->state = OTG_STATE_B_PERIPHERAL;
+					otg->state = USB_PHY_STATE_B_PERIPHERAL;
 					break;
 				case USB_SDP_CHARGER:
 					msm_otg_notify_charger(motg, IUNIT);
 					msm_otg_start_peripheral(otg, 1);
-					otg->state = OTG_STATE_B_PERIPHERAL;
+					otg->state = USB_PHY_STATE_B_PERIPHERAL;
 					break;
 				default:
 					break;
@@ -1213,24 +1213,24 @@ static void msm_otg_sm_work(struct work_struct *w)
 		}
 		pm_runtime_put_sync(otg->dev);
 		break;
-	case OTG_STATE_B_PERIPHERAL:
-		dev_dbg(otg->dev, "OTG_STATE_B_PERIPHERAL state\n");
+	case USB_PHY_STATE_B_PERIPHERAL:
+		dev_dbg(otg->dev, "USB_PHY_STATE_B_PERIPHERAL state\n");
 		if (!test_bit(B_SESS_VLD, &motg->inputs) ||
 				!test_bit(ID, &motg->inputs)) {
 			msm_otg_notify_charger(motg, 0);
 			msm_otg_start_peripheral(otg, 0);
 			motg->chg_state = USB_CHG_STATE_UNDEFINED;
 			motg->chg_type = USB_INVALID_CHARGER;
-			otg->state = OTG_STATE_B_IDLE;
+			otg->state = USB_PHY_STATE_B_IDLE;
 			msm_otg_reset(otg);
 			schedule_work(w);
 		}
 		break;
-	case OTG_STATE_A_HOST:
-		dev_dbg(otg->dev, "OTG_STATE_A_HOST state\n");
+	case USB_PHY_STATE_A_HOST:
+		dev_dbg(otg->dev, "USB_PHY_STATE_A_HOST state\n");
 		if (test_bit(ID, &motg->inputs)) {
 			msm_otg_start_host(otg, 0);
-			otg->state = OTG_STATE_B_IDLE;
+			otg->state = USB_PHY_STATE_B_IDLE;
 			msm_otg_reset(otg);
 			schedule_work(w);
 		}
@@ -1284,10 +1284,10 @@ static int msm_otg_mode_show(struct seq_file *s, void *unused)
 	struct usb_phy *otg = &motg->otg;
 
 	switch (otg->state) {
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		seq_printf(s, "host\n");
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		seq_printf(s, "peripheral\n");
 		break;
 	default:
@@ -1334,8 +1334,8 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 	switch (req_mode) {
 	case USB_NONE:
 		switch (otg->state) {
-		case OTG_STATE_A_HOST:
-		case OTG_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_A_HOST:
+		case USB_PHY_STATE_B_PERIPHERAL:
 			set_bit(ID, &motg->inputs);
 			clear_bit(B_SESS_VLD, &motg->inputs);
 			break;
@@ -1345,8 +1345,8 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 		break;
 	case USB_PERIPHERAL:
 		switch (otg->state) {
-		case OTG_STATE_B_IDLE:
-		case OTG_STATE_A_HOST:
+		case USB_PHY_STATE_B_IDLE:
+		case USB_PHY_STATE_A_HOST:
 			set_bit(ID, &motg->inputs);
 			set_bit(B_SESS_VLD, &motg->inputs);
 			break;
@@ -1356,8 +1356,8 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 		break;
 	case USB_HOST:
 		switch (otg->state) {
-		case OTG_STATE_B_IDLE:
-		case OTG_STATE_B_PERIPHERAL:
+		case USB_PHY_STATE_B_IDLE:
+		case USB_PHY_STATE_B_PERIPHERAL:
 			clear_bit(ID, &motg->inputs);
 			break;
 		default:
@@ -1670,7 +1670,7 @@ static int msm_otg_runtime_idle(struct device *dev)
 	 * This 1 sec delay also prevents entering into LPM immediately
 	 * after asynchronous interrupt.
 	 */
-	if (otg->state != OTG_STATE_UNDEFINED)
+	if (otg->state != USB_PHY_STATE_UNDEFINED)
 		pm_schedule_suspend(dev, 1000);
 
 	return -EAGAIN;
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 2ab0279..6a0c102 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -84,7 +84,7 @@ static int nop_set_peripheral(struct usb_phy *x,
 	}
 
 	nop->otg.gadget = gadget;
-	nop->otg.state = OTG_STATE_B_IDLE;
+	nop->otg.state = USB_PHY_STATE_B_IDLE;
 	return 0;
 }
 
@@ -118,7 +118,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
 	nop->dev		= &pdev->dev;
 	nop->otg.dev		= nop->dev;
 	nop->otg.label		= "nop-xceiv";
-	nop->otg.state		= OTG_STATE_UNDEFINED;
+	nop->otg.state		= USB_PHY_STATE_UNDEFINED;
 	nop->otg.set_host	= nop_set_host;
 	nop->otg.set_peripheral	= nop_set_peripheral;
 	nop->otg.set_suspend	= nop_set_suspend;
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index 059c487..c6f2bed 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -65,37 +65,37 @@ int otg_set_transceiver(struct usb_phy *x)
 }
 EXPORT_SYMBOL(otg_set_transceiver);
 
-const char *otg_state_string(enum usb_otg_state state)
+const char *usb_phy_state_string(enum usb_phy_state state)
 {
 	switch (state) {
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		return "a_idle";
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		return "a_wait_vrise";
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		return "a_wait_bcon";
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		return "a_host";
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		return "a_suspend";
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		return "a_peripheral";
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		return "a_wait_vfall";
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		return "a_vbus_err";
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		return "b_idle";
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		return "b_srp_init";
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		return "b_peripheral";
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		return "b_wait_acon";
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		return "b_host";
 	default:
 		return "UNDEFINED";
 	}
 }
-EXPORT_SYMBOL(otg_state_string);
+EXPORT_SYMBOL(usb_phy_state_string);
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c
index 0911738..b2feb07 100644
--- a/drivers/usb/otg/otg_fsm.c
+++ b/drivers/usb/otg/otg_fsm.c
@@ -65,48 +65,48 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
 static int state_changed;
 
 /* Called when leaving a state.  Do state clean up jobs here */
-void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
+void otg_leave_state(struct otg_fsm *fsm, enum usb_phy_state old_state)
 {
 	switch (old_state) {
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		otg_del_timer(fsm, b_se0_srp_tmr);
 		fsm->b_se0_srp = 0;
 		break;
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		fsm->b_srp_done = 0;
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		break;
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		otg_del_timer(fsm, b_ase0_brst_tmr);
 		fsm->b_ase0_brst_tmout = 0;
 		break;
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		break;
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		break;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		otg_del_timer(fsm, a_wait_vrise_tmr);
 		fsm->a_wait_vrise_tmout = 0;
 		break;
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		otg_del_timer(fsm, a_wait_bcon_tmr);
 		fsm->a_wait_bcon_tmout = 0;
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		otg_del_timer(fsm, a_wait_enum_tmr);
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		otg_del_timer(fsm, a_aidl_bdis_tmr);
 		fsm->a_aidl_bdis_tmout = 0;
 		fsm->a_suspend_req = 0;
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		otg_del_timer(fsm, a_wait_vrise_tmr);
 		break;
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		break;
 	default:
 		break;
@@ -114,15 +114,15 @@ void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
 }
 
 /* Called when entering a state */
-int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
+int otg_set_state(struct otg_fsm *fsm, enum usb_phy_state new_state)
 {
 	state_changed = 1;
 	if (fsm->transceiver->state == new_state)
 		return 0;
-	VDBG("Set state: %s\n", otg_state_string(new_state));
+	VDBG("Set state: %s\n", usb_phy_state_string(new_state));
 	otg_leave_state(fsm, fsm->transceiver->state);
 	switch (new_state) {
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		otg_drv_vbus(fsm, 0);
 		otg_chrg_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
@@ -130,19 +130,19 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		otg_set_protocol(fsm, PROTO_UNDEF);
 		otg_add_timer(fsm, b_se0_srp_tmr);
 		break;
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		otg_start_pulse(fsm);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_UNDEF);
 		otg_add_timer(fsm, b_srp_fail_tmr);
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		otg_chrg_vbus(fsm, 0);
 		otg_loc_conn(fsm, 1);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_GADGET);
 		break;
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		otg_chrg_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
@@ -150,7 +150,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		otg_add_timer(fsm, b_ase0_brst_tmr);
 		fsm->a_bus_suspend = 0;
 		break;
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		otg_chrg_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 1);
@@ -158,28 +158,28 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		usb_bus_start_enum(fsm->transceiver->host,
 				fsm->transceiver->host->otg_port);
 		break;
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		otg_drv_vbus(fsm, 0);
 		otg_chrg_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_HOST);
 		break;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		otg_drv_vbus(fsm, 1);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_HOST);
 		otg_add_timer(fsm, a_wait_vrise_tmr);
 		break;
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		otg_drv_vbus(fsm, 1);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_HOST);
 		otg_add_timer(fsm, a_wait_bcon_tmr);
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		otg_drv_vbus(fsm, 1);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 1);
@@ -191,7 +191,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		if (!fsm->a_bus_req || fsm->a_suspend_req)
 			otg_add_timer(fsm, a_wait_enum_tmr);
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		otg_drv_vbus(fsm, 1);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
@@ -199,19 +199,19 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 		otg_add_timer(fsm, a_aidl_bdis_tmr);
 
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		otg_loc_conn(fsm, 1);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_GADGET);
 		otg_drv_vbus(fsm, 1);
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		otg_drv_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
 		otg_set_protocol(fsm, PROTO_HOST);
 		break;
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		otg_drv_vbus(fsm, 0);
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 0);
@@ -228,7 +228,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
 /* State change judgement */
 int otg_statemachine(struct otg_fsm *fsm)
 {
-	enum usb_otg_state state;
+	enum usb_phy_state state;
 	unsigned long flags;
 
 	spin_lock_irqsave(&fsm->lock, flags);
@@ -238,105 +238,105 @@ int otg_statemachine(struct otg_fsm *fsm)
 	/* State machine state change judgement */
 
 	switch (state) {
-	case OTG_STATE_UNDEFINED:
+	case USB_PHY_STATE_UNDEFINED:
 		VDBG("fsm->id = %d\n", fsm->id);
 		if (fsm->id)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		else
-			otg_set_state(fsm, OTG_STATE_A_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_A_IDLE);
 		break;
-	case OTG_STATE_B_IDLE:
+	case USB_PHY_STATE_B_IDLE:
 		if (!fsm->id)
-			otg_set_state(fsm, OTG_STATE_A_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_A_IDLE);
 		else if (fsm->b_sess_vld && fsm->transceiver->gadget)
-			otg_set_state(fsm, OTG_STATE_B_PERIPHERAL);
+			otg_set_state(fsm, USB_PHY_STATE_B_PERIPHERAL);
 		else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp)
-			otg_set_state(fsm, OTG_STATE_B_SRP_INIT);
+			otg_set_state(fsm, USB_PHY_STATE_B_SRP_INIT);
 		break;
-	case OTG_STATE_B_SRP_INIT:
+	case USB_PHY_STATE_B_SRP_INIT:
 		if (!fsm->id || fsm->b_srp_done)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		break;
-	case OTG_STATE_B_PERIPHERAL:
+	case USB_PHY_STATE_B_PERIPHERAL:
 		if (!fsm->id || !fsm->b_sess_vld)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		else if (fsm->b_bus_req && fsm->transceiver->
 				gadget->b_hnp_enable && fsm->a_bus_suspend)
-			otg_set_state(fsm, OTG_STATE_B_WAIT_ACON);
+			otg_set_state(fsm, USB_PHY_STATE_B_WAIT_ACON);
 		break;
-	case OTG_STATE_B_WAIT_ACON:
+	case USB_PHY_STATE_B_WAIT_ACON:
 		if (fsm->a_conn)
-			otg_set_state(fsm, OTG_STATE_B_HOST);
+			otg_set_state(fsm, USB_PHY_STATE_B_HOST);
 		else if (!fsm->id || !fsm->b_sess_vld)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		else if (fsm->a_bus_resume || fsm->b_ase0_brst_tmout) {
 			fsm->b_ase0_brst_tmout = 0;
-			otg_set_state(fsm, OTG_STATE_B_PERIPHERAL);
+			otg_set_state(fsm, USB_PHY_STATE_B_PERIPHERAL);
 		}
 		break;
-	case OTG_STATE_B_HOST:
+	case USB_PHY_STATE_B_HOST:
 		if (!fsm->id || !fsm->b_sess_vld)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		else if (!fsm->b_bus_req || !fsm->a_conn)
-			otg_set_state(fsm, OTG_STATE_B_PERIPHERAL);
+			otg_set_state(fsm, USB_PHY_STATE_B_PERIPHERAL);
 		break;
-	case OTG_STATE_A_IDLE:
+	case USB_PHY_STATE_A_IDLE:
 		if (fsm->id)
-			otg_set_state(fsm, OTG_STATE_B_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
 		else if (!fsm->a_bus_drop && (fsm->a_bus_req || fsm->a_srp_det))
-			otg_set_state(fsm, OTG_STATE_A_WAIT_VRISE);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_VRISE);
 		break;
-	case OTG_STATE_A_WAIT_VRISE:
+	case USB_PHY_STATE_A_WAIT_VRISE:
 		if (fsm->id || fsm->a_bus_drop || fsm->a_vbus_vld ||
 				fsm->a_wait_vrise_tmout) {
-			otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
 		}
 		break;
-	case OTG_STATE_A_WAIT_BCON:
+	case USB_PHY_STATE_A_WAIT_BCON:
 		if (!fsm->a_vbus_vld)
-			otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
+			otg_set_state(fsm, USB_PHY_STATE_A_VBUS_ERR);
 		else if (fsm->b_conn)
-			otg_set_state(fsm, OTG_STATE_A_HOST);
+			otg_set_state(fsm, USB_PHY_STATE_A_HOST);
 		else if (fsm->id | fsm->a_bus_drop | fsm->a_wait_bcon_tmout)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_VFALL);
 		break;
-	case OTG_STATE_A_HOST:
+	case USB_PHY_STATE_A_HOST:
 		if ((!fsm->a_bus_req || fsm->a_suspend_req) &&
 				fsm->transceiver->host->b_hnp_enable)
-			otg_set_state(fsm, OTG_STATE_A_SUSPEND);
+			otg_set_state(fsm, USB_PHY_STATE_A_SUSPEND);
 		else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
 		else if (!fsm->a_vbus_vld)
-			otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
+			otg_set_state(fsm, USB_PHY_STATE_A_VBUS_ERR);
 		break;
-	case OTG_STATE_A_SUSPEND:
+	case USB_PHY_STATE_A_SUSPEND:
 		if (!fsm->b_conn && fsm->transceiver->host->b_hnp_enable)
-			otg_set_state(fsm, OTG_STATE_A_PERIPHERAL);
+			otg_set_state(fsm, USB_PHY_STATE_A_PERIPHERAL);
 		else if (!fsm->b_conn && !fsm->transceiver->host->b_hnp_enable)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
 		else if (fsm->a_bus_req || fsm->b_bus_resume)
-			otg_set_state(fsm, OTG_STATE_A_HOST);
+			otg_set_state(fsm, USB_PHY_STATE_A_HOST);
 		else if (fsm->id || fsm->a_bus_drop || fsm->a_aidl_bdis_tmout)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_VFALL);
 		else if (!fsm->a_vbus_vld)
-			otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
+			otg_set_state(fsm, USB_PHY_STATE_A_VBUS_ERR);
 		break;
-	case OTG_STATE_A_PERIPHERAL:
+	case USB_PHY_STATE_A_PERIPHERAL:
 		if (fsm->id || fsm->a_bus_drop)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_VFALL);
 		else if (fsm->b_bus_suspend)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_BCON);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
 		else if (!fsm->a_vbus_vld)
-			otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
+			otg_set_state(fsm, USB_PHY_STATE_A_VBUS_ERR);
 		break;
-	case OTG_STATE_A_WAIT_VFALL:
+	case USB_PHY_STATE_A_WAIT_VFALL:
 		if (fsm->id || fsm->a_bus_req || (!fsm->a_sess_vld &&
 					!fsm->b_conn))
-			otg_set_state(fsm, OTG_STATE_A_IDLE);
+			otg_set_state(fsm, USB_PHY_STATE_A_IDLE);
 		break;
-	case OTG_STATE_A_VBUS_ERR:
+	case USB_PHY_STATE_A_VBUS_ERR:
 		if (fsm->id || fsm->a_bus_drop || fsm->a_clr_err)
-			otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
+			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_VFALL);
 		break;
 	default:
 		break;
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index beeecc2..9eed1f3 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -246,7 +246,7 @@ twl4030_usb_clear_bits(struct twl4030_usb *twl, u8 reg, u8 bits)
 
 /*-------------------------------------------------------------------------*/
 
-static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl)
+static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 {
 	int	status;
 	int	linkstat = USB_EVENT_NONE;
@@ -291,10 +291,10 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	twl->linkstat = linkstat;
 	if (linkstat == USB_EVENT_ID) {
 		twl->otg.default_a = true;
-		twl->otg.state = OTG_STATE_A_IDLE;
+		twl->otg.state = USB_PHY_STATE_A_IDLE;
 	} else {
 		twl->otg.default_a = false;
-		twl->otg.state = OTG_STATE_B_IDLE;
+		twl->otg.state = USB_PHY_STATE_B_IDLE;
 	}
 	spin_unlock_irq(&twl->lock);
 
@@ -571,7 +571,7 @@ static int twl4030_set_peripheral(struct usb_phy *x,
 	twl = xceiv_to_twl(x);
 	twl->otg.gadget = gadget;
 	if (!gadget)
-		twl->otg.state = OTG_STATE_UNDEFINED;
+		twl->otg.state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
@@ -586,7 +586,7 @@ static int twl4030_set_host(struct usb_phy *x, struct usb_bus *host)
 	twl = xceiv_to_twl(x);
 	twl->otg.host = host;
 	if (!host)
-		twl->otg.state = OTG_STATE_UNDEFINED;
+		twl->otg.state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index e6e63fb..720ab7d 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -285,7 +285,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 			twl->asleep = 1;
 			status = USB_EVENT_VBUS;
 			twl->otg.default_a = false;
-			twl->otg.state = OTG_STATE_B_IDLE;
+			twl->otg.state = USB_PHY_STATE_B_IDLE;
 			twl->linkstat = status;
 			twl->otg.last_event = status;
 			atomic_notifier_call_chain(&twl->otg.notifier,
@@ -324,7 +324,7 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 								0x10);
 		status = USB_EVENT_ID;
 		twl->otg.default_a = true;
-		twl->otg.state = OTG_STATE_A_IDLE;
+		twl->otg.state = USB_PHY_STATE_A_IDLE;
 		twl->linkstat = status;
 		twl->otg.last_event = status;
 		atomic_notifier_call_chain(&twl->otg.notifier, status,
@@ -351,7 +351,7 @@ static int twl6030_set_peripheral(struct usb_phy *x,
 	twl = xceiv_to_twl(x);
 	twl->otg.gadget = gadget;
 	if (!gadget)
-		twl->otg.state = OTG_STATE_UNDEFINED;
+		twl->otg.state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
@@ -412,7 +412,7 @@ static int twl6030_set_host(struct usb_phy *x, struct usb_bus *host)
 	twl = xceiv_to_twl(x);
 	twl->otg.host = host;
 	if (!host)
-		twl->otg.state = OTG_STATE_UNDEFINED;
+		twl->otg.state = USB_PHY_STATE_UNDEFINED;
 	return 0;
 }
 
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 2d3547a..e25ee7a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -133,7 +133,7 @@ struct msm_otg_platform_data {
 	enum otg_control_type otg_control;
 	enum usb_mode_type default_mode;
 	enum msm_usb_phy_type phy_type;
-	void (*setup_gpio)(enum usb_otg_state state);
+	void (*setup_gpio)(enum usb_phy_state state);
 	char *pclk_src_name;
 };
 
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e0bc557..926e04c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -12,30 +12,30 @@
 #include <linux/notifier.h>
 
 /* OTG defines lots of enumeration states before device reset */
-enum usb_otg_state {
-	OTG_STATE_UNDEFINED = 0,
+enum usb_phy_state {
+	USB_PHY_STATE_UNDEFINED = 0,
 
 	/* single-role peripheral, and dual-role default-b */
-	OTG_STATE_B_IDLE,
-	OTG_STATE_B_SRP_INIT,
-	OTG_STATE_B_PERIPHERAL,
+	USB_PHY_STATE_B_IDLE,
+	USB_PHY_STATE_B_SRP_INIT,
+	USB_PHY_STATE_B_PERIPHERAL,
 
 	/* extra dual-role default-b states */
-	OTG_STATE_B_WAIT_ACON,
-	OTG_STATE_B_HOST,
+	USB_PHY_STATE_B_WAIT_ACON,
+	USB_PHY_STATE_B_HOST,
 
 	/* dual-role default-a */
-	OTG_STATE_A_IDLE,
-	OTG_STATE_A_WAIT_VRISE,
-	OTG_STATE_A_WAIT_BCON,
-	OTG_STATE_A_HOST,
-	OTG_STATE_A_SUSPEND,
-	OTG_STATE_A_PERIPHERAL,
-	OTG_STATE_A_WAIT_VFALL,
-	OTG_STATE_A_VBUS_ERR,
+	USB_PHY_STATE_A_IDLE,
+	USB_PHY_STATE_A_WAIT_VRISE,
+	USB_PHY_STATE_A_WAIT_BCON,
+	USB_PHY_STATE_A_HOST,
+	USB_PHY_STATE_A_SUSPEND,
+	USB_PHY_STATE_A_PERIPHERAL,
+	USB_PHY_STATE_A_WAIT_VFALL,
+	USB_PHY_STATE_A_VBUS_ERR,
 };
 
-enum usb_xceiv_events {
+enum usb_phy_events {
 	USB_EVENT_NONE,         /* no events or cable disconnected */
 	USB_EVENT_VBUS,         /* vbus valid event */
 	USB_EVENT_ID,           /* id was grounded */
@@ -65,8 +65,8 @@ struct usb_phy {
 	unsigned int		 flags;
 
 	u8			default_a;
-	enum usb_otg_state	state;
-	enum usb_xceiv_events	last_event;
+	enum usb_phy_state	state;
+	enum usb_phy_events	last_event;
 
 	struct usb_bus		*host;
 	struct usb_gadget	*gadget;
@@ -74,7 +74,7 @@ struct usb_phy {
 	struct otg_io_access_ops	*io_ops;
 	void __iomem			*io_priv;
 
-	/* for notification of usb_xceiv_events */
+	/* for notification of usb_phy_events */
 	struct atomic_notifier_head	notifier;
 
 	/* to pass extra port status to the root hub */
@@ -168,7 +168,7 @@ otg_shutdown(struct usb_phy *x)
 #ifdef CONFIG_USB_OTG_UTILS
 extern struct usb_phy *otg_get_transceiver(void);
 extern void otg_put_transceiver(struct usb_phy *);
-extern const char *otg_state_string(enum usb_otg_state state);
+extern const char *usb_phy_state_string(enum usb_phy_state state);
 #else
 static inline struct usb_phy *otg_get_transceiver(void)
 {
@@ -179,7 +179,7 @@ static inline void otg_put_transceiver(struct usb_phy *x)
 {
 }
 
-static inline const char *otg_state_string(enum usb_otg_state state)
+static inline const char *usb_phy_state_string(enum usb_phy_state state)
 {
 	return NULL;
 }
-- 
1.7.4.1


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

* [PATCHv5 03/19] usb: otg: Separate otg members from usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 01/19] usb: otg: Rename otg_transceiver to usb_phy Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 02/19] usb: otg: Rename usb_otg and usb_xceiv " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 04/19] usb: otg: ab8500: Start using struct usb_otg Heikki Krogerus
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Introducing struct otg and collecting otg specific members
to it from struct usb_phy. There are no changes to
struct usb_phy at this stage. This also renames
transceiver specific functions, and offers aliases for the
old otg ones.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/otg/otg.c   |   18 ++++----
 include/linux/usb/otg.h |   96 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index c6f2bed..5fcc020 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -17,7 +17,7 @@
 static struct usb_phy *xceiv;
 
 /**
- * otg_get_transceiver - find the (single) OTG transceiver
+ * usb_get_transceiver - find the (single) OTG transceiver
  *
  * Returns the transceiver driver, after getting a refcount to it; or
  * null if there is no such transceiver.  The caller is responsible for
@@ -25,45 +25,45 @@ static struct usb_phy *xceiv;
  *
  * For use by USB host and peripheral drivers.
  */
-struct usb_phy *otg_get_transceiver(void)
+struct usb_phy *usb_get_transceiver(void)
 {
 	if (xceiv)
 		get_device(xceiv->dev);
 	return xceiv;
 }
-EXPORT_SYMBOL(otg_get_transceiver);
+EXPORT_SYMBOL(usb_get_transceiver);
 
 /**
- * otg_put_transceiver - release the (single) OTG transceiver
+ * usb_put_transceiver - release the (single) OTG transceiver
  * @x: the transceiver returned by otg_get_transceiver()
  *
  * Releases a refcount the caller received from otg_get_transceiver().
  *
  * For use by USB host and peripheral drivers.
  */
-void otg_put_transceiver(struct usb_phy *x)
+void usb_put_transceiver(struct usb_phy *x)
 {
 	if (x)
 		put_device(x->dev);
 }
-EXPORT_SYMBOL(otg_put_transceiver);
+EXPORT_SYMBOL(usb_put_transceiver);
 
 /**
- * otg_set_transceiver - declare the (single) OTG transceiver
+ * usb_set_transceiver - declare the (single) OTG transceiver
  * @x: the USB OTG transceiver to be used; or NULL
  *
  * This call is exclusively for use by transceiver drivers, which
  * coordinate the activities of drivers for host and peripheral
  * controllers, and in some cases for VBUS current regulation.
  */
-int otg_set_transceiver(struct usb_phy *x)
+int usb_set_transceiver(struct usb_phy *x)
 {
 	if (xceiv && x)
 		return -EBUSY;
 	xceiv = x;
 	return 0;
 }
-EXPORT_SYMBOL(otg_set_transceiver);
+EXPORT_SYMBOL(usb_set_transceiver);
 
 const char *usb_phy_state_string(enum usb_phy_state state)
 {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 926e04c..34dea9b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -48,11 +48,36 @@ struct usb_phy;
 /* for transceivers connected thru an ULPI interface, the user must
  * provide access ops
  */
-struct otg_io_access_ops {
+struct usb_phy_io_ops {
 	int (*read)(struct usb_phy *x, u32 reg);
 	int (*write)(struct usb_phy *x, u32 val, u32 reg);
 };
 
+struct usb_otg {
+	u8			default_a;
+
+	struct usb_phy		*xceiv;
+	struct usb_bus		*host;
+	struct usb_gadget	*gadget;
+
+	/* bind/unbind the host controller */
+	int	(*set_host)(struct usb_otg *otg, struct usb_bus *host);
+
+	/* bind/unbind the peripheral controller */
+	int	(*set_peripheral)(struct usb_otg *otg,
+					struct usb_gadget *gadget);
+
+	/* effective for A-peripheral, ignored for B devices */
+	int	(*set_vbus)(struct usb_otg *otg, bool enabled);
+
+	/* for B devices only:  start session with A-Host */
+	int	(*start_srp)(struct usb_otg *otg);
+
+	/* start or continue HNP role switch */
+	int	(*start_hnp)(struct usb_otg *otg);
+
+};
+
 /*
  * the otg driver needs to interact with both device side and host side
  * usb controllers.  it decides which controller is active at a given
@@ -68,11 +93,13 @@ struct usb_phy {
 	enum usb_phy_state	state;
 	enum usb_phy_events	last_event;
 
+	struct usb_otg		*otg;
+
 	struct usb_bus		*host;
 	struct usb_gadget	*gadget;
 
-	struct otg_io_access_ops	*io_ops;
-	void __iomem			*io_priv;
+	struct usb_phy_io_ops	*io_ops;
+	void __iomem		*io_priv;
 
 	/* for notification of usb_phy_events */
 	struct atomic_notifier_head	notifier;
@@ -115,7 +142,7 @@ struct usb_phy {
 
 
 /* for board-specific init logic */
-extern int otg_set_transceiver(struct usb_phy *);
+extern int usb_set_transceiver(struct usb_phy *);
 
 #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
 /* sometimes transceivers are accessed only through e.g. ULPI */
@@ -132,7 +159,7 @@ static inline void usb_nop_xceiv_unregister(void)
 #endif
 
 /* helpers for direct access thru low-level io interface */
-static inline int otg_io_read(struct usb_phy *x, u32 reg)
+static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
 {
 	if (x->io_ops && x->io_ops->read)
 		return x->io_ops->read(x, reg);
@@ -140,7 +167,7 @@ static inline int otg_io_read(struct usb_phy *x, u32 reg)
 	return -EINVAL;
 }
 
-static inline int otg_io_write(struct usb_phy *x, u32 val, u32 reg)
+static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
 {
 	if (x->io_ops && x->io_ops->write)
 		return x->io_ops->write(x, val, reg);
@@ -149,7 +176,7 @@ static inline int otg_io_write(struct usb_phy *x, u32 val, u32 reg)
 }
 
 static inline int
-otg_init(struct usb_phy *x)
+usb_phy_init(struct usb_phy *x)
 {
 	if (x->init)
 		return x->init(x);
@@ -158,7 +185,7 @@ otg_init(struct usb_phy *x)
 }
 
 static inline void
-otg_shutdown(struct usb_phy *x)
+usb_phy_shutdown(struct usb_phy *x)
 {
 	if (x->shutdown)
 		x->shutdown(x);
@@ -166,16 +193,16 @@ otg_shutdown(struct usb_phy *x)
 
 /* for usb host and peripheral controller drivers */
 #ifdef CONFIG_USB_OTG_UTILS
-extern struct usb_phy *otg_get_transceiver(void);
-extern void otg_put_transceiver(struct usb_phy *);
+extern struct usb_phy *usb_get_transceiver(void);
+extern void usb_put_transceiver(struct usb_phy *);
 extern const char *usb_phy_state_string(enum usb_phy_state state);
 #else
-static inline struct usb_phy *otg_get_transceiver(void)
+static inline struct usb_phy *usb_get_transceiver(void)
 {
 	return NULL;
 }
 
-static inline void otg_put_transceiver(struct usb_phy *x)
+static inline void usb_put_transceiver(struct usb_phy *x)
 {
 }
 
@@ -189,6 +216,9 @@ static inline const char *usb_phy_state_string(enum usb_phy_state state)
 static inline int
 otg_start_hnp(struct usb_phy *x)
 {
+	if (x->otg && x->otg->start_hnp)
+		return x->otg->start_hnp(x->otg);
+
 	return x->start_hnp(x);
 }
 
@@ -196,6 +226,9 @@ otg_start_hnp(struct usb_phy *x)
 static inline int
 otg_set_vbus(struct usb_phy *x, bool enabled)
 {
+	if (x->otg && x->otg->set_vbus)
+		return x->otg->set_vbus(x->otg, enabled);
+
 	return x->set_vbus(x, enabled);
 }
 
@@ -203,6 +236,9 @@ otg_set_vbus(struct usb_phy *x, bool enabled)
 static inline int
 otg_set_host(struct usb_phy *x, struct usb_bus *host)
 {
+	if (x->otg && x->otg->set_host)
+		return x->otg->set_host(x->otg, host);
+
 	return x->set_host(x, host);
 }
 
@@ -212,18 +248,23 @@ otg_set_host(struct usb_phy *x, struct usb_bus *host)
 static inline int
 otg_set_peripheral(struct usb_phy *x, struct usb_gadget *periph)
 {
+	if (x->otg && x->otg->set_peripheral)
+		return x->otg->set_peripheral(x->otg, periph);
+
 	return x->set_peripheral(x, periph);
 }
 
 static inline int
-otg_set_power(struct usb_phy *x, unsigned mA)
+usb_phy_set_power(struct usb_phy *x, unsigned mA)
 {
-	return x->set_power(x, mA);
+	if (x && x->set_power)
+		return x->set_power(x, mA);
+	return 0;
 }
 
 /* Context: can sleep */
 static inline int
-otg_set_suspend(struct usb_phy *x, int suspend)
+usb_phy_set_suspend(struct usb_phy *x, int suspend)
 {
 	if (x->set_suspend != NULL)
 		return x->set_suspend(x, suspend);
@@ -234,18 +275,21 @@ otg_set_suspend(struct usb_phy *x, int suspend)
 static inline int
 otg_start_srp(struct usb_phy *x)
 {
+	if (x->otg && x->otg->start_srp)
+		return x->otg->start_srp(x->otg);
+
 	return x->start_srp(x);
 }
 
 /* notifiers */
 static inline int
-otg_register_notifier(struct usb_phy *x, struct notifier_block *nb)
+usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
 {
 	return atomic_notifier_chain_register(&x->notifier, nb);
 }
 
 static inline void
-otg_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
+usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
 {
 	atomic_notifier_chain_unregister(&x->notifier, nb);
 }
@@ -253,4 +297,22 @@ otg_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
 /* for OTG controller drivers (and maybe other stuff) */
 extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
 
+/* Temporary aliases for transceiver functions */
+#define otg_set_transceiver(x) usb_set_transceiver(x)
+#define otg_get_transceiver() usb_get_transceiver()
+#define otg_put_transceiver(x) usb_put_transceiver(x)
+
+#define otg_io_read(x, a) usb_phy_io_read(x, a)
+#define otg_io_write(x, a, b) usb_phy_io_write(x, a, b)
+
+#define otg_init(x) usb_phy_init(x)
+#define otg_shutdown(x) usb_phy_shutdown(x)
+#define otg_set_power(x, a) usb_phy_set_power(x, a)
+#define otg_set_suspend(x, a) usb_phy_set_suspend(x, a)
+
+#define otg_register_notifier(x, a) usb_register_notifier(x, a)
+#define otg_unregister_notifier(x, a) usb_unregiser_notifier(x, a)
+
+#define otg_io_access_ops usb_phy_io_ops
+
 #endif /* __LINUX_USB_OTG_H */
-- 
1.7.4.1


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

* [PATCHv5 04/19] usb: otg: ab8500: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (2 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 03/19] usb: otg: Separate otg members from usb_phy Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 05/19] usb: otg: fsl: " Heikki Krogerus
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
---
 drivers/usb/otg/ab8500-usb.c |   87 +++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 366c3af..3d659c3 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -68,7 +68,7 @@ enum ab8500_usb_link_status {
 };
 
 struct ab8500_usb {
-	struct usb_phy otg;
+	struct usb_phy xceiv;
 	struct device *dev;
 	int irq_num_id_rise;
 	int irq_num_id_fall;
@@ -84,7 +84,7 @@ struct ab8500_usb {
 
 static inline struct ab8500_usb *xceiv_to_ab(struct usb_phy *x)
 {
-	return container_of(x, struct ab8500_usb, otg);
+	return container_of(x, struct ab8500_usb, xceiv);
 }
 
 static void ab8500_usb_wd_workaround(struct ab8500_usb *ab)
@@ -169,8 +169,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 		/* TODO: Disable regulators. */
 		ab8500_usb_host_phy_dis(ab);
 		ab8500_usb_peri_phy_dis(ab);
-		ab->otg.state = USB_PHY_STATE_B_IDLE;
-		ab->otg.default_a = false;
+		ab->xceiv.state = USB_PHY_STATE_B_IDLE;
+		ab->xceiv.otg->default_a = false;
 		ab->vbus_draw = 0;
 		event = USB_EVENT_NONE;
 		break;
@@ -181,22 +181,22 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 	case USB_LINK_HOST_CHG_NM:
 	case USB_LINK_HOST_CHG_HS:
 	case USB_LINK_HOST_CHG_HS_CHIRP:
-		if (ab->otg.gadget) {
+		if (ab->xceiv.otg->gadget) {
 			/* TODO: Enable regulators. */
 			ab8500_usb_peri_phy_en(ab);
-			v = ab->otg.gadget;
+			v = ab->xceiv.otg->gadget;
 		}
 		event = USB_EVENT_VBUS;
 		break;
 
 	case USB_LINK_HM_IDGND:
-		if (ab->otg.host) {
+		if (ab->xceiv.otg->host) {
 			/* TODO: Enable regulators. */
 			ab8500_usb_host_phy_en(ab);
-			v = ab->otg.host;
+			v = ab->xceiv.otg->host;
 		}
-		ab->otg.state = USB_PHY_STATE_A_IDLE;
-		ab->otg.default_a = true;
+		ab->xceiv.state = USB_PHY_STATE_A_IDLE;
+		ab->xceiv.otg->default_a = true;
 		event = USB_EVENT_ID;
 		break;
 
@@ -212,7 +212,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
 		break;
 	}
 
-	atomic_notifier_call_chain(&ab->otg.notifier, event, v);
+	atomic_notifier_call_chain(&ab->xceiv.notifier, event, v);
 
 	return 0;
 }
@@ -262,27 +262,27 @@ static void ab8500_usb_phy_disable_work(struct work_struct *work)
 	struct ab8500_usb *ab = container_of(work, struct ab8500_usb,
 						phy_dis_work);
 
-	if (!ab->otg.host)
+	if (!ab->xceiv.otg->host)
 		ab8500_usb_host_phy_dis(ab);
 
-	if (!ab->otg.gadget)
+	if (!ab->xceiv.otg->gadget)
 		ab8500_usb_peri_phy_dis(ab);
 }
 
-static int ab8500_usb_set_power(struct usb_phy *otg, unsigned mA)
+static int ab8500_usb_set_power(struct usb_phy *xceiv, unsigned mA)
 {
 	struct ab8500_usb *ab;
 
-	if (!otg)
+	if (!xceiv)
 		return -ENODEV;
 
-	ab = xceiv_to_ab(otg);
+	ab = xceiv_to_ab(xceiv);
 
 	ab->vbus_draw = mA;
 
 	if (mA)
-		atomic_notifier_call_chain(&ab->otg.notifier,
-				USB_EVENT_ENUMERATED, ab->otg.gadget);
+		atomic_notifier_call_chain(&ab->xceiv.notifier,
+				USB_EVENT_ENUMERATED, ab->xceiv.otg->gadget);
 	return 0;
 }
 
@@ -296,15 +296,15 @@ static int ab8500_usb_set_suspend(struct usb_phy *x, int suspend)
 	return 0;
 }
 
-static int ab8500_usb_set_peripheral(struct usb_phy *otg,
-		struct usb_gadget *gadget)
+static int ab8500_usb_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
 	struct ab8500_usb *ab;
 
 	if (!otg)
 		return -ENODEV;
 
-	ab = xceiv_to_ab(otg);
+	ab = xceiv_to_ab(otg->xceiv);
 
 	/* Some drivers call this function in atomic context.
 	 * Do not update ab8500 registers directly till this
@@ -313,11 +313,11 @@ static int ab8500_usb_set_peripheral(struct usb_phy *otg,
 
 	if (!gadget) {
 		/* TODO: Disable regulators. */
-		ab->otg.gadget = NULL;
+		otg->gadget = NULL;
 		schedule_work(&ab->phy_dis_work);
 	} else {
-		ab->otg.gadget = gadget;
-		ab->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->gadget = gadget;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 
 		/* Phy will not be enabled if cable is already
 		 * plugged-in. Schedule to enable phy.
@@ -329,15 +329,14 @@ static int ab8500_usb_set_peripheral(struct usb_phy *otg,
 	return 0;
 }
 
-static int ab8500_usb_set_host(struct usb_phy *otg,
-					struct usb_bus *host)
+static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
 	struct ab8500_usb *ab;
 
 	if (!otg)
 		return -ENODEV;
 
-	ab = xceiv_to_ab(otg);
+	ab = xceiv_to_ab(otg->xceiv);
 
 	/* Some drivers call this function in atomic context.
 	 * Do not update ab8500 registers directly till this
@@ -346,10 +345,10 @@ static int ab8500_usb_set_host(struct usb_phy *otg,
 
 	if (!host) {
 		/* TODO: Disable regulators. */
-		ab->otg.host = NULL;
+		otg->host = NULL;
 		schedule_work(&ab->phy_dis_work);
 	} else {
-		ab->otg.host = host;
+		otg->host = host;
 		/* Phy will not be enabled if cable is already
 		 * plugged-in. Schedule to enable phy.
 		 * Use same delay to avoid any race condition.
@@ -488,19 +487,27 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
 	if (!ab)
 		return -ENOMEM;
 
+	ab->xceiv.otg = kzalloc(sizeof *ab->xceiv.otg, GFP_KERNEL);
+	if (!ab->xceiv.otg) {
+		kfree(ab);
+		return -ENOMEM;
+	}
+
 	ab->dev			= &pdev->dev;
 	ab->rev			= rev;
-	ab->otg.dev		= ab->dev;
-	ab->otg.label		= "ab8500";
-	ab->otg.state		= USB_PHY_STATE_UNDEFINED;
-	ab->otg.set_host	= ab8500_usb_set_host;
-	ab->otg.set_peripheral	= ab8500_usb_set_peripheral;
-	ab->otg.set_suspend	= ab8500_usb_set_suspend;
-	ab->otg.set_power	= ab8500_usb_set_power;
+	ab->xceiv.dev		= ab->dev;
+	ab->xceiv.label		= "ab8500";
+	ab->xceiv.set_suspend	= ab8500_usb_set_suspend;
+	ab->xceiv.set_power	= ab8500_usb_set_power;
+	ab->xceiv.state		= USB_PHY_STATE_UNDEFINED;
+
+	ab->xceiv.otg->xceiv		= &ab->xceiv;
+	ab->xceiv.otg->set_host		= ab8500_usb_set_host;
+	ab->xceiv.otg->set_peripheral	= ab8500_usb_set_peripheral;
 
 	platform_set_drvdata(pdev, ab);
 
-	ATOMIC_INIT_NOTIFIER_HEAD(&ab->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&ab->xceiv.notifier);
 
 	/* v1: Wait for link status to become stable.
 	 * all: Updates form set_host and set_peripheral as they are atomic.
@@ -520,7 +527,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
 	if (err < 0)
 		goto fail0;
 
-	err = otg_set_transceiver(&ab->otg);
+	err = usb_set_transceiver(&ab->xceiv);
 	if (err) {
 		dev_err(&pdev->dev, "Can't register transceiver\n");
 		goto fail1;
@@ -532,6 +539,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
 fail1:
 	ab8500_usb_irq_free(ab);
 fail0:
+	kfree(ab->xceiv.otg);
 	kfree(ab);
 	return err;
 }
@@ -546,13 +554,14 @@ static int __devexit ab8500_usb_remove(struct platform_device *pdev)
 
 	cancel_work_sync(&ab->phy_dis_work);
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 
 	ab8500_usb_host_phy_dis(ab);
 	ab8500_usb_peri_phy_dis(ab);
 
 	platform_set_drvdata(pdev, NULL);
 
+	kfree(ab->xceiv.otg);
 	kfree(ab);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCHv5 05/19] usb: otg: fsl: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (3 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 04/19] usb: otg: ab8500: Start using struct usb_otg Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 06/19] usb: otg: gpio_vbus: " Heikki Krogerus
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Li Yang

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Li Yang <leoli@freescale.com>
---
 drivers/usb/otg/fsl_otg.c |  118 +++++++++++++++++++++++++-------------------
 drivers/usb/otg/fsl_otg.h |    2 +-
 drivers/usb/otg/otg_fsm.c |   22 ++++----
 drivers/usb/otg/otg_fsm.h |    2 +-
 4 files changed, 80 insertions(+), 64 deletions(-)

diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c
index 76125f7..70bb428 100644
--- a/drivers/usb/otg/fsl_otg.c
+++ b/drivers/usb/otg/fsl_otg.c
@@ -275,7 +275,7 @@ void b_srp_end(unsigned long foo)
 	fsl_otg_dischrg_vbus(0);
 	srp_wait_done = 1;
 
-	if ((fsl_otg_dev->otg.state == USB_PHY_STATE_B_SRP_INIT) &&
+	if ((fsl_otg_dev->xceiv.state == USB_PHY_STATE_B_SRP_INIT) &&
 	    fsl_otg_dev->fsm.b_sess_vld)
 		fsl_otg_dev->fsm.b_srp_done = 1;
 }
@@ -288,7 +288,7 @@ void b_srp_end(unsigned long foo)
 void a_wait_enum(unsigned long foo)
 {
 	VDBG("a_wait_enum timeout\n");
-	if (!fsl_otg_dev->otg.host->b_hnp_enable)
+	if (!fsl_otg_dev->xceiv.otg->host->b_hnp_enable)
 		fsl_otg_add_timer(a_wait_enum_tmr);
 	else
 		otg_statemachine(&fsl_otg_dev->fsm);
@@ -452,14 +452,15 @@ void otg_reset_controller(void)
 /* Call suspend/resume routines in host driver */
 int fsl_otg_start_host(struct otg_fsm *fsm, int on)
 {
-	struct usb_phy *xceiv = fsm->transceiver;
+	struct usb_otg *otg = fsm->otg;
 	struct device *dev;
-	struct fsl_otg *otg_dev = container_of(xceiv, struct fsl_otg, otg);
+	struct fsl_otg *otg_dev = container_of(otg->xceiv, struct fsl_otg,
+						xceiv);
 	u32 retval = 0;
 
-	if (!xceiv->host)
+	if (!otg->host)
 		return -ENODEV;
-	dev = xceiv->host->controller;
+	dev = otg->host->controller;
 
 	/*
 	 * Update a_vbus_vld state as a_vbus_vld int is disabled
@@ -518,14 +519,14 @@ end:
  */
 int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
 {
-	struct usb_phy *xceiv = fsm->transceiver;
+	struct usb_otg *otg = fsm->otg;
 	struct device *dev;
 
-	if (!xceiv->gadget || !xceiv->gadget->dev.parent)
+	if (!otg->gadget || !otg->gadget->dev.parent)
 		return -ENODEV;
 
 	VDBG("gadget %s\n", on ? "on" : "off");
-	dev = xceiv->gadget->dev.parent;
+	dev = otg->gadget->dev.parent;
 
 	if (on) {
 		if (dev->driver->resume)
@@ -542,14 +543,15 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
  * Called by initialization code of host driver.  Register host controller
  * to the OTG.  Suspend host for OTG role detection.
  */
-static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
+static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
+	struct fsl_otg *otg_dev = container_of(otg->xceiv, struct fsl_otg,
+						xceiv);
 
-	if (!otg_p || otg_dev != fsl_otg_dev)
+	if (!otg || otg_dev != fsl_otg_dev)
 		return -ENODEV;
 
-	otg_p->host = host;
+	otg->host = host;
 
 	otg_dev->fsm.a_bus_drop = 0;
 	otg_dev->fsm.a_bus_req = 1;
@@ -557,8 +559,8 @@ static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
 	if (host) {
 		VDBG("host off......\n");
 
-		otg_p->host->otg_port = fsl_otg_initdata.otg_port;
-		otg_p->host->is_b_host = otg_dev->fsm.id;
+		otg->host->otg_port = fsl_otg_initdata.otg_port;
+		otg->host->is_b_host = otg_dev->fsm.id;
 		/*
 		 * must leave time for khubd to finish its thing
 		 * before yanking the host driver out from under it,
@@ -574,7 +576,7 @@ static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
 			/* Mini-A cable connected */
 			struct otg_fsm *fsm = &otg_dev->fsm;
 
-			otg_p->state = USB_PHY_STATE_UNDEFINED;
+			otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 			fsm->protocol = PROTO_UNDEF;
 		}
 	}
@@ -587,29 +589,30 @@ static int fsl_otg_set_host(struct usb_phy *otg_p, struct usb_bus *host)
 }
 
 /* Called by initialization code of udc.  Register udc to OTG. */
-static int fsl_otg_set_peripheral(struct usb_phy *otg_p,
-				  struct usb_gadget *gadget)
+static int fsl_otg_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
-	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
+	struct fsl_otg *otg_dev = container_of(otg->xceiv, struct fsl_otg,
+						xceiv);
 
 	VDBG("otg_dev 0x%x\n", (int)otg_dev);
 	VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev);
 
-	if (!otg_p || otg_dev != fsl_otg_dev)
+	if (!otg || otg_dev != fsl_otg_dev)
 		return -ENODEV;
 
 	if (!gadget) {
-		if (!otg_dev->otg.default_a)
-			otg_p->gadget->ops->vbus_draw(otg_p->gadget, 0);
-		usb_gadget_vbus_disconnect(otg_dev->otg.gadget);
-		otg_dev->otg.gadget = 0;
+		if (!otg->default_a)
+			otg->gadget->ops->vbus_draw(otg->gadget, 0);
+		usb_gadget_vbus_disconnect(otg->gadget);
+		otg->gadget = 0;
 		otg_dev->fsm.b_bus_req = 0;
 		otg_statemachine(&otg_dev->fsm);
 		return 0;
 	}
 
-	otg_p->gadget = gadget;
-	otg_p->gadget->is_a_peripheral = !otg_dev->fsm.id;
+	otg->gadget = gadget;
+	otg->gadget->is_a_peripheral = !otg_dev->fsm.id;
 
 	otg_dev->fsm.b_bus_req = 1;
 
@@ -625,11 +628,11 @@ static int fsl_otg_set_peripheral(struct usb_phy *otg_p,
 }
 
 /* Set OTG port power, only for B-device */
-static int fsl_otg_set_power(struct usb_phy *otg_p, unsigned mA)
+static int fsl_otg_set_power(struct usb_phy *xceiv, unsigned mA)
 {
 	if (!fsl_otg_dev)
 		return -ENODEV;
-	if (otg_p->state == USB_PHY_STATE_B_PERIPHERAL)
+	if (xceiv->state == USB_PHY_STATE_B_PERIPHERAL)
 		pr_info("FSL OTG: Draw %d mA\n", mA);
 
 	return 0;
@@ -658,12 +661,13 @@ static void fsl_otg_event(struct work_struct *work)
 }
 
 /* B-device start SRP */
-static int fsl_otg_start_srp(struct usb_phy *otg_p)
+static int fsl_otg_start_srp(struct usb_otg *otg)
 {
-	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
+	struct fsl_otg *otg_dev = container_of(otg->xceiv, struct fsl_otg,
+						xceiv);
 
-	if (!otg_p || otg_dev != fsl_otg_dev
-	    || otg_p->state != USB_PHY_STATE_B_IDLE)
+	if (!otg || otg_dev != fsl_otg_dev
+	    || otg->xceiv->state != USB_PHY_STATE_B_IDLE)
 		return -ENODEV;
 
 	otg_dev->fsm.b_bus_req = 1;
@@ -673,11 +677,12 @@ static int fsl_otg_start_srp(struct usb_phy *otg_p)
 }
 
 /* A_host suspend will call this function to start hnp */
-static int fsl_otg_start_hnp(struct usb_phy *otg_p)
+static int fsl_otg_start_hnp(struct usb_otg *otg)
 {
-	struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg);
+	struct fsl_otg *otg_dev = container_of(otg->xceiv, struct fsl_otg,
+						xceiv);
 
-	if (!otg_p || otg_dev != fsl_otg_dev)
+	if (!otg || otg_dev != fsl_otg_dev)
 		return -ENODEV;
 
 	DBG("start_hnp...n");
@@ -698,7 +703,7 @@ static int fsl_otg_start_hnp(struct usb_phy *otg_p)
 irqreturn_t fsl_otg_isr(int irq, void *dev_id)
 {
 	struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm;
-	struct usb_phy *otg = &((struct fsl_otg *)dev_id)->otg;
+	struct usb_otg *otg = ((struct fsl_otg *)dev_id)->xceiv.otg;
 	u32 otg_int_src, otg_sc;
 
 	otg_sc = fsl_readl(&usb_dr_regs->otgsc);
@@ -774,6 +779,12 @@ static int fsl_otg_conf(struct platform_device *pdev)
 	if (!fsl_otg_tc)
 		return -ENOMEM;
 
+	fsl_otg_tc->xceiv.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!fsl_otg_tc->xceiv.otg) {
+		kfree(fsl_otg_tc);
+		return -ENOMEM;
+	}
+
 	INIT_DELAYED_WORK(&fsl_otg_tc->otg_event, fsl_otg_event);
 
 	INIT_LIST_HEAD(&active_timers);
@@ -788,17 +799,19 @@ static int fsl_otg_conf(struct platform_device *pdev)
 	fsl_otg_tc->fsm.ops = &fsl_otg_ops;
 
 	/* initialize the otg structure */
-	fsl_otg_tc->otg.label = DRIVER_DESC;
-	fsl_otg_tc->otg.set_host = fsl_otg_set_host;
-	fsl_otg_tc->otg.set_peripheral = fsl_otg_set_peripheral;
-	fsl_otg_tc->otg.set_power = fsl_otg_set_power;
-	fsl_otg_tc->otg.start_hnp = fsl_otg_start_hnp;
-	fsl_otg_tc->otg.start_srp = fsl_otg_start_srp;
+	fsl_otg_tc->xceiv.label = DRIVER_DESC;
+	fsl_otg_tc->xceiv.set_power = fsl_otg_set_power;
+
+	fsl_otg_tc->xceiv.otg->xceiv = &fsl_otg_tc->xceiv;
+	fsl_otg_tc->xceiv.otg->set_host = fsl_otg_set_host;
+	fsl_otg_tc->xceiv.otg->set_peripheral = fsl_otg_set_peripheral;
+	fsl_otg_tc->xceiv.otg->start_hnp = fsl_otg_start_hnp;
+	fsl_otg_tc->xceiv.otg->start_srp = fsl_otg_start_srp;
 
 	fsl_otg_dev = fsl_otg_tc;
 
 	/* Store the otg transceiver */
-	status = otg_set_transceiver(&fsl_otg_tc->otg);
+	status = usb_set_transceiver(&fsl_otg_tc->xceiv);
 	if (status) {
 		pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n");
 		goto err;
@@ -807,6 +820,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
 	return 0;
 err:
 	fsl_otg_uninit_timers();
+	kfree(fsl_otg_tc->xceiv.otg);
 	kfree(fsl_otg_tc);
 	return status;
 }
@@ -815,19 +829,19 @@ err:
 int usb_otg_start(struct platform_device *pdev)
 {
 	struct fsl_otg *p_otg;
-	struct usb_phy *otg_trans = otg_get_transceiver();
+	struct usb_phy *otg_trans = usb_get_transceiver();
 	struct otg_fsm *fsm;
 	int status;
 	struct resource *res;
 	u32 temp;
 	struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
 
-	p_otg = container_of(otg_trans, struct fsl_otg, otg);
+	p_otg = container_of(otg_trans, struct fsl_otg, xceiv);
 	fsm = &p_otg->fsm;
 
 	/* Initialize the state machine structure with default values */
 	SET_OTG_STATE(otg_trans, USB_PHY_STATE_UNDEFINED);
-	fsm->transceiver = &p_otg->otg;
+	fsm->otg = p_otg->xceiv.otg;
 
 	/* We don't require predefined MEM/IRQ resource index */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -857,9 +871,10 @@ int usb_otg_start(struct platform_device *pdev)
 	status = request_irq(p_otg->irq, fsl_otg_isr,
 				IRQF_SHARED, driver_name, p_otg);
 	if (status) {
-		dev_dbg(p_otg->otg.dev, "can't get IRQ %d, error %d\n",
+		dev_dbg(p_otg->xceiv.dev, "can't get IRQ %d, error %d\n",
 			p_otg->irq, status);
 		iounmap(p_otg->dr_mem_map);
+		kfree(p_otg->xceiv.otg);
 		kfree(p_otg);
 		return status;
 	}
@@ -919,10 +934,10 @@ int usb_otg_start(struct platform_device *pdev)
 	 * Also: record initial state of ID pin
 	 */
 	if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) {
-		p_otg->otg.state = USB_PHY_STATE_UNDEFINED;
+		p_otg->xceiv.state = USB_PHY_STATE_UNDEFINED;
 		p_otg->fsm.id = 1;
 	} else {
-		p_otg->otg.state = USB_PHY_STATE_A_IDLE;
+		p_otg->xceiv.state = USB_PHY_STATE_A_IDLE;
 		p_otg->fsm.id = 0;
 	}
 
@@ -978,7 +993,7 @@ static int show_fsl_usb2_otg_state(struct device *dev,
 	/* State */
 	t = scnprintf(next, size,
 		      "OTG state: %s\n\n",
-		      usb_phy_state_string(fsl_otg_dev->otg.state));
+		      usb_phy_state_string(fsl_otg_dev->xceiv.state));
 	size -= t;
 	next += t;
 
@@ -1124,12 +1139,13 @@ static int __devexit fsl_otg_remove(struct platform_device *pdev)
 {
 	struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 	free_irq(fsl_otg_dev->irq, fsl_otg_dev);
 
 	iounmap((void *)usb_dr_regs);
 
 	fsl_otg_uninit_timers();
+	kfree(fsl_otg_dev->xceiv.otg);
 	kfree(fsl_otg_dev);
 
 	device_remove_file(&pdev->dev, &dev_attr_fsl_usb2_otg_state);
diff --git a/drivers/usb/otg/fsl_otg.h b/drivers/usb/otg/fsl_otg.h
index 33f3997..a474ae2 100644
--- a/drivers/usb/otg/fsl_otg.h
+++ b/drivers/usb/otg/fsl_otg.h
@@ -369,7 +369,7 @@ inline struct fsl_otg_timer *otg_timer_initializer
 }
 
 struct fsl_otg {
-	struct usb_phy otg;
+	struct usb_phy xceiv;
 	struct otg_fsm fsm;
 	struct usb_dr_mmap *dr_mem_map;
 	struct delayed_work otg_event;
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c
index b2feb07..7d94871 100644
--- a/drivers/usb/otg/otg_fsm.c
+++ b/drivers/usb/otg/otg_fsm.c
@@ -117,10 +117,10 @@ void otg_leave_state(struct otg_fsm *fsm, enum usb_phy_state old_state)
 int otg_set_state(struct otg_fsm *fsm, enum usb_phy_state new_state)
 {
 	state_changed = 1;
-	if (fsm->transceiver->state == new_state)
+	if (fsm->otg->xceiv->state == new_state)
 		return 0;
 	VDBG("Set state: %s\n", usb_phy_state_string(new_state));
-	otg_leave_state(fsm, fsm->transceiver->state);
+	otg_leave_state(fsm, fsm->otg->xceiv->state);
 	switch (new_state) {
 	case USB_PHY_STATE_B_IDLE:
 		otg_drv_vbus(fsm, 0);
@@ -155,8 +155,8 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_phy_state new_state)
 		otg_loc_conn(fsm, 0);
 		otg_loc_sof(fsm, 1);
 		otg_set_protocol(fsm, PROTO_HOST);
-		usb_bus_start_enum(fsm->transceiver->host,
-				fsm->transceiver->host->otg_port);
+		usb_bus_start_enum(fsm->otg->host,
+				fsm->otg->host->otg_port);
 		break;
 	case USB_PHY_STATE_A_IDLE:
 		otg_drv_vbus(fsm, 0);
@@ -221,7 +221,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_phy_state new_state)
 		break;
 	}
 
-	fsm->transceiver->state = new_state;
+	fsm->otg->xceiv->state = new_state;
 	return 0;
 }
 
@@ -233,7 +233,7 @@ int otg_statemachine(struct otg_fsm *fsm)
 
 	spin_lock_irqsave(&fsm->lock, flags);
 
-	state = fsm->transceiver->state;
+	state = fsm->otg->xceiv->state;
 	state_changed = 0;
 	/* State machine state change judgement */
 
@@ -248,7 +248,7 @@ int otg_statemachine(struct otg_fsm *fsm)
 	case USB_PHY_STATE_B_IDLE:
 		if (!fsm->id)
 			otg_set_state(fsm, USB_PHY_STATE_A_IDLE);
-		else if (fsm->b_sess_vld && fsm->transceiver->gadget)
+		else if (fsm->b_sess_vld && fsm->otg->gadget)
 			otg_set_state(fsm, USB_PHY_STATE_B_PERIPHERAL);
 		else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp)
 			otg_set_state(fsm, USB_PHY_STATE_B_SRP_INIT);
@@ -260,7 +260,7 @@ int otg_statemachine(struct otg_fsm *fsm)
 	case USB_PHY_STATE_B_PERIPHERAL:
 		if (!fsm->id || !fsm->b_sess_vld)
 			otg_set_state(fsm, USB_PHY_STATE_B_IDLE);
-		else if (fsm->b_bus_req && fsm->transceiver->
+		else if (fsm->b_bus_req && fsm->otg->
 				gadget->b_hnp_enable && fsm->a_bus_suspend)
 			otg_set_state(fsm, USB_PHY_STATE_B_WAIT_ACON);
 		break;
@@ -302,7 +302,7 @@ int otg_statemachine(struct otg_fsm *fsm)
 		break;
 	case USB_PHY_STATE_A_HOST:
 		if ((!fsm->a_bus_req || fsm->a_suspend_req) &&
-				fsm->transceiver->host->b_hnp_enable)
+				fsm->otg->host->b_hnp_enable)
 			otg_set_state(fsm, USB_PHY_STATE_A_SUSPEND);
 		else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop)
 			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
@@ -310,9 +310,9 @@ int otg_statemachine(struct otg_fsm *fsm)
 			otg_set_state(fsm, USB_PHY_STATE_A_VBUS_ERR);
 		break;
 	case USB_PHY_STATE_A_SUSPEND:
-		if (!fsm->b_conn && fsm->transceiver->host->b_hnp_enable)
+		if (!fsm->b_conn && fsm->otg->host->b_hnp_enable)
 			otg_set_state(fsm, USB_PHY_STATE_A_PERIPHERAL);
-		else if (!fsm->b_conn && !fsm->transceiver->host->b_hnp_enable)
+		else if (!fsm->b_conn && !fsm->otg->host->b_hnp_enable)
 			otg_set_state(fsm, USB_PHY_STATE_A_WAIT_BCON);
 		else if (fsm->a_bus_req || fsm->b_bus_resume)
 			otg_set_state(fsm, USB_PHY_STATE_A_HOST);
diff --git a/drivers/usb/otg/otg_fsm.h b/drivers/usb/otg/otg_fsm.h
index 5e589ae..c30a2e1 100644
--- a/drivers/usb/otg/otg_fsm.h
+++ b/drivers/usb/otg/otg_fsm.h
@@ -82,7 +82,7 @@ struct otg_fsm {
 	int loc_sof;
 
 	struct otg_fsm_ops *ops;
-	struct usb_phy *transceiver;
+	struct usb_otg *otg;
 
 	/* Current usb protocol used: 0:undefine; 1:host; 2:client */
 	int protocol;
-- 
1.7.4.1


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

* [PATCHv5 06/19] usb: otg: gpio_vbus: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (4 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 05/19] usb: otg: fsl: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 07/19] usb: otg: isp1301_omap: " Heikki Krogerus
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Philipp Zabel

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Philipp Zabel <philipp.zabel@gmail.com>
---
 drivers/usb/otg/gpio_vbus.c |   61 +++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 14f48e8..548720c 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -31,7 +31,7 @@
  * Needs to be loaded before the UDC driver that will use it.
  */
 struct gpio_vbus_data {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct device          *dev;
 	struct regulator       *vbus_draw;
 	int			vbus_draw_enabled;
@@ -97,7 +97,7 @@ static void gpio_vbus_work(struct work_struct *work)
 	struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
 	int gpio;
 
-	if (!gpio_vbus->otg.gadget)
+	if (!gpio_vbus->xceiv.otg->gadget)
 		return;
 
 	/* Peripheral controllers which manage the pullup themselves won't have
@@ -107,8 +107,8 @@ static void gpio_vbus_work(struct work_struct *work)
 	 */
 	gpio = pdata->gpio_pullup;
 	if (is_vbus_powered(pdata)) {
-		gpio_vbus->otg.state = USB_PHY_STATE_B_PERIPHERAL;
-		usb_gadget_vbus_connect(gpio_vbus->otg.gadget);
+		gpio_vbus->xceiv.state = USB_PHY_STATE_B_PERIPHERAL;
+		usb_gadget_vbus_connect(gpio_vbus->xceiv.otg->gadget);
 
 		/* drawing a "unit load" is *always* OK, except for OTG */
 		set_vbus_draw(gpio_vbus, 100);
@@ -123,8 +123,8 @@ static void gpio_vbus_work(struct work_struct *work)
 
 		set_vbus_draw(gpio_vbus, 0);
 
-		usb_gadget_vbus_disconnect(gpio_vbus->otg.gadget);
-		gpio_vbus->otg.state = USB_PHY_STATE_B_IDLE;
+		usb_gadget_vbus_disconnect(gpio_vbus->xceiv.otg->gadget);
+		gpio_vbus->xceiv.state = USB_PHY_STATE_B_IDLE;
 	}
 }
 
@@ -134,12 +134,13 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data)
 	struct platform_device *pdev = data;
 	struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data;
 	struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
+	struct usb_otg *otg = gpio_vbus->xceiv.otg;
 
 	dev_dbg(&pdev->dev, "VBUS %s (gadget: %s)\n",
 		is_vbus_powered(pdata) ? "supplied" : "inactive",
-		gpio_vbus->otg.gadget ? gpio_vbus->otg.gadget->name : "none");
+		otg->gadget ? otg->gadget->name : "none");
 
-	if (gpio_vbus->otg.gadget)
+	if (otg->gadget)
 		schedule_work(&gpio_vbus->work);
 
 	return IRQ_HANDLED;
@@ -148,15 +149,15 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data)
 /* OTG transceiver interface */
 
 /* bind/unbind the peripheral controller */
-static int gpio_vbus_set_peripheral(struct usb_phy *otg,
-				struct usb_gadget *gadget)
+static int gpio_vbus_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
 	struct gpio_vbus_data *gpio_vbus;
 	struct gpio_vbus_mach_info *pdata;
 	struct platform_device *pdev;
 	int gpio, irq;
 
-	gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
+	gpio_vbus = container_of(otg->xceiv, struct gpio_vbus_data, xceiv);
 	pdev = to_platform_device(gpio_vbus->dev);
 	pdata = gpio_vbus->dev->platform_data;
 	irq = gpio_to_irq(pdata->gpio_vbus);
@@ -173,7 +174,7 @@ static int gpio_vbus_set_peripheral(struct usb_phy *otg,
 		set_vbus_draw(gpio_vbus, 0);
 
 		usb_gadget_vbus_disconnect(otg->gadget);
-		otg->state = USB_PHY_STATE_UNDEFINED;
+		otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 
 		otg->gadget = NULL;
 		return 0;
@@ -188,23 +189,23 @@ static int gpio_vbus_set_peripheral(struct usb_phy *otg,
 }
 
 /* effective for B devices, ignored for A-peripheral */
-static int gpio_vbus_set_power(struct usb_phy *otg, unsigned mA)
+static int gpio_vbus_set_power(struct usb_phy *xceiv, unsigned mA)
 {
 	struct gpio_vbus_data *gpio_vbus;
 
-	gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
+	gpio_vbus = container_of(xceiv, struct gpio_vbus_data, xceiv);
 
-	if (otg->state == USB_PHY_STATE_B_PERIPHERAL)
+	if (xceiv->state == USB_PHY_STATE_B_PERIPHERAL)
 		set_vbus_draw(gpio_vbus, mA);
 	return 0;
 }
 
 /* for non-OTG B devices: set/clear transceiver suspend mode */
-static int gpio_vbus_set_suspend(struct usb_phy *otg, int suspend)
+static int gpio_vbus_set_suspend(struct usb_phy *xceiv, int suspend)
 {
 	struct gpio_vbus_data *gpio_vbus;
 
-	gpio_vbus = container_of(otg, struct gpio_vbus_data, otg);
+	gpio_vbus = container_of(xceiv, struct gpio_vbus_data, xceiv);
 
 	/* draw max 0 mA from vbus in suspend mode; or the previously
 	 * recorded amount of current if not suspended
@@ -212,7 +213,7 @@ static int gpio_vbus_set_suspend(struct usb_phy *otg, int suspend)
 	 * NOTE: high powered configs (mA > 100) may draw up to 2.5 mA
 	 * if they're wake-enabled ... we don't handle that yet.
 	 */
-	return gpio_vbus_set_power(otg, suspend ? 0 : gpio_vbus->mA);
+	return gpio_vbus_set_power(xceiv, suspend ? 0 : gpio_vbus->mA);
 }
 
 /* platform driver interface */
@@ -232,13 +233,21 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
 	if (!gpio_vbus)
 		return -ENOMEM;
 
+	gpio_vbus->xceiv.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!gpio_vbus->xceiv.otg) {
+		kfree(gpio_vbus);
+		return -ENOMEM;
+	}
+
 	platform_set_drvdata(pdev, gpio_vbus);
 	gpio_vbus->dev = &pdev->dev;
-	gpio_vbus->otg.label = "gpio-vbus";
-	gpio_vbus->otg.state = USB_PHY_STATE_UNDEFINED;
-	gpio_vbus->otg.set_peripheral = gpio_vbus_set_peripheral;
-	gpio_vbus->otg.set_power = gpio_vbus_set_power;
-	gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend;
+	gpio_vbus->xceiv.label = "gpio-vbus";
+	gpio_vbus->xceiv.set_power = gpio_vbus_set_power;
+	gpio_vbus->xceiv.set_suspend = gpio_vbus_set_suspend;
+	gpio_vbus->xceiv.state = USB_PHY_STATE_UNDEFINED;
+
+	gpio_vbus->xceiv.otg->xceiv = &gpio_vbus->xceiv;
+	gpio_vbus->xceiv.otg->set_peripheral = gpio_vbus_set_peripheral;
 
 	err = gpio_request(gpio, "vbus_detect");
 	if (err) {
@@ -287,7 +296,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
 	}
 
 	/* only active when a gadget is registered */
-	err = otg_set_transceiver(&gpio_vbus->otg);
+	err = usb_set_transceiver(&gpio_vbus->xceiv);
 	if (err) {
 		dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
 			err);
@@ -303,6 +312,7 @@ err_irq:
 	gpio_free(pdata->gpio_vbus);
 err_gpio:
 	platform_set_drvdata(pdev, NULL);
+	kfree(gpio_vbus->xceiv.otg);
 	kfree(gpio_vbus);
 	return err;
 }
@@ -315,13 +325,14 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev)
 
 	regulator_put(gpio_vbus->vbus_draw);
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 
 	free_irq(gpio_to_irq(gpio), &pdev->dev);
 	if (gpio_is_valid(pdata->gpio_pullup))
 		gpio_free(pdata->gpio_pullup);
 	gpio_free(gpio);
 	platform_set_drvdata(pdev, NULL);
+	kfree(gpio_vbus->xceiv.otg);
 	kfree(gpio_vbus);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCHv5 07/19] usb: otg: isp1301_omap: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (5 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 06/19] usb: otg: gpio_vbus: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 08/19] usb: otg: msm: " Heikki Krogerus
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/otg/isp1301_omap.c |  236 +++++++++++++++++++++-------------------
 1 files changed, 123 insertions(+), 113 deletions(-)

diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index 175922a..4645970 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -52,7 +52,7 @@ MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
 MODULE_LICENSE("GPL");
 
 struct isp1301 {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct i2c_client	*client;
 	void			(*i2c_release)(struct device *dev);
 
@@ -236,7 +236,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits)
 
 static inline const char *state_name(struct isp1301 *isp)
 {
-	return usb_phy_state_string(isp->otg.state);
+	return usb_phy_state_string(isp->xceiv.state);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -251,7 +251,7 @@ static inline const char *state_name(struct isp1301 *isp)
 
 static void power_down(struct isp1301 *isp)
 {
-	isp->otg.state = USB_PHY_STATE_UNDEFINED;
+	isp->xceiv.state = USB_PHY_STATE_UNDEFINED;
 
 	// isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
 	isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
@@ -280,13 +280,13 @@ static int host_suspend(struct isp1301 *isp)
 #else
 	struct device	*dev;
 
-	if (!isp->otg.host)
+	if (!isp->xceiv.otg->host)
 		return -ENODEV;
 
 	/* Currently ASSUMES only the OTG port matters;
 	 * other ports could be active...
 	 */
-	dev = isp->otg.host->controller;
+	dev = isp->xceiv.otg->host->controller;
 	return dev->driver->suspend(dev, 3, 0);
 #endif
 }
@@ -298,20 +298,20 @@ static int host_resume(struct isp1301 *isp)
 #else
 	struct device	*dev;
 
-	if (!isp->otg.host)
+	if (!isp->xceiv.otg->host)
 		return -ENODEV;
 
-	dev = isp->otg.host->controller;
+	dev = isp->xceiv.otg->host->controller;
 	return dev->driver->resume(dev, 0);
 #endif
 }
 
 static int gadget_suspend(struct isp1301 *isp)
 {
-	isp->otg.gadget->b_hnp_enable = 0;
-	isp->otg.gadget->a_hnp_support = 0;
-	isp->otg.gadget->a_alt_hnp_support = 0;
-	return usb_gadget_vbus_disconnect(isp->otg.gadget);
+	isp->xceiv.otg->gadget->b_hnp_enable = 0;
+	isp->xceiv.otg->gadget->a_hnp_support = 0;
+	isp->xceiv.otg->gadget->a_alt_hnp_support = 0;
+	return usb_gadget_vbus_disconnect(isp->xceiv.otg->gadget);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -341,19 +341,19 @@ static void a_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == USB_PHY_STATE_A_IDLE)
+	if (isp->xceiv.state == USB_PHY_STATE_A_IDLE)
 		return;
 
-	isp->otg.default_a = 1;
-	if (isp->otg.host) {
-		isp->otg.host->is_b_host = 0;
+	isp->xceiv.otg->default_a = 1;
+	if (isp->xceiv.otg->host) {
+		isp->xceiv.otg->host->is_b_host = 0;
 		host_suspend(isp);
 	}
-	if (isp->otg.gadget) {
-		isp->otg.gadget->is_a_peripheral = 1;
+	if (isp->xceiv.otg->gadget) {
+		isp->xceiv.otg->gadget->is_a_peripheral = 1;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = USB_PHY_STATE_A_IDLE;
+	isp->xceiv.state = USB_PHY_STATE_A_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -365,19 +365,19 @@ static void b_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == USB_PHY_STATE_B_IDLE)
+	if (isp->xceiv.state == USB_PHY_STATE_B_IDLE)
 		return;
 
-	isp->otg.default_a = 0;
-	if (isp->otg.host) {
-		isp->otg.host->is_b_host = 1;
+	isp->xceiv.otg->default_a = 0;
+	if (isp->xceiv.otg->host) {
+		isp->xceiv.otg->host->is_b_host = 1;
 		host_suspend(isp);
 	}
-	if (isp->otg.gadget) {
-		isp->otg.gadget->is_a_peripheral = 0;
+	if (isp->xceiv.otg->gadget) {
+		isp->xceiv.otg->gadget->is_a_peripheral = 0;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = USB_PHY_STATE_B_IDLE;
+	isp->xceiv.state = USB_PHY_STATE_B_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -478,7 +478,7 @@ static void check_state(struct isp1301 *isp, const char *tag)
 	default:
 		break;
 	}
-	if (isp->otg.state == state && !extra)
+	if (isp->xceiv.state == state && !extra)
 		return;
 	pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
 		usb_phy_state_string(state), fsm, state_name(isp),
@@ -502,22 +502,23 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
 
 	if (int_src & INTR_SESS_VLD)
 		otg_ctrl |= OTG_ASESSVLD;
-	else if (isp->otg.state == USB_PHY_STATE_A_WAIT_VFALL) {
+	else if (isp->xceiv.state == USB_PHY_STATE_A_WAIT_VFALL) {
 		a_idle(isp, "vfall");
 		otg_ctrl &= ~OTG_CTRL_BITS;
 	}
 	if (int_src & INTR_VBUS_VLD)
 		otg_ctrl |= OTG_VBUSVLD;
 	if (int_src & INTR_ID_GND) {		/* default-A */
-		if (isp->otg.state == USB_PHY_STATE_B_IDLE
-				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
+		if (isp->xceiv.state == USB_PHY_STATE_B_IDLE
+				|| isp->xceiv.state
+					== USB_PHY_STATE_UNDEFINED) {
 			a_idle(isp, "init");
 			return;
 		}
 	} else {				/* default-B */
 		otg_ctrl |= OTG_ID;
-		if (isp->otg.state == USB_PHY_STATE_A_IDLE
-				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
+		if (isp->xceiv.state == USB_PHY_STATE_A_IDLE
+			|| isp->xceiv.state == USB_PHY_STATE_UNDEFINED) {
 			b_idle(isp, "init");
 			return;
 		}
@@ -551,14 +552,14 @@ static void otg_update_isp(struct isp1301 *isp)
 	isp->last_otg_ctrl = otg_ctrl;
 	otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
 
-	switch (isp->otg.state) {
+	switch (isp->xceiv.state) {
 	case USB_PHY_STATE_B_IDLE:
 	case USB_PHY_STATE_B_PERIPHERAL:
 	case USB_PHY_STATE_B_SRP_INIT:
 		if (!(otg_ctrl & OTG_PULLUP)) {
 			// if (otg_ctrl & OTG_B_HNPEN) {
-			if (isp->otg.gadget->b_hnp_enable) {
-				isp->otg.state = USB_PHY_STATE_B_WAIT_ACON;
+			if (isp->xceiv.otg->gadget->b_hnp_enable) {
+				isp->xceiv.state = USB_PHY_STATE_B_WAIT_ACON;
 				pr_debug("  --> b_wait_acon\n");
 			}
 			goto pulldown;
@@ -585,10 +586,10 @@ pulldown:
 		else clr |= ISP; \
 		} while (0)
 
-	if (!(isp->otg.host))
+	if (!(isp->xceiv.otg->host))
 		otg_ctrl &= ~OTG_DRV_VBUS;
 
-	switch (isp->otg.state) {
+	switch (isp->xceiv.state) {
 	case USB_PHY_STATE_A_SUSPEND:
 		if (otg_ctrl & OTG_DRV_VBUS) {
 			set |= OTG1_VBUS_DRV;
@@ -599,7 +600,7 @@ pulldown:
 
 		/* FALLTHROUGH */
 	case USB_PHY_STATE_A_VBUS_ERR:
-		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+		isp->xceiv.state = USB_PHY_STATE_A_WAIT_VFALL;
 		pr_debug("  --> a_wait_vfall\n");
 		/* FALLTHROUGH */
 	case USB_PHY_STATE_A_WAIT_VFALL:
@@ -608,7 +609,7 @@ pulldown:
 		break;
 	case USB_PHY_STATE_A_IDLE:
 		if (otg_ctrl & OTG_DRV_VBUS) {
-			isp->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
+			isp->xceiv.state = USB_PHY_STATE_A_WAIT_VRISE;
 			pr_debug("  --> a_wait_vrise\n");
 		}
 		/* FALLTHROUGH */
@@ -628,17 +629,17 @@ pulldown:
 	if (otg_change & OTG_PULLUP) {
 		u32 l;
 
-		switch (isp->otg.state) {
+		switch (isp->xceiv.state) {
 		case USB_PHY_STATE_B_IDLE:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+			isp->xceiv.state = USB_PHY_STATE_B_PERIPHERAL;
 			pr_debug("  --> b_peripheral\n");
 			break;
 		case USB_PHY_STATE_A_SUSPEND:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = USB_PHY_STATE_A_PERIPHERAL;
+			isp->xceiv.state = USB_PHY_STATE_A_PERIPHERAL;
 			pr_debug("  --> a_peripheral\n");
 			break;
 		default:
@@ -659,6 +660,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 	u32		otg_ctrl;
 	int		ret = IRQ_NONE;
 	struct isp1301	*isp = _isp;
+	struct usb_otg	*otg = isp->xceiv.otg;
 
 	/* update ISP1301 transceiver from OTG controller */
 	if (otg_irq & OPRT_CHG) {
@@ -675,7 +677,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		 * remote wakeup (SRP, normal) using their own timer
 		 * to give "check cable and A-device" messages.
 		 */
-		if (isp->otg.state == USB_PHY_STATE_B_SRP_INIT)
+		if (isp->xceiv.state == USB_PHY_STATE_B_SRP_INIT)
 			b_idle(isp, "srp_timeout");
 
 		omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
@@ -693,7 +695,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		omap_writel(otg_ctrl, OTG_CTRL);
 
 		/* subset of b_peripheral()... */
-		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+		isp->xceiv.state = USB_PHY_STATE_B_PERIPHERAL;
 		pr_debug("  --> b_peripheral\n");
 
 		omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
@@ -705,9 +707,9 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 				state_name(isp), omap_readl(OTG_CTRL));
 
 		isp1301_defer_work(isp, WORK_UPDATE_OTG);
-		switch (isp->otg.state) {
+		switch (isp->xceiv.state) {
 		case USB_PHY_STATE_A_IDLE:
-			if (!isp->otg.host)
+			if (!otg->host)
 				break;
 			isp1301_defer_work(isp, WORK_HOST_RESUME);
 			otg_ctrl = omap_readl(OTG_CTRL);
@@ -736,7 +738,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+		isp->xceiv.state = USB_PHY_STATE_A_WAIT_VFALL;
 
 		omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -750,7 +752,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+		isp->xceiv.state = USB_PHY_STATE_A_VBUS_ERR;
 
 		omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -771,7 +773,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 
 		/* role is peripheral */
 		if (otg_ctrl & OTG_DRIVER_SEL) {
-			switch (isp->otg.state) {
+			switch (isp->xceiv.state) {
 			case USB_PHY_STATE_A_IDLE:
 				b_idle(isp, __func__);
 				break;
@@ -787,20 +789,20 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 				omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL);
 			}
 
-			if (isp->otg.host) {
-				switch (isp->otg.state) {
+			if (otg->host) {
+				switch (isp->xceiv.state) {
 				case USB_PHY_STATE_B_WAIT_ACON:
-					isp->otg.state = USB_PHY_STATE_B_HOST;
+					isp->xceiv.state = USB_PHY_STATE_B_HOST;
 					pr_debug("  --> b_host\n");
 					kick = 1;
 					break;
 				case USB_PHY_STATE_A_WAIT_BCON:
-					isp->otg.state = USB_PHY_STATE_A_HOST;
+					isp->xceiv.state = USB_PHY_STATE_A_HOST;
 					pr_debug("  --> a_host\n");
 					break;
 				case USB_PHY_STATE_A_PERIPHERAL:
-					isp->otg.state =
-						USB_PHY_STATE_A_WAIT_BCON;
+					isp->xceiv.state
+						= USB_PHY_STATE_A_WAIT_BCON;
 					pr_debug("  --> a_wait_bcon\n");
 					break;
 				default:
@@ -814,8 +816,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		ret = IRQ_HANDLED;
 
 		if (kick)
-			usb_bus_start_enum(isp->otg.host,
-						isp->otg.host->otg_port);
+			usb_bus_start_enum(otg->host, otg->host->otg_port);
 	}
 
 	check_state(isp, __func__);
@@ -931,7 +932,7 @@ static void b_peripheral(struct isp1301 *isp)
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 
-	usb_gadget_vbus_connect(isp->otg.gadget);
+	usb_gadget_vbus_connect(isp->xceiv.otg->gadget);
 
 #ifdef	CONFIG_USB_OTG
 	enable_vbus_draw(isp, 8);
@@ -941,7 +942,7 @@ static void b_peripheral(struct isp1301 *isp)
 	/* UDC driver just set OTG_BSESSVLD */
 	isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
 	isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
-	isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+	isp->xceiv.state = USB_PHY_STATE_B_PERIPHERAL;
 	pr_debug("  --> b_peripheral\n");
 	dump_regs(isp, "2periph");
 #endif
@@ -949,8 +950,9 @@ static void b_peripheral(struct isp1301 *isp)
 
 static void isp_update_otg(struct isp1301 *isp, u8 stat)
 {
+	struct usb_otg		*otg = isp->xceiv.otg;
 	u8			isp_stat, isp_bstat;
-	enum usb_phy_state	state = isp->otg.state;
+	enum usb_phy_state	state = isp->xceiv.state;
 
 	if (stat & INTR_BDIS_ACON)
 		pr_debug("OTG:  BDIS_ACON, %s\n", state_name(isp));
@@ -958,7 +960,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 	/* start certain state transitions right away */
 	isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE);
 	if (isp_stat & INTR_ID_GND) {
-		if (isp->otg.default_a) {
+		if (otg->default_a) {
 			switch (state) {
 			case USB_PHY_STATE_B_IDLE:
 				a_idle(isp, "idle");
@@ -973,7 +975,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				 * when HNP is used.
 				 */
 				if (isp_stat & INTR_VBUS_VLD)
-					isp->otg.state = USB_PHY_STATE_A_HOST;
+					isp->xceiv.state = USB_PHY_STATE_A_HOST;
 				break;
 			case USB_PHY_STATE_A_WAIT_VFALL:
 				if (!(isp_stat & INTR_SESS_VLD))
@@ -981,8 +983,8 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				break;
 			default:
 				if (!(isp_stat & INTR_VBUS_VLD))
-					isp->otg.state =
-						USB_PHY_STATE_A_VBUS_ERR;
+					isp->xceiv.state
+						= USB_PHY_STATE_A_VBUS_ERR;
 				break;
 			}
 			isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
@@ -991,14 +993,14 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			case USB_PHY_STATE_B_PERIPHERAL:
 			case USB_PHY_STATE_B_HOST:
 			case USB_PHY_STATE_B_WAIT_ACON:
-				usb_gadget_vbus_disconnect(isp->otg.gadget);
+				usb_gadget_vbus_disconnect(otg->gadget);
 				break;
 			default:
 				break;
 			}
 			if (state != USB_PHY_STATE_A_IDLE)
 				a_idle(isp, "id");
-			if (isp->otg.host && state == USB_PHY_STATE_A_IDLE)
+			if (otg->host && state == USB_PHY_STATE_A_IDLE)
 				isp1301_defer_work(isp, WORK_HOST_RESUME);
 			isp_bstat = 0;
 		}
@@ -1008,10 +1010,10 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		/* if user unplugged mini-A end of cable,
 		 * don't bypass A_WAIT_VFALL.
 		 */
-		if (isp->otg.default_a) {
+		if (otg->default_a) {
 			switch (state) {
 			default:
-				isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+				isp->xceiv.state = USB_PHY_STATE_A_WAIT_VFALL;
 				break;
 			case USB_PHY_STATE_A_WAIT_VFALL:
 				state = USB_PHY_STATE_A_IDLE;
@@ -1024,7 +1026,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				host_suspend(isp);
 				isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
 						MC1_BDIS_ACON_EN);
-				isp->otg.state = USB_PHY_STATE_B_IDLE;
+				isp->xceiv.state = USB_PHY_STATE_B_IDLE;
 				l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
 				l &= ~OTG_CTRL_BITS;
 				omap_writel(l, OTG_CTRL);
@@ -1035,7 +1037,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		}
 		isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
 
-		switch (isp->otg.state) {
+		switch (isp->xceiv.state) {
 		case USB_PHY_STATE_B_PERIPHERAL:
 		case USB_PHY_STATE_B_WAIT_ACON:
 		case USB_PHY_STATE_B_HOST:
@@ -1057,7 +1059,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			omap_writel(l, OTG_CTRL);
 			/* FALLTHROUGH */
 		case USB_PHY_STATE_B_IDLE:
-			if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) {
+			if (otg->gadget && (isp_bstat & OTG_B_SESS_VLD)) {
 #ifdef	CONFIG_USB_OTG
 				update_otg1(isp, isp_stat);
 				update_otg2(isp, isp_bstat);
@@ -1075,7 +1077,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		}
 	}
 
-	if (state != isp->otg.state)
+	if (state != isp->xceiv.state)
 		pr_debug("  isp, %s -> %s\n",
 				usb_phy_state_string(state), state_name(isp));
 
@@ -1133,10 +1135,10 @@ isp1301_work(struct work_struct *work)
 			 * skip A_WAIT_VRISE; hc transitions invisibly
 			 * skip A_WAIT_BCON; same.
 			 */
-			switch (isp->otg.state) {
+			switch (isp->xceiv.state) {
 			case USB_PHY_STATE_A_WAIT_BCON:
 			case USB_PHY_STATE_A_WAIT_VRISE:
-				isp->otg.state = USB_PHY_STATE_A_HOST;
+				isp->xceiv.state = USB_PHY_STATE_A_HOST;
 				pr_debug("  --> a_host\n");
 				otg_ctrl = omap_readl(OTG_CTRL);
 				otg_ctrl |= OTG_A_BUSREQ;
@@ -1145,7 +1147,7 @@ isp1301_work(struct work_struct *work)
 				omap_writel(otg_ctrl, OTG_CTRL);
 				break;
 			case USB_PHY_STATE_B_WAIT_ACON:
-				isp->otg.state = USB_PHY_STATE_B_HOST;
+				isp->xceiv.state = USB_PHY_STATE_B_HOST;
 				pr_debug("  --> b_host (acon)\n");
 				break;
 			case USB_PHY_STATE_B_HOST:
@@ -1206,6 +1208,7 @@ static void isp1301_release(struct device *dev)
 	/* ugly -- i2c hijacks our memory hook to wait_for_completion() */
 	if (isp->i2c_release)
 		isp->i2c_release(dev);
+	kfree(isp->xceiv.otg);
 	kfree (isp);
 }
 
@@ -1276,9 +1279,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
 
 /* add or disable the host device+driver */
 static int
-isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
+isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg->xceiv, struct isp1301, xceiv);
 
 	if (!otg || isp != the_transceiver)
 		return -ENODEV;
@@ -1286,21 +1289,21 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
 	if (!host) {
 		omap_writew(0, OTG_IRQ_EN);
 		power_down(isp);
-		isp->otg.host = NULL;
+		otg->host = NULL;
 		return 0;
 	}
 
 #ifdef	CONFIG_USB_OTG
-	isp->otg.host = host;
+	otg->host = host;
 	dev_dbg(&isp->client->dev, "registered host\n");
 	host_suspend(isp);
-	if (isp->otg.gadget)
+	if (otg->gadget)
 		return isp1301_otg_enable(isp);
 	return 0;
 
 #elif	!defined(CONFIG_USB_GADGET_OMAP)
 	// FIXME update its refcount
-	isp->otg.host = host;
+	otg->host = host;
 
 	power_up(isp);
 
@@ -1332,9 +1335,9 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
 }
 
 static int
-isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
+isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 {
-	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg->xceiv, struct isp1301, xceiv);
 #ifndef	CONFIG_USB_OTG
 	u32 l;
 #endif
@@ -1344,24 +1347,24 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 
 	if (!gadget) {
 		omap_writew(0, OTG_IRQ_EN);
-		if (!isp->otg.default_a)
+		if (!otg->default_a)
 			enable_vbus_draw(isp, 0);
-		usb_gadget_vbus_disconnect(isp->otg.gadget);
-		isp->otg.gadget = NULL;
+		usb_gadget_vbus_disconnect(otg->gadget);
+		otg->gadget = NULL;
 		power_down(isp);
 		return 0;
 	}
 
 #ifdef	CONFIG_USB_OTG
-	isp->otg.gadget = gadget;
+	otg->gadget = gadget;
 	dev_dbg(&isp->client->dev, "registered gadget\n");
 	/* gadget driver may be suspended until vbus_connect () */
-	if (isp->otg.host)
+	if (otg->host)
 		return isp1301_otg_enable(isp);
 	return 0;
 
 #elif	!defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE)
-	isp->otg.gadget = gadget;
+	otg->gadget = gadget;
 	// FIXME update its refcount
 
 	l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
@@ -1370,7 +1373,7 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 	omap_writel(l, OTG_CTRL);
 
 	power_up(isp);
-	isp->otg.state = USB_PHY_STATE_B_IDLE;
+	isp->xceiv.state = USB_PHY_STATE_B_IDLE;
 
 	if (machine_is_omap_h2() || machine_is_omap_h3())
 		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
@@ -1411,13 +1414,13 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
 }
 
 static int
-isp1301_start_srp(struct usb_phy *dev)
+isp1301_start_srp(struct usb_otg *otg)
 {
-	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg->xceiv, struct isp1301, xceiv);
 	u32		otg_ctrl;
 
-	if (!dev || isp != the_transceiver
-			|| isp->otg.state != USB_PHY_STATE_B_IDLE)
+	if (!otg || isp != the_transceiver
+			|| isp->xceiv.state != USB_PHY_STATE_B_IDLE)
 		return -ENODEV;
 
 	otg_ctrl = omap_readl(OTG_CTRL);
@@ -1427,7 +1430,7 @@ isp1301_start_srp(struct usb_phy *dev)
 	otg_ctrl |= OTG_B_BUSREQ;
 	otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
 	omap_writel(otg_ctrl, OTG_CTRL);
-	isp->otg.state = USB_PHY_STATE_B_SRP_INIT;
+	isp->xceiv.state = USB_PHY_STATE_B_SRP_INIT;
 
 	pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
 			omap_readl(OTG_CTRL));
@@ -1438,27 +1441,26 @@ isp1301_start_srp(struct usb_phy *dev)
 }
 
 static int
-isp1301_start_hnp(struct usb_phy *dev)
+isp1301_start_hnp(struct usb_otg *otg)
 {
 #ifdef	CONFIG_USB_OTG
-	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg->xceiv, struct isp1301, xceiv);
 	u32 l;
 
-	if (!dev || isp != the_transceiver)
+	if (!otg || isp != the_transceiver)
 		return -ENODEV;
-	if (isp->otg.default_a && (isp->otg.host == NULL
-			|| !isp->otg.host->b_hnp_enable))
+	if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
 		return -ENOTCONN;
-	if (!isp->otg.default_a && (isp->otg.gadget == NULL
-			|| !isp->otg.gadget->b_hnp_enable))
+	if (!otg->default_a && (otg->gadget == NULL
+			|| !otg->gadget->b_hnp_enable))
 		return -ENOTCONN;
 
 	/* We want hardware to manage most HNP protocol timings.
 	 * So do this part as early as possible...
 	 */
-	switch (isp->otg.state) {
+	switch (isp->xceiv.state) {
 	case USB_PHY_STATE_B_HOST:
-		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+		isp->xceiv.state = USB_PHY_STATE_B_PERIPHERAL;
 		/* caller will suspend next */
 		break;
 	case USB_PHY_STATE_A_HOST:
@@ -1468,7 +1470,7 @@ isp1301_start_hnp(struct usb_phy *dev)
 				MC1_BDIS_ACON_EN);
 #endif
 		/* caller must suspend then clear A_BUSREQ */
-		usb_gadget_vbus_connect(isp->otg.gadget);
+		usb_gadget_vbus_connect(otg->gadget);
 		l = omap_readl(OTG_CTRL);
 		l |= OTG_A_SETB_HNPEN;
 		omap_writel(l, OTG_CTRL);
@@ -1505,6 +1507,12 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	if (!isp)
 		return 0;
 
+	isp->xceiv.otg = kzalloc(sizeof *isp->xceiv.otg, GFP_KERNEL);
+	if (!isp->xceiv.otg) {
+		kfree(isp);
+		return 0;
+	}
+
 	INIT_WORK(&isp->work, isp1301_work);
 	init_timer(&isp->timer);
 	isp->timer.function = isp1301_timer;
@@ -1578,14 +1586,15 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 		goto fail;
 	}
 
-	isp->otg.dev = &i2c->dev;
-	isp->otg.label = DRIVER_NAME;
+	isp->xceiv.dev = &i2c->dev;
+	isp->xceiv.label = DRIVER_NAME;
+	isp->xceiv.set_power = isp1301_set_power,
 
-	isp->otg.set_host = isp1301_set_host,
-	isp->otg.set_peripheral = isp1301_set_peripheral,
-	isp->otg.set_power = isp1301_set_power,
-	isp->otg.start_srp = isp1301_start_srp,
-	isp->otg.start_hnp = isp1301_start_hnp,
+	isp->xceiv.otg->xceiv = &isp->xceiv;
+	isp->xceiv.otg->set_host = isp1301_set_host,
+	isp->xceiv.otg->set_peripheral = isp1301_set_peripheral,
+	isp->xceiv.otg->start_srp = isp1301_start_srp,
+	isp->xceiv.otg->start_hnp = isp1301_start_hnp,
 
 	enable_vbus_draw(isp, 0);
 	power_down(isp);
@@ -1603,7 +1612,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES);
 #endif
 
-	status = otg_set_transceiver(&isp->otg);
+	status = usb_set_transceiver(&isp->xceiv);
 	if (status < 0)
 		dev_err(&i2c->dev, "can't register transceiver, %d\n",
 			status);
@@ -1611,6 +1620,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	return 0;
 
 fail:
+	kfree(isp->xceiv.otg);
 	kfree(isp);
 	return -ENODEV;
 }
@@ -1641,7 +1651,7 @@ subsys_initcall(isp_init);
 static void __exit isp_exit(void)
 {
 	if (the_transceiver)
-		otg_set_transceiver(NULL);
+		usb_set_transceiver(NULL);
 	i2c_del_driver(&isp1301_driver);
 }
 module_exit(isp_exit);
-- 
1.7.4.1


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

* [PATCHv5 08/19] usb: otg: msm: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (6 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 07/19] usb: otg: isp1301_omap: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 09/19] usb: otg: langwell: " Heikki Krogerus
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Pavankumar Kondeti

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
---
 drivers/usb/otg/msm_otg.c     |  398 +++++++++++++++++++++--------------------
 include/linux/usb/msm_hsusb.h |    2 +-
 2 files changed, 206 insertions(+), 194 deletions(-)

diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index c468db6..eb1e34c 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -69,9 +69,9 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 	int ret = 0;
 
 	if (init) {
-		hsusb_vddcx = regulator_get(motg->otg.dev, "HSUSB_VDDCX");
+		hsusb_vddcx = regulator_get(motg->xceiv.dev, "HSUSB_VDDCX");
 		if (IS_ERR(hsusb_vddcx)) {
-			dev_err(motg->otg.dev, "unable to get hsusb vddcx\n");
+			dev_err(motg->xceiv.dev, "unable to get hsusb vddcx\n");
 			return PTR_ERR(hsusb_vddcx);
 		}
 
@@ -79,7 +79,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
-			dev_err(motg->otg.dev, "unable to set the voltage "
+			dev_err(motg->xceiv.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
 			regulator_put(hsusb_vddcx);
 			return ret;
@@ -87,18 +87,18 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 
 		ret = regulator_enable(hsusb_vddcx);
 		if (ret) {
-			dev_err(motg->otg.dev, "unable to enable hsusb vddcx\n");
+			dev_err(motg->xceiv.dev, "unable to enable hsusb vddcx\n");
 			regulator_put(hsusb_vddcx);
 		}
 	} else {
 		ret = regulator_set_voltage(hsusb_vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret)
-			dev_err(motg->otg.dev, "unable to set the voltage "
+			dev_err(motg->xceiv.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
 		ret = regulator_disable(hsusb_vddcx);
 		if (ret)
-			dev_err(motg->otg.dev, "unable to disable hsusb vddcx\n");
+			dev_err(motg->xceiv.dev, "unable to disable hsusb vddcx\n");
 
 		regulator_put(hsusb_vddcx);
 	}
@@ -111,40 +111,40 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 	int rc = 0;
 
 	if (init) {
-		hsusb_3p3 = regulator_get(motg->otg.dev, "HSUSB_3p3");
+		hsusb_3p3 = regulator_get(motg->xceiv.dev, "HSUSB_3p3");
 		if (IS_ERR(hsusb_3p3)) {
-			dev_err(motg->otg.dev, "unable to get hsusb 3p3\n");
+			dev_err(motg->xceiv.dev, "unable to get hsusb 3p3\n");
 			return PTR_ERR(hsusb_3p3);
 		}
 
 		rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
-			dev_err(motg->otg.dev, "unable to set voltage level "
+			dev_err(motg->xceiv.dev, "unable to set voltage level "
 					"for hsusb 3p3\n");
 			goto put_3p3;
 		}
 		rc = regulator_enable(hsusb_3p3);
 		if (rc) {
-			dev_err(motg->otg.dev, "unable to enable the hsusb 3p3\n");
+			dev_err(motg->xceiv.dev, "unable to enable the hsusb 3p3\n");
 			goto put_3p3;
 		}
-		hsusb_1p8 = regulator_get(motg->otg.dev, "HSUSB_1p8");
+		hsusb_1p8 = regulator_get(motg->xceiv.dev, "HSUSB_1p8");
 		if (IS_ERR(hsusb_1p8)) {
-			dev_err(motg->otg.dev, "unable to get hsusb 1p8\n");
+			dev_err(motg->xceiv.dev, "unable to get hsusb 1p8\n");
 			rc = PTR_ERR(hsusb_1p8);
 			goto disable_3p3;
 		}
 		rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
-			dev_err(motg->otg.dev, "unable to set voltage level "
+			dev_err(motg->xceiv.dev, "unable to set voltage level "
 					"for hsusb 1p8\n");
 			goto put_1p8;
 		}
 		rc = regulator_enable(hsusb_1p8);
 		if (rc) {
-			dev_err(motg->otg.dev, "unable to enable the hsusb 1p8\n");
+			dev_err(motg->xceiv.dev, "unable to enable the hsusb 1p8\n");
 			goto put_1p8;
 		}
 
@@ -235,9 +235,9 @@ static int msm_hsusb_ldo_set_mode(int on)
 	return ret < 0 ? ret : 0;
 }
 
-static int ulpi_read(struct usb_phy *otg, u32 reg)
+static int ulpi_read(struct usb_phy *xceiv, u32 reg)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 	int cnt = 0;
 
 	/* initiate read operation */
@@ -253,16 +253,16 @@ static int ulpi_read(struct usb_phy *otg, u32 reg)
 	}
 
 	if (cnt >= ULPI_IO_TIMEOUT_USEC) {
-		dev_err(otg->dev, "ulpi_read: timeout %08x\n",
+		dev_err(xceiv->dev, "ulpi_read: timeout %08x\n",
 			readl(USB_ULPI_VIEWPORT));
 		return -ETIMEDOUT;
 	}
 	return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT));
 }
 
-static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
+static int ulpi_write(struct usb_phy *xceiv, u32 val, u32 reg)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 	int cnt = 0;
 
 	/* initiate write operation */
@@ -279,13 +279,13 @@ static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 	}
 
 	if (cnt >= ULPI_IO_TIMEOUT_USEC) {
-		dev_err(otg->dev, "ulpi_write: timeout\n");
+		dev_err(xceiv->dev, "ulpi_write: timeout\n");
 		return -ETIMEDOUT;
 	}
 	return 0;
 }
 
-static struct otg_io_access_ops msm_otg_io_ops = {
+static struct usb_phy_io_ops msm_otg_io_ops = {
 	.read = ulpi_read,
 	.write = ulpi_write,
 };
@@ -299,9 +299,9 @@ static void ulpi_init(struct msm_otg *motg)
 		return;
 
 	while (seq[0] >= 0) {
-		dev_vdbg(motg->otg.dev, "ulpi: write 0x%02x to 0x%02x\n",
+		dev_vdbg(motg->xceiv.dev, "ulpi: write 0x%02x to 0x%02x\n",
 				seq[0], seq[1]);
-		ulpi_write(&motg->otg, seq[0], seq[1]);
+		ulpi_write(&motg->xceiv, seq[0], seq[1]);
 		seq += 2;
 	}
 }
@@ -313,11 +313,11 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
 	if (assert) {
 		ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
 		if (ret)
-			dev_err(motg->otg.dev, "usb hs_clk assert failed\n");
+			dev_err(motg->xceiv.dev, "usb hs_clk assert failed\n");
 	} else {
 		ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
 		if (ret)
-			dev_err(motg->otg.dev, "usb hs_clk deassert failed\n");
+			dev_err(motg->xceiv.dev, "usb hs_clk deassert failed\n");
 	}
 	return ret;
 }
@@ -328,13 +328,13 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg)
 
 	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
 	if (ret) {
-		dev_err(motg->otg.dev, "usb phy clk assert failed\n");
+		dev_err(motg->xceiv.dev, "usb phy clk assert failed\n");
 		return ret;
 	}
 	usleep_range(10000, 12000);
 	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
 	if (ret)
-		dev_err(motg->otg.dev, "usb phy clk deassert failed\n");
+		dev_err(motg->xceiv.dev, "usb phy clk deassert failed\n");
 	return ret;
 }
 
@@ -358,7 +358,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
 	writel(val | PORTSC_PTS_ULPI, USB_PORTSC);
 
 	for (retries = 3; retries > 0; retries--) {
-		ret = ulpi_write(&motg->otg, ULPI_FUNC_CTRL_SUSPENDM,
+		ret = ulpi_write(&motg->xceiv, ULPI_FUNC_CTRL_SUSPENDM,
 				ULPI_CLR(ULPI_FUNC_CTRL));
 		if (!ret)
 			break;
@@ -375,7 +375,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
 		return ret;
 
 	for (retries = 3; retries > 0; retries--) {
-		ret = ulpi_read(&motg->otg, ULPI_DEBUG);
+		ret = ulpi_read(&motg->xceiv, ULPI_DEBUG);
 		if (ret != -ETIMEDOUT)
 			break;
 		ret = msm_otg_phy_clk_reset(motg);
@@ -385,14 +385,14 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
 	if (!retries)
 		return -ETIMEDOUT;
 
-	dev_info(motg->otg.dev, "phy_reset: success\n");
+	dev_info(motg->xceiv.dev, "phy_reset: success\n");
 	return 0;
 }
 
 #define LINK_RESET_TIMEOUT_USEC		(250 * 1000)
-static int msm_otg_reset(struct usb_phy *otg)
+static int msm_otg_reset(struct usb_phy *xceiv)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 	struct msm_otg_platform_data *pdata = motg->pdata;
 	int cnt = 0;
 	int ret;
@@ -401,7 +401,7 @@ static int msm_otg_reset(struct usb_phy *otg)
 
 	ret = msm_otg_phy_reset(motg);
 	if (ret) {
-		dev_err(otg->dev, "phy_reset failed\n");
+		dev_err(xceiv->dev, "phy_reset failed\n");
 		return ret;
 	}
 
@@ -435,8 +435,8 @@ static int msm_otg_reset(struct usb_phy *otg)
 			val |= OTGSC_BSVIE;
 		}
 		writel(val, USB_OTGSC);
-		ulpi_write(otg, ulpi_val, ULPI_USB_INT_EN_RISE);
-		ulpi_write(otg, ulpi_val, ULPI_USB_INT_EN_FALL);
+		ulpi_write(xceiv, ulpi_val, ULPI_USB_INT_EN_RISE);
+		ulpi_write(xceiv, ulpi_val, ULPI_USB_INT_EN_FALL);
 	}
 
 	return 0;
@@ -448,8 +448,8 @@ static int msm_otg_reset(struct usb_phy *otg)
 #ifdef CONFIG_PM_SLEEP
 static int msm_otg_suspend(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
-	struct usb_bus *bus = otg->host;
+	struct usb_phy *xceiv = &motg->xceiv;
+	struct usb_bus *bus = xceiv->otg->host;
 	struct msm_otg_platform_data *pdata = motg->pdata;
 	int cnt = 0;
 
@@ -475,10 +475,10 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	 */
 
 	if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY) {
-		ulpi_read(otg, 0x14);
+		ulpi_read(xceiv, 0x14);
 		if (pdata->otg_control == OTG_PHY_CONTROL)
-			ulpi_write(otg, 0x01, 0x30);
-		ulpi_write(otg, 0x08, 0x09);
+			ulpi_write(xceiv, 0x01, 0x30);
+		ulpi_write(xceiv, 0x08, 0x09);
 	}
 
 	/*
@@ -495,8 +495,8 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	}
 
 	if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) {
-		dev_err(otg->dev, "Unable to suspend PHY\n");
-		msm_otg_reset(otg);
+		dev_err(xceiv->dev, "Unable to suspend PHY\n");
+		msm_otg_reset(xceiv);
 		enable_irq(motg->irq);
 		return -ETIMEDOUT;
 	}
@@ -528,7 +528,7 @@ static int msm_otg_suspend(struct msm_otg *motg)
 		msm_hsusb_config_vddcx(0);
 	}
 
-	if (device_may_wakeup(otg->dev))
+	if (device_may_wakeup(xceiv->dev))
 		enable_irq_wake(motg->irq);
 	if (bus)
 		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags);
@@ -536,15 +536,15 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	atomic_set(&motg->in_lpm, 1);
 	enable_irq(motg->irq);
 
-	dev_info(otg->dev, "USB in low power mode\n");
+	dev_info(xceiv->dev, "USB in low power mode\n");
 
 	return 0;
 }
 
 static int msm_otg_resume(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
-	struct usb_bus *bus = otg->host;
+	struct usb_phy *xceiv = &motg->xceiv;
+	struct usb_bus *bus = xceiv->otg->host;
 	int cnt = 0;
 	unsigned temp;
 
@@ -592,13 +592,13 @@ static int msm_otg_resume(struct msm_otg *motg)
 		 * PHY. USB state can not be restored. Re-insertion
 		 * of USB cable is the only way to get USB working.
 		 */
-		dev_err(otg->dev, "Unable to resume USB."
+		dev_err(xceiv->dev, "Unable to resume USB."
 				"Re-plugin the cable\n");
-		msm_otg_reset(otg);
+		msm_otg_reset(xceiv);
 	}
 
 skip_phy_resume:
-	if (device_may_wakeup(otg->dev))
+	if (device_may_wakeup(xceiv->dev))
 		disable_irq_wake(motg->irq);
 	if (bus)
 		set_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags);
@@ -607,11 +607,11 @@ skip_phy_resume:
 
 	if (motg->async_int) {
 		motg->async_int = 0;
-		pm_runtime_put(otg->dev);
+		pm_runtime_put(xceiv->dev);
 		enable_irq(motg->irq);
 	}
 
-	dev_info(otg->dev, "USB exited from low power mode\n");
+	dev_info(xceiv->dev, "USB exited from low power mode\n");
 
 	return 0;
 }
@@ -623,13 +623,13 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
 		return;
 
 	/* TODO: Notify PMIC about available current */
-	dev_info(motg->otg.dev, "Avail curr from USB = %u\n", mA);
+	dev_info(motg->xceiv.dev, "Avail curr from USB = %u\n", mA);
 	motg->cur_power = mA;
 }
 
-static int msm_otg_set_power(struct usb_phy *otg, unsigned mA)
+static int msm_otg_set_power(struct usb_phy *xceiv, unsigned mA)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 
 	/*
 	 * Gadget driver uses set_power method to notify about the
@@ -644,19 +644,19 @@ static int msm_otg_set_power(struct usb_phy *otg, unsigned mA)
 	return 0;
 }
 
-static void msm_otg_start_host(struct usb_phy *otg, int on)
+static void msm_otg_start_host(struct usb_phy *xceiv, int on)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 	struct msm_otg_platform_data *pdata = motg->pdata;
 	struct usb_hcd *hcd;
 
-	if (!otg->host)
+	if (!xceiv->otg->host)
 		return;
 
-	hcd = bus_to_hcd(otg->host);
+	hcd = bus_to_hcd(xceiv->otg->host);
 
 	if (on) {
-		dev_dbg(otg->dev, "host on\n");
+		dev_dbg(xceiv->dev, "host on\n");
 
 		if (pdata->vbus_power)
 			pdata->vbus_power(1);
@@ -671,7 +671,7 @@ static void msm_otg_start_host(struct usb_phy *otg, int on)
 		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
 #endif
 	} else {
-		dev_dbg(otg->dev, "host off\n");
+		dev_dbg(xceiv->dev, "host off\n");
 
 #ifdef CONFIG_USB
 		usb_remove_hcd(hcd);
@@ -683,9 +683,9 @@ static void msm_otg_start_host(struct usb_phy *otg, int on)
 	}
 }
 
-static int msm_otg_set_host(struct usb_phy *otg, struct usb_bus *host)
+static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(otg->xceiv, struct msm_otg, xceiv);
 	struct usb_hcd *hcd;
 
 	/*
@@ -693,16 +693,16 @@ static int msm_otg_set_host(struct usb_phy *otg, struct usb_bus *host)
 	 * only peripheral configuration.
 	 */
 	if (motg->pdata->mode == USB_PERIPHERAL) {
-		dev_info(otg->dev, "Host mode is not supported\n");
+		dev_info(otg->xceiv->dev, "Host mode is not supported\n");
 		return -ENODEV;
 	}
 
 	if (!host) {
-		if (otg->state == USB_PHY_STATE_A_HOST) {
-			pm_runtime_get_sync(otg->dev);
-			msm_otg_start_host(otg, 0);
+		if (otg->xceiv->state == USB_PHY_STATE_A_HOST) {
+			pm_runtime_get_sync(otg->xceiv->dev);
+			msm_otg_start_host(otg->xceiv, 0);
 			otg->host = NULL;
-			otg->state = USB_PHY_STATE_UNDEFINED;
+			otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 			schedule_work(&motg->sm_work);
 		} else {
 			otg->host = NULL;
@@ -715,30 +715,30 @@ static int msm_otg_set_host(struct usb_phy *otg, struct usb_bus *host)
 	hcd->power_budget = motg->pdata->power_budget;
 
 	otg->host = host;
-	dev_dbg(otg->dev, "host driver registered w/ tranceiver\n");
+	dev_dbg(otg->xceiv->dev, "host driver registered w/ tranceiver\n");
 
 	/*
 	 * Kick the state machine work, if peripheral is not supported
 	 * or peripheral is already registered with us.
 	 */
 	if (motg->pdata->mode == USB_HOST || otg->gadget) {
-		pm_runtime_get_sync(otg->dev);
+		pm_runtime_get_sync(otg->xceiv->dev);
 		schedule_work(&motg->sm_work);
 	}
 
 	return 0;
 }
 
-static void msm_otg_start_peripheral(struct usb_phy *otg, int on)
+static void msm_otg_start_peripheral(struct usb_phy *xceiv, int on)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(xceiv, struct msm_otg, xceiv);
 	struct msm_otg_platform_data *pdata = motg->pdata;
 
-	if (!otg->gadget)
+	if (!xceiv->otg->gadget)
 		return;
 
 	if (on) {
-		dev_dbg(otg->dev, "gadget on\n");
+		dev_dbg(xceiv->dev, "gadget on\n");
 		/*
 		 * Some boards have a switch cotrolled by gpio
 		 * to enable/disable internal HUB. Disable internal
@@ -746,36 +746,36 @@ static void msm_otg_start_peripheral(struct usb_phy *otg, int on)
 		 */
 		if (pdata->setup_gpio)
 			pdata->setup_gpio(USB_PHY_STATE_B_PERIPHERAL);
-		usb_gadget_vbus_connect(otg->gadget);
+		usb_gadget_vbus_connect(xceiv->otg->gadget);
 	} else {
-		dev_dbg(otg->dev, "gadget off\n");
-		usb_gadget_vbus_disconnect(otg->gadget);
+		dev_dbg(xceiv->dev, "gadget off\n");
+		usb_gadget_vbus_disconnect(xceiv->otg->gadget);
 		if (pdata->setup_gpio)
 			pdata->setup_gpio(USB_PHY_STATE_UNDEFINED);
 	}
 
 }
 
-static int msm_otg_set_peripheral(struct usb_phy *otg,
-			struct usb_gadget *gadget)
+static int msm_otg_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
-	struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+	struct msm_otg *motg = container_of(otg->xceiv, struct msm_otg, xceiv);
 
 	/*
 	 * Fail peripheral registration if this board can support
 	 * only host configuration.
 	 */
 	if (motg->pdata->mode == USB_HOST) {
-		dev_info(otg->dev, "Peripheral mode is not supported\n");
+		dev_info(otg->xceiv->dev, "Peripheral mode is not supported\n");
 		return -ENODEV;
 	}
 
 	if (!gadget) {
-		if (otg->state == USB_PHY_STATE_B_PERIPHERAL) {
-			pm_runtime_get_sync(otg->dev);
-			msm_otg_start_peripheral(otg, 0);
+		if (otg->xceiv->state == USB_PHY_STATE_B_PERIPHERAL) {
+			pm_runtime_get_sync(otg->xceiv->dev);
+			msm_otg_start_peripheral(otg->xceiv, 0);
 			otg->gadget = NULL;
-			otg->state = USB_PHY_STATE_UNDEFINED;
+			otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 			schedule_work(&motg->sm_work);
 		} else {
 			otg->gadget = NULL;
@@ -784,14 +784,14 @@ static int msm_otg_set_peripheral(struct usb_phy *otg,
 		return 0;
 	}
 	otg->gadget = gadget;
-	dev_dbg(otg->dev, "peripheral driver registered w/ tranceiver\n");
+	dev_dbg(otg->xceiv->dev, "peripheral driver registered w/ tranceiver\n");
 
 	/*
 	 * Kick the state machine work, if host is not supported
 	 * or host is already registered with us.
 	 */
 	if (motg->pdata->mode == USB_PERIPHERAL || otg->host) {
-		pm_runtime_get_sync(otg->dev);
+		pm_runtime_get_sync(otg->xceiv->dev);
 		schedule_work(&motg->sm_work);
 	}
 
@@ -800,17 +800,17 @@ static int msm_otg_set_peripheral(struct usb_phy *otg,
 
 static bool msm_chg_check_secondary_det(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 	bool ret = false;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		ret = chg_det & (1 << 4);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x87);
+		chg_det = ulpi_read(xceiv, 0x87);
 		ret = chg_det & 1;
 		break;
 	default:
@@ -821,38 +821,38 @@ static bool msm_chg_check_secondary_det(struct msm_otg *motg)
 
 static void msm_chg_enable_secondary_det(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		/* Turn off charger block */
 		chg_det |= ~(1 << 1);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		udelay(20);
 		/* control chg block via ULPI */
 		chg_det &= ~(1 << 3);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		/* put it in host mode for enabling D- source */
 		chg_det &= ~(1 << 2);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		/* Turn on chg detect block */
 		chg_det &= ~(1 << 1);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		udelay(20);
 		/* enable chg detection */
 		chg_det &= ~(1 << 0);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
 		/*
 		 * Configure DM as current source, DP as current sink
 		 * and enable battery charging comparators.
 		 */
-		ulpi_write(otg, 0x8, 0x85);
-		ulpi_write(otg, 0x2, 0x85);
-		ulpi_write(otg, 0x1, 0x85);
+		ulpi_write(xceiv, 0x8, 0x85);
+		ulpi_write(xceiv, 0x2, 0x85);
+		ulpi_write(xceiv, 0x1, 0x85);
 		break;
 	default:
 		break;
@@ -861,17 +861,17 @@ static void msm_chg_enable_secondary_det(struct msm_otg *motg)
 
 static bool msm_chg_check_primary_det(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 	bool ret = false;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		ret = chg_det & (1 << 4);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x87);
+		chg_det = ulpi_read(xceiv, 0x87);
 		ret = chg_det & 1;
 		break;
 	default:
@@ -882,23 +882,23 @@ static bool msm_chg_check_primary_det(struct msm_otg *motg)
 
 static void msm_chg_enable_primary_det(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		/* enable chg detection */
 		chg_det &= ~(1 << 0);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
 		/*
 		 * Configure DP as current source, DM as current sink
 		 * and enable battery charging comparators.
 		 */
-		ulpi_write(otg, 0x2, 0x85);
-		ulpi_write(otg, 0x1, 0x85);
+		ulpi_write(xceiv, 0x2, 0x85);
+		ulpi_write(xceiv, 0x1, 0x85);
 		break;
 	default:
 		break;
@@ -907,17 +907,17 @@ static void msm_chg_enable_primary_det(struct msm_otg *motg)
 
 static bool msm_chg_check_dcd(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 line_state;
 	bool ret = false;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		line_state = ulpi_read(otg, 0x15);
+		line_state = ulpi_read(xceiv, 0x15);
 		ret = !(line_state & 1);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
-		line_state = ulpi_read(otg, 0x87);
+		line_state = ulpi_read(xceiv, 0x87);
 		ret = line_state & 2;
 		break;
 	default:
@@ -928,17 +928,17 @@ static bool msm_chg_check_dcd(struct msm_otg *motg)
 
 static void msm_chg_disable_dcd(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		chg_det &= ~(1 << 5);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
-		ulpi_write(otg, 0x10, 0x86);
+		ulpi_write(xceiv, 0x10, 0x86);
 		break;
 	default:
 		break;
@@ -947,19 +947,19 @@ static void msm_chg_disable_dcd(struct msm_otg *motg)
 
 static void msm_chg_enable_dcd(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 chg_det;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		/* Turn on D+ current source */
 		chg_det |= (1 << 5);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
 		/* Data contact detection enable */
-		ulpi_write(otg, 0x10, 0x85);
+		ulpi_write(xceiv, 0x10, 0x85);
 		break;
 	default:
 		break;
@@ -968,32 +968,32 @@ static void msm_chg_enable_dcd(struct msm_otg *motg)
 
 static void msm_chg_block_on(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 func_ctrl, chg_det;
 
 	/* put the controller in non-driving mode */
-	func_ctrl = ulpi_read(otg, ULPI_FUNC_CTRL);
+	func_ctrl = ulpi_read(xceiv, ULPI_FUNC_CTRL);
 	func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
 	func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
-	ulpi_write(otg, func_ctrl, ULPI_FUNC_CTRL);
+	ulpi_write(xceiv, func_ctrl, ULPI_FUNC_CTRL);
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		/* control chg block via ULPI */
 		chg_det &= ~(1 << 3);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		/* Turn on chg detect block */
 		chg_det &= ~(1 << 1);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		udelay(20);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
 		/* Clear charger detecting control bits */
-		ulpi_write(otg, 0x3F, 0x86);
+		ulpi_write(xceiv, 0x3F, 0x86);
 		/* Clear alt interrupt latch and enable bits */
-		ulpi_write(otg, 0x1F, 0x92);
-		ulpi_write(otg, 0x1F, 0x95);
+		ulpi_write(xceiv, 0x1F, 0x92);
+		ulpi_write(xceiv, 0x1F, 0x95);
 		udelay(100);
 		break;
 	default:
@@ -1003,32 +1003,32 @@ static void msm_chg_block_on(struct msm_otg *motg)
 
 static void msm_chg_block_off(struct msm_otg *motg)
 {
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 func_ctrl, chg_det;
 
 	switch (motg->pdata->phy_type) {
 	case CI_45NM_INTEGRATED_PHY:
-		chg_det = ulpi_read(otg, 0x34);
+		chg_det = ulpi_read(xceiv, 0x34);
 		/* Turn off charger block */
 		chg_det |= ~(1 << 1);
-		ulpi_write(otg, chg_det, 0x34);
+		ulpi_write(xceiv, chg_det, 0x34);
 		break;
 	case SNPS_28NM_INTEGRATED_PHY:
 		/* Clear charger detecting control bits */
-		ulpi_write(otg, 0x3F, 0x86);
+		ulpi_write(xceiv, 0x3F, 0x86);
 		/* Clear alt interrupt latch and enable bits */
-		ulpi_write(otg, 0x1F, 0x92);
-		ulpi_write(otg, 0x1F, 0x95);
+		ulpi_write(xceiv, 0x1F, 0x92);
+		ulpi_write(xceiv, 0x1F, 0x95);
 		break;
 	default:
 		break;
 	}
 
 	/* put the controller in normal mode */
-	func_ctrl = ulpi_read(otg, ULPI_FUNC_CTRL);
+	func_ctrl = ulpi_read(xceiv, ULPI_FUNC_CTRL);
 	func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
 	func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NORMAL;
-	ulpi_write(otg, func_ctrl, ULPI_FUNC_CTRL);
+	ulpi_write(xceiv, func_ctrl, ULPI_FUNC_CTRL);
 }
 
 #define MSM_CHG_DCD_POLL_TIME		(100 * HZ/1000) /* 100 msec */
@@ -1038,14 +1038,14 @@ static void msm_chg_block_off(struct msm_otg *motg)
 static void msm_chg_detect_work(struct work_struct *w)
 {
 	struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work);
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	bool is_dcd, tmout, vout;
 	unsigned long delay;
 
-	dev_dbg(otg->dev, "chg detection work\n");
+	dev_dbg(xceiv->dev, "chg detection work\n");
 	switch (motg->chg_state) {
 	case USB_CHG_STATE_UNDEFINED:
-		pm_runtime_get_sync(otg->dev);
+		pm_runtime_get_sync(xceiv->dev);
 		msm_chg_block_on(motg);
 		msm_chg_enable_dcd(motg);
 		motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
@@ -1088,7 +1088,7 @@ static void msm_chg_detect_work(struct work_struct *w)
 		motg->chg_state = USB_CHG_STATE_DETECTED;
 	case USB_CHG_STATE_DETECTED:
 		msm_chg_block_off(motg);
-		dev_dbg(otg->dev, "charger = %d\n", motg->chg_type);
+		dev_dbg(xceiv->dev, "charger = %d\n", motg->chg_type);
 		schedule_work(&motg->sm_work);
 		return;
 	default:
@@ -1152,22 +1152,22 @@ static void msm_otg_init_sm(struct msm_otg *motg)
 static void msm_otg_sm_work(struct work_struct *w)
 {
 	struct msm_otg *motg = container_of(w, struct msm_otg, sm_work);
-	struct usb_phy *otg = &motg->otg;
+	struct usb_otg *otg = motg->xceiv.otg;
 
-	switch (otg->state) {
+	switch (otg->xceiv->state) {
 	case USB_PHY_STATE_UNDEFINED:
-		dev_dbg(otg->dev, "USB_PHY_STATE_UNDEFINED state\n");
-		msm_otg_reset(otg);
+		dev_dbg(otg->xceiv->dev, "USB_PHY_STATE_UNDEFINED state\n");
+		msm_otg_reset(otg->xceiv);
 		msm_otg_init_sm(motg);
-		otg->state = USB_PHY_STATE_B_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		/* FALL THROUGH */
 	case USB_PHY_STATE_B_IDLE:
-		dev_dbg(otg->dev, "USB_PHY_STATE_B_IDLE state\n");
+		dev_dbg(otg->xceiv->dev, "USB_PHY_STATE_B_IDLE state\n");
 		if (!test_bit(ID, &motg->inputs) && otg->host) {
 			/* disable BSV bit */
 			writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC);
-			msm_otg_start_host(otg, 1);
-			otg->state = USB_PHY_STATE_A_HOST;
+			msm_otg_start_host(otg->xceiv, 1);
+			otg->xceiv->state = USB_PHY_STATE_A_HOST;
 		} else if (test_bit(B_SESS_VLD, &motg->inputs)) {
 			switch (motg->chg_state) {
 			case USB_CHG_STATE_UNDEFINED:
@@ -1182,13 +1182,15 @@ static void msm_otg_sm_work(struct work_struct *w)
 				case USB_CDP_CHARGER:
 					msm_otg_notify_charger(motg,
 							IDEV_CHG_MAX);
-					msm_otg_start_peripheral(otg, 1);
-					otg->state = USB_PHY_STATE_B_PERIPHERAL;
+					msm_otg_start_peripheral(otg->xceiv, 1);
+					otg->xceiv->state
+						= USB_PHY_STATE_B_PERIPHERAL;
 					break;
 				case USB_SDP_CHARGER:
 					msm_otg_notify_charger(motg, IUNIT);
-					msm_otg_start_peripheral(otg, 1);
-					otg->state = USB_PHY_STATE_B_PERIPHERAL;
+					msm_otg_start_peripheral(otg->xceiv, 1);
+					otg->xceiv->state
+						= USB_PHY_STATE_B_PERIPHERAL;
 					break;
 				default:
 					break;
@@ -1204,34 +1206,34 @@ static void msm_otg_sm_work(struct work_struct *w)
 			 * is incremented in charger detection work.
 			 */
 			if (cancel_delayed_work_sync(&motg->chg_work)) {
-				pm_runtime_put_sync(otg->dev);
-				msm_otg_reset(otg);
+				pm_runtime_put_sync(otg->xceiv->dev);
+				msm_otg_reset(otg->xceiv);
 			}
 			msm_otg_notify_charger(motg, 0);
 			motg->chg_state = USB_CHG_STATE_UNDEFINED;
 			motg->chg_type = USB_INVALID_CHARGER;
 		}
-		pm_runtime_put_sync(otg->dev);
+		pm_runtime_put_sync(otg->xceiv->dev);
 		break;
 	case USB_PHY_STATE_B_PERIPHERAL:
-		dev_dbg(otg->dev, "USB_PHY_STATE_B_PERIPHERAL state\n");
+		dev_dbg(otg->xceiv->dev, "USB_PHY_STATE_B_PERIPHERAL state\n");
 		if (!test_bit(B_SESS_VLD, &motg->inputs) ||
 				!test_bit(ID, &motg->inputs)) {
 			msm_otg_notify_charger(motg, 0);
-			msm_otg_start_peripheral(otg, 0);
+			msm_otg_start_peripheral(otg->xceiv, 0);
 			motg->chg_state = USB_CHG_STATE_UNDEFINED;
 			motg->chg_type = USB_INVALID_CHARGER;
-			otg->state = USB_PHY_STATE_B_IDLE;
-			msm_otg_reset(otg);
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
+			msm_otg_reset(otg->xceiv);
 			schedule_work(w);
 		}
 		break;
 	case USB_PHY_STATE_A_HOST:
-		dev_dbg(otg->dev, "USB_PHY_STATE_A_HOST state\n");
+		dev_dbg(otg->xceiv->dev, "USB_PHY_STATE_A_HOST state\n");
 		if (test_bit(ID, &motg->inputs)) {
-			msm_otg_start_host(otg, 0);
-			otg->state = USB_PHY_STATE_B_IDLE;
-			msm_otg_reset(otg);
+			msm_otg_start_host(otg->xceiv, 0);
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
+			msm_otg_reset(otg->xceiv);
 			schedule_work(w);
 		}
 		break;
@@ -1243,13 +1245,13 @@ static void msm_otg_sm_work(struct work_struct *w)
 static irqreturn_t msm_otg_irq(int irq, void *data)
 {
 	struct msm_otg *motg = data;
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	u32 otgsc = 0;
 
 	if (atomic_read(&motg->in_lpm)) {
 		disable_irq_nosync(irq);
 		motg->async_int = 1;
-		pm_runtime_get(otg->dev);
+		pm_runtime_get(xceiv->dev);
 		return IRQ_HANDLED;
 	}
 
@@ -1262,15 +1264,15 @@ static irqreturn_t msm_otg_irq(int irq, void *data)
 			set_bit(ID, &motg->inputs);
 		else
 			clear_bit(ID, &motg->inputs);
-		dev_dbg(otg->dev, "ID set/clear\n");
-		pm_runtime_get_noresume(otg->dev);
+		dev_dbg(xceiv->dev, "ID set/clear\n");
+		pm_runtime_get_noresume(xceiv->dev);
 	} else if ((otgsc & OTGSC_BSVIS) && (otgsc & OTGSC_BSVIE)) {
 		if (otgsc & OTGSC_BSV)
 			set_bit(B_SESS_VLD, &motg->inputs);
 		else
 			clear_bit(B_SESS_VLD, &motg->inputs);
-		dev_dbg(otg->dev, "BSV set/clear\n");
-		pm_runtime_get_noresume(otg->dev);
+		dev_dbg(xceiv->dev, "BSV set/clear\n");
+		pm_runtime_get_noresume(xceiv->dev);
 	}
 
 	writel(otgsc, USB_OTGSC);
@@ -1281,9 +1283,9 @@ static irqreturn_t msm_otg_irq(int irq, void *data)
 static int msm_otg_mode_show(struct seq_file *s, void *unused)
 {
 	struct msm_otg *motg = s->private;
-	struct usb_phy *otg = &motg->otg;
+	struct usb_otg *otg = motg->xceiv.otg;
 
-	switch (otg->state) {
+	switch (otg->xceiv->state) {
 	case USB_PHY_STATE_A_HOST:
 		seq_printf(s, "host\n");
 		break;
@@ -1309,7 +1311,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 	struct seq_file *s = file->private_data;
 	struct msm_otg *motg = s->private;
 	char buf[16];
-	struct usb_phy *otg = &motg->otg;
+	struct usb_otg *otg = motg->xceiv.otg;
 	int status = count;
 	enum usb_mode_type req_mode;
 
@@ -1333,7 +1335,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 
 	switch (req_mode) {
 	case USB_NONE:
-		switch (otg->state) {
+		switch (otg->xceiv->state) {
 		case USB_PHY_STATE_A_HOST:
 		case USB_PHY_STATE_B_PERIPHERAL:
 			set_bit(ID, &motg->inputs);
@@ -1344,7 +1346,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 		}
 		break;
 	case USB_PERIPHERAL:
-		switch (otg->state) {
+		switch (otg->xceiv->state) {
 		case USB_PHY_STATE_B_IDLE:
 		case USB_PHY_STATE_A_HOST:
 			set_bit(ID, &motg->inputs);
@@ -1355,7 +1357,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 		}
 		break;
 	case USB_HOST:
-		switch (otg->state) {
+		switch (otg->xceiv->state) {
 		case USB_PHY_STATE_B_IDLE:
 		case USB_PHY_STATE_B_PERIPHERAL:
 			clear_bit(ID, &motg->inputs);
@@ -1368,7 +1370,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 		goto out;
 	}
 
-	pm_runtime_get_sync(otg->dev);
+	pm_runtime_get_sync(otg->xceiv->dev);
 	schedule_work(&motg->sm_work);
 out:
 	return status;
@@ -1414,7 +1416,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 	int ret = 0;
 	struct resource *res;
 	struct msm_otg *motg;
-	struct usb_phy *otg;
+	struct usb_phy *xceiv;
 
 	dev_info(&pdev->dev, "msm_otg probe\n");
 	if (!pdev->dev.platform_data) {
@@ -1428,9 +1430,15 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	motg->xceiv.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!motg->xceiv.otg) {
+		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
+		return -ENOMEM;
+	}
+
 	motg->pdata = pdev->dev.platform_data;
-	otg = &motg->otg;
-	otg->dev = &pdev->dev;
+	xceiv = &motg->xceiv;
+	xceiv->dev = &pdev->dev;
 
 	motg->phy_reset_clk = clk_get(&pdev->dev, "usb_phy_clk");
 	if (IS_ERR(motg->phy_reset_clk)) {
@@ -1538,16 +1546,18 @@ static int __init msm_otg_probe(struct platform_device *pdev)
 		goto disable_clks;
 	}
 
-	otg->init = msm_otg_reset;
-	otg->set_host = msm_otg_set_host;
-	otg->set_peripheral = msm_otg_set_peripheral;
-	otg->set_power = msm_otg_set_power;
+	xceiv->init = msm_otg_reset;
+	xceiv->set_power = msm_otg_set_power;
+
+	xceiv->io_ops = &msm_otg_io_ops;
 
-	otg->io_ops = &msm_otg_io_ops;
+	xceiv->otg->xceiv = &motg->xceiv;
+	xceiv->otg->set_host = msm_otg_set_host;
+	xceiv->otg->set_peripheral = msm_otg_set_peripheral;
 
-	ret = otg_set_transceiver(&motg->otg);
+	ret = usb_set_transceiver(&motg->xceiv);
 	if (ret) {
-		dev_err(&pdev->dev, "otg_set_transceiver failed\n");
+		dev_err(&pdev->dev, "usb_set_transceiver failed\n");
 		goto free_irq;
 	}
 
@@ -1591,6 +1601,7 @@ put_clk:
 put_phy_reset_clk:
 	clk_put(motg->phy_reset_clk);
 free_motg:
+	kfree(motg->xceiv.otg);
 	kfree(motg);
 	return ret;
 }
@@ -1598,10 +1609,10 @@ free_motg:
 static int __devexit msm_otg_remove(struct platform_device *pdev)
 {
 	struct msm_otg *motg = platform_get_drvdata(pdev);
-	struct usb_phy *otg = &motg->otg;
+	struct usb_phy *xceiv = &motg->xceiv;
 	int cnt = 0;
 
-	if (otg->host || otg->gadget)
+	if (xceiv->otg->host || xceiv->otg->gadget)
 		return -EBUSY;
 
 	msm_otg_debugfs_cleanup();
@@ -1613,14 +1624,14 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 	device_init_wakeup(&pdev->dev, 0);
 	pm_runtime_disable(&pdev->dev);
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 	free_irq(motg->irq, motg);
 
 	/*
 	 * Put PHY in low power mode.
 	 */
-	ulpi_read(otg, 0x14);
-	ulpi_write(otg, 0x08, 0x09);
+	ulpi_read(xceiv, 0x14);
+	ulpi_write(xceiv, 0x08, 0x09);
 
 	writel(readl(USB_PORTSC) | PORTSC_PHCD, USB_PORTSC);
 	while (cnt < PHY_SUSPEND_TIMEOUT_USEC) {
@@ -1630,7 +1641,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 		cnt++;
 	}
 	if (cnt >= PHY_SUSPEND_TIMEOUT_USEC)
-		dev_err(otg->dev, "Unable to suspend PHY\n");
+		dev_err(xceiv->dev, "Unable to suspend PHY\n");
 
 	clk_disable(motg->pclk);
 	clk_disable(motg->clk);
@@ -1651,6 +1662,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 	if (motg->core_clk)
 		clk_put(motg->core_clk);
 
+	kfree(motg->xceiv.otg);
 	kfree(motg);
 
 	return 0;
@@ -1660,7 +1672,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
 static int msm_otg_runtime_idle(struct device *dev)
 {
 	struct msm_otg *motg = dev_get_drvdata(dev);
-	struct usb_phy *otg = &motg->otg;
+	struct usb_otg *otg = motg->xceiv.otg;
 
 	dev_dbg(dev, "OTG runtime idle\n");
 
@@ -1670,7 +1682,7 @@ static int msm_otg_runtime_idle(struct device *dev)
 	 * This 1 sec delay also prevents entering into LPM immediately
 	 * after asynchronous interrupt.
 	 */
-	if (otg->state != USB_PHY_STATE_UNDEFINED)
+	if (otg->xceiv->state != USB_PHY_STATE_UNDEFINED)
 		pm_schedule_suspend(dev, 1000);
 
 	return -EAGAIN;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index e25ee7a..fb7f047 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -160,7 +160,7 @@ struct msm_otg_platform_data {
  *               detection process.
  */
 struct msm_otg {
-	struct usb_phy otg;
+	struct usb_phy xceiv;
 	struct msm_otg_platform_data *pdata;
 	int irq;
 	struct clk *clk;
-- 
1.7.4.1


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

* [PATCHv5 09/19] usb: otg: langwell: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (7 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 08/19] usb: otg: msm: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 10/19] usb: otg: nop: " Heikki Krogerus
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/otg/langwell_otg.c    |  333 ++++++++++++++++++++-----------------
 include/linux/usb/intel_mid_otg.h |    6 +-
 2 files changed, 180 insertions(+), 159 deletions(-)

diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index 54ab373..d6bd9c4 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -55,11 +55,10 @@ static void langwell_otg_remove(struct pci_dev *pdev);
 static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message);
 static int langwell_otg_resume(struct pci_dev *pdev);
 
-static int langwell_otg_set_host(struct usb_phy *otg,
-				struct usb_bus *host);
-static int langwell_otg_set_peripheral(struct usb_phy *otg,
+static int langwell_otg_set_host(struct usb_otg *otg, struct usb_bus *host);
+static int langwell_otg_set_peripheral(struct usb_otg *otg,
 				struct usb_gadget *gadget);
-static int langwell_otg_start_srp(struct usb_phy *otg);
+static int langwell_otg_start_srp(struct usb_otg *otg);
 
 static const struct pci_device_id pci_ids[] = {{
 	.class =        ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
@@ -118,15 +117,14 @@ void langwell_update_transceiver(void)
 }
 EXPORT_SYMBOL(langwell_update_transceiver);
 
-static int langwell_otg_set_host(struct usb_phy *otg,
-					struct usb_bus *host)
+static int langwell_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
 	otg->host = host;
 
 	return 0;
 }
 
-static int langwell_otg_set_peripheral(struct usb_phy *otg,
+static int langwell_otg_set_peripheral(struct usb_otg *otg,
 					struct usb_gadget *gadget)
 {
 	otg->gadget = gadget;
@@ -141,7 +139,7 @@ static int langwell_otg_set_power(struct usb_phy *otg,
 }
 
 /* A-device drives vbus, controlled through IPC commands */
-static int langwell_otg_set_vbus(struct usb_phy *otg, bool enabled)
+static int langwell_otg_set_vbus(struct usb_otg *otg, bool enabled)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	u8				sub_id;
@@ -180,7 +178,7 @@ static void langwell_otg_chrg_vbus(int on)
 }
 
 /* Start SRP */
-static int langwell_otg_start_srp(struct usb_phy *otg)
+static int langwell_otg_start_srp(struct usb_otg *otg)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
@@ -205,9 +203,9 @@ static int langwell_otg_start_srp(struct usb_phy *otg)
 	writel(val, iotg->base + CI_OTGSC);
 
 	/* Start VBus SRP, drive vbus to generate VBus pulse */
-	iotg->otg.set_vbus(&iotg->otg, true);
+	otg->set_vbus(otg, true);
 	msleep(15);
-	iotg->otg.set_vbus(&iotg->otg, false);
+	otg->set_vbus(otg, false);
 
 	/* Enable interrupt - b_sess_vld*/
 	val = readl(iotg->base + CI_OTGSC);
@@ -237,7 +235,7 @@ static void langwell_otg_loc_sof(int on)
 
 	dev_dbg(lnw->dev, "%s ---> %s\n", __func__, on ? "suspend" : "resume");
 
-	hcd = bus_to_hcd(lnw->iotg.otg.host);
+	hcd = bus_to_hcd(lnw->iotg.xceiv.otg->host);
 	if (on)
 		err = hcd->driver->bus_resume(hcd);
 	else
@@ -672,6 +670,7 @@ static void init_hsm(void)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 	u32				val32;
 
 	/* read OTGSC after reset */
@@ -681,14 +680,14 @@ static void init_hsm(void)
 	/* set init state */
 	if (val32 & OTGSC_ID) {
 		iotg->hsm.id = 1;
-		iotg->otg.default_a = 0;
+		otg->default_a = 0;
 		set_client_mode();
-		iotg->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 	} else {
 		iotg->hsm.id = 0;
-		iotg->otg.default_a = 1;
+		otg->default_a = 1;
 		set_host_mode();
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 	}
 
 	/* set session indicator */
@@ -832,6 +831,7 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = data;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 	int				flag = 0;
 
 	if (iotg == NULL)
@@ -843,7 +843,7 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 	switch (action) {
 	case MID_OTG_NOTIFY_CONNECT:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Connect Event\n");
-		if (iotg->otg.default_a == 1)
+		if (otg->default_a == 1)
 			iotg->hsm.b_conn = 1;
 		else
 			iotg->hsm.a_conn = 1;
@@ -851,7 +851,7 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 		break;
 	case MID_OTG_NOTIFY_DISCONN:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Disconnect Event\n");
-		if (iotg->otg.default_a == 1)
+		if (otg->default_a == 1)
 			iotg->hsm.b_conn = 0;
 		else
 			iotg->hsm.a_conn = 0;
@@ -859,7 +859,7 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 		break;
 	case MID_OTG_NOTIFY_HSUSPEND:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Host Bus suspend Event\n");
-		if (iotg->otg.default_a == 1)
+		if (otg->default_a == 1)
 			iotg->hsm.a_suspend_req = 1;
 		else
 			iotg->hsm.b_bus_req = 0;
@@ -867,13 +867,13 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 		break;
 	case MID_OTG_NOTIFY_HRESUME:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Host Bus resume Event\n");
-		if (iotg->otg.default_a == 1)
+		if (otg->default_a == 1)
 			iotg->hsm.b_bus_resume = 1;
 		flag = 1;
 		break;
 	case MID_OTG_NOTIFY_CSUSPEND:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Client Bus suspend Event\n");
-		if (iotg->otg.default_a == 1) {
+		if (otg->default_a == 1) {
 			if (iotg->hsm.b_bus_suspend_vld == 2) {
 				iotg->hsm.b_bus_suspend = 1;
 				iotg->hsm.b_bus_suspend_vld = 0;
@@ -891,7 +891,7 @@ static int langwell_otg_iotg_notify(struct notifier_block *nb,
 		break;
 	case MID_OTG_NOTIFY_CRESUME:
 		dev_dbg(lnw->dev, "Lnw OTG Notify Client Bus resume Event\n");
-		if (iotg->otg.default_a == 0)
+		if (otg->default_a == 0)
 			iotg->hsm.a_bus_suspend = 0;
 		flag = 0;
 		break;
@@ -926,31 +926,33 @@ static void langwell_otg_work(struct work_struct *work)
 {
 	struct langwell_otg		*lnw;
 	struct intel_mid_otg_xceiv	*iotg;
+	struct usb_otg			*otg;
 	int				retval;
 	struct pci_dev			*pdev;
 
 	lnw = container_of(work, struct langwell_otg, work);
 	iotg = &lnw->iotg;
 	pdev = to_pci_dev(lnw->dev);
+	otg = iotg->xceiv.otg;
 
 	dev_dbg(lnw->dev, "%s: old state = %s\n", __func__,
-			usb_phy_state_string(iotg->otg.state));
+			usb_phy_state_string(otg->xceiv->state));
 
-	switch (iotg->otg.state) {
+	switch (otg->xceiv->state) {
 	case USB_PHY_STATE_UNDEFINED:
 	case USB_PHY_STATE_B_IDLE:
 		if (!iotg->hsm.id) {
 			langwell_otg_del_timer(b_srp_init_tmr);
 			del_timer_sync(&lnw->hsm_timer);
 
-			iotg->otg.default_a = 1;
+			otg->default_a = 1;
 			iotg->hsm.a_srp_det = 0;
 
 			langwell_otg_chrg_vbus(0);
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
 
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.b_sess_vld) {
 			langwell_otg_del_timer(b_srp_init_tmr);
@@ -961,7 +963,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			if (lnw->iotg.start_peripheral) {
 				lnw->iotg.start_peripheral(&lnw->iotg);
-				iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+				otg->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 			} else
 				dev_dbg(lnw->dev, "client driver not loaded\n");
 
@@ -987,7 +989,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 				/* Start SRP */
 				langwell_otg_add_timer(b_srp_init_tmr);
-				iotg->otg.start_srp(&iotg->otg);
+				otg->start_srp(otg);
 				langwell_otg_del_timer(b_srp_init_tmr);
 				langwell_otg_add_ktimer(TB_SRP_FAIL_TMR);
 
@@ -998,28 +1000,28 @@ static void langwell_otg_work(struct work_struct *work)
 		break;
 	case USB_PHY_STATE_B_SRP_INIT:
 		if (!iotg->hsm.id) {
-			iotg->otg.default_a = 1;
+			otg->default_a = 1;
 			iotg->hsm.a_srp_det = 0;
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			langwell_otg_chrg_vbus(0);
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.b_sess_vld) {
 			langwell_otg_chrg_vbus(0);
 			if (lnw->iotg.start_peripheral) {
 				lnw->iotg.start_peripheral(&lnw->iotg);
-				iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+				otg->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 			} else
 				dev_dbg(lnw->dev, "client driver not loaded\n");
 		}
 		break;
 	case USB_PHY_STATE_B_PERIPHERAL:
 		if (!iotg->hsm.id) {
-			iotg->otg.default_a = 1;
+			otg->default_a = 1;
 			iotg->hsm.a_srp_det = 0;
 
 			langwell_otg_chrg_vbus(0);
@@ -1032,7 +1034,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			iotg->hsm.b_hnp_enable = 0;
@@ -1043,9 +1045,9 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 					"client driver has been removed.\n");
 
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
-		} else if (iotg->hsm.b_bus_req && iotg->otg.gadget &&
-					iotg->otg.gadget->b_hnp_enable &&
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
+		} else if (iotg->hsm.b_bus_req && otg->gadget &&
+					otg->gadget->b_hnp_enable &&
 					iotg->hsm.a_bus_suspend) {
 
 			if (lnw->iotg.stop_peripheral)
@@ -1059,7 +1061,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			if (lnw->iotg.start_host) {
 				lnw->iotg.start_host(&lnw->iotg);
-				iotg->otg.state = USB_PHY_STATE_B_WAIT_ACON;
+				otg->xceiv->state = USB_PHY_STATE_B_WAIT_ACON;
 			} else
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
@@ -1074,7 +1076,7 @@ static void langwell_otg_work(struct work_struct *work)
 			/* delete hsm timer for b_ase0_brst_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
-			iotg->otg.default_a = 1;
+			otg->default_a = 1;
 			iotg->hsm.a_srp_det = 0;
 
 			langwell_otg_chrg_vbus(0);
@@ -1088,7 +1090,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			/* delete hsm timer for b_ase0_brst_tmr */
@@ -1108,13 +1110,13 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		} else if (iotg->hsm.a_conn) {
 			/* delete hsm timer for b_ase0_brst_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
 			langwell_otg_HAAR(0);
-			iotg->otg.state = USB_PHY_STATE_B_HOST;
+			otg->xceiv->state = USB_PHY_STATE_B_HOST;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_resume ||
 				iotg->hsm.b_ase0_brst_tmout) {
@@ -1139,13 +1141,13 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 					"client driver not loaded.\n");
 
-			iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+			otg->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		}
 		break;
 
 	case USB_PHY_STATE_B_HOST:
 		if (!iotg->hsm.id) {
-			iotg->otg.default_a = 1;
+			otg->default_a = 1;
 			iotg->hsm.a_srp_det = 0;
 
 			langwell_otg_chrg_vbus(0);
@@ -1158,7 +1160,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.b_sess_vld) {
 			iotg->hsm.b_hnp_enable = 0;
@@ -1173,7 +1175,7 @@ static void langwell_otg_work(struct work_struct *work)
 
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		} else if ((!iotg->hsm.b_bus_req) ||
 				(!iotg->hsm.a_conn)) {
 			iotg->hsm.b_bus_req = 0;
@@ -1193,33 +1195,33 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"client driver not loaded.\n");
 
-			iotg->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+			otg->xceiv->state = USB_PHY_STATE_B_PERIPHERAL;
 		}
 		break;
 
 	case USB_PHY_STATE_A_IDLE:
-		iotg->otg.default_a = 1;
+		otg->default_a = 1;
 		if (iotg->hsm.id) {
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.b_bus_req = 0;
 			iotg->hsm.vbus_srp_up = 0;
 
 			langwell_otg_chrg_vbus(0);
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_bus_drop &&
 			(iotg->hsm.a_srp_det || iotg->hsm.a_bus_req)) {
 			langwell_otg_phy_low_power(0);
 
 			/* Turn on VBus */
-			iotg->otg.set_vbus(&iotg->otg, true);
+			otg->set_vbus(otg, true);
 
 			iotg->hsm.vbus_srp_up = 0;
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_bus_drop && iotg->hsm.a_sess_vld) {
 			iotg->hsm.vbus_srp_up = 1;
@@ -1228,12 +1230,12 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_phy_low_power(0);
 
 			/* Turn on VBus */
-			iotg->otg.set_vbus(&iotg->otg, true);
+			otg->set_vbus(otg, true);
 			iotg->hsm.a_srp_det = 1;
 			iotg->hsm.vbus_srp_up = 0;
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_sess_vld &&
 				!iotg->hsm.vbus_srp_up) {
@@ -1244,13 +1246,13 @@ static void langwell_otg_work(struct work_struct *work)
 		if (iotg->hsm.id) {
 			langwell_otg_del_timer(a_wait_vrise_tmr);
 			iotg->hsm.b_bus_req = 0;
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		} else if (iotg->hsm.a_vbus_vld) {
 			langwell_otg_del_timer(a_wait_vrise_tmr);
 			iotg->hsm.b_conn = 0;
@@ -1262,7 +1264,7 @@ static void langwell_otg_work(struct work_struct *work)
 			}
 
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		} else if (iotg->hsm.a_wait_vrise_tmout) {
 			iotg->hsm.b_conn = 0;
 			if (iotg->hsm.a_vbus_vld) {
@@ -1274,13 +1276,13 @@ static void langwell_otg_work(struct work_struct *work)
 					break;
 				}
 				langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-				iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
+				otg->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 			} else {
 
 				/* Turn off VBus */
-				iotg->otg.set_vbus(&iotg->otg, false);
+				otg->set_vbus(otg, false);
 				langwell_otg_phy_low_power_wait(1);
-				iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+				otg->xceiv->state = USB_PHY_STATE_A_VBUS_ERR;
 			}
 		}
 		break;
@@ -1289,7 +1291,7 @@ static void langwell_otg_work(struct work_struct *work)
 			/* delete hsm timer for a_wait_bcon_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.b_bus_req = 0;
 
 			if (lnw->iotg.stop_host)
@@ -1299,10 +1301,10 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_vbus_vld) {
 			/* delete hsm timer for a_wait_bcon_tmr */
@@ -1315,9 +1317,9 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+			otg->xceiv->state = USB_PHY_STATE_A_VBUS_ERR;
 		} else if (iotg->hsm.a_bus_drop ||
 				(iotg->hsm.a_wait_bcon_tmout &&
 				!iotg->hsm.a_bus_req)) {
@@ -1331,21 +1333,21 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+			otg->set_vbus(otg, false);
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (iotg->hsm.b_conn) {
 			/* delete hsm timer for a_wait_bcon_tmr */
 			del_timer_sync(&lnw->hsm_timer);
 
 			iotg->hsm.a_suspend_req = 0;
-			iotg->otg.state = USB_PHY_STATE_A_HOST;
-			if (iotg->hsm.a_srp_det && iotg->otg.host &&
-					!iotg->otg.host->b_hnp_enable) {
+			otg->xceiv->state = USB_PHY_STATE_A_HOST;
+			if (iotg->hsm.a_srp_det && otg->host &&
+					!otg->host->b_hnp_enable) {
 				/* SRP capable peripheral-only device */
 				iotg->hsm.a_bus_req = 1;
 				iotg->hsm.a_srp_det = 0;
-			} else if (!iotg->hsm.a_bus_req && iotg->otg.host &&
-					iotg->otg.host->b_hnp_enable) {
+			} else if (!iotg->hsm.a_bus_req && otg->host &&
+					otg->host->b_hnp_enable) {
 				/* It is not safe enough to do a fast
 				 * transition from A_WAIT_BCON to
 				 * A_SUSPEND */
@@ -1369,9 +1371,9 @@ static void langwell_otg_work(struct work_struct *work)
 				/* clear PHCD to enable HW timer */
 				langwell_otg_phy_low_power(0);
 				langwell_otg_add_timer(a_aidl_bdis_tmr);
-				iotg->otg.state = USB_PHY_STATE_A_SUSPEND;
-			} else if (!iotg->hsm.a_bus_req && iotg->otg.host &&
-				!iotg->otg.host->b_hnp_enable) {
+				otg->xceiv->state = USB_PHY_STATE_A_SUSPEND;
+			} else if (!iotg->hsm.a_bus_req && otg->host &&
+				!otg->host->b_hnp_enable) {
 				if (lnw->iotg.stop_host)
 					lnw->iotg.stop_host(&lnw->iotg);
 				else
@@ -1379,14 +1381,14 @@ static void langwell_otg_work(struct work_struct *work)
 						"host driver removed.\n");
 
 				/* Turn off VBus */
-				iotg->otg.set_vbus(&iotg->otg, false);
-				iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+				otg->set_vbus(otg, false);
+				otg->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 			}
 		}
 		break;
 	case USB_PHY_STATE_A_HOST:
 		if (iotg->hsm.id) {
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.b_bus_req = 0;
 
 			if (lnw->iotg.stop_host)
@@ -1396,14 +1398,14 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_drop ||
-				(iotg->otg.host &&
-				!iotg->otg.host->b_hnp_enable &&
+				(otg->host &&
+				!otg->host->b_hnp_enable &&
 					!iotg->hsm.a_bus_req)) {
 			if (lnw->iotg.stop_host)
 				lnw->iotg.stop_host(&lnw->iotg);
@@ -1412,8 +1414,8 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+			otg->set_vbus(otg, false);
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (!iotg->hsm.a_vbus_vld) {
 			if (lnw->iotg.stop_host)
 				lnw->iotg.stop_host(&lnw->iotg);
@@ -1422,11 +1424,11 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
-		} else if (iotg->otg.host &&
-				iotg->otg.host->b_hnp_enable &&
+			otg->xceiv->state = USB_PHY_STATE_A_VBUS_ERR;
+		} else if (otg->host &&
+				otg->host->b_hnp_enable &&
 				!iotg->hsm.a_bus_req) {
 			/* Set HABA to enable hardware assistance to signal
 			 *  A-connect after receiver B-disconnect. Hardware
@@ -1449,10 +1451,10 @@ static void langwell_otg_work(struct work_struct *work)
 			/* clear PHCD to enable HW timer */
 			langwell_otg_phy_low_power(0);
 			langwell_otg_add_timer(a_aidl_bdis_tmr);
-			iotg->otg.state = USB_PHY_STATE_A_SUSPEND;
+			otg->xceiv->state = USB_PHY_STATE_A_SUSPEND;
 		} else if (!iotg->hsm.b_conn || !iotg->hsm.a_bus_req) {
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		}
 		break;
 	case USB_PHY_STATE_A_SUSPEND:
@@ -1460,7 +1462,7 @@ static void langwell_otg_work(struct work_struct *work)
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
 			langwell_otg_HABA(0);
 			free_irq(pdev->irq, iotg->base);
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.b_bus_req = 0;
 
 			if (lnw->iotg.stop_host)
@@ -1470,10 +1472,10 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_req ||
 				iotg->hsm.b_bus_resume) {
@@ -1482,7 +1484,7 @@ static void langwell_otg_work(struct work_struct *work)
 			free_irq(pdev->irq, iotg->base);
 			iotg->hsm.a_suspend_req = 0;
 			langwell_otg_loc_sof(1);
-			iotg->otg.state = USB_PHY_STATE_A_HOST;
+			otg->xceiv->state = USB_PHY_STATE_A_HOST;
 		} else if (iotg->hsm.a_aidl_bdis_tmout ||
 				iotg->hsm.a_bus_drop) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
@@ -1495,10 +1497,10 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
-		} else if (!iotg->hsm.b_conn && iotg->otg.host &&
-				iotg->otg.host->b_hnp_enable) {
+			otg->set_vbus(otg, false);
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
+		} else if (!iotg->hsm.b_conn && otg->host &&
+				otg->host->b_hnp_enable) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
 			langwell_otg_HABA(0);
 			free_irq(pdev->irq, iotg->base);
@@ -1520,7 +1522,7 @@ static void langwell_otg_work(struct work_struct *work)
 					"client driver not loaded.\n");
 
 			langwell_otg_add_ktimer(TB_BUS_SUSPEND_TMR);
-			iotg->otg.state = USB_PHY_STATE_A_PERIPHERAL;
+			otg->xceiv->state = USB_PHY_STATE_A_PERIPHERAL;
 			break;
 		} else if (!iotg->hsm.a_vbus_vld) {
 			langwell_otg_del_timer(a_aidl_bdis_tmr);
@@ -1533,16 +1535,16 @@ static void langwell_otg_work(struct work_struct *work)
 					"host driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+			otg->xceiv->state = USB_PHY_STATE_A_VBUS_ERR;
 		}
 		break;
 	case USB_PHY_STATE_A_PERIPHERAL:
 		if (iotg->hsm.id) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.b_bus_req = 0;
 			if (lnw->iotg.stop_peripheral)
 				lnw->iotg.stop_peripheral(&lnw->iotg);
@@ -1551,10 +1553,10 @@ static void langwell_otg_work(struct work_struct *work)
 					"client driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			set_client_mode();
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (!iotg->hsm.a_vbus_vld) {
 			/* delete hsm timer for b_bus_suspend_tmr */
@@ -1567,9 +1569,9 @@ static void langwell_otg_work(struct work_struct *work)
 					"client driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
+			otg->set_vbus(otg, false);
 			langwell_otg_phy_low_power_wait(1);
-			iotg->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+			otg->xceiv->state = USB_PHY_STATE_A_VBUS_ERR;
 		} else if (iotg->hsm.a_bus_drop) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1581,8 +1583,8 @@ static void langwell_otg_work(struct work_struct *work)
 					"client driver has been removed.\n");
 
 			/* Turn off VBus */
-			iotg->otg.set_vbus(&iotg->otg, false);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+			otg->set_vbus(otg, false);
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VFALL;
 		} else if (iotg->hsm.b_bus_suspend) {
 			/* delete hsm timer for b_bus_suspend_tmr */
 			del_timer_sync(&lnw->hsm_timer);
@@ -1599,7 +1601,7 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		} else if (iotg->hsm.b_bus_suspend_tmout) {
 			u32	val;
 			val = readl(lnw->iotg.base + CI_PORTSC1);
@@ -1618,24 +1620,24 @@ static void langwell_otg_work(struct work_struct *work)
 				dev_dbg(lnw->dev,
 						"host driver not loaded.\n");
 			langwell_otg_add_ktimer(TA_WAIT_BCON_TMR);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_BCON;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_BCON;
 		}
 		break;
 	case USB_PHY_STATE_A_VBUS_ERR:
 		if (iotg->hsm.id) {
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			iotg->hsm.a_clr_err = 0;
 			iotg->hsm.a_srp_det = 0;
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_clr_err) {
 			iotg->hsm.a_clr_err = 0;
 			iotg->hsm.a_srp_det = 0;
 			reset_otg();
 			init_hsm();
-			if (iotg->otg.state == USB_PHY_STATE_A_IDLE)
+			if (otg->xceiv->state == USB_PHY_STATE_A_IDLE)
 				langwell_update_transceiver();
 		} else {
 			/* FW will clear PHCD bit when any VBus
@@ -1645,23 +1647,23 @@ static void langwell_otg_work(struct work_struct *work)
 		break;
 	case USB_PHY_STATE_A_WAIT_VFALL:
 		if (iotg->hsm.id) {
-			iotg->otg.default_a = 0;
+			otg->default_a = 0;
 			set_client_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 			langwell_update_transceiver();
 		} else if (iotg->hsm.a_bus_req) {
 
 			/* Turn on VBus */
-			iotg->otg.set_vbus(&iotg->otg, true);
+			otg->set_vbus(otg, true);
 			iotg->hsm.a_wait_vrise_tmout = 0;
 			langwell_otg_add_timer(a_wait_vrise_tmr);
-			iotg->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
+			otg->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		} else if (!iotg->hsm.a_sess_vld) {
 			iotg->hsm.a_srp_det = 0;
 			set_host_mode();
 			langwell_otg_phy_low_power(1);
-			iotg->otg.state = USB_PHY_STATE_A_IDLE;
+			otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		}
 		break;
 	default:
@@ -1669,7 +1671,7 @@ static void langwell_otg_work(struct work_struct *work)
 	}
 
 	dev_dbg(lnw->dev, "%s: new state = %s\n", __func__,
-			usb_phy_state_string(iotg->otg.state));
+			usb_phy_state_string(otg->xceiv->state));
 }
 
 static ssize_t
@@ -1713,17 +1715,18 @@ show_hsm(struct device *_dev, struct device_attribute *attr, char *buf)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 	char				*next;
 	unsigned			size, t;
 
 	next = buf;
 	size = PAGE_SIZE;
 
-	if (iotg->otg.host)
-		iotg->hsm.a_set_b_hnp_en = iotg->otg.host->b_hnp_enable;
+	if (otg->host)
+		iotg->hsm.a_set_b_hnp_en = otg->host->b_hnp_enable;
 
-	if (iotg->otg.gadget)
-		iotg->hsm.b_hnp_enable = iotg->otg.gadget->b_hnp_enable;
+	if (otg->gadget)
+		iotg->hsm.b_hnp_enable = otg->gadget->b_hnp_enable;
 
 	t = scnprintf(next, size,
 		"\n"
@@ -1755,7 +1758,7 @@ show_hsm(struct device *_dev, struct device_attribute *attr, char *buf)
 		"b_bus_req = \t%d\n"
 		"b_bus_suspend_tmout = \t%d\n"
 		"b_bus_suspend_vld = \t%d\n",
-		usb_phy_state_string(iotg->otg.state),
+		usb_phy_state_string(otg->xceiv->state),
 		iotg->hsm.a_bus_resume,
 		iotg->hsm.a_bus_suspend,
 		iotg->hsm.a_conn,
@@ -1814,8 +1817,9 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 
-	if (!iotg->otg.default_a)
+	if (!otg->default_a)
 		return -1;
 	if (count > 2)
 		return -1;
@@ -1861,8 +1865,9 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr,
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 
-	if (!iotg->otg.default_a)
+	if (!otg->default_a)
 		return -1;
 	if (count > 2)
 		return -1;
@@ -1907,8 +1912,9 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 
-	if (iotg->otg.default_a)
+	if (otg->default_a)
 		return -1;
 
 	if (count > 2)
@@ -1935,8 +1941,9 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr,
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = iotg->xceiv.otg;
 
-	if (!iotg->otg.default_a)
+	if (!otg->default_a)
 		return -1;
 	if (count > 2)
 		return -1;
@@ -1974,6 +1981,7 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 	int			retval;
 	u32			val32;
 	struct langwell_otg	*lnw;
+	struct usb_otg		*otg;
 	char			qname[] = "langwell_otg_queue";
 
 	retval = 0;
@@ -1988,6 +1996,15 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 		retval = -ENOMEM;
 		goto done;
 	}
+
+	otg = kzalloc(sizeof *otg, GFP_KERNEL);
+	if (otg == NULL) {
+		kfree(lnw);
+		retval = -ENOMEM;
+		goto done;
+	}
+
+	lnw->iotg.xceiv.otg = otg;
 	the_transceiver = lnw;
 
 	/* control register: BAR 0 */
@@ -2036,16 +2053,18 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 
 	/* OTG common part */
 	lnw->dev = &pdev->dev;
-	lnw->iotg.otg.dev = lnw->dev;
-	lnw->iotg.otg.label = driver_name;
-	lnw->iotg.otg.set_host = langwell_otg_set_host;
-	lnw->iotg.otg.set_peripheral = langwell_otg_set_peripheral;
-	lnw->iotg.otg.set_power = langwell_otg_set_power;
-	lnw->iotg.otg.set_vbus = langwell_otg_set_vbus;
-	lnw->iotg.otg.start_srp = langwell_otg_start_srp;
-	lnw->iotg.otg.state = USB_PHY_STATE_UNDEFINED;
-
-	if (otg_set_transceiver(&lnw->iotg.otg)) {
+	lnw->iotg.xceiv.dev = lnw->dev;
+	lnw->iotg.xceiv.label = driver_name;
+	lnw->iotg.xceiv.set_power = langwell_otg_set_power;
+	lnw->iotg.xceiv.state = USB_PHY_STATE_UNDEFINED;
+
+	otg->xceiv = &lnw->iotg.xceiv;
+	otg->set_host = langwell_otg_set_host;
+	otg->set_peripheral = langwell_otg_set_peripheral;
+	otg->set_vbus = langwell_otg_set_vbus;
+	otg->start_srp = langwell_otg_start_srp;
+
+	if (usb_set_transceiver(&lnw->iotg.xceiv)) {
 		dev_dbg(lnw->dev, "can't set transceiver\n");
 		retval = -EBUSY;
 		goto err;
@@ -2107,7 +2126,7 @@ static int langwell_otg_probe(struct pci_dev *pdev,
 		goto err;
 	}
 
-	if (lnw->iotg.otg.state == USB_PHY_STATE_A_IDLE)
+	if (otg->xceiv->state == USB_PHY_STATE_A_IDLE)
 		langwell_update_transceiver();
 
 	return 0;
@@ -2145,11 +2164,12 @@ static void langwell_otg_remove(struct pci_dev *pdev)
 		release_mem_region(pci_resource_start(pdev, 0),
 				pci_resource_len(pdev, 0));
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 	pci_disable_device(pdev);
 	sysfs_remove_group(&pdev->dev.kobj, &debug_dev_attr_group);
 	device_remove_file(&pdev->dev, &dev_attr_hsm);
 	device_remove_file(&pdev->dev, &dev_attr_registers);
+	kfree(lnw->iotg.xceiv.otg);
 	kfree(lnw);
 	lnw = NULL;
 }
@@ -2165,6 +2185,7 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 {
 	struct langwell_otg		*lnw = the_transceiver;
 	struct intel_mid_otg_xceiv	*iotg = &lnw->iotg;
+	struct usb_otg			*otg = lnw->iotg.xceiv.otg;
 	int				ret = 0;
 
 	/* Disbale OTG interrupts */
@@ -2179,9 +2200,9 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 	lnw->qwork = NULL;
 
 	/* start actions */
-	switch (iotg->otg.state) {
+	switch (otg->xceiv->state) {
 	case USB_PHY_STATE_A_WAIT_VFALL:
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 	case USB_PHY_STATE_A_IDLE:
 	case USB_PHY_STATE_B_IDLE:
 	case USB_PHY_STATE_A_VBUS_ERR:
@@ -2192,8 +2213,8 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
-		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->set_vbus(otg, false);
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_A_WAIT_BCON:
@@ -2206,8 +2227,8 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
-		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->set_vbus(otg, false);
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_A_HOST:
@@ -2219,9 +2240,9 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
-		iotg->otg.set_vbus(&iotg->otg, false);
+		otg->set_vbus(otg, false);
 
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_A_SUSPEND:
@@ -2234,8 +2255,8 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
-		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->set_vbus(otg, false);
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_A_PERIPHERAL:
@@ -2249,8 +2270,8 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		iotg->hsm.a_srp_det = 0;
 
 		/* Turn off VBus */
-		iotg->otg.set_vbus(&iotg->otg, false);
-		iotg->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->set_vbus(otg, false);
+		otg->xceiv->state = USB_PHY_STATE_A_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_B_HOST:
@@ -2259,7 +2280,7 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		else
 			dev_dbg(&pdev->dev, "host driver has been removed.\n");
 		iotg->hsm.b_bus_req = 0;
-		iotg->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_B_PERIPHERAL:
@@ -2268,7 +2289,7 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		else
 			dev_dbg(&pdev->dev,
 				"client driver has been removed.\n");
-		iotg->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	case USB_PHY_STATE_B_WAIT_ACON:
@@ -2282,7 +2303,7 @@ static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message)
 		else
 			dev_dbg(&pdev->dev, "host driver has been removed.\n");
 		iotg->hsm.b_bus_req = 0;
-		iotg->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 		transceiver_suspend(pdev);
 		break;
 	default:
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
index 756cf55..08687cb 100644
--- a/include/linux/usb/intel_mid_otg.h
+++ b/include/linux/usb/intel_mid_otg.h
@@ -108,7 +108,7 @@ struct iotg_ulpi_access_ops {
  * purpose.
  */
 struct intel_mid_otg_xceiv {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct otg_hsm		hsm;
 
 	/* base address */
@@ -147,9 +147,9 @@ struct intel_mid_otg_xceiv {
 
 };
 static inline
-struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
+struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *xceiv)
 {
-	return container_of(otg, struct intel_mid_otg_xceiv, otg);
+	return container_of(xceiv, struct intel_mid_otg_xceiv, xceiv);
 }
 
 #define MID_OTG_NOTIFY_CONNECT		0x0001
-- 
1.7.4.1


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

* [PATCHv5 10/19] usb: otg: nop: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (8 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 09/19] usb: otg: langwell: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 11/19] usb: otg: twl4030: " Heikki Krogerus
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/otg/nop-usb-xceiv.c |   64 ++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 6a0c102..37ce4d3 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -33,7 +33,7 @@
 #include <linux/slab.h>
 
 struct nop_usb_xceiv {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct device		*dev;
 };
 
@@ -58,51 +58,37 @@ void usb_nop_xceiv_unregister(void)
 }
 EXPORT_SYMBOL(usb_nop_xceiv_unregister);
 
-static inline struct nop_usb_xceiv *xceiv_to_nop(struct usb_phy *x)
-{
-	return container_of(x, struct nop_usb_xceiv, otg);
-}
-
 static int nop_set_suspend(struct usb_phy *x, int suspend)
 {
 	return 0;
 }
 
-static int nop_set_peripheral(struct usb_phy *x,
-		struct usb_gadget *gadget)
+static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 {
-	struct nop_usb_xceiv *nop;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	nop = xceiv_to_nop(x);
-
 	if (!gadget) {
-		nop->otg.gadget = NULL;
+		otg->gadget = NULL;
 		return -ENODEV;
 	}
 
-	nop->otg.gadget = gadget;
-	nop->otg.state = USB_PHY_STATE_B_IDLE;
+	otg->gadget = gadget;
+	otg->xceiv->state = USB_PHY_STATE_B_IDLE;
 	return 0;
 }
 
-static int nop_set_host(struct usb_phy *x, struct usb_bus *host)
+static int nop_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct nop_usb_xceiv *nop;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	nop = xceiv_to_nop(x);
-
 	if (!host) {
-		nop->otg.host = NULL;
+		otg->host = NULL;
 		return -ENODEV;
 	}
 
-	nop->otg.host = host;
+	otg->host = host;
 	return 0;
 }
 
@@ -115,15 +101,23 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
 	if (!nop)
 		return -ENOMEM;
 
+	nop->xceiv.otg = kzalloc(sizeof *nop->xceiv.otg, GFP_KERNEL);
+	if (!nop->xceiv.otg) {
+		kfree(nop);
+		return -ENOMEM;
+	}
+
 	nop->dev		= &pdev->dev;
-	nop->otg.dev		= nop->dev;
-	nop->otg.label		= "nop-xceiv";
-	nop->otg.state		= USB_PHY_STATE_UNDEFINED;
-	nop->otg.set_host	= nop_set_host;
-	nop->otg.set_peripheral	= nop_set_peripheral;
-	nop->otg.set_suspend	= nop_set_suspend;
-
-	err = otg_set_transceiver(&nop->otg);
+	nop->xceiv.dev		= nop->dev;
+	nop->xceiv.label	= "nop-xceiv";
+	nop->xceiv.set_suspend	= nop_set_suspend;
+	nop->xceiv.state	= USB_PHY_STATE_UNDEFINED;
+
+	nop->xceiv.otg->xceiv		= &nop->xceiv;
+	nop->xceiv.otg->set_host	= nop_set_host;
+	nop->xceiv.otg->set_peripheral	= nop_set_peripheral;
+
+	err = usb_set_transceiver(&nop->xceiv);
 	if (err) {
 		dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
 			err);
@@ -132,10 +126,11 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, nop);
 
-	ATOMIC_INIT_NOTIFIER_HEAD(&nop->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&nop->xceiv.notifier);
 
 	return 0;
 exit:
+	kfree(nop->xceiv.otg);
 	kfree(nop);
 	return err;
 }
@@ -144,9 +139,10 @@ static int __devexit nop_usb_xceiv_remove(struct platform_device *pdev)
 {
 	struct nop_usb_xceiv *nop = platform_get_drvdata(pdev);
 
-	otg_set_transceiver(NULL);
+	usb_set_transceiver(NULL);
 
 	platform_set_drvdata(pdev, NULL);
+	kfree(nop->xceiv.otg);
 	kfree(nop);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCHv5 11/19] usb: otg: twl4030: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (9 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 10/19] usb: otg: nop: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 12/19] usb: otg: twl6030: " Heikki Krogerus
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/otg/twl4030-usb.c |   77 +++++++++++++++++++++++------------------
 1 files changed, 43 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 9eed1f3..4151004 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -144,7 +144,7 @@
 #define GPIO_USB_4PIN_ULPI_2430C	(3 << 0)
 
 struct twl4030_usb {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct device		*dev;
 
 	/* TWL4030 internal USB regulator supplies */
@@ -166,7 +166,7 @@ struct twl4030_usb {
 };
 
 /* internal define on top of container_of */
-#define xceiv_to_twl(x)		container_of((x), struct twl4030_usb, otg)
+#define xceiv_to_twl(x)		container_of((x), struct twl4030_usb, xceiv)
 
 /*-------------------------------------------------------------------------*/
 
@@ -250,6 +250,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 {
 	int	status;
 	int	linkstat = USB_EVENT_NONE;
+	struct usb_otg *otg = twl->xceiv.otg;
 
 	twl->vbus_supplied = false;
 
@@ -281,7 +282,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
 			status, status, linkstat);
 
-	twl->otg.last_event = linkstat;
+	twl->xceiv.last_event = linkstat;
 
 	/* REVISIT this assumes host and peripheral controllers
 	 * are registered, and that both are active...
@@ -290,11 +291,11 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
 	spin_lock_irq(&twl->lock);
 	twl->linkstat = linkstat;
 	if (linkstat == USB_EVENT_ID) {
-		twl->otg.default_a = true;
-		twl->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->default_a = true;
+		twl->xceiv.state = USB_PHY_STATE_A_IDLE;
 	} else {
-		twl->otg.default_a = false;
-		twl->otg.state = USB_PHY_STATE_B_IDLE;
+		otg->default_a = false;
+		twl->xceiv.state = USB_PHY_STATE_B_IDLE;
 	}
 	spin_unlock_irq(&twl->lock);
 
@@ -520,8 +521,8 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl)
 		else
 			twl4030_phy_resume(twl);
 
-		atomic_notifier_call_chain(&twl->otg.notifier, status,
-				twl->otg.gadget);
+		atomic_notifier_call_chain(&twl->xceiv.notifier, status,
+				twl->xceiv.otg->gadget);
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
 
@@ -542,8 +543,8 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl)
 			twl->asleep = 0;
 		}
 
-		atomic_notifier_call_chain(&twl->otg.notifier, status,
-				twl->otg.gadget);
+		atomic_notifier_call_chain(&twl->xceiv.notifier, status,
+				twl->xceiv.otg->gadget);
 	}
 	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
 }
@@ -560,33 +561,27 @@ static int twl4030_set_suspend(struct usb_phy *x, int suspend)
 	return 0;
 }
 
-static int twl4030_set_peripheral(struct usb_phy *x,
-		struct usb_gadget *gadget)
+static int twl4030_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
-	struct twl4030_usb *twl;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	twl = xceiv_to_twl(x);
-	twl->otg.gadget = gadget;
+	otg->gadget = gadget;
 	if (!gadget)
-		twl->otg.state = USB_PHY_STATE_UNDEFINED;
+		otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
 
-static int twl4030_set_host(struct usb_phy *x, struct usb_bus *host)
+static int twl4030_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct twl4030_usb *twl;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	twl = xceiv_to_twl(x);
-	twl->otg.host = host;
+	otg->host = host;
 	if (!host)
-		twl->otg.state = USB_PHY_STATE_UNDEFINED;
+		otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
@@ -596,6 +591,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	struct twl4030_usb_data *pdata = pdev->dev.platform_data;
 	struct twl4030_usb	*twl;
 	int			status, err;
+	struct usb_otg		*otg;
 
 	if (!pdata) {
 		dev_dbg(&pdev->dev, "platform_data not available\n");
@@ -606,16 +602,26 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	if (!twl)
 		return -ENOMEM;
 
+	otg = kzalloc(sizeof *otg, GFP_KERNEL);
+	if (!otg) {
+		kfree(twl);
+		return -ENOMEM;
+	}
+
 	twl->dev		= &pdev->dev;
 	twl->irq		= platform_get_irq(pdev, 0);
-	twl->otg.dev		= twl->dev;
-	twl->otg.label		= "twl4030";
-	twl->otg.set_host	= twl4030_set_host;
-	twl->otg.set_peripheral	= twl4030_set_peripheral;
-	twl->otg.set_suspend	= twl4030_set_suspend;
 	twl->usb_mode		= pdata->usb_mode;
 	twl->vbus_supplied	= false;
-	twl->asleep = 1;
+	twl->asleep		= 1;
+
+	twl->xceiv.dev		= twl->dev;
+	twl->xceiv.label	= "twl4030";
+	twl->xceiv.otg		= otg;
+	twl->xceiv.set_suspend	= twl4030_set_suspend;
+
+	otg->xceiv		= &twl->xceiv;
+	otg->set_host		= twl4030_set_host;
+	otg->set_peripheral	= twl4030_set_peripheral;
 
 	/* init spinlock for workqueue */
 	spin_lock_init(&twl->lock);
@@ -623,16 +629,17 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	err = twl4030_usb_ldo_init(twl);
 	if (err) {
 		dev_err(&pdev->dev, "ldo init failed\n");
+		kfree(otg);
 		kfree(twl);
 		return err;
 	}
-	otg_set_transceiver(&twl->otg);
+	usb_set_transceiver(&twl->xceiv);
 
 	platform_set_drvdata(pdev, twl);
 	if (device_create_file(&pdev->dev, &dev_attr_vbus))
 		dev_warn(&pdev->dev, "could not create sysfs file\n");
 
-	ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&twl->xceiv.notifier);
 
 	/* Our job is to use irqs and status from the power module
 	 * to keep the transceiver disabled when nothing's connected.
@@ -649,6 +656,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
 	if (status < 0) {
 		dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n",
 			twl->irq, status);
+		kfree(otg);
 		kfree(twl);
 		return status;
 	}
@@ -693,6 +701,7 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
 	regulator_put(twl->usb1v8);
 	regulator_put(twl->usb3v1);
 
+	kfree(twl->xceiv.otg);
 	kfree(twl);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCHv5 12/19] usb: otg: twl6030: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (10 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 11/19] usb: otg: twl4030: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 13/19] usb: otg: ulpi: " Heikki Krogerus
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Hema HK

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Hema HK <hemahk@ti.com>
---
 drivers/usb/otg/twl6030-usb.c |  105 ++++++++++++++++++++++------------------
 1 files changed, 58 insertions(+), 47 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 720ab7d..843c47d 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -87,7 +87,7 @@
 #define	VBUS_DET			BIT(2)
 
 struct twl6030_usb {
-	struct usb_phy		otg;
+	struct usb_phy		xceiv;
 	struct device		*dev;
 
 	/* for vbus reporting with irqs disabled */
@@ -107,7 +107,7 @@ struct twl6030_usb {
 	unsigned long		features;
 };
 
-#define xceiv_to_twl(x)		container_of((x), struct twl6030_usb, otg)
+#define xceiv_to_twl(x)		container_of((x), struct twl6030_usb, xceiv)
 
 /*-------------------------------------------------------------------------*/
 
@@ -194,9 +194,9 @@ static int twl6030_phy_suspend(struct usb_phy *x, int suspend)
 	return 0;
 }
 
-static int twl6030_start_srp(struct usb_phy *x)
+static int twl6030_start_srp(struct usb_otg *otg)
 {
-	struct twl6030_usb *twl = xceiv_to_twl(x);
+	struct twl6030_usb *twl = xceiv_to_twl(otg->xceiv);
 
 	twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET);
 	twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET);
@@ -272,6 +272,7 @@ static DEVICE_ATTR(vbus, 0444, twl6030_usb_vbus_show, NULL);
 static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 {
 	struct twl6030_usb *twl = _twl;
+	struct usb_otg *otg = twl->xceiv.otg;
 	int status;
 	u8 vbus_state, hw_state;
 
@@ -284,18 +285,18 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 			regulator_enable(twl->usb3v3);
 			twl->asleep = 1;
 			status = USB_EVENT_VBUS;
-			twl->otg.default_a = false;
-			twl->otg.state = USB_PHY_STATE_B_IDLE;
+			otg->default_a = false;
+			twl->xceiv.state = USB_PHY_STATE_B_IDLE;
 			twl->linkstat = status;
-			twl->otg.last_event = status;
-			atomic_notifier_call_chain(&twl->otg.notifier,
-						status, twl->otg.gadget);
+			twl->xceiv.last_event = status;
+			atomic_notifier_call_chain(&twl->xceiv.notifier,
+						status, otg->gadget);
 		} else {
 			status = USB_EVENT_NONE;
 			twl->linkstat = status;
-			twl->otg.last_event = status;
-			atomic_notifier_call_chain(&twl->otg.notifier,
-						status, twl->otg.gadget);
+			twl->xceiv.last_event = status;
+			atomic_notifier_call_chain(&twl->xceiv.notifier,
+						status, otg->gadget);
 			if (twl->asleep) {
 				regulator_disable(twl->usb3v3);
 				twl->asleep = 0;
@@ -310,6 +311,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
 static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 {
 	struct twl6030_usb *twl = _twl;
+	struct usb_otg *otg = twl->xceiv.otg;
 	int status = USB_EVENT_NONE;
 	u8 hw_state;
 
@@ -323,12 +325,12 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
 								0x10);
 		status = USB_EVENT_ID;
-		twl->otg.default_a = true;
-		twl->otg.state = USB_PHY_STATE_A_IDLE;
+		otg->default_a = true;
+		twl->xceiv.state = USB_PHY_STATE_A_IDLE;
 		twl->linkstat = status;
-		twl->otg.last_event = status;
-		atomic_notifier_call_chain(&twl->otg.notifier, status,
-							twl->otg.gadget);
+		twl->xceiv.last_event = status;
+		atomic_notifier_call_chain(&twl->xceiv.notifier, status,
+							otg->gadget);
 	} else  {
 		twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
 								0x10);
@@ -340,18 +342,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
 	return IRQ_HANDLED;
 }
 
-static int twl6030_set_peripheral(struct usb_phy *x,
-		struct usb_gadget *gadget)
+static int twl6030_set_peripheral(struct usb_otg *otg,
+					struct usb_gadget *gadget)
 {
-	struct twl6030_usb *twl;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	twl = xceiv_to_twl(x);
-	twl->otg.gadget = gadget;
+	otg->gadget = gadget;
 	if (!gadget)
-		twl->otg.state = USB_PHY_STATE_UNDEFINED;
+		otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 
 	return 0;
 }
@@ -392,9 +391,9 @@ static void otg_set_vbus_work(struct work_struct *data)
 							CHARGERUSB_CTRL1);
 }
 
-static int twl6030_set_vbus(struct usb_phy *x, bool enabled)
+static int twl6030_set_vbus(struct usb_otg *otg, bool enabled)
 {
-	struct twl6030_usb *twl = xceiv_to_twl(x);
+	struct twl6030_usb *twl = xceiv_to_twl(otg->xceiv);
 
 	twl->vbus_enable = enabled;
 	schedule_work(&twl->set_vbus_work);
@@ -402,17 +401,14 @@ static int twl6030_set_vbus(struct usb_phy *x, bool enabled)
 	return 0;
 }
 
-static int twl6030_set_host(struct usb_phy *x, struct usb_bus *host)
+static int twl6030_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	struct twl6030_usb *twl;
-
-	if (!x)
+	if (!otg)
 		return -ENODEV;
 
-	twl = xceiv_to_twl(x);
-	twl->otg.host = host;
+	otg->host = host;
 	if (!host)
-		twl->otg.state = USB_PHY_STATE_UNDEFINED;
+		otg->xceiv->state = USB_PHY_STATE_UNDEFINED;
 	return 0;
 }
 
@@ -421,6 +417,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 	struct twl6030_usb	*twl;
 	int			status, err;
 	struct twl4030_usb_data *pdata;
+	struct usb_otg		*otg;
 	struct device *dev = &pdev->dev;
 	pdata = dev->platform_data;
 
@@ -428,19 +425,29 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 	if (!twl)
 		return -ENOMEM;
 
+	otg = kzalloc(sizeof *otg, GFP_KERNEL);
+	if (!otg) {
+		kfree(twl);
+		return -ENOMEM;
+	}
+
 	twl->dev		= &pdev->dev;
 	twl->irq1		= platform_get_irq(pdev, 0);
 	twl->irq2		= platform_get_irq(pdev, 1);
 	twl->features		= pdata->features;
-	twl->otg.dev		= twl->dev;
-	twl->otg.label		= "twl6030";
-	twl->otg.set_host	= twl6030_set_host;
-	twl->otg.set_peripheral	= twl6030_set_peripheral;
-	twl->otg.set_vbus	= twl6030_set_vbus;
-	twl->otg.init		= twl6030_phy_init;
-	twl->otg.shutdown	= twl6030_phy_shutdown;
-	twl->otg.set_suspend	= twl6030_phy_suspend;
-	twl->otg.start_srp	= twl6030_start_srp;
+
+	twl->xceiv.dev		= twl->dev;
+	twl->xceiv.label	= "twl6030";
+	twl->xceiv.otg		= otg;
+	twl->xceiv.init		= twl6030_phy_init;
+	twl->xceiv.shutdown	= twl6030_phy_shutdown;
+	twl->xceiv.set_suspend	= twl6030_phy_suspend;
+
+	otg->xceiv		= &twl->xceiv;
+	otg->set_host		= twl6030_set_host;
+	otg->set_peripheral	= twl6030_set_peripheral;
+	otg->set_vbus		= twl6030_set_vbus;
+	otg->start_srp		= twl6030_start_srp;
 
 	/* init spinlock for workqueue */
 	spin_lock_init(&twl->lock);
@@ -448,16 +455,17 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 	err = twl6030_usb_ldo_init(twl);
 	if (err) {
 		dev_err(&pdev->dev, "ldo init failed\n");
+		kfree(otg);
 		kfree(twl);
 		return err;
 	}
-	otg_set_transceiver(&twl->otg);
+	usb_set_transceiver(&twl->xceiv);
 
 	platform_set_drvdata(pdev, twl);
 	if (device_create_file(&pdev->dev, &dev_attr_vbus))
 		dev_warn(&pdev->dev, "could not create sysfs file\n");
 
-	ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier);
+	ATOMIC_INIT_NOTIFIER_HEAD(&twl->xceiv.notifier);
 
 	INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
 
@@ -469,6 +477,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
 			twl->irq1, status);
 		device_remove_file(twl->dev, &dev_attr_vbus);
+		kfree(otg);
 		kfree(twl);
 		return status;
 	}
@@ -481,14 +490,15 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 			twl->irq2, status);
 		free_irq(twl->irq1, twl);
 		device_remove_file(twl->dev, &dev_attr_vbus);
+		kfree(otg);
 		kfree(twl);
 		return status;
 	}
 
 	twl->asleep = 0;
 	pdata->phy_init(dev);
-	twl6030_phy_suspend(&twl->otg, 0);
-	twl6030_enable_irq(&twl->otg);
+	twl6030_phy_suspend(&twl->xceiv, 0);
+	twl6030_enable_irq(&twl->xceiv);
 	dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
 
 	return 0;
@@ -512,6 +522,7 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev)
 	pdata->phy_exit(twl->dev);
 	device_remove_file(twl->dev, &dev_attr_vbus);
 	cancel_work_sync(&twl->set_vbus_work);
+	kfree(twl->xceiv.otg);
 	kfree(twl);
 
 	return 0;
-- 
1.7.4.1


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

* [PATCHv5 13/19] usb: otg: ulpi: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (11 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 12/19] usb: otg: twl6030: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-10-24 12:28   ` Igor Grinberg
  2011-09-26 11:21 ` [PATCHv5 14/19] arm: imx: " Heikki Krogerus
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 arch/arm/mach-pxa/pxa3xx-ulpi.c       |    6 +-
 arch/arm/plat-mxc/include/mach/ulpi.h |    2 +-
 arch/arm/plat-mxc/ulpi.c              |    2 +-
 drivers/usb/otg/ulpi.c                |  114 ++++++++++++++++++---------------
 drivers/usb/otg/ulpi_viewport.c       |    2 +-
 include/linux/usb/ulpi.h              |    4 +-
 6 files changed, 71 insertions(+), 59 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index 83e185d..a299e11 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -111,7 +111,7 @@ static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 	return pxa310_ulpi_poll();
 }
 
-struct otg_io_access_ops pxa310_ulpi_access_ops = {
+struct usb_phy_io_ops pxa310_ulpi_access_ops = {
 	.read	= pxa310_ulpi_read,
 	.write	= pxa310_ulpi_write,
 };
@@ -139,7 +139,7 @@ static int pxa310_start_otg_host_transcvr(struct usb_bus *host)
 
 	pxa310_otg_transceiver_rtsm();
 
-	err = otg_init(u2d->otg);
+	err = usb_phy_init(u2d->otg);
 	if (err) {
 		pr_err("OTG transceiver init failed");
 		return err;
@@ -191,7 +191,7 @@ static void pxa310_stop_otg_hc(void)
 
 	otg_set_host(u2d->otg, NULL);
 	otg_set_vbus(u2d->otg, 0);
-	otg_shutdown(u2d->otg);
+	usb_phy_shutdown(u2d->otg);
 }
 
 static void pxa310_u2d_setup_otg_hc(void)
diff --git a/arch/arm/plat-mxc/include/mach/ulpi.h b/arch/arm/plat-mxc/include/mach/ulpi.h
index d39d94a..42bdaca 100644
--- a/arch/arm/plat-mxc/include/mach/ulpi.h
+++ b/arch/arm/plat-mxc/include/mach/ulpi.h
@@ -10,7 +10,7 @@ static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
 }
 #endif
 
-extern struct otg_io_access_ops mxc_ulpi_access_ops;
+extern struct usb_phy_io_ops mxc_ulpi_access_ops;
 
 #endif /* __MACH_ULPI_H */
 
diff --git a/arch/arm/plat-mxc/ulpi.c b/arch/arm/plat-mxc/ulpi.c
index 8eeeb6b..d296342 100644
--- a/arch/arm/plat-mxc/ulpi.c
+++ b/arch/arm/plat-mxc/ulpi.c
@@ -106,7 +106,7 @@ static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
 	return ulpi_poll(view, ULPIVW_RUN);
 }
 
-struct otg_io_access_ops mxc_ulpi_access_ops = {
+struct usb_phy_io_ops mxc_ulpi_access_ops = {
 	.read	= ulpi_read,
 	.write	= ulpi_write,
 };
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index abc2339..b109258 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -48,31 +48,31 @@ static struct ulpi_info ulpi_ids[] = {
 	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
 };
 
-static int ulpi_set_otg_flags(struct usb_phy *otg)
+static int ulpi_set_otg_flags(struct usb_phy *xceiv)
 {
 	unsigned int flags = ULPI_OTG_CTRL_DP_PULLDOWN |
 			     ULPI_OTG_CTRL_DM_PULLDOWN;
 
-	if (otg->flags & ULPI_OTG_ID_PULLUP)
+	if (xceiv->flags & ULPI_OTG_ID_PULLUP)
 		flags |= ULPI_OTG_CTRL_ID_PULLUP;
 
 	/*
 	 * ULPI Specification rev.1.1 default
 	 * for Dp/DmPulldown is enabled.
 	 */
-	if (otg->flags & ULPI_OTG_DP_PULLDOWN_DIS)
+	if (xceiv->flags & ULPI_OTG_DP_PULLDOWN_DIS)
 		flags &= ~ULPI_OTG_CTRL_DP_PULLDOWN;
 
-	if (otg->flags & ULPI_OTG_DM_PULLDOWN_DIS)
+	if (xceiv->flags & ULPI_OTG_DM_PULLDOWN_DIS)
 		flags &= ~ULPI_OTG_CTRL_DM_PULLDOWN;
 
-	if (otg->flags & ULPI_OTG_EXTVBUSIND)
+	if (xceiv->flags & ULPI_OTG_EXTVBUSIND)
 		flags |= ULPI_OTG_CTRL_EXTVBUSIND;
 
-	return otg_io_write(otg, flags, ULPI_OTG_CTRL);
+	return usb_phy_io_write(xceiv, flags, ULPI_OTG_CTRL);
 }
 
-static int ulpi_set_fc_flags(struct usb_phy *otg)
+static int ulpi_set_fc_flags(struct usb_phy *xceiv)
 {
 	unsigned int flags = 0;
 
@@ -80,27 +80,27 @@ static int ulpi_set_fc_flags(struct usb_phy *otg)
 	 * ULPI Specification rev.1.1 default
 	 * for XcvrSelect is Full Speed.
 	 */
-	if (otg->flags & ULPI_FC_HS)
+	if (xceiv->flags & ULPI_FC_HS)
 		flags |= ULPI_FUNC_CTRL_HIGH_SPEED;
-	else if (otg->flags & ULPI_FC_LS)
+	else if (xceiv->flags & ULPI_FC_LS)
 		flags |= ULPI_FUNC_CTRL_LOW_SPEED;
-	else if (otg->flags & ULPI_FC_FS4LS)
+	else if (xceiv->flags & ULPI_FC_FS4LS)
 		flags |= ULPI_FUNC_CTRL_FS4LS;
 	else
 		flags |= ULPI_FUNC_CTRL_FULL_SPEED;
 
-	if (otg->flags & ULPI_FC_TERMSEL)
+	if (xceiv->flags & ULPI_FC_TERMSEL)
 		flags |= ULPI_FUNC_CTRL_TERMSELECT;
 
 	/*
 	 * ULPI Specification rev.1.1 default
 	 * for OpMode is Normal Operation.
 	 */
-	if (otg->flags & ULPI_FC_OP_NODRV)
+	if (xceiv->flags & ULPI_FC_OP_NODRV)
 		flags |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
-	else if (otg->flags & ULPI_FC_OP_DIS_NRZI)
+	else if (xceiv->flags & ULPI_FC_OP_DIS_NRZI)
 		flags |= ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI;
-	else if (otg->flags & ULPI_FC_OP_NSYNC_NEOP)
+	else if (xceiv->flags & ULPI_FC_OP_NSYNC_NEOP)
 		flags |= ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP;
 	else
 		flags |= ULPI_FUNC_CTRL_OPMODE_NORMAL;
@@ -111,54 +111,54 @@ static int ulpi_set_fc_flags(struct usb_phy *otg)
 	 */
 	flags |= ULPI_FUNC_CTRL_SUSPENDM;
 
-	return otg_io_write(otg, flags, ULPI_FUNC_CTRL);
+	return usb_phy_io_write(xceiv, flags, ULPI_FUNC_CTRL);
 }
 
-static int ulpi_set_ic_flags(struct usb_phy *otg)
+static int ulpi_set_ic_flags(struct usb_phy *xceiv)
 {
 	unsigned int flags = 0;
 
-	if (otg->flags & ULPI_IC_AUTORESUME)
+	if (xceiv->flags & ULPI_IC_AUTORESUME)
 		flags |= ULPI_IFC_CTRL_AUTORESUME;
 
-	if (otg->flags & ULPI_IC_EXTVBUS_INDINV)
+	if (xceiv->flags & ULPI_IC_EXTVBUS_INDINV)
 		flags |= ULPI_IFC_CTRL_EXTERNAL_VBUS;
 
-	if (otg->flags & ULPI_IC_IND_PASSTHRU)
+	if (xceiv->flags & ULPI_IC_IND_PASSTHRU)
 		flags |= ULPI_IFC_CTRL_PASSTHRU;
 
-	if (otg->flags & ULPI_IC_PROTECT_DIS)
+	if (xceiv->flags & ULPI_IC_PROTECT_DIS)
 		flags |= ULPI_IFC_CTRL_PROTECT_IFC_DISABLE;
 
-	return otg_io_write(otg, flags, ULPI_IFC_CTRL);
+	return usb_phy_io_write(xceiv, flags, ULPI_IFC_CTRL);
 }
 
-static int ulpi_set_flags(struct usb_phy *otg)
+static int ulpi_set_flags(struct usb_phy *xceiv)
 {
 	int ret;
 
-	ret = ulpi_set_otg_flags(otg);
+	ret = ulpi_set_otg_flags(xceiv);
 	if (ret)
 		return ret;
 
-	ret = ulpi_set_ic_flags(otg);
+	ret = ulpi_set_ic_flags(xceiv);
 	if (ret)
 		return ret;
 
-	return ulpi_set_fc_flags(otg);
+	return ulpi_set_fc_flags(xceiv);
 }
 
-static int ulpi_check_integrity(struct usb_phy *otg)
+static int ulpi_check_integrity(struct usb_phy *xceiv)
 {
 	int ret, i;
 	unsigned int val = 0x55;
 
 	for (i = 0; i < 2; i++) {
-		ret = otg_io_write(otg, val, ULPI_SCRATCH);
+		ret = usb_phy_io_write(xceiv, val, ULPI_SCRATCH);
 		if (ret < 0)
 			return ret;
 
-		ret = otg_io_read(otg, ULPI_SCRATCH);
+		ret = usb_phy_io_read(xceiv, ULPI_SCRATCH);
 		if (ret < 0)
 			return ret;
 
@@ -174,13 +174,13 @@ static int ulpi_check_integrity(struct usb_phy *otg)
 	return 0;
 }
 
-static int ulpi_init(struct usb_phy *otg)
+static int ulpi_init(struct usb_phy *xceiv)
 {
 	int i, vid, pid, ret;
 	u32 ulpi_id = 0;
 
 	for (i = 0; i < 4; i++) {
-		ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i);
+		ret = usb_phy_io_read(xceiv, ULPI_PRODUCT_ID_HIGH - i);
 		if (ret < 0)
 			return ret;
 		ulpi_id = (ulpi_id << 8) | ret;
@@ -198,16 +198,17 @@ static int ulpi_init(struct usb_phy *otg)
 		}
 	}
 
-	ret = ulpi_check_integrity(otg);
+	ret = ulpi_check_integrity(xceiv);
 	if (ret)
 		return ret;
 
-	return ulpi_set_flags(otg);
+	return ulpi_set_flags(xceiv);
 }
 
-static int ulpi_set_host(struct usb_phy *otg, struct usb_bus *host)
+static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	unsigned int flags = otg_io_read(otg, ULPI_IFC_CTRL);
+	struct usb_phy *xceiv = otg->xceiv;
+	unsigned int flags = usb_phy_io_read(xceiv, ULPI_IFC_CTRL);
 
 	if (!host) {
 		otg->host = NULL;
@@ -220,51 +221,62 @@ static int ulpi_set_host(struct usb_phy *otg, struct usb_bus *host)
 		   ULPI_IFC_CTRL_3_PIN_SERIAL_MODE |
 		   ULPI_IFC_CTRL_CARKITMODE);
 
-	if (otg->flags & ULPI_IC_6PIN_SERIAL)
+	if (xceiv->flags & ULPI_IC_6PIN_SERIAL)
 		flags |= ULPI_IFC_CTRL_6_PIN_SERIAL_MODE;
-	else if (otg->flags & ULPI_IC_3PIN_SERIAL)
+	else if (xceiv->flags & ULPI_IC_3PIN_SERIAL)
 		flags |= ULPI_IFC_CTRL_3_PIN_SERIAL_MODE;
-	else if (otg->flags & ULPI_IC_CARKIT)
+	else if (xceiv->flags & ULPI_IC_CARKIT)
 		flags |= ULPI_IFC_CTRL_CARKITMODE;
 
-	return otg_io_write(otg, flags, ULPI_IFC_CTRL);
+	return usb_phy_io_write(xceiv, flags, ULPI_IFC_CTRL);
 }
 
-static int ulpi_set_vbus(struct usb_phy *otg, bool on)
+static int ulpi_set_vbus(struct usb_otg *otg, bool on)
 {
-	unsigned int flags = otg_io_read(otg, ULPI_OTG_CTRL);
+	struct usb_phy *xceiv = otg->xceiv;
+	unsigned int flags = usb_phy_io_read(xceiv, ULPI_OTG_CTRL);
 
 	flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT);
 
 	if (on) {
-		if (otg->flags & ULPI_OTG_DRVVBUS)
+		if (xceiv->flags & ULPI_OTG_DRVVBUS)
 			flags |= ULPI_OTG_CTRL_DRVVBUS;
 
-		if (otg->flags & ULPI_OTG_DRVVBUS_EXT)
+		if (xceiv->flags & ULPI_OTG_DRVVBUS_EXT)
 			flags |= ULPI_OTG_CTRL_DRVVBUS_EXT;
 	}
 
-	return otg_io_write(otg, flags, ULPI_OTG_CTRL);
+	return usb_phy_io_write(xceiv, flags, ULPI_OTG_CTRL);
 }
 
 struct usb_phy *
-otg_ulpi_create(struct otg_io_access_ops *ops,
+otg_ulpi_create(struct usb_phy_io_ops *ops,
 		unsigned int flags)
 {
-	struct usb_phy *otg;
+	struct usb_phy *xceiv;
+	struct usb_otg *otg;
+
+	xceiv = kzalloc(sizeof(*xceiv), GFP_KERNEL);
+	if (!xceiv)
+		return NULL;
 
 	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
-	if (!otg)
+	if (!otg) {
+		kfree(xceiv);
 		return NULL;
+	}
+
+	xceiv->label	= "ULPI";
+	xceiv->flags	= flags;
+	xceiv->io_ops	= ops;
+	xceiv->otg	= otg;
+	xceiv->init	= ulpi_init;
 
-	otg->label	= "ULPI";
-	otg->flags	= flags;
-	otg->io_ops	= ops;
-	otg->init	= ulpi_init;
+	otg->xceiv	= xceiv;
 	otg->set_host	= ulpi_set_host;
 	otg->set_vbus	= ulpi_set_vbus;
 
-	return otg;
+	return xceiv;
 }
 EXPORT_SYMBOL_GPL(otg_ulpi_create);
 
diff --git a/drivers/usb/otg/ulpi_viewport.c b/drivers/usb/otg/ulpi_viewport.c
index e7b311b..c5ba7e5 100644
--- a/drivers/usb/otg/ulpi_viewport.c
+++ b/drivers/usb/otg/ulpi_viewport.c
@@ -74,7 +74,7 @@ static int ulpi_viewport_write(struct usb_phy *otg, u32 val, u32 reg)
 	return ulpi_viewport_wait(view, ULPI_VIEW_RUN);
 }
 
-struct otg_io_access_ops ulpi_viewport_access_ops = {
+struct usb_phy_io_ops ulpi_viewport_access_ops = {
 	.read	= ulpi_viewport_read,
 	.write	= ulpi_viewport_write,
 };
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 51ebf72..6f033a4 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -181,12 +181,12 @@
 
 /*-------------------------------------------------------------------------*/
 
-struct usb_phy *otg_ulpi_create(struct otg_io_access_ops *ops,
+struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
 					unsigned int flags);
 
 #ifdef CONFIG_USB_ULPI_VIEWPORT
 /* access ops for controllers with a viewport register */
-extern struct otg_io_access_ops ulpi_viewport_access_ops;
+extern struct usb_phy_io_ops ulpi_viewport_access_ops;
 #endif
 
 #endif /* __LINUX_USB_ULPI_H */
-- 
1.7.4.1


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

* [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (12 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 13/19] usb: otg: ulpi: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-10-03 13:04   ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 15/19] usb: musb: " Heikki Krogerus
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Sascha Hauer

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Includes fixes from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/mx31moboard-devboard.c |   22 ++++++++++++++--------
 arch/arm/mach-imx/mx31moboard-marxbot.c  |   22 ++++++++++++++--------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c
index 9cd4a97..cc285e5 100644
--- a/arch/arm/mach-imx/mx31moboard-devboard.c
+++ b/arch/arm/mach-imx/mx31moboard-devboard.c
@@ -177,7 +177,7 @@ static int devboard_isp1105_init(struct usb_phy *otg)
 }
 
 
-static int devboard_isp1105_set_vbus(struct usb_phy *otg, bool on)
+static int devboard_isp1105_set_vbus(struct usb_otg *otg, bool on)
 {
 	if (on)
 		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -194,18 +194,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 
 static int __init devboard_usbh1_init(void)
 {
-	struct usb_phy *otg;
+	struct usb_phy *phy;
 	struct platform_device *pdev;
 
-	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
-	if (!otg)
+	phy = kzalloc(sizeof(*phy), GFP_KERNEL);
+	if (!phy)
 		return -ENOMEM;
 
-	otg->label	= "ISP1105";
-	otg->init	= devboard_isp1105_init;
-	otg->set_vbus	= devboard_isp1105_set_vbus;
+	phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!phy->otg) {
+		kfree(phy);
+		return -ENOMEM;
+	}
+
+	phy->label	= "ISP1105";
+	phy->init	= devboard_isp1105_init;
+	phy->otg->set_vbus	= devboard_isp1105_set_vbus;
 
-	usbh1_pdata.otg = otg;
+	usbh1_pdata.otg = phy;
 
 	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
 	if (IS_ERR(pdev))
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c
index 2be769b..135c90e 100644
--- a/arch/arm/mach-imx/mx31moboard-marxbot.c
+++ b/arch/arm/mach-imx/mx31moboard-marxbot.c
@@ -291,7 +291,7 @@ static int marxbot_isp1105_init(struct usb_phy *otg)
 }
 
 
-static int marxbot_isp1105_set_vbus(struct usb_phy *otg, bool on)
+static int marxbot_isp1105_set_vbus(struct usb_otg *otg, bool on)
 {
 	if (on)
 		gpio_set_value(USBH1_VBUSEN_B, 0);
@@ -308,18 +308,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = {
 
 static int __init marxbot_usbh1_init(void)
 {
-	struct usb_phy *otg;
+	struct usb_phy *phy;
 	struct platform_device *pdev;
 
-	otg = kzalloc(sizeof(*otg), GFP_KERNEL);
-	if (!otg)
+	phy = kzalloc(sizeof(*phy), GFP_KERNEL);
+	if (!phy)
 		return -ENOMEM;
 
-	otg->label	= "ISP1105";
-	otg->init	= marxbot_isp1105_init;
-	otg->set_vbus	= marxbot_isp1105_set_vbus;
+	phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!phy->otg) {
+		kfree(phy);
+		return -ENOMEM;
+	}
+
+	phy->label	= "ISP1105";
+	phy->init	= marxbot_isp1105_init;
+	phy->otg->set_vbus	= marxbot_isp1105_set_vbus;
 
-	usbh1_pdata.otg = otg;
+	usbh1_pdata.otg = phy;
 
 	pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
 	if (IS_ERR(pdev))
-- 
1.7.4.1


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

* [PATCHv5 15/19] usb: musb: Start using struct usb_otg
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (13 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 14/19] arm: imx: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 16/19] power_supply: Convert all users to new usb_phy Heikki Krogerus
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/musb/am35x.c        |    5 +++--
 drivers/usb/musb/da8xx.c        |    5 +++--
 drivers/usb/musb/davinci.c      |    7 ++++---
 drivers/usb/musb/musb_core.c    |   11 ++++++-----
 drivers/usb/musb/musb_virthub.c |    9 ++++++---
 drivers/usb/musb/omap2430.c     |    5 +++--
 drivers/usb/musb/tusb6010.c     |   14 ++++++++------
 7 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index ee1c43e..8325ecf 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -226,6 +226,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
 	struct device *dev = musb->controller;
 	struct musb_hdrc_platform_data *plat = dev->platform_data;
 	struct omap_musb_board_data *data = plat->board_data;
+	struct usb_otg *otg = musb->xceiv->otg;
 	unsigned long flags;
 	irqreturn_t ret = IRQ_NONE;
 	u32 epintr, usbintr;
@@ -289,14 +290,14 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
-			musb->xceiv->default_a = 1;
+			otg->default_a = 1;
 			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
-			musb->xceiv->default_a = 0;
+			otg->default_a = 0;
 			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index fc982fa..61813b5 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -294,6 +294,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
 {
 	struct musb		*musb = hci;
 	void __iomem		*reg_base = musb->ctrl_base;
+	struct usb_otg		*otg = musb->xceiv->otg;
 	unsigned long		flags;
 	irqreturn_t		ret = IRQ_NONE;
 	u32			status;
@@ -351,14 +352,14 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
-			musb->xceiv->default_a = 1;
+			otg->default_a = 1;
 			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
-			musb->xceiv->default_a = 0;
+			otg->default_a = 0;
 			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index c1f4998e..b2daf1c 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -268,6 +268,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
 	unsigned long	flags;
 	irqreturn_t	retval = IRQ_NONE;
 	struct musb	*musb = __hci;
+	struct usb_otg	*otg = musb->xceiv->otg;
 	void __iomem	*tibase = musb->ctrl_base;
 	struct cppi	*cppi;
 	u32		tmp;
@@ -334,14 +335,14 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
 			WARNING("VBUS error workaround (delay coming)\n");
 		} else if (is_host_enabled(musb) && drvvbus) {
 			MUSB_HST_MODE(musb);
-			musb->xceiv->default_a = 1;
+			otg->default_a = 1;
 			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			portstate(musb->port1_status |= USB_PORT_STAT_POWER);
 			del_timer(&otg_workaround);
 		} else {
 			musb->is_active = 0;
 			MUSB_DEV_MODE(musb);
-			musb->xceiv->default_a = 0;
+			otg->default_a = 0;
 			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
 		}
@@ -467,7 +468,7 @@ static int davinci_musb_exit(struct musb *musb)
 	davinci_musb_source_power(musb, 0 /*off*/, 1);
 
 	/* delay, to avoid problems with module reload */
-	if (is_host_enabled(musb) && musb->xceiv->default_a) {
+	if (is_host_enabled(musb) && musb->xceiv->otg->default_a) {
 		int	maxdelay = 30;
 		u8	devctl, warn = 0;
 
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e7c97e6..f9edf2c 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -415,6 +415,7 @@ void musb_hnp_stop(struct musb *musb)
 static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 				u8 devctl, u8 power)
 {
+	struct usb_otg *otg = musb->xceiv->otg;
 	irqreturn_t handled = IRQ_NONE;
 
 	dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl,
@@ -631,7 +632,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		case USB_PHY_STATE_B_PERIPHERAL:
 			musb_g_suspend(musb);
 			musb->is_active = is_otg_enabled(musb)
-					&& musb->xceiv->gadget->b_hnp_enable;
+					&& otg->gadget->b_hnp_enable;
 			if (musb->is_active) {
 				musb->xceiv->state = USB_PHY_STATE_B_WAIT_ACON;
 				dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
@@ -648,7 +649,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 		case USB_PHY_STATE_A_HOST:
 			musb->xceiv->state = USB_PHY_STATE_A_SUSPEND;
 			musb->is_active = is_otg_enabled(musb)
-					&& musb->xceiv->host->b_hnp_enable;
+					&& otg->host->b_hnp_enable;
 			break;
 		case USB_PHY_STATE_B_HOST:
 			/* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
@@ -1974,7 +1975,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
-		musb->xceiv->host = &hcd->self;
+		musb->xceiv->otg->host = &hcd->self;
 		hcd->power_budget = 2 * (plat->power ? : 250);
 
 		/* program PHY to use external vBus if required */
@@ -1993,7 +1994,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		struct usb_hcd	*hcd = musb_to_hcd(musb);
 
 		MUSB_HST_MODE(musb);
-		musb->xceiv->default_a = 1;
+		musb->xceiv->otg->default_a = 1;
 		musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 
 		status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
@@ -2008,7 +2009,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
 	} else /* peripheral is enabled */ {
 		MUSB_DEV_MODE(musb);
-		musb->xceiv->default_a = 0;
+		musb->xceiv->otg->default_a = 0;
 		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 
 		status = musb_gadget_setup(musb);
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index b36e704..b757395 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -47,6 +47,7 @@
 
 static void musb_port_suspend(struct musb *musb, bool do_suspend)
 {
+	struct usb_otg	*otg = musb->xceiv->otg;
 	u8		power;
 	void __iomem	*mbase = musb->mregs;
 
@@ -81,7 +82,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
 		case USB_PHY_STATE_A_HOST:
 			musb->xceiv->state = USB_PHY_STATE_A_SUSPEND;
 			musb->is_active = is_otg_enabled(musb)
-					&& musb->xceiv->host->b_hnp_enable;
+					&& otg->host->b_hnp_enable;
 			if (musb->is_active)
 				mod_timer(&musb->otg_timer, jiffies
 					+ msecs_to_jiffies(
@@ -91,7 +92,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend)
 		case USB_PHY_STATE_B_HOST:
 			musb->xceiv->state = USB_PHY_STATE_B_WAIT_ACON;
 			musb->is_active = is_otg_enabled(musb)
-					&& musb->xceiv->host->b_hnp_enable;
+					&& otg->host->b_hnp_enable;
 			musb_platform_try_idle(musb, 0);
 			break;
 		default:
@@ -179,6 +180,8 @@ static void musb_port_reset(struct musb *musb, bool do_reset)
 
 void musb_root_disconnect(struct musb *musb)
 {
+	struct usb_otg	*otg = musb->xceiv->otg;
+
 	musb->port1_status = USB_PORT_STAT_POWER
 			| (USB_PORT_STAT_C_CONNECTION << 16);
 
@@ -188,7 +191,7 @@ void musb_root_disconnect(struct musb *musb)
 	switch (musb->xceiv->state) {
 	case USB_PHY_STATE_A_SUSPEND:
 		if (is_otg_enabled(musb)
-				&& musb->xceiv->host->b_hnp_enable) {
+				&& otg->host->b_hnp_enable) {
 			musb->xceiv->state = USB_PHY_STATE_A_PERIPHERAL;
 			musb->g.is_a_peripheral = 1;
 			break;
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2cd9408..0879a2b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -133,6 +133,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
 
 static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 {
+	struct usb_otg	*otg = musb->xceiv->otg;
 	u8		devctl;
 	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
 	int ret = 1;
@@ -168,7 +169,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 				otg_set_vbus(musb->xceiv, 1);
 		} else {
 			musb->is_active = 1;
-			musb->xceiv->default_a = 1;
+			otg->default_a = 1;
 			musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 			devctl |= MUSB_DEVCTL_SESSION;
 			MUSB_HST_MODE(musb);
@@ -180,7 +181,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 		 * jumping right to B_IDLE...
 		 */
 
-		musb->xceiv->default_a = 0;
+		otg->default_a = 0;
 		musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 		devctl &= ~MUSB_DEVCTL_SESSION;
 
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index d7cae3d..3c7dd53 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -292,7 +292,7 @@ static int tusb_draw_power(struct usb_phy *x, unsigned mA)
 	 * The actual current usage would be very board-specific.  For now,
 	 * it's simpler to just use an aggregate (also board-specific).
 	 */
-	if (x->default_a || mA < (musb->min_power << 1))
+	if (x->otg->default_a || mA < (musb->min_power << 1))
 		mA = 0;
 
 	reg = musb_readl(tbase, TUSB_PRCM_MNGMT);
@@ -509,6 +509,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 	void __iomem	*tbase = musb->ctrl_base;
 	u32		conf, prcm, timer;
 	u8		devctl;
+	struct usb_otg	*otg = musb->xceiv->otg;
 
 	/* HDRC controls CPEN, but beware current surges during device
 	 * connect.  They can trigger transient overcurrent conditions
@@ -521,7 +522,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 
 	if (is_on) {
 		timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE);
-		musb->xceiv->default_a = 1;
+		otg->default_a = 1;
 		musb->xceiv->state = USB_PHY_STATE_A_WAIT_VRISE;
 		devctl |= MUSB_DEVCTL_SESSION;
 
@@ -547,11 +548,11 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on)
 				musb->xceiv->state = USB_PHY_STATE_A_IDLE;
 			}
 			musb->is_active = 0;
-			musb->xceiv->default_a = 1;
+			otg->default_a = 1;
 			MUSB_HST_MODE(musb);
 		} else {
 			musb->is_active = 0;
-			musb->xceiv->default_a = 0;
+			otg->default_a = 0;
 			musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 			MUSB_DEV_MODE(musb);
 		}
@@ -643,6 +644,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 {
 	u32		otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT);
 	unsigned long	idle_timeout = 0;
+	struct usb_otg	*otg = musb->xceiv->otg;
 
 	/* ID pin */
 	if ((int_src & TUSB_INT_SRC_ID_STATUS_CHNG)) {
@@ -653,7 +655,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 		else
 			default_a = is_host_enabled(musb);
 		dev_dbg(musb->controller, "Default-%c\n", default_a ? 'A' : 'B');
-		musb->xceiv->default_a = default_a;
+		otg->default_a = default_a;
 		tusb_musb_set_vbus(musb, default_a);
 
 		/* Don't allow idling immediately */
@@ -665,7 +667,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
 	if (int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) {
 
 		/* B-dev state machine:  no vbus ~= disconnect */
-		if ((is_otg_enabled(musb) && !musb->xceiv->default_a)
+		if ((is_otg_enabled(musb) && !otg->default_a)
 				|| !is_host_enabled(musb)) {
 			/* ? musb_root_disconnect(musb); */
 			musb->port1_status &=
-- 
1.7.4.1


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

* [PATCHv5 16/19] power_supply: Convert all users to new usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (14 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 15/19] usb: musb: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
       [not found]   ` <20111003131055.GC2487@xps8300>
  2011-09-26 11:21 ` [PATCHv5 17/19] usb: " Heikki Krogerus
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

Use the new usb_phy_* functions instead of the old
otg_* ones.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/power/isp1704_charger.c |  108 +++++++++++++++++++++-----------------
 drivers/power/pda_power.c       |    6 +-
 drivers/power/twl4030_charger.c |   18 +++---
 3 files changed, 72 insertions(+), 60 deletions(-)

diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index 9230bdd..ba2a647 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -56,7 +56,7 @@ static u16 isp170x_id[] = {
 struct isp1704_charger {
 	struct device		*dev;
 	struct power_supply	psy;
-	struct usb_phy		*otg;
+	struct usb_phy		*xceiv;
 	struct notifier_block	nb;
 	struct work_struct	work;
 
@@ -71,6 +71,18 @@ struct isp1704_charger {
 	unsigned		max_power;
 };
 
+static inline int
+isp1704_read(struct isp1704_charger *isp, u32 reg)
+{
+	return usb_phy_io_read(isp->xceiv, reg);
+}
+
+static inline int
+isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg)
+{
+	return usb_phy_io_read(isp->xceiv, val, reg);
+}
+
 /*
  * Disable/enable the power from the isp1704 if a function for it
  * has been provided with platform data.
@@ -97,31 +109,31 @@ static inline int isp1704_charger_type(struct isp1704_charger *isp)
 	u8 otg_ctrl;
 	int type = POWER_SUPPLY_TYPE_USB_DCP;
 
-	func_ctrl = otg_io_read(isp->otg, ULPI_FUNC_CTRL);
-	otg_ctrl = otg_io_read(isp->otg, ULPI_OTG_CTRL);
+	func_ctrl = isp1704_read(isp, ULPI_FUNC_CTRL);
+	otg_ctrl = isp1704_read(isp, ULPI_OTG_CTRL);
 
 	/* disable pulldowns */
 	reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN;
-	otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), reg);
+	isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), reg);
 
 	/* full speed */
-	otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
+	isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
 			ULPI_FUNC_CTRL_XCVRSEL_MASK);
-	otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL),
+	isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL),
 			ULPI_FUNC_CTRL_FULL_SPEED);
 
 	/* Enable strong pull-up on DP (1.5K) and reset */
 	reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
-	otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), reg);
+	isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), reg);
 	usleep_range(1000, 2000);
 
-	reg = otg_io_read(isp->otg, ULPI_DEBUG);
+	reg = isp1704_read(isp, ULPI_DEBUG);
 	if ((reg & 3) != 3)
 		type = POWER_SUPPLY_TYPE_USB_CDP;
 
 	/* recover original state */
-	otg_io_write(isp->otg, ULPI_FUNC_CTRL, func_ctrl);
-	otg_io_write(isp->otg, ULPI_OTG_CTRL, otg_ctrl);
+	isp1704_write(isp, ULPI_FUNC_CTRL, func_ctrl);
+	isp1704_write(isp, ULPI_OTG_CTRL, otg_ctrl);
 
 	return type;
 }
@@ -136,28 +148,28 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp)
 	u8	r;
 
 	/* Reset the transceiver */
-	r = otg_io_read(isp->otg, ULPI_FUNC_CTRL);
+	r = isp1704_read(isp, ULPI_FUNC_CTRL);
 	r |= ULPI_FUNC_CTRL_RESET;
-	otg_io_write(isp->otg, ULPI_FUNC_CTRL, r);
+	isp1704_write(isp, ULPI_FUNC_CTRL, r);
 	usleep_range(1000, 2000);
 
 	/* Set normal mode */
 	r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK);
-	otg_io_write(isp->otg, ULPI_FUNC_CTRL, r);
+	isp1704_write(isp, ULPI_FUNC_CTRL, r);
 
 	/* Clear the DP and DM pull-down bits */
 	r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN;
-	otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), r);
+	isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), r);
 
 	/* Enable strong pull-up on DP (1.5K) and reset */
 	r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
-	otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), r);
+	isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), r);
 	usleep_range(1000, 2000);
 
 	/* Read the line state */
-	if (!otg_io_read(isp->otg, ULPI_DEBUG)) {
+	if (!isp1704_read(isp, ULPI_DEBUG)) {
 		/* Disable strong pull-up on DP (1.5K) */
-		otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
+		isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
 				ULPI_FUNC_CTRL_TERMSELECT);
 		return 1;
 	}
@@ -165,23 +177,23 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp)
 	/* Is it a charger or PS/2 connection */
 
 	/* Enable weak pull-up resistor on DP */
-	otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL),
+	isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
 			ISP1704_PWR_CTRL_DP_WKPU_EN);
 
 	/* Disable strong pull-up on DP (1.5K) */
-	otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
+	isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
 			ULPI_FUNC_CTRL_TERMSELECT);
 
 	/* Enable weak pull-down resistor on DM */
-	otg_io_write(isp->otg, ULPI_SET(ULPI_OTG_CTRL),
+	isp1704_write(isp, ULPI_SET(ULPI_OTG_CTRL),
 			ULPI_OTG_CTRL_DM_PULLDOWN);
 
 	/* It's a charger if the line states are clear */
-	if (!(otg_io_read(isp->otg, ULPI_DEBUG)))
+	if (!(isp1704_read(isp, ULPI_DEBUG)))
 		ret = 1;
 
 	/* Disable weak pull-up resistor on DP */
-	otg_io_write(isp->otg, ULPI_CLR(ISP1704_PWR_CTRL),
+	isp1704_write(isp, ULPI_CLR(ISP1704_PWR_CTRL),
 			ISP1704_PWR_CTRL_DP_WKPU_EN);
 
 	return ret;
@@ -193,14 +205,14 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
 	u8		pwr_ctrl;
 	int		ret = 0;
 
-	pwr_ctrl = otg_io_read(isp->otg, ISP1704_PWR_CTRL);
+	pwr_ctrl = isp1704_read(isp, ISP1704_PWR_CTRL);
 
 	/* set SW control bit in PWR_CTRL register */
-	otg_io_write(isp->otg, ISP1704_PWR_CTRL,
+	isp1704_write(isp, ISP1704_PWR_CTRL,
 			ISP1704_PWR_CTRL_SWCTRL);
 
 	/* enable manual charger detection */
-	otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL),
+	isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
 			ISP1704_PWR_CTRL_SWCTRL
 			| ISP1704_PWR_CTRL_DPVSRC_EN);
 	usleep_range(1000, 2000);
@@ -208,7 +220,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
 	timeout = jiffies + msecs_to_jiffies(300);
 	do {
 		/* Check if there is a charger */
-		if (otg_io_read(isp->otg, ISP1704_PWR_CTRL)
+		if (isp1704_read(isp, ISP1704_PWR_CTRL)
 				& ISP1704_PWR_CTRL_VDAT_DET) {
 			ret = isp1704_charger_verify(isp);
 			break;
@@ -216,7 +228,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
 	} while (!time_after(jiffies, timeout) && isp->online);
 
 	/* recover original state */
-	otg_io_write(isp->otg, ISP1704_PWR_CTRL, pwr_ctrl);
+	isp1704_write(isp, ISP1704_PWR_CTRL, pwr_ctrl);
 
 	return ret;
 }
@@ -264,8 +276,8 @@ static void isp1704_charger_work(struct work_struct *data)
 		case POWER_SUPPLY_TYPE_USB:
 		default:
 			/* enable data pullups */
-			if (isp->otg->gadget)
-				usb_gadget_connect(isp->otg->gadget);
+			if (isp->xceiv->gadget)
+				usb_gadget_connect(isp->xceiv->gadget);
 		}
 		break;
 	case USB_EVENT_NONE:
@@ -283,8 +295,8 @@ static void isp1704_charger_work(struct work_struct *data)
 		 * chargers. The pullups may be enabled elsewhere, so this can
 		 * not be the final solution.
 		 */
-		if (isp->otg->gadget)
-			usb_gadget_disconnect(isp->otg->gadget);
+		if (isp->xceiv->gadget)
+			usb_gadget_disconnect(isp->xceiv->gadget);
 
 		isp1704_charger_set_power(isp, 0);
 		break;
@@ -364,11 +376,11 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp)
 	int ret = -ENODEV;
 
 	/* Test ULPI interface */
-	ret = otg_io_write(isp->otg, ULPI_SCRATCH, 0xaa);
+	ret = isp1704_write(isp, ULPI_SCRATCH, 0xaa);
 	if (ret < 0)
 		return ret;
 
-	ret = otg_io_read(isp->otg, ULPI_SCRATCH);
+	ret = isp1704_read(isp, ULPI_SCRATCH);
 	if (ret < 0)
 		return ret;
 
@@ -376,13 +388,13 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp)
 		return -ENODEV;
 
 	/* Verify the product and vendor id matches */
-	vendor = otg_io_read(isp->otg, ULPI_VENDOR_ID_LOW);
-	vendor |= otg_io_read(isp->otg, ULPI_VENDOR_ID_HIGH) << 8;
+	vendor = isp1704_read(isp, ULPI_VENDOR_ID_LOW);
+	vendor |= isp1704_read(isp, ULPI_VENDOR_ID_HIGH) << 8;
 	if (vendor != NXP_VENDOR_ID)
 		return -ENODEV;
 
-	product = otg_io_read(isp->otg, ULPI_PRODUCT_ID_LOW);
-	product |= otg_io_read(isp->otg, ULPI_PRODUCT_ID_HIGH) << 8;
+	product = isp1704_read(isp, ULPI_PRODUCT_ID_LOW);
+	product |= isp1704_read(isp, ULPI_PRODUCT_ID_HIGH) << 8;
 
 	for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) {
 		if (product == isp170x_id[i]) {
@@ -405,8 +417,8 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
 	if (!isp)
 		return -ENOMEM;
 
-	isp->otg = otg_get_transceiver();
-	if (!isp->otg)
+	isp->xceiv = usb_get_transceiver();
+	if (!isp->xceiv)
 		goto fail0;
 
 	isp->dev = &pdev->dev;
@@ -429,14 +441,14 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
 		goto fail1;
 
 	/*
-	 * REVISIT: using work in order to allow the otg notifications to be
+	 * REVISIT: using work in order to allow the usb notifications to be
 	 * made atomically in the future.
 	 */
 	INIT_WORK(&isp->work, isp1704_charger_work);
 
 	isp->nb.notifier_call = isp1704_notifier_call;
 
-	ret = otg_register_notifier(isp->otg, &isp->nb);
+	ret = usb_register_notifier(isp->xceiv, &isp->nb);
 	if (ret)
 		goto fail2;
 
@@ -449,13 +461,13 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
 	 * enumerated. The charger driver should be always loaded before any
 	 * gadget is loaded.
 	 */
-	if (isp->otg->gadget)
-		usb_gadget_disconnect(isp->otg->gadget);
+	if (isp->xceiv->gadget)
+		usb_gadget_disconnect(isp->xceiv->gadget);
 
 	/* Detect charger if VBUS is valid (the cable was already plugged). */
-	ret = otg_io_read(isp->otg, ULPI_USB_INT_STS);
+	ret = isp1704_read(isp, ULPI_USB_INT_STS);
 	isp1704_charger_set_power(isp, 0);
-	if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) {
+	if ((ret & ULPI_INT_VBUS_VALID) && !isp->xceiv->otg->default_a) {
 		isp->event = USB_EVENT_VBUS;
 		schedule_work(&isp->work);
 	}
@@ -464,7 +476,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
 fail2:
 	power_supply_unregister(&isp->psy);
 fail1:
-	otg_put_transceiver(isp->otg);
+	usb_put_transceiver(isp->xceiv);
 fail0:
 	kfree(isp);
 
@@ -477,9 +489,9 @@ static int __devexit isp1704_charger_remove(struct platform_device *pdev)
 {
 	struct isp1704_charger *isp = platform_get_drvdata(pdev);
 
-	otg_unregister_notifier(isp->otg, &isp->nb);
+	usb_unregister_notifier(isp->xceiv, &isp->nb);
 	power_supply_unregister(&isp->psy);
-	otg_put_transceiver(isp->otg);
+	usb_put_transceiver(isp->xceiv);
 	isp1704_charger_set_power(isp, 0);
 	kfree(isp);
 
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 60433b7..69e3a86 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -304,7 +304,7 @@ static int pda_power_probe(struct platform_device *pdev)
 	}
 
 #ifdef CONFIG_USB_OTG_UTILS
-	transceiver = otg_get_transceiver();
+	transceiver = usb_get_transceiver();
 	if (transceiver && !pdata->is_usb_online) {
 		pdata->is_usb_online = otg_is_usb_online;
 	}
@@ -351,7 +351,7 @@ usb_supply_failed:
 		free_irq(ac_irq->start, &pda_psy_ac);
 #ifdef CONFIG_USB_OTG_UTILS
 	if (transceiver)
-		otg_put_transceiver(transceiver);
+		usb_put_transceiver(transceiver);
 #endif
 ac_irq_failed:
 	if (pdata->is_ac_online)
@@ -386,7 +386,7 @@ static int pda_power_remove(struct platform_device *pdev)
 		power_supply_unregister(&pda_psy_ac);
 #ifdef CONFIG_USB_OTG_UTILS
 	if (transceiver)
-		otg_put_transceiver(transceiver);
+		usb_put_transceiver(transceiver);
 #endif
 	if (ac_draw) {
 		regulator_put(ac_draw);
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index b3ead23..fdad850 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -70,7 +70,7 @@ struct twl4030_bci {
 	struct power_supply	ac;
 	struct power_supply	usb;
 	struct usb_phy		*transceiver;
-	struct notifier_block	otg_nb;
+	struct notifier_block	usb_nb;
 	struct work_struct	work;
 	int			irq_chg;
 	int			irq_bci;
@@ -279,7 +279,7 @@ static void twl4030_bci_usb_work(struct work_struct *data)
 static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
 			       void *priv)
 {
-	struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);
+	struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, usb_nb);
 
 	dev_dbg(bci->dev, "OTG notify %lu\n", val);
 
@@ -479,10 +479,10 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
 
 	INIT_WORK(&bci->work, twl4030_bci_usb_work);
 
-	bci->transceiver = otg_get_transceiver();
+	bci->transceiver = usb_get_transceiver();
 	if (bci->transceiver != NULL) {
-		bci->otg_nb.notifier_call = twl4030_bci_usb_ncb;
-		otg_register_notifier(bci->transceiver, &bci->otg_nb);
+		bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
+		usb_register_notifier(bci->transceiver, &bci->usb_nb);
 	}
 
 	/* Enable interrupts now. */
@@ -508,8 +508,8 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
 
 fail_unmask_interrupts:
 	if (bci->transceiver != NULL) {
-		otg_unregister_notifier(bci->transceiver, &bci->otg_nb);
-		otg_put_transceiver(bci->transceiver);
+		usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
+		usb_put_transceiver(bci->transceiver);
 	}
 	free_irq(bci->irq_bci, bci);
 fail_bci_irq:
@@ -539,8 +539,8 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev)
 			 TWL4030_INTERRUPTS_BCIIMR2A);
 
 	if (bci->transceiver != NULL) {
-		otg_unregister_notifier(bci->transceiver, &bci->otg_nb);
-		otg_put_transceiver(bci->transceiver);
+		usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
+		usb_put_transceiver(bci->transceiver);
 	}
 	free_irq(bci->irq_bci, bci);
 	free_irq(bci->irq_chg, bci);
-- 
1.7.4.1


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

* [PATCHv5 17/19] usb: Convert all users to new usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (15 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 16/19] power_supply: Convert all users to new usb_phy Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 18/19] usb: otg: Remove OTG specific members from usb_phy Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 19/19] usb: otg: Convert all users to pass struct usb_otg for OTG functions Heikki Krogerus
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Sascha Hauer, Pavankumar Kondeti, Li Yang,
	Eric Miao, Alan Stern

Use the new usb_phy_* functions with transceiver
operations instead of the old otg functions.

Includes fixes from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/usb/gadget/ci13xxx_msm.c  |    4 ++--
 drivers/usb/gadget/ci13xxx_udc.c  |   10 +++++-----
 drivers/usb/gadget/fsl_udc_core.c |    4 ++--
 drivers/usb/gadget/langwell_udc.c |    8 ++++----
 drivers/usb/gadget/omap_udc.c     |   14 ++++++++------
 drivers/usb/gadget/pxa25x_udc.c   |    8 ++++----
 drivers/usb/gadget/pxa27x_udc.c   |    6 +++---
 drivers/usb/host/ehci-fsl.c       |    2 +-
 drivers/usb/host/ehci-msm.c       |   14 +++++++-------
 drivers/usb/host/ehci-mxc.c       |   10 ++++++----
 drivers/usb/host/ehci-tegra.c     |    6 +++---
 drivers/usb/host/ohci-omap.c      |    2 +-
 drivers/usb/musb/am35x.c          |    4 ++--
 drivers/usb/musb/blackfin.c       |    4 ++--
 drivers/usb/musb/da8xx.c          |    4 ++--
 drivers/usb/musb/davinci.c        |    6 +++---
 drivers/usb/musb/musb_core.c      |   10 +++++-----
 drivers/usb/musb/musb_gadget.c    |    2 +-
 drivers/usb/musb/omap2430.c       |   24 ++++++++++++------------
 drivers/usb/musb/tusb6010.c       |    6 +++---
 drivers/usb/musb/ux500.c          |    8 ++++----
 21 files changed, 80 insertions(+), 76 deletions(-)

diff --git a/drivers/usb/gadget/ci13xxx_msm.c b/drivers/usb/gadget/ci13xxx_msm.c
index 470981a..737fe42 100644
--- a/drivers/usb/gadget/ci13xxx_msm.c
+++ b/drivers/usb/gadget/ci13xxx_msm.c
@@ -48,10 +48,10 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *udc, unsigned event)
 		 * Put the transceiver in non-driving mode. Otherwise host
 		 * may not detect soft-disconnection.
 		 */
-		val = otg_io_read(udc->transceiver, ULPI_FUNC_CTRL);
+		val = usb_phy_io_read(udc->transceiver, ULPI_FUNC_CTRL);
 		val &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
 		val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
-		otg_io_write(udc->transceiver, val, ULPI_FUNC_CTRL);
+		usb_phy_io_write(udc->transceiver, val, ULPI_FUNC_CTRL);
 		break;
 	default:
 		dev_dbg(dev, "unknown ci13xxx_udc event\n");
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 1265a85..677e448 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2519,7 +2519,7 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
 	struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget);
 
 	if (udc->transceiver)
-		return otg_set_power(udc->transceiver, mA);
+		return usb_phy_set_power(udc->transceiver, mA);
 	return -ENOTSUPP;
 }
 
@@ -2883,7 +2883,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 	if (retval < 0)
 		goto free_udc;
 
-	udc->transceiver = otg_get_transceiver();
+	udc->transceiver = usb_get_transceiver();
 
 	if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
 		if (udc->transceiver == NULL) {
@@ -2929,7 +2929,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 remove_trans:
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver, &udc->gadget);
-		otg_put_transceiver(udc->transceiver);
+		usb_put_transceiver(udc->transceiver);
 	}
 
 	err("error = %i", retval);
@@ -2941,7 +2941,7 @@ unreg_device:
 	device_unregister(&udc->gadget.dev);
 put_transceiver:
 	if (udc->transceiver)
-		otg_put_transceiver(udc->transceiver);
+		usb_put_transceiver(udc->transceiver);
 free_udc:
 	kfree(udc);
 	_udc = NULL;
@@ -2965,7 +2965,7 @@ static void udc_remove(void)
 
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver, &udc->gadget);
-		otg_put_transceiver(udc->transceiver);
+		usb_put_transceiver(udc->transceiver);
 	}
 #ifdef CONFIG_USB_GADGET_DEBUG_FILES
 	dbg_remove_files(&udc->gadget.dev);
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index de24a42..8775867 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1221,7 +1221,7 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 
 	udc = container_of(gadget, struct fsl_udc, gadget);
 	if (udc->transceiver)
-		return otg_set_power(udc->transceiver, mA);
+		return usb_phy_set_power(udc->transceiver, mA);
 	return -ENOTSUPP;
 }
 
@@ -2450,7 +2450,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG
 	if (pdata->operating_mode == FSL_USB2_DR_OTG) {
-		udc_controller->transceiver = otg_get_transceiver();
+		udc_controller->transceiver = usb_get_transceiver();
 		if (!udc_controller->transceiver) {
 			ERR("Can't find OTG driver!\n");
 			ret = -ENODEV;
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 00ddf29..64f98ff 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -1279,9 +1279,9 @@ static int langwell_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
 	if (dev->transceiver) {
-		dev_vdbg(&dev->pdev->dev, "otg_set_power\n");
+		dev_vdbg(&dev->pdev->dev, "usb_phy_set_power\n");
 		dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
-		return otg_set_power(dev->transceiver, mA);
+		return usb_phy_set_power(dev->transceiver, mA);
 	}
 
 	dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
@@ -3103,7 +3103,7 @@ static void langwell_udc_remove(struct pci_dev *pdev)
 		pci_disable_device(pdev);
 #else
 	if (dev->transceiver) {
-		otg_put_transceiver(dev->transceiver);
+		usb_put_transceiver(dev->transceiver);
 		dev->transceiver = NULL;
 		dev->lotg = NULL;
 	}
@@ -3168,7 +3168,7 @@ static int langwell_udc_probe(struct pci_dev *pdev,
 
 	/* mem region and register base */
 	dev->region = 1;
-	dev->transceiver = otg_get_transceiver();
+	dev->transceiver = usb_get_transceiver();
 	dev->lotg = otg_to_langwell(dev->transceiver);
 	base = dev->lotg->regs;
 #else
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 56d4f47..21828ab 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1355,7 +1355,7 @@ static int omap_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 
 	udc = container_of(gadget, struct omap_udc, gadget);
 	if (udc->transceiver)
-		return otg_set_power(udc->transceiver, mA);
+		return usb_phy_set_power(udc->transceiver, mA);
 	return -EOPNOTSUPP;
 }
 
@@ -1849,11 +1849,13 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
 					spin_lock(&udc->lock);
 				}
 				if (udc->transceiver)
-					otg_set_suspend(udc->transceiver, 1);
+					usb_phy_set_suspend(
+							udc->transceiver, 1);
 			} else {
 				VDBG("resume\n");
 				if (udc->transceiver)
-					otg_set_suspend(udc->transceiver, 0);
+					usb_phy_set_suspend(
+							udc->transceiver, 0);
 				if (udc->gadget.speed == USB_SPEED_FULL
 						&& udc->driver->resume) {
 					spin_unlock(&udc->lock);
@@ -2872,7 +2874,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
 		 * use it.  Except for OTG, we don't _need_ to talk to one;
 		 * but not having one probably means no VBUS detection.
 		 */
-		xceiv = otg_get_transceiver();
+		xceiv = usb_get_transceiver();
 		if (xceiv)
 			type = xceiv->label;
 		else if (config->otg) {
@@ -3018,7 +3020,7 @@ cleanup1:
 
 cleanup0:
 	if (xceiv)
-		otg_put_transceiver(xceiv);
+		usb_put_transceiver(xceiv);
 
 	if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) {
 		clk_disable(hhc_clk);
@@ -3048,7 +3050,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
 
 	pullup_disable(udc);
 	if (udc->transceiver) {
-		otg_put_transceiver(udc->transceiver);
+		usb_put_transceiver(udc->transceiver);
 		udc->transceiver = NULL;
 	}
 	omap_writew(0, UDC_SYSCON1);
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index e4e59b4..57133a0 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1007,7 +1007,7 @@ static int pxa25x_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
 	udc = container_of(_gadget, struct pxa25x_udc, gadget);
 
 	if (udc->transceiver)
-		return otg_set_power(udc->transceiver, mA);
+		return usb_phy_set_power(udc->transceiver, mA);
 	return -EOPNOTSUPP;
 }
 
@@ -2171,7 +2171,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
 	dev->dev = &pdev->dev;
 	dev->mach = pdev->dev.platform_data;
 
-	dev->transceiver = otg_get_transceiver();
+	dev->transceiver = usb_get_transceiver();
 
 	if (gpio_is_valid(dev->mach->gpio_pullup)) {
 		if ((retval = gpio_request(dev->mach->gpio_pullup,
@@ -2250,7 +2250,7 @@ lubbock_fail0:
 		gpio_free(dev->mach->gpio_pullup);
  err_gpio_pullup:
 	if (dev->transceiver) {
-		otg_put_transceiver(dev->transceiver);
+		usb_put_transceiver(dev->transceiver);
 		dev->transceiver = NULL;
 	}
 	clk_put(dev->clk);
@@ -2292,7 +2292,7 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
 	clk_put(dev->clk);
 
 	if (dev->transceiver) {
-		otg_put_transceiver(dev->transceiver);
+		usb_put_transceiver(dev->transceiver);
 		dev->transceiver = NULL;
 	}
 
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 85b68c7..57ac8c5 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1676,7 +1676,7 @@ static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
 
 	udc = to_gadget_udc(_gadget);
 	if (udc->transceiver)
-		return otg_set_power(udc->transceiver, mA);
+		return usb_phy_set_power(udc->transceiver, mA);
 	return -EOPNOTSUPP;
 }
 
@@ -2473,7 +2473,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
 
 	udc->dev = &pdev->dev;
 	udc->mach = pdev->dev.platform_data;
-	udc->transceiver = otg_get_transceiver();
+	udc->transceiver = usb_get_transceiver();
 
 	gpio = udc->mach->gpio_pullup;
 	if (gpio_is_valid(gpio)) {
@@ -2552,7 +2552,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev)
 	if (gpio_is_valid(gpio))
 		gpio_free(gpio);
 
-	otg_put_transceiver(udc->transceiver);
+	usb_put_transceiver(udc->transceiver);
 
 	udc->transceiver = NULL;
 	platform_set_drvdata(_dev, NULL);
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 34a3140..2026c0c 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -142,7 +142,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
 	if (pdata->operating_mode == FSL_USB2_DR_OTG) {
 		struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-		ehci->transceiver = otg_get_transceiver();
+		ehci->transceiver = usb_get_transceiver();
 		dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, transceiver=0x%p\n",
 			hcd, ehci, ehci->transceiver);
 
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index ef7c431..bb97dc3 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -32,7 +32,7 @@
 
 #define MSM_USB_BASE (hcd->regs)
 
-static struct usb_phy *otg;
+static struct usb_phy *xceiv;
 
 static int ehci_msm_reset(struct usb_hcd *hcd)
 {
@@ -145,14 +145,14 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	 * powering up VBUS, mapping of registers address space and power
 	 * management.
 	 */
-	otg = otg_get_transceiver();
-	if (!otg) {
+	xceiv = usb_get_transceiver();
+	if (!xceiv) {
 		dev_err(&pdev->dev, "unable to find transceiver\n");
 		ret = -ENODEV;
 		goto unmap;
 	}
 
-	ret = otg_set_host(otg, &hcd->self);
+	ret = otg_set_host(xceiv, &hcd->self);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "unable to register with transceiver\n");
 		goto put_transceiver;
@@ -169,7 +169,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	return 0;
 
 put_transceiver:
-	otg_put_transceiver(otg);
+	usb_put_transceiver(xceiv);
 unmap:
 	iounmap(hcd->regs);
 put_hcd:
@@ -186,8 +186,8 @@ static int __devexit ehci_msm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
-	otg_set_host(otg, NULL);
-	otg_put_transceiver(otg);
+	otg_set_host(xceiv, NULL);
+	usb_put_transceiver(xceiv);
 
 	usb_put_hcd(hcd);
 
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 555a73c..eccf55c 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -220,7 +220,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 	/* Initialize the transceiver */
 	if (pdata->otg) {
 		pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET;
-		ret = otg_init(pdata->otg);
+		ret = usb_phy_init(pdata->otg);
 		if (ret) {
 			dev_err(dev, "unable to init transceiver, probably missing\n");
 			ret = -ENODEV;
@@ -247,9 +247,11 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 		 * It's in violation of USB specs
 		 */
 		if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) {
-			flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL);
+			flags = usb_phy_io_read(pdata->otg,
+							ULPI_OTG_CTRL);
 			flags |= ULPI_OTG_CTRL_CHRGVBUS;
-			ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL);
+			ret = usb_phy_io_write(pdata->otg, flags,
+							ULPI_OTG_CTRL);
 			if (ret) {
 				dev_err(dev, "unable to set CHRVBUS\n");
 				goto err_add;
@@ -297,7 +299,7 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
 		pdata->exit(pdev);
 
 	if (pdata->otg)
-		otg_shutdown(pdata->otg);
+		usb_phy_shutdown(pdata->otg);
 
 	usb_remove_hcd(hcd);
 	iounmap(hcd->regs);
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 4637a29..8fc0214 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -668,7 +668,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG_UTILS
 	if (pdata->operating_mode == TEGRA_USB_OTG) {
-		tegra->transceiver = otg_get_transceiver();
+		tegra->transceiver = usb_get_transceiver();
 		if (tegra->transceiver)
 			otg_set_host(tegra->transceiver, &hcd->self);
 	}
@@ -686,7 +686,7 @@ fail:
 #ifdef CONFIG_USB_OTG_UTILS
 	if (tegra->transceiver) {
 		otg_set_host(tegra->transceiver, NULL);
-		otg_put_transceiver(tegra->transceiver);
+		usb_put_transceiver(tegra->transceiver);
 	}
 #endif
 	tegra_usb_phy_close(tegra->phy);
@@ -744,7 +744,7 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 #ifdef CONFIG_USB_OTG_UTILS
 	if (tegra->transceiver) {
 		otg_set_host(tegra->transceiver, NULL);
-		otg_put_transceiver(tegra->transceiver);
+		usb_put_transceiver(tegra->transceiver);
 	}
 #endif
 
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index bc45648..b3ff4c3 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -210,7 +210,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
 
 #ifdef	CONFIG_USB_OTG
 	if (need_transceiver) {
-		ohci->transceiver = otg_get_transceiver();
+		ohci->transceiver = usb_get_transceiver();
 		if (ohci->transceiver) {
 			int	status = otg_set_host(ohci->transceiver,
 						&ohci_to_hcd(ohci)->self);
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 8325ecf..37530f2 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -364,7 +364,7 @@ static int am35x_musb_init(struct musb *musb)
 		return -ENODEV;
 
 	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv)
 		return -ENODEV;
 
@@ -406,7 +406,7 @@ static int am35x_musb_exit(struct musb *musb)
 	if (data->set_phy_power)
 		data->set_phy_power(0);
 
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 
 	return 0;
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 2f3e0b0..1ba9e0b 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -415,7 +415,7 @@ static int bfin_musb_init(struct musb *musb)
 	gpio_direction_output(musb->config->gpio_vrsel, 0);
 
 	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv) {
 		gpio_free(musb->config->gpio_vrsel);
 		return -ENODEV;
@@ -440,7 +440,7 @@ static int bfin_musb_exit(struct musb *musb)
 {
 	gpio_free(musb->config->gpio_vrsel);
 
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 	return 0;
 }
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 61813b5..92e093d 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -425,7 +425,7 @@ static int da8xx_musb_init(struct musb *musb)
 		goto fail;
 
 	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv)
 		goto fail;
 
@@ -458,7 +458,7 @@ static int da8xx_musb_exit(struct musb *musb)
 
 	phy_off();
 
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 
 	return 0;
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index b2daf1c..e36af9a 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -387,7 +387,7 @@ static int davinci_musb_init(struct musb *musb)
 	u32		revision;
 
 	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv)
 		return -ENODEV;
 
@@ -446,7 +446,7 @@ static int davinci_musb_init(struct musb *musb)
 	return 0;
 
 fail:
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 	return -ENODEV;
 }
@@ -495,7 +495,7 @@ static int davinci_musb_exit(struct musb *musb)
 
 	phy_off();
 
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 
 	return 0;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f9edf2c..dd918f0 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -131,9 +131,9 @@ static inline struct musb *dev_to_musb(struct device *dev)
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
-static int musb_ulpi_read(struct usb_phy *otg, u32 offset)
+static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
 {
-	void __iomem *addr = otg->io_priv;
+	void __iomem *addr = phy->io_priv;
 	int	i = 0;
 	u8	r;
 	u8	power;
@@ -165,10 +165,10 @@ static int musb_ulpi_read(struct usb_phy *otg, u32 offset)
 	return musb_readb(addr, MUSB_ULPI_REG_DATA);
 }
 
-static int musb_ulpi_write(struct usb_phy *otg,
+static int musb_ulpi_write(struct usb_phy *phy,
 		u32 offset, u32 data)
 {
-	void __iomem *addr = otg->io_priv;
+	void __iomem *addr = phy->io_priv;
 	int	i = 0;
 	u8	r = 0;
 	u8	power;
@@ -200,7 +200,7 @@ static int musb_ulpi_write(struct usb_phy *otg,
 #define musb_ulpi_write		NULL
 #endif
 
-static struct otg_io_access_ops musb_ulpi_access = {
+static struct usb_phy_io_ops musb_ulpi_access = {
 	.read = musb_ulpi_read,
 	.write = musb_ulpi_write,
 };
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d931058..a811fd8 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1688,7 +1688,7 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 
 	if (!musb->xceiv->set_power)
 		return -EOPNOTSUPP;
-	return otg_set_power(musb->xceiv, mA);
+	return usb_phy_set_power(musb->xceiv, mA);
 }
 
 static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 0879a2b..f61afc9 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -240,12 +240,12 @@ static int musb_otg_notifications(struct notifier_block *nb,
 		if (is_otg_enabled(musb)) {
 			if (musb->gadget_driver) {
 				pm_runtime_get_sync(musb->controller);
-				otg_init(musb->xceiv);
+				usb_phy_init(musb->xceiv);
 				omap2430_musb_set_vbus(musb, 1);
 			}
 		} else {
 			pm_runtime_get_sync(musb->controller);
-			otg_init(musb->xceiv);
+			usb_phy_init(musb->xceiv);
 			omap2430_musb_set_vbus(musb, 1);
 		}
 		break;
@@ -255,7 +255,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
 
 		if (musb->gadget_driver)
 			pm_runtime_get_sync(musb->controller);
-		otg_init(musb->xceiv);
+		usb_phy_init(musb->xceiv);
 		break;
 
 	case USB_EVENT_NONE:
@@ -271,7 +271,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
 			if (musb->xceiv->set_vbus)
 				otg_set_vbus(musb->xceiv, 0);
 		}
-		otg_shutdown(musb->xceiv);
+		usb_phy_shutdown(musb->xceiv);
 		break;
 	default:
 		dev_dbg(musb->controller, "ID float\n");
@@ -292,7 +292,7 @@ static int omap2430_musb_init(struct musb *musb)
 	 * up through ULPI.  TWL4030-family PMICs include one,
 	 * which needs a driver, drivers aren't always needed.
 	 */
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv) {
 		pr_err("HS USB OTG: no transceiver configured\n");
 		return -ENODEV;
@@ -325,7 +325,7 @@ static int omap2430_musb_init(struct musb *musb)
 			musb_readl(musb->mregs, OTG_SIMENABLE));
 
 	musb->nb.notifier_call = musb_otg_notifications;
-	status = otg_register_notifier(musb->xceiv, &musb->nb);
+	status = usb_register_notifier(musb->xceiv, &musb->nb);
 
 	if (status)
 		dev_dbg(musb->controller, "notification register failed\n");
@@ -350,7 +350,7 @@ static void omap2430_musb_enable(struct musb *musb)
 	switch (musb->xceiv->last_event) {
 
 	case USB_EVENT_ID:
-		otg_init(musb->xceiv);
+		usb_phy_init(musb->xceiv);
 		if (data->interface_type == MUSB_INTERFACE_UTMI) {
 			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 			/* start the session */
@@ -370,7 +370,7 @@ static void omap2430_musb_enable(struct musb *musb)
 		break;
 
 	case USB_EVENT_VBUS:
-		otg_init(musb->xceiv);
+		usb_phy_init(musb->xceiv);
 		break;
 
 	default:
@@ -381,7 +381,7 @@ static void omap2430_musb_enable(struct musb *musb)
 static void omap2430_musb_disable(struct musb *musb)
 {
 	if (musb->xceiv->last_event)
-		otg_shutdown(musb->xceiv);
+		usb_phy_shutdown(musb->xceiv);
 }
 
 static int omap2430_musb_exit(struct musb *musb)
@@ -389,7 +389,7 @@ static int omap2430_musb_exit(struct musb *musb)
 	del_timer_sync(&musb_idle_timer);
 
 	omap2430_low_level_exit(musb);
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 
 	return 0;
 }
@@ -493,7 +493,7 @@ static int omap2430_runtime_suspend(struct device *dev)
 	struct musb			*musb = glue_to_musb(glue);
 
 	omap2430_low_level_exit(musb);
-	otg_set_suspend(musb->xceiv, 1);
+	usb_phy_set_suspend(musb->xceiv, 1);
 
 	return 0;
 }
@@ -504,7 +504,7 @@ static int omap2430_runtime_resume(struct device *dev)
 	struct musb			*musb = glue_to_musb(glue);
 
 	omap2430_low_level_init(musb);
-	otg_set_suspend(musb->xceiv, 0);
+	usb_phy_set_suspend(musb->xceiv, 0);
 
 	return 0;
 }
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 3c7dd53..e5402d7 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1081,7 +1081,7 @@ static int tusb_musb_init(struct musb *musb)
 	int			ret;
 
 	usb_nop_xceiv_register();
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv)
 		return -ENODEV;
 
@@ -1133,7 +1133,7 @@ done:
 		if (sync)
 			iounmap(sync);
 
-		otg_put_transceiver(musb->xceiv);
+		usb_put_transceiver(musb->xceiv);
 		usb_nop_xceiv_unregister();
 	}
 	return ret;
@@ -1149,7 +1149,7 @@ static int tusb_musb_exit(struct musb *musb)
 
 	iounmap(musb->sync_va);
 
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 	usb_nop_xceiv_unregister();
 	return 0;
 }
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index f7e04bf..0f56674 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -37,7 +37,7 @@ struct ux500_glue {
 
 static int ux500_musb_init(struct musb *musb)
 {
-	musb->xceiv = otg_get_transceiver();
+	musb->xceiv = usb_get_transceiver();
 	if (!musb->xceiv) {
 		pr_err("HS USB OTG: no transceiver configured\n");
 		return -ENODEV;
@@ -48,7 +48,7 @@ static int ux500_musb_init(struct musb *musb)
 
 static int ux500_musb_exit(struct musb *musb)
 {
-	otg_put_transceiver(musb->xceiv);
+	usb_put_transceiver(musb->xceiv);
 
 	return 0;
 }
@@ -160,7 +160,7 @@ static int ux500_suspend(struct device *dev)
 	struct ux500_glue	*glue = dev_get_drvdata(dev);
 	struct musb		*musb = glue_to_musb(glue);
 
-	otg_set_suspend(musb->xceiv, 1);
+	usb_phy_set_suspend(musb->xceiv, 1);
 	clk_disable(glue->clk);
 
 	return 0;
@@ -178,7 +178,7 @@ static int ux500_resume(struct device *dev)
 		return ret;
 	}
 
-	otg_set_suspend(musb->xceiv, 0);
+	usb_phy_set_suspend(musb->xceiv, 0);
 
 	return 0;
 }
-- 
1.7.4.1


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

* [PATCHv5 18/19] usb: otg: Remove OTG specific members from usb_phy
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (16 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 17/19] usb: " Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  2011-09-26 11:21 ` [PATCHv5 19/19] usb: otg: Convert all users to pass struct usb_otg for OTG functions Heikki Krogerus
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295, Alexander Shishkin

All the drivers are now converted to use struct usb_otg, so
removing the OTG specific members from struct usb_phy.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 include/linux/usb/otg.h |   50 ++++------------------------------------------
 1 files changed, 5 insertions(+), 45 deletions(-)

diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 34dea9b..ff47067 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -89,15 +89,11 @@ struct usb_phy {
 	const char		*label;
 	unsigned int		 flags;
 
-	u8			default_a;
 	enum usb_phy_state	state;
 	enum usb_phy_events	last_event;
 
 	struct usb_otg		*otg;
 
-	struct usb_bus		*host;
-	struct usb_gadget	*gadget;
-
 	struct usb_phy_io_ops	*io_ops;
 	void __iomem		*io_priv;
 
@@ -112,32 +108,14 @@ struct usb_phy {
 	int	(*init)(struct usb_phy *x);
 	void	(*shutdown)(struct usb_phy *x);
 
-	/* bind/unbind the host controller */
-	int	(*set_host)(struct usb_phy *x,
-				struct usb_bus *host);
-
-	/* bind/unbind the peripheral controller */
-	int	(*set_peripheral)(struct usb_phy *x,
-				struct usb_gadget *gadget);
-
 	/* effective for B devices, ignored for A-peripheral */
 	int	(*set_power)(struct usb_phy *x,
 				unsigned mA);
 
-	/* effective for A-peripheral, ignored for B devices */
-	int	(*set_vbus)(struct usb_phy *x,
-				bool enabled);
-
 	/* for non-OTG B devices: set transceiver into suspend mode */
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
-	/* for B devices only:  start session with A-Host */
-	int	(*start_srp)(struct usb_phy *x);
-
-	/* start or continue HNP role switch */
-	int	(*start_hnp)(struct usb_phy *x);
-
 };
 
 
@@ -219,7 +197,7 @@ otg_start_hnp(struct usb_phy *x)
 	if (x->otg && x->otg->start_hnp)
 		return x->otg->start_hnp(x->otg);
 
-	return x->start_hnp(x);
+	return -ENOTSUPP;
 }
 
 /* Context: can sleep */
@@ -229,7 +207,7 @@ otg_set_vbus(struct usb_phy *x, bool enabled)
 	if (x->otg && x->otg->set_vbus)
 		return x->otg->set_vbus(x->otg, enabled);
 
-	return x->set_vbus(x, enabled);
+	return -ENOTSUPP;
 }
 
 /* for HCDs */
@@ -239,7 +217,7 @@ otg_set_host(struct usb_phy *x, struct usb_bus *host)
 	if (x->otg && x->otg->set_host)
 		return x->otg->set_host(x->otg, host);
 
-	return x->set_host(x, host);
+	return -ENOTSUPP;
 }
 
 /* for usb peripheral controller drivers */
@@ -251,7 +229,7 @@ otg_set_peripheral(struct usb_phy *x, struct usb_gadget *periph)
 	if (x->otg && x->otg->set_peripheral)
 		return x->otg->set_peripheral(x->otg, periph);
 
-	return x->set_peripheral(x, periph);
+	return -ENOTSUPP;
 }
 
 static inline int
@@ -278,7 +256,7 @@ otg_start_srp(struct usb_phy *x)
 	if (x->otg && x->otg->start_srp)
 		return x->otg->start_srp(x->otg);
 
-	return x->start_srp(x);
+	return -ENOTSUPP;
 }
 
 /* notifiers */
@@ -297,22 +275,4 @@ usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
 /* for OTG controller drivers (and maybe other stuff) */
 extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
 
-/* Temporary aliases for transceiver functions */
-#define otg_set_transceiver(x) usb_set_transceiver(x)
-#define otg_get_transceiver() usb_get_transceiver()
-#define otg_put_transceiver(x) usb_put_transceiver(x)
-
-#define otg_io_read(x, a) usb_phy_io_read(x, a)
-#define otg_io_write(x, a, b) usb_phy_io_write(x, a, b)
-
-#define otg_init(x) usb_phy_init(x)
-#define otg_shutdown(x) usb_phy_shutdown(x)
-#define otg_set_power(x, a) usb_phy_set_power(x, a)
-#define otg_set_suspend(x, a) usb_phy_set_suspend(x, a)
-
-#define otg_register_notifier(x, a) usb_register_notifier(x, a)
-#define otg_unregister_notifier(x, a) usb_unregiser_notifier(x, a)
-
-#define otg_io_access_ops usb_phy_io_ops
-
 #endif /* __LINUX_USB_OTG_H */
-- 
1.7.4.1


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

* [PATCHv5 19/19] usb: otg: Convert all users to pass struct usb_otg for OTG functions
  2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
                   ` (17 preceding siblings ...)
  2011-09-26 11:21 ` [PATCHv5 18/19] usb: otg: Remove OTG specific members from usb_phy Heikki Krogerus
@ 2011-09-26 11:21 ` Heikki Krogerus
  18 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-09-26 11:21 UTC (permalink / raw)
  To: Felipe Balbi, Greg KH
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Sascha Hauer

This changes the otg functions so that they receive struct
otg instead of struct usb_phy as parameter and
converts all users of these functions to pass the otg member
of their usb_phy.

Includes fixes to IMX code from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-pxa/pxa3xx-ulpi.c   |    8 ++++----
 drivers/usb/gadget/ci13xxx_udc.c  |    7 ++++---
 drivers/usb/gadget/fsl_udc_core.c |    5 +++--
 drivers/usb/gadget/langwell_udc.c |    2 +-
 drivers/usb/gadget/omap_udc.c     |    7 ++++---
 drivers/usb/gadget/pxa25x_udc.c   |    5 +++--
 drivers/usb/gadget/pxa27x_udc.c   |    5 +++--
 drivers/usb/host/ehci-fsl.c       |    4 ++--
 drivers/usb/host/ehci-hub.c       |    2 +-
 drivers/usb/host/ehci-msm.c       |    4 ++--
 drivers/usb/host/ehci-mxc.c       |    2 +-
 drivers/usb/host/ehci-tegra.c     |    6 +++---
 drivers/usb/host/ohci-omap.c      |    6 +++---
 drivers/usb/musb/musb_core.c      |    2 +-
 drivers/usb/musb/musb_gadget.c    |   11 ++++++-----
 drivers/usb/musb/omap2430.c       |    8 ++++----
 include/linux/usb/otg.h           |   30 +++++++++++++++---------------
 17 files changed, 60 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index a299e11..e385dde 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -145,13 +145,13 @@ static int pxa310_start_otg_host_transcvr(struct usb_bus *host)
 		return err;
 	}
 
-	err = otg_set_vbus(u2d->otg, 1);
+	err = otg_set_vbus(u2d->otg->otg, 1);
 	if (err) {
 		pr_err("OTG transceiver VBUS set failed");
 		return err;
 	}
 
-	err = otg_set_host(u2d->otg, host);
+	err = otg_set_host(u2d->otg->otg, host);
 	if (err)
 		pr_err("OTG transceiver Host mode set failed");
 
@@ -189,8 +189,8 @@ static void pxa310_stop_otg_hc(void)
 {
 	pxa310_otg_transceiver_rtsm();
 
-	otg_set_host(u2d->otg, NULL);
-	otg_set_vbus(u2d->otg, 0);
+	otg_set_host(u2d->otg->otg, NULL);
+	otg_set_vbus(u2d->otg->otg, 0);
 	usb_phy_shutdown(u2d->otg);
 }
 
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 677e448..59cd1cd 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2911,7 +2911,8 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 		goto unreg_device;
 
 	if (udc->transceiver) {
-		retval = otg_set_peripheral(udc->transceiver, &udc->gadget);
+		retval = otg_set_peripheral(udc->transceiver->otg,
+						&udc->gadget);
 		if (retval)
 			goto remove_dbg;
 	}
@@ -2928,7 +2929,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 
 remove_trans:
 	if (udc->transceiver) {
-		otg_set_peripheral(udc->transceiver, &udc->gadget);
+		otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
 		usb_put_transceiver(udc->transceiver);
 	}
 
@@ -2964,7 +2965,7 @@ static void udc_remove(void)
 	usb_del_gadget_udc(&udc->gadget);
 
 	if (udc->transceiver) {
-		otg_set_peripheral(udc->transceiver, &udc->gadget);
+		otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
 		usb_put_transceiver(udc->transceiver);
 	}
 #ifdef CONFIG_USB_GADGET_DEBUG_FILES
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 8775867..897a7d9 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1974,7 +1974,8 @@ static int fsl_start(struct usb_gadget_driver *driver,
 
 		/* connect to bus through transceiver */
 		if (udc_controller->transceiver) {
-			retval = otg_set_peripheral(udc_controller->transceiver,
+			retval = otg_set_peripheral(
+					udc_controller->transceiver->otg,
 						    &udc_controller->gadget);
 			if (retval < 0) {
 				ERR("can't bind to transceiver\n");
@@ -2014,7 +2015,7 @@ static int fsl_stop(struct usb_gadget_driver *driver)
 		return -EINVAL;
 
 	if (udc_controller->transceiver)
-		otg_set_peripheral(udc_controller->transceiver, NULL);
+		otg_set_peripheral(udc_controller->transceiver->otg, NULL);
 
 	/* stop DR, disable intr */
 	dr_controller_stop(udc_controller);
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 64f98ff..9557a02 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -1940,7 +1940,7 @@ static int langwell_stop(struct usb_gadget_driver *driver)
 
 	/* unbind OTG transceiver */
 	if (dev->transceiver)
-		(void)otg_set_peripheral(dev->transceiver, 0);
+		(void)otg_set_peripheral(dev->transceiver->otg, 0);
 
 	/* disable interrupt and set controller to stop state */
 	langwell_udc_stop(dev);
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 21828ab..33f884e 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1223,7 +1223,7 @@ static int omap_wakeup(struct usb_gadget *gadget)
 	/* NOTE:  non-OTG systems may use SRP TOO... */
 	} else if (!(udc->devstat & UDC_ATT)) {
 		if (udc->transceiver)
-			retval = otg_start_srp(udc->transceiver);
+			retval = otg_start_srp(udc->transceiver->otg);
 	}
 	spin_unlock_irqrestore(&udc->lock, flags);
 
@@ -2166,7 +2166,8 @@ static int omap_udc_start(struct usb_gadget_driver *driver,
 
 	/* connect to bus through transceiver */
 	if (udc->transceiver) {
-		status = otg_set_peripheral(udc->transceiver, &udc->gadget);
+		status = otg_set_peripheral(udc->transceiver->otg,
+						&udc->gadget);
 		if (status < 0) {
 			ERR("can't bind to transceiver\n");
 			if (driver->unbind) {
@@ -2212,7 +2213,7 @@ static int omap_udc_stop(struct usb_gadget_driver *driver)
 		omap_vbus_session(&udc->gadget, 0);
 
 	if (udc->transceiver)
-		(void) otg_set_peripheral(udc->transceiver, NULL);
+		(void) otg_set_peripheral(udc->transceiver->otg, NULL);
 	else
 		pullup_disable(udc);
 
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 57133a0..62b4cff 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1313,7 +1313,8 @@ fail:
 
 	/* connect to bus through transceiver */
 	if (dev->transceiver) {
-		retval = otg_set_peripheral(dev->transceiver, &dev->gadget);
+		retval = otg_set_peripheral(dev->transceiver->otg,
+						&dev->gadget);
 		if (retval) {
 			DMSG("can't bind to transceiver\n");
 			if (driver->unbind)
@@ -1372,7 +1373,7 @@ static int pxa25x_stop(struct usb_gadget_driver *driver)
 	local_irq_enable();
 
 	if (dev->transceiver)
-		(void) otg_set_peripheral(dev->transceiver, NULL);
+		(void) otg_set_peripheral(dev->transceiver->otg, NULL);
 
 	driver->unbind(&dev->gadget);
 	dev->gadget.dev.driver = NULL;
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 57ac8c5..5874bf8 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1845,7 +1845,8 @@ static int pxa27x_udc_start(struct usb_gadget_driver *driver,
 		driver->driver.name);
 
 	if (udc->transceiver) {
-		retval = otg_set_peripheral(udc->transceiver, &udc->gadget);
+		retval = otg_set_peripheral(udc->transceiver->otg,
+						&udc->gadget);
 		if (retval) {
 			dev_err(udc->dev, "can't bind to transceiver\n");
 			goto transceiver_fail;
@@ -1918,7 +1919,7 @@ static int pxa27x_udc_stop(struct usb_gadget_driver *driver)
 		 driver->driver.name);
 
 	if (udc->transceiver)
-		return otg_set_peripheral(udc->transceiver, NULL);
+		return otg_set_peripheral(udc->transceiver->otg, NULL);
 	return 0;
 }
 
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 2026c0c..5d9ab26 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -147,7 +147,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
 			hcd, ehci, ehci->transceiver);
 
 		if (ehci->transceiver) {
-			retval = otg_set_host(ehci->transceiver,
+			retval = otg_set_host(ehci->transceiver->otg,
 					      &ehci_to_hcd(ehci)->self);
 			if (retval) {
 				if (ehci->transceiver)
@@ -194,7 +194,7 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
 	if (ehci->transceiver) {
-		otg_set_host(ehci->transceiver, NULL);
+		otg_set_host(ehci->transceiver->otg, NULL);
 		put_device(ehci->transceiver->dev);
 	}
 
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 4c32cb1..63104b3 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -729,7 +729,7 @@ static int ehci_hub_control (
 #ifdef CONFIG_USB_OTG
 			if ((hcd->self.otg_port == (wIndex + 1))
 			    && hcd->self.b_hnp_enable) {
-				otg_start_hnp(ehci->transceiver);
+				otg_start_hnp(ehci->transceiver->otg);
 				break;
 			}
 #endif
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index bb97dc3..b909430 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -152,7 +152,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
 		goto unmap;
 	}
 
-	ret = otg_set_host(xceiv, &hcd->self);
+	ret = otg_set_host(xceiv->otg, &hcd->self);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "unable to register with transceiver\n");
 		goto put_transceiver;
@@ -186,7 +186,7 @@ static int __devexit ehci_msm_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
-	otg_set_host(xceiv, NULL);
+	otg_set_host(xceiv->otg, NULL);
 	usb_put_transceiver(xceiv);
 
 	usb_put_hcd(hcd);
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index eccf55c..cf8f192 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -226,7 +226,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 			ret = -ENODEV;
 			goto err_add;
 		}
-		ret = otg_set_vbus(pdata->otg, 1);
+		ret = otg_set_vbus(pdata->otg->otg, 1);
 		if (ret) {
 			dev_err(dev, "unable to enable vbus on transceiver\n");
 			goto err_add;
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 8fc0214..24c0107 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -670,7 +670,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 	if (pdata->operating_mode == TEGRA_USB_OTG) {
 		tegra->transceiver = usb_get_transceiver();
 		if (tegra->transceiver)
-			otg_set_host(tegra->transceiver, &hcd->self);
+			otg_set_host(tegra->transceiver->otg, &hcd->self);
 	}
 #endif
 
@@ -685,7 +685,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 fail:
 #ifdef CONFIG_USB_OTG_UTILS
 	if (tegra->transceiver) {
-		otg_set_host(tegra->transceiver, NULL);
+		otg_set_host(tegra->transceiver->otg, NULL);
 		usb_put_transceiver(tegra->transceiver);
 	}
 #endif
@@ -743,7 +743,7 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_USB_OTG_UTILS
 	if (tegra->transceiver) {
-		otg_set_host(tegra->transceiver, NULL);
+		otg_set_host(tegra->transceiver->otg, NULL);
 		usb_put_transceiver(tegra->transceiver);
 	}
 #endif
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index b3ff4c3..d246ebbb 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -171,7 +171,7 @@ static void start_hnp(struct ohci_hcd *ohci)
 	unsigned long	flags;
 	u32 l;
 
-	otg_start_hnp(ohci->transceiver);
+	otg_start_hnp(ohci->transceiver->otg);
 
 	local_irq_save(flags);
 	ohci->transceiver->state = USB_PHY_STATE_A_SUSPEND;
@@ -212,7 +212,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
 	if (need_transceiver) {
 		ohci->transceiver = usb_get_transceiver();
 		if (ohci->transceiver) {
-			int	status = otg_set_host(ohci->transceiver,
+			int	status = otg_set_host(ohci->transceiver->otg,
 						&ohci_to_hcd(ohci)->self);
 			dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n",
 					ohci->transceiver->label, status);
@@ -404,7 +404,7 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
 
 	usb_remove_hcd(hcd);
 	if (ohci->transceiver) {
-		(void) otg_set_host(ohci->transceiver, 0);
+		(void) otg_set_host(ohci->transceiver->otg, 0);
 		put_device(ohci->transceiver->dev);
 	}
 	if (machine_is_omap_osk())
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index dd918f0..3278efa 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1971,7 +1971,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	if (is_host_enabled(musb)) {
 		struct usb_hcd	*hcd = musb_to_hcd(musb);
 
-		otg_set_host(musb->xceiv, &hcd->self);
+		otg_set_host(musb->xceiv->otg, &hcd->self);
 
 		if (is_otg_enabled(musb))
 			hcd->self.otg_port = 1;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index a811fd8..9993320 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1609,7 +1609,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget)
 		}
 
 		spin_unlock_irqrestore(&musb->lock, flags);
-		otg_start_srp(musb->xceiv);
+		otg_start_srp(musb->xceiv->otg);
 		spin_lock_irqsave(&musb->lock, flags);
 
 		/* Block idling for at least 1s */
@@ -1883,6 +1883,7 @@ static int musb_gadget_start(struct usb_gadget *g,
 		struct usb_gadget_driver *driver)
 {
 	struct musb		*musb = gadget_to_musb(g);
+	struct usb_otg		*otg = musb->xceiv->otg;
 	unsigned long		flags;
 	int			retval = -EINVAL;
 
@@ -1899,7 +1900,7 @@ static int musb_gadget_start(struct usb_gadget *g,
 	spin_lock_irqsave(&musb->lock, flags);
 	musb->is_active = 1;
 
-	otg_set_peripheral(musb->xceiv, &musb->g);
+	otg_set_peripheral(otg, &musb->g);
 	musb->xceiv->state = USB_PHY_STATE_B_IDLE;
 
 	/*
@@ -1930,8 +1931,8 @@ static int musb_gadget_start(struct usb_gadget *g,
 		}
 
 		if ((musb->xceiv->last_event == USB_EVENT_ID)
-					&& musb->xceiv->set_vbus)
-			otg_set_vbus(musb->xceiv, 1);
+					&& otg->set_vbus)
+			otg_set_vbus(otg, 1);
 
 		hcd->self.uses_pio_for_control = 1;
 	}
@@ -2017,7 +2018,7 @@ static int musb_gadget_stop(struct usb_gadget *g,
 
 	musb->xceiv->state = USB_PHY_STATE_UNDEFINED;
 	stop_activity(musb, driver);
-	otg_set_peripheral(musb->xceiv, NULL);
+	otg_set_peripheral(musb->xceiv->otg, NULL);
 
 	dev_dbg(musb->controller, "unregistering driver %s\n", driver->function);
 
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f61afc9..fc9377c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -165,8 +165,8 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 				}
 			}
 
-			if (ret && musb->xceiv->set_vbus)
-				otg_set_vbus(musb->xceiv, 1);
+			if (ret && otg->set_vbus)
+				otg_set_vbus(otg, 1);
 		} else {
 			musb->is_active = 1;
 			otg->default_a = 1;
@@ -268,8 +268,8 @@ static int musb_otg_notifications(struct notifier_block *nb,
 			}
 
 		if (data->interface_type == MUSB_INTERFACE_UTMI) {
-			if (musb->xceiv->set_vbus)
-				otg_set_vbus(musb->xceiv, 0);
+			if (musb->xceiv->otg->set_vbus)
+				otg_set_vbus(musb->xceiv->otg, 0);
 		}
 		usb_phy_shutdown(musb->xceiv);
 		break;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index ff47067..1f7661f 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -192,30 +192,30 @@ static inline const char *usb_phy_state_string(enum usb_phy_state state)
 
 /* Context: can sleep */
 static inline int
-otg_start_hnp(struct usb_phy *x)
+otg_start_hnp(struct usb_otg *otg)
 {
-	if (x->otg && x->otg->start_hnp)
-		return x->otg->start_hnp(x->otg);
+	if (otg && otg->start_hnp)
+		return otg->start_hnp(otg);
 
 	return -ENOTSUPP;
 }
 
 /* Context: can sleep */
 static inline int
-otg_set_vbus(struct usb_phy *x, bool enabled)
+otg_set_vbus(struct usb_otg *otg, bool enabled)
 {
-	if (x->otg && x->otg->set_vbus)
-		return x->otg->set_vbus(x->otg, enabled);
+	if (otg && otg->set_vbus)
+		return otg->set_vbus(otg, enabled);
 
 	return -ENOTSUPP;
 }
 
 /* for HCDs */
 static inline int
-otg_set_host(struct usb_phy *x, struct usb_bus *host)
+otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-	if (x->otg && x->otg->set_host)
-		return x->otg->set_host(x->otg, host);
+	if (otg && otg->set_host)
+		return otg->set_host(otg, host);
 
 	return -ENOTSUPP;
 }
@@ -224,10 +224,10 @@ otg_set_host(struct usb_phy *x, struct usb_bus *host)
 
 /* Context: can sleep */
 static inline int
-otg_set_peripheral(struct usb_phy *x, struct usb_gadget *periph)
+otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph)
 {
-	if (x->otg && x->otg->set_peripheral)
-		return x->otg->set_peripheral(x->otg, periph);
+	if (otg && otg->set_peripheral)
+		return otg->set_peripheral(otg, periph);
 
 	return -ENOTSUPP;
 }
@@ -251,10 +251,10 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
 }
 
 static inline int
-otg_start_srp(struct usb_phy *x)
+otg_start_srp(struct usb_otg *otg)
 {
-	if (x->otg && x->otg->start_srp)
-		return x->otg->start_srp(x->otg);
+	if (otg && otg->start_srp)
+		return otg->start_srp(otg);
 
 	return -ENOTSUPP;
 }
-- 
1.7.4.1


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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-09-26 11:21 ` [PATCHv5 14/19] arm: imx: " Heikki Krogerus
@ 2011-10-03 13:04   ` Heikki Krogerus
  2011-10-03 13:29     ` Fabio Estevam
  0 siblings, 1 reply; 30+ messages in thread
From: Heikki Krogerus @ 2011-10-03 13:04 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: linux-usb, linux-kernel, Peter Chen, Lin Tony-B19295,
	Alexander Shishkin, Felipe Balbi, Greg KH

Hi Sascha,

On Mon, Sep 26, 2011 at 02:21:27PM +0300, Heikki Krogerus wrote:
> Use struct usb_otg members with OTG specific functions instead
> of usb_phy members.
> 
> Includes fixes from Sascha Hauer.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>

Have you had time to check it these work?

-- 
heikki

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-03 13:04   ` Heikki Krogerus
@ 2011-10-03 13:29     ` Fabio Estevam
  2011-10-04 13:51       ` Philippe Rétornaz
  2011-10-04 17:05       ` Philippe Rétornaz
  0 siblings, 2 replies; 30+ messages in thread
From: Fabio Estevam @ 2011-10-03 13:29 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Sascha Hauer, linux-usb, linux-kernel, Peter Chen,
	Lin Tony-B19295, Alexander Shishkin, Felipe Balbi, Greg KH,
	philippe.retornaz

On Mon, Oct 3, 2011 at 10:04 AM, Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
> Hi Sascha,
>
> On Mon, Sep 26, 2011 at 02:21:27PM +0300, Heikki Krogerus wrote:
>> Use struct usb_otg members with OTG specific functions instead
>> of usb_phy members.
>>
>> Includes fixes from Sascha Hauer.
>>
>> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
>> Cc: Sascha Hauer <s.hauer@pengutronix.de>
>
> Have you had time to check it these work?

Adding Philippe who has access to the mx31moboard-devboard and maybe
could run a test?

Regards,

Fabio Estevam

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-03 13:29     ` Fabio Estevam
@ 2011-10-04 13:51       ` Philippe Rétornaz
  2011-10-04 14:38         ` Heikki Krogerus
  2011-10-04 17:05       ` Philippe Rétornaz
  1 sibling, 1 reply; 30+ messages in thread
From: Philippe Rétornaz @ 2011-10-04 13:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Heikki Krogerus, Sascha Hauer, linux-usb, linux-kernel,
	Peter Chen, Lin Tony-B19295, Alexander Shishkin, Felipe Balbi,
	Greg KH

Hello

Le lundi 3 octobre 2011 15:29:44, Fabio Estevam a écrit :
> On Mon, Oct 3, 2011 at 10:04 AM, Heikki Krogerus
> 
> <heikki.krogerus@linux.intel.com> wrote:
> > Hi Sascha,
> > 
> > On Mon, Sep 26, 2011 at 02:21:27PM +0300, Heikki Krogerus wrote:
> >> Use struct usb_otg members with OTG specific functions instead
> >> of usb_phy members.
> >> 
> >> Includes fixes from Sascha Hauer.
> >> 
> >> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
> >> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > Have you had time to check it these work?
> 
> Adding Philippe who has access to the mx31moboard-devboard and maybe
> could run a test?

On which tree should I test thoses patches ? 3.0 does not apply.

Thanks

Philippe

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-04 13:51       ` Philippe Rétornaz
@ 2011-10-04 14:38         ` Heikki Krogerus
  0 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-10-04 14:38 UTC (permalink / raw)
  To: Philippe Rétornaz
  Cc: Fabio Estevam, Sascha Hauer, linux-usb, linux-kernel, Peter Chen,
	Lin Tony-B19295, Alexander Shishkin, Felipe Balbi, Greg KH

On Tue, Oct 04, 2011 at 03:51:19PM +0200, Philippe Rétornaz wrote:
> > Adding Philippe who has access to the mx31moboard-devboard and maybe
> > could run a test?
> 
> On which tree should I test thoses patches ? 3.0 does not apply.

Linus's tree. It's possible that our smtp server has done something it
should not have. If this is the case, you will find this patch set here:

git://github.com/krohei/linux.git branch otg

-- 
heikki

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-03 13:29     ` Fabio Estevam
  2011-10-04 13:51       ` Philippe Rétornaz
@ 2011-10-04 17:05       ` Philippe Rétornaz
  2011-10-05  9:51         ` Heikki Krogerus
  1 sibling, 1 reply; 30+ messages in thread
From: Philippe Rétornaz @ 2011-10-04 17:05 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Heikki Krogerus, Sascha Hauer, linux-usb, linux-kernel,
	Peter Chen, Lin Tony-B19295, Alexander Shishkin, Felipe Balbi,
	Greg KH

Le lundi 3 octobre 2011 15:29:44, Fabio Estevam a écrit :
> On Mon, Oct 3, 2011 at 10:04 AM, Heikki Krogerus
> 
> <heikki.krogerus@linux.intel.com> wrote:
> > Hi Sascha,
> > 
> > On Mon, Sep 26, 2011 at 02:21:27PM +0300, Heikki Krogerus wrote:
> >> Use struct usb_otg members with OTG specific functions instead
> >> of usb_phy members.
> >> 
> >> Includes fixes from Sascha Hauer.
> >> 
> >> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
> >> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > Have you had time to check it these work?
> 
> Adding Philippe who has access to the mx31moboard-devboard and maybe
> could run a test?

Tested on mx31moboard-marxbot, works fine (ie, nothing changed).

BTW, totally unrelated, but I had to disable the sdma in order to boot 
userspace on 3.1-rc8. It seems there is data corruption on sd card access with 
the dma now.

Regards,

Philippe

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-04 17:05       ` Philippe Rétornaz
@ 2011-10-05  9:51         ` Heikki Krogerus
  2011-10-07 12:52           ` Sascha Hauer
  0 siblings, 1 reply; 30+ messages in thread
From: Heikki Krogerus @ 2011-10-05  9:51 UTC (permalink / raw)
  To: Philippe Rétornaz, Sascha Hauer
  Cc: Fabio Estevam, linux-usb, linux-kernel, Peter Chen,
	Lin Tony-B19295, Alexander Shishkin, Felipe Balbi, Greg KH

On Tue, Oct 04, 2011 at 07:05:58PM +0200, Philippe Rétornaz wrote:
> Tested on mx31moboard-marxbot, works fine (ie, nothing changed).

Thanks Philippe. I assume we can add:

Tested-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>

Sascha, I still would like you to test these, as you found the issues
in the v4.

Thanks,

-- 
heikki

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

* Re: [PATCHv5 14/19] arm: imx: Start using struct usb_otg
  2011-10-05  9:51         ` Heikki Krogerus
@ 2011-10-07 12:52           ` Sascha Hauer
  0 siblings, 0 replies; 30+ messages in thread
From: Sascha Hauer @ 2011-10-07 12:52 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Philippe Rétornaz, Fabio Estevam, linux-usb, linux-kernel,
	Peter Chen, Lin Tony-B19295, Alexander Shishkin, Felipe Balbi,
	Greg KH

On Wed, Oct 05, 2011 at 12:51:14PM +0300, Heikki Krogerus wrote:
> On Tue, Oct 04, 2011 at 07:05:58PM +0200, Philippe Rétornaz wrote:
> > Tested on mx31moboard-marxbot, works fine (ie, nothing changed).
> 
> Thanks Philippe. I assume we can add:
> 
> Tested-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
> 
> Sascha, I still would like you to test these, as you found the issues
> in the v4.

Compiles and works fine on a i.MX27 board.

Tested-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCHv5 16/19] power_supply: Convert all users to new usb_phy
       [not found]   ` <20111003131055.GC2487@xps8300>
@ 2011-10-10 19:08     ` Anton Vorontsov
  2011-10-24 10:14       ` Heikki Krogerus
  0 siblings, 1 reply; 30+ messages in thread
From: Anton Vorontsov @ 2011-10-10 19:08 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-kernel

On Mon, Oct 03, 2011 at 04:10:55PM +0300, Heikki Krogerus wrote:
[...]
> > +static inline int
> > +isp1704_read(struct isp1704_charger *isp, u32 reg)

Cosmetic nitpick: I don't see any reason to break this into two lines.

> > +{
> > +	return usb_phy_io_read(isp->xceiv, reg);
> > +}
> > +
> > +static inline int
> > +isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg)

Same here.

I assume you want this patch to go via some other tree, so feel
free to add

Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>

Thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

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

* Re: [PATCHv5 16/19] power_supply: Convert all users to new usb_phy
  2011-10-10 19:08     ` Anton Vorontsov
@ 2011-10-24 10:14       ` Heikki Krogerus
  0 siblings, 0 replies; 30+ messages in thread
From: Heikki Krogerus @ 2011-10-24 10:14 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linux-kernel

Hi,

On Mon, Oct 10, 2011 at 11:08:12PM +0400, Anton Vorontsov wrote:
> On Mon, Oct 03, 2011 at 04:10:55PM +0300, Heikki Krogerus wrote:
> [...]
> > > +static inline int
> > > +isp1704_read(struct isp1704_charger *isp, u32 reg)
> 
> Cosmetic nitpick: I don't see any reason to break this into two lines.
> 
> > > +{
> > > +	return usb_phy_io_read(isp->xceiv, reg);
> > > +}
> > > +
> > > +static inline int
> > > +isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg)
> 
> Same here.
> 
> I assume you want this patch to go via some other tree, so feel
> free to add
> 
> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> 
> Thanks!

Thanks Anton. I'll change them.

-- 
heikki

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

* Re: [PATCHv5 13/19] usb: otg: ulpi: Start using struct usb_otg
  2011-09-26 11:21 ` [PATCHv5 13/19] usb: otg: ulpi: " Heikki Krogerus
@ 2011-10-24 12:28   ` Igor Grinberg
  0 siblings, 0 replies; 30+ messages in thread
From: Igor Grinberg @ 2011-10-24 12:28 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Felipe Balbi, Greg KH, linux-usb, linux-kernel, Peter Chen,
	Lin Tony-B19295, Alexander Shishkin

On 09/26/2011 02:21 PM, Heikki Krogerus wrote:
> Use struct usb_otg members with OTG specific functions instead
> of usb_phy members.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

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

end of thread, other threads:[~2011-10-24 12:29 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-26 11:21 [PATCHv5 00/19] First round in OTG rework Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 01/19] usb: otg: Rename otg_transceiver to usb_phy Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 02/19] usb: otg: Rename usb_otg and usb_xceiv " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 03/19] usb: otg: Separate otg members from usb_phy Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 04/19] usb: otg: ab8500: Start using struct usb_otg Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 05/19] usb: otg: fsl: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 06/19] usb: otg: gpio_vbus: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 07/19] usb: otg: isp1301_omap: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 08/19] usb: otg: msm: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 09/19] usb: otg: langwell: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 10/19] usb: otg: nop: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 11/19] usb: otg: twl4030: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 12/19] usb: otg: twl6030: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 13/19] usb: otg: ulpi: " Heikki Krogerus
2011-10-24 12:28   ` Igor Grinberg
2011-09-26 11:21 ` [PATCHv5 14/19] arm: imx: " Heikki Krogerus
2011-10-03 13:04   ` Heikki Krogerus
2011-10-03 13:29     ` Fabio Estevam
2011-10-04 13:51       ` Philippe Rétornaz
2011-10-04 14:38         ` Heikki Krogerus
2011-10-04 17:05       ` Philippe Rétornaz
2011-10-05  9:51         ` Heikki Krogerus
2011-10-07 12:52           ` Sascha Hauer
2011-09-26 11:21 ` [PATCHv5 15/19] usb: musb: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 16/19] power_supply: Convert all users to new usb_phy Heikki Krogerus
     [not found]   ` <20111003131055.GC2487@xps8300>
2011-10-10 19:08     ` Anton Vorontsov
2011-10-24 10:14       ` Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 17/19] usb: " Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 18/19] usb: otg: Remove OTG specific members from usb_phy Heikki Krogerus
2011-09-26 11:21 ` [PATCHv5 19/19] usb: otg: Convert all users to pass struct usb_otg for OTG functions Heikki Krogerus

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.