From 23900af85b812db2c433de5756df1fb705e37fd7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 3 Sep 2023 18:58:35 +0200 Subject: [PATCH] 6.5-stable patches added patches: usb-typec-tcpci-clear-the-fault-status-bit.patch --- queue-6.5/series | 1 + ...pec-tcpci-clear-the-fault-status-bit.patch | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 queue-6.5/usb-typec-tcpci-clear-the-fault-status-bit.patch diff --git a/queue-6.5/series b/queue-6.5/series index 8724a3f560a..55f5efec6fa 100644 --- a/queue-6.5/series +++ b/queue-6.5/series @@ -30,3 +30,4 @@ tcpm-avoid-soft-reset-when-partner-does-not-support-get_status.patch dt-bindings-sc16is7xx-add-property-to-change-gpio-function.patch tracing-zero-the-pipe-cpumask-on-alloc-to-avoid-spurious-ebusy.patch nilfs2-fix-warning-in-mark_buffer_dirty-due-to-discarded-buffer-reuse.patch +usb-typec-tcpci-clear-the-fault-status-bit.patch diff --git a/queue-6.5/usb-typec-tcpci-clear-the-fault-status-bit.patch b/queue-6.5/usb-typec-tcpci-clear-the-fault-status-bit.patch new file mode 100644 index 00000000000..6c46fc33968 --- /dev/null +++ b/queue-6.5/usb-typec-tcpci-clear-the-fault-status-bit.patch @@ -0,0 +1,57 @@ +From 23e60c8daf5ec2ab1b731310761b668745fcf6ed Mon Sep 17 00:00:00 2001 +From: Marco Felsch +Date: Wed, 16 Aug 2023 14:25:02 -0300 +Subject: usb: typec: tcpci: clear the fault status bit + +From: Marco Felsch + +commit 23e60c8daf5ec2ab1b731310761b668745fcf6ed upstream. + +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 +--- + drivers/usb/typec/tcpm/tcpci.c | 4 ++++ + include/linux/usb/tcpci.h | 1 + + 2 files changed, 5 insertions(+) + +--- a/drivers/usb/typec/tcpm/tcpci.c ++++ b/drivers/usb/typec/tcpm/tcpci.c +@@ -602,6 +602,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/include/linux/usb/tcpci.h ++++ b/include/linux/usb/tcpci.h +@@ -103,6 +103,7 @@ + #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) + + #define TCPC_FAULT_STATUS 0x1f ++#define TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT BIT(7) + + #define TCPC_ALERT_EXTENDED 0x21 + -- 2.47.3