[PATCH 1/3] fpga: intel_pr: Change to use fdt_get_resource()

Jit Loon Lim jit.loon.lim at intel.com
Mon Nov 7 14:33:49 CET 2022


From: Ley Foon Tan <ley.foon.tan at intel.com>

HSD #1508201592: Change from fdtdec_get_addr() to fdt_get_resource().

fdtdec_get_addr() returns a 64-bit value, including base address and
register size. Change to use fdt_get_resource() and get base address
from struct fdt_resource.

Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim at intel.com>
---
 drivers/fpga/intel_pr.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/fpga/intel_pr.c b/drivers/fpga/intel_pr.c
index b8f510fbd7..6637425452 100644
--- a/drivers/fpga/intel_pr.c
+++ b/drivers/fpga/intel_pr.c
@@ -34,6 +34,8 @@ static int intel_get_freeze_br_addr(fdt_addr_t *addr, unsigned int region)
 {
 	int offset;
 	char freeze_br[12];
+	struct fdt_resource r;
+	int ret;
 
 	snprintf(freeze_br, sizeof(freeze_br), "freeze_br%d", region);
 
@@ -49,13 +51,15 @@ static int intel_get_freeze_br_addr(fdt_addr_t *addr, unsigned int region)
 		return -ENODEV;
 	}
 
-	*addr = fdtdec_get_addr(gd->fdt_blob, offset, "reg");
-	if (*addr == FDT_ADDR_T_NONE) {
+	ret = fdt_get_resource(gd->fdt_blob, offset, "reg", 0, &r);
+	if (ret) {
 		printf("%s has no 'reg' property!\n", freeze_br);
-		return -ENXIO;
+		return ret;
 	}
 
-	return 0;
+	*addr = r.start;
+
+	return ret;
 }
 
 static int intel_freeze_br_do_freeze(unsigned int region)
-- 
2.26.2



More information about the U-Boot mailing list