> From: [email protected] [mailto:[email protected]]
> Sent: Thursday, February 13, 2014 1:11 PM
> 
> Similar to the DWC3 dual-role driver config, the default mode for the
> dwc2/s3c-hsotg driver is a dual-role driver.
> 
> When the driver is built as a module the dwc2.ko and dwc2_platform.ko are
> the two ko's that should be insmod for all operation modes of the driver.

< snip > 

> diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> index ce14859..8c0df5d 100644
> --- a/drivers/usb/dwc2/Kconfig
> +++ b/drivers/usb/dwc2/Kconfig
> @@ -20,21 +20,6 @@ config USB_DWC2
> 
>  if USB_DWC2
> 
> -config USB_DWC2_HOST
> -     bool "Host only mode"
> -     depends on USB=y || USB=USB_DWC2
> -     default y
> -     help
> -       Select this when you want to use DWC2 in host mode only,
> -       thereby the gadget feature will be regressed.
> -
> -config USB_S3C_HSOTG
> -     depends on (ARM || USB_GADGET=y) && !USB_DWC2_HOST
> -     tristate "Designware/S3C HS/OtG USB Device controller"
> -     help
> -       The Designware USB2.0 high-speed gadget controller
> -       integrated into many SoCs.
> -
>  config USB_DWC2_DEBUG
>       bool "Enable Debugging Messages"
>       help
> @@ -66,3 +51,31 @@ config USB_DWC2_DEBUG_PERIODIC
>         incomplete. Note that this also disables some debug messages
>         for which the transfer type cannot be deduced.
>  endif
> +
> +choice
> +     bool "DWC2 Mode Selection"
> +     default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET)
> +     default USB_DWC2_HOST if (USB && !USB_GADGET)
> +     default USB_S3C_HSOTG if (!USB && USB_GADGET)
> +
> +config USB_DWC2_HOST
> +     bool "Host only mode"
> +     depends on USB=y || USB=USB_DWC2
> +     help
> +       Select this when you want to use DWC2 in host mode only,
> +       thereby the gadget feature will be regressed.
> +
> +config USB_S3C_HSOTG
> +     depends on ARM || USB_GADGET=y
> +     tristate "Designware/S3C HS/OtG USB Device controller"
> +     help
> +       The Designware USB2.0 high-speed gadget controller
> +       integrated into many SoCs.
> +
> +config USB_DWC2_DUAL_ROLE
> +     bool "Dual Role mode"
> +     depends on ((USB=y || USB=USB_DWC2) && (USB_GADGET=y))
> +     help
> +       This is the default mode of working of DWC2 controller where
> +       both host and gadget features are enabled.
> +endchoice
> diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile
> index 2cbbabf..eca1bd9 100644
> --- a/drivers/usb/dwc2/Makefile
> +++ b/drivers/usb/dwc2/Makefile
> @@ -2,18 +2,15 @@ ccflags-$(CONFIG_USB_DWC2_DEBUG)    += -DDEBUG
>  ccflags-$(CONFIG_USB_DWC2_VERBOSE)   += -DVERBOSE_DEBUG
> 
>  obj-$(CONFIG_USB_DWC2)                       += dwc2.o
> -dwc2-y                                  += core.o core_intr.o
> -dwc2-y                                  += hcd.o hcd_intr.o
> -dwc2-y                                  += hcd_queue.o hcd_ddma.o
> -endif
> -obj-$(CONFIG_USB_S3C_HSOTG)             += s3c-hsotg.o

Whitespace damage here (spaces instead of tabs)

> +dwc2-y                                       += core.o core_intr.o
> +dwc2-y                                       += hcd.o hcd_intr.o
> +dwc2-y                                       += hcd_queue.o hcd_ddma.o
> +dwc2-y                                       += s3c-hsotg.o
> 
>  ifneq ($(CONFIG_PCI),)
>       obj-$(CONFIG_USB_DWC2)          += dwc2_pci.o
>  endif
> -ifneq ($(CONFIG_USB_DWC2_HOST),)
> -     obj-$(CONFIG_USB_DWC2)                  += dwc2_platform.o
> -endif
> +obj-$(CONFIG_USB_DWC2)                       += dwc2_platform.o
> 
>  dwc2_pci-y                           += pci.o
>  dwc2_platform-y                              += platform.o
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index 1d12988..12e9465 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -467,6 +467,7 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool 
> select_phy, int irq)
> 
>       return 0;
>  }
> +EXPORT_SYMBOL_GPL(dwc2_core_init);
> 
>  /**
>   * dwc2_enable_host_interrupts() - Enables the Host mode interrupts
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index dd5c496..9bbbe53 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -737,7 +737,7 @@ extern void dwc2_read_packet(struct dwc2_hsotg *hsotg, u8 
> *dest, u16 bytes);
>  extern void dwc2_flush_tx_fifo(struct dwc2_hsotg *hsotg, const int num);
>  extern void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg);
> 
> -extern int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int 
> irq);
> +int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq);

Gratuitous change. I know checkpatch now complains about 'extern' on
function declarations, but removing it from just one function is ugly.

-- 
Paul

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

Reply via email to