2 * OHCI HCD (Host Controller Driver) for USB.
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
6 * (C) Copyright 2002 Hewlett-Packard Company
8 * Bus Glue for AMD Alchemy Au1xxx
10 * Written by Christopher Hoover <ch@hpl.hp.com>
11 * Based on fragments of previous driver by Rusell King et al.
13 * Modified for LH7A404 from ahcd-sa1111.c
14 * by Durgesh Pattamatta <pattamattad@sharpsec.com>
15 * Modified for AMD Alchemy Au1xxx
16 * by Matt Porter <mporter@kernel.crashing.org>
18 * This file is licenced under the GPL.
21 #include <linux/platform_device.h>
22 #include <linux/signal.h>
24 #include <asm/bootinfo.h>
25 #include <adm5120_defs.h>
28 #define HCD_DBG(f, a...) printk(KERN_DEBUG "%s: " f, hcd_name, ## a)
30 #define HCD_DBG(f, a...) do {} while (0)
32 #define HCD_ERR(f, a...) printk(KERN_ERR "%s: " f, hcd_name, ## a)
33 #define HCD_INFO(f, a...) printk(KERN_INFO "%s: " f, hcd_name, ## a)
35 /*-------------------------------------------------------------------------*/
37 static int admhc_adm5120_probe(const struct hc_driver
*driver
,
38 struct platform_device
*dev
)
43 struct resource
*regs
;
46 regs
= platform_get_resource(dev
, IORESOURCE_MEM
, 0);
48 HCD_DBG("no IOMEM resource found\n");
52 irq
= platform_get_irq(dev
, 0);
54 HCD_DBG("no IRQ resource found\n");
58 hcd
= usb_create_hcd(driver
, &dev
->dev
, "ADM5120");
62 hcd
->rsrc_start
= regs
->start
;
63 hcd
->rsrc_len
= regs
->end
- regs
->start
+ 1;
65 if (!request_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
, hcd_name
)) {
66 HCD_DBG("request_mem_region failed\n");
71 hcd
->regs
= ioremap(hcd
->rsrc_start
, hcd
->rsrc_len
);
73 HCD_DBG("ioremap failed\n");
78 admhc_hcd_init(hcd_to_admhcd(hcd
));
80 retval
= usb_add_hcd(hcd
, irq
, IRQF_DISABLED
);
89 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
96 /* may be called without controller electrically present */
97 /* may be called with controller, bus, and devices active */
99 static void admhc_adm5120_remove(struct usb_hcd
*hcd
,
100 struct platform_device
*dev
)
104 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
108 /*-------------------------------------------------------------------------*/
111 admhc_adm5120_start(struct usb_hcd
*hcd
)
113 struct admhcd
*ahcd
= hcd_to_admhcd (hcd
);
116 ret
= admhc_init(ahcd
);
118 HCD_ERR("unable to init %s\n", hcd
->self
.bus_name
);
122 ret
= admhc_run(ahcd
);
124 HCD_ERR("unable to run %s\n", hcd
->self
.bus_name
);
136 /*-------------------------------------------------------------------------*/
138 static const struct hc_driver adm5120_hc_driver
= {
139 .description
= hcd_name
,
140 .product_desc
= "ADM5120 built-in USB 1.1 Host Controller",
141 .hcd_priv_size
= sizeof(struct admhcd
),
144 * generic hardware linkage
147 .flags
= HCD_USB11
| HCD_MEMORY
,
150 * basic lifecycle operations
152 .start
= admhc_adm5120_start
,
154 .shutdown
= admhc_shutdown
,
157 * managing i/o requests and associated device resources
159 .urb_enqueue
= admhc_urb_enqueue
,
160 .urb_dequeue
= admhc_urb_dequeue
,
161 .endpoint_disable
= admhc_endpoint_disable
,
166 .get_frame_number
= admhc_get_frame_number
,
171 .hub_status_data
= admhc_hub_status_data
,
172 .hub_control
= admhc_hub_control
,
173 .hub_irq_enable
= admhc_hub_irq_enable
,
175 .bus_suspend
= admhc_bus_suspend
,
176 .bus_resume
= admhc_bus_resume
,
178 .start_port_reset
= admhc_start_port_reset
,
181 /*-------------------------------------------------------------------------*/
183 static int usb_hcd_adm5120_probe(struct platform_device
*pdev
)
187 if (mips_machgroup
!= MACH_GROUP_ADM5120
)
190 ret
= admhc_adm5120_probe(&adm5120_hc_driver
, pdev
);
195 static int usb_hcd_adm5120_remove(struct platform_device
*pdev
)
197 struct usb_hcd
*hcd
= platform_get_drvdata(pdev
);
199 admhc_adm5120_remove(hcd
, pdev
);
206 static int usb_hcd_adm5120_suspend(struct platform_device
*dev
)
208 struct usb_hcd
*hcd
= platform_get_drvdata(dev
);
213 static int usb_hcd_adm5120_resume(struct platform_device
*dev
)
215 struct usb_hcd
*hcd
= platform_get_drvdata(dev
);
220 #define usb_hcd_adm5120_suspend NULL
221 #define usb_hcd_adm5120_resume NULL
222 #endif /* CONFIG_PM */
224 static struct platform_driver usb_hcd_adm5120_driver
= {
225 .probe
= usb_hcd_adm5120_probe
,
226 .remove
= usb_hcd_adm5120_remove
,
227 .shutdown
= usb_hcd_platform_shutdown
,
228 .suspend
= usb_hcd_adm5120_suspend
,
229 .resume
= usb_hcd_adm5120_resume
,
231 .name
= "adm5120-hcd",
232 .owner
= THIS_MODULE
,