From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Johan Hovold <johan+linaro@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Abel Vesa <abel.vesa@linaro.org>,
Stephan Gerhold <stephan.gerhold@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] usb: typec: ps883x: fix registration race
Date: Wed, 26 Feb 2025 11:54:24 +0200 [thread overview]
Message-ID: <Z77k0MzLV3htrIbd@kuha.fi.intel.com> (raw)
In-Reply-To: <20250218152933.22992-2-johan+linaro@kernel.org>
On Tue, Feb 18, 2025 at 04:29:31PM +0100, Johan Hovold wrote:
> Make sure that the retimer is fully setup before registering it to avoid
> having consumers try to access it while it is being reset.
>
> Fixes: 257a087c8b52 ("usb: typec: Add support for Parade PS8830 Type-C Retimer")
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/mux/ps883x.c | 31 ++++++++++++++++---------------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c
> index ef086989231f..274de7abe585 100644
> --- a/drivers/usb/typec/mux/ps883x.c
> +++ b/drivers/usb/typec/mux/ps883x.c
> @@ -346,6 +346,22 @@ static int ps883x_retimer_probe(struct i2c_client *client)
> goto err_vregs_disable;
> }
>
> + /* skip resetting if already configured */
> + if (regmap_test_bits(retimer->regmap, REG_USB_PORT_CONN_STATUS_0,
> + CONN_STATUS_0_CONNECTION_PRESENT) == 1) {
> + gpiod_direction_output(retimer->reset_gpio, 0);
> + } else {
> + gpiod_direction_output(retimer->reset_gpio, 1);
> +
> + /* VDD IO supply enable to reset release delay */
> + usleep_range(4000, 14000);
> +
> + gpiod_set_value(retimer->reset_gpio, 0);
> +
> + /* firmware initialization delay */
> + msleep(60);
> + }
> +
> sw_desc.drvdata = retimer;
> sw_desc.fwnode = dev_fwnode(dev);
> sw_desc.set = ps883x_sw_set;
> @@ -368,21 +384,6 @@ static int ps883x_retimer_probe(struct i2c_client *client)
> goto err_switch_unregister;
> }
>
> - /* skip resetting if already configured */
> - if (regmap_test_bits(retimer->regmap, REG_USB_PORT_CONN_STATUS_0,
> - CONN_STATUS_0_CONNECTION_PRESENT) == 1)
> - return gpiod_direction_output(retimer->reset_gpio, 0);
> -
> - gpiod_direction_output(retimer->reset_gpio, 1);
> -
> - /* VDD IO supply enable to reset release delay */
> - usleep_range(4000, 14000);
> -
> - gpiod_set_value(retimer->reset_gpio, 0);
> -
> - /* firmware initialization delay */
> - msleep(60);
> -
> return 0;
>
> err_switch_unregister:
> --
> 2.45.3
--
heikki
next prev parent reply other threads:[~2025-02-26 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 15:29 [PATCH 0/3] usb: typec: ps883x: follow-up fixes Johan Hovold
2025-02-18 15:29 ` [PATCH 1/3] usb: typec: ps883x: fix registration race Johan Hovold
2025-02-26 9:54 ` Heikki Krogerus [this message]
2025-02-18 15:29 ` [PATCH 2/3] usb: typec: ps883x: fix missing accessibility check Johan Hovold
2025-02-26 9:55 ` Heikki Krogerus
2025-03-02 13:34 ` Jens Glathe
2025-03-03 7:07 ` Johan Hovold
2025-02-18 15:29 ` [PATCH 3/3] usb: typec: ps883x: fix configuration error handling Johan Hovold
2025-02-26 9:56 ` Heikki Krogerus
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=Z77k0MzLV3htrIbd@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=abel.vesa@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan+linaro@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stephan.gerhold@linaro.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