[PATCH 4/4] omap: musb: introduce default baord config

Oleg Drokin green at linuxhacker.ru
Thu Apr 28 12:21:47 EDT 2011


Hello!

On Apr 28, 2011, at 10:18 AM, Russell King - ARM Linux wrote:
>>> -void __init usb_musb_init(struct omap_musb_board_data *board_data)
>>> +static struct omap_musb_board_data musb_default_board_data = {
>>> +	.interface_type		= MUSB_INTERFACE_ULPI,
>>> +	.mode			= MUSB_OTG,
>> 
>> In fact can you make it more generic with ifdefs like this?
>> (since there are tons of boards taht are client only or would like to be compiled in some other way):
>> 
>> +#ifdef CONFIG_USB_MUSB_OTG
>> +       .mode                   = MUSB_OTG,
>> +#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
>> +       .mode                   = MUSB_HOST,
>> +#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
>> +       .mode                   = MUSB_PERIPHERAL,
>> +#endif
> If this is something that's desired, then it should not be done via ifdefs
> but by platforms passing the mode argument into an initialization function.
> Eventually, when we switch to some DT like system, this is the kind of
> information that would be obtained from DT, and identifying this stuff
> now will help when DT stuff comes along.

Frankly, I am not even sure why the mode needs to be supplied by the board at all.
The musb code already  has a very similar switch in musb_plat and so it totally looks like
a duplicated specification of the same thing from the board file and from
generic musb code where the original init value is then ignored.

I see that in .29 the board file did not need to specify usb mode and it was all decided
in musb-specific code, and I have no idea why that was later changed to the way it is now.

Would it just be better if a patch removing mode field from struct omap_musb_board_data
is adopted like this (warning - not a real patch)?
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 35559f7..c7f834f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -129,7 +129,6 @@ void __init usb_musb_init(struct omap_musb_board_data *board
        musb_plat.clock = "ick";
        musb_plat.board_data = board_data;
        musb_plat.power = board_data->power >> 1;
-       musb_plat.mode = board_data->mode;
        musb_plat.extvbus = board_data->extvbus;
 
        if (cpu_is_omap44xx())

Bye,
    Oleg


More information about the linux-arm-kernel mailing list