[U-Boot] [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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/timer/timer-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 12ee6eb..97a4c74 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -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);

Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/core/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/core/device.c b/drivers/core/device.c index 0d15e50..37d89bc 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -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);

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/core/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
Without a valid ofnode, it's meaningless to call clk_set_defaults() to process various properties.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/core/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!

Per device tree spec, "status" property can have a value of "okay", or "disabled", but not "disable".
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/core/ofnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index c72c6e2..bbea729 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -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"); }

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
Per device tree spec, "status" property can have a value of "okay", or "disabled", but not "disable".
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/core/ofnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
Per device tree spec, "status" property can have a value of "okay", or "disabled", but not "disable".
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/core/ofnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!

The comments of dev_read_name() wrongly describe "node" as its parameter.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
include/dm/read.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/dm/read.h b/include/dm/read.h index 60b727c..ddb05d1 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -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);

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
The comments of dev_read_name() wrongly describe "node" as its parameter.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
include/dm/read.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
The comments of dev_read_name() wrongly describe "node" as its parameter.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
include/dm/read.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
It is possible that a timer device has a null ofnode, hence there is no need to further parse DT for the clock rate.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/timer/timer-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, 5 Jul 2019 at 10:23, Bin Meng bmeng.cn@gmail.com wrote:
It is possible that a timer device has a null ofnode, hence there is no need to further parse DT for the clock rate.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/timer/timer-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm, thanks!
participants (3)
-
Bin Meng
-
Simon Glass
-
sjg@google.com