Skip to contentSkip to conversation

USB: OHCI-HCD: Support for LPC32xx

PATCH Superseded Roland Stigge 3 participants 9 messages Mar 11, 2012 – Mar 12, 2012

Subsystems (4)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover USB: OHCI-HCD: Support for LPC32xx

These patches add support for the LPC32xx to the ohci-pnx4008 driver and make the driver use smbus functions.

As discussed with Greg-KH on the USB mailing list, the ohci-pnx4008 driver is first renamed to reflect its multi-platform support. The second patch also renames the respective pnx4008_* symbols accordingly.

The third patch adds the actual lpc32xx support.

The fourth patch removes the re-coded i2c_write() by using an existing smbus function. You can leave out this very single patch to still have the desired LPC32xx support. It just fixes existing kernel code to only use smbus calls in this driver.

Applies to v3.3-rc6

Since v6, i2c_write() has been removed in favour of i2c_smbus_write_byte_data()

Thanks to Wolfram Sang for reviewing!

---

Roland Stigge (4):
USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp
USB: ohci-nxp: Rename symbols from pnx4008 to nxp
USB: ohci-nxp: Support for LPC32xx
USB: ohci-nxp: Remove i2c_write(), use smbus

 Documentation/i2c/instantiating-devices |    6 
 drivers/usb/host/ohci-hcd.c             |    6 
 drivers/usb/host/ohci-nxp.c             |  652 ++++++++++++++++++++++++++++----
 drivers/usb/host/ohci-pnx4008.c         |  453 ----------------------
 4 files changed, 596 insertions(+), 521 deletions(-)
#1 lore raw

PATCH v7 1/4 USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp

Since this driver is compatible with several NXP devices, the driver is renamed accordingly. Please combine with the following patch which also changes the respective symbol names.

---
 drivers/usb/host/ohci-hcd.c     |    2 
 drivers/usb/host/ohci-nxp.c     |  453 ++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci-pnx4008.c |  453 ----------------------------------------
 3 files changed, 454 insertions(+), 454 deletions(-)
drivers/usb/host/ohci-hcd.c +1 -1
@@ -1051,7 +1051,7 @@ MODULE_LICENSE ("GPL");
 #endif
 
 #ifdef CONFIG_ARCH_PNX4008
-#include "ohci-pnx4008.c"
+#include "ohci-nxp.c"
 #define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
 #endif
 
drivers/usb/host/ohci-nxp.c new file +453 -0

453 lines not on this page · raw message

drivers/usb/host/ohci-pnx4008.c deleted +0 -453

453 lines not on this page · raw message

#3 lore raw

PATCH v7 2/4 USB: ohci-nxp: Rename symbols from pnx4008 to nxp

In reply to Roland Stigge

Since this driver is compatible with several NXP devices, the driver was renamed accordingly. This patch also changes the respective symbol names.

---
 Documentation/i2c/instantiating-devices |    6 +--
 drivers/usb/host/ohci-hcd.c             |    2 -
 drivers/usb/host/ohci-nxp.c             |   55 ++++++++++++++++----------------
 3 files changed, 33 insertions(+), 30 deletions(-)
Documentation/i2c/instantiating-devices +3 -3
@@ -87,11 +87,11 @@ it may have different addresses from one
 changing its design without notice). In this case, you can call
 i2c_new_probed_device() instead of i2c_new_device().
 
-Example (from the pnx4008 OHCI driver):
+Example (from the nxp OHCI driver):
 
 static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
 
-static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
+static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
 {
 	(...)
 	struct i2c_adapter *i2c_adap;
@@ -100,7 +100,7 @@ static int __devinit usb_hcd_pnx4008_pro
 	(...)
 	i2c_adap = i2c_get_adapter(2);
 	memset(&i2c_info, 0, sizeof(struct i2c_board_info));
-	strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE);
+	strlcpy(i2c_info.type, "isp1301_nxp", I2C_NAME_SIZE);
 	isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
 						   normal_i2c, NULL);
 	i2c_put_adapter(i2c_adap);
drivers/usb/host/ohci-hcd.c +1 -1
@@ -1052,7 +1052,7 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_ARCH_PNX4008
 #include "ohci-nxp.c"
-#define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
+#define PLATFORM_DRIVER		usb_hcd_nxp_driver
 #endif
 
 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
drivers/usb/host/ohci-nxp.c +29 -26

174 lines not on this page · raw message

#4 lore raw

PATCH v7 3/4 USB: ohci-nxp: Support for LPC32xx

In reply to Roland Stigge

This patch adds support for the LPC32xx to ohci-nxp

---
 drivers/usb/host/ohci-hcd.c |    2 
 drivers/usb/host/ohci-nxp.c |  142 +++++++++++++++++++++++++++++++++-----------
 2 files changed, 109 insertions(+), 35 deletions(-)
drivers/usb/host/ohci-hcd.c +1 -1
@@ -1050,7 +1050,7 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ohci_hcd_at91_driver
 #endif
 
-#ifdef CONFIG_ARCH_PNX4008
+#if defined(CONFIG_ARCH_PNX4008) || defined(CONFIG_ARCH_LPC32XX)
 #include "ohci-nxp.c"
 #define PLATFORM_DRIVER		usb_hcd_nxp_driver
 #endif
drivers/usb/host/ohci-nxp.c +108 -34

200 lines not on this page · raw message

#5 lore raw

PATCH v7 4/4 USB: ohci-nxp: Remove i2c_write(), use smbus

In reply to Roland Stigge

This patch removes the re-coded i2c_write function from the ohci-nxp driver in favour of using just smbus functions.

---
 drivers/usb/host/ohci-nxp.c |   58 ++++++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/usb/host/ohci-nxp.c +29 -29
@@ -151,38 +151,36 @@ static struct i2c_driver isp1301_driver
 	.id_table = isp1301_id,
 };
 
-static void i2c_write(u8 buf, u8 subaddr)
-{
-	char tmpbuf[2];
-
-	tmpbuf[0] = subaddr;	/*register number */
-	tmpbuf[1] = buf;	/*register data */
-	i2c_master_send(isp1301_i2c_client, &tmpbuf[0], 2);
-}
-
 static void isp1301_configure_pnx4008(void)
 {
 	/* PNX4008 only supports DAT_SE0 USB mode */
 	/* PNX4008 R2A requires setting the MAX603 to output 3.6V */
 	/* Power up externel charge-pump */
 
-	i2c_write(MC1_DAT_SE0 | MC1_SPEED_REG, ISP1301_I2C_MODE_CONTROL_1);
-	i2c_write(~(MC1_DAT_SE0 | MC1_SPEED_REG),
-		  ISP1301_I2C_MODE_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR);
-	i2c_write(MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL,
-		  ISP1301_I2C_MODE_CONTROL_2);
-	i2c_write(~(MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL),
-		  ISP1301_I2C_MODE_CONTROL_2 | ISP1301_I2C_REG_CLEAR_ADDR);
-	i2c_write(OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN,
-		  ISP1301_I2C_OTG_CONTROL_1);
-	i2c_write(~(OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN),
-		  ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR);
-	i2c_write(0xFF,
-		  ISP1301_I2C_INTERRUPT_LATCH | ISP1301_I2C_REG_CLEAR_ADDR);
-	i2c_write(0xFF,
-		  ISP1301_I2C_INTERRUPT_FALLING | ISP1301_I2C_REG_CLEAR_ADDR);
-	i2c_write(0xFF,
-		  ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_MODE_CONTROL_1, MC1_DAT_SE0 | MC1_SPEED_REG);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_MODE_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR,
+		~(MC1_DAT_SE0 | MC1_SPEED_REG));
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_MODE_CONTROL_2,
+		MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_MODE_CONTROL_2 | ISP1301_I2C_REG_CLEAR_ADDR,
+		~(MC2_BI_DI | MC2_PSW_EN | MC2_SPD_SUSP_CTRL));
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_OTG_CONTROL_1, OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR,
+		~(OTG1_DM_PULLDOWN | OTG1_DP_PULLDOWN));
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_INTERRUPT_LATCH | ISP1301_I2C_REG_CLEAR_ADDR, 0xFF);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_INTERRUPT_FALLING | ISP1301_I2C_REG_CLEAR_ADDR,
+		0xFF);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR,
+		0xFF);
 }
 
 static void isp1301_configure_lpc32xx(void)
@@ -244,13 +242,15 @@ static void isp1301_configure(void)
 
 static inline void isp1301_vbus_on(void)
 {
-	i2c_write(OTG1_VBUS_DRV, ISP1301_I2C_OTG_CONTROL_1);
+	i2c_smbus_write_byte_data(isp1301_i2c_client, ISP1301_I2C_OTG_CONTROL_1,
+				  OTG1_VBUS_DRV);
 }
 
 static inline void isp1301_vbus_off(void)
 {
-	i2c_write(OTG1_VBUS_DRV,
-		  ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR);
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_OTG_CONTROL_1 | ISP1301_I2C_REG_CLEAR_ADDR,
+		OTG1_VBUS_DRV);
 }
 
 static void nxp_start_hc(void)
#2 lore raw

Re: [PATCH v7 1/4] USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp

In reply to Roland Stigge
Quoted 6 lines · Roland Stigge

Since this driver is compatible with several NXP devices, the driver is renamed accordingly. Please combine with the following patch which also changes the respective symbol names.

Hi Roland,

As a general comment, it's helpful to use the "-M" flag to git-format-patch whenever you rename files, because that makes it obvious whether you have changed anything in the file or not.

drivers/usb/host/ohci-nxp.c line 5

Quoted 8 lines
drivers/usb/host/ohci-nxp.c new file +5 -0
@@ -0,0 +1,453 @@
+/*
+ * drivers/usb/host/ohci-pnx4008.c
+ *
+ * driver for Philips PNX4008 USB Host
+ *

I think your second patch does not change this comment and probably should.

Just remove the file name from the comment because that one is generally not helpful.

Arnd

#7 lore raw
In reply to Roland Stigge
Quoted 2 lines · Roland Stigge

These patches add support for the LPC32xx to the ohci-pnx4008 driver and make the driver use smbus functions.

Do you have a branch ready to test (USB driver fixes + mach additions)? I'd like to test but I get lots of conflicts when adding the mach related stuff. I probably have a different base?

Thanks,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120312/cc2d3541/attachment-0001.sig>
#6 lore raw

Re: [PATCH v7 4/4] USB: ohci-nxp: Remove i2c_write(), use smbus

In reply to Roland Stigge

drivers/usb/host/ohci-nxp.c static struct i2c_driver isp1301_driver · line 183

Quoted 4 lines
drivers/usb/host/ohci-nxp.c +3 -0
+	i2c_smbus_write_byte_data(isp1301_i2c_client,
+		ISP1301_I2C_INTERRUPT_RISING | ISP1301_I2C_REG_CLEAR_ADDR,
+		0xFF);

No need to resend, still: Breaking the 80 char limit for such cases is usually more readable.

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120312/7ace2dde/attachment.sig>
#8 lore raw
In reply to Wolfram Sang

Hi Wolfram,

Quoted 7 lines · Wolfram Sang
Quoted 2 lines · Roland Stigge

These patches add support for the LPC32xx to the ohci-pnx4008 driver and make the driver use smbus functions.

Do you have a branch ready to test (USB driver fixes + mach additions)? I'd like to test but I get lots of conflicts when adding the mach related stuff. I probably have a different base?

I just pushed into the following branches at
git://git.antcom.de/linux-2.6.git :

* lpc32xx/usb - The ohci-pnx driver as submitted on the USB mailing list
* lpc32xx/eth - The ethernet driver as submitted on the ethernet mailing list
* lpc32xx/baseline - Patches on top of v3.3-rc7 which have already been accepted into the various subsystem maintainer's repos. This is the baseline on top of which the next two branches are forked from
* lpc32xx/mach-lpc32xx-usb - Mach specific USB part
* lpc32xx/mach-lpc32xx-eth - Mach specific ethernet part

Roland