Skip to content

Commit a8ab3e7

Browse files
committed
Merge tag 'usb-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: USB: changes for v5.7 merge window Lots of changes on dwc3 this time, most of them from Thinh fixing a bunch of really old mishaps on the driver. DWC2 got support for STM32MP15 and a couple RockChip SoCs while DWC3 learned about Amlogic A1 family. Apart from these, we have a few spelling fixes and other minor non-critical fixes all over the place. Signed-off-by: Felipe Balbi <balbi@kernel.org> * tag 'usb-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (41 commits) dt-bindings: usb: add documentation for aspeed usb-vhub ARM: dts: aspeed-g4: add vhub port and endpoint properties ARM: dts: aspeed-g5: add vhub port and endpoint properties ARM: dts: aspeed-g6: add usb functions usb: gadget: aspeed: add ast2600 vhub support usb: gadget: aspeed: read vhub properties from device tree usb: gadget: aspeed: support per-vhub usb descriptors usb: gadget: f_phonet: Replace zero-length array with flexible-array member usb: gadget: composite: Inform controller driver of self-powered usb: gadget: amd5536udc: fix spelling mistake "reserverd" -> "reserved" udc: s3c-hsudc: Silence warning about supplies during deferred probe usb: dwc2: Silence warning about supplies during deferred probe dt-bindings: usb: dwc2: add compatible property for rk3368 usb dt-bindings: usb: dwc2: add compatible property for rk3328 usb usb: gadget: add raw-gadget interface usb: dwc2: Implement set_selfpowered() usb: dwc3: qcom: Replace <linux/clk-provider.h> by <linux/of_clk.h> usb: dwc3: core: don't do suspend for device mode if already suspended usb: dwc3: Rework resets initialization to be more flexible usb: dwc3: Rework clock initialization to be more flexible ...
2 parents 6a7c533 + 4a5dbd9 commit a8ab3e7

40 files changed

Lines changed: 3496 additions & 183 deletions

‎Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ description: |
2222
The DWC3 Glue controls the PHY routing and power, an interrupt line is
2323
connected to the Glue to serve as OTG ID change detection.
2424
25+
The Amlogic A1 embeds a DWC3 USB IP Core configured for USB2 in
26+
host-only mode.
27+
2528
properties:
2629
compatible:
2730
enum:
2831
- amlogic,meson-g12a-usb-ctrl
32+
- amlogic,meson-a1-usb-ctrl
2933

3034
ranges: true
3135

@@ -84,6 +88,25 @@ required:
8488
- phys
8589
- dr_mode
8690

91+
allOf:
92+
- if:
93+
properties:
94+
compatible:
95+
enum:
96+
- amlogic,meson-a1-usb-ctrl
97+
98+
then:
99+
properties:
100+
clocks:
101+
minItems: 3
102+
clock-names:
103+
items:
104+
- const: usb_ctrl
105+
- const: usb_bus
106+
- const: xtal_usb_ctrl
107+
required:
108+
- clock-names
109+
87110
examples:
88111
- |
89112
usb: usb@ffe09000 {
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright (c) 2020 Facebook Inc.
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/usb/aspeed,usb-vhub.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: ASPEED USB 2.0 Virtual Hub Controller
9+
10+
maintainers:
11+
- Benjamin Herrenschmidt <benh@kernel.crashing.org>
12+
13+
description: |+
14+
The ASPEED USB 2.0 Virtual Hub Controller implements 1 set of USB Hub
15+
register and several sets of Device and Endpoint registers to support
16+
the Virtual Hub's downstream USB devices.
17+
18+
Supported number of devices and endpoints vary depending on hardware
19+
revisions. AST2400 and AST2500 Virtual Hub supports 5 downstream devices
20+
and 15 generic endpoints, while AST2600 Virtual Hub supports 7 downstream
21+
devices and 21 generic endpoints.
22+
23+
properties:
24+
compatible:
25+
enum:
26+
- aspeed,ast2400-usb-vhub
27+
- aspeed,ast2500-usb-vhub
28+
- aspeed,ast2600-usb-vhub
29+
30+
reg:
31+
maxItems: 1
32+
33+
clocks:
34+
maxItems: 1
35+
36+
interrupts:
37+
maxItems: 1
38+
39+
aspeed,vhub-downstream-ports:
40+
description: Number of downstream ports supported by the Virtual Hub
41+
allOf:
42+
- $ref: /schemas/types.yaml#/definitions/uint32
43+
- default: 5
44+
minimum: 1
45+
maximum: 7
46+
47+
aspeed,vhub-generic-endpoints:
48+
description: Number of generic endpoints supported by the Virtual Hub
49+
allOf:
50+
- $ref: /schemas/types.yaml#/definitions/uint32
51+
- default: 15
52+
minimum: 1
53+
maximum: 21
54+
55+
required:
56+
- compatible
57+
- reg
58+
- clocks
59+
- interrupts
60+
- aspeed,vhub-downstream-ports
61+
- aspeed,vhub-generic-endpoints
62+
63+
additionalProperties: false
64+
65+
examples:
66+
- |
67+
#include <dt-bindings/clock/aspeed-clock.h>
68+
vhub: usb-vhub@1e6a0000 {
69+
compatible = "aspeed,ast2500-usb-vhub";
70+
reg = <0x1e6a0000 0x300>;
71+
interrupts = <5>;
72+
clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
73+
aspeed,vhub-downstream-ports = <5>;
74+
aspeed,vhub-generic-endpoints = <15>;
75+
pinctrl-names = "default";
76+
pinctrl-0 = <&pinctrl_usb2ad_default>;
77+
};

‎Documentation/devicetree/bindings/usb/dwc2.yaml‎

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,15 @@ properties:
1818
- const: rockchip,rk3066-usb
1919
- const: snps,dwc2
2020
- items:
21-
- const: rockchip,px30-usb
22-
- const: rockchip,rk3066-usb
23-
- const: snps,dwc2
24-
- items:
25-
- const: rockchip,rk3036-usb
26-
- const: rockchip,rk3066-usb
27-
- const: snps,dwc2
28-
- items:
29-
- const: rockchip,rv1108-usb
30-
- const: rockchip,rk3066-usb
31-
- const: snps,dwc2
32-
- items:
33-
- const: rockchip,rk3188-usb
34-
- const: rockchip,rk3066-usb
35-
- const: snps,dwc2
36-
- items:
37-
- const: rockchip,rk3228-usb
38-
- const: rockchip,rk3066-usb
39-
- const: snps,dwc2
40-
- items:
41-
- const: rockchip,rk3288-usb
21+
- enum:
22+
- rockchip,px30-usb
23+
- rockchip,rk3036-usb
24+
- rockchip,rk3188-usb
25+
- rockchip,rk3228-usb
26+
- rockchip,rk3288-usb
27+
- rockchip,rk3328-usb
28+
- rockchip,rk3368-usb
29+
- rockchip,rv1108-usb
4230
- const: rockchip,rk3066-usb
4331
- const: snps,dwc2
4432
- const: lantiq,arx100-usb

‎Documentation/devicetree/bindings/usb/dwc3.txt‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Required properties:
77
- compatible: must be "snps,dwc3"
88
- reg : Address and length of the register set for the device
99
- interrupts: Interrupts used by the dwc3 controller.
10-
- clock-names: should contain "ref", "bus_early", "suspend"
10+
- clock-names: list of clock names. Ideally should be "ref",
11+
"bus_early", "suspend" but may be less or more.
1112
- clocks: list of phandle and clock specifier pairs corresponding to
1213
entries in the clock-names property.
1314

@@ -36,7 +37,7 @@ Optional properties:
3637
- phys: from the *Generic PHY* bindings
3738
- phy-names: from the *Generic PHY* bindings; supported names are "usb2-phy"
3839
or "usb3-phy".
39-
- resets: a single pair of phandle and reset specifier
40+
- resets: set of phandle and reset specifier pairs
4041
- snps,usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
4142
- snps,usb3_lpm_capable: determines if platform is USB3 LPM capable
4243
- snps,dis-start-transfer-quirk: when set, disable isoc START TRANSFER command
@@ -75,6 +76,8 @@ Optional properties:
7576
from P0 to P1/P2/P3 without delay.
7677
- snps,dis-tx-ipgap-linecheck-quirk: when set, disable u2mac linestate check
7778
during HS transmit.
79+
- snps,parkmode-disable-ss-quirk: when set, all SuperSpeed bus instances in
80+
park mode are disabled.
7881
- snps,dis_metastability_quirk: when set, disable metastability workaround.
7982
CAUTION: use only if you are absolutely sure of it.
8083
- snps,is-utmi-l1-suspend: true when DWC3 asserts output signal

‎Documentation/devicetree/bindings/usb/generic.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ Optional properties:
3535
the USB data role (USB host or USB device) for a given
3636
USB connector, such as Type-C, Type-B(micro).
3737
see connector/usb-connector.txt.
38+
- role-switch-default-mode: indicating if usb-role-switch is enabled, the
39+
device default operation mode of controller while usb
40+
role is USB_ROLE_NONE. Valid arguments are "host" and
41+
"peripheral". Defaults to "peripheral" if not
42+
specified.
43+
3844

3945
This is an attribute to a USB controller such as:
4046

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/usb/maxim,max3420-udc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: MAXIM MAX3420/1 USB Peripheral Controller
8+
9+
maintainers:
10+
- Jassi Brar <jaswinder.singh@linaro.org>
11+
12+
description: |
13+
The controller provices USB2.0 compliant FullSpeed peripheral
14+
implementation over the SPI interface.
15+
16+
Specifications about the part can be found at:
17+
http://datasheets.maximintegrated.com/en/ds/MAX3420E.pdf
18+
19+
properties:
20+
compatible:
21+
enum:
22+
- maxim,max3420-udc
23+
- maxim,max3421-udc
24+
25+
reg:
26+
maxItems: 1
27+
28+
interrupts:
29+
items:
30+
- description: usb irq from max3420
31+
- description: vbus detection irq
32+
minItems: 1
33+
maxItems: 2
34+
35+
interrupt-names:
36+
items:
37+
- const: udc
38+
- const: vbus
39+
minItems: 1
40+
maxItems: 2
41+
42+
spi-max-frequency:
43+
maximum: 26000000
44+
45+
required:
46+
- compatible
47+
- reg
48+
- interrupts
49+
- interrupt-names
50+
51+
additionalProperties: false
52+
53+
examples:
54+
- |
55+
#include <dt-bindings/gpio/gpio.h>
56+
#include <dt-bindings/interrupt-controller/irq.h>
57+
spi0 {
58+
#address-cells = <1>;
59+
#size-cells = <0>;
60+
61+
udc@0 {
62+
compatible = "maxim,max3420-udc";
63+
reg = <0>;
64+
interrupt-parent = <&gpio>;
65+
interrupts = <0 IRQ_TYPE_EDGE_FALLING>, <10 IRQ_TYPE_EDGE_BOTH>;
66+
interrupt-names = "udc", "vbus";
67+
spi-max-frequency = <12500000>;
68+
};
69+
};

‎Documentation/usb/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ USB support
2222
misc_usbsevseg
2323
mtouchusb
2424
ohci
25+
raw-gadget
2526
usbip_protocol
2627
usbmon
2728
usb-serial

‎Documentation/usb/raw-gadget.rst‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
==============
2+
USB Raw Gadget
3+
==============
4+
5+
USB Raw Gadget is a kernel module that provides a userspace interface for
6+
the USB Gadget subsystem. Essentially it allows to emulate USB devices
7+
from userspace. Enabled with CONFIG_USB_RAW_GADGET. Raw Gadget is
8+
currently a strictly debugging feature and shouldn't be used in
9+
production, use GadgetFS instead.
10+
11+
Comparison to GadgetFS
12+
~~~~~~~~~~~~~~~~~~~~~~
13+
14+
Raw Gadget is similar to GadgetFS, but provides a more low-level and
15+
direct access to the USB Gadget layer for the userspace. The key
16+
differences are:
17+
18+
1. Every USB request is passed to the userspace to get a response, while
19+
GadgetFS responds to some USB requests internally based on the provided
20+
descriptors. However note, that the UDC driver might respond to some
21+
requests on its own and never forward them to the Gadget layer.
22+
23+
2. GadgetFS performs some sanity checks on the provided USB descriptors,
24+
while Raw Gadget allows you to provide arbitrary data as responses to
25+
USB requests.
26+
27+
3. Raw Gadget provides a way to select a UDC device/driver to bind to,
28+
while GadgetFS currently binds to the first available UDC.
29+
30+
4. Raw Gadget uses predictable endpoint names (handles) across different
31+
UDCs (as long as UDCs have enough endpoints of each required transfer
32+
type).
33+
34+
5. Raw Gadget has ioctl-based interface instead of a filesystem-based one.
35+
36+
Userspace interface
37+
~~~~~~~~~~~~~~~~~~~
38+
39+
To create a Raw Gadget instance open /dev/raw-gadget. Multiple raw-gadget
40+
instances (bound to different UDCs) can be used at the same time. The
41+
interaction with the opened file happens through the ioctl() calls, see
42+
comments in include/uapi/linux/usb/raw_gadget.h for details.
43+
44+
The typical usage of Raw Gadget looks like:
45+
46+
1. Open Raw Gadget instance via /dev/raw-gadget.
47+
2. Initialize the instance via USB_RAW_IOCTL_INIT.
48+
3. Launch the instance with USB_RAW_IOCTL_RUN.
49+
4. In a loop issue USB_RAW_IOCTL_EVENT_FETCH calls to receive events from
50+
Raw Gadget and react to those depending on what kind of USB device
51+
needs to be emulated.
52+
53+
Potential future improvements
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55+
56+
- Implement ioctl's for setting/clearing halt status on endpoints.
57+
58+
- Reporting more events (suspend, resume, etc.) through
59+
USB_RAW_IOCTL_EVENT_FETCH.
60+
61+
- Support O_NONBLOCK I/O.

‎arch/arm/boot/dts/aspeed-g4.dtsi‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@
164164
reg = <0x1e6a0000 0x300>;
165165
interrupts = <5>;
166166
clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
167+
aspeed,vhub-downstream-ports = <5>;
168+
aspeed,vhub-generic-endpoints = <15>;
167169
pinctrl-names = "default";
168170
pinctrl-0 = <&pinctrl_usb2d_default>;
169171
status = "disabled";

‎arch/arm/boot/dts/aspeed-g5.dtsi‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@
195195
reg = <0x1e6a0000 0x300>;
196196
interrupts = <5>;
197197
clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
198+
aspeed,vhub-downstream-ports = <5>;
199+
aspeed,vhub-generic-endpoints = <15>;
198200
pinctrl-names = "default";
199201
pinctrl-0 = <&pinctrl_usb2ad_default>;
200202
status = "disabled";

0 commit comments

Comments
 (0)