[linux-yocto] [PATCH 81/87] drivers/usb: ehci-ci13612.c replaced hard-coded address and irq to use dtb
Paul Butler
butler.paul at gmail.com
Mon May 27 09:56:52 PDT 2013
Signed-off-by: Paul Butler <paul.butler at windriver.com>
---
drivers/usb/host/ehci-ci13612.c | 17 ++++++++++++-----
drivers/usb/host/ehci-ci13612.h | 9 ---------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/host/ehci-ci13612.c b/drivers/usb/host/ehci-ci13612.c
index 8b7102f..34a48b3 100644
--- a/drivers/usb/host/ehci-ci13612.c
+++ b/drivers/usb/host/ehci-ci13612.c
@@ -163,7 +163,7 @@ static int ci13612_ehci_probe(struct platform_device *pdev)
int retval;
struct device_node *np = pdev->dev.of_node;
const int *enabled;
-
+ struct resource *res;
enabled = of_get_property(np, "enabled", NULL);
if (!enabled || !*enabled)
@@ -173,10 +173,10 @@ static int ci13612_ehci_probe(struct platform_device *pdev)
return -ENODEV;
/* Map the irq in the PPC476 to get the irq number */
- irq = irq_create_mapping(NULL, 31);
+ irq = platform_get_irq(pdev, 0);
if (NO_IRQ == irq) {
- dev_dbg(&pdev->dev, "error mapping irq number\n");
+ dev_dbg(&pdev->dev, "error getting irq number\n");
retval = -EBUSY;
goto fail_create_hcd;
}
@@ -187,14 +187,21 @@ static int ci13612_ehci_probe(struct platform_device *pdev)
goto fail_create_hcd;
}
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(&pdev->dev, "Error: resource addr %s setup!\n",
+ dev_name(&pdev->dev));
+ return -ENODEV;
+ }
+
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
if (!hcd) {
retval = -ENOMEM;
goto fail_create_hcd;
}
- hcd->rsrc_start = ci13612_PHY_ADDR;
- hcd->rsrc_len = 0x20000;
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = resource_size(res);
hcd->regs = of_iomap(np, 0);
if (!hcd->regs) {
diff --git a/drivers/usb/host/ehci-ci13612.h b/drivers/usb/host/ehci-ci13612.h
index 9d296ce..b257cf7 100644
--- a/drivers/usb/host/ehci-ci13612.h
+++ b/drivers/usb/host/ehci-ci13612.h
@@ -1,13 +1,4 @@
/*
- * System definitions
- */
-#define ci13612_PHY_ADDR 0x0020004A0000ULL
-#define ci13162_PHY_ADDR_SIZE 0x20000
-
-#define GPREG_PHY_ADDR 0x00200040C000ULL
-#define GPREG_PHY_ADDR_SIZE 0x1000
-
-/*
* Host interface registers
*/
--
1.8.3
More information about the linux-yocto
mailing list