aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-10-30 13:41:14 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:01:25 -0500
commit19c1eac2685b62640ca2386a0a885ac2152668c8 (patch)
treee53fc8ad677eb36411e92823675b042e432bda4f
parente47d92545c2972bcf3711e7db80f481e402163c7 (diff)
usb: rename phy to usb_phy in OTG
This patch prepares the introduction of the generic PHY support in the USB OTG common functions. The USB PHY member of the OTG structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/phy/phy-omap-usb2.c6
-rw-r--r--drivers/usb/chipidea/otg_fsm.c2
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c6
-rw-r--r--drivers/usb/phy/phy-fsl-usb.c13
-rw-r--r--drivers/usb/phy/phy-generic.c2
-rw-r--r--drivers/usb/phy/phy-gpio-vbus-usb.c4
-rw-r--r--drivers/usb/phy/phy-isp1301-omap.c10
-rw-r--r--drivers/usb/phy/phy-msm-usb.c61
-rw-r--r--drivers/usb/phy/phy-mv-usb.c4
-rw-r--r--drivers/usb/phy/phy-tahvo.c8
-rw-r--r--drivers/usb/phy/phy-ulpi.c6
-rw-r--r--include/linux/usb/otg.h2
12 files changed, 65 insertions, 59 deletions
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 9f4093590f4c..32c3e86b4935 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
60 60
61static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) 61static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
62{ 62{
63 struct omap_usb *phy = phy_to_omapusb(otg->phy); 63 struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
64 64
65 if (!phy->comparator) 65 if (!phy->comparator)
66 return -ENODEV; 66 return -ENODEV;
@@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
70 70
71static int omap_usb_start_srp(struct usb_otg *otg) 71static int omap_usb_start_srp(struct usb_otg *otg)
72{ 72{
73 struct omap_usb *phy = phy_to_omapusb(otg->phy); 73 struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
74 74
75 if (!phy->comparator) 75 if (!phy->comparator)
76 return -ENODEV; 76 return -ENODEV;
@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
251 otg->set_vbus = omap_usb_set_vbus; 251 otg->set_vbus = omap_usb_set_vbus;
252 if (phy_data->flags & OMAP_USB2_HAS_START_SRP) 252 if (phy_data->flags & OMAP_USB2_HAS_START_SRP)
253 otg->start_srp = omap_usb_start_srp; 253 otg->start_srp = omap_usb_start_srp;
254 otg->phy = &phy->phy; 254 otg->usb_phy = &phy->phy;
255 255
256 platform_set_drvdata(pdev, phy); 256 platform_set_drvdata(pdev, phy);
257 257
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 8cb2508a6b71..d8490e758a74 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
788 return -ENOMEM; 788 return -ENOMEM;
789 } 789 }
790 790
791 otg->phy = ci->transceiver; 791 otg->usb_phy = ci->transceiver;
792 otg->gadget = &ci->gadget; 792 otg->gadget = &ci->gadget;
793 ci->fsm.otg = otg; 793 ci->fsm.otg = otg;
794 ci->transceiver->otg = ci->fsm.otg; 794 ci->transceiver->otg = ci->fsm.otg;
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 2d5250143ce1..3a802fa7dae2 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg,
1056 if (!otg) 1056 if (!otg)
1057 return -ENODEV; 1057 return -ENODEV;
1058 1058
1059 ab = phy_to_ab(otg->phy); 1059 ab = phy_to_ab(otg->usb_phy);
1060 1060
1061 ab->phy.otg->gadget = gadget; 1061 ab->phy.otg->gadget = gadget;
1062 1062
@@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
1080 if (!otg) 1080 if (!otg)
1081 return -ENODEV; 1081 return -ENODEV;
1082 1082
1083 ab = phy_to_ab(otg->phy); 1083 ab = phy_to_ab(otg->usb_phy);
1084 1084
1085 ab->phy.otg->host = host; 1085 ab->phy.otg->host = host;
1086 1086
@@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev)
1382 ab->phy.set_power = ab8500_usb_set_power; 1382 ab->phy.set_power = ab8500_usb_set_power;
1383 ab->phy.otg->state = OTG_STATE_UNDEFINED; 1383 ab->phy.otg->state = OTG_STATE_UNDEFINED;
1384 1384
1385 otg->phy = &ab->phy; 1385 otg->usb_phy = &ab->phy;
1386 otg->set_host = ab8500_usb_set_host; 1386 otg->set_host = ab8500_usb_set_host;
1387 otg->set_peripheral = ab8500_usb_set_peripheral; 1387 otg->set_peripheral = ab8500_usb_set_peripheral;
1388 1388
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 15d7a81eece5..b7f36b212422 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
499{ 499{
500 struct usb_otg *otg = fsm->otg; 500 struct usb_otg *otg = fsm->otg;
501 struct device *dev; 501 struct device *dev;
502 struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); 502 struct fsl_otg *otg_dev =
503 container_of(otg->usb_phy, struct fsl_otg, phy);
503 u32 retval = 0; 504 u32 retval = 0;
504 505
505 if (!otg->host) 506 if (!otg->host)
@@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
594 if (!otg) 595 if (!otg)
595 return -ENODEV; 596 return -ENODEV;
596 597
597 otg_dev = container_of(otg->phy, struct fsl_otg, phy); 598 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
598 if (otg_dev != fsl_otg_dev) 599 if (otg_dev != fsl_otg_dev)
599 return -ENODEV; 600 return -ENODEV;
600 601
@@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg,
644 if (!otg) 645 if (!otg)
645 return -ENODEV; 646 return -ENODEV;
646 647
647 otg_dev = container_of(otg->phy, struct fsl_otg, phy); 648 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
648 VDBG("otg_dev 0x%x\n", (int)otg_dev); 649 VDBG("otg_dev 0x%x\n", (int)otg_dev);
649 VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); 650 VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev);
650 if (otg_dev != fsl_otg_dev) 651 if (otg_dev != fsl_otg_dev)
@@ -717,7 +718,7 @@ static int fsl_otg_start_srp(struct usb_otg *otg)
717 if (!otg || otg.state != OTG_STATE_B_IDLE) 718 if (!otg || otg.state != OTG_STATE_B_IDLE)
718 return -ENODEV; 719 return -ENODEV;
719 720
720 otg_dev = container_of(otg->phy, struct fsl_otg, phy); 721 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
721 if (otg_dev != fsl_otg_dev) 722 if (otg_dev != fsl_otg_dev)
722 return -ENODEV; 723 return -ENODEV;
723 724
@@ -735,7 +736,7 @@ static int fsl_otg_start_hnp(struct usb_otg *otg)
735 if (!otg) 736 if (!otg)
736 return -ENODEV; 737 return -ENODEV;
737 738
738 otg_dev = container_of(otg->phy, struct fsl_otg, phy); 739 otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
739 if (otg_dev != fsl_otg_dev) 740 if (otg_dev != fsl_otg_dev)
740 return -ENODEV; 741 return -ENODEV;
741 742
@@ -857,7 +858,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
857 fsl_otg_tc->phy.dev = &pdev->dev; 858 fsl_otg_tc->phy.dev = &pdev->dev;
858 fsl_otg_tc->phy.set_power = fsl_otg_set_power; 859 fsl_otg_tc->phy.set_power = fsl_otg_set_power;
859 860
860 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; 861 fsl_otg_tc->phy.otg->usb_phy = &fsl_otg_tc->phy;
861 fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host; 862 fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host;
862 fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral; 863 fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral;
863 fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp; 864 fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp;
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 280a3458ff6b..0c01bd12cabc 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -228,7 +228,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
228 nop->phy.type = type; 228 nop->phy.type = type;
229 229
230 nop->phy.otg->state = OTG_STATE_UNDEFINED; 230 nop->phy.otg->state = OTG_STATE_UNDEFINED;
231 nop->phy.otg->phy = &nop->phy; 231 nop->phy.otg->usb_phy = &nop->phy;
232 nop->phy.otg->set_host = nop_set_host; 232 nop->phy.otg->set_host = nop_set_host;
233 nop->phy.otg->set_peripheral = nop_set_peripheral; 233 nop->phy.otg->set_peripheral = nop_set_peripheral;
234 234
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index 7a6be3e5dc23..9fcf19ba1416 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -180,7 +180,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg,
180 struct platform_device *pdev; 180 struct platform_device *pdev;
181 int gpio; 181 int gpio;
182 182
183 gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); 183 gpio_vbus = container_of(otg->usb_phy, struct gpio_vbus_data, phy);
184 pdev = to_platform_device(gpio_vbus->dev); 184 pdev = to_platform_device(gpio_vbus->dev);
185 pdata = dev_get_platdata(gpio_vbus->dev); 185 pdata = dev_get_platdata(gpio_vbus->dev);
186 gpio = pdata->gpio_pullup; 186 gpio = pdata->gpio_pullup;
@@ -271,7 +271,7 @@ static int gpio_vbus_probe(struct platform_device *pdev)
271 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; 271 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend;
272 272
273 gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED; 273 gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED;
274 gpio_vbus->phy.otg->phy = &gpio_vbus->phy; 274 gpio_vbus->phy.otg->usb_phy = &gpio_vbus->phy;
275 gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; 275 gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral;
276 276
277 err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect"); 277 err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect");
diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c
index 24f84cbbed57..a2dfb2ae520e 100644
--- a/drivers/usb/phy/phy-isp1301-omap.c
+++ b/drivers/usb/phy/phy-isp1301-omap.c
@@ -1275,7 +1275,7 @@ static int isp1301_otg_enable(struct isp1301 *isp)
1275static int 1275static int
1276isp1301_set_host(struct usb_otg *otg, struct usb_bus *host) 1276isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
1277{ 1277{
1278 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1278 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1279 1279
1280 if (isp != the_transceiver) 1280 if (isp != the_transceiver)
1281 return -ENODEV; 1281 return -ENODEV;
@@ -1331,7 +1331,7 @@ isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
1331static int 1331static int
1332isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) 1332isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
1333{ 1333{
1334 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1334 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1335 1335
1336 if (isp != the_transceiver) 1336 if (isp != the_transceiver)
1337 return -ENODEV; 1337 return -ENODEV;
@@ -1411,7 +1411,7 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
1411static int 1411static int
1412isp1301_start_srp(struct usb_otg *otg) 1412isp1301_start_srp(struct usb_otg *otg)
1413{ 1413{
1414 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1414 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1415 u32 otg_ctrl; 1415 u32 otg_ctrl;
1416 1416
1417 if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE) 1417 if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE)
@@ -1438,7 +1438,7 @@ static int
1438isp1301_start_hnp(struct usb_otg *otg) 1438isp1301_start_hnp(struct usb_otg *otg)
1439{ 1439{
1440#ifdef CONFIG_USB_OTG 1440#ifdef CONFIG_USB_OTG
1441 struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); 1441 struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
1442 u32 l; 1442 u32 l;
1443 1443
1444 if (isp != the_transceiver) 1444 if (isp != the_transceiver)
@@ -1583,7 +1583,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
1583 isp->phy.label = DRIVER_NAME; 1583 isp->phy.label = DRIVER_NAME;
1584 isp->phy.set_power = isp1301_set_power, 1584 isp->phy.set_power = isp1301_set_power,
1585 1585
1586 isp->phy.otg->phy = &isp->phy; 1586 isp->phy.otg->usb_phy = &isp->phy;
1587 isp->phy.otg->set_host = isp1301_set_host, 1587 isp->phy.otg->set_host = isp1301_set_host,
1588 isp->phy.otg->set_peripheral = isp1301_set_peripheral, 1588 isp->phy.otg->set_peripheral = isp1301_set_peripheral,
1589 isp->phy.otg->start_srp = isp1301_start_srp, 1589 isp->phy.otg->start_srp = isp1301_start_srp,
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 18015b7c8afc..e120d87778b2 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -708,7 +708,7 @@ static void msm_otg_start_host(struct usb_phy *phy, int on)
708 708
709static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) 709static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
710{ 710{
711 struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); 711 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy);
712 struct usb_hcd *hcd; 712 struct usb_hcd *hcd;
713 713
714 /* 714 /*
@@ -716,14 +716,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
716 * only peripheral configuration. 716 * only peripheral configuration.
717 */ 717 */
718 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) { 718 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) {
719 dev_info(otg->phy->dev, "Host mode is not supported\n"); 719 dev_info(otg->usb_phy->dev, "Host mode is not supported\n");
720 return -ENODEV; 720 return -ENODEV;
721 } 721 }
722 722
723 if (!host) { 723 if (!host) {
724 if (otg->state == OTG_STATE_A_HOST) { 724 if (otg->state == OTG_STATE_A_HOST) {
725 pm_runtime_get_sync(otg->phy->dev); 725 pm_runtime_get_sync(otg->usb_phy->dev);
726 msm_otg_start_host(otg->phy, 0); 726 msm_otg_start_host(otg->usb_phy, 0);
727 otg->host = NULL; 727 otg->host = NULL;
728 otg->state = OTG_STATE_UNDEFINED; 728 otg->state = OTG_STATE_UNDEFINED;
729 schedule_work(&motg->sm_work); 729 schedule_work(&motg->sm_work);
@@ -738,14 +738,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
738 hcd->power_budget = motg->pdata->power_budget; 738 hcd->power_budget = motg->pdata->power_budget;
739 739
740 otg->host = host; 740 otg->host = host;
741 dev_dbg(otg->phy->dev, "host driver registered w/ tranceiver\n"); 741 dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n");
742 742
743 /* 743 /*
744 * Kick the state machine work, if peripheral is not supported 744 * Kick the state machine work, if peripheral is not supported
745 * or peripheral is already registered with us. 745 * or peripheral is already registered with us.
746 */ 746 */
747 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { 747 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) {
748 pm_runtime_get_sync(otg->phy->dev); 748 pm_runtime_get_sync(otg->usb_phy->dev);
749 schedule_work(&motg->sm_work); 749 schedule_work(&motg->sm_work);
750 } 750 }
751 751
@@ -782,21 +782,21 @@ static void msm_otg_start_peripheral(struct usb_phy *phy, int on)
782static int msm_otg_set_peripheral(struct usb_otg *otg, 782static int msm_otg_set_peripheral(struct usb_otg *otg,
783 struct usb_gadget *gadget) 783 struct usb_gadget *gadget)
784{ 784{
785 struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); 785 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy);
786 786
787 /* 787 /*
788 * Fail peripheral registration if this board can support 788 * Fail peripheral registration if this board can support
789 * only host configuration. 789 * only host configuration.
790 */ 790 */
791 if (motg->pdata->mode == USB_DR_MODE_HOST) { 791 if (motg->pdata->mode == USB_DR_MODE_HOST) {
792 dev_info(otg->phy->dev, "Peripheral mode is not supported\n"); 792 dev_info(otg->usb_phy->dev, "Peripheral mode is not supported\n");
793 return -ENODEV; 793 return -ENODEV;
794 } 794 }
795 795
796 if (!gadget) { 796 if (!gadget) {
797 if (otg->state == OTG_STATE_B_PERIPHERAL) { 797 if (otg->state == OTG_STATE_B_PERIPHERAL) {
798 pm_runtime_get_sync(otg->phy->dev); 798 pm_runtime_get_sync(otg->usb_phy->dev);
799 msm_otg_start_peripheral(otg->phy, 0); 799 msm_otg_start_peripheral(otg->usb_phy, 0);
800 otg->gadget = NULL; 800 otg->gadget = NULL;
801 otg->state = OTG_STATE_UNDEFINED; 801 otg->state = OTG_STATE_UNDEFINED;
802 schedule_work(&motg->sm_work); 802 schedule_work(&motg->sm_work);
@@ -807,14 +807,15 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
807 return 0; 807 return 0;
808 } 808 }
809 otg->gadget = gadget; 809 otg->gadget = gadget;
810 dev_dbg(otg->phy->dev, "peripheral driver registered w/ tranceiver\n"); 810 dev_dbg(otg->usb_phy->dev,
811 "peripheral driver registered w/ tranceiver\n");
811 812
812 /* 813 /*
813 * Kick the state machine work, if host is not supported 814 * Kick the state machine work, if host is not supported
814 * or host is already registered with us. 815 * or host is already registered with us.
815 */ 816 */
816 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { 817 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) {
817 pm_runtime_get_sync(otg->phy->dev); 818 pm_runtime_get_sync(otg->usb_phy->dev);
818 schedule_work(&motg->sm_work); 819 schedule_work(&motg->sm_work);
819 } 820 }
820 821
@@ -1172,17 +1173,17 @@ static void msm_otg_sm_work(struct work_struct *w)
1172 1173
1173 switch (otg->state) { 1174 switch (otg->state) {
1174 case OTG_STATE_UNDEFINED: 1175 case OTG_STATE_UNDEFINED:
1175 dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n"); 1176 dev_dbg(otg->usb_phy->dev, "OTG_STATE_UNDEFINED state\n");
1176 msm_otg_reset(otg->phy); 1177 msm_otg_reset(otg->usb_phy);
1177 msm_otg_init_sm(motg); 1178 msm_otg_init_sm(motg);
1178 otg->state = OTG_STATE_B_IDLE; 1179 otg->state = OTG_STATE_B_IDLE;
1179 /* FALL THROUGH */ 1180 /* FALL THROUGH */
1180 case OTG_STATE_B_IDLE: 1181 case OTG_STATE_B_IDLE:
1181 dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n"); 1182 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_IDLE state\n");
1182 if (!test_bit(ID, &motg->inputs) && otg->host) { 1183 if (!test_bit(ID, &motg->inputs) && otg->host) {
1183 /* disable BSV bit */ 1184 /* disable BSV bit */
1184 writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); 1185 writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC);
1185 msm_otg_start_host(otg->phy, 1); 1186 msm_otg_start_host(otg->usb_phy, 1);
1186 otg->state = OTG_STATE_A_HOST; 1187 otg->state = OTG_STATE_A_HOST;
1187 } else if (test_bit(B_SESS_VLD, &motg->inputs)) { 1188 } else if (test_bit(B_SESS_VLD, &motg->inputs)) {
1188 switch (motg->chg_state) { 1189 switch (motg->chg_state) {
@@ -1198,13 +1199,15 @@ static void msm_otg_sm_work(struct work_struct *w)
1198 case USB_CDP_CHARGER: 1199 case USB_CDP_CHARGER:
1199 msm_otg_notify_charger(motg, 1200 msm_otg_notify_charger(motg,
1200 IDEV_CHG_MAX); 1201 IDEV_CHG_MAX);
1201 msm_otg_start_peripheral(otg->phy, 1); 1202 msm_otg_start_peripheral(otg->usb_phy,
1203 1);
1202 otg->state 1204 otg->state
1203 = OTG_STATE_B_PERIPHERAL; 1205 = OTG_STATE_B_PERIPHERAL;
1204 break; 1206 break;
1205 case USB_SDP_CHARGER: 1207 case USB_SDP_CHARGER:
1206 msm_otg_notify_charger(motg, IUNIT); 1208 msm_otg_notify_charger(motg, IUNIT);
1207 msm_otg_start_peripheral(otg->phy, 1); 1209 msm_otg_start_peripheral(otg->usb_phy,
1210 1);
1208 otg->state 1211 otg->state
1209 = OTG_STATE_B_PERIPHERAL; 1212 = OTG_STATE_B_PERIPHERAL;
1210 break; 1213 break;
@@ -1222,8 +1225,8 @@ static void msm_otg_sm_work(struct work_struct *w)
1222 * is incremented in charger detection work. 1225 * is incremented in charger detection work.
1223 */ 1226 */
1224 if (cancel_delayed_work_sync(&motg->chg_work)) { 1227 if (cancel_delayed_work_sync(&motg->chg_work)) {
1225 pm_runtime_put_sync(otg->phy->dev); 1228 pm_runtime_put_sync(otg->usb_phy->dev);
1226 msm_otg_reset(otg->phy); 1229 msm_otg_reset(otg->usb_phy);
1227 } 1230 }
1228 msm_otg_notify_charger(motg, 0); 1231 msm_otg_notify_charger(motg, 0);
1229 motg->chg_state = USB_CHG_STATE_UNDEFINED; 1232 motg->chg_state = USB_CHG_STATE_UNDEFINED;
@@ -1231,27 +1234,27 @@ static void msm_otg_sm_work(struct work_struct *w)
1231 } 1234 }
1232 1235
1233 if (otg->state == OTG_STATE_B_IDLE) 1236 if (otg->state == OTG_STATE_B_IDLE)
1234 pm_runtime_put_sync(otg->phy->dev); 1237 pm_runtime_put_sync(otg->usb_phy->dev);
1235 break; 1238 break;
1236 case OTG_STATE_B_PERIPHERAL: 1239 case OTG_STATE_B_PERIPHERAL:
1237 dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); 1240 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
1238 if (!test_bit(B_SESS_VLD, &motg->inputs) || 1241 if (!test_bit(B_SESS_VLD, &motg->inputs) ||
1239 !test_bit(ID, &motg->inputs)) { 1242 !test_bit(ID, &motg->inputs)) {
1240 msm_otg_notify_charger(motg, 0); 1243 msm_otg_notify_charger(motg, 0);
1241 msm_otg_start_peripheral(otg->phy, 0); 1244 msm_otg_start_peripheral(otg->usb_phy, 0);
1242 motg->chg_state = USB_CHG_STATE_UNDEFINED; 1245 motg->chg_state = USB_CHG_STATE_UNDEFINED;
1243 motg->chg_type = USB_INVALID_CHARGER; 1246 motg->chg_type = USB_INVALID_CHARGER;
1244 otg->state = OTG_STATE_B_IDLE; 1247 otg->state = OTG_STATE_B_IDLE;
1245 msm_otg_reset(otg->phy); 1248 msm_otg_reset(otg->usb_phy);
1246 schedule_work(w); 1249 schedule_work(w);
1247 } 1250 }
1248 break; 1251 break;
1249 case OTG_STATE_A_HOST: 1252 case OTG_STATE_A_HOST:
1250 dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n"); 1253 dev_dbg(otg->usb_phy->dev, "OTG_STATE_A_HOST state\n");
1251 if (test_bit(ID, &motg->inputs)) { 1254 if (test_bit(ID, &motg->inputs)) {
1252 msm_otg_start_host(otg->phy, 0); 1255 msm_otg_start_host(otg->usb_phy, 0);
1253 otg->state = OTG_STATE_B_IDLE; 1256 otg->state = OTG_STATE_B_IDLE;
1254 msm_otg_reset(otg->phy); 1257 msm_otg_reset(otg->usb_phy);
1255 schedule_work(w); 1258 schedule_work(w);
1256 } 1259 }
1257 break; 1260 break;
@@ -1388,7 +1391,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
1388 goto out; 1391 goto out;
1389 } 1392 }
1390 1393
1391 pm_runtime_get_sync(otg->phy->dev); 1394 pm_runtime_get_sync(otg->usb_phy->dev);
1392 schedule_work(&motg->sm_work); 1395 schedule_work(&motg->sm_work);
1393out: 1396out:
1394 return status; 1397 return status;
@@ -1668,7 +1671,7 @@ static int msm_otg_probe(struct platform_device *pdev)
1668 1671
1669 phy->io_ops = &msm_otg_io_ops; 1672 phy->io_ops = &msm_otg_io_ops;
1670 1673
1671 phy->otg->phy = &motg->phy; 1674 phy->otg->usb_phy = &motg->phy;
1672 phy->otg->set_host = msm_otg_set_host; 1675 phy->otg->set_host = msm_otg_set_host;
1673 phy->otg->set_peripheral = msm_otg_set_peripheral; 1676 phy->otg->set_peripheral = msm_otg_set_peripheral;
1674 1677
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index ee87aa7144db..81d934fdd0c3 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -56,7 +56,7 @@ static char *state_string[] = {
56 56
57static int mv_otg_set_vbus(struct usb_otg *otg, bool on) 57static int mv_otg_set_vbus(struct usb_otg *otg, bool on)
58{ 58{
59 struct mv_otg *mvotg = container_of(otg->phy, struct mv_otg, phy); 59 struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy);
60 if (mvotg->pdata->set_vbus == NULL) 60 if (mvotg->pdata->set_vbus == NULL)
61 return -ENODEV; 61 return -ENODEV;
62 62
@@ -716,8 +716,8 @@ static int mv_otg_probe(struct platform_device *pdev)
716 mvotg->phy.otg = otg; 716 mvotg->phy.otg = otg;
717 mvotg->phy.label = driver_name; 717 mvotg->phy.label = driver_name;
718 718
719 otg->phy = &mvotg->phy;
720 otg->state = OTG_STATE_UNDEFINED; 719 otg->state = OTG_STATE_UNDEFINED;
720 otg->usb_phy = &mvotg->phy;
721 otg->set_host = mv_otg_set_host; 721 otg->set_host = mv_otg_set_host;
722 otg->set_peripheral = mv_otg_set_peripheral; 722 otg->set_peripheral = mv_otg_set_peripheral;
723 otg->set_vbus = mv_otg_set_vbus; 723 otg->set_vbus = mv_otg_set_vbus;
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 04ece535c2f8..9cabc1a20d1c 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -196,7 +196,8 @@ static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend)
196 196
197static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) 197static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
198{ 198{
199 struct tahvo_usb *tu = container_of(otg->phy, struct tahvo_usb, phy); 199 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb,
200 phy);
200 201
201 dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, host); 202 dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, host);
202 203
@@ -225,7 +226,8 @@ static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
225static int tahvo_usb_set_peripheral(struct usb_otg *otg, 226static int tahvo_usb_set_peripheral(struct usb_otg *otg,
226 struct usb_gadget *gadget) 227 struct usb_gadget *gadget)
227{ 228{
228 struct tahvo_usb *tu = container_of(otg->phy, struct tahvo_usb, phy); 229 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb,
230 phy);
229 231
230 dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, gadget); 232 dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, gadget);
231 233
@@ -383,7 +385,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
383 tu->phy.label = DRIVER_NAME; 385 tu->phy.label = DRIVER_NAME;
384 tu->phy.set_suspend = tahvo_usb_set_suspend; 386 tu->phy.set_suspend = tahvo_usb_set_suspend;
385 387
386 tu->phy.otg->phy = &tu->phy; 388 tu->phy.otg->usb_phy = &tu->phy;
387 tu->phy.otg->set_host = tahvo_usb_set_host; 389 tu->phy.otg->set_host = tahvo_usb_set_host;
388 tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral; 390 tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral;
389 391
diff --git a/drivers/usb/phy/phy-ulpi.c b/drivers/usb/phy/phy-ulpi.c
index 4e3877c329f2..f48a7a21e3c2 100644
--- a/drivers/usb/phy/phy-ulpi.c
+++ b/drivers/usb/phy/phy-ulpi.c
@@ -211,7 +211,7 @@ static int ulpi_init(struct usb_phy *phy)
211 211
212static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host) 212static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host)
213{ 213{
214 struct usb_phy *phy = otg->phy; 214 struct usb_phy *phy = otg->usb_phy;
215 unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL); 215 unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL);
216 216
217 if (!host) { 217 if (!host) {
@@ -237,7 +237,7 @@ static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host)
237 237
238static int ulpi_set_vbus(struct usb_otg *otg, bool on) 238static int ulpi_set_vbus(struct usb_otg *otg, bool on)
239{ 239{
240 struct usb_phy *phy = otg->phy; 240 struct usb_phy *phy = otg->usb_phy;
241 unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL); 241 unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL);
242 242
243 flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT); 243 flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT);
@@ -276,7 +276,7 @@ otg_ulpi_create(struct usb_phy_io_ops *ops,
276 phy->otg = otg; 276 phy->otg = otg;
277 phy->init = ulpi_init; 277 phy->init = ulpi_init;
278 278
279 otg->phy = phy; 279 otg->usb_phy = phy;
280 otg->set_host = ulpi_set_host; 280 otg->set_host = ulpi_set_host;
281 otg->set_vbus = ulpi_set_vbus; 281 otg->set_vbus = ulpi_set_vbus;
282 282
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 33d3480c9cda..978fbbb0e266 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -14,7 +14,7 @@
14struct usb_otg { 14struct usb_otg {
15 u8 default_a; 15 u8 default_a;
16 16
17 struct usb_phy *phy; 17 struct usb_phy *usb_phy;
18 struct usb_bus *host; 18 struct usb_bus *host;
19 struct usb_gadget *gadget; 19 struct usb_gadget *gadget;
20 20