aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-10-20 07:10:00 -0400
committerJason Cooper <jason@lakedaemon.net>2012-11-23 21:53:12 -0500
commit77dae54ab385033e488d8b07045bc7f8d931740f (patch)
tree370d645c4cc15cbcd85161973e1a6c3584c04614
parentec65aed950d619c6ec9883679631bdf6e7aa4527 (diff)
ARM: Kirkwood: ehci-orion: Add device tree binding
Based on previous work by Michael Walle and Jason Cooper. Made their work actually work, which required added interrupt from DT and auxdata, along with setting the dma_mask, which DT does not currently do. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--Documentation/devicetree/bindings/usb/ehci-orion.txt15
-rw-r--r--drivers/usb/host/ehci-orion.c38
2 files changed, 50 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/usb/ehci-orion.txt b/Documentation/devicetree/bindings/usb/ehci-orion.txt
new file mode 100644
index 000000000000..6bc09ec14c4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ehci-orion.txt
@@ -0,0 +1,15 @@
1* EHCI controller, Orion Marvell variants
2
3Required properties:
4- compatible: must be "marvell,orion-ehci"
5- reg: physical base address of the controller and length of memory mapped
6 region.
7- interrupts: The EHCI interrupt
8
9Example:
10
11 ehci@50000 {
12 compatible = "marvell,orion-ehci";
13 reg = <0x50000 0x1000>;
14 interrupts = <19>;
15 };
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};