From: Alice Guo <[email protected]>

Replace fdtdec_get_addr() with fdtdec_get_addr_size_auto_noparent() to
properly handle device tree address translation with different #address-cells
and #size-cells values.

Add i.MX8ULP platform support in ci_udc_otg_phy_mode() function to
ensure correct PHY base address is used.

Signed-off-by: Alice Guo <[email protected]>
---
 drivers/usb/gadget/ci_udc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 154a3ab7f22..98d6dd99055 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -1213,7 +1213,8 @@ static int ci_udc_phy_setup(struct udevice *dev, struct 
ci_udc_priv_data *priv)
                        return -EINVAL;
        }
 
-       addr = (void __iomem *)fdtdec_get_addr(gd->fdt_blob, priv->phy_off, 
"reg");
+       addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, 
priv->phy_off,
+                                                                 "reg", 0, 
NULL, false);
        if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
                addr = NULL;
 
@@ -1223,7 +1224,8 @@ static int ci_udc_phy_setup(struct udevice *dev, struct 
ci_udc_priv_data *priv)
        if (misc_off < 0)
                return -EINVAL;
 
-       addr = (void __iomem *)fdtdec_get_addr(gd->fdt_blob, misc_off, "reg");
+       addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, 
misc_off,
+                                                                 "reg", 0, 
NULL, false);
        if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -1326,10 +1328,10 @@ static int ci_udc_otg_phy_mode(struct udevice *dev)
        void *__iomem phy_base = (void *__iomem)devfdt_get_addr(&priv->otgdev);
        u32 val;
 
-       if (is_mx6() || is_mx7ulp() || is_imx8()) {
-               phy_base = (void __iomem *)fdtdec_get_addr(gd->fdt_blob,
-                                                          priv->phy_off,
-                                                          "reg");
+       if (is_mx6() || is_mx7ulp() || is_imx8() || is_imx8ulp()) {
+               phy_base = (void __iomem 
*)fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
+                                                                             
priv->phy_off, "reg",
+                                                                             
0, NULL, false);
                if ((fdt_addr_t)phy_base == FDT_ADDR_T_NONE)
                        return -EINVAL;
 

-- 
2.43.0

Reply via email to