ARM: at91: usb ehci add dt support

Signed-off-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6a062459
...@@ -17,3 +17,15 @@ usb0: ohci@00500000 { ...@@ -17,3 +17,15 @@ usb0: ohci@00500000 {
interrupts = <20 4>; interrupts = <20 4>;
num-ports = <2>; num-ports = <2>;
}; };
EHCI
Required properties:
- compatible: Should be "atmel,at91sam9g45-ehci" for USB controllers
used in host mode.
usb1: ehci@00800000 {
compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
reg = <0x00800000 0x100000>;
interrupts = <22 4>;
};
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_platform.h>
/* interface and function clocks */ /* interface and function clocks */
static struct clk *iclk, *fclk; static struct clk *iclk, *fclk;
...@@ -115,6 +116,8 @@ static const struct hc_driver ehci_atmel_hc_driver = { ...@@ -115,6 +116,8 @@ static const struct hc_driver ehci_atmel_hc_driver = {
.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
}; };
static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);
static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
...@@ -137,6 +140,13 @@ static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) ...@@ -137,6 +140,13 @@ static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
goto fail_create_hcd; goto fail_create_hcd;
} }
/* Right now device-tree probed devices don't get dma_mask set.
* Since shared usb code relies on it, set it here for now.
* Once we have dma capability bindings this can go away.
*/
if (!pdev->dev.dma_mask)
pdev->dev.dma_mask = &at91_ehci_dma_mask;
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
if (!hcd) { if (!hcd) {
retval = -ENOMEM; retval = -ENOMEM;
...@@ -225,9 +235,21 @@ static int __devexit ehci_atmel_drv_remove(struct platform_device *pdev) ...@@ -225,9 +235,21 @@ static int __devexit ehci_atmel_drv_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_OF
static const struct of_device_id atmel_ehci_dt_ids[] = {
{ .compatible = "atmel,at91sam9g45-ehci" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids);
#endif
static struct platform_driver ehci_atmel_driver = { static struct platform_driver ehci_atmel_driver = {
.probe = ehci_atmel_drv_probe, .probe = ehci_atmel_drv_probe,
.remove = __devexit_p(ehci_atmel_drv_remove), .remove = __devexit_p(ehci_atmel_drv_remove),
.shutdown = usb_hcd_platform_shutdown, .shutdown = usb_hcd_platform_shutdown,
.driver.name = "atmel-ehci", .driver = {
.name = "atmel-ehci",
.of_match_table = of_match_ptr(atmel_ehci_dt_ids),
},
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment