aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2015-09-01 09:35:24 -0400
committerJiri Kosina <jkosina@suse.cz>2015-09-01 09:35:24 -0400
commit067e2601d3c076abbf45db91261f9065eaa879b2 (patch)
tree86c8d4b913873dbd3b4ff23562a3a8597984b4df /drivers/usb/chipidea
parent3e097d1271ecdff2f251a54ddfc5eaa1f9821e96 (diff)
parent931830aa5c251e0803523213428f777a48bde254 (diff)
Merge branch 'for-4.3/gembird' into for-linus
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/ci_hdrc_usb2.c8
-rw-r--r--drivers/usb/chipidea/core.c13
-rw-r--r--drivers/usb/chipidea/host.c19
-rw-r--r--drivers/usb/chipidea/host.h6
-rw-r--r--drivers/usb/chipidea/usbmisc_imx.c2
5 files changed, 41 insertions, 7 deletions
diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 45844c951788..9eae1a16cef9 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -25,7 +25,7 @@ struct ci_hdrc_usb2_priv {
25 struct clk *clk; 25 struct clk *clk;
26}; 26};
27 27
28static struct ci_hdrc_platform_data ci_default_pdata = { 28static const struct ci_hdrc_platform_data ci_default_pdata = {
29 .capoffset = DEF_CAPOFFSET, 29 .capoffset = DEF_CAPOFFSET,
30 .flags = CI_HDRC_DISABLE_STREAMING, 30 .flags = CI_HDRC_DISABLE_STREAMING,
31}; 31};
@@ -37,8 +37,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
37 struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); 37 struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
38 int ret; 38 int ret;
39 39
40 if (!ci_pdata) 40 if (!ci_pdata) {
41 ci_pdata = &ci_default_pdata; 41 ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL);
42 *ci_pdata = ci_default_pdata; /* struct copy */
43 }
42 44
43 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 45 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
44 if (!priv) 46 if (!priv)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 74fea4fa41b1..3ad48e1c0c57 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -1024,7 +1024,18 @@ static struct platform_driver ci_hdrc_driver = {
1024 }, 1024 },
1025}; 1025};
1026 1026
1027module_platform_driver(ci_hdrc_driver); 1027static int __init ci_hdrc_platform_register(void)
1028{
1029 ci_hdrc_host_driver_init();
1030 return platform_driver_register(&ci_hdrc_driver);
1031}
1032module_init(ci_hdrc_platform_register);
1033
1034static void __exit ci_hdrc_platform_unregister(void)
1035{
1036 platform_driver_unregister(&ci_hdrc_driver);
1037}
1038module_exit(ci_hdrc_platform_unregister);
1028 1039
1029MODULE_ALIAS("platform:ci_hdrc"); 1040MODULE_ALIAS("platform:ci_hdrc");
1030MODULE_LICENSE("GPL v2"); 1041MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 21fe1a314313..7161439def19 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -37,12 +37,14 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd);
37 37
38struct ehci_ci_priv { 38struct ehci_ci_priv {
39 struct regulator *reg_vbus; 39 struct regulator *reg_vbus;
40 struct ci_hdrc *ci;
40}; 41};
41 42
42static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) 43static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
43{ 44{
44 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 45 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
45 struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv; 46 struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;
47 struct ci_hdrc *ci = priv->ci;
46 struct device *dev = hcd->self.controller; 48 struct device *dev = hcd->self.controller;
47 int ret = 0; 49 int ret = 0;
48 int port = HCS_N_PORTS(ehci->hcs_params); 50 int port = HCS_N_PORTS(ehci->hcs_params);
@@ -64,6 +66,15 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
64 return ret; 66 return ret;
65 } 67 }
66 } 68 }
69
70 if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
71 /*
72 * Marvell 28nm HSIC PHY requires forcing the port to HS mode.
73 * As HSIC is always HS, this should be safe for others.
74 */
75 hw_port_test_set(ci, 5);
76 hw_port_test_set(ci, 0);
77 }
67 return 0; 78 return 0;
68}; 79};
69 80
@@ -112,6 +123,7 @@ static int host_start(struct ci_hdrc *ci)
112 123
113 priv = (struct ehci_ci_priv *)ehci->priv; 124 priv = (struct ehci_ci_priv *)ehci->priv;
114 priv->reg_vbus = NULL; 125 priv->reg_vbus = NULL;
126 priv->ci = ci;
115 127
116 if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) { 128 if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci)) {
117 if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) { 129 if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) {
@@ -237,9 +249,12 @@ int ci_hdrc_host_init(struct ci_hdrc *ci)
237 rdrv->name = "host"; 249 rdrv->name = "host";
238 ci->roles[CI_ROLE_HOST] = rdrv; 250 ci->roles[CI_ROLE_HOST] = rdrv;
239 251
252 return 0;
253}
254
255void ci_hdrc_host_driver_init(void)
256{
240 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); 257 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides);
241 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend; 258 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend;
242 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend; 259 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend;
243
244 return 0;
245} 260}
diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h
index 5707bf379bfb..0f12f131bdd3 100644
--- a/drivers/usb/chipidea/host.h
+++ b/drivers/usb/chipidea/host.h
@@ -5,6 +5,7 @@
5 5
6int ci_hdrc_host_init(struct ci_hdrc *ci); 6int ci_hdrc_host_init(struct ci_hdrc *ci);
7void ci_hdrc_host_destroy(struct ci_hdrc *ci); 7void ci_hdrc_host_destroy(struct ci_hdrc *ci);
8void ci_hdrc_host_driver_init(void);
8 9
9#else 10#else
10 11
@@ -18,6 +19,11 @@ static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci)
18 19
19} 20}
20 21
22static void ci_hdrc_host_driver_init(void)
23{
24
25}
26
21#endif 27#endif
22 28
23#endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */ 29#endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 140945cb124f..3cefd49ddb00 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -160,7 +160,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
160 break; 160 break;
161 default: 161 default:
162 return -EINVAL; 162 return -EINVAL;
163 }; 163 }
164 164
165 spin_lock_irqsave(&usbmisc->lock, flags); 165 spin_lock_irqsave(&usbmisc->lock, flags);
166 if (data->disable_oc) 166 if (data->disable_oc)