aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/chipidea/ci.h2
-rw-r--r--drivers/usb/chipidea/core.c4
-rw-r--r--drivers/usb/chipidea/host.c1
-rw-r--r--drivers/usb/chipidea/udc.c11
4 files changed, 14 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 9655e3569d4c..d738603a2757 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -160,6 +160,8 @@ struct ci13xxx {
160 160
161 struct ci13xxx_platform_data *platdata; 161 struct ci13xxx_platform_data *platdata;
162 int vbus_active; 162 int vbus_active;
163 /* FIXME: some day, we'll not use global phy */
164 bool global_phy;
163 struct usb_phy *transceiver; 165 struct usb_phy *transceiver;
164 struct usb_hcd *hcd; 166 struct usb_hcd *hcd;
165}; 167};
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 39603d7b7916..1083585fad00 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -419,6 +419,10 @@ static int __devinit ci_hdrc_probe(struct platform_device *pdev)
419 419
420 ci->dev = dev; 420 ci->dev = dev;
421 ci->platdata = dev->platform_data; 421 ci->platdata = dev->platform_data;
422 if (ci->platdata->phy)
423 ci->transceiver = ci->platdata->phy;
424 else
425 ci->global_phy = true;
422 426
423 ret = hw_device_init(ci, base); 427 ret = hw_device_init(ci, base);
424 if (ret < 0) { 428 if (ret < 0) {
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 4a4fdb8c65f8..ebff9f4f56ec 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -117,6 +117,7 @@ static int host_start(struct ci13xxx *ci)
117 hcd->has_tt = 1; 117 hcd->has_tt = 1;
118 118
119 hcd->power_budget = ci->platdata->power_budget; 119 hcd->power_budget = ci->platdata->power_budget;
120 hcd->phy = ci->transceiver;
120 121
121 ehci = hcd_to_ehci(hcd); 122 ehci = hcd_to_ehci(hcd);
122 ehci->caps = ci->hw_bank.cap; 123 ehci->caps = ci->hw_bank.cap;
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index ba8284e2a237..c7a032a4f0c5 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1685,7 +1685,8 @@ static int udc_start(struct ci13xxx *ci)
1685 1685
1686 ci->gadget.ep0 = &ci->ep0in->ep; 1686 ci->gadget.ep0 = &ci->ep0in->ep;
1687 1687
1688 ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); 1688 if (ci->global_phy)
1689 ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
1689 1690
1690 if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { 1691 if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
1691 if (ci->transceiver == NULL) { 1692 if (ci->transceiver == NULL) {
@@ -1729,7 +1730,8 @@ static int udc_start(struct ci13xxx *ci)
1729remove_trans: 1730remove_trans:
1730 if (!IS_ERR_OR_NULL(ci->transceiver)) { 1731 if (!IS_ERR_OR_NULL(ci->transceiver)) {
1731 otg_set_peripheral(ci->transceiver->otg, &ci->gadget); 1732 otg_set_peripheral(ci->transceiver->otg, &ci->gadget);
1732 usb_put_phy(ci->transceiver); 1733 if (ci->global_phy)
1734 usb_put_phy(ci->transceiver);
1733 } 1735 }
1734 1736
1735 dev_err(dev, "error = %i\n", retval); 1737 dev_err(dev, "error = %i\n", retval);
@@ -1738,7 +1740,7 @@ remove_dbg:
1738unreg_device: 1740unreg_device:
1739 device_unregister(&ci->gadget.dev); 1741 device_unregister(&ci->gadget.dev);
1740put_transceiver: 1742put_transceiver:
1741 if (!IS_ERR_OR_NULL(ci->transceiver)) 1743 if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy)
1742 usb_put_phy(ci->transceiver); 1744 usb_put_phy(ci->transceiver);
1743free_pools: 1745free_pools:
1744 dma_pool_destroy(ci->td_pool); 1746 dma_pool_destroy(ci->td_pool);
@@ -1772,7 +1774,8 @@ static void udc_stop(struct ci13xxx *ci)
1772 1774
1773 if (!IS_ERR_OR_NULL(ci->transceiver)) { 1775 if (!IS_ERR_OR_NULL(ci->transceiver)) {
1774 otg_set_peripheral(ci->transceiver->otg, NULL); 1776 otg_set_peripheral(ci->transceiver->otg, NULL);
1775 usb_put_phy(ci->transceiver); 1777 if (ci->global_phy)
1778 usb_put_phy(ci->transceiver);
1776 } 1779 }
1777 dbg_remove_files(&ci->gadget.dev); 1780 dbg_remove_files(&ci->gadget.dev);
1778 device_unregister(&ci->gadget.dev); 1781 device_unregister(&ci->gadget.dev);