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	imply CMD_BIND
21	help
22	   USB is a master/slave protocol, organized with one master
23	   host (such as a PC) controlling up to 127 peripheral devices.
24	   The USB hardware is asymmetric, which makes it easier to set up:
25	   you can't connect a "to-the-host" connector to a peripheral.
26
27	   U-Boot can run in the host, or in the peripheral.  In both cases
28	   you need a low level bus controller driver, and some software
29	   talking to it.  Peripheral controllers are often discrete silicon,
30	   or are integrated with the CPU in a microcontroller.  The more
31	   familiar host side controllers have names like "EHCI", "OHCI",
32	   or "UHCI", and are usually integrated into southbridges on PC
33	   motherboards.
34
35	   Enable this configuration option if you want to run U-Boot inside
36	   a USB peripheral device.  Configure one hardware driver for your
37	   peripheral/device side bus controller, and a "gadget driver" for
38	   your peripheral protocol.
39
40config SPL_USB_GADGET
41	bool "USB Gadget Support in SPL"
42	help
43	  Enable USB Gadget API which allows to enable USB device functions
44	  in SPL.
45
46if USB_GADGET
47
48config USB_GADGET_MANUFACTURER
49	string "Vendor name of the USB device"
50	default "NVIDIA" if ARCH_TEGRA
51	default "Allwinner Technology" if ARCH_SUNXI
52	default "Rockchip" if ARCH_ROCKCHIP
53	default "U-Boot"
54	help
55	  Vendor name of the USB device emulated, reported to the host device.
56	  This is usually either the manufacturer of the device or the SoC.
57
58config USB_GADGET_VENDOR_NUM
59	hex "Vendor ID of the USB device"
60	default 0x0955 if ARCH_TEGRA
61	default 0x1f3a if ARCH_SUNXI
62	default 0x2207 if ARCH_ROCKCHIP
63	default 0x0
64	help
65	  Vendor ID of the USB device emulated, reported to the host device.
66	  This is usually the board or SoC vendor's, unless you've registered
67	  for one.
68
69config USB_GADGET_PRODUCT_NUM
70	hex "Product ID of the USB device"
71	default 0x701a if ARCH_TEGRA
72	default 0x1010 if ARCH_SUNXI
73	default 0x110a if ROCKCHIP_RV1108
74	default 0x110b if ROCKCHIP_RV1126
75	default 0x300a if ROCKCHIP_RK3066
76	default 0x301a if ROCKCHIP_RK3036
77	default 0x310b if ROCKCHIP_RK3188
78	default 0x310c if ROCKCHIP_RK3128
79	default 0x320a if ROCKCHIP_RK3288
80	default 0x320b if ROCKCHIP_RK322X
81	default 0x320c if ROCKCHIP_RK3328
82	default 0x330a if ROCKCHIP_RK3368
83	default 0x330c if ROCKCHIP_RK3399
84	default 0x330d if ROCKCHIP_PX30
85	default 0x330e if ROCKCHIP_RK3308
86	default 0x350a if ROCKCHIP_RK3568
87	default 0x350b if ROCKCHIP_RK3588
88	default 0x350c if ROCKCHIP_RK3528
89	default 0x0
90	help
91	  Product ID of the USB device emulated, reported to the host device.
92
93config USB_GADGET_ATMEL_USBA
94	bool "Atmel USBA"
95	select USB_GADGET_DUALSPEED
96	help
97	  USBA is the integrated high-speed USB Device controller on
98	  the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
99
100config USB_GADGET_BCM_UDC_OTG_PHY
101	bool "Broadcom UDC OTG PHY"
102	help
103	  Enable the Broadcom UDC OTG physical device interface.
104
105config USB_GADGET_AT91
106	bool "Atmel AT91 USB Gadget Controller"
107	depends on ARCH_AT91
108
109config USB_GADGET_DWC2_OTG
110	bool "DesignWare USB2.0 HS OTG controller (gadget mode)"
111	select USB_GADGET_DUALSPEED
112	help
113	  The Designware USB2.0 high-speed gadget controller
114	  integrated into many SoCs. Select this option if you want the
115	  driver to operate in Peripheral mode. This option requires
116	  USB_GADGET to be enabled.
117
118config USB_RENESAS_USBHS
119	bool "Renesas R-Car USB2.0 HS controller (gadget mode)"
120	select USB_GADGET_DUALSPEED
121	help
122	  The Renesas R-Car USB 2.0 high-speed gadget controller
123	  integrated into Salvator and Kingfisher boards. Select this
124	  option if you want the driver to operate in Peripheral mode.
125	  This option requires USB_GADGET to be enabled.
126
127if USB_GADGET_DWC2_OTG
128
129config USB_GADGET_DWC2_OTG_PHY
130	bool "DesignWare USB2.0 HS OTG PHY"
131	help
132	  Enable the DesignWare USB2.0 HS OTG physical device interface.
133
134config USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8
135	bool "DesignWare USB2.0 HS OTG controller 8-bit PHY bus width"
136	help
137	  Set the Designware USB2.0 high-speed OTG controller
138	  PHY interface width to 8 bits, rather than the default (16 bits).
139
140endif # USB_GADGET_DWC2_OTG
141
142config USB_GADGET_OS_DESCRIPTORS
143	bool "USB OS Feature Descriptors support"
144	help
145	  This is a porting patch from linux kernel: 37a3a533429e
146	  ("usb: gadget: OS Feature Descriptors support"), the original commit
147	  log see below:
148	  There is a custom (non-USB IF) extension to the USB standard:
149	  http://msdn.microsoft.com/library/windows/hardware/gg463182
150
151config CI_UDC
152	bool "ChipIdea device controller"
153	select USB_GADGET_DUALSPEED
154	help
155	  Say Y here to enable device controller functionality of the
156	  ChipIdea driver.
157
158config USB_GADGET_MAX3420
159	bool "MAX3420 USB Over SPI"
160	depends on DM_SPI
161	help
162	  MAX3420, from MAXIM, implements USB-over-SPI Full-Speed device controller.
163
164config USB_GADGET_VBUS_DRAW
165	int "Maximum VBUS Power usage (2-500 mA)"
166	range 2 500
167	default 2
168	help
169	   Some devices need to draw power from USB when they are
170	   configured, perhaps to operate circuitry or to recharge
171	   batteries.  This is in addition to any local power supply,
172	   such as an AC adapter or batteries.
173
174	   Enter the maximum power your device draws through USB, in
175	   milliAmperes.  The permitted range of values is 2 - 500 mA;
176	   0 mA would be legal, but can make some hosts misbehave.
177
178	   This value will be used except for system-specific gadget
179	   drivers that have more specific information.
180
181config SDP_LOADADDR
182	hex "Default load address at SDP_WRITE and SDP_JUMP"
183	default 0x0
184
185# Selected by UDC drivers that support high-speed operation.
186config USB_GADGET_DUALSPEED
187	bool
188
189config USB_GADGET_DOWNLOAD
190	bool "Enable USB download gadget"
191	help
192	  Composite USB download gadget support (g_dnl) for download functions.
193	  This code works on top of composite gadget.
194
195if USB_GADGET_DOWNLOAD
196
197config USB_FUNCTION_MASS_STORAGE
198	bool "Enable USB mass storage gadget"
199	help
200	  Enable mass storage protocol support in U-Boot. It allows exporting
201	  the eMMC/SD card content to HOST PC so it can be mounted.
202
203config USB_FUNCTION_ROCKUSB
204        bool "Enable USB rockusb gadget"
205        help
206          Rockusb protocol is widely used by Rockchip SoC based devices. It can
207          read/write info, image to/from devices. This enables the USB part of
208          the rockusb gadget.for more detail about Rockusb protocol, please see
209          doc/README.rockusb
210
211config USB_FUNCTION_SDP
212	bool "Enable USB SDP (Serial Download Protocol)"
213	help
214	  Enable Serial Download Protocol (SDP) device support in U-Boot. This
215	  allows to download images into memory and execute (jump to) them
216	  using the same protocol as implemented by the i.MX family's boot ROM.
217
218config USB_FUNCTION_THOR
219	bool "Enable USB THOR gadget"
220	help
221	  Enable Tizen's THOR download protocol support in U-Boot. It
222	  allows downloading images into memory and flash them to target device.
223
224config USB_FUNCTION_ACM
225	bool "Enable CDC ACM gadget"
226	select SYS_STDIO_DEREGISTER
227	select CIRCBUF
228	help
229	  ACM serial link. This function can be used to create a stdio device to
230	  interoperate with MS-Windows hosts or with the Linux-USB "cdc-acm"
231	  driver.
232
233endif # USB_GADGET_DOWNLOAD
234
235config USB_ETHER
236	bool "USB Ethernet Gadget"
237	depends on NET || NET_LWIP
238	default y if ARCH_SUNXI && USB_MUSB_GADGET
239	help
240	  Creates an Ethernet network device through a USB peripheral
241	  controller. This will create a network interface on both the device
242	  (U-Boot) and the host (remote device) that can be used just like any
243	  other nework interface.
244	  It will bind on the peripheral USB controller, ignoring the USB hosts
245	  controllers in the system.
246
247if USB_ETHER
248
249choice
250	prompt "USB Ethernet Gadget Model"
251	default USB_ETH_RNDIS
252	help
253	  There is several models (protocols) to implement Ethernet over USB
254	  devices. The main ones are Microsoft's RNDIS and USB's CDC-Ethernet
255	  (also called CDC-ECM). RNDIS is obviously compatible with Windows,
256	  while CDC-ECM is not. Most other operating systems support both, so
257	  if inter-operability is a concern, RNDIS is to be preferred.
258
259config USB_ETH_CDC
260	bool "CDC-ECM Protocol"
261	help
262	  CDC (Communications Device Class) is the standard for Ethernet over
263	  USB devices. While there's several alternatives, the most widely used
264	  protocol is ECM (Ethernet Control Model). However, compatibility with
265	  Windows is not that great.
266
267config USB_ETH_RNDIS
268	bool "RNDIS Protocol"
269	help
270	  The RNDIS (Remote Network Driver Interface Specification) is a
271	  Microsoft proprietary protocol to create an Ethernet device over USB.
272	  Windows obviously supports it, as well as all the major operating
273	  systems, so it's the best option for compatibility.
274
275endchoice
276
277config USBNET_DEV_ADDR
278	string "USB Gadget Ethernet device mac address"
279	default "de:ad:be:ef:00:01"
280	help
281	  Ethernet MAC address of the device-side (ie. local board's) MAC
282	  address of the usb_ether interface
283
284config USBNET_HOST_ADDR
285	string "USB Gadget Ethernet host mac address"
286	default "de:ad:be:ef:00:00"
287	help
288	  Ethernet MAC address of the host-side (ie. remote device's) MAC
289	  address of the usb_ether interface
290
291endif # USB_ETHER
292
293endif # USB_GADGET
294
295if SPL_USB_GADGET
296
297config SPL_USB_ETHER
298	bool "Support USB Ethernet drivers in SPL"
299	depends on SPL_NET
300	help
301	  Enable access to the USB network subsystem and associated
302	  drivers in SPL. This permits SPL to load U-Boot over a
303	  USB-connected Ethernet link (such as a USB Ethernet dongle) rather
304	  than from an onboard peripheral. Environment support is required
305	  since the network stack uses a number of environment variables.
306	  See also SPL_NET and SPL_ETH.
307
308if SPL_USB_ETHER
309
310choice
311	prompt "USB Ethernet Gadget Model in SPL"
312	default SPL_USB_ETH_RNDIS
313	help
314	  There is several models (protocols) to implement Ethernet over USB
315	  devices. The main ones are Microsoft's RNDIS and USB's CDC-Ethernet
316	  (also called CDC-ECM). RNDIS is obviously compatible with Windows,
317	  while CDC-ECM is not. Most other operating systems support both, so
318	  if inter-operability is a concern, RNDIS is to be preferred.
319
320config SPL_USB_ETH_RNDIS
321	bool "RNDIS Protocol"
322	help
323	  The RNDIS (Remote Network Driver Interface Specification) is a
324	  Microsoft proprietary protocol to create an Ethernet device over USB.
325	  Windows obviously supports it, as well as all the major operating
326	  systems, so it's the best option for compatibility.
327
328endchoice
329
330endif # SPL_USB_ETHER
331
332config SPL_DFU
333	bool "Support DFU (Device Firmware Upgrade) in SPL"
334	select SPL_HASH
335	select SPL_DFU_NO_RESET
336	select SPL_RAM_SUPPORT
337	depends on DFU_OVER_USB
338	help
339	  This feature enables the DFU (Device Firmware Upgrade) in SPL with
340	  RAM memory device support. The ROM code will load and execute
341	  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
342	  selected device partition from host-pc using dfu-utils.
343	  This feature is useful to flash the binaries to factory or bare-metal
344	  boards using USB interface.
345
346choice
347	bool "DFU device selection in SPL"
348	depends on SPL_DFU
349
350config SPL_DFU_RAM
351	bool "RAM device"
352	depends on SPL_DFU && SPL_RAM_SUPPORT
353	help
354	 select RAM/DDR memory device for loading binary images
355	 (u-boot/kernel) to the selected device partition using
356	 DFU and execute the u-boot/kernel from RAM.
357
358endchoice
359
360config SPL_USB_SDP_SUPPORT
361	bool "Support SDP (Serial Download Protocol) in SPL"
362	depends on SPL_SERIAL
363	help
364	  Enable Serial Download Protocol (SDP) device support in SPL. This
365	  allows to download images into memory and execute (jump to) them
366	  using the same protocol as implemented by the i.MX family's boot ROM.
367
368config SPL_SDP_USB_DEV
369	int "SDP USB controller index in SPL"
370	default 0
371	depends on SPL_USB_SDP_SUPPORT
372	help
373	  Some boards have USB controller other than 0. Define this option
374	  so it can be used in compiled environment.
375
376endif # SPL_USB_GADGET
377