From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Kubushyn Date: Fri, 22 Mar 2019 10:39:54 -0700 (PDT) Subject: [U-Boot] [PATCH] dm: Add a No-op uclass In-Reply-To: <20190322164429.28637-1-jjhiblot@ti.com> References: <20190322164429.28637-1-jjhiblot@ti.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 22 Mar 2019, Jean-Jacques Hiblot wrote: It is probably the right solution, just have one suggestion -- why wouldn't we make it UCLASS_GLUE instead? NOP is too generic, IMHO and it is just NOP. There is definitely a place for such thing but we might want to add some specific functionality for glues and NOP is not a very good place to do so... Just my $.25... BTW, there is yet another thing with USB gadgets bound by a glue. The usb_gadget_initialize() in udc-uclass.c calls uclass_get_device_by_seq() that requires either already probed device or an alias. If neither is found it fails so it is not possible to get USB Glue gadget subnode to come up automagically. Replacing uclass_get_device_by_seq() with plain uclass_get_device() solves this problem -- it probes the device without a need for an alias. Tested here on a custom imx8mq board. Yet another $.25 :) > 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. > > Signed-off-by: Jean-Jacques Hiblot > --- > 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 */ > -- > 2.17.1 > --- ****************************************************************** * KSI at home KOI8 Net < > The impossible we do immediately. * * Las Vegas NV, USA < > Miracles require 24-hour notice. * ******************************************************************