2020-04-10 02:47:05 +00:00
|
|
|
From 504c440dd9c391ed97299a9d4b2e41b3ac3b6211 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Peter Chen <peter.chen@nxp.com>
|
|
|
|
Date: Mon, 28 Jan 2019 15:15:11 +0800
|
|
|
|
Subject: [PATCH] usb: dwc3: add otg properties update
|
|
|
|
|
|
|
|
During the USB certification CV9 test, if we report OTG descriptor
|
|
|
|
to test suite, it will require doing OTG test, but in fact, it does
|
|
|
|
not support OTG-compliance in dwc3 driver.
|
|
|
|
|
|
|
|
Signed-off-by: Peter Chen <peter.chen@nxp.com>
|
|
|
|
---
|
|
|
|
drivers/usb/dwc3/core.c | 11 +++++++++++
|
|
|
|
drivers/usb/dwc3/core.h | 2 ++
|
|
|
|
drivers/usb/dwc3/gadget.c | 4 ++++
|
|
|
|
3 files changed, 17 insertions(+)
|
|
|
|
|
|
|
|
--- a/drivers/usb/dwc3/core.c
|
|
|
|
+++ b/drivers/usb/dwc3/core.c
|
kernel: bump 5.4 to 5.4.73
Removed upstreamed patches:
generic/pending-5.4
445-mtd-spinand-gigadevice-Only-one-dummy-byte-in-QUA.patch
446-mtd-spinand-gigadevice-Add-QE-Bit.patch
pistachio/patches-5.4
150-pwm-img-Fix-null-pointer-access-in-probe.patch
Manually rebased:
layerscape/patches-5.4
801-audio-0011-Revert-ASoC-fsl_sai-add-of_match-data.patch
801-audio-0039-MLK-16224-6-ASoC-fsl_sai-fix-DSD-suspend-resume.patch
801-audio-0073-MLK-21957-3-ASoC-fsl_sai-add-bitcount-and-timestamp-.patch
820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch
All modifications made by update_kernel.sh
Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711,
mvebu (mamba, rango), x86_64, ramips/mt7621
Run-tested: ipq806x/R7800, mvebu (mamba, rango), x86_64, ramips (RT-AC57U)
No dmesg regressions, everything functional
Signed-off-by: John Audia <graysky@archlinux.us>
[alter 820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-31 11:35:12 +00:00
|
|
|
@@ -1269,6 +1269,17 @@ static void dwc3_get_properties(struct d
|
2020-04-10 02:47:05 +00:00
|
|
|
|
|
|
|
dwc->maximum_speed = usb_get_maximum_speed(dev);
|
|
|
|
dwc->dr_mode = usb_get_dr_mode(dev);
|
|
|
|
+ if (dwc->dr_mode == USB_DR_MODE_OTG) {
|
|
|
|
+ dwc->otg_caps.otg_rev = 0x0300;
|
|
|
|
+ dwc->otg_caps.hnp_support = true;
|
|
|
|
+ dwc->otg_caps.srp_support = true;
|
|
|
|
+ dwc->otg_caps.adp_support = true;
|
|
|
|
+
|
|
|
|
+ /* Update otg capabilities by DT properties */
|
|
|
|
+ of_usb_update_otg_caps(dev->of_node,
|
|
|
|
+ &dwc->otg_caps);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
dwc->hsphy_mode = of_usb_get_phy_mode(dev->of_node);
|
|
|
|
|
|
|
|
dwc->sysdev_is_parent = device_property_read_bool(dev,
|
|
|
|
--- a/drivers/usb/dwc3/core.h
|
|
|
|
+++ b/drivers/usb/dwc3/core.h
|
2021-01-09 14:10:40 +00:00
|
|
|
@@ -955,6 +955,7 @@ struct dwc3_scratchpad_array {
|
2020-04-10 02:47:05 +00:00
|
|
|
* @nr_scratch: number of scratch buffers
|
|
|
|
* @u1u2: only used on revisions <1.83a for workaround
|
|
|
|
* @maximum_speed: maximum speed requested (mainly for testing purposes)
|
|
|
|
+ * @otg_caps: the OTG capabilities from hardware point
|
|
|
|
* @revision: revision register contents
|
|
|
|
* @version_type: VERSIONTYPE register contents, a sub release of a revision
|
|
|
|
* @dr_mode: requested mode of operation
|
2021-01-09 14:10:40 +00:00
|
|
|
@@ -1111,6 +1112,7 @@ struct dwc3 {
|
2020-04-10 02:47:05 +00:00
|
|
|
u32 nr_scratch;
|
|
|
|
u32 u1u2;
|
|
|
|
u32 maximum_speed;
|
|
|
|
+ struct usb_otg_caps otg_caps;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All 3.1 IP version constants are greater than the 3.0 IP
|
|
|
|
--- a/drivers/usb/dwc3/gadget.c
|
|
|
|
+++ b/drivers/usb/dwc3/gadget.c
|
2022-05-10 18:34:09 +00:00
|
|
|
@@ -3699,6 +3699,10 @@ int dwc3_gadget_init(struct dwc3 *dwc)
|
2020-04-10 02:47:05 +00:00
|
|
|
dwc->gadget.sg_supported = true;
|
|
|
|
dwc->gadget.name = "dwc3-gadget";
|
|
|
|
dwc->gadget.lpm_capable = true;
|
|
|
|
+ dwc->gadget.is_otg = (dwc->dr_mode == USB_DR_MODE_OTG) &&
|
|
|
|
+ (dwc->otg_caps.hnp_support ||
|
|
|
|
+ dwc->otg_caps.srp_support ||
|
|
|
|
+ dwc->otg_caps.adp_support);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME We might be setting max_speed to <SUPER, however versions
|