]> www.infradead.org Git - users/jedix/linux-maple.git/commit
phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Wed, 7 May 2025 12:50:28 +0000 (15:50 +0300)
committerVinod Koul <vkoul@kernel.org>
Wed, 14 May 2025 11:25:09 +0000 (12:25 +0100)
commit54c4c58713aaff76c2422ff5750e557ab3b100d7
treecd491f547882f5258e6c4ba532f77dc282475e9e
parent83c178470e0bf690d34c8c08440f2421b82e881c
phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind

It has been observed on the Renesas RZ/G3S SoC that unbinding and binding
the PHY driver leads to role autodetection failures. This issue occurs when
PHY 3 is the first initialized PHY. PHY 3 does not have an interrupt
associated with the USB2_INT_ENABLE register (as
rcar_gen3_int_enable[3] = 0). As a result, rcar_gen3_init_otg() is called
to initialize OTG without enabling PHY interrupts.

To resolve this, add rcar_gen3_is_any_otg_rphy_initialized() and call it in
role_store(), role_show(), and rcar_gen3_init_otg(). At the same time,
rcar_gen3_init_otg() is only called when initialization for a PHY with
interrupt bits is in progress. As a result, the
struct rcar_gen3_phy::otg_initialized is no longer needed.

Fixes: 549b6b55b005 ("phy: renesas: rcar-gen3-usb2: enable/disable independent irqs")
Cc: stable@vger.kernel.org
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250507125032.565017-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/renesas/phy-rcar-gen3-usb2.c