821-usb-dwc2-dualrole.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. --- a/drivers/usb/dwc2/Kconfig
  2. +++ b/drivers/usb/dwc2/Kconfig
  3. @@ -1,6 +1,6 @@
  4. config USB_DWC2
  5. - bool "DesignWare USB2 DRD Core Support"
  6. - depends on USB
  7. + tristate "DesignWare USB2 DRD Core Support"
  8. + depends on USB || USB_GADGET
  9. help
  10. Say Y here if your system has a Dual Role Hi-Speed USB
  11. controller based on the DesignWare HSOTG IP Core.
  12. @@ -10,49 +10,61 @@ config USB_DWC2
  13. bus interface module (if you have a PCI bus system) will be
  14. called dwc2_pci.ko, and the platform interface module (for
  15. controllers directly connected to the CPU) will be called
  16. - dwc2_platform.ko. For gadget mode, there will be a single
  17. - module called dwc2_gadget.ko.
  18. -
  19. - NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The
  20. - host and gadget drivers are still currently separate drivers.
  21. - There are plans to merge the dwc2_gadget driver with the dwc2
  22. - host driver in the near future to create a dual-role driver.
  23. + dwc2_platform.ko. For all modes(host, gadget and dual-role), there
  24. + will be an additional module named dwc2.ko.
  25. if USB_DWC2
  26. +choice
  27. + bool "DWC2 Mode Selection"
  28. + default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET)
  29. + default USB_DWC2_HOST if (USB && !USB_GADGET)
  30. + default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET)
  31. +
  32. config USB_DWC2_HOST
  33. - tristate "Host only mode"
  34. + bool "Host only mode"
  35. depends on USB
  36. help
  37. The Designware USB2.0 high-speed host controller
  38. - integrated into many SoCs.
  39. + integrated into many SoCs. Select this option if you want the
  40. + driver to operate in Host-only mode.
  41. -config USB_DWC2_PLATFORM
  42. - bool "DWC2 Platform"
  43. - depends on USB_DWC2_HOST
  44. - default USB_DWC2_HOST
  45. +comment "Gadget/Dual-role mode requires USB Gadget support to be enabled"
  46. +
  47. +config USB_DWC2_PERIPHERAL
  48. + bool "Gadget only mode"
  49. + depends on USB_GADGET=y || USB_GADGET=USB_DWC2
  50. + help
  51. + The Designware USB2.0 high-speed gadget controller
  52. + integrated into many SoCs. Select this option if you want the
  53. + driver to operate in Peripheral-only mode. This option requires
  54. + USB_GADGET to be enabled.
  55. +
  56. +config USB_DWC2_DUAL_ROLE
  57. + bool "Dual Role mode"
  58. + depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2)
  59. help
  60. - The Designware USB2.0 platform interface module for
  61. - controllers directly connected to the CPU. This is only
  62. - used for host mode.
  63. + Select this option if you want the driver to work in a dual-role
  64. + mode. In this mode both host and gadget features are enabled, and
  65. + the role will be determined by the cable that gets plugged-in. This
  66. + option requires USB_GADGET to be enabled.
  67. +endchoice
  68. +
  69. +config USB_DWC2_PLATFORM
  70. + tristate "DWC2 Platform"
  71. + default USB_DWC2_HOST || USB_DWC2_PERIPHERAL
  72. + help
  73. + The Designware USB2.0 platform interface module for
  74. + controllers directly connected to the CPU.
  75. config USB_DWC2_PCI
  76. - bool "DWC2 PCI"
  77. + tristate "DWC2 PCI"
  78. depends on USB_DWC2_HOST && PCI
  79. default USB_DWC2_HOST
  80. help
  81. The Designware USB2.0 PCI interface module for controllers
  82. connected to a PCI bus. This is only used for host mode.
  83. -comment "Gadget mode requires USB Gadget support to be enabled"
  84. -
  85. -config USB_DWC2_PERIPHERAL
  86. - tristate "Gadget only mode"
  87. - depends on USB_GADGET
  88. - help
  89. - The Designware USB2.0 high-speed gadget controller
  90. - integrated into many SoCs.
  91. -
  92. config USB_DWC2_DEBUG
  93. bool "Enable Debugging Messages"
  94. help
  95. --- a/drivers/usb/dwc2/Makefile
  96. +++ b/drivers/usb/dwc2/Makefile
  97. @@ -1,28 +1,28 @@
  98. ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG
  99. ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG
  100. -obj-$(CONFIG_USB_DWC2_HOST) += dwc2.o
  101. +obj-$(CONFIG_USB_DWC2) += dwc2.o
  102. dwc2-y := core.o core_intr.o
  103. -dwc2-y += hcd.o hcd_intr.o
  104. -dwc2-y += hcd_queue.o hcd_ddma.o
  105. +
  106. +ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
  107. + dwc2-y += hcd.o hcd_intr.o
  108. + dwc2-y += hcd_queue.o hcd_ddma.o
  109. +endif
  110. +
  111. +ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
  112. + dwc2-y += gadget.o
  113. +endif
  114. # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to
  115. # this location and renamed gadget.c. When building for dynamically linked
  116. -# modules, dwc2_gadget.ko will get built for peripheral mode. For host mode,
  117. -# the core module will be dwc2.ko, the PCI bus interface module will called
  118. -# dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko.
  119. -# At present the host and gadget driver will be separate drivers, but there
  120. -# are plans in the near future to create a dual-role driver.
  121. +# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role
  122. +# mode. The PCI bus interface module will called dwc2_pci.ko and the platform
  123. +# interface module will be called dwc2_platform.ko.
  124. ifneq ($(CONFIG_USB_DWC2_PCI),)
  125. - obj-$(CONFIG_USB_DWC2_HOST) += dwc2_pci.o
  126. + obj-$(CONFIG_USB_DWC2) += dwc2_pci.o
  127. dwc2_pci-y := pci.o
  128. endif
  129. -ifneq ($(CONFIG_USB_DWC2_PLATFORM),)
  130. - obj-$(CONFIG_USB_DWC2_HOST) += dwc2_platform.o
  131. - dwc2_platform-y := platform.o
  132. -endif
  133. -
  134. -obj-$(CONFIG_USB_DWC2_PERIPHERAL) += dwc2_gadget.o
  135. -dwc2_gadget-y := gadget.o
  136. +obj-$(CONFIG_USB_DWC2_PLATFORM) += dwc2_platform.o
  137. +dwc2_platform-y := platform.o