summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/ehci-ppc-of.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 8063b9d3aebd..457d15da40a3 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -18,8 +18,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
static const struct hc_driver ehci_ppc_of_hc_driver = {
@@ -96,7 +94,9 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
struct ehci_hcd *ehci = NULL;
- struct resource res;
+ struct resource *res;
+ struct resource ohci_res;
+ void __iomem *regs;
int irq;
int rv;
@@ -107,39 +107,30 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
dev_dbg(&op->dev, "initializing PPC-OF USB Controller\n");
- rv = of_address_to_resource(dn, 0, &res);
- if (rv)
- return rv;
+ regs = devm_platform_get_and_ioremap_resource(op, 0, &res);
+ if (IS_ERR(regs))
+ return PTR_ERR(regs);
+
+ irq = platform_get_irq(op, 0);
+ if (irq < 0)
+ return irq;
hcd = usb_create_hcd(&ehci_ppc_of_hc_driver, &op->dev, "PPC-OF USB");
if (!hcd)
return -ENOMEM;
- hcd->rsrc_start = res.start;
- hcd->rsrc_len = resource_size(&res);
-
- irq = irq_of_parse_and_map(dn, 0);
- if (!irq) {
- dev_err(&op->dev, "%s: irq_of_parse_and_map failed\n",
- __FILE__);
- rv = -EBUSY;
- goto err_irq;
- }
-
- hcd->regs = devm_ioremap_resource(&op->dev, &res);
- if (IS_ERR(hcd->regs)) {
- rv = PTR_ERR(hcd->regs);
- goto err_ioremap;
- }
+ hcd->regs = regs;
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = resource_size(res);
ehci = hcd_to_ehci(hcd);
np = of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx");
if (np != NULL) {
/* claim we really affected by usb23 erratum */
- if (!of_address_to_resource(np, 0, &res))
+ if (!of_address_to_resource(np, 0, &ohci_res))
ehci->ohci_hcctrl_reg =
devm_ioremap(&op->dev,
- res.start + OHCI_HCCTRL_OFFSET,
+ ohci_res.start + OHCI_HCCTRL_OFFSET,
OHCI_HCCTRL_LEN);
else
pr_debug("%s: no ohci offset in fdt\n", __FILE__);
@@ -170,14 +161,12 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
rv = usb_add_hcd(hcd, irq, 0);
if (rv)
- goto err_ioremap;
+ goto err;
device_wakeup_enable(hcd->self.controller);
return 0;
-err_ioremap:
- irq_dispose_mapping(irq);
-err_irq:
+err:
usb_put_hcd(hcd);
return rv;
@@ -196,8 +185,6 @@ static void ehci_hcd_ppc_of_remove(struct platform_device *op)
usb_remove_hcd(hcd);
- irq_dispose_mapping(hcd->irq);
-
/* use request_mem_region to test if the ohci driver is loaded. if so
* ensure the ohci core is operational.
*/