From: Marco Felsch <m.felsch@pengutronix.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: 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>,
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 16:27:08 +0200 [thread overview]
Message-ID: <20230504142708.l4xo4sbl7wzsrbql@pengutronix.de> (raw)
In-Reply-To: <6a894ff0-3232-4ef0-5e26-95471cc33ed9@roeck-us.net>
On 23-05-04, Guenter Roeck wrote:
> 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 ?
Sry. I don't get this.
> > 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 ?
Sure, thanks.
> corresponding
Of course!
> > 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, ®);
>
> Needs error check.
I will add this.
> 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 ?
According the spec the bit must be cleared before the TCPC_ALERT is
cleared. Of course the vendor-init can (re-)trigger the bit, therefore
we should move behind the vendor init and right before the TCPC_ALERT
clear.
> Also, why not just write the bit unconditionally, similar
> to TCPC_ALERT ?
Thought about this too.. I will change it in the v3.
Thanks for the feedback,
Marco
>
> 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
> >
>
>
next prev parent reply other threads:[~2023-05-04 14:27 UTC|newest]
Thread overview: 17+ 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 ` [PATCH v2 1/4] dt-bindings: usb: gpio-sbu-mux: add support for ss-data lanes mux Marco Felsch
2023-05-04 14:08 ` Rob Herring
2023-05-04 14:29 ` Marco Felsch
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 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 14:08 ` Guenter Roeck
2023-05-04 14:27 ` Marco Felsch [this message]
2023-05-04 15:27 ` Guenter Roeck
2023-05-04 16:52 ` Marco Felsch
2023-08-16 16:29 ` Fabio Estevam
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-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=20230504142708.l4xo4sbl7wzsrbql@pengutronix.de \
--to=m.felsch@pengutronix.de \
--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=linux@roeck-us.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).