aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-04-29 10:47:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-01 13:36:18 -0400
commit73108aa90cbfc663649885a06fe5c1235307de1c (patch)
tree2a380085e86514a1e3916758f06266fbfbcfd315 /drivers/usb
parent24a28e4283510dcd58890379a42b8a7d3201d9d3 (diff)
USB: ohci-nxp: Use isp1301 driver
ohci-nxp duplicates the isp1301 driver. This patch removes this code and makes ohci-nxp use the new separate isp1301 driver instead. 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/usb')
-rw-r--r--drivers/usb/host/Kconfig1
-rw-r--r--drivers/usb/host/ohci-nxp.c121
2 files changed, 16 insertions, 106 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 896fc91c54ab..684a7bba9307 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -292,6 +292,7 @@ config USB_OHCI_HCD
292 depends on USB && USB_ARCH_HAS_OHCI 292 depends on USB && USB_ARCH_HAS_OHCI
293 select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 293 select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
294 select USB_OTG_UTILS if ARCH_OMAP 294 select USB_OTG_UTILS if ARCH_OMAP
295 select USB_ISP1301 if ARCH_LPC32XX || ARCH_PNX4008
295 ---help--- 296 ---help---
296 The Open Host Controller Interface (OHCI) is a standard for accessing 297 The Open Host Controller Interface (OHCI) is a standard for accessing
297 USB 1.1 host controller hardware. It does more in hardware than Intel's 298 USB 1.1 host controller hardware. It does more in hardware than Intel's
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index bf542e7e2b1c..1e364ec962fb 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -23,6 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/usb/isp1301.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -58,54 +59,6 @@
58#define TRANSPARENT_I2C_EN (1 << 7) 59#define TRANSPARENT_I2C_EN (1 << 7)
59#define HOST_EN (1 << 0) 60#define HOST_EN (1 << 0)
60 61
61/* ISP1301 USB transceiver I2C registers */
62#define ISP1301_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */
63
64#define MC1_SPEED_REG (1 << 0)
65#define MC1_SUSPEND_REG (1 << 1)
66#define MC1_DAT_SE0 (1 << 2)
67#define MC1_TRANSPARENT (1 << 3)
68#define MC1_BDIS_ACON_EN (1 << 4)
69#define MC1_OE_INT_EN (1 << 5)
70#define MC1_UART_EN (1 << 6)
71#define MC1_MASK 0x7f
72
73#define ISP1301_MODE_CONTROL_2 0x12 /* u8 read, set, +1 clear */
74
75#define MC2_GLOBAL_PWR_DN (1 << 0)
76#define MC2_SPD_SUSP_CTRL (1 << 1)
77#define MC2_BI_DI (1 << 2)
78#define MC2_TRANSP_BDIR0 (1 << 3)
79#define MC2_TRANSP_BDIR1 (1 << 4)
80#define MC2_AUDIO_EN (1 << 5)
81#define MC2_PSW_EN (1 << 6)
82#define MC2_EN2V7 (1 << 7)
83
84#define ISP1301_OTG_CONTROL_1 0x06 /* u8 read, set, +1 clear */
85# define OTG1_DP_PULLUP (1 << 0)
86# define OTG1_DM_PULLUP (1 << 1)
87# define OTG1_DP_PULLDOWN (1 << 2)
88# define OTG1_DM_PULLDOWN (1 << 3)
89# define OTG1_ID_PULLDOWN (1 << 4)
90# define OTG1_VBUS_DRV (1 << 5)
91# define OTG1_VBUS_DISCHRG (1 << 6)
92# define OTG1_VBUS_CHRG (1 << 7)
93#define ISP1301_OTG_STATUS 0x10 /* u8 readonly */
94# define OTG_B_SESS_END (1 << 6)
95# define OTG_B_SESS_VLD (1 << 7)
96
97#define ISP1301_I2C_ADDR 0x2C
98
99#define ISP1301_I2C_MODE_CONTROL_1 0x4
100#define ISP1301_I2C_MODE_CONTROL_2 0x12
101#define ISP1301_I2C_OTG_CONTROL_1 0x6
102#define ISP1301_I2C_OTG_CONTROL_2 0x10
103#define ISP1301_I2C_INTERRUPT_SOURCE 0x8
104#define ISP1301_I2C_INTERRUPT_LATCH 0xA
105#define ISP1301_I2C_INTERRUPT_FALLING 0xC
106#define ISP1301_I2C_INTERRUPT_RISING 0xE
107#define ISP1301_I2C_REG_CLEAR_ADDR 1
108
109/* On LPC32xx, those are undefined */ 62/* On LPC32xx, those are undefined */
110#ifndef start_int_set_falling_edge 63#ifndef start_int_set_falling_edge
111#define start_int_set_falling_edge(irq) 64#define start_int_set_falling_edge(irq)
@@ -115,41 +68,12 @@
115#define start_int_umask(irq) 68#define start_int_umask(irq)
116#endif 69#endif
117 70
118static struct i2c_driver isp1301_driver;
119static struct i2c_client *isp1301_i2c_client; 71static struct i2c_client *isp1301_i2c_client;
120 72
121extern int usb_disabled(void); 73extern int usb_disabled(void);
122 74
123static struct clk *usb_clk; 75static struct clk *usb_clk;
124 76
125static const unsigned short normal_i2c[] =
126 { ISP1301_I2C_ADDR, ISP1301_I2C_ADDR + 1, I2C_CLIENT_END };
127
128static int isp1301_probe(struct i2c_client *client,
129 const struct i2c_device_id *id)
130{
131 return 0;
132}
133
134static int isp1301_remove(struct i2c_client *client)
135{
136 return 0;
137}
138
139static const struct i2c_device_id isp1301_id[] = {
140 { "isp1301_nxp", 0 },
141 { }
142};
143
144static struct i2c_driver isp1301_driver = {
145 .driver = {
146 .name = "isp1301_nxp",
147 },
148 .probe = isp1301_probe,
149 .remove = isp1301_remove,
150 .id_table = isp1301_id,
151};
152
153static void isp1301_configure_pnx4008(void) 77static void isp1301_configure_pnx4008(void)
154{ 78{
155 /* PNX4008 only supports DAT_SE0 USB mode */ 79 /* PNX4008 only supports DAT_SE0 USB mode */
@@ -373,11 +297,22 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
373 struct usb_hcd *hcd = 0; 297 struct usb_hcd *hcd = 0;
374 struct ohci_hcd *ohci; 298 struct ohci_hcd *ohci;
375 const struct hc_driver *driver = &ohci_nxp_hc_driver; 299 const struct hc_driver *driver = &ohci_nxp_hc_driver;
376 struct i2c_adapter *i2c_adap;
377 struct i2c_board_info i2c_info;
378 struct resource *res; 300 struct resource *res;
379
380 int ret = 0, irq; 301 int ret = 0, irq;
302 struct device_node *isp1301_node;
303
304 if (pdev->dev.of_node) {
305 isp1301_node = of_parse_phandle(pdev->dev.of_node,
306 "transceiver", 0);
307 } else {
308 isp1301_node = NULL;
309 }
310
311 isp1301_i2c_client = isp1301_get_client(isp1301_node);
312 if (!isp1301_i2c_client) {
313 ret = -EPROBE_DEFER;
314 goto out;
315 }
381 316
382 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 317 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
383 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 318 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
@@ -392,28 +327,6 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
392 /* Enable AHB slave USB clock, needed for further USB clock control */ 327 /* Enable AHB slave USB clock, needed for further USB clock control */
393 __raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL); 328 __raw_writel(USB_SLAVE_HCLK_EN | PAD_CONTROL_LAST_DRIVEN, USB_CTRL);
394 329
395 ret = i2c_add_driver(&isp1301_driver);
396 if (ret < 0) {
397 dev_err(&pdev->dev, "failed to add ISP1301 driver\n");
398 goto out;
399 }
400 i2c_adap = i2c_get_adapter(2);
401 if (!i2c_adap) {
402 dev_err(&pdev->dev, "failed on i2c_get_adapter");
403 goto out_i2c_driver;
404 }
405
406 memset(&i2c_info, 0, sizeof(struct i2c_board_info));
407 strlcpy(i2c_info.type, "isp1301_nxp", I2C_NAME_SIZE);
408 isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
409 normal_i2c, NULL);
410 i2c_put_adapter(i2c_adap);
411 if (!isp1301_i2c_client) {
412 dev_err(&pdev->dev, "failed to connect I2C to ISP1301 USB Transceiver\n");
413 ret = -ENODEV;
414 goto out_i2c_driver;
415 }
416
417 isp1301_configure(); 330 isp1301_configure();
418 331
419 /* Enable USB PLL */ 332 /* Enable USB PLL */
@@ -495,10 +408,7 @@ out3:
495out2: 408out2:
496 clk_put(usb_clk); 409 clk_put(usb_clk);
497out1: 410out1:
498 i2c_unregister_device(isp1301_i2c_client);
499 isp1301_i2c_client = NULL; 411 isp1301_i2c_client = NULL;
500out_i2c_driver:
501 i2c_del_driver(&isp1301_driver);
502out: 412out:
503 return ret; 413 return ret;
504} 414}
@@ -516,7 +426,6 @@ static int usb_hcd_nxp_remove(struct platform_device *pdev)
516 clk_put(usb_clk); 426 clk_put(usb_clk);
517 i2c_unregister_device(isp1301_i2c_client); 427 i2c_unregister_device(isp1301_i2c_client);
518 isp1301_i2c_client = NULL; 428 isp1301_i2c_client = NULL;
519 i2c_del_driver(&isp1301_driver);
520 429
521 platform_set_drvdata(pdev, NULL); 430 platform_set_drvdata(pdev, NULL);
522 431