clk: introduce u-boot,ignore-clk-defaults
PATCH 1/1 clk: introduce u-boot,ignore-clk-defaults
From: Peng Fan <[email protected]>
Current code has a force clk_set_defaults in multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, so clk_set_defaults will fail and cause the clk provider registeration fail.
So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)
doc/device-tree-bindings/device.txt +3 -0
@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. on I2C bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------
drivers/clk/clk-uclass.c +3 -0
@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)if (!dev_has_ofnode (dev))return 0 ; +if (ofnode_get_property (dev_ofnode (dev),"u-boot,ignore-clk-defaults" ,NULL )) +return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Signature · 1 line
2.30.0
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.
Quoted 9 lines
So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)
I wonder if this binding could be made standard, instead of 'u-boot,'?
Quoted 31 lines
doc/device-tree-bindings/device.txt +3
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. on I2C bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c +3
-1@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)if (!dev_has_ofnode (dev))return 0 ; +if (ofnode_get_property (dev_ofnode (dev),"u-boot,ignore-clk-defaults" ,NULL )) +return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly -- 2.30.0
Quoted 19 lines · Simon Glass
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.Quoted 9 lines
So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>I wonder if this binding could be made standard, instead of 'u-boot,'?
Feels like something we should see about, yes.
Signature · 1 line
Tom
Simon,
Quoted 19 lines · Simon Glass
Quoted 8 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.Quoted 9 lines
So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>I wonder if this binding could be made standard, instead of 'u-boot,'?
Sorry, could you explain more? You mean put it in linux device tree in linux kernel repo?
Thanks,
Peng.
Quoted 33 lines
Quoted 33 lines
doc/device-tree-bindings/device.txt +3
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. on I2C bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c +3
-1@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)if (!dev_has_ofnode (dev))return 0 ; +if (ofnode_get_property (dev_ofnode (dev),"u-boot,ignore-clk-defaults" ,NULL )) +return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly -- 2.30.0
Hi Peng,
Quoted 23 lines · Peng Fan (OSS)
Simon,
Quoted 19 lines · Simon Glass
Quoted 17 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)
Quoted 7 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>I wonder if this binding could be made standard, instead of 'u-boot,'?
Sorry, could you explain more? You mean put it in linux device tree in linux kernel repo?
Yes, if you think it would be useful there. Just a suggestion.
Regards,
Simon
Quoted 36 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +3
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. on I2C bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c +0
-0
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage) · line 384
Quoted 9 lines
drivers/clk/clk-uclass.c +3
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)if (!dev_has_ofnode (dev))return 0 ; +if (ofnode_get_property (dev_ofnode (dev),"u-boot,ignore-clk-defaults" ,NULL )) +return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Why not just have the property ignore errors?
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
--Sean
Quoted 47 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0doc/device-tree-bindings/device.txt the acpi,compatible property. · line 28
Quoted 1 line
doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. onI2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
doc/device-tree-bindings/device.txt +3
-0bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode (dev))return 0 ; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 9 lines
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 4 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Regards,
Peng.
Quoted 2 lines
--Sean
Hi Peng, Sean,
Quoted 61 lines · Peng Fan
Quoted 56 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0doc/device-tree-bindings/device.txt the acpi,compatible property. · line 28
Quoted 1 line
doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. onI2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
doc/device-tree-bindings/device.txt +3
-0bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode (dev))return 0 ; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Quoted 1 line
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Yes that is me, indeed. It's just that we should not silently ignore errors. If we know the clock is optional, then the driver that knows that can handle it. But if we start having things quietly fail, debugging becomes a pain.
Regards,
Simon
Quoted 68 lines · Simon Glass
Hi Peng, Sean,
Quoted 65 lines · Peng Fan
Quoted 56 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0doc/device-tree-bindings/device.txt the acpi,compatible property. · line 28
Quoted 1 line
doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. onI2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
doc/device-tree-bindings/device.txt +3
-0bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode (dev))return 0 ; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Quoted 1 line
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 4 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
Quoted 7 lines
Quoted 2 lines
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Yes that is me, indeed. It's just that we should not silently ignore errors. If we know the clock is optional, then the driver that knows that can handle it. But if we start having things quietly fail, debugging becomes a pain.
Can't we have them loudly fail instead?
--Sean
Hi Sean,
Quoted 73 lines · Sean Anderson
Quoted 71 lines · Simon Glass
Hi Peng, Sean,
Quoted 67 lines · Peng Fan
Quoted 56 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0doc/device-tree-bindings/device.txt the acpi,compatible property. · line 28
Quoted 1 line
doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. onI2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
doc/device-tree-bindings/device.txt +3
-0bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode (dev))return 0 ; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Quoted 1 line
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 4 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Quoted 7 lines
Quoted 4 lines
Yes that is me, indeed. It's just that we should not silently ignore errors. If we know the clock is optional, then the driver that knows that can handle it. But if we start having things quietly fail, debugging becomes a pain.
Can't we have them loudly fail instead?
That is how it works today, as I understand it. But some boards want the defaults to be there but not to implement them in U-Boot. This seems fair enough to me. Perhaps we could add something to each node instead, to disable it?
Regards,
Simon
Quoted 1 line
--Sean
Quoted 81 lines · Simon Glass
Hi Sean,
Quoted 78 lines · Sean Anderson
Quoted 75 lines · Simon Glass
Hi Peng, Sean,
Quoted 61 lines · Peng Fan
Quoted 56 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>--- doc/device-tree-bindings/device.txt | 3 +++ drivers/clk/clk-uclass.c | 3 +++ 2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0doc/device-tree-bindings/device.txt the acpi,compatible property. · line 28
Quoted 1 line
doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property. Linux will only load the driver if the device can be detected (e.g. onI2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
doc/device-tree-bindings/device.txt +3
-0bus). Note that this is an out-of-tree Linux feature. +Common device bindings that could be shared listed below: + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property. Example -------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode (dev))return 0 ; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+return 0 ; +/* * To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Quoted 1 line
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Yes that is me, indeed. It's just that we should not silently ignore errors. If we know the clock is optional, then the driver that knows that can handle it. But if we start having things quietly fail, debugging becomes a pain.
Quoted 7 lines
Quoted 2 lines
Can't we have them loudly fail instead?
That is how it works today, as I understand it. But some boards want the defaults to be there but not to implement them in U-Boot. This seems fair enough to me. Perhaps we could add something to each node instead, to disable it?
u-boot,assigned-clock-status = "disabled";
?
--Sean
Quoted 85 lines · Sean Anderson
Quoted 84 lines · Simon Glass
Hi Sean,
Quoted 80 lines · Sean Anderson
Quoted 68 lines · Simon Glass
Hi Peng, Sean,
Quoted 65 lines · Peng Fan
Quoted 56 lines
Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults
Quoted 22 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Current code has a force
clk_set_defaultsin multiple stages, U-Boot reuse the same device tree and Linux Kernel device tree, but we not register all the clks as Linux Kernel, soclk_set_defaultswill fail and cause the clk provider registeration fail.So introduce a new property to ignore the default settings which could be used by any node that wanna ignore default settings.
Signed-off-by Peng Fan <[email protected]>---
doc/device-tree-bindings/device.txt| 3 +++
drivers/clk/clk-uclass.c | 3 +++2 files changed, 6 insertions(+)doc/device-tree-bindings/device.txt +0
-0@@ -28,6 +28,9 @@ the acpi,compatible property.Quoted 1 line
Linux will only load the driver if the device can be detected (e.g. on
I2C
drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum
Quoted 13 lines
bus). Note that this is an out-of-tree Linux feature.
+Common device bindings that could be shared listed below:
+ - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents + and assigned-clock-rates for a device that has the property.Example
-------drivers/clk/clk-uclass.c index renamed from drivers/clk/clk-uclass.c +0
-0
493018b33e..6bf3179e7b100644drivers/clk/clk-uclass.c +0
-0@@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum
clk_defaults_stagestage)drivers/clk/clk-uclass.c int clk_set_defaults(struct udevice *dev, enum · line 379
Quoted 4 lines
drivers/clk/clk-uclass.c +1
-0if (!dev_has_ofnode(dev)) return 0; + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults",NULL))
Quoted 7 lines
drivers/clk/clk-uclass.c +2
-0+ return 0; + /** To avoid setting defaults twice, don't set them before relocation. * However, still set them for SPL. And still set them if explicitly
Quoted 1 line
Why not just have the property ignore errors?
I think the force err return was done by Simon?
Quoted 4 lines
In the long term, it may be better to standardize that e.g. ENOENT means that the clock doesn't exist. That way we can skip setting the defaults. ENOSYS should probably be treated the same way (warn, but don't fail).
Quoted 7 lines
Quoted 2 lines
I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. For i.MX, I not expect force error.
Yes that is me, indeed. It's just that we should not silently ignore errors. If we know the clock is optional, then the driver that knows that can handle it. But if we start having things quietly fail, debugging becomes a pain.
Can't we have them loudly fail instead?
Quoted 6 lines
Quoted 4 lines
That is how it works today, as I understand it. But some boards want the defaults to be there but not to implement them in U-Boot. This seems fair enough to me. Perhaps we could add something to each node instead, to disable it?
u-boot,assigned-clock-status = "disabled";
Actually, I think that was Peng's idea in the first place :)
--Sean