Skip to contentSkip to conversation

dm: timer: Skip device that does not have a valid ofnode in pre_probe()

PATCH New Bin Meng 3 participants 12 messages Jul 5, 2019 – Jul 21, 2019

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/4 dm: timer: Skip device that does not have a valid ofnode in pre_probe()

It is possible that a timer device has a null ofnode, hence there is no need to further parse DT for the clock rate.

---

 drivers/timer/timer-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/timer/timer-uclass.c +4 -0
index 12ee6eb..97a4c74 100644
@@ -48,6 +48,10 @@ static int timer_pre_probe(struct udevice *dev)
 	int err;
 	ulong ret;
 
+	/* It is possible that a timer device has a null ofnode */
+	if (!dev_of_valid(dev))
+		return 0;
+
 	err = clk_get_by_index(dev, 0, &timer_clk);
 	if (!err) {
 		ret = clk_get_rate(&timer_clk);
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/4 dm: core: Call clk_set_defaults() during probe() only for a valid ofnode

Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.

---

 drivers/core/device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/core/device.c +10 -4
index 0d15e50..37d89bc 100644
@@ -409,10 +409,16 @@ int device_probe(struct udevice *dev)
 			goto fail;
 	}
 
-	/* Process 'assigned-{clocks/clock-parents/clock-rates}' properties */
-	ret = clk_set_defaults(dev);
-	if (ret)
-		goto fail;
+	/* Only handle devices that have a valid ofnode */
+	if (dev_of_valid(dev)) {
+		/*
+		 * Process 'assigned-{clocks/clock-parents/clock-rates}'
+		 * properties
+		 */
+		ret = clk_set_defaults(dev);
+		if (ret)
+			goto fail;
+	}
 
 	if (drv->probe) {
 		ret = drv->probe(dev);
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 dm: core: Call clk_set_defaults() during probe() only for a valid ofnode

Quoted 9 lines · Bin Meng

Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.

---

 drivers/core/device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
#3 lore raw

PATCH 2/4 dm: core: Call clk_set_defaults() during probe() only for a valid ofnode

Quoted 9 lines · Bin Meng

Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.

---

 drivers/core/device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!

author
#4 lore raw

PATCH 3/4 dm: core: Set correct "status" value for a node

In reply to Bin Meng

Per device tree spec, "status" property can have a value of "okay", or "disabled", but not "disable".

---

 drivers/core/ofnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/ofnode.c +1 -1
index c72c6e2..bbea729 100644
@@ -876,5 +876,5 @@ int ofnode_set_enabled(ofnode node, bool value)
 	if (value)
 		return ofnode_write_string(node, "status", "okay");
 	else
-		return ofnode_write_string(node, "status", "disable");
+		return ofnode_write_string(node, "status", "disabled");
 }
Signature · 1 line
2.7.4
author
#7 lore raw

PATCH 4/4 dm: Fix parameter description of dev_read_name()

In reply to Bin Meng

The comments of dev_read_name() wrongly describe "node" as its parameter.

---

 include/dm/read.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/dm/read.h +1 -1
index 60b727c..ddb05d1 100644
@@ -227,7 +227,7 @@ fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname,
 /**
  * dev_read_name() - get the name of a device's node
  *
- * @node: valid node to look up
+ * @dev: Device to read from
  * @return name of node
  */
 const char *dev_read_name(struct udevice *dev);
Signature · 1 line
2.7.4
#11 lore raw

PATCH 1/4 dm: timer: Skip device that does not have a valid ofnode in pre_probe()

Quoted 9 lines · Bin Meng

It is possible that a timer device has a null ofnode, hence there is no need to further parse DT for the clock rate.

---

 drivers/timer/timer-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied to u-boot-dm, thanks!