23 #include <linux/i2c.h>
27 #include <mach/hardware.h>
31 #include <mach/platform.h>
32 #include <mach/irqs.h>
34 #define USB_CONFIG_BASE 0x31020000
35 #define PWRMAN_BASE 0x40004000
37 #define USB_CTRL IO_ADDRESS(PWRMAN_BASE + 0x64)
40 #define USB_SLAVE_HCLK_EN (1 << 24)
41 #define USB_DEV_NEED_CLK_EN (1 << 22)
42 #define USB_HOST_NEED_CLK_EN (1 << 21)
43 #define PAD_CONTROL_LAST_DRIVEN (1 << 19)
45 #define USB_OTG_STAT_CONTROL IO_ADDRESS(USB_CONFIG_BASE + 0x110)
48 #define TRANSPARENT_I2C_EN (1 << 7)
49 #define HOST_EN (1 << 0)
52 #ifndef start_int_set_falling_edge
53 #define start_int_set_falling_edge(irq)
54 #define start_int_set_rising_edge(irq)
55 #define start_int_ack(irq)
56 #define start_int_mask(irq)
57 #define start_int_umask(irq)
64 static struct clk *usb_pll_clk;
65 static struct clk *usb_dev_clk;
66 static struct clk *usb_otg_clk;
68 static void isp1301_configure_lpc32xx(
void)
117 static void isp1301_configure(
void)
119 isp1301_configure_lpc32xx();
122 static inline void isp1301_vbus_on(
void)
128 static inline void isp1301_vbus_off(
void)
135 static void nxp_start_hc(
void)
142 static void nxp_stop_hc(
void)
150 static int __devinit ohci_nxp_start(
struct usb_hcd *hcd)
155 if ((ret = ohci_init(ohci)) < 0)
158 if ((ret = ohci_run(ohci)) < 0) {
159 dev_err(hcd->self.controller,
"can't start\n");
166 static const struct hc_driver ohci_nxp_hc_driver = {
167 .description = hcd_name,
168 .product_desc =
"nxp OHCI",
174 .flags = HCD_USB11 | HCD_MEMORY,
176 .hcd_priv_size =
sizeof(
struct ohci_hcd),
180 .
start = ohci_nxp_start,
182 .shutdown = ohci_shutdown,
187 .urb_enqueue = ohci_urb_enqueue,
188 .urb_dequeue = ohci_urb_dequeue,
189 .endpoint_disable = ohci_endpoint_disable,
194 .get_frame_number = ohci_get_frame,
199 .hub_status_data = ohci_hub_status_data,
200 .hub_control = ohci_hub_control,
202 .bus_suspend = ohci_bus_suspend,
203 .bus_resume = ohci_bus_resume,
210 struct usb_hcd *hcd = 0;
212 const struct hc_driver *
driver = &ohci_nxp_hc_driver;
217 if (pdev->
dev.of_node) {
225 if (!isp1301_i2c_client) {
231 pdev->
dev.dma_mask = &pdev->
dev.coherent_dma_mask;
245 if (IS_ERR(usb_pll_clk)) {
246 dev_err(&pdev->
dev,
"failed to acquire USB PLL\n");
247 ret = PTR_ERR(usb_pll_clk);
253 dev_err(&pdev->
dev,
"failed to start USB PLL\n");
259 dev_err(&pdev->
dev,
"failed to set USB clock rate\n");
265 if (IS_ERR(usb_dev_clk)) {
266 dev_err(&pdev->
dev,
"failed to acquire USB DEV Clock\n");
267 ret = PTR_ERR(usb_dev_clk);
273 dev_err(&pdev->
dev,
"failed to start USB DEV Clock\n");
278 usb_otg_clk =
clk_get(&pdev->
dev,
"ck_usb_otg");
279 if (IS_ERR(usb_otg_clk)) {
280 dev_err(&pdev->
dev,
"failed to acquire USB DEV Clock\n");
281 ret = PTR_ERR(usb_otg_clk);
289 dev_err(&pdev->
dev,
"failed to start USB DEV Clock\n");
297 dev_err(&pdev->
dev,
"Failed to allocate HC buffer\n");
304 dev_err(&pdev->
dev,
"Failed to get MEM resource\n");
311 dev_err(&pdev->
dev,
"Failed to devm_request_and_ioremap\n");
315 hcd->rsrc_start = res->
start;
316 hcd->rsrc_len = resource_size(res);
325 platform_set_drvdata(pdev, hcd);
326 ohci = hcd_to_ohci(hcd);
329 dev_info(&pdev->
dev,
"at 0x%p, irq %d\n", hcd->regs, hcd->irq);
350 isp1301_i2c_client =
NULL;
357 struct usb_hcd *hcd = platform_get_drvdata(pdev);
368 isp1301_i2c_client =
NULL;
370 platform_set_drvdata(pdev,
NULL);
379 static const struct of_device_id usb_hcd_nxp_match[] = {
392 .probe = usb_hcd_nxp_probe,
393 .remove = usb_hcd_nxp_remove,