2 * EHCI HCD for Netlogic XLS processors.
4 * (C) Copyright 2011 Netlogic Microsystems Inc.
6 * Based on various ehci-*.c 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>
15 static int ehci_xls_setup(struct usb_hcd
*hcd
)
18 struct ehci_hcd
*ehci
= hcd_to_ehci(hcd
);
20 ehci
->caps
= hcd
->regs
;
21 ehci
->regs
= hcd
->regs
+
22 HC_LENGTH(ehci
, ehci_readl(ehci
, &ehci
->caps
->hc_capbase
));
23 dbg_hcs_params(ehci
, "reset");
24 dbg_hcc_params(ehci
, "reset");
26 /* cache this readonly data; minimize chip reads */
27 ehci
->hcs_params
= ehci_readl(ehci
, &ehci
->caps
->hcs_params
);
29 retval
= ehci_halt(ehci
);
33 /* data structure init */
34 retval
= ehci_init(hcd
);
43 int ehci_xls_probe_internal(const struct hc_driver
*driver
,
44 struct platform_device
*pdev
)
50 /* Get our IRQ from an earlier registered Platform Resource */
51 irq
= platform_get_irq(pdev
, 0);
53 dev_err(&pdev
->dev
, "Found HC with no IRQ. Check %s setup!\n",
54 dev_name(&pdev
->dev
));
58 /* Get our Memory Handle */
59 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
61 dev_err(&pdev
->dev
, "Error: MMIO Handle %s setup!\n",
62 dev_name(&pdev
->dev
));
65 hcd
= usb_create_hcd(driver
, &pdev
->dev
, dev_name(&pdev
->dev
));
71 hcd
->rsrc_start
= res
->start
;
72 hcd
->rsrc_len
= resource_size(res
);
74 if (!request_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
,
75 driver
->description
)) {
76 dev_dbg(&pdev
->dev
, "controller already in use\n");
80 hcd
->regs
= ioremap_nocache(hcd
->rsrc_start
, hcd
->rsrc_len
);
82 if (hcd
->regs
== NULL
) {
83 dev_dbg(&pdev
->dev
, "error mapping memory\n");
88 retval
= usb_add_hcd(hcd
, irq
, IRQF_SHARED
);
96 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
100 dev_err(&pdev
->dev
, "init %s fail, %d\n", dev_name(&pdev
->dev
),
105 static struct hc_driver ehci_xls_hc_driver
= {
106 .description
= hcd_name
,
107 .product_desc
= "XLS EHCI Host Controller",
108 .hcd_priv_size
= sizeof(struct ehci_hcd
),
110 .flags
= HCD_USB2
| HCD_MEMORY
,
111 .reset
= ehci_xls_setup
,
114 .shutdown
= ehci_shutdown
,
116 .urb_enqueue
= ehci_urb_enqueue
,
117 .urb_dequeue
= ehci_urb_dequeue
,
118 .endpoint_disable
= ehci_endpoint_disable
,
119 .endpoint_reset
= ehci_endpoint_reset
,
121 .get_frame_number
= ehci_get_frame
,
123 .hub_status_data
= ehci_hub_status_data
,
124 .hub_control
= ehci_hub_control
,
125 .bus_suspend
= ehci_bus_suspend
,
126 .bus_resume
= ehci_bus_resume
,
127 .relinquish_port
= ehci_relinquish_port
,
128 .port_handed_over
= ehci_port_handed_over
,
130 .clear_tt_buffer_complete
= ehci_clear_tt_buffer_complete
,
133 static int ehci_xls_probe(struct platform_device
*pdev
)
138 return ehci_xls_probe_internal(&ehci_xls_hc_driver
, pdev
);
141 static int ehci_xls_remove(struct platform_device
*pdev
)
143 struct usb_hcd
*hcd
= platform_get_drvdata(pdev
);
147 release_mem_region(hcd
->rsrc_start
, hcd
->rsrc_len
);
152 MODULE_ALIAS("ehci-xls");
154 static struct platform_driver ehci_xls_driver
= {
155 .probe
= ehci_xls_probe
,
156 .remove
= ehci_xls_remove
,
157 .shutdown
= usb_hcd_platform_shutdown
,