diff --git a/include/sbi_utils/regmap/fdt_regmap.h b/include/sbi_utils/regmap/fdt_regmap.h index 86e72442..de946f27 100644 --- a/include/sbi_utils/regmap/fdt_regmap.h +++ b/include/sbi_utils/regmap/fdt_regmap.h @@ -17,7 +17,7 @@ struct fdt_phandle_args; /** FDT based regmap driver */ struct fdt_regmap { const struct fdt_match *match_table; - int (*init)(const void *fdt, int nodeoff, u32 phandle, + int (*init)(const void *fdt, int nodeoff, const struct fdt_match *match); }; diff --git a/lib/utils/regmap/fdt_regmap.c b/lib/utils/regmap/fdt_regmap.c index f02d2f07..933938fb 100644 --- a/lib/utils/regmap/fdt_regmap.c +++ b/lib/utils/regmap/fdt_regmap.c @@ -16,7 +16,7 @@ extern struct fdt_regmap *fdt_regmap_drivers[]; extern unsigned long fdt_regmap_drivers_size; -static int fdt_regmap_init(const void *fdt, int nodeoff, u32 phandle) +static int fdt_regmap_init(const void *fdt, int nodeoff) { int pos, rc; struct fdt_regmap *drv; @@ -27,7 +27,7 @@ static int fdt_regmap_init(const void *fdt, int nodeoff, u32 phandle) drv = fdt_regmap_drivers[pos]; match = fdt_match_node(fdt, nodeoff, drv->match_table); if (match && drv->init) { - rc = drv->init(fdt, nodeoff, phandle, match); + rc = drv->init(fdt, nodeoff, match); if (rc == SBI_ENODEV) continue; if (rc) @@ -39,20 +39,20 @@ static int fdt_regmap_init(const void *fdt, int nodeoff, u32 phandle) return SBI_ENOSYS; } -static int fdt_regmap_find(const void *fdt, int nodeoff, u32 phandle, +static int fdt_regmap_find(const void *fdt, int nodeoff, struct regmap **out_rmap) { int rc; - struct regmap *rmap = regmap_find(phandle); + struct regmap *rmap = regmap_find(nodeoff); if (!rmap) { /* Regmap not found so initialize matching driver */ - rc = fdt_regmap_init(fdt, nodeoff, phandle); + rc = fdt_regmap_init(fdt, nodeoff); if (rc) return rc; /* Try to find regmap again */ - rmap = regmap_find(phandle); + rmap = regmap_find(nodeoff); if (!rmap) return SBI_ENOSYS; } @@ -75,7 +75,7 @@ int fdt_regmap_get_by_phandle(const void *fdt, u32 phandle, if (pnodeoff < 0) return pnodeoff; - return fdt_regmap_find(fdt, pnodeoff, phandle, out_rmap); + return fdt_regmap_find(fdt, pnodeoff, out_rmap); } int fdt_regmap_get(const void *fdt, int nodeoff, struct regmap **out_rmap) diff --git a/lib/utils/regmap/fdt_regmap_syscon.c b/lib/utils/regmap/fdt_regmap_syscon.c index a95f2515..ba559086 100644 --- a/lib/utils/regmap/fdt_regmap_syscon.c +++ b/lib/utils/regmap/fdt_regmap_syscon.c @@ -159,7 +159,7 @@ static int regmap_syscon_write_be32(struct regmap *rmap, unsigned int reg, return 0; } -static int regmap_syscon_init(const void *fdt, int nodeoff, u32 phandle, +static int regmap_syscon_init(const void *fdt, int nodeoff, const struct fdt_match *match) { struct syscon_regmap *srm; @@ -188,7 +188,7 @@ static int regmap_syscon_init(const void *fdt, int nodeoff, u32 phandle, goto fail_free_syscon; srm->addr = addr; - srm->rmap.id = phandle; + srm->rmap.id = nodeoff; srm->rmap.reg_shift = 0; srm->rmap.reg_stride = srm->reg_io_width * 8; srm->rmap.reg_base = 0;