summaryrefslogtreecommitdiff
path: root/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
diff options
context:
space:
mode:
authorPeter Geis <pgwipeout@gmail.com>2021-12-16 00:02:48 +0300
committerVinod Koul <vkoul@kernel.org>2021-12-23 14:24:48 +0300
commite6915e1acca57bc4fdb61dccd5cc2e49f72ef743 (patch)
tree654234540fe5f612503167eb375d85497b615027 /drivers/phy/rockchip/phy-rockchip-inno-usb2.c
parent9c19c531dc98d7ba49b44802a607042e763ebe21 (diff)
downloadlinux-e6915e1acca57bc4fdb61dccd5cc2e49f72ef743.tar.xz
phy: phy-rockchip-inno-usb2: support standalone phy nodes
New Rockchip devices have the usb2 phy devices as standalone nodes instead of children of the grf node. Allow the driver to find the grf node from a phandle. Signed-off-by: Peter Geis <pgwipeout@gmail.com> Tested-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.kernel.org/r/20211215210252.120923-5-pgwipeout@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy/rockchip/phy-rockchip-inno-usb2.c')
-rw-r--r--drivers/phy/rockchip/phy-rockchip-inno-usb2.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index fac390e1f8de..1cdd9ae0a230 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1073,12 +1073,19 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
return -EINVAL;
}
- if (!dev->parent || !dev->parent->of_node)
- return -EINVAL;
+ if (!dev->parent || !dev->parent->of_node) {
+ rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
+ if (IS_ERR(rphy->grf)) {
+ dev_err(dev, "failed to locate usbgrf\n");
+ return PTR_ERR(rphy->grf);
+ }
+ }
- rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
- if (IS_ERR(rphy->grf))
- return PTR_ERR(rphy->grf);
+ else {
+ rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
+ if (IS_ERR(rphy->grf))
+ return PTR_ERR(rphy->grf);
+ }
if (of_device_is_compatible(np, "rockchip,rv1108-usb2phy")) {
rphy->usbgrf =