2 * OHCI HCD for Netlogic XLS processors.
4 * (C) Copyright 2011 Netlogic Microsystems Inc.
6 * Based on ohci-au1xxx.c, and other Linux OHCI drivers.
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
13 #include <linux/platform_device.h>
14 #include <linux/signal.h>
16 static int ohci_xls_probe_internal(const struct hc_driver
*driver
,
17 struct platform_device
*dev
)
23 /* Get our IRQ from an earlier registered Platform Resource */
24 irq
= platform_get_irq(dev
, 0);
26 dev_err(&dev
->dev
, "Found HC with no IRQ\n");
30 /* Get our Memory Handle */
31 res
= platform_get_resource(dev
, IORESOURCE_MEM
, 0);
33 dev_err(&dev
->dev
, "MMIO Handle incorrect!\n");
37 hcd
= usb_create_hcd(driver
, &dev
->dev
, "XLS");
42 hcd
->rsrc_start
= res
->start
;
43 hcd
->rsrc_len
= resource_size(res
);
45 if (!request_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
,
46 driver
->description
)) {
47 dev_dbg(&dev
->dev
, "Controller already in use\n");
52 hcd
->regs
= ioremap_nocache(hcd
->rsrc_start
, hcd
->rsrc_len
);
53 if (hcd
->regs
== NULL
) {
54 dev_dbg(&dev
->dev
, "error mapping memory\n");
59 retval
= usb_add_hcd(hcd
, irq
, IRQF_DISABLED
| IRQF_SHARED
);
67 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
71 dev_err(&dev
->dev
, "init fail, %d\n", retval
);
75 static int ohci_xls_reset(struct usb_hcd
*hcd
)
77 struct ohci_hcd
*ohci
= hcd_to_ohci(hcd
);
80 return ohci_init(ohci
);
83 static int __devinit
ohci_xls_start(struct usb_hcd
*hcd
)
85 struct ohci_hcd
*ohci
;
88 ohci
= hcd_to_ohci(hcd
);
91 err("can't start %s", hcd
->self
.bus_name
);
98 static struct hc_driver ohci_xls_hc_driver
= {
99 .description
= hcd_name
,
100 .product_desc
= "XLS OHCI Host Controller",
101 .hcd_priv_size
= sizeof(struct ohci_hcd
),
103 .flags
= HCD_MEMORY
| HCD_USB11
,
104 .reset
= ohci_xls_reset
,
105 .start
= ohci_xls_start
,
107 .shutdown
= ohci_shutdown
,
108 .urb_enqueue
= ohci_urb_enqueue
,
109 .urb_dequeue
= ohci_urb_dequeue
,
110 .endpoint_disable
= ohci_endpoint_disable
,
111 .get_frame_number
= ohci_get_frame
,
112 .hub_status_data
= ohci_hub_status_data
,
113 .hub_control
= ohci_hub_control
,
115 .bus_suspend
= ohci_bus_suspend
,
116 .bus_resume
= ohci_bus_resume
,
118 .start_port_reset
= ohci_start_port_reset
,
121 static int ohci_xls_probe(struct platform_device
*dev
)
125 pr_debug("In ohci_xls_probe");
128 ret
= ohci_xls_probe_internal(&ohci_xls_hc_driver
, dev
);
132 static int ohci_xls_remove(struct platform_device
*dev
)
134 struct usb_hcd
*hcd
= platform_get_drvdata(dev
);
138 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
143 static struct platform_driver ohci_xls_driver
= {
144 .probe
= ohci_xls_probe
,
145 .remove
= ohci_xls_remove
,
146 .shutdown
= usb_hcd_platform_shutdown
,
148 .name
= "ohci-xls-0",
149 .owner
= THIS_MODULE
,