Skip to contentSkip to conversation

clk-conf.h: Add missing re-inclusion protection

PATCH In review Sascha Hauer 2 participants 6 messages Feb 13, 2020 – Apr 15, 2020

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

PATCH 1/3 clk-conf.h: Add missing re-inclusion protection

---
 include/linux/clk/clk-conf.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/linux/clk/clk-conf.h +5 -2
index 8f4382e6c6..ac6cfdf711 100644
@@ -6,12 +6,15 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
-#if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER)
+#ifndef __CLK_CONF_H
+#define __CLK_CONF_H
 
 #include <linux/types.h>
 
+#if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER)
+
 struct device_node;
 int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
 
 #endif
+#endif /* __CLK_CONF_H */
Signature · 7 lines
2.25.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/3 clk-conf.h: Add static inline wrapper for of_clk_set_defaults()

Will be needed once we call of_clk_set_defaults() from the driver core.

---
 include/linux/clk/clk-conf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/clk/clk-conf.h +8 -0
index ac6cfdf711..8da0f99d66 100644
@@ -16,5 +16,13 @@
 struct device_node;
 int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
 
+#else
+
+static inline int of_clk_set_defaults(struct device_node *node,
+				      bool clk_supplier)
+{
+	return 0;
+}
+
 #endif
 #endif /* __CLK_CONF_H */
Signature · 7 lines
2.25.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/3 driver: Call of_clk_set_defaults for each probed device

In reply to Sascha Hauer

So far we only honour the assigned-clocks and assigned-clock-rates device tree properties for the clock controller nodes. With this patch we also honour the properties for each device which is done by Linux as well.

---
 drivers/base/driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/base/driver.c +2 -0
index eec2a2d8a2..247456a2c6 100644
@@ -36,6 +36,7 @@
 #include <linux/err.h>
 #include <complete.h>
 #include <pinctrl.h>
+#include <linux/clk/clk-conf.h>
 
 LIST_HEAD(device_list);
 EXPORT_SYMBOL(device_list);
@@ -86,6 +87,7 @@ int device_probe(struct device_d *dev)
 	int ret;
 
 	pinctrl_select_state_default(dev);
+	of_clk_set_defaults(dev->device_node, false);
 
 	list_add(&dev->active, &active);
 
Signature · 7 lines
2.25.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH 3/3] driver: Call of_clk_set_defaults for each probed device

Hello Sascha,

Quoted 4 lines · Sascha Hauer

So far we only honour the assigned-clocks and assigned-clock-rates device tree properties for the clock controller nodes. With this patch we also honour the properties for each device which is done by Linux as well.

This breaks the default barebox console on the i.MX7 sabresd.
The default UART, uart1, specifies assigned-clock-parents, which is now applied and causes garbage to be output on the serial port.

&uart1 {
       /delete-property/ assigned-clocks;
       /delete-property/ assigned-clock-parents;
};

Fixes it, but I didn't dig deeper than that.

Quoted 27 lines
---
 drivers/base/driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/base/driver.c +2 -0
index eec2a2d8a2..247456a2c6 100644
@@ -36,6 +36,7 @@
 #include <linux/err.h>
 #include <complete.h>
 #include <pinctrl.h>
+#include <linux/clk/clk-conf.h>
 
 LIST_HEAD(device_list);
 EXPORT_SYMBOL(device_list);
@@ -86,6 +87,7 @@ int device_probe(struct device_d *dev)
 	int ret;
 
 	pinctrl_select_state_default(dev);
+	of_clk_set_defaults(dev->device_node, false);
 
 	list_add(&dev->active, &active);
 
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH 3/3] driver: Call of_clk_set_defaults for each probed device

Quoted 12 lines · Ahmad Fatoum

Hello Sascha,

Quoted 4 lines · Sascha Hauer

So far we only honour the assigned-clocks and assigned-clock-rates device tree properties for the clock controller nodes. With this patch we also honour the properties for each device which is done by Linux as well.

This breaks the default barebox console on the i.MX7 sabresd.
The default UART, uart1, specifies assigned-clock-parents, which is now applied and causes garbage to be output on the serial port.

Quoted 6 lines
&uart1 {
       /delete-property/ assigned-clocks;
       /delete-property/ assigned-clock-parents;
};

Fixes it, but I didn't dig deeper than that.

Care to send this as a patch so that we at least have a stop gap solution?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH 3/3] driver: Call of_clk_set_defaults for each probed device

Hello Sascha,

Quoted 18 lines · Sascha Hauer
Quoted 17 lines · Ahmad Fatoum

Hello Sascha,

Quoted 4 lines · Sascha Hauer

So far we only honour the assigned-clocks and assigned-clock-rates device tree properties for the clock controller nodes. With this patch we also honour the properties for each device which is done by Linux as well.

This breaks the default barebox console on the i.MX7 sabresd.
The default UART, uart1, specifies assigned-clock-parents, which is now applied and causes garbage to be output on the serial port.

&uart1 {
       /delete-property/ assigned-clocks;
       /delete-property/ assigned-clock-parents;
};
Quoted 4 lines
Quoted 1 line

Fixes it, but I didn't dig deeper than that.

Care to send this as a patch so that we at least have a stop gap solution?

Sure. Working on it now. Don't tag the new release just yet :D

Quoted 3 lines

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox