Skip to contentSkip to conversation

mailbox: stm32_ipcc: Convert to use APIs which support live DT

PATCH New Patrick Delaunay 2 participants 3 messages Sep 9, 2020 – Oct 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailbox: stm32_ipcc: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the driver can support live DT.

---

 drivers/mailbox/stm32-ipcc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mailbox/stm32-ipcc.c +3 -6
index b8bf356b4a..81a4115986 100644
@@ -101,9 +101,8 @@ static int stm32_ipcc_probe(struct udevice *dev)
 {
 	struct stm32_ipcc *ipcc = dev_get_priv(dev);
 	fdt_addr_t addr;
-	const fdt32_t *cell;
 	struct clk clk;
-	int len, ret;
+	int ret;
 
 	debug("%s(dev=%p)\n", __func__, dev);
 
@@ -114,14 +113,12 @@ static int stm32_ipcc_probe(struct udevice *dev)
 	ipcc->reg_base = (void __iomem *)addr;
 
 	/* proc_id */
-	cell = dev_read_prop(dev, "st,proc_id", &len);
-	if (len < sizeof(fdt32_t)) {
+	ret = dev_read_u32_index(dev, "st,proc_id", 1, &ipcc->proc_id);
+	if (ret) {
 		dev_dbg(dev, "Missing st,proc_id\n");
 		return -EINVAL;
 	}
 
-	ipcc->proc_id = fdtdec_get_number(cell, 1);
-
 	if (ipcc->proc_id >= STM32_MAX_PROCS) {
 		dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id);
 		return -EINVAL;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 mailbox: stm32_ipcc: Convert to use APIs which support live DT

Hi Patrick

Quoted 31 lines · Patrick Delaunay

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the driver can support live DT.

---

 drivers/mailbox/stm32-ipcc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mailbox/stm32-ipcc.c +2 -4
index b8bf356b4a..81a4115986 100644
@@ -101,9 +101,8 @@ static int stm32_ipcc_probe(struct udevice *dev)
 {
 	struct stm32_ipcc *ipcc = dev_get_priv(dev);
 	fdt_addr_t addr;
-	const fdt32_t *cell;
 	struct clk clk;
-	int len, ret;
+	int ret;
 
 	debug("%s(dev=%p)\n", __func__, dev);
 
@@ -114,14 +113,12 @@ static int stm32_ipcc_probe(struct udevice *dev)
 	ipcc->reg_base = (void __iomem *)addr;
 
 	/* proc_id */
-	cell = dev_read_prop(dev, "st,proc_id", &len);
-	if (len < sizeof(fdt32_t)) {
+	ret = dev_read_u32_index(dev, "st,proc_id", 1, &ipcc->proc_id);

drivers/mailbox/stm32-ipcc.c static int stm32_ipcc_probe(struct udevice *dev) · line 124

Quoted 10 lines
drivers/mailbox/stm32-ipcc.c +1 -2
+	if (ret) {
 		dev_dbg(dev, "Missing st,proc_id\n");
 		return -EINVAL;
 	}
 
-	ipcc->proc_id = fdtdec_get_number(cell, 1);
-
 	if (ipcc->proc_id >= STM32_MAX_PROCS) {
 		dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id);
 		return -EINVAL;

Thanks

#2 lore raw

PATCH 1/1 mailbox: stm32_ipcc: Convert to use APIs which support live DT

In reply to Patrick Delaunay

Hi,

Quoted 12 lines

From: Patrick DELAUNAY <[email protected]>
Sent: mercredi 9 septembre 2020 17:48

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the driver can support live DT.

---

 drivers/mailbox/stm32-ipcc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Applied to u-boot-stm/next, thanks!

Regards

Patrick