From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Mon, 28 May 2018 10:37:01 +0200 Subject: [U-Boot] [PATCH v1 2/7] usb: introduce a separate config option for DM USB device In-Reply-To: <1527240762-27114-3-git-send-email-jjhiblot@ti.com> References: <1527240762-27114-1-git-send-email-jjhiblot@ti.com> <1527240762-27114-3-git-send-email-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 25.5.2018 11:32, Jean-Jacques Hiblot wrote: > Using CONFIG_DM_USB for this purpose prevents using DM_USB for host and not > for device. > > Signed-off-by: Jean-Jacques Hiblot > --- > > drivers/usb/Kconfig | 6 ++++++ > drivers/usb/dwc3/core.c | 2 +- > drivers/usb/dwc3/dwc3-generic.c | 4 +++- > 3 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig > index 4fbe172..3587ba4 100644 > --- a/drivers/usb/Kconfig > +++ b/drivers/usb/Kconfig > @@ -47,6 +47,12 @@ config DM_USB > declared with the U_BOOT_USB_DEVICE() macro and will be > automatically probed when found on the bus. > > +config DM_USB_DEV > + bool "Enable driver model for USB (Peripheral mode)" > + depends on DM_USB > + help > + Enable driver model for USB (Peripheral mode). > + > source "drivers/usb/host/Kconfig" > > source "drivers/usb/dwc3/Kconfig" > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 1ab5cee..d5ee6d9 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -789,7 +789,7 @@ MODULE_AUTHOR("Felipe Balbi "); > MODULE_LICENSE("GPL v2"); > MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver"); > > -#ifdef CONFIG_DM_USB > +#ifdef CONFIG_DM_USB_DEV > > int dwc3_init(struct dwc3 *dwc) > { > diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c > index ca63eac..2c1e696 100644 > --- a/drivers/usb/dwc3/dwc3-generic.c > +++ b/drivers/usb/dwc3/dwc3-generic.c > @@ -21,7 +21,7 @@ > #include "gadget.h" > #include "linux-compat.h" > > -DECLARE_GLOBAL_DATA_PTR; Removing this looks weird. I would expect that there will be new error/warning when you compile it because gd is used in bind function. M > +#ifdef CONFIG_DM_USB_DEV > > int usb_gadget_handle_interrupts(int index) > { > @@ -98,6 +98,8 @@ U_BOOT_DRIVER(dwc3_generic_peripheral) = { > .flags = DM_FLAG_ALLOC_PRIV_DMA, > }; > > +#endif > + > static int dwc3_generic_bind(struct udevice *parent) > { > const void *fdt = gd->fdt_blob; >