[U-Boot] [PATCH v1 03/18] dm: Add a No-op uclass

Marek Vasut marex at denx.de
Fri May 3 09:57:03 UTC 2019


On 5/3/19 11:30 AM, Jean-Jacques Hiblot wrote:
> 
> On 29/04/2019 11:56, Marek Vasut wrote:
>> On 4/5/19 2:55 PM, Jean-Jacques Hiblot wrote:
>>> This uclass is intended for devices that do not need any features
>>> from the
>>> uclass, including binding children.
>>> This will typically be used by devices that are used to bind child
>>> devices
>>> but do not use dm_scan_fdt_dev() to do it. That is for example the
>>> case of
>>> several USB wrappers that have 2 child devices (1 for device and 1 for
>>> host) but bind only one at a any given time.
>>>
>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
>> Could this be UCLASS_BUS or some sort of simple bus ?
> 
> The reason we need a new UCLASS is that MISC or SIMPLE_BUS bind all
> their child devices. The dwc3 wrapper and maybe others too, need to bind
> only one of its 2 children (host or device)

You can return -ENODEV from bind for one of the two devices, but maybe
that's not helping you ?

>> Anyway, +CC Simon.
>>
>>> ---
>>>
>>>   drivers/core/uclass.c  | 5 +++++
>>>   include/dm/uclass-id.h | 1 +
>>>   2 files changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
>>> index fc3157de39..dc9eb62893 100644
>>> --- a/drivers/core/uclass.c
>>> +++ b/drivers/core/uclass.c
>>> @@ -757,3 +757,8 @@ int uclass_pre_remove_device(struct udevice *dev)
>>>       return 0;
>>>   }
>>>   #endif
>>> +
>>> +UCLASS_DRIVER(nop) = {
>>> +    .id        = UCLASS_NOP,
>>> +    .name        = "nop",
>>> +};
>>> diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
>>> index 86e59781b0..3797cd48f6 100644
>>> --- a/include/dm/uclass-id.h
>>> +++ b/include/dm/uclass-id.h
>>> @@ -61,6 +61,7 @@ enum uclass_id {
>>>       UCLASS_MMC,        /* SD / MMC card or chip */
>>>       UCLASS_MOD_EXP,        /* RSA Mod Exp device */
>>>       UCLASS_MTD,        /* Memory Technology Device (MTD) device */
>>> +    UCLASS_NOP,        /* No-op devices */
>>>       UCLASS_NORTHBRIDGE,    /* Intel Northbridge / SDRAM controller */
>>>       UCLASS_NVME,        /* NVM Express device */
>>>       UCLASS_PANEL,        /* Display panel, such as an LCD */
>>>
>>


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list