aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-orion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-orion.c')
-rw-r--r--drivers/usb/host/ehci-orion.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 9c2717d66730..e7e8275028d3 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -14,6 +14,9 @@
14#include <linux/mbus.h> 14#include <linux/mbus.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_data/usb-ehci-orion.h> 16#include <linux/platform_data/usb-ehci-orion.h>
17#include <linux/of.h>
18#include <linux/of_device.h>
19#include <linux/of_irq.h>
17 20
18#define rdl(off) __raw_readl(hcd->regs + (off)) 21#define rdl(off) __raw_readl(hcd->regs + (off))
19#define wrl(off, val) __raw_writel((val), hcd->regs + (off)) 22#define wrl(off, val) __raw_writel((val), hcd->regs + (off))
@@ -181,6 +184,8 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
181 } 184 }
182} 185}
183 186
187static u64 ehci_orion_dma_mask = DMA_BIT_MASK(32);
188
184static int __devinit ehci_orion_drv_probe(struct platform_device *pdev) 189static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
185{ 190{
186 struct orion_ehci_data *pd = pdev->dev.platform_data; 191 struct orion_ehci_data *pd = pdev->dev.platform_data;
@@ -191,13 +196,17 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
191 struct clk *clk; 196 struct clk *clk;
192 void __iomem *regs; 197 void __iomem *regs;
193 int irq, err; 198 int irq, err;
199 enum orion_ehci_phy_ver phy_version;
194 200
195 if (usb_disabled()) 201 if (usb_disabled())
196 return -ENODEV; 202 return -ENODEV;
197 203
198 pr_debug("Initializing Orion-SoC USB Host Controller\n"); 204 pr_debug("Initializing Orion-SoC USB Host Controller\n");
199 205
200 irq = platform_get_irq(pdev, 0); 206 if (pdev->dev.of_node)
207 irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
208 else
209 irq = platform_get_irq(pdev, 0);
201 if (irq <= 0) { 210 if (irq <= 0) {
202 dev_err(&pdev->dev, 211 dev_err(&pdev->dev,
203 "Found HC with no IRQ. Check %s setup!\n", 212 "Found HC with no IRQ. Check %s setup!\n",
@@ -215,6 +224,14 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
215 goto err1; 224 goto err1;
216 } 225 }
217 226
227 /*
228 * Right now device-tree probed devices don't get dma_mask
229 * set. Since shared usb code relies on it, set it here for
230 * now. Once we have dma capability bindings this can go away.
231 */
232 if (!pdev->dev.dma_mask)
233 pdev->dev.dma_mask = &ehci_orion_dma_mask;
234
218 if (!request_mem_region(res->start, resource_size(res), 235 if (!request_mem_region(res->start, resource_size(res),
219 ehci_orion_hc_driver.description)) { 236 ehci_orion_hc_driver.description)) {
220 dev_dbg(&pdev->dev, "controller already in use\n"); 237 dev_dbg(&pdev->dev, "controller already in use\n");
@@ -262,7 +279,12 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
262 /* 279 /*
263 * setup Orion USB controller. 280 * setup Orion USB controller.
264 */ 281 */
265 switch (pd->phy_version) { 282 if (pdev->dev.of_node)
283 phy_version = EHCI_PHY_NA;
284 else
285 phy_version = pd->phy_version;
286
287 switch (phy_version) {
266 case EHCI_PHY_NA: /* dont change USB phy settings */ 288 case EHCI_PHY_NA: /* dont change USB phy settings */
267 break; 289 break;
268 case EHCI_PHY_ORION: 290 case EHCI_PHY_ORION:
@@ -317,9 +339,19 @@ static int __exit ehci_orion_drv_remove(struct platform_device *pdev)
317 339
318MODULE_ALIAS("platform:orion-ehci"); 340MODULE_ALIAS("platform:orion-ehci");
319 341
342static const struct of_device_id ehci_orion_dt_ids[] __devinitdata = {
343 { .compatible = "marvell,orion-ehci", },
344 {},
345};
346MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);
347
320static struct platform_driver ehci_orion_driver = { 348static struct platform_driver ehci_orion_driver = {
321 .probe = ehci_orion_drv_probe, 349 .probe = ehci_orion_drv_probe,
322 .remove = __exit_p(ehci_orion_drv_remove), 350 .remove = __exit_p(ehci_orion_drv_remove),
323 .shutdown = usb_hcd_platform_shutdown, 351 .shutdown = usb_hcd_platform_shutdown,
324 .driver.name = "orion-ehci", 352 .driver = {
353 .name = "orion-ehci",
354 .owner = THIS_MODULE,
355 .of_match_table = of_match_ptr(ehci_orion_dt_ids),
356 },
325}; 357};