All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Marco Felsch <m.felsch@pengutronix.de>,
	andreas@fatal.se, jun.li@nxp.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/4] usb: typec: tcpci: clear the fault status bit
Date: Thu, 4 May 2023 07:08:17 -0700	[thread overview]
Message-ID: <6a894ff0-3232-4ef0-5e26-95471cc33ed9@roeck-us.net> (raw)
In-Reply-To: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-3-3889b1b2050c@pengutronix.de>

On 5/4/23 06:46, Marco Felsch wrote:
> 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 reseted to

cleared ? set ?

> their default values.
> 
> This triggers an alert(-irq) on PTN5110 devices albeit we do mask the
> fault-irq. Fix this gernally by writing a one to the correspondig

generically ?

corresponding

> bit-7.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>   drivers/usb/typec/tcpm/tcpci.c | 5 +++++
>   include/linux/usb/tcpci.h      | 1 +
>   2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 8da23240afbe..15632d023e4c 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -602,6 +602,11 @@ static int tcpci_init(struct tcpc_dev *tcpc)
>   	if (time_after(jiffies, timeout))
>   		return -ETIMEDOUT;
>   
> +	regmap_read(tcpci->regmap, TCPC_FAULT_STATUS, &reg);

Needs error check.

Also, I am not sure if this is the correct place for this code. The alert
status is cleared after vendor initialization. Should the same be done
here ? Also, why not just write the bit unconditionally, similar
to TCPC_ALERT ?

Thanks,
Guenter

> +	if (reg & TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT)
> +		tcpci_write16(tcpci, TCPC_FAULT_STATUS,
> +			      TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT);
> +
>   	/* 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
>   
> 


WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Marco Felsch <m.felsch@pengutronix.de>,
	andreas@fatal.se, jun.li@nxp.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/4] usb: typec: tcpci: clear the fault status bit
Date: Thu, 4 May 2023 07:08:17 -0700	[thread overview]
Message-ID: <6a894ff0-3232-4ef0-5e26-95471cc33ed9@roeck-us.net> (raw)
In-Reply-To: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-3-3889b1b2050c@pengutronix.de>

On 5/4/23 06:46, Marco Felsch wrote:
> 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 reseted to

cleared ? set ?

> their default values.
> 
> This triggers an alert(-irq) on PTN5110 devices albeit we do mask the
> fault-irq. Fix this gernally by writing a one to the correspondig

generically ?

corresponding

> bit-7.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>   drivers/usb/typec/tcpm/tcpci.c | 5 +++++
>   include/linux/usb/tcpci.h      | 1 +
>   2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 8da23240afbe..15632d023e4c 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -602,6 +602,11 @@ static int tcpci_init(struct tcpc_dev *tcpc)
>   	if (time_after(jiffies, timeout))
>   		return -ETIMEDOUT;
>   
> +	regmap_read(tcpci->regmap, TCPC_FAULT_STATUS, &reg);

Needs error check.

Also, I am not sure if this is the correct place for this code. The alert
status is cleared after vendor initialization. Should the same be done
here ? Also, why not just write the bit unconditionally, similar
to TCPC_ALERT ?

Thanks,
Guenter

> +	if (reg & TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT)
> +		tcpci_write16(tcpci, TCPC_FAULT_STATUS,
> +			      TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT);
> +
>   	/* 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
>   
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-05-04 14:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 13:46 [PATCH v2 0/4] Add i.MX8MP-EVK USB Gadget Support Marco Felsch
2023-05-04 13:46 ` Marco Felsch
2023-05-04 13:46 ` [PATCH v2 1/4] dt-bindings: usb: gpio-sbu-mux: add support for ss-data lanes mux Marco Felsch
2023-05-04 13:46   ` Marco Felsch
2023-05-04 14:08   ` Rob Herring
2023-05-04 14:08     ` Rob Herring
2023-05-04 14:29     ` Marco Felsch
2023-05-04 14:29       ` Marco Felsch
2023-05-04 19:47   ` Rob Herring
2023-05-04 19:47     ` Rob Herring
2023-05-04 13:46 ` [PATCH v2 2/4] usb: typec: mux: gpio-sbu-mux: add support for ss data lane muxing Marco Felsch
2023-05-04 13:46   ` Marco Felsch
2023-05-04 15:46   ` kernel test robot
2023-05-04 15:46     ` kernel test robot
2023-05-04 13:46 ` [PATCH v2 3/4] usb: typec: tcpci: clear the fault status bit Marco Felsch
2023-05-04 13:46   ` Marco Felsch
2023-05-04 14:08   ` Guenter Roeck [this message]
2023-05-04 14:08     ` Guenter Roeck
2023-05-04 14:27     ` Marco Felsch
2023-05-04 14:27       ` Marco Felsch
2023-05-04 15:27       ` Guenter Roeck
2023-05-04 15:27         ` Guenter Roeck
2023-05-04 16:52         ` Marco Felsch
2023-05-04 16:52           ` Marco Felsch
2023-08-16 16:29       ` Fabio Estevam
2023-08-16 16:29         ` Fabio Estevam
2023-08-17  8:00         ` Marco Felsch
2023-08-17  8:00           ` Marco Felsch
2023-05-04 13:46 ` [PATCH v2 4/4] arm64: dts: imx8mp-evk: add dual-role usb port1 support Marco Felsch
2023-05-04 13:46   ` Marco Felsch
2023-05-14 13:21 ` [PATCH v2 0/4] Add i.MX8MP-EVK USB Gadget Support Shawn Guo
2023-05-15  3:48   ` Greg Kroah-Hartman

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=6a894ff0-3232-4ef0-5e26-95471cc33ed9@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=andersson@kernel.org \
    --cc=andreas@fatal.se \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jun.li@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.