From: "Heiko Stübner" <heiko@sntech.de>
To: "Ondřej Jirman" <megi@xff.cz>, "Heiko Stuebner" <heiko@sntech.de>,
vkoul@kernel.org, kishon@kernel.org,
linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
quentin.schulz@cherry.de, sebastian.reichel@collabora.com,
"Heiko Stuebner" <heiko.stuebner@cherry.de>
Subject: Re: [PATCH 2/2] phy: rockchip: usbdp: re-init the phy on orientation-change
Date: Wed, 26 Feb 2025 16:53:45 +0100 [thread overview]
Message-ID: <1878927.BzM5BlMlMQ@diego> (raw)
In-Reply-To: <7q5yn466xd7emebhjze4ixkswgyxjjjt5rwvyww2hwbts6bamd@i5vwvegy2os6>
Hey Ondřej,
Am Mittwoch, 26. Februar 2025, 15:46:11 MEZ schrieb Ondřej Jirman:
> On Tue, Feb 25, 2025 at 07:45:19PM +0100, Heiko Stuebner wrote:
> > From: Heiko Stuebner <heiko.stuebner@cherry.de>
> >
> > Until now the usbdp in the orientation-handler set the new lane setup in
> > its internal state variables and adapted the sbu gpios as needed.
> > It never actually updated the phy itself though, but relied on the
> > controlling usb-controller to disable and re-enable the phy.
> >
> > And while on the vendor-kernel, I could see that on every unplug the dwc3
> > did go to its suspend and woke up on the next device plug-in event,
> > thus toggling the phy as needed, this does not happen in all cases and we
> > should not rely on that behaviour.
>
> On RK3399 there's a similar issue with the equivalent type-c PHY driver.
> The TRM (part 2) states that:
>
> 4.6.1 Some Special Settings before Initialization
>
> - Set USB3.0 OTG controller AXI master setting.
> - Clear USB2.0 only mode setting (bit 3 of register GRF_USB3PHY0/1_CON0 in Chapter GRF)
> - USB3.0 OTG controller should be hold in reset during the initialization of the corresponding
> TypeC PHY until TypeC PHY is ready for USB operation.
> - Set PHYIF to 1 to use 16-bit UTMI+ interface (see register GUSB2PHYCFG0)
> - Clear ENBLSLPM to 0 to disable sleep and l1 suspend (see register GUSB2PHYCFG0)
> ...
>
> The PHY for Superspeed signals is expected to be set up while the USB
> controller is held in reset, which makes sense HW wise, and it's what downstream
> kernel efectivelly does, via its RPM based hack.
>
> RK3588 TRM doesn't have very detailed notes on this, but I expect it will be
> similar.
>
> So reconfiguring the phy here, while it's actively linked to the USB controller
> without the controller driver driving the process so it reliably happens while
> it's in reset, or at least so that USB controller reset happens afterwards, may
> not be correct way to approach this.
the function here, is using infrastructure from the type-c framework.
The function in question tcpm_mux_set(), which then ends up in the
usbdp_phy only gets called from tcpm_reset_port() .
Which I think will do the right already - judging by its name ;-) .
[and also by the fact that the referenced qcom phy behaves similarly
when talking to the type-c framework]
For the rk3399 I would think converting the old typec-phy-driver over to
use the actual kernel type-c framework, might just magically solve the
issue you have on it.
Rockchip actually has converted the rk3399 typec-phy to use the type-c
framework in their vendor kernel.
Heiko
next prev parent reply other threads:[~2025-02-26 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 18:45 [PATCH 0/2] phy: rockchip: usbdp: improve typec orientation handling Heiko Stuebner
2025-02-25 18:45 ` [PATCH 1/2] phy: rockchip: usbdp: move type-orientation-switch further down Heiko Stuebner
2025-02-25 22:16 ` Christophe JAILLET
2025-02-25 22:22 ` Heiko Stübner
2025-02-25 18:45 ` [PATCH 2/2] phy: rockchip: usbdp: re-init the phy on orientation-change Heiko Stuebner
2025-02-25 22:07 ` Heiko Stübner
2025-02-26 14:46 ` Ondřej Jirman
2025-02-26 15:53 ` Heiko Stübner [this message]
2025-02-26 17:03 ` Ondřej Jirman
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=1878927.BzM5BlMlMQ@diego \
--to=heiko@sntech.de \
--cc=heiko.stuebner@cherry.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=megi@xff.cz \
--cc=quentin.schulz@cherry.de \
--cc=sebastian.reichel@collabora.com \
--cc=vkoul@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).