public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, m.felsch@pengutronix.de,
	jun.li@nxp.com, xu.yang_2@nxp.com, angus@akkea.ca,
	stable@vger.kernel.org, Christian Bach <christian.bach@scs.ch>,
	Fabio Estevam <festevam@denx.de>
Subject: Re: [PATCH v3] usb: typec: tcpci: clear the fault status bit
Date: Tue, 22 Aug 2023 16:57:04 +0300	[thread overview]
Message-ID: <ZOS+sPN43cpMwd8e@kuha.fi.intel.com> (raw)
In-Reply-To: <20230816172502.1155079-1-festevam@gmail.com>

On Wed, Aug 16, 2023 at 02:25:02PM -0300, Fabio Estevam wrote:
> From: Marco Felsch <m.felsch@pengutronix.de>
> 
> 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) <angus@akkea.ca>
> Closes: https://lore.kernel.org/all/20190508002749.14816-2-angus@akkea.ca/
> Reported-by: Christian Bach <christian.bach@scs.ch>
> Closes: https://lore.kernel.org/regressions/ZR0P278MB07737E5F1D48632897D51AC3EB329@ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM/t/
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Changes since v2:
> - Submitted it as a standalone patch.
> - Explain that it may cause a kernel hang.
> - Fixed typos in the commit log. (Guenter)
> - Check the tcpci_write16() return value. (Guenter)
> - Write to TCPC_FAULT_STATUS unconditionally. (Guenter)
> - Added Fixes, Reported-by and Closes tags.
> - CCed stable
> 
>  drivers/usb/typec/tcpm/tcpci.c | 4 ++++
>  include/linux/usb/tcpci.h      | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index fc708c289a73..0ee3e6e29bb1 100644
> --- 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 *tcpc)
>  	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);
> diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h
> index 85e95a3251d3..83376473ac76 100644
> --- 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.34.1

-- 
heikki

      parent reply	other threads:[~2023-08-22 13:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 17:25 [PATCH v3] usb: typec: tcpci: clear the fault status bit Fabio Estevam
2023-08-16 20:16 ` Guenter Roeck
2023-08-17  7:58 ` Marco Felsch
2023-08-22 13:57 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOS+sPN43cpMwd8e@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=angus@akkea.ca \
    --cc=christian.bach@scs.ch \
    --cc=festevam@denx.de \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=m.felsch@pengutronix.de \
    --cc=stable@vger.kernel.org \
    --cc=xu.yang_2@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox