2 * IXP4XX EHCI Host Controller Driver
4 * Author: Vladimir Barinov <vbarinov@embeddedalley.com>
6 * Based on "ehci-fsl.c" by Randy Vinson <rvinson@mvista.com>
8 * 2007 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
14 #include <linux/platform_device.h>
16 static int ixp4xx_ehci_init(struct usb_hcd
*hcd
)
18 struct ehci_hcd
*ehci
= hcd_to_ehci(hcd
);
21 ehci
->big_endian_desc
= 1;
22 ehci
->big_endian_mmio
= 1;
24 ehci
->caps
= hcd
->regs
+ 0x100;
25 ehci
->regs
= hcd
->regs
+ 0x100
26 + HC_LENGTH(ehci
, ehci_readl(ehci
, &ehci
->caps
->hc_capbase
));
27 ehci
->hcs_params
= ehci_readl(ehci
, &ehci
->caps
->hcs_params
);
32 retval
= ehci_init(hcd
);
36 ehci_port_power(ehci
, 0);
41 static const struct hc_driver ixp4xx_ehci_hc_driver
= {
42 .description
= hcd_name
,
43 .product_desc
= "IXP4XX EHCI Host Controller",
44 .hcd_priv_size
= sizeof(struct ehci_hcd
),
46 .flags
= HCD_MEMORY
| HCD_USB2
,
47 .reset
= ixp4xx_ehci_init
,
50 .shutdown
= ehci_shutdown
,
51 .urb_enqueue
= ehci_urb_enqueue
,
52 .urb_dequeue
= ehci_urb_dequeue
,
53 .endpoint_disable
= ehci_endpoint_disable
,
54 .endpoint_reset
= ehci_endpoint_reset
,
55 .get_frame_number
= ehci_get_frame
,
56 .hub_status_data
= ehci_hub_status_data
,
57 .hub_control
= ehci_hub_control
,
58 #if defined(CONFIG_PM)
59 .bus_suspend
= ehci_bus_suspend
,
60 .bus_resume
= ehci_bus_resume
,
62 .relinquish_port
= ehci_relinquish_port
,
63 .port_handed_over
= ehci_port_handed_over
,
65 .clear_tt_buffer_complete
= ehci_clear_tt_buffer_complete
,
68 static int ixp4xx_ehci_probe(struct platform_device
*pdev
)
71 const struct hc_driver
*driver
= &ixp4xx_ehci_hc_driver
;
79 res
= platform_get_resource(pdev
, IORESOURCE_IRQ
, 0);
82 "Found HC with no IRQ. Check %s setup!\n",
83 dev_name(&pdev
->dev
));
88 hcd
= usb_create_hcd(driver
, &pdev
->dev
, dev_name(&pdev
->dev
));
94 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
97 "Found HC with no register addr. Check %s setup!\n",
98 dev_name(&pdev
->dev
));
100 goto fail_request_resource
;
102 hcd
->rsrc_start
= res
->start
;
103 hcd
->rsrc_len
= resource_size(res
);
105 if (!request_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
,
106 driver
->description
)) {
107 dev_dbg(&pdev
->dev
, "controller already in use\n");
109 goto fail_request_resource
;
112 hcd
->regs
= ioremap_nocache(hcd
->rsrc_start
, hcd
->rsrc_len
);
113 if (hcd
->regs
== NULL
) {
114 dev_dbg(&pdev
->dev
, "error mapping memory\n");
119 retval
= usb_add_hcd(hcd
, irq
, IRQF_SHARED
);
128 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
129 fail_request_resource
:
132 dev_err(&pdev
->dev
, "init %s fail, %d\n", dev_name(&pdev
->dev
), retval
);
136 static int ixp4xx_ehci_remove(struct platform_device
*pdev
)
138 struct usb_hcd
*hcd
= platform_get_drvdata(pdev
);
142 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
148 MODULE_ALIAS("platform:ixp4xx-ehci");
150 static struct platform_driver ixp4xx_ehci_driver
= {
151 .probe
= ixp4xx_ehci_probe
,
152 .remove
= ixp4xx_ehci_remove
,
154 .name
= "ixp4xx-ehci",