Skip to content

Commit 356590c

Browse files
prabhakarladvinodkoul
authored andcommitted
phy: renesas: rcar-gen3-usb2: Fix ID check logic with VBUS valid
The existing ID detection logic returned false when both IDDIG and VBUSVALID were set, which caused incorrect role determination in some cases. The condition: !(device && !vbus_valid) did not properly reflect the intended relationship between IDDIG and VBUSVALID signals. Update the logic to: return vbus_valid ? device : !device; This ensures that when VBUS is valid, the role follows the IDDIG value, and when VBUS is not valid, the role is inverted, matching the expected OTG behavior. Fixes: b725741 ("phy: renesas: rcar-gen3-usb2: Add support for RZ/T2H SoC") Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20250821155957.1088337-1-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3d13e37 commit 356590c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/phy/renesas/phy-rcar-gen3-usb2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
302302
device = !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
303303
vbus_valid = !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_VBUSVALID);
304304

305-
return !(device && !vbus_valid);
305+
return vbus_valid ? device : !device;
306306
}
307307

308308
if (!ch->uses_otg_pins)

0 commit comments

Comments
 (0)