aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-04-29 10:47:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-01 13:33:02 -0400
commit8b7c3b68104d687a16dbcc803a18c72148fdfdac (patch)
treeae9a1f2807b6ca9b6fa7934f3e86bb8d52a75038 /drivers
parent2265efea38c45ba42a4e483eee11740730f053d2 (diff)
USB: Add driver for NXP ISP1301 USB transceiver
This new driver registers the NXP ISP1301 chip via the I2C subsystem. The chip is the USB transceiver shared by ohci-nxp, lpc32xx_udc (gadget) and isp1301_omap. ISP1301 is a very low-level driver that primarily separates out the I2C client registration of the ISP1301 chip (including instantiation via DT), used by other drivers, and declares the chip's registers. It's only a helper driver for some OHCI and USB device drivers. The driver can be considered as a register set extension of ohci-nxp, lpc32xx-udc and isp1301_omap, which in turn know best what to do with the low level functionality (individual ISP1301 registers and timing, see the different initialization strategies in those drivers). Those drivers previously internally duplicated ISP1301 register definitions which is solved by this new isp1301 driver. The ISP1301 registers exposed via isp1301.h can be accessed by other drivers using it with standard i2c_smbus_*() accesses. Following patches let the respective USB host and gadget drivers use this driver, instead of duplicating ISP1301 handling. Signed-off-by: Roland Stigge <stigge@antcom.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/Makefile1
-rw-r--r--drivers/usb/phy/Kconfig17
-rw-r--r--drivers/usb/phy/Makefile7
-rw-r--r--drivers/usb/phy/isp1301.c77
5 files changed, 104 insertions, 0 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 76316a33061b..4473ae51ddb4 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -177,6 +177,8 @@ source "drivers/usb/serial/Kconfig"
177 177
178source "drivers/usb/misc/Kconfig" 178source "drivers/usb/misc/Kconfig"
179 179
180source "drivers/usb/phy/Kconfig"
181
180source "drivers/usb/atm/Kconfig" 182source "drivers/usb/atm/Kconfig"
181 183
182source "drivers/usb/gadget/Kconfig" 184source "drivers/usb/gadget/Kconfig"
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 53a7bc07dd8d..77c835a15239 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
46obj-$(CONFIG_USB_SERIAL) += serial/ 46obj-$(CONFIG_USB_SERIAL) += serial/
47 47
48obj-$(CONFIG_USB) += misc/ 48obj-$(CONFIG_USB) += misc/
49obj-$(CONFIG_USB) += phy/
49obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ 50obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
50 51
51obj-$(CONFIG_USB_ATM) += atm/ 52obj-$(CONFIG_USB_ATM) += atm/
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
new file mode 100644
index 000000000000..3cfabcba7447
--- /dev/null
+++ b/drivers/usb/phy/Kconfig
@@ -0,0 +1,17 @@
1#
2# Physical Layer USB driver configuration
3#
4comment "USB Physical Layer drivers"
5 depends on USB
6
7config USB_ISP1301
8 tristate "NXP ISP1301 USB transceiver support"
9 depends on USB
10 depends on I2C
11 help
12 Say Y here to add support for the NXP ISP1301 USB transceiver driver.
13 This chip is typically used as USB transceiver for USB host, gadget
14 and OTG drivers (to be selected separately).
15
16 To compile this driver as a module, choose M here: the
17 module will be called isp1301.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
new file mode 100644
index 000000000000..eca095b1a890
--- /dev/null
+++ b/drivers/usb/phy/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for physical layer USB drivers
3#
4
5ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
6
7obj-$(CONFIG_USB_ISP1301) += isp1301.o
diff --git a/drivers/usb/phy/isp1301.c b/drivers/usb/phy/isp1301.c
new file mode 100644
index 000000000000..b19f4932a037
--- /dev/null
+++ b/drivers/usb/phy/isp1301.c
@@ -0,0 +1,77 @@
1/*
2 * NXP ISP1301 USB transceiver driver
3 *
4 * Copyright (C) 2012 Roland Stigge
5 *
6 * Author: Roland Stigge <stigge@antcom.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/i2c.h>
15
16#define DRV_NAME "isp1301"
17
18#define ISP1301_I2C_ADDR 0x2C
19
20static const unsigned short normal_i2c[] = {
21 ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END
22};
23
24static const struct i2c_device_id isp1301_id[] = {
25 { "isp1301", 0 },
26 { }
27};
28
29static struct i2c_client *isp1301_i2c_client;
30
31static int isp1301_probe(struct i2c_client *client,
32 const struct i2c_device_id *i2c_id)
33{
34 isp1301_i2c_client = client;
35 return 0;
36}
37
38static int isp1301_remove(struct i2c_client *client)
39{
40 return 0;
41}
42
43static struct i2c_driver isp1301_driver = {
44 .driver = {
45 .name = DRV_NAME,
46 },
47 .probe = isp1301_probe,
48 .remove = isp1301_remove,
49 .id_table = isp1301_id,
50};
51
52module_i2c_driver(isp1301_driver);
53
54static int match(struct device *dev, void *data)
55{
56 struct device_node *node = (struct device_node *)data;
57 return (dev->of_node == node) &&
58 (dev->driver == &isp1301_driver.driver);
59}
60
61struct i2c_client *isp1301_get_client(struct device_node *node)
62{
63 if (node) { /* reference of ISP1301 I2C node via DT */
64 struct device *dev = bus_find_device(&i2c_bus_type, NULL,
65 node, match);
66 if (!dev)
67 return NULL;
68 return to_i2c_client(dev);
69 } else { /* non-DT: only one ISP1301 chip supported */
70 return isp1301_i2c_client;
71 }
72}
73EXPORT_SYMBOL_GPL(isp1301_get_client);
74
75MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>");
76MODULE_DESCRIPTION("NXP ISP1301 USB transceiver driver");
77MODULE_LICENSE("GPL");