aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/Kconfig17
-rw-r--r--drivers/usb/phy/Makefile7
-rw-r--r--drivers/usb/phy/isp1301.c77
3 files changed, 101 insertions, 0 deletions
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
new file mode 100644
index 000000000000..e7cf84f0751a
--- /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 || USB_GADGET
6
7config USB_ISP1301
8 tristate "NXP ISP1301 USB transceiver support"
9 depends on USB || USB_GADGET
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");