Skip to contentSkip to conversation

USB: Support for LPC32xx SoC

PATCH In review Roland Stigge 3 participants 5 messages Mar 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 USB: Support for LPC32xx SoC

This patch adds OHCI support to the LPC32xx ARM platform

---
Applies to v3.3-rc6

Since v3, only the machine_is_*() dependencies have been pulled into the machine dependent functions.

Thanks to Greg Kroah-Hartman for reviewing!

 drivers/usb/host/ohci-hcd.c     |    5 +
 drivers/usb/host/ohci-pnx4008.c |  119 +++++++++++++++++++++++++++++-----------
 2 files changed, 94 insertions(+), 30 deletions(-)
drivers/usb/host/ohci-hcd.c +5 -0
@@ -1055,6 +1055,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
 #endif
 
+#ifdef CONFIG_ARCH_LPC32XX
+#include "ohci-pnx4008.c"
+#define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
+#endif
+
 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
 #include "ohci-da8xx.c"
 #define PLATFORM_DRIVER		ohci_hcd_da8xx_driver
drivers/usb/host/ohci-pnx4008.c +89 -30

148 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · Roland Stigge

This patch adds OHCI support to the LPC32xx ARM platform

---
Applies to v3.3-rc6

Since v3, only the machine_is_*() dependencies have been pulled into the machine dependent functions.

Better, but:

drivers/usb/host/ohci-pnx4008.c static const struct hc_driver ohci_pnx40 · line 344

Quoted 9 lines

static void pnx4008_unset_usb_bits(void)
{

drivers/usb/host/ohci-pnx4008.c +1 -6
-	start_int_mask(SE_USB_OTG_ATX_INT_N);
-	start_int_mask(SE_USB_OTG_TIMER_INT);
-	start_int_mask(SE_USB_I2C_INT);
-	start_int_mask(SE_USB_INT);
-	start_int_mask(SE_USB_NEED_CLK_INT);
-	start_int_mask(SE_USB_AHB_NEED_CLK_INT);
+	if (machine_is_pnx4008()) {

The function is called "pnx4008...", so why would any code path that is not this hardware call this?

I think there's a disconnect between what you think a pnx4008 machine is, and what I think it is, or what this code is running on and thinks it is.

So, should this function just be called something else, for the type of hardware (lpc32xx?), and then do this check within the function?

Again, consistancy is key. Note how not all of the pnc4008_*() functions make this check, which implies that something is not consistant here...

thanks,

greg k-h

#4 lore raw
In reply to Roland Stigge

drivers/usb/host/ohci-hcd.c MODULE_LICENSE ("GPL"); · line 1061

Quoted 11 lines
drivers/usb/host/ohci-hcd.c +4 -0
@@ -1055,6 +1055,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
 #endif
 
+#ifdef CONFIG_ARCH_LPC32XX
+#include "ohci-pnx4008.c"
+#define PLATFORM_DRIVER		usb_hcd_pnx4008_driver
+#endif

Can't we just do

#if defined(CONFIG_ARCH_PNX4008) || defined(CONFIG_ARCH_LPC32XX)

to save the duplicate entry?

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/20120308/5a622cc2/attachment.sig>
#2 lore raw
In reply to Greg Kroah-Hartman

Hi,

Quoted 2 lines · Greg Kroah-Hartman

So, should this function just be called something else, for the type of hardware (lpc32xx?), and then do this check within the function?

Right. LPC32xx and PNX4008 seem to share much of the functionality but they don't share the bits() part. How about renaming (the static)

pnx4008_set_usb_bits()
pnx4008_unset_usb_bits()

to

set_usb_bits()
unset_usb_bits()

and internally doing machine_is_pnx4008() dependent stuff?

Regarding the other pnx4008_*() functions that are shared with lpc32xx, they only inherit the name for historical reasons. Which naming scheme should apply here if change is due? One common name between those two would be "nxp". We could replace everything common between pnx4008 and lpc32xx with nxp (including ths driver name) and handle the small pnx4008-specific stuff via machine_is_pnx4008().

Thanks in advance,

Roland

#3 lore raw
Quoted 17 lines · Roland Stigge

Hi,

Quoted 2 lines · Greg Kroah-Hartman

So, should this function just be called something else, for the type of hardware (lpc32xx?), and then do this check within the function?

Right. LPC32xx and PNX4008 seem to share much of the functionality but they don't share the bits() part. How about renaming (the static)

pnx4008_set_usb_bits()
pnx4008_unset_usb_bits()

to

set_usb_bits()
unset_usb_bits()

Quoted 8 lines

and internally doing machine_is_pnx4008() dependent stuff?

Regarding the other pnx4008_*() functions that are shared with lpc32xx, they only inherit the name for historical reasons. Which naming scheme should apply here if change is due? One common name between those two would be "nxp". We could replace everything common between pnx4008 and lpc32xx with nxp (including ths driver name) and handle the small pnx4008-specific stuff via machine_is_pnx4008().

That sounds more reasonable, right? But do it in at least two patches to make things obvious as to what is happening.

thanks,

greg k-h