diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-05 18:18:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-05 18:18:00 -0400 |
commit | 64dc9e2e7320f079b97c46b106133b58b8e18d40 (patch) | |
tree | ab010dc1337d44e29c2b32b7f11788620a91fe4f /drivers/usb/dwc3/dwc3-exynos.c | |
parent | 01a60e76b6392547ad3dca3ac05b9c886fa5da45 (diff) | |
parent | 9b192de60b5a584ee4ed967fb6758773c75e4643 (diff) |
Merge tag 'usb-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes:
usb: patches for v3.10 merge window
Here is the big Gadget & PHY pull request. Many of us have
been really busy lately getting multiple drivers to a better
position.
Since this pull request is so large, I will divide it in sections
so it's easier to grasp what's included.
- cleanups:
. UDC drivers no longer touch gadget->dev, that's now udc-core
responsibility
. Many more UDC drivers converted to usb_gadget_map/unmap_request()
. UDC drivers no longer initialize DMA-related fields from gadget's
device structure
. UDC drivers don't touch gadget.dev.driver directly
. UDC drivers don't assign gadget.dev.release directly
. Removal of some unused DMA_ADDR_INVALID
. Introduction of CONFIG_USB_PHY
. All phy drivers have been moved to drivers/usb/phy and renamed to
a common naming scheme
. Fix PHY layer so it never returns a NULL pointer, also fix all
callers to avoid using IS_ERR_OR_NULL()
. Sparse fixes all over the place
. drivers/usb/otg/ has been deleted
. Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock
usage
- new features:
. UDC core now provides a generic way for tracking and reporting
UDC's state (not attached, resuming, suspended, addressed,
default, etc)
. twl4030-usb learned that it shouldn't be enabled during init
. Full DT support for DWC3 has been implemented
. ab8500-usb learned about pinctrl framework
. nop PHY learned about DeviceTree and regulators
. DWC3 learned about suspend/resume
. DWC3 can now be compiled in host-only and gadget-only (as well as
DRD) configurations
. UVC now enables streaming endpoint based on negotiated speed
. isp1301 now implements the PHY API properly
. configfs-based interface for gadget drivers which will lead to
the removal of all code which just combines functions together
to build functional gadget drivers.
. f_serial and f_obex were converted to new configfs interface while
maintaining old interface around.
- non-critical fixes:
. UVC gadget driver got fixes for Endpoint usage and stream calculation
. ab8500-usb fixed unbalanced clock and regulator API usage
. twl4030-usb got a fix for when OMAP3 is booted with cable connected
. fusb300_udc got a fix for DMA usage
. UVC got fixes for two assertions of the USB Video Class Compliance
specification revision 1.1
. build warning issues caused by recent addition of __must_check to
regulator API
These are all changes which deserve a mention, all other changes are related
to these one or minor spelling fixes and other similar tasks.
Signed-of-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-exynos.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-exynos.c | 98 |
1 files changed, 63 insertions, 35 deletions
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index b082bec7343e..a8afe6e26621 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <linux/usb/otg.h> | 22 | #include <linux/usb/otg.h> |
23 | #include <linux/usb/nop-usb-xceiv.h> | 23 | #include <linux/usb/nop-usb-xceiv.h> |
24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
25 | #include <linux/of_platform.h> | ||
25 | 26 | ||
26 | struct dwc3_exynos { | 27 | struct dwc3_exynos { |
27 | struct platform_device *dwc3; | ||
28 | struct platform_device *usb2_phy; | 28 | struct platform_device *usb2_phy; |
29 | struct platform_device *usb3_phy; | 29 | struct platform_device *usb3_phy; |
30 | struct device *dev; | 30 | struct device *dev; |
@@ -86,21 +86,30 @@ err1: | |||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
88 | 88 | ||
89 | static int dwc3_exynos_remove_child(struct device *dev, void *unused) | ||
90 | { | ||
91 | struct platform_device *pdev = to_platform_device(dev); | ||
92 | |||
93 | platform_device_unregister(pdev); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
89 | static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32); | 98 | static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32); |
90 | 99 | ||
91 | static int dwc3_exynos_probe(struct platform_device *pdev) | 100 | static int dwc3_exynos_probe(struct platform_device *pdev) |
92 | { | 101 | { |
93 | struct platform_device *dwc3; | ||
94 | struct dwc3_exynos *exynos; | 102 | struct dwc3_exynos *exynos; |
95 | struct clk *clk; | 103 | struct clk *clk; |
96 | struct device *dev = &pdev->dev; | 104 | struct device *dev = &pdev->dev; |
105 | struct device_node *node = dev->of_node; | ||
97 | 106 | ||
98 | int ret = -ENOMEM; | 107 | int ret = -ENOMEM; |
99 | 108 | ||
100 | exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); | 109 | exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); |
101 | if (!exynos) { | 110 | if (!exynos) { |
102 | dev_err(dev, "not enough memory\n"); | 111 | dev_err(dev, "not enough memory\n"); |
103 | return -ENOMEM; | 112 | goto err1; |
104 | } | 113 | } |
105 | 114 | ||
106 | /* | 115 | /* |
@@ -108,21 +117,15 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
108 | * Since shared usb code relies on it, set it here for now. | 117 | * Since shared usb code relies on it, set it here for now. |
109 | * Once we move to full device tree support this will vanish off. | 118 | * Once we move to full device tree support this will vanish off. |
110 | */ | 119 | */ |
111 | if (!pdev->dev.dma_mask) | 120 | if (!dev->dma_mask) |
112 | pdev->dev.dma_mask = &dwc3_exynos_dma_mask; | 121 | dev->dma_mask = &dwc3_exynos_dma_mask; |
113 | 122 | ||
114 | platform_set_drvdata(pdev, exynos); | 123 | platform_set_drvdata(pdev, exynos); |
115 | 124 | ||
116 | ret = dwc3_exynos_register_phys(exynos); | 125 | ret = dwc3_exynos_register_phys(exynos); |
117 | if (ret) { | 126 | if (ret) { |
118 | dev_err(dev, "couldn't register PHYs\n"); | 127 | dev_err(dev, "couldn't register PHYs\n"); |
119 | return ret; | 128 | goto err1; |
120 | } | ||
121 | |||
122 | dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); | ||
123 | if (!dwc3) { | ||
124 | dev_err(dev, "couldn't allocate dwc3 device\n"); | ||
125 | return -ENOMEM; | ||
126 | } | 129 | } |
127 | 130 | ||
128 | clk = devm_clk_get(dev, "usbdrd30"); | 131 | clk = devm_clk_get(dev, "usbdrd30"); |
@@ -132,37 +135,28 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
132 | goto err1; | 135 | goto err1; |
133 | } | 136 | } |
134 | 137 | ||
135 | dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask); | ||
136 | |||
137 | dwc3->dev.parent = dev; | ||
138 | dwc3->dev.dma_mask = dev->dma_mask; | ||
139 | dwc3->dev.dma_parms = dev->dma_parms; | ||
140 | exynos->dwc3 = dwc3; | ||
141 | exynos->dev = dev; | 138 | exynos->dev = dev; |
142 | exynos->clk = clk; | 139 | exynos->clk = clk; |
143 | 140 | ||
144 | clk_enable(exynos->clk); | 141 | clk_prepare_enable(exynos->clk); |
145 | 142 | ||
146 | ret = platform_device_add_resources(dwc3, pdev->resource, | 143 | if (node) { |
147 | pdev->num_resources); | 144 | ret = of_platform_populate(node, NULL, NULL, dev); |
148 | if (ret) { | 145 | if (ret) { |
149 | dev_err(dev, "couldn't add resources to dwc3 device\n"); | 146 | dev_err(dev, "failed to add dwc3 core\n"); |
150 | goto err2; | 147 | goto err2; |
151 | } | 148 | } |
152 | 149 | } else { | |
153 | ret = platform_device_add(dwc3); | 150 | dev_err(dev, "no device node, failed to add dwc3 core\n"); |
154 | if (ret) { | 151 | ret = -ENODEV; |
155 | dev_err(dev, "failed to register dwc3 device\n"); | ||
156 | goto err2; | 152 | goto err2; |
157 | } | 153 | } |
158 | 154 | ||
159 | return 0; | 155 | return 0; |
160 | 156 | ||
161 | err2: | 157 | err2: |
162 | clk_disable(clk); | 158 | clk_disable_unprepare(clk); |
163 | err1: | 159 | err1: |
164 | platform_device_put(dwc3); | ||
165 | |||
166 | return ret; | 160 | return ret; |
167 | } | 161 | } |
168 | 162 | ||
@@ -170,11 +164,11 @@ static int dwc3_exynos_remove(struct platform_device *pdev) | |||
170 | { | 164 | { |
171 | struct dwc3_exynos *exynos = platform_get_drvdata(pdev); | 165 | struct dwc3_exynos *exynos = platform_get_drvdata(pdev); |
172 | 166 | ||
173 | platform_device_unregister(exynos->dwc3); | ||
174 | platform_device_unregister(exynos->usb2_phy); | 167 | platform_device_unregister(exynos->usb2_phy); |
175 | platform_device_unregister(exynos->usb3_phy); | 168 | platform_device_unregister(exynos->usb3_phy); |
169 | device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child); | ||
176 | 170 | ||
177 | clk_disable(exynos->clk); | 171 | clk_disable_unprepare(exynos->clk); |
178 | 172 | ||
179 | return 0; | 173 | return 0; |
180 | } | 174 | } |
@@ -187,12 +181,46 @@ static const struct of_device_id exynos_dwc3_match[] = { | |||
187 | MODULE_DEVICE_TABLE(of, exynos_dwc3_match); | 181 | MODULE_DEVICE_TABLE(of, exynos_dwc3_match); |
188 | #endif | 182 | #endif |
189 | 183 | ||
184 | #ifdef CONFIG_PM_SLEEP | ||
185 | static int dwc3_exynos_suspend(struct device *dev) | ||
186 | { | ||
187 | struct dwc3_exynos *exynos = dev_get_drvdata(dev); | ||
188 | |||
189 | clk_disable(exynos->clk); | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static int dwc3_exynos_resume(struct device *dev) | ||
195 | { | ||
196 | struct dwc3_exynos *exynos = dev_get_drvdata(dev); | ||
197 | |||
198 | clk_enable(exynos->clk); | ||
199 | |||
200 | /* runtime set active to reflect active state. */ | ||
201 | pm_runtime_disable(dev); | ||
202 | pm_runtime_set_active(dev); | ||
203 | pm_runtime_enable(dev); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { | ||
209 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_exynos_suspend, dwc3_exynos_resume) | ||
210 | }; | ||
211 | |||
212 | #define DEV_PM_OPS (&dwc3_exynos_dev_pm_ops) | ||
213 | #else | ||
214 | #define DEV_PM_OPS NULL | ||
215 | #endif /* CONFIG_PM_SLEEP */ | ||
216 | |||
190 | static struct platform_driver dwc3_exynos_driver = { | 217 | static struct platform_driver dwc3_exynos_driver = { |
191 | .probe = dwc3_exynos_probe, | 218 | .probe = dwc3_exynos_probe, |
192 | .remove = dwc3_exynos_remove, | 219 | .remove = dwc3_exynos_remove, |
193 | .driver = { | 220 | .driver = { |
194 | .name = "exynos-dwc3", | 221 | .name = "exynos-dwc3", |
195 | .of_match_table = of_match_ptr(exynos_dwc3_match), | 222 | .of_match_table = of_match_ptr(exynos_dwc3_match), |
223 | .pm = DEV_PM_OPS, | ||
196 | }, | 224 | }, |
197 | }; | 225 | }; |
198 | 226 | ||