Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 2 | /* |
Roland Stigge | 2864310 | 2012-03-12 22:54:50 +0100 | [diff] [blame] | 3 | * driver for NXP USB Host devices |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 4 | * |
Roland Stigge | 2864310 | 2012-03-12 22:54:50 +0100 | [diff] [blame] | 5 | * Currently supported OHCI host devices: |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 6 | * - NXP LPC32xx |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 7 | * |
| 8 | * Authors: Dmitry Chigirev <source@mvista.com> |
David Brownell | dd9048a | 2006-12-05 03:18:31 -0800 | [diff] [blame] | 9 | * Vitaly Wool <vitalywool@gmail.com> |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 10 | * |
| 11 | * register initialization is based on code examples provided by Philips |
| 12 | * Copyright (c) 2005 Koninklijke Philips Electronics N.V. |
| 13 | * |
| 14 | * NOTE: This driver does not have suspend/resume functionality |
| 15 | * This driver is intended for engineering development purposes only |
| 16 | * |
Greg Kroah-Hartman | ef1362d | 2017-11-06 15:37:25 +0100 | [diff] [blame] | 17 | * 2005-2006 (c) MontaVista Software, Inc. |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 18 | */ |
| 19 | #include <linux/clk.h> |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 20 | #include <linux/dma-mapping.h> |
| 21 | #include <linux/io.h> |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 22 | #include <linux/i2c.h> |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 23 | #include <linux/module.h> |
Roland Stigge | 2265efe | 2012-04-29 16:47:03 +0200 | [diff] [blame] | 24 | #include <linux/of.h> |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 25 | #include <linux/platform_device.h> |
Roland Stigge | 73108aa | 2012-04-29 16:47:06 +0200 | [diff] [blame] | 26 | #include <linux/usb/isp1301.h> |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 27 | #include <linux/usb.h> |
| 28 | #include <linux/usb/hcd.h> |
| 29 | |
| 30 | #include "ohci.h" |
| 31 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 32 | #include <mach/hardware.h> |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 33 | |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 34 | #define USB_CONFIG_BASE 0x31020000 |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 35 | #define USB_OTG_STAT_CONTROL IO_ADDRESS(USB_CONFIG_BASE + 0x110) |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 36 | |
| 37 | /* USB_OTG_STAT_CONTROL bit defines */ |
| 38 | #define TRANSPARENT_I2C_EN (1 << 7) |
| 39 | #define HOST_EN (1 << 0) |
| 40 | |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 41 | /* On LPC32xx, those are undefined */ |
| 42 | #ifndef start_int_set_falling_edge |
| 43 | #define start_int_set_falling_edge(irq) |
| 44 | #define start_int_set_rising_edge(irq) |
| 45 | #define start_int_ack(irq) |
| 46 | #define start_int_mask(irq) |
| 47 | #define start_int_umask(irq) |
| 48 | #endif |
| 49 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 50 | #define DRIVER_DESC "OHCI NXP driver" |
| 51 | |
| 52 | static const char hcd_name[] = "ohci-nxp"; |
| 53 | static struct hc_driver __read_mostly ohci_nxp_hc_driver; |
| 54 | |
Jean Delvare | 09ce497 | 2009-10-01 19:03:13 +0200 | [diff] [blame] | 55 | static struct i2c_client *isp1301_i2c_client; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 56 | |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 57 | static struct clk *usb_host_clk; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 58 | |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 59 | static void isp1301_configure_lpc32xx(void) |
| 60 | { |
| 61 | /* LPC32XX only supports DAT_SE0 USB mode */ |
| 62 | /* This sequence is important */ |
| 63 | |
| 64 | /* Disable transparent UART mode first */ |
| 65 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 66 | (ISP1301_I2C_MODE_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR), |
| 67 | MC1_UART_EN); |
| 68 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 69 | (ISP1301_I2C_MODE_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR), |
| 70 | ~MC1_SPEED_REG); |
| 71 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 72 | ISP1301_I2C_MODE_CONTROL_1, MC1_SPEED_REG); |
| 73 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 74 | (ISP1301_I2C_MODE_CONTROL_2 | ISP1301_I2C_REG_CLEAR_ADDR), |
| 75 | ~0); |
| 76 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 77 | ISP1301_I2C_MODE_CONTROL_2, |
| 78 | (MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL)); |
| 79 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 80 | (ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR), ~0); |
| 81 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 82 | ISP1301_I2C_MODE_CONTROL_1, MC1_DAT_SE0); |
| 83 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 84 | ISP1301_I2C_OTG_CONTROL_1, |
| 85 | (OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN)); |
| 86 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 87 | (ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR), |
| 88 | (OTG1_DM_PULLUP | OTG1_DP_PULLUP)); |
| 89 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 90 | ISP1301_I2C_INTERRUPT_LATCH | ISP1301_I2C_REG_CLEAR_ADDR, ~0); |
| 91 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 92 | ISP1301_I2C_INTERRUPT_FALLING | ISP1301_I2C_REG_CLEAR_ADDR, |
| 93 | ~0); |
| 94 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 95 | ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR, ~0); |
| 96 | |
Roland Stigge | 53dc25a | 2012-03-12 22:54:51 +0100 | [diff] [blame] | 97 | printk(KERN_INFO "ISP1301 Vendor ID : 0x%04x\n", |
| 98 | i2c_smbus_read_word_data(isp1301_i2c_client, 0x00)); |
| 99 | printk(KERN_INFO "ISP1301 Product ID : 0x%04x\n", |
| 100 | i2c_smbus_read_word_data(isp1301_i2c_client, 0x02)); |
| 101 | printk(KERN_INFO "ISP1301 Version ID : 0x%04x\n", |
| 102 | i2c_smbus_read_word_data(isp1301_i2c_client, 0x14)); |
| 103 | } |
| 104 | |
| 105 | static void isp1301_configure(void) |
| 106 | { |
Roland Stigge | d684f05 | 2012-08-26 16:30:37 +0200 | [diff] [blame] | 107 | isp1301_configure_lpc32xx(); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | static inline void isp1301_vbus_on(void) |
| 111 | { |
Roland Stigge | a6a3600 | 2012-03-12 22:54:52 +0100 | [diff] [blame] | 112 | i2c_smbus_write_byte_data(isp1301_i2c_client, ISP1301_I2C_OTG_CONTROL_1, |
| 113 | OTG1_VBUS_DRV); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | static inline void isp1301_vbus_off(void) |
| 117 | { |
Roland Stigge | a6a3600 | 2012-03-12 22:54:52 +0100 | [diff] [blame] | 118 | i2c_smbus_write_byte_data(isp1301_i2c_client, |
| 119 | ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR, |
| 120 | OTG1_VBUS_DRV); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 121 | } |
| 122 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 123 | static void ohci_nxp_start_hc(void) |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 124 | { |
| 125 | unsigned long tmp = __raw_readl(USB_OTG_STAT_CONTROL) | HOST_EN; |
Manjunath Goudar | 5c5a94a | 2016-12-07 23:54:11 +0000 | [diff] [blame] | 126 | |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 127 | __raw_writel(tmp, USB_OTG_STAT_CONTROL); |
| 128 | isp1301_vbus_on(); |
| 129 | } |
| 130 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 131 | static void ohci_nxp_stop_hc(void) |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 132 | { |
| 133 | unsigned long tmp; |
Manjunath Goudar | 5c5a94a | 2016-12-07 23:54:11 +0000 | [diff] [blame] | 134 | |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 135 | isp1301_vbus_off(); |
| 136 | tmp = __raw_readl(USB_OTG_STAT_CONTROL) & ~HOST_EN; |
| 137 | __raw_writel(tmp, USB_OTG_STAT_CONTROL); |
| 138 | } |
| 139 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 140 | static int ohci_hcd_nxp_probe(struct platform_device *pdev) |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 141 | { |
| 142 | struct usb_hcd *hcd = 0; |
Roland Stigge | 2864310 | 2012-03-12 22:54:50 +0100 | [diff] [blame] | 143 | const struct hc_driver *driver = &ohci_nxp_hc_driver; |
Roland Stigge | a6a99cf | 2012-04-29 16:47:02 +0200 | [diff] [blame] | 144 | struct resource *res; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 145 | int ret = 0, irq; |
Roland Stigge | 73108aa | 2012-04-29 16:47:06 +0200 | [diff] [blame] | 146 | struct device_node *isp1301_node; |
| 147 | |
| 148 | if (pdev->dev.of_node) { |
| 149 | isp1301_node = of_parse_phandle(pdev->dev.of_node, |
| 150 | "transceiver", 0); |
| 151 | } else { |
| 152 | isp1301_node = NULL; |
| 153 | } |
| 154 | |
| 155 | isp1301_i2c_client = isp1301_get_client(isp1301_node); |
Manjunath Goudar | 5c5a94a | 2016-12-07 23:54:11 +0000 | [diff] [blame] | 156 | if (!isp1301_i2c_client) |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 157 | return -EPROBE_DEFER; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 158 | |
Russell King | e1fd734 | 2013-06-27 12:36:37 +0100 | [diff] [blame] | 159 | ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
Russell King | 22d9d8e | 2013-06-10 16:28:49 +0100 | [diff] [blame] | 160 | if (ret) |
| 161 | goto fail_disable; |
Roland Stigge | a6a99cf | 2012-04-29 16:47:02 +0200 | [diff] [blame] | 162 | |
Roland Stigge | 2864310 | 2012-03-12 22:54:50 +0100 | [diff] [blame] | 163 | dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 164 | if (usb_disabled()) { |
Greg Kroah-Hartman | b6c227e | 2012-04-27 11:24:41 -0700 | [diff] [blame] | 165 | dev_err(&pdev->dev, "USB is disabled\n"); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 166 | ret = -ENODEV; |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 167 | goto fail_disable; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 168 | } |
| 169 | |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 170 | /* Enable USB host clock */ |
| 171 | usb_host_clk = devm_clk_get(&pdev->dev, NULL); |
| 172 | if (IS_ERR(usb_host_clk)) { |
| 173 | dev_err(&pdev->dev, "failed to acquire USB OHCI clock\n"); |
| 174 | ret = PTR_ERR(usb_host_clk); |
Jingoo Han | ac8d81f | 2013-12-11 16:30:35 +0900 | [diff] [blame] | 175 | goto fail_disable; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 176 | } |
| 177 | |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 178 | ret = clk_prepare_enable(usb_host_clk); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 179 | if (ret < 0) { |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 180 | dev_err(&pdev->dev, "failed to start USB OHCI clock\n"); |
Jingoo Han | ac8d81f | 2013-12-11 16:30:35 +0900 | [diff] [blame] | 181 | goto fail_disable; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 182 | } |
| 183 | |
Alexandre Pereira da Silva | 78091dc | 2012-06-20 09:02:23 -0300 | [diff] [blame] | 184 | isp1301_configure(); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 185 | |
Roland Stigge | a6a99cf | 2012-04-29 16:47:02 +0200 | [diff] [blame] | 186 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 187 | if (!hcd) { |
Greg Kroah-Hartman | b6c227e | 2012-04-27 11:24:41 -0700 | [diff] [blame] | 188 | dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 189 | ret = -ENOMEM; |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 190 | goto fail_hcd; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 191 | } |
| 192 | |
Roland Stigge | a6a99cf | 2012-04-29 16:47:02 +0200 | [diff] [blame] | 193 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
Thierry Reding | 148e113 | 2013-01-21 11:09:22 +0100 | [diff] [blame] | 194 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
| 195 | if (IS_ERR(hcd->regs)) { |
| 196 | ret = PTR_ERR(hcd->regs); |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 197 | goto fail_resource; |
Roland Stigge | a6a99cf | 2012-04-29 16:47:02 +0200 | [diff] [blame] | 198 | } |
| 199 | hcd->rsrc_start = res->start; |
| 200 | hcd->rsrc_len = resource_size(res); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 201 | |
| 202 | irq = platform_get_irq(pdev, 0); |
| 203 | if (irq < 0) { |
| 204 | ret = -ENXIO; |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 205 | goto fail_resource; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 206 | } |
| 207 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 208 | ohci_nxp_start_hc(); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 209 | platform_set_drvdata(pdev, hcd); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 210 | |
| 211 | dev_info(&pdev->dev, "at 0x%p, irq %d\n", hcd->regs, hcd->irq); |
Yong Zhang | b5dd18d | 2011-09-07 16:10:52 +0800 | [diff] [blame] | 212 | ret = usb_add_hcd(hcd, irq, 0); |
Peter Chen | 3c9740a | 2013-11-05 10:46:02 +0800 | [diff] [blame] | 213 | if (ret == 0) { |
| 214 | device_wakeup_enable(hcd->self.controller); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 215 | return ret; |
Peter Chen | 3c9740a | 2013-11-05 10:46:02 +0800 | [diff] [blame] | 216 | } |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 217 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 218 | ohci_nxp_stop_hc(); |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 219 | fail_resource: |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 220 | usb_put_hcd(hcd); |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 221 | fail_hcd: |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 222 | clk_disable_unprepare(usb_host_clk); |
Libo Chen | b3517d5 | 2013-05-10 14:22:42 +0800 | [diff] [blame] | 223 | fail_disable: |
Jean Delvare | 3a407e7 | 2008-11-13 18:57:53 +0100 | [diff] [blame] | 224 | isp1301_i2c_client = NULL; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 225 | return ret; |
| 226 | } |
| 227 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 228 | static int ohci_hcd_nxp_remove(struct platform_device *pdev) |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 229 | { |
| 230 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
| 231 | |
| 232 | usb_remove_hcd(hcd); |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 233 | ohci_nxp_stop_hc(); |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 234 | usb_put_hcd(hcd); |
Vladimir Zapolskiy | 83253b3 | 2016-03-03 06:19:36 +0200 | [diff] [blame] | 235 | clk_disable_unprepare(usb_host_clk); |
Jean Delvare | 3a407e7 | 2008-11-13 18:57:53 +0100 | [diff] [blame] | 236 | isp1301_i2c_client = NULL; |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 237 | |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 238 | return 0; |
| 239 | } |
| 240 | |
Kay Sievers | f4fce61 | 2008-04-10 21:29:22 -0700 | [diff] [blame] | 241 | /* work with hotplug and coldplug */ |
| 242 | MODULE_ALIAS("platform:usb-ohci"); |
| 243 | |
Roland Stigge | 2265efe | 2012-04-29 16:47:03 +0200 | [diff] [blame] | 244 | #ifdef CONFIG_OF |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 245 | static const struct of_device_id ohci_hcd_nxp_match[] = { |
Roland Stigge | 2265efe | 2012-04-29 16:47:03 +0200 | [diff] [blame] | 246 | { .compatible = "nxp,ohci-nxp" }, |
| 247 | {}, |
| 248 | }; |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 249 | MODULE_DEVICE_TABLE(of, ohci_hcd_nxp_match); |
Roland Stigge | 2265efe | 2012-04-29 16:47:03 +0200 | [diff] [blame] | 250 | #endif |
| 251 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 252 | static struct platform_driver ohci_hcd_nxp_driver = { |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 253 | .driver = { |
| 254 | .name = "usb-ohci", |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 255 | .of_match_table = of_match_ptr(ohci_hcd_nxp_match), |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 256 | }, |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 257 | .probe = ohci_hcd_nxp_probe, |
| 258 | .remove = ohci_hcd_nxp_remove, |
Vitaly Wool | 60bbfc8 | 2006-06-29 18:28:18 +0400 | [diff] [blame] | 259 | }; |
| 260 | |
Manjunath Goudar | 30330b8 | 2013-09-21 16:38:44 +0530 | [diff] [blame] | 261 | static int __init ohci_nxp_init(void) |
| 262 | { |
| 263 | if (usb_disabled()) |
| 264 | return -ENODEV; |
| 265 | |
| 266 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); |
| 267 | |
| 268 | ohci_init_driver(&ohci_nxp_hc_driver, NULL); |
| 269 | return platform_driver_register(&ohci_hcd_nxp_driver); |
| 270 | } |
| 271 | module_init(ohci_nxp_init); |
| 272 | |
| 273 | static void __exit ohci_nxp_cleanup(void) |
| 274 | { |
| 275 | platform_driver_unregister(&ohci_hcd_nxp_driver); |
| 276 | } |
| 277 | module_exit(ohci_nxp_cleanup); |
| 278 | |
| 279 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 280 | MODULE_LICENSE("GPL v2"); |