From 7efb4a6e09421a8ceaaaff61e28905ddec0c02a5 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 5 Jul 2019 09:23:15 -0700 Subject: 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 Reviewed-by: Simon Glass --- drivers/timer/timer-uclass.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 12ee6eb804..97a4c74851 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); -- cgit v1.2.3 From a1f99e46665855ade49935a813073860c26d2728 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 5 Jul 2019 09:23:16 -0700 Subject: 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. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- drivers/core/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/core/device.c b/drivers/core/device.c index 0d15e5062b..37d89bcd1d 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); -- cgit v1.2.3 From 163512122e9833a58d430230a9a3df44eb7f8058 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 5 Jul 2019 09:23:17 -0700 Subject: dm: core: Set correct "status" value for a node Per device tree spec, "status" property can have a value of "okay", or "disabled", but not "disable". Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 179a6447dc..2ac73af934 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -884,5 +884,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"); } -- cgit v1.2.3 From e497fabb9186bb2f36b4f3ceda4c69bea8e22233 Mon Sep 17 00:00:00 2001 From: Sekhar Nori Date: Thu, 11 Jul 2019 14:30:24 +0530 Subject: clk: initialize clk->data when using default xlate Right now when using clk_of_xlate_default(), clk->data remains un-initialized because clk_get_bulk() does not initialize memory on allocation of clock structure. This can cause problems when data is used to match if two clocks pointers are exactly the same underlying clocks, for example. Fix it by initializing clk->data to 0. Suggested-by: Lokesh Vutla Signed-off-by: Sekhar Nori --- drivers/clk/clk-uclass.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 79b3b0494c..06a8258d5f 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -51,6 +51,8 @@ static int clk_of_xlate_default(struct clk *clk, else clk->id = 0; + clk->data = 0; + return 0; } -- cgit v1.2.3 From 44e02e39a91cd91aae5a28d90259d3a6996010bf Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Sun, 14 Jul 2019 21:11:01 +0200 Subject: dm: device: make power domain calls optional Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled. With gcc v8.2, this change saves 104 bytes. Signed-off-by: Anatolij Gustschin Reviewed-by: Peng Fan --- drivers/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/core/device.c b/drivers/core/device.c index 37d89bcd1d..474c1642ee 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -388,7 +388,8 @@ int device_probe(struct udevice *dev) if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) pinctrl_select_state(dev, "default"); - if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) { + if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent && + device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) { if (!power_domain_get(dev, &pd)) power_domain_on(&pd); } -- cgit v1.2.3