From fbeda7b157701d6a0764cd78b9cf9ea2e2aa73b8 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Feb 14 2024 11:50:16 +0000 Subject: usb: typec: tcpci: clear the fault status bit (git-fixes). --- diff --git a/patches.suse/usb-typec-tcpci-clear-the-fault-status-bit.patch b/patches.suse/usb-typec-tcpci-clear-the-fault-status-bit.patch new file mode 100644 index 0000000..262a4b7 --- /dev/null +++ b/patches.suse/usb-typec-tcpci-clear-the-fault-status-bit.patch @@ -0,0 +1,58 @@ +From 23e60c8daf5ec2ab1b731310761b668745fcf6ed Mon Sep 17 00:00:00 2001 +From: Marco Felsch +Date: Wed, 16 Aug 2023 14:25:02 -0300 +Subject: [PATCH] usb: typec: tcpci: clear the fault status bit +Git-commit: 23e60c8daf5ec2ab1b731310761b668745fcf6ed +References: git-fixes +Patch-mainline: v6.6-rc1 + +According the "USB Type-C Port Controller Interface Specification v2.0" +the TCPC sets the fault status register bit-7 +(AllRegistersResetToDefault) once the registers have been reset to +their default values. + +This triggers an alert(-irq) on PTN5110 devices albeit we do mask the +fault-irq, which may cause a kernel hang. Fix this generically by writing +a one to the corresponding bit-7. + +Cc: stable@vger.kernel.org +Fixes: 74e656d6b055 ("staging: typec: Type-C Port Controller Interface driver (tcpci)") +Reported-by: "Angus Ainslie (Purism)" +Closes: https://lore.kernel.org/all/20190508002749.14816-2-angus@akkea.ca/ +Reported-by: Christian Bach +Closes: https://lore.kernel.org/regressions/ZR0P278MB07737E5F1D48632897D51AC3EB329@ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM/t/ +Signed-off-by: Marco Felsch +Signed-off-by: Fabio Estevam +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20230816172502.1155079-1-festevam@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Oliver Neukum + +--- + drivers/usb/typec/tcpm/tcpci.c | 4 ++++ + drivers/usb/typec/tcpm/tcpci.h | 1 + + 2 files changed, 5 insertions(+) + +--- a/drivers/usb/typec/tcpm/tcpci.c ++++ b/drivers/usb/typec/tcpm/tcpci.c +@@ -376,6 +376,10 @@ static int tcpci_init(struct tcpc_dev *t + if (time_after(jiffies, timeout)) + return -ETIMEDOUT; + ++ ret = tcpci_write16(tcpci, TCPC_FAULT_STATUS, TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT); ++ if (ret < 0) ++ return ret; ++ + /* Handle vendor init */ + if (tcpci->data->init) { + ret = tcpci->data->init(tcpci, tcpci->data); +--- a/drivers/usb/typec/tcpm/tcpci.h ++++ b/drivers/usb/typec/tcpm/tcpci.h +@@ -80,6 +80,7 @@ + #define TCPC_POWER_STATUS_VBUS_PRES BIT(2) + + #define TCPC_FAULT_STATUS 0x1f ++#define TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT BIT(7) + + #define TCPC_COMMAND 0x23 + #define TCPC_CMD_WAKE_I2C 0x11 diff --git a/series.conf b/series.conf index cd6964d..f959dd4 100644 --- a/series.conf +++ b/series.conf @@ -64688,6 +64688,7 @@ patches.suse/NFSv4-pnfs-minor-fix-for-cleanup-path-in-nfs4_get_de.patch patches.suse/nfs-blocklayout-Use-the-passed-in-gfp-flags.patch patches.suse/NFS-Guard-against-READDIR-loop-when-entry-names-exce.patch + patches.suse/usb-typec-tcpci-clear-the-fault-status-bit.patch patches.suse/USB-serial-option-add-Quectel-EM05G-variant-0x030e.patch patches.suse/USB-serial-option-add-FOXCONN-T99W368-T99W373-produc.patch patches.suse/x86-speculation-Mark-all-Skylake-CPUs-as-vulnerable-to-GDS.patch