Message ID | 20230217115845.75303-7-jagan@amarulasolutions.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On 2023/2/17 19:58, Jagan Teki wrote: > New Rockchip devices have the usb phy nodes as standalone devices. > These nodes have register nodes with #address_cells = 2, but only > use 32 bit addresses. > > Adjust the driver to check if the returned address is "0", and adjust > the index in that case. > > Derived and adjusted the similar change from linux-next with below > commit <9c19c531dc98> ("phy: phy-rockchip-inno-usb2: support > #address_cells = 2") > > Co-developed-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com> > Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Thanks, - Kever > --- > drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > index b32a498ea7..a01148db22 100644 > --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > @@ -179,12 +179,21 @@ static int rockchip_usb2phy_probe(struct udevice *dev) > if (IS_ERR(priv->reg_base)) > return PTR_ERR(priv->reg_base); > > - ret = ofnode_read_u32(dev_ofnode(dev), "reg", ®); > + ret = ofnode_read_u32_index(dev_ofnode(dev), "reg", 0, ®); > if (ret) { > dev_err(dev, "failed to read reg property (ret = %d)\n", ret); > return ret; > } > > + /* support address_cells=2 */ > + if (reg == 0) { > + if (ofnode_read_u32_index(dev_ofnode(dev), "reg", 1, ®)) { > + dev_err(dev, "%s must have reg[1]\n", > + ofnode_get_name(dev_ofnode(dev))); > + return -EINVAL; > + } > + } > + > phy_cfgs = (const struct rockchip_usb2phy_cfg *) > dev_get_driver_data(dev); > if (!phy_cfgs)
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index b32a498ea7..a01148db22 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -179,12 +179,21 @@ static int rockchip_usb2phy_probe(struct udevice *dev) if (IS_ERR(priv->reg_base)) return PTR_ERR(priv->reg_base); - ret = ofnode_read_u32(dev_ofnode(dev), "reg", ®); + ret = ofnode_read_u32_index(dev_ofnode(dev), "reg", 0, ®); if (ret) { dev_err(dev, "failed to read reg property (ret = %d)\n", ret); return ret; } + /* support address_cells=2 */ + if (reg == 0) { + if (ofnode_read_u32_index(dev_ofnode(dev), "reg", 1, ®)) { + dev_err(dev, "%s must have reg[1]\n", + ofnode_get_name(dev_ofnode(dev))); + return -EINVAL; + } + } + phy_cfgs = (const struct rockchip_usb2phy_cfg *) dev_get_driver_data(dev); if (!phy_cfgs)