Skip to contentSkip to conversation

remoteproc: xlnx: fix sram property parsing

PATCH In review Tanmay Shah 3 participants 3 messages Feb 4 – Feb 6 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: xlnx: fix sram property parsing

From: Tim Michals <[email protected]>

As per sram bindings, "sram" property can be list of phandles. When more than one sram phandles are listed, driver can't parse second phandle's address correctly. Because, phandle index is passed to the API instead of offset of address from reg property which is always 0 as per sram.yaml bindings. Fix it by passing 0 to the API instead of sram phandle index.

Fixes 77fcdf51b8ca ("remoteproc: xlnx: Add sram support")
---
 drivers/remoteproc/xlnx_r5_remoteproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/xlnx_r5_remoteproc.c +1 -1
index bd619a6c42aa..970a9ef97945 100644
@@ -1005,7 +1005,7 @@ static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core)
 		}
 
 		/* Get SRAM device address */
-		ret = of_property_read_reg(sram_np, i, &abs_addr, &size);
+		ret = of_property_read_reg(sram_np, 0, &abs_addr, &size);
 		if (ret) {
 			dev_err(dev, "failed to get reg property\n");
 			goto fail_sram_get;

base-commit: 85ab651885e1b542ee0bb9ec4642ef0b11716997

Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 22 lines · Tanmay Shah

From: Tim Michals <[email protected]>

As per sram bindings, "sram" property can be list of phandles. When more than one sram phandles are listed, driver can't parse second phandle's address correctly. Because, phandle index is passed to the API instead of offset of address from reg property which is always 0 as per sram.yaml bindings. Fix it by passing 0 to the API instead of sram phandle index.

Fixes 77fcdf51b8ca ("remoteproc: xlnx: Add sram support")
---
 drivers/remoteproc/xlnx_r5_remoteproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/xlnx_r5_remoteproc.c +0 -0
index bd619a6c42aa..970a9ef97945 100644

drivers/remoteproc/xlnx_r5_remoteproc.c static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core) · line 1008

Quoted 5 lines
drivers/remoteproc/xlnx_r5_remoteproc.c +1 -1
@@ -1005,7 +1005,7 @@ static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core)
 		}
 
 		/* Get SRAM device address */
-		ret = of_property_read_reg(sram_np, i, &abs_addr, &size);
+		ret = of_property_read_reg(sram_np, 0, &abs_addr, &size);

I'll pick this up in two weeks when 6.20-rc1 comes out.

On a separate note, it would help if an example that includes an "sram" was part of the xlnx_r5 bindings.

Thanks,
Mathieu

Quoted 9 lines
drivers/remoteproc/xlnx_r5_remoteproc.c +0 -0
 		if (ret) {
 			dev_err(dev, "failed to get reg property\n");
 			goto fail_sram_get;

base-commit: 85ab651885e1b542ee0bb9ec4642ef0b11716997

Signature · 1 line
2.34.1
#2 lore raw
Quoted 25 lines · Mathieu Poirier
Quoted 24 lines · Tanmay Shah

From: Tim Michals <[email protected]>

As per sram bindings, "sram" property can be list of phandles. When more than one sram phandles are listed, driver can't parse second phandle's address correctly. Because, phandle index is passed to the API instead of offset of address from reg property which is always 0 as per sram.yaml bindings. Fix it by passing 0 to the API instead of sram phandle index.

Fixes 77fcdf51b8ca ("remoteproc: xlnx: Add sram support")
---
 drivers/remoteproc/xlnx_r5_remoteproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/xlnx_r5_remoteproc.c +0 -0
index bd619a6c42aa..970a9ef97945 100644
@@ -1005,7 +1005,7 @@ static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core)
 		}
 
Quoted 9 lines

drivers/remoteproc/xlnx_r5_remoteproc.c static int zynqmp_r5_get_sram_banks(struct zynqmp_r5_core *r5_core) · line 1008

Quoted 3 lines
drivers/remoteproc/xlnx_r5_remoteproc.c +1 -1
 		/* Get SRAM device address */
-		ret = of_property_read_reg(sram_np, i, &abs_addr, &size);
+		ret = of_property_read_reg(sram_np, 0, &abs_addr, &size);

I'll pick this up in two weeks when 6.20-rc1 comes out.

On a separate note, it would help if an example that includes an "sram" was part of the xlnx_r5 bindings.

Thank You for reviews.

Sure, I will send separate patch including sram nodes in the bindings.

Tanmay

Quoted 12 lines

Thanks,
Mathieu

Quoted 9 lines
drivers/remoteproc/xlnx_r5_remoteproc.c +0 -0
 		if (ret) {
 			dev_err(dev, "failed to get reg property\n");
 			goto fail_sram_get;

base-commit: 85ab651885e1b542ee0bb9ec4642ef0b11716997

Signature · 1 line
2.34.1