Update sunxi-5.17 (#3725)
* update sunxi-5.17: tag: orange-pi-5.17-20220424-2152 * Update sunxi-5.17: orange-pi-5.17-20220427-0710
This commit is contained in:
parent
e48e00a612
commit
4a80910d6c
@ -0,0 +1,119 @@
|
||||
From d03d9bce98c524a443bbea0f6c1aeae8200531eb Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megi@xff.cz>
|
||||
Date: Wed, 27 Apr 2022 07:06:10 +0200
|
||||
Subject: [PATCH] usb: musb: sunxi: Avoid enabling host side code on SoCs where
|
||||
it's not used
|
||||
|
||||
For some sunxi SoCs host side code is active but unused, because
|
||||
phy re-routes USB handling to a regular EHCI/OHCI driver.
|
||||
|
||||
When host side code of musb is left initialized it sometimes
|
||||
interferes with suspend to RAM. Disabling the host side code
|
||||
on SoCs that re-route host mode to a regular *HCI hardware
|
||||
block fixes the issue.
|
||||
|
||||
Issue: https://gitlab.com/postmarketOS/pmaports/-/issues/1478
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||||
---
|
||||
drivers/of/base.c | 1 +
|
||||
drivers/usb/musb/musb_core.c | 10 ++++++++++
|
||||
drivers/usb/musb/sunxi.c | 29 ++++++++++++++++++++++-------
|
||||
3 files changed, 33 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/of/base.c b/drivers/of/base.c
|
||||
index e7d92b67cb8a..e7db05f4bbc1 100644
|
||||
--- a/drivers/of/base.c
|
||||
+++ b/drivers/of/base.c
|
||||
@@ -579,6 +579,7 @@ int of_device_compatible_match(struct device_node *device,
|
||||
|
||||
return score;
|
||||
}
|
||||
+EXPORT_SYMBOL(of_device_compatible_match);
|
||||
|
||||
/**
|
||||
* of_machine_is_compatible - Test root of device tree for a given compatible value
|
||||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
|
||||
index f7b1d5993f8c..59584841fbd7 100644
|
||||
--- a/drivers/usb/musb/musb_core.c
|
||||
+++ b/drivers/usb/musb/musb_core.c
|
||||
@@ -979,6 +979,16 @@ static void musb_handle_intr_disconnect(struct musb *musb, u8 devctl)
|
||||
case OTG_STATE_B_IDLE:
|
||||
musb_g_disconnect(musb);
|
||||
break;
|
||||
+ case OTG_STATE_A_WAIT_VRISE:
|
||||
+ /*
|
||||
+ * For sunxi use case, where host side of the musb driver
|
||||
+ * is not used for host mode, we want to ignore
|
||||
+ * OTG_STATE_A_WAIT_VRISE state set in sunxi glue code
|
||||
+ * when transitioning to host mode on disconnect, in
|
||||
+ * order to not confuse the dmesg reader about possible
|
||||
+ * issues.
|
||||
+ */
|
||||
+ break;
|
||||
default:
|
||||
WARNING("unhandled DISCONNECT transition (%s)\n",
|
||||
usb_otg_state_string(musb->xceiv->otg->state));
|
||||
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
|
||||
index 961c858fb349..07672f2eb35e 100644
|
||||
--- a/drivers/usb/musb/sunxi.c
|
||||
+++ b/drivers/usb/musb/sunxi.c
|
||||
@@ -345,12 +345,6 @@ static int sunxi_musb_set_mode(struct musb *musb, u8 mode)
|
||||
if (glue->phy_mode == new_mode)
|
||||
return 0;
|
||||
|
||||
- if (musb->port_mode != MUSB_OTG) {
|
||||
- dev_err(musb->controller->parent,
|
||||
- "Error changing modes is only supported in dual role mode\n");
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
if (musb->port1_status & USB_PORT_STAT_ENABLE)
|
||||
musb_root_disconnect(musb);
|
||||
|
||||
@@ -670,13 +664,21 @@ static struct musb_hdrc_config sunxi_musb_hdrc_config_h3 = {
|
||||
.ram_bits = SUNXI_MUSB_RAM_BITS,
|
||||
};
|
||||
|
||||
+static const char * const sunxi_musb_host_rerouted_phys[] = {
|
||||
+ "allwinner,sun8i-h3-usb-phy",
|
||||
+ "allwinner,sun8i-r40-usb-phy",
|
||||
+ "allwinner,sun8i-v3s-usb-phy",
|
||||
+ "allwinner,sun50i-a64-usb-phy",
|
||||
+ "allwinner,sun50i-h6-usb-phy",
|
||||
+ NULL,
|
||||
+};
|
||||
|
||||
static int sunxi_musb_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct musb_hdrc_platform_data pdata;
|
||||
struct platform_device_info pinfo;
|
||||
struct sunxi_glue *glue;
|
||||
- struct device_node *np = pdev->dev.of_node;
|
||||
+ struct device_node *np = pdev->dev.of_node, *phy_np;
|
||||
int ret;
|
||||
|
||||
if (!np) {
|
||||
@@ -769,6 +771,19 @@ static int sunxi_musb_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(glue->phy);
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Host mode is handled outside of the musb driver on some allwinner
|
||||
+ * SoCs. We don't need musb host side code to be enabled at all.
|
||||
+ * In fact it causes occasional issues with suspend to ram, when
|
||||
+ * the host side code is enabled and unused (due to phy being re-routed
|
||||
+ * to a different *HCI controller).
|
||||
+ */
|
||||
+ phy_np = glue->phy->dev.of_node;
|
||||
+ if (of_device_compatible_match(phy_np, sunxi_musb_host_rerouted_phys)) {
|
||||
+ dev_info(&pdev->dev, "Disabling musb host side code due to re-routed phy\n");
|
||||
+ pdata.mode = MUSB_PERIPHERAL;
|
||||
+ }
|
||||
+
|
||||
glue->usb_phy = usb_phy_generic_register();
|
||||
if (IS_ERR(glue->usb_phy)) {
|
||||
dev_err(&pdev->dev, "Error registering usb-phy %ld\n",
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 374c70d60771f6687342af050424c0dba7384086 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megi@xff.cz>
|
||||
Date: Sun, 24 Apr 2022 21:51:12 +0200
|
||||
Subject: [PATCH] usb: typec: tcpm: Fix NPE in debug code
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||||
---
|
||||
drivers/usb/typec/tcpm/tcpm.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
|
||||
index e3685f577cc0..f6671aba6161 100644
|
||||
--- a/drivers/usb/typec/tcpm/tcpm.c
|
||||
+++ b/drivers/usb/typec/tcpm/tcpm.c
|
||||
@@ -869,13 +869,13 @@ static int tcpm_pd_transmit(struct tcpm_port *port,
|
||||
unsigned long timeout;
|
||||
int ret;
|
||||
|
||||
- if (msg)
|
||||
+ if (msg) {
|
||||
tcpm_log(port, "PD TX, header: %#x", le16_to_cpu(msg->header));
|
||||
- else
|
||||
+ for (ret = 0; ret < pd_header_cnt_le(msg->header); ret++)
|
||||
+ tcpm_log(port, " tx payload[%d]: %#x", ret, le32_to_cpu(msg->payload[ret]));
|
||||
+ } else {
|
||||
tcpm_log(port, "PD TX, type: %#x", type);
|
||||
-
|
||||
- for (ret = 0; ret < pd_header_cnt_le(msg->header); ret++)
|
||||
- tcpm_log(port, " tx payload[%d]: %#x", ret, le32_to_cpu(msg->payload[ret]));
|
||||
+ }
|
||||
|
||||
reinit_completion(&port->tx_complete);
|
||||
ret = port->tcpc->pd_transmit(port->tcpc, type, msg, port->negotiated_rev);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -574,6 +574,10 @@
|
||||
patches.megous/rtw89-change-station-scheduler-setting-for-hardware-TX-mode.patch
|
||||
patches.megous/rtw89-reset-BA-CAM.patch
|
||||
# tag: orange-pi-5.17-20220416-0116
|
||||
patches.megous/usb-typec-tcpm-Fix-NPE-in-debug-code.patch
|
||||
# tag: orange-pi-5.17-20220424-2152
|
||||
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs.patch
|
||||
# tag: orange-pi-5.17-20220427-0710
|
||||
############################################################################
|
||||
#
|
||||
# Armbian patches
|
||||
|
||||
@ -574,3 +574,7 @@
|
||||
patches.megous/rtw89-change-station-scheduler-setting-for-hardware-TX-mode.patch
|
||||
patches.megous/rtw89-reset-BA-CAM.patch
|
||||
# tag: orange-pi-5.17-20220416-0116
|
||||
patches.megous/usb-typec-tcpm-Fix-NPE-in-debug-code.patch
|
||||
# tag: orange-pi-5.17-20220424-2152
|
||||
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs.patch
|
||||
# tag: orange-pi-5.17-20220427-0710
|
||||
|
||||
Loading…
Reference in New Issue
Block a user