# SPDX-License-Identifier: GPL-2.0

menu "USB Support"

config AMLOGIC_USB
	bool "Amlogic USB controller support"
	default n
	select USB_PHY if AMLOGIC_BREAK_GKI
	depends on USB
	help
	  DWC_OTG
	  USB
	  host
	  controller.

config AMLOGIC_COMMON_USB
	bool "It is used to cover the USB modification for common dir."
	default n
	depends on AMLOGIC_USB
	help
	  DWC_OTG
	  USB
	  host
	  controller.

config AMLOGIC_USB_SUPPORT
	tristate "USB Host controller and phy support"
	depends on AMLOGIC_USB
	help
	  USB Host
	  controller
	  dwc_otg
	  support

config AMLOGIC_USB_DWC_OTG_HCD
	tristate "USB Host controller dwc_otg support"
	depends on AMLOGIC_USB
	help
	  USB Host
	  controller
	  dwc_otg
	  support

config AMLOGIC_CRG
        bool "USB Host controller corigine support"
        depends on AMLOGIC_USB
        help
          USB Host
          controller
          corigine
          support

config MESON_USBPHY
	bool "Meson new USB PHY Driver"
	depends on AMLOGIC_USB
	help
	  Enable this to support new Amlogic USB phy driver for Amlogic SoCs.
	  This driver uses the Generic Phy framework for Amlogic USB 2.0 PHY &
	  Amlogic USB 3.0 PHY and implements Amlogic USB otg functions.

	  For which socs this driver supports, check the files in the driver directory.

if TYPEC
source "$(COMMON_DRIVERS_DIR)/drivers/usb/typec/Kconfig"
endif # TYPEC

config AMLOGIC_USBPHY
	bool "Amlogic USB PHY Driver"
	depends on AMLOGIC_USB
	help
	  Enable this to support Amlogic USB phy helper driver for Amlogic SoCs.
	  This driver provides common interface to interact, for Amlogic USB 2.0 PHY
	  driver and later for Amlogic USB 3.0 PHY driver.

	  This driver supports GXBABYTV and G9TV.

          To compile this driver as a module, choose M here: the
          module will be called phy-aml-usb.

config AMLOGIC_USB2PHY
	bool "Amlogic USB 2.0 PHY controller Driver"
	depends on AMLOGIC_USBPHY
	help
	  Enable this to support Amlogic USB 2.0 (High Speed) PHY controller
	  for Amlogic SoCs.

	  This driver supports GXBABYTV and G9TV.

	  To compile this driver as a module, choose M here: the
          module will be called phy-aml-usb.

config AMLOGIC_USB3PHY
	bool "Amlogic USB 3.0 PHY controller Driver"
	depends on AMLOGIC_USBPHY
	help
	  Enable this to support Amlogic USB 3.0 (Super Speed) phy controller
	  for Amlogic SoCs.

	  This driver supports GXBABYTV and G9TV.

          To compile this driver as a module, choose M here: the
          module will be called phy-aml-usb.

config AMLOGIC_USBPHYC2
	bool "Amlogic C2 USB PHY controller Driver"
	depends on AMLOGIC_USBPHY
	help
	  Enable this to support Amlogic USB phy controller
	  for Amlogic SoCs.

	  This driver supports GXBABYTV and G9TV.

	  To compile this driver as a module, choose M here: the
	  module will be called phy-aml-usb.

config AMLOGIC_BC
        bool "Amlogic BC detect Driver"
        depends on AMLOGIC_USB
        help
          Enable this to support Amlogic BC detect for Amlogic SoCs.

          This driver supports C2.

          To compile this driver as a module, choose M here: the
          module will be called amlogic-bc.

config AMLOGIC_CC
        bool "Amlogic CC detect Driver"
        depends on AMLOGIC_USB
        help
          Enable this to support Amlogic CC detect for Amlogic SoCs.

          This driver supports C2.

          To compile this driver as a module, choose M here: the
          module will be called amlogic-cc.

config AMLOGIC_USB_DWC3
	tristate "DesignWare USB3 DRD Core Support"
	depends on AMLOGIC_USB
	depends on AMLOGIC_COMMON_USB
	depends on (USB || USB_GADGET) && HAS_DMA
	depends on (EXTCON || EXTCON=n)
	default y
	select USB_XHCI_PLATFORM if USB_XHCI_HCD
	select USB_ROLE_SWITCH if USB_DWC3_DUAL_ROLE
	help
	  Say Y or M here if your system has a Dual Role SuperSpeed
	  USB controller based on the DesignWare USB3 IP Core.

	  If you choose to build this driver as a dynamically linked
	  module, the module will be called dwc3-meson.ko.

if AMLOGIC_USB_DWC3

config AMLOGIC_USB_DWC3_ULPI
	bool "Register ULPI PHY Interface"
	depends on USB_ULPI_BUS=y || USB_ULPI_BUS=USB_DWC3
	default n
	help
	  Select this if you have ULPI type PHY attached to your DWC3
	  controller.

choice
	bool "DWC3 Mode Selection"
	default AMLOGIC_USB_DWC3_DUAL_ROLE if (USB && USB_GADGET)
	default AMLOGIC_USB_DWC3_HOST if (USB && !USB_GADGET)
	default AMLOGIC_USB_DWC3_GADGET if (!USB && USB_GADGET)

config AMLOGIC_USB_DWC3_HOST
	bool "Host only mode"
	depends on USB=y || USB=USB_DWC3
	help
	  Select this when you want to use DWC3 in host mode only,
	  thereby the gadget feature will be regressed.

config AMLOGIC_USB_DWC3_GADGET
	bool "Gadget only mode"
	depends on USB_GADGET=y || USB_GADGET=USB_DWC3
	help
	  Select this when you want to use DWC3 in gadget mode only,
	  thereby the host feature will be regressed.

config AMLOGIC_USB_DWC3_DUAL_ROLE
	bool "Dual Role mode"
	depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
	help
	  This is the default mode of working of DWC3 controller where
	  both host and gadget features are enabled.

endchoice

config AMLOGIC_USB_DWC3_DEBUGFS
	bool "Used to control to build debugfs-meson.c"
	depends on AMLOGIC_USB_DWC3 && DEBUG_FS
	default y
	help
	  Used to control to build debugfs-meson.c.

comment "Platform Glue Driver Support"

config AMLOGIC_USB_DWC3_OTG
	tristate "Amlogic Platforms"
	depends on OF
	default y
	help
	  Some platforms from Amlogic use this IP for USB2/3 functionality.

	  Say 'Y' or 'M' here if you have one such device
endif

endmenu
