phy: sun4i-usb: Fix of_xlate() argument check
authorAndre Przywara <andre.przywara@arm.com>
Sun, 11 Jun 2023 23:32:35 +0000 (00:32 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Thu, 20 Jul 2023 23:21:42 +0000 (00:21 +0100)
commit999bc5e660a31a97870e6afb42b0b9cf7f3f780a
treeae1491805b52a3e44724171c59dbed3ca6a25f74
parent0274eb61e1f2a8e053fb028b6c668c67c0b75b9c
phy: sun4i-usb: Fix of_xlate() argument check

In its of_xlate() function, the Allwinner USB PHY driver compares the
args_count variable against the number of implemented USB PHYs, although
this is the *number of arguments* to the DT phandle property. Per the DT
binding for this PHY device, this number is always one, so this check
will always fail if the particular SoC implements exactly one USB PHY.
So far this affected only the V3s (which has USB support disabled), but
the F1C100s also sports one PHY only.

Fix that check to compare args_count against exactly 1, and the args[0]
content (requested PHY number) against the number of implemented PHYs.

This fixes USB operation on the Allwinner V3s and allows to enable USB
on the Allwinner F1C100s SoC.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
drivers/phy/allwinner/phy-sun4i-usb.c