kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 821-usb-dwc2-dualrole.patch
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
26 if USB_DWC2
27
28 +choice
29 + bool "DWC2 Mode Selection"
30 + default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET)
31 + default USB_DWC2_HOST if (USB && !USB_GADGET)
32 + default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET)
33 +
34 config USB_DWC2_HOST
35 - tristate "Host only mode"
36 + bool "Host only mode"
37 depends on USB
38 help
39 The Designware USB2.0 high-speed host controller
40 - integrated into many SoCs.
41 + integrated into many SoCs. Select this option if you want the
42 + driver to operate in Host-only mode.
43
44 -config USB_DWC2_PLATFORM
45 - bool "DWC2 Platform"
46 - depends on USB_DWC2_HOST
47 - default USB_DWC2_HOST
48 +comment "Gadget/Dual-role mode requires USB Gadget support to be enabled"
49 +
50 +config USB_DWC2_PERIPHERAL
51 + bool "Gadget only mode"
52 + depends on USB_GADGET=y || USB_GADGET=USB_DWC2
53 + help
54 + The Designware USB2.0 high-speed gadget controller
55 + integrated into many SoCs. Select this option if you want the
56 + driver to operate in Peripheral-only mode. This option requires
57 + USB_GADGET to be enabled.
58 +
59 +config USB_DWC2_DUAL_ROLE
60 + bool "Dual Role mode"
61 + depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2)
62 help
63 - The Designware USB2.0 platform interface module for
64 - controllers directly connected to the CPU. This is only
65 - used for host mode.
66 + Select this option if you want the driver to work in a dual-role
67 + mode. In this mode both host and gadget features are enabled, and
68 + the role will be determined by the cable that gets plugged-in. This
69 + option requires USB_GADGET to be enabled.
70 +endchoice
71 +
72 +config USB_DWC2_PLATFORM
73 + tristate "DWC2 Platform"
74 + default USB_DWC2_HOST || USB_DWC2_PERIPHERAL
75 + help
76 + The Designware USB2.0 platform interface module for
77 + controllers directly connected to the CPU.
78
79 config USB_DWC2_PCI
80 - bool "DWC2 PCI"
81 + tristate "DWC2 PCI"
82 depends on USB_DWC2_HOST && PCI
83 default USB_DWC2_HOST
84 help
85 The Designware USB2.0 PCI interface module for controllers
86 connected to a PCI bus. This is only used for host mode.
87
88 -comment "Gadget mode requires USB Gadget support to be enabled"
89 -
90 -config USB_DWC2_PERIPHERAL
91 - tristate "Gadget only mode"
92 - depends on USB_GADGET
93 - help
94 - The Designware USB2.0 high-speed gadget controller
95 - integrated into many SoCs.
96 -
97 config USB_DWC2_DEBUG
98 bool "Enable Debugging Messages"
99 help
100 --- a/drivers/usb/dwc2/Makefile
101 +++ b/drivers/usb/dwc2/Makefile
102 @@ -1,28 +1,28 @@
103 ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG
104 ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG
105
106 -obj-$(CONFIG_USB_DWC2_HOST) += dwc2.o
107 +obj-$(CONFIG_USB_DWC2) += dwc2.o
108 dwc2-y := core.o core_intr.o
109 -dwc2-y += hcd.o hcd_intr.o
110 -dwc2-y += hcd_queue.o hcd_ddma.o
111 +
112 +ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
113 + dwc2-y += hcd.o hcd_intr.o
114 + dwc2-y += hcd_queue.o hcd_ddma.o
115 +endif
116 +
117 +ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
118 + dwc2-y += gadget.o
119 +endif
120
121 # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to
122 # this location and renamed gadget.c. When building for dynamically linked
123 -# modules, dwc2_gadget.ko will get built for peripheral mode. For host mode,
124 -# the core module will be dwc2.ko, the PCI bus interface module will called
125 -# dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko.
126 -# At present the host and gadget driver will be separate drivers, but there
127 -# are plans in the near future to create a dual-role driver.
128 +# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role
129 +# mode. The PCI bus interface module will called dwc2_pci.ko and the platform
130 +# interface module will be called dwc2_platform.ko.
131
132 ifneq ($(CONFIG_USB_DWC2_PCI),)
133 - obj-$(CONFIG_USB_DWC2_HOST) += dwc2_pci.o
134 + obj-$(CONFIG_USB_DWC2) += dwc2_pci.o
135 dwc2_pci-y := pci.o
136 endif
137
138 -ifneq ($(CONFIG_USB_DWC2_PLATFORM),)
139 - obj-$(CONFIG_USB_DWC2_HOST) += dwc2_platform.o
140 - dwc2_platform-y := platform.o
141 -endif
142 -
143 -obj-$(CONFIG_USB_DWC2_PERIPHERAL) += dwc2_gadget.o
144 -dwc2_gadget-y := gadget.o
145 +obj-$(CONFIG_USB_DWC2_PLATFORM) += dwc2_platform.o
146 +dwc2_platform-y := platform.o