aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-platform.c')
-rw-r--r--drivers/usb/host/ehci-platform.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index ca7506390542..cda0fa9613e7 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -18,11 +18,13 @@
18 * 18 *
19 * Licensed under the GNU/GPL. See COPYING for details. 19 * Licensed under the GNU/GPL. See COPYING for details.
20 */ 20 */
21#include <linux/dma-mapping.h>
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/kernel.h> 23#include <linux/kernel.h>
23#include <linux/hrtimer.h> 24#include <linux/hrtimer.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/of.h>
26#include <linux/platform_device.h> 28#include <linux/platform_device.h>
27#include <linux/usb.h> 29#include <linux/usb.h>
28#include <linux/usb/hcd.h> 30#include <linux/usb/hcd.h>
@@ -62,22 +64,32 @@ static const struct ehci_driver_overrides platform_overrides __initdata = {
62 .reset = ehci_platform_reset, 64 .reset = ehci_platform_reset,
63}; 65};
64 66
67static struct usb_ehci_pdata ehci_platform_defaults;
68
65static int ehci_platform_probe(struct platform_device *dev) 69static int ehci_platform_probe(struct platform_device *dev)
66{ 70{
67 struct usb_hcd *hcd; 71 struct usb_hcd *hcd;
68 struct resource *res_mem; 72 struct resource *res_mem;
69 struct usb_ehci_pdata *pdata = dev->dev.platform_data; 73 struct usb_ehci_pdata *pdata;
70 int irq; 74 int irq;
71 int err = -ENOMEM; 75 int err = -ENOMEM;
72 76
73 if (!pdata) {
74 WARN_ON(1);
75 return -ENODEV;
76 }
77
78 if (usb_disabled()) 77 if (usb_disabled())
79 return -ENODEV; 78 return -ENODEV;
80 79
80 /*
81 * use reasonable defaults so platforms don't have to provide these.
82 * with DT probing on ARM, none of these are set.
83 */
84 if (!dev->dev.platform_data)
85 dev->dev.platform_data = &ehci_platform_defaults;
86 if (!dev->dev.dma_mask)
87 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
88 if (!dev->dev.coherent_dma_mask)
89 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
90
91 pdata = dev->dev.platform_data;
92
81 irq = platform_get_irq(dev, 0); 93 irq = platform_get_irq(dev, 0);
82 if (irq < 0) { 94 if (irq < 0) {
83 dev_err(&dev->dev, "no irq provided"); 95 dev_err(&dev->dev, "no irq provided");
@@ -139,6 +151,9 @@ static int ehci_platform_remove(struct platform_device *dev)
139 if (pdata->power_off) 151 if (pdata->power_off)
140 pdata->power_off(dev); 152 pdata->power_off(dev);
141 153
154 if (pdata == &ehci_platform_defaults)
155 dev->dev.platform_data = NULL;
156
142 return 0; 157 return 0;
143} 158}
144 159
@@ -183,6 +198,12 @@ static int ehci_platform_resume(struct device *dev)
183#define ehci_platform_resume NULL 198#define ehci_platform_resume NULL
184#endif /* CONFIG_PM */ 199#endif /* CONFIG_PM */
185 200
201static const struct of_device_id vt8500_ehci_ids[] = {
202 { .compatible = "via,vt8500-ehci", },
203 { .compatible = "wm,prizm-ehci", },
204 {}
205};
206
186static const struct platform_device_id ehci_platform_table[] = { 207static const struct platform_device_id ehci_platform_table[] = {
187 { "ehci-platform", 0 }, 208 { "ehci-platform", 0 },
188 { } 209 { }
@@ -203,6 +224,7 @@ static struct platform_driver ehci_platform_driver = {
203 .owner = THIS_MODULE, 224 .owner = THIS_MODULE,
204 .name = "ehci-platform", 225 .name = "ehci-platform",
205 .pm = &ehci_platform_pm_ops, 226 .pm = &ehci_platform_pm_ops,
227 .of_match_table = of_match_ptr(vt8500_ehci_ids),
206 } 228 }
207}; 229};
208 230