Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: EHCI: ehci-mv: add DT support

Add Device tree support.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lubomir Rintel and committed by
Greg Kroah-Hartman
813e18b1 a740f20d

+23 -18
+23 -18
drivers/usb/host/ehci-mv.c
··· 34 34 void __iomem *op_regs; 35 35 36 36 struct usb_phy *otg; 37 + struct clk *clk; 37 38 38 - struct mv_usb_platform_data *pdata; 39 39 struct phy *phy; 40 40 41 - struct clk *clk; 41 + int (*set_vbus)(unsigned int vbus); 42 42 }; 43 43 44 44 static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) ··· 100 100 int retval = -ENODEV; 101 101 u32 offset; 102 102 103 - if (!pdata) { 104 - dev_err(&pdev->dev, "missing platform_data\n"); 105 - return -ENODEV; 106 - } 107 - 108 103 if (usb_disabled()) 109 104 return -ENODEV; 110 105 ··· 109 114 110 115 platform_set_drvdata(pdev, hcd); 111 116 ehci_mv = hcd_to_ehci_hcd_mv(hcd); 112 - ehci_mv->pdata = pdata; 117 + 118 + ehci_mv->mode = MV_USB_MODE_HOST; 119 + if (pdata) { 120 + ehci_mv->mode = pdata->mode; 121 + ehci_mv->set_vbus = pdata->set_vbus; 122 + } 113 123 114 124 ehci_mv->phy = devm_phy_get(&pdev->dev, "usb"); 115 125 if (IS_ERR(ehci_mv->phy)) { ··· 166 166 ehci = hcd_to_ehci(hcd); 167 167 ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs; 168 168 169 - ehci_mv->mode = pdata->mode; 170 169 if (ehci_mv->mode == MV_USB_MODE_OTG) { 171 170 ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); 172 171 if (IS_ERR(ehci_mv->otg)) { ··· 190 191 /* otg will enable clock before use as host */ 191 192 mv_ehci_disable(ehci_mv); 192 193 } else { 193 - if (pdata->set_vbus) 194 - pdata->set_vbus(1); 194 + if (ehci_mv->set_vbus) 195 + ehci_mv->set_vbus(1); 195 196 196 197 retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); 197 198 if (retval) { ··· 210 211 return 0; 211 212 212 213 err_set_vbus: 213 - if (pdata->set_vbus) 214 - pdata->set_vbus(0); 214 + if (ehci_mv->set_vbus) 215 + ehci_mv->set_vbus(0); 215 216 err_disable_clk: 216 217 mv_ehci_disable(ehci_mv); 217 218 err_put_hcd: ··· 232 233 otg_set_host(ehci_mv->otg->otg, NULL); 233 234 234 235 if (ehci_mv->mode == MV_USB_MODE_HOST) { 235 - if (ehci_mv->pdata->set_vbus) 236 - ehci_mv->pdata->set_vbus(0); 236 + if (ehci_mv->set_vbus) 237 + ehci_mv->set_vbus(0); 237 238 238 239 mv_ehci_disable(ehci_mv); 239 240 } ··· 264 265 hcd->driver->shutdown(hcd); 265 266 } 266 267 268 + static const struct of_device_id ehci_mv_dt_ids[] = { 269 + { .compatible = "marvell,pxau2o-ehci", }, 270 + {}, 271 + }; 272 + 267 273 static struct platform_driver ehci_mv_driver = { 268 274 .probe = mv_ehci_probe, 269 275 .remove = mv_ehci_remove, 270 276 .shutdown = mv_ehci_shutdown, 271 277 .driver = { 272 - .name = "mv-ehci", 273 - .bus = &platform_bus_type, 274 - }, 278 + .name = "mv-ehci", 279 + .bus = &platform_bus_type, 280 + .of_match_table = ehci_mv_dt_ids, 281 + }, 275 282 .id_table = ehci_id_table, 276 283 }; 277 284