ARM: OMAP: Add support for USB on OMAP34XX
A message that is not in the archive (sent off-list or not yet received): [email protected]
Felipe and others,
Quoted 4 lines
Quoted 4 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp-usb.c
===================================================================arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0
<snip>
Quoted 12 lines
arch/arm/mach-omap2/board-3430sdp-usb.c
Quoted 10 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +10
-0+#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/usb.h> + +#if defined(CONFIG_USB_MUSB_HDRC) ||
defined(CONFIG_USB_MUSB_HDRC_MODULE)
Quoted 2 lines
What about #ifdef
CONFIG_USB_MUSB_SOC
How is this relevant? Could you please elaborate?
Quoted 11 lines
Quoted 3 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
---linux-omap.orig/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 7 lines
10:02:53.000000000 +0530
+++linux-omap/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
17:04:09.664182922 +0530arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0@@ -307,6 +307,8 @@return 0 ; }
Quoted 4 lines
arch/arm/mach-omap2/board-3430sdp-usb.c line 310
Quoted 1 line
arch/arm/mach-omap2/board-3430sdp-usb.c new file +1
-0+extern void __init sdp3430_usb_init (void );This extern will look better in
include/asm-arm/arch-omap/board-3430sdp.h
Yes. But there are other .c files in arch/arm/mach-omap2 that declare externs. Specifically, board-2430sdp.c also does it this way. I thought it would be a good idea to retain the same structure.
I can move it to the .h file if needed. What do you think?
Best Regards,
Anand
Quoted 19 lines · Anand
Felipe and others,
Quoted 4 lines
Quoted 4 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp-usb.c
===================================================================arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0<snip>
Quoted 12 lines
arch/arm/mach-omap2/board-3430sdp-usb.c
Quoted 10 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +10
-0+#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/usb.h> + +#if defined(CONFIG_USB_MUSB_HDRC) ||
defined(CONFIG_USB_MUSB_HDRC_MODULE)
Quoted 4 lines
Quoted 2 lines
What about #ifdef
CONFIG_USB_MUSB_SOCHow is this relevant? Could you please elaborate?
#if defined(*) || defined(*_MODULE) looks a bit awkward. CONFIG_USB_MUSB_SOC is a boolean macro and is true in 2430 and 34XX.
Anybody has any comments on this ??
Quoted 19 lines
Quoted 14 lines
Quoted 6 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
---linux-omap.orig/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 7 lines
10:02:53.000000000 +0530
+++linux-omap/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
17:04:09.664182922 +0530arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0@@ -307,6 +307,8 @@return 0 ; }Quoted 4 lines
arch/arm/mach-omap2/board-3430sdp-usb.c line 310
Quoted 1 line
arch/arm/mach-omap2/board-3430sdp-usb.c new file +1
-0+extern void __init sdp3430_usb_init (void );This extern will look better in
include/asm-arm/arch-omap/board-3430sdp.h
Quoted 5 lines
Yes. But there are other .c files in
arch/arm/mach-omap2that declare externs. Specifically,board-2430sdp.calso does it this way. I thought it would be a good idea to retain the same structure.I can move it to the .h file if needed. What do you think?
Don't know about the others, but I'd prefer seeing this prototype in the header file.
Signature · 8 lines
Best Regards, Felipe Balbi [email protected] +55 92 2126-1003 INdT - OSMRC - Manaus Core Team
Quoted 21 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp-usb.c===================================================================
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0<snip>
Quoted 14 lines
arch/arm/mach-omap2/board-3430sdp-usb.c
Quoted 10 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +10
-0+#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/usb.h> + +#if defined(CONFIG_USB_MUSB_HDRC) ||
defined(CONFIG_USB_MUSB_HDRC_MODULE)What about #ifdef
CONFIG_USB_MUSB_SOC
Quoted 6 lines
Quoted 1 line
How is this relevant? Could you please elaborate?
#if
defined(*)||defined(*_MODULE)looks a bit awkward.CONFIG_USB_MUSB_SOCis a boolean macro and is true in 2430 and 34XX.Anybody has any comments on this ??
I might end up doing this in other places as well. Specifically, when adding EHCI, I might have something along the lines of
#if defined (CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE)
Besides, it seems to be common usage anywhere you have something that can be built as a module.
grep -r CONFIG | grep MODULE | grep "#if" | wc -l
returns something like 900+ results ;)
Quoted 25 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp.c===================================================================
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
---
linux-omap.orig/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 2 lines
10:02:53.000000000 +0530
+++linux-omap/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 11 lines
Quoted 9 lines
arch/arm/mach-omap2/board-3430sdp-usb.c line 310
Quoted 6 lines
17:04:09.664182922 +0530
arch/arm/mach-omap2/board-3430sdp-usb.c new file +1
-0@@ -307,6 +307,8 @@return 0 ; } +extern void __init sdp3430_usb_init (void );This extern will look better in
include/asm-arm/arch-omap/board-3430sdp.hYes. But there are other .c files in
arch/arm/mach-omap2that declare externs.
Quoted 1 line
Specifically,
board-2430sdp.calso does it this way. I
Quoted 9 lines
thought it would be a
Quoted 3 lines
good idea to retain the same structure.
I can move it to the .h file if needed. What do you think?
Don't know about the others, but I'd prefer seeing this prototype in the
header file.
Ok. No problem moving it to the .h file. Anyone else thinks this way?
Also what about the other externs in board*.c files?
Best Regards,
Anand
Quoted 31 lines · Anand
Quoted 21 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp-usb.c===================================================================
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +0
-0<snip>
Quoted 14 lines
arch/arm/mach-omap2/board-3430sdp-usb.c
Quoted 10 lines
arch/arm/mach-omap2/board-3430sdp-usb.c new file +10
-0+#include <linux/types.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/usb/musb.h> + +#include <asm/arch/hardware.h> +#include <asm/arch/usb.h> + +#if defined(CONFIG_USB_MUSB_HDRC) ||
defined(CONFIG_USB_MUSB_HDRC_MODULE)What about #ifdef
CONFIG_USB_MUSB_SOCQuoted 6 lines
Quoted 1 line
How is this relevant? Could you please elaborate?
#if
defined(*)||defined(*_MODULE)looks a bit awkward.CONFIG_USB_MUSB_SOCis a boolean macro and is true in 2430 and 34XX.Anybody has any comments on this ??
I might end up doing this in other places as well. Specifically, when adding EHCI, I might have something along the lines of
Quoted 7 lines
#if defined (
CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE)Besides, it seems to be common usage anywhere you have something that can be built as a module.
grep -r CONFIG | grep MODULE | grep "#if" | wc -l
returns something like 900+ results ;)
Ok then... that's fine to me ;-)
Quoted 42 lines
Quoted 26 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Index:
linux-omap/arch/arm/mach-omap2/board-3430sdp.c===================================================================
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
---
linux-omap.orig/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 2 lines
10:02:53.000000000 +0530
+++linux-omap/arch/arm/mach-omap2/board-3430sdp.c2007-12-05
Quoted 11 lines
Quoted 9 lines
arch/arm/mach-omap2/board-3430sdp-usb.c line 310
Quoted 6 lines
17:04:09.664182922 +0530
arch/arm/mach-omap2/board-3430sdp-usb.c new file +1
-0@@ -307,6 +307,8 @@return 0 ; } +extern void __init sdp3430_usb_init (void );This extern will look better in
include/asm-arm/arch-omap/board-3430sdp.hYes. But there are other .c files in
arch/arm/mach-omap2that declare externs.
Quoted 1 line
Specifically,
board-2430sdp.calso does it this way. IQuoted 9 lines
thought it would be a
Quoted 3 lines
good idea to retain the same structure.
I can move it to the .h file if needed. What do you think?
Don't know about the others, but I'd prefer seeing this prototype in the
header file.Ok. No problem moving it to the .h file. Anyone else thinks this way?
Also what about the other externs in board*.c files?
Best Regards,
Anand
Signature · 8 lines
Best Regards, Felipe Balbi [email protected] +55 92 2126-1003 INdT - OSMRC - Manaus Core Team
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
+#if
defined(CONFIG_USB_MUSB_HDRC)||defined(CONFIG_USB_MUSB_HDRC_MODULE)What about #ifdef
CONFIG_USB_MUSB_SOCHow is this relevant? Could you please elaborate?
#if
defined(*)||defined(*_MODULE)looks a bit awkward.CONFIG_USB_MUSB_SOCis a boolean macro and is true in 2430 and 34XX.Anybody has any comments on this ??
Quoted 7 lines
I might end up doing this in other places as well. Specifically, when adding EHCI, I might have something along the lines of
#if defined (
CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE)Besides, it seems to be common usage anywhere you have something that can be built as a module.
It's common usage only when it's the best solution available.
When there's a single boolean symbol available (as in this case), the simple #ifdef seems clearly better....
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
+extern void
__initsdp3430_usb_init(void);This extern will look better in
include/asm-arm/arch-omap/board-3430sdp.hYes. But there are other .c files in
arch/arm/mach-omap2that declare externs.
Specifically,board-2430sdp.calso does it this way. I thought it would be a good idea to retain the same structure.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I can move it to the .h file if needed. What do you think?
Don't know about the others, but I'd prefer seeing this prototype in the header file.
Ok. No problem moving it to the .h file. Anyone else thinks this way?
Yes. Don't perpetuate bad idioms. I'm fairly convinced this one happens out of laziness ... I know that's been the reason I've done it on occasion, just to avoid a larger rebuild.
Prototypes should be in header files so that there is only one copy, so that when the signature changes it's easier to catch all the code that relies on the old version.
Quoted 1 line
Also what about the other externs in board*.c files?
They're all bugs that should be fixed at a convenient time. Sooner is better, so fewer folk are tempted to repeat these goofs.
- Dave