USB: OHCI-HCD: Support for LPC32xx
Subsystems (4)
v5 cover USB: OHCI-HCD: Support for LPC32xx
This patch adds support for the LPC32xx to the ohci-pnx4008 driver.
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 and final patch adds the actual lpc32xx support.
Applies to v3.3-rc6
---
Roland Stigge (3):
USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp
USB: ohci-nxp: Rename symbols from pnx4008 to nxp
USB: ohci-nxp: Support for LPC32xx
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(-)
PATCH v5 1/3 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
PATCH v5 2/3 USB: ohci-nxp: Rename symbols from pnx4008 to nxp
In reply to Roland StiggeSince 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
PATCH v5 3/3 USB: ohci-nxp: Support for LPC32xx
In reply to Roland StiggeThis patch adds support for the LPC32xx to ohci-nxp
--- drivers/usb/host/ohci-hcd.c | 2 drivers/usb/host/ohci-nxp.c | 140 +++++++++++++++++++++++++++++++++----------- 2 files changed, 107 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 +106 -34
198 lines not on this page · raw message
Re: [PATCH v5 3/3] USB: ohci-nxp: Support for LPC32xx
drivers/usb/host/ohci-nxp.c static void i2c_write(u8 buf, u8 subaddr · line 171
Quoted 11 lines
drivers/usb/host/ohci-nxp.c +9
-1-static void isp1301_configure (void ) +static u16 i2c_read16 (u8 subaddr) +{ +u16 data; + +i2c_master_send (isp1301_i2c_client, &subaddr,1 ); +i2c_master_recv (isp1301_i2c_client, (u8 *) &data,2 ); + +return data; +}
Won't i2c_smbus_read_word_data(isp1301_i2c_client, reg) do?
And while we are at it: Could you also try replacing i2c_write() with i2c_smbus_write_byte_data(isp1301_i2c_client, reg, val)?
No need to recode it (and in general, those solutions will also work with SMBus for free)
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/20120310/4102bb68/attachment.sig>
Re: [PATCH v5 3/3] USB: ohci-nxp: Support for LPC32xx
Quoted 14 lines · Wolfram Sang
drivers/usb/host/ohci-nxp.c static void i2c_write(u8 buf, u8 subaddr · line 171
Quoted 11 lines
drivers/usb/host/ohci-nxp.c +9
-1-static void isp1301_configure (void ) +static u16 i2c_read16 (u8 subaddr) +{ +u16 data; + +i2c_master_send (isp1301_i2c_client, &subaddr,1 ); +i2c_master_recv (isp1301_i2c_client, (u8 *) &data,2 ); + +return data; +}Won't
i2c_smbus_read_word_data(isp1301_i2c_client, reg)do?
Quoted 5 lines
And while we are at it: Could you also try replacing
i2c_write()withi2c_smbus_write_byte_data(isp1301_i2c_client, reg, val)?No need to recode it (and in general, those solutions will also work with SMBus for free)
"no need to recode it" means "no need to recode these already existing functions"
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/20120310/53437b57/attachment-0001.sig>
Re: [PATCH v5 3/3] USB: ohci-nxp: Support for LPC32xx
In reply to Wolfram SangQuoted 6 lines · Wolfram Sang
Quoted 4 lines
-static void
isp1301_configure(void)+static u16 i2c_read16(u8
subaddr) +{ + u16 data; + + i2c_master_send(isp1301_i2c_client,
&subaddr, 1); + i2c_master_recv(isp1301_i2c_client, (u8 *) &data,
2); + + return data; +}Won't
i2c_smbus_read_word_data(isp1301_i2c_client, reg)do?
Yes, thank you for the hint! Replaced i2c_read16() with i2c_smbus_read_word_data() calls.
Quoted 2 lines
And while we are at it: Could you also try replacing
i2c_write()withi2c_smbus_write_byte_data(isp1301_i2c_client, reg, val)?
Interestingly now, replacing i2c_write() calls with i2c_smbus_write_byte_data() did _not_ work (hardware initialization failure). I guess this is due to the differences between i2c and smbus, and the hardware only handles the former correctly?
Roland
Re: [PATCH v5 3/3] USB: ohci-nxp: Support for LPC32xx
Quoted 7 lines
Quoted 2 lines
And while we are at it: Could you also try replacing
i2c_write()withi2c_smbus_write_byte_data(isp1301_i2c_client, reg, val)?Interestingly now, replacing
i2c_write()calls withi2c_smbus_write_byte_data()did _not_ work (hardware initialization failure). I guess this is due to the differences between i2c and smbus, and the hardware only handles the former correctly?
Did you take into consideration that the smbus-call has (client, reg, val) as arguments while i2c_write has (val, reg), that is you have to swap the arguments?
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/20120311/8ab88db7/attachment.sig>
Re: [PATCH v5 3/3] USB: ohci-nxp: Support for LPC32xx
Hi,
Quoted 10 lines · Wolfram Sang
Quoted 9 lines
Quoted 3 lines
And while we are at it: Could you also try replacing
i2c_write()withi2c_smbus_write_byte_data(isp1301_i2c_client, reg, val)?Interestingly now, replacing
i2c_write()calls withi2c_smbus_write_byte_data()did _not_ work (hardware initialization failure). I guess this is due to the differences between i2c and smbus, and the hardware only handles the former correctly?
Quoted 3 lines
Did you take into consideration that the smbus-call has (client, reg, val) as arguments while
i2c_writehas (val, reg), that is you have to swap the arguments?
Yes, that's it! :-)
I'll update my patch to not use i2c_write() anymore.
For the remaining i2c_write() in the current kernel driver, I will include an additional patch to remove it completely in favour of i2c_smbus_write_byte_data().
Thanks,
Roland