Re: [PATCH v2 07/11] usb: musb: add Kconfig options for HOST, GAGDET or DUAL_ROLE modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ravi,

On 08.04.2013 12:42, B, Ravi wrote:
>> Subject: [PATCH v2 07/11] usb: musb: add Kconfig options for HOST, GAGDET
>> or DUAL_ROLE modes
>>
>> This makes building the actual object files optional to the selected
>> mode, which saves users who know which kind of USB mode support they
>> need some binary size.
>>
>> Unimplemented functions are stubbed out with static inline functions.
>>
>> Signed-off-by: Daniel Mack <zonque@xxxxxxxxx>
>> ---
>>  drivers/usb/musb/Kconfig       | 29 +++++++++++++++++++++++++++++
>>  drivers/usb/musb/Makefile      | 10 ++++++++--
>>  drivers/usb/musb/musb_gadget.h | 21 +++++++++++++++++++++
>>  drivers/usb/musb/musb_host.h   | 29 +++++++++++++++++++++++++++--
>>  4 files changed, 85 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
>> index 47442d3..aab1568 100644
>> --- a/drivers/usb/musb/Kconfig
>> +++ b/drivers/usb/musb/Kconfig
>> @@ -28,6 +28,35 @@ config USB_MUSB_HDRC
>>  if USB_MUSB_HDRC
>>
>>  choice
>> +	bool "MUSB Mode Selection"
>> +	default USB_MUSB_DUAL_ROLE if (USB && USB_GADGET)
>> +	default USB_MUSB_HOST if (USB && !USB_GADGET)
>> +	default USB_MUSB_GADGET if (!USB && USB_GADGET)
>> +
>> +config USB_MUSB_HOST
>> +	bool "Host only mode"
>> +	depends on USB
>> +	help
>> +	  Select this when you want to use MUSB in host mode only,
>> +	  thereby the gadget feature will be regressed.
>> +
>> +config USB_MUSB_GADGET
>> +	bool "Gadget only mode"
>> +	depends on USB_GADGET
>> +	help
>> +	  Select this when you want to use MUSB in gadget mode only,
>> +	  thereby the host feature will be regressed.
>> +
>> +config USB_MUSB_DUAL_ROLE
>> +	bool "Dual Role mode"
>> +	depends on (USB && USB_GADGET)
>> +	help
>> +	  This is the default mode of working of MUSB controller where
>> +	  both host and gadget features are enabled.
>> +
>> +endchoice
> 
> How do you cater for multi-instance support? Where one controller to force as host and other as device (similar to am33x beagle configuration).
> In general for all combination possible like <host, host> <host, device> <device, host> <dual, dual> etc.

The actual mode chosen for an instance is passed in via pdata/DT. The
Kconfig options only exist in order to stub out code that certainly
isn't needed for a particular platform. IOW, to reduce the binary size.

So the beagleboard will have to select the DUAL_ROLE config parameters,
where other board (like mine) can go for the HOST only option.

If a user selects a mode as runtime parameter that is stubbed out by the
chosen config, it will simply don't do anything. Just as with a driver
that is referenced from DT but not compiled in. I don't think we should
be over-smart here and mess with the configured platform data. If the
platform data is wrong, it has to be fixed anyway. Felipe, do you agree?


Thanks,
Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux