aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-mv.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
commit64dc9e2e7320f079b97c46b106133b58b8e18d40 (patch)
treeab010dc1337d44e29c2b32b7f11788620a91fe4f /drivers/usb/host/ehci-mv.c
parent01a60e76b6392547ad3dca3ac05b9c886fa5da45 (diff)
parent9b192de60b5a584ee4ed967fb6758773c75e4643 (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/host/ehci-mv.c')
-rw-r--r--drivers/usb/host/ehci-mv.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 5cd9f96ed92d..402062973f03 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -33,25 +33,17 @@ struct ehci_hcd_mv {
33 33
34 struct mv_usb_platform_data *pdata; 34 struct mv_usb_platform_data *pdata;
35 35
36 /* clock source and total clock number */ 36 struct clk *clk;
37 unsigned int clknum;
38 struct clk *clk[0];
39}; 37};
40 38
41static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) 39static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
42{ 40{
43 unsigned int i; 41 clk_prepare_enable(ehci_mv->clk);
44
45 for (i = 0; i < ehci_mv->clknum; i++)
46 clk_prepare_enable(ehci_mv->clk[i]);
47} 42}
48 43
49static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) 44static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
50{ 45{
51 unsigned int i; 46 clk_disable_unprepare(ehci_mv->clk);
52
53 for (i = 0; i < ehci_mv->clknum; i++)
54 clk_disable_unprepare(ehci_mv->clk[i]);
55} 47}
56 48
57static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) 49static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
@@ -144,9 +136,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
144 struct ehci_hcd *ehci; 136 struct ehci_hcd *ehci;
145 struct ehci_hcd_mv *ehci_mv; 137 struct ehci_hcd_mv *ehci_mv;
146 struct resource *r; 138 struct resource *r;
147 int clk_i, retval = -ENODEV; 139 int retval = -ENODEV;
148 u32 offset; 140 u32 offset;
149 size_t size;
150 141
151 if (!pdata) { 142 if (!pdata) {
152 dev_err(&pdev->dev, "missing platform_data\n"); 143 dev_err(&pdev->dev, "missing platform_data\n");
@@ -160,8 +151,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
160 if (!hcd) 151 if (!hcd)
161 return -ENOMEM; 152 return -ENOMEM;
162 153
163 size = sizeof(*ehci_mv) + sizeof(struct clk *) * pdata->clknum; 154 ehci_mv = devm_kzalloc(&pdev->dev, sizeof(*ehci_mv), GFP_KERNEL);
164 ehci_mv = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
165 if (ehci_mv == NULL) { 155 if (ehci_mv == NULL) {
166 dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n"); 156 dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n");
167 retval = -ENOMEM; 157 retval = -ENOMEM;
@@ -172,16 +162,11 @@ static int mv_ehci_probe(struct platform_device *pdev)
172 ehci_mv->pdata = pdata; 162 ehci_mv->pdata = pdata;
173 ehci_mv->hcd = hcd; 163 ehci_mv->hcd = hcd;
174 164
175 ehci_mv->clknum = pdata->clknum; 165 ehci_mv->clk = devm_clk_get(&pdev->dev, NULL);
176 for (clk_i = 0; clk_i < ehci_mv->clknum; clk_i++) { 166 if (IS_ERR(ehci_mv->clk)) {
177 ehci_mv->clk[clk_i] = 167 dev_err(&pdev->dev, "error getting clock\n");
178 devm_clk_get(&pdev->dev, pdata->clkname[clk_i]); 168 retval = PTR_ERR(ehci_mv->clk);
179 if (IS_ERR(ehci_mv->clk[clk_i])) { 169 goto err_clear_drvdata;
180 dev_err(&pdev->dev, "error get clck \"%s\"\n",
181 pdata->clkname[clk_i]);
182 retval = PTR_ERR(ehci_mv->clk[clk_i]);
183 goto err_clear_drvdata;
184 }
185 } 170 }
186 171
187 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); 172 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs");
@@ -240,12 +225,16 @@ static int mv_ehci_probe(struct platform_device *pdev)
240 225
241 ehci_mv->mode = pdata->mode; 226 ehci_mv->mode = pdata->mode;
242 if (ehci_mv->mode == MV_USB_MODE_OTG) { 227 if (ehci_mv->mode == MV_USB_MODE_OTG) {
243#ifdef CONFIG_USB_OTG_UTILS
244 ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); 228 ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
245 if (IS_ERR_OR_NULL(ehci_mv->otg)) { 229 if (IS_ERR(ehci_mv->otg)) {
246 dev_err(&pdev->dev, 230 retval = PTR_ERR(ehci_mv->otg);
247 "unable to find transceiver\n"); 231
248 retval = -ENODEV; 232 if (retval == -ENXIO)
233 dev_info(&pdev->dev, "MV_USB_MODE_OTG "
234 "must have CONFIG_USB_PHY enabled\n");
235 else
236 dev_err(&pdev->dev,
237 "unable to find transceiver\n");
249 goto err_disable_clk; 238 goto err_disable_clk;
250 } 239 }
251 240
@@ -258,11 +247,6 @@ static int mv_ehci_probe(struct platform_device *pdev)
258 } 247 }
259 /* otg will enable clock before use as host */ 248 /* otg will enable clock before use as host */
260 mv_ehci_disable(ehci_mv); 249 mv_ehci_disable(ehci_mv);
261#else
262 dev_info(&pdev->dev, "MV_USB_MODE_OTG "
263 "must have CONFIG_USB_OTG_UTILS enabled\n");
264 goto err_disable_clk;
265#endif
266 } else { 250 } else {
267 if (pdata->set_vbus) 251 if (pdata->set_vbus)
268 pdata->set_vbus(1); 252 pdata->set_vbus(1);