1#
2# USB Gadget support on a system involves
3#    (a) a peripheral controller, and
4#    (b) the gadget driver using it.
5#
6# NOTE:  Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !!
7#
8#  - Host systems (like PCs) need CONFIG_USB (with "A" jacks).
9#  - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks).
10#  - Some systems have both kinds of controllers.
11#
12# With help from a special transceiver and a "Mini-AB" jack, systems with
13# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
14#
15
16menuconfig USB_GADGET
17	bool "USB Gadget Support"
18	depends on DM
19	select DM_USB
20	help
21	   USB is a master/slave protocol, organized with one master
22	   host (such as a PC) controlling up to 127 peripheral devices.
23	   The USB hardware is asymmetric, which makes it easier to set up:
24	   you can't connect a "to-the-host" connector to a peripheral.
25
26	   U-Boot can run in the host, or in the peripheral.  In both cases
27	   you need a low level bus controller driver, and some software
28	   talking to it.  Peripheral controllers are often discrete silicon,
29	   or are integrated with the CPU in a microcontroller.  The more
30	   familiar host side controllers have names like "EHCI", "OHCI",
31	   or "UHCI", and are usually integrated into southbridges on PC
32	   motherboards.
33
34	   Enable this configuration option if you want to run U-Boot inside
35	   a USB peripheral device.  Configure one hardware driver for your
36	   peripheral/device side bus controller, and a "gadget driver" for
37	   your peripheral protocol.
38
39if USB_GADGET
40
41config USB_GADGET_MANUFACTURER
42	string "Vendor name of the USB device"
43	default "Allwinner Technology" if ARCH_SUNXI
44	default "Rockchip" if ARCH_ROCKCHIP
45	default "U-Boot"
46	help
47	  Vendor name of the USB device emulated, reported to the host device.
48	  This is usually either the manufacturer of the device or the SoC.
49
50config USB_GADGET_VENDOR_NUM
51	hex "Vendor ID of the USB device"
52	default 0x1f3a if ARCH_SUNXI
53	default 0x2207 if ARCH_ROCKCHIP
54	default 0x0
55	help
56	  Vendor ID of the USB device emulated, reported to the host device.
57	  This is usually the board or SoC vendor's, unless you've registered
58	  for one.
59
60config USB_GADGET_PRODUCT_NUM
61	hex "Product ID of the USB device"
62	default 0x1010 if ARCH_SUNXI
63	default 0x310a if ROCKCHIP_RK3036
64	default 0x310c if ROCKCHIP_RK3128
65	default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288
66	default 0x330a if ROCKCHIP_RK3328
67	default 0x330c if ROCKCHIP_RK3399
68	default 0x0
69	help
70	  Product ID of the USB device emulated, reported to the host device.
71
72config USB_GADGET_ATMEL_USBA
73	bool "Atmel USBA"
74	select USB_GADGET_DUALSPEED
75	help
76	  USBA is the integrated high-speed USB Device controller on
77	  the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
78
79config USB_GADGET_BCM_UDC_OTG_PHY
80	bool "Broadcom UDC OTG PHY"
81	help
82	  Enable the Broadcom UDC OTG physical device interface.
83
84config USB_GADGET_DWC2_OTG
85	bool "DesignWare USB2.0 HS OTG controller (gadget mode)"
86	select USB_GADGET_DUALSPEED
87	help
88	  The Designware USB2.0 high-speed gadget controller
89	  integrated into many SoCs. Select this option if you want the
90	  driver to operate in Peripheral mode. This option requires
91	  USB_GADGET to be enabled.
92
93if USB_GADGET_DWC2_OTG
94
95config USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8
96	bool "DesignWare USB2.0 HS OTG controller 8-bit PHY bus width"
97	help
98	  Set the Designware USB2.0 high-speed OTG controller
99	  PHY interface width to 8 bits, rather than the default (16 bits).
100
101endif # USB_GADGET_DWC2_OTG
102
103config USB_GADGET_OS_DESCRIPTORS
104	bool "USB OS Feature Descriptors support"
105	help
106	  This is a porting patch from linux kernel: 37a3a533429e
107	  ("usb: gadget: OS Feature Descriptors support"), the original commit
108	  log see below:
109	  There is a custom (non-USB IF) extension to the USB standard:
110	  http://msdn.microsoft.com/library/windows/hardware/gg463182
111
112config CI_UDC
113	bool "ChipIdea device controller"
114	select USB_GADGET_DUALSPEED
115	help
116	  Say Y here to enable device controller functionality of the
117	  ChipIdea driver.
118
119config USB_GADGET_MAX3420
120	bool "MAX3420 USB Over SPI"
121	depends on DM_SPI
122	help
123	  MAX3420, from MAXIM, implements USB-over-SPI Full-Speed device controller.
124
125config USB_GADGET_VBUS_DRAW
126	int "Maximum VBUS Power usage (2-500 mA)"
127	range 2 500
128	default 2
129	help
130	   Some devices need to draw power from USB when they are
131	   configured, perhaps to operate circuitry or to recharge
132	   batteries.  This is in addition to any local power supply,
133	   such as an AC adapter or batteries.
134
135	   Enter the maximum power your device draws through USB, in
136	   milliAmperes.  The permitted range of values is 2 - 500 mA;
137	   0 mA would be legal, but can make some hosts misbehave.
138
139	   This value will be used except for system-specific gadget
140	   drivers that have more specific information.
141
142config SDP_LOADADDR
143	hex "Default load address at SDP_WRITE and SDP_JUMP"
144	default 0
145
146# Selected by UDC drivers that support high-speed operation.
147config USB_GADGET_DUALSPEED
148	bool
149
150config USB_GADGET_DOWNLOAD
151	bool "Enable USB download gadget"
152	help
153	  Composite USB download gadget support (g_dnl) for download functions.
154	  This code works on top of composite gadget.
155
156if USB_GADGET_DOWNLOAD
157
158config USB_FUNCTION_MASS_STORAGE
159	bool "Enable USB mass storage gadget"
160	help
161	  Enable mass storage protocol support in U-Boot. It allows exporting
162	  the eMMC/SD card content to HOST PC so it can be mounted.
163
164config USB_FUNCTION_ROCKUSB
165        bool "Enable USB rockusb gadget"
166        help
167          Rockusb protocol is widely used by Rockchip SoC based devices. It can
168          read/write info, image to/from devices. This enables the USB part of
169          the rockusb gadget.for more detail about Rockusb protocol, please see
170          doc/README.rockusb
171
172config USB_FUNCTION_SDP
173	bool "Enable USB SDP (Serial Download Protocol)"
174	help
175	  Enable Serial Download Protocol (SDP) device support in U-Boot. This
176	  allows to download images into memory and execute (jump to) them
177	  using the same protocol as implemented by the i.MX family's boot ROM.
178
179config USB_FUNCTION_THOR
180	bool "Enable USB THOR gadget"
181	help
182	  Enable Tizen's THOR download protocol support in U-Boot. It
183	  allows downloading images into memory and flash them to target device.
184
185endif # USB_GADGET_DOWNLOAD
186
187config USB_ETHER
188	bool "USB Ethernet Gadget"
189	depends on NET
190	default y if ARCH_SUNXI && USB_MUSB_GADGET
191	help
192	  Creates an Ethernet network device through a USB peripheral
193	  controller. This will create a network interface on both the device
194	  (U-Boot) and the host (remote device) that can be used just like any
195	  other nework interface.
196	  It will bind on the peripheral USB controller, ignoring the USB hosts
197	  controllers in the system.
198
199if USB_ETHER
200
201choice
202	prompt "USB Ethernet Gadget Model"
203	default USB_ETH_RNDIS
204	help
205	  There is several models (protocols) to implement Ethernet over USB
206	  devices. The main ones are Microsoft's RNDIS and USB's CDC-Ethernet
207	  (also called CDC-ECM). RNDIS is obviously compatible with Windows,
208	  while CDC-ECM is not. Most other operating systems support both, so
209	  if inter-operability is a concern, RNDIS is to be preferred.
210
211config USB_ETH_CDC
212	bool "CDC-ECM Protocol"
213	help
214	  CDC (Communications Device Class) is the standard for Ethernet over
215	  USB devices. While there's several alternatives, the most widely used
216	  protocol is ECM (Ethernet Control Model). However, compatibility with
217	  Windows is not that great.
218
219config USB_ETH_RNDIS
220	bool "RNDIS Protocol"
221	help
222	  The RNDIS (Remote Network Driver Interface Specification) is a
223	  Microsoft proprietary protocol to create an Ethernet device over USB.
224	  Windows obviously supports it, as well as all the major operating
225	  systems, so it's the best option for compatibility.
226
227endchoice
228
229config USBNET_DEVADDR
230	string "USB Gadget Ethernet device mac address"
231	default "de:ad:be:ef:00:01"
232	help
233	  Ethernet MAC address of the device-side (ie. local board's) MAC
234	  address of the usb_ether interface
235
236config USBNET_HOST_ADDR
237	string "USB Gadget Ethernet host mac address"
238	default "de:ad:be:ef:00:00"
239	help
240	  Ethernet MAC address of the host-side (ie. remote device's) MAC
241	  address of the usb_ether interface
242
243endif # USB_ETHER
244
245endif # USB_GADGET
246