Skip to content

Commit

Permalink
Merge tag 'usb-for-v5.9' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/balbi/usb into usb-next

Felipe writes:

USB: changes for v5.9 merge window

CDNS3 got several improvements, most of which are non-critical fixes.
DWC3 has a reset fix for the meson platform, while dwc2 has
improvements for role switch on STM32MP15 SoCs.

Apart from these, we have the usual set of non-critical fixes all over
the place and support for new Ingenic SoC to their PHY driver.

* tag 'usb-for-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (38 commits)
  usb: dwc3: gadget: when the started list is empty stop the active xfer
  usb: dwc3: gadget: make starting isoc transfers more robust
  usb: dwc3: gadget: add frame number mask
  usb: gadget: function: printer: Interface is disabled and returns error
  usb: gadget: f_uac2: fix AC Interface Header Descriptor wTotalLength
  dt-bindings: usb: ti,keystone-dwc3.yaml: Improve schema
  usb: bdc: Use devm_clk_get_optional()
  usb: bdc: Halt controller on suspend
  usb: bdc: driver runs out of buffer descriptors on large ADB transfers
  usb: bdc: Adb shows offline after resuming from S2
  bdc: Fix bug causing crash after multiple disconnects
  usb: bdc: Add compatible string for new style USB DT nodes
  dt-bindings: usb: bdc: Update compatible strings
  USB: PHY: JZ4770: Reformat the code to align it.
  USB: PHY: JZ4770: Add support for new Ingenic SoCs.
  USB: PHY: JZ4770: Unify code style and simplify code.
  dt-bindings: USB: Add bindings for new Ingenic SoCs.
  usb: gadget: net2280: fix memory leak on probe error handling paths
  usb: cdns3: drd: simplify *switch_gadet and *switch_host
  usb: cdns3: core: removed overwriting some error code
  ...
  • Loading branch information
gregkh committed Jul 27, 2020
2 parents c977930 + f5e46aa commit e98ba8c
Show file tree
Hide file tree
Showing 30 changed files with 731 additions and 279 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/usb/brcm,bdc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Broadcom USB Device Controller (BDC)
Required properties:

- compatible: must be one of:
"brcm,bdc-v0.16"
"brcm,bdc-udc-v2"
"brcm,bdc"
- reg: the base register address and length
- interrupts: the interrupt line for this controller
Expand All @@ -21,7 +21,7 @@ On Broadcom STB platforms, these properties are required:
Example:

bdc@f0b02000 {
compatible = "brcm,bdc-v0.16";
compatible = "brcm,bdc-udc-v2";
reg = <0xf0b02000 0xfc4>;
interrupts = <0x0 0x60 0x0>;
phys = <&usbphy_0 0x0>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
$id: http://devicetree.org/schemas/usb/ingenic,jz4770-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Ingenic JZ4770 USB PHY devicetree bindings
title: Ingenic SoCs USB PHY devicetree bindings

maintainers:
- Paul Cercueil <paul@crapouillou.net>
- 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>

properties:
$nodename:
Expand All @@ -16,6 +17,9 @@ properties:
compatible:
enum:
- ingenic,jz4770-phy
- ingenic,jz4780-phy
- ingenic,x1000-phy
- ingenic,x1830-phy

reg:
maxItems: 1
Expand Down
51 changes: 37 additions & 14 deletions Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,36 @@ maintainers:

properties:
compatible:
oneOf:
- const: "ti,keystone-dwc3"
- const: "ti,am654-dwc3"
items:
- enum:
- ti,keystone-dwc3
- ti,am654-dwc3

reg:
maxItems: 1
description: Address and length of the register set for the USB subsystem on
the SOC.

'#address-cells':
const: 1

'#size-cells':
const: 1

ranges: true

interrupts:
maxItems: 1
description: The irq number of this device that is used to interrupt the MPU.


clocks:
description: Clock ID for USB functional clock.
minItems: 1
maxItems: 2

assigned-clocks:
minItems: 1
maxItems: 2

assigned-clock-parents:
minItems: 1
maxItems: 2

power-domains:
description: Should contain a phandle to a PM domain provider node
Expand All @@ -42,33 +56,42 @@ properties:

phy-names:
items:
- const: "usb3-phy"
- const: usb3-phy

dma-coherent: true

dwc3:
dma-ranges: true

patternProperties:
"usb@[a-f0-9]+$":
type: object
description: This is the node representing the DWC3 controller instance
Documentation/devicetree/bindings/usb/dwc3.txt

required:
- compatible
- reg
- "#address-cells"
- "#size-cells"
- ranges
- interrupts
- clocks

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
usb: usb@2680000 {
dwc3@2680000 {
compatible = "ti,keystone-dwc3";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x2680000 0x10000>;
clocks = <&clkusb>;
clock-names = "usb";
interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
ranges;
dwc3@2690000 {
usb@2690000 {
compatible = "synopsys,dwc3";
reg = <0x2690000 0x70000>;
interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
Expand Down
39 changes: 13 additions & 26 deletions drivers/usb/cdns3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@

static int cdns3_idle_init(struct cdns3 *cdns);

static inline
struct cdns3_role_driver *cdns3_get_current_role_driver(struct cdns3 *cdns)
{
WARN_ON(!cdns->roles[cdns->role]);
return cdns->roles[cdns->role];
}

static int cdns3_role_start(struct cdns3 *cdns, enum usb_role role)
{
int ret;
Expand Down Expand Up @@ -93,7 +86,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
struct device *dev = cdns->dev;
enum usb_dr_mode best_dr_mode;
enum usb_dr_mode dr_mode;
int ret = 0;
int ret;

dr_mode = usb_get_dr_mode(dev);
cdns->role = USB_ROLE_NONE;
Expand Down Expand Up @@ -184,7 +177,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
goto err;
}

return ret;
return 0;
err:
cdns3_exit_roles(cdns);
return ret;
Expand All @@ -198,11 +191,17 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
*/
static enum usb_role cdns3_hw_role_state_machine(struct cdns3 *cdns)
{
enum usb_role role;
enum usb_role role = USB_ROLE_NONE;
int id, vbus;

if (cdns->dr_mode != USB_DR_MODE_OTG)
goto not_otg;
if (cdns->dr_mode != USB_DR_MODE_OTG) {
if (cdns3_is_host(cdns))
role = USB_ROLE_HOST;
if (cdns3_is_device(cdns))
role = USB_ROLE_DEVICE;

return role;
}

id = cdns3_get_id(cdns);
vbus = cdns3_get_vbus(cdns);
Expand Down Expand Up @@ -239,14 +238,6 @@ static enum usb_role cdns3_hw_role_state_machine(struct cdns3 *cdns)
dev_dbg(cdns->dev, "role %d -> %d\n", cdns->role, role);

return role;

not_otg:
if (cdns3_is_host(cdns))
role = USB_ROLE_HOST;
if (cdns3_is_device(cdns))
role = USB_ROLE_DEVICE;

return role;
}

static int cdns3_idle_role_start(struct cdns3 *cdns)
Expand Down Expand Up @@ -356,7 +347,6 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_HOST:
break;
default:
ret = -EPERM;
goto pm_put;
}
}
Expand All @@ -367,17 +357,14 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_DEVICE:
break;
default:
ret = -EPERM;
goto pm_put;
}
}

cdns3_role_stop(cdns);
ret = cdns3_role_start(cdns, role);
if (ret) {
if (ret)
dev_err(cdns->dev, "set role %d has failed\n", role);
ret = -EPERM;
}

pm_put:
pm_runtime_put_sync(cdns->dev);
Expand All @@ -402,7 +389,7 @@ static int cdns3_probe(struct platform_device *pdev)
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (ret) {
dev_err(dev, "error setting dma mask: %d\n", ret);
return -ENODEV;
return ret;
}

cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL);
Expand Down
Loading

0 comments on commit e98ba8c

Please sign in to comment.