diff options
author | Felipe Balbi <balbi@ti.com> | 2012-07-19 07:01:10 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 12:29:42 -0400 |
commit | d720f057fda4bae91a5108a11587374b9e396c6a (patch) | |
tree | 89106f45b1719ce0d962d97f3272a8acc821ddf0 /drivers | |
parent | a418cc4ea552884e9f2aa875aaa0afa1f0ffe07d (diff) |
usb: dwc3: exynos: add nop transceiver support
We will be adding support for transceivers on
dwc3 driver but not all boards have controllable
transceivers.
For those which don't provide controllable transceivers
we will register nop transceivers.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/dwc3-exynos.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index b8f00389fa34..ca6597853f90 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
@@ -19,16 +19,74 @@ | |||
19 | #include <linux/platform_data/dwc3-exynos.h> | 19 | #include <linux/platform_data/dwc3-exynos.h> |
20 | #include <linux/dma-mapping.h> | 20 | #include <linux/dma-mapping.h> |
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/usb/otg.h> | ||
23 | #include <linux/usb/nop-usb-xceiv.h> | ||
22 | 24 | ||
23 | #include "core.h" | 25 | #include "core.h" |
24 | 26 | ||
25 | struct dwc3_exynos { | 27 | struct dwc3_exynos { |
26 | struct platform_device *dwc3; | 28 | struct platform_device *dwc3; |
29 | struct platform_device *usb2_phy; | ||
30 | struct platform_device *usb3_phy; | ||
27 | struct device *dev; | 31 | struct device *dev; |
28 | 32 | ||
29 | struct clk *clk; | 33 | struct clk *clk; |
30 | }; | 34 | }; |
31 | 35 | ||
36 | static int __devinit dwc3_exynos_register_phys(struct dwc3_exynos *exynos) | ||
37 | { | ||
38 | struct nop_usb_xceiv_platform_data pdata; | ||
39 | struct platform_device *pdev; | ||
40 | int ret; | ||
41 | |||
42 | memset(&pdata, 0x00, sizeof(pdata)); | ||
43 | |||
44 | pdev = platform_device_alloc("nop_usb_xceiv", 0); | ||
45 | if (!pdev) | ||
46 | return -ENOMEM; | ||
47 | |||
48 | exynos->usb2_phy = pdev; | ||
49 | pdata.type = USB_PHY_TYPE_USB2; | ||
50 | |||
51 | ret = platform_device_add_data(exynos->usb2_phy, &pdata, sizeof(pdata)); | ||
52 | if (ret) | ||
53 | goto err1; | ||
54 | |||
55 | pdev = platform_device_alloc("nop_usb_xceiv", 1); | ||
56 | if (!pdev) { | ||
57 | ret = -ENOMEM; | ||
58 | goto err1; | ||
59 | } | ||
60 | |||
61 | exynos->usb3_phy = pdev; | ||
62 | pdata.type = USB_PHY_TYPE_USB3; | ||
63 | |||
64 | ret = platform_device_add_data(exynos->usb3_phy, &pdata, sizeof(pdata)); | ||
65 | if (ret) | ||
66 | goto err2; | ||
67 | |||
68 | ret = platform_device_add(exynos->usb2_phy); | ||
69 | if (ret) | ||
70 | goto err2; | ||
71 | |||
72 | ret = platform_device_add(exynos->usb3_phy); | ||
73 | if (ret) | ||
74 | goto err3; | ||
75 | |||
76 | return 0; | ||
77 | |||
78 | err3: | ||
79 | platform_device_del(exynos->usb2_phy); | ||
80 | |||
81 | err2: | ||
82 | platform_device_put(exynos->usb3_phy); | ||
83 | |||
84 | err1: | ||
85 | platform_device_put(exynos->usb2_phy); | ||
86 | |||
87 | return ret; | ||
88 | } | ||
89 | |||
32 | static int __devinit dwc3_exynos_probe(struct platform_device *pdev) | 90 | static int __devinit dwc3_exynos_probe(struct platform_device *pdev) |
33 | { | 91 | { |
34 | struct dwc3_exynos_data *pdata = pdev->dev.platform_data; | 92 | struct dwc3_exynos_data *pdata = pdev->dev.platform_data; |
@@ -51,6 +109,12 @@ static int __devinit dwc3_exynos_probe(struct platform_device *pdev) | |||
51 | if (devid < 0) | 109 | if (devid < 0) |
52 | goto err1; | 110 | goto err1; |
53 | 111 | ||
112 | ret = dwc3_exynos_register_phys(exynos); | ||
113 | if (ret) { | ||
114 | dev_err(&pdev->dev, "couldn't register PHYs\n"); | ||
115 | goto err1; | ||
116 | } | ||
117 | |||
54 | dwc3 = platform_device_alloc("dwc3", devid); | 118 | dwc3 = platform_device_alloc("dwc3", devid); |
55 | if (!dwc3) { | 119 | if (!dwc3) { |
56 | dev_err(&pdev->dev, "couldn't allocate dwc3 device\n"); | 120 | dev_err(&pdev->dev, "couldn't allocate dwc3 device\n"); |
@@ -120,6 +184,8 @@ static int __devexit dwc3_exynos_remove(struct platform_device *pdev) | |||
120 | struct dwc3_exynos_data *pdata = pdev->dev.platform_data; | 184 | struct dwc3_exynos_data *pdata = pdev->dev.platform_data; |
121 | 185 | ||
122 | platform_device_unregister(exynos->dwc3); | 186 | platform_device_unregister(exynos->dwc3); |
187 | platform_device_unregister(exynos->usb2_phy); | ||
188 | platform_device_unregister(exynos->usb3_phy); | ||
123 | 189 | ||
124 | dwc3_put_device_id(exynos->dwc3->id); | 190 | dwc3_put_device_id(exynos->dwc3->id); |
125 | 191 | ||