Skip to contentSkip to conversation

ARM: shmobile: Break out and extend clock workaround V2

PATCH New Magnus Damm 2 participants 11 messages Mar 12, 2014 – Mar 13, 2014

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

v2 cover ARM: shmobile: Break out and extend clock workaround V2

ARM: shmobile: Break out and extend clock workaround V2

[PATCH v2 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() [PATCH 02/03] ARM: shmobile: Use shmobile_clk_workaround() on Lager [PATCH 03/03] ARM: shmobile: Use shmobile_clk_workaround() on Koelsch

These patches consolidates the clkdev workaround present in the DT reference version of board code for Lager and Koelsch, and it also extends it to allow static enablement of a selected set of clocks during boot. The latter is needed for USB PCI support patches that have been posted.

---

Changes since V1:
- Reworked dependencies, updated header file path in patch [1/3].

Written against renesas.git tag renesas-devel-v3.14-rc6-20140311

 arch/arm/mach-shmobile/Makefile                  |    2 
 arch/arm/mach-shmobile/board-koelsch-reference.c |   71 ++++++++--------------
 arch/arm/mach-shmobile/board-lager-reference.c   |   65 +++++++-------------
 arch/arm/mach-shmobile/clock.c                   |   29 ++++++++
 arch/arm/mach-shmobile/include/mach/clock.h      |   16 ++++
 5 files changed, 99 insertions(+), 84 deletions(-)
author maintainer
#1 lore raw

PATCH v2 1/3 ARM: shmobile: Introduce shmobile_clk_workaround()

From: Magnus Damm <[email protected]>

Introduce a new clock workaround function used by DT reference code on the mach-shmobile subarchitecture. The new function shmobile_clk_workaround() is used to configure clkdev to allow DT and platform devices to coexist. It is possible for the DT reference board code to also request enabling of the clock in case the driver does not implement clock control.

---

Changes since V1:
- Reworked patch dependency, updated include file path

 arch/arm/mach-shmobile/Makefile             |    2 -
 arch/arm/mach-shmobile/clock.c              |   29 +++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/clock.h |   16 ++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/Makefile +1 -1
@@ -21,8 +21,8 @@ obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.
 obj-$(CONFIG_ARCH_R7S72100)	+= setup-r7s72100.o
 
 # Clock objects
-ifndef CONFIG_COMMON_CLK
 obj-y				+= clock.o
+ifndef CONFIG_COMMON_CLK
 obj-$(CONFIG_ARCH_SH7372)	+= clock-sh7372.o
 obj-$(CONFIG_ARCH_SH73A0)	+= clock-sh73a0.o
 obj-$(CONFIG_ARCH_R8A73A4)	+= clock-r8a73a4.o
arch/arm/mach-shmobile/clock.c +29 -0
@@ -21,6 +21,32 @@
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
+
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <mach/clock.h>
+
+void __init shmobile_clk_workaround(const struct clk_name *clks,
+				    int nr_clks, bool enable)
+{
+	const struct clk_name *clkn;
+	struct clk *clk;
+	unsigned int i;
+
+	for (i = 0; i < nr_clks; ++i) {
+		clkn = clks + i;
+		clk = clk_get(NULL, clkn->clk);
+		if (!IS_ERR(clk)) {
+			clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
+			if (enable)
+				clk_prepare_enable(clk);
+			clk_put(clk);
+		}
+	}
+}
+
+#else /* CONFIG_COMMON_CLK */
 #include <linux/sh_clk.h>
 #include <linux/export.h>
 #include <mach/clock.h>
@@ -58,3 +84,6 @@ void __clk_put(struct clk *clk)
 {
 }
 EXPORT_SYMBOL(__clk_put);
+
+#endif /* CONFIG_COMMON_CLK */
+
arch/arm/mach-shmobile/include/mach/clock.h +16 -0
@@ -1,6 +1,21 @@
 #ifndef CLOCK_H
 #define CLOCK_H
 
+#ifdef CONFIG_COMMON_CLK
+/* temporary clock configuration helper for platform devices */
+
+struct clk_name {
+	const char *clk;
+	const char *con_id;
+	const char *dev_id;
+};
+
+void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
+			     bool enable);
+
+#else /* CONFIG_COMMON_CLK */
+/* legacy clock implementation */
+
 unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
 extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
 
@@ -36,4 +51,5 @@ do {			\
 	(p)->div = d;	\
 } while (0)
 
+#endif /* CONFIG_COMMON_CLK */
 #endif
#2 lore raw

PATCH v2 1/3 ARM: shmobile: Introduce shmobile_clk_workaround()

Quoted 10 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Introduce a new clock workaround function used by DT reference code on the mach-shmobile subarchitecture. The new function shmobile_clk_workaround() is used to configure clkdev to allow DT and platform devices to coexist. It is possible for the DT reference board code to also request enabling of the clock in case the driver does not implement clock control.

Thanks, I have queued this up with Wolfram's Reviewed-by and Tested-by which he supplied for v1.

I have also removed the trailing empty line that this patch adds to clock.c.

Quoted 95 lines

---

Changes since V1:
- Reworked patch dependency, updated include file path

 arch/arm/mach-shmobile/Makefile             |    2 -
 arch/arm/mach-shmobile/clock.c              |   29 +++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/clock.h |   16 ++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/Makefile +1 -1
@@ -21,8 +21,8 @@ obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.
 obj-$(CONFIG_ARCH_R7S72100)	+= setup-r7s72100.o
 
 # Clock objects
-ifndef CONFIG_COMMON_CLK
 obj-y				+= clock.o
+ifndef CONFIG_COMMON_CLK
 obj-$(CONFIG_ARCH_SH7372)	+= clock-sh7372.o
 obj-$(CONFIG_ARCH_SH73A0)	+= clock-sh73a0.o
 obj-$(CONFIG_ARCH_R8A73A4)	+= clock-r8a73a4.o
arch/arm/mach-shmobile/clock.c +29 -0
@@ -21,6 +21,32 @@
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
+
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <mach/clock.h>
+
+void __init shmobile_clk_workaround(const struct clk_name *clks,
+				    int nr_clks, bool enable)
+{
+	const struct clk_name *clkn;
+	struct clk *clk;
+	unsigned int i;
+
+	for (i = 0; i < nr_clks; ++i) {
+		clkn = clks + i;
+		clk = clk_get(NULL, clkn->clk);
+		if (!IS_ERR(clk)) {
+			clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
+			if (enable)
+				clk_prepare_enable(clk);
+			clk_put(clk);
+		}
+	}
+}
+
+#else /* CONFIG_COMMON_CLK */
 #include <linux/sh_clk.h>
 #include <linux/export.h>
 #include <mach/clock.h>
@@ -58,3 +84,6 @@ void __clk_put(struct clk *clk)
 {
 }
 EXPORT_SYMBOL(__clk_put);
+
+#endif /* CONFIG_COMMON_CLK */
+
arch/arm/mach-shmobile/include/mach/clock.h +16 -0
@@ -1,6 +1,21 @@
 #ifndef CLOCK_H
 #define CLOCK_H
 
+#ifdef CONFIG_COMMON_CLK
+/* temporary clock configuration helper for platform devices */
+
+struct clk_name {
+	const char *clk;
+	const char *con_id;
+	const char *dev_id;
+};
+
+void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
+			     bool enable);
+
+#else /* CONFIG_COMMON_CLK */
+/* legacy clock implementation */
+
 unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
 extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
 
@@ -36,4 +51,5 @@ do {			\
 	(p)->div = d;	\
 } while (0)
 
+#endif /* CONFIG_COMMON_CLK */
 #endif
author maintainer
#3 lore raw

PATCH v2 2/3 ARM: shmobile: Use shmobile_clk_workaround() on Lager

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Lager DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-lager-reference.c |   65 +++++++++---------------
 1 file changed, 25 insertions(+), 40 deletions(-)
arch/arm/mach-shmobile/board-lager-reference.c +25 -40
@@ -18,12 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>
@@ -86,46 +85,32 @@ static void __init lager_add_du_device(v
 	platform_device_register_full(&info);
 }
 
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {
+	{ "cmt0", NULL, "sh_cmt.0" },
+	{ "scifa0", NULL, "sh-sci.0" },
+	{ "scifa1", NULL, "sh-sci.1" },
+	{ "scifb0", NULL, "sh-sci.2" },
+	{ "scifb1", NULL, "sh-sci.3" },
+	{ "scifb2", NULL, "sh-sci.4" },
+	{ "scifa2", NULL, "sh-sci.5" },
+	{ "scif0", NULL, "sh-sci.6" },
+	{ "scif1", NULL, "sh-sci.7" },
+	{ "hscif0", NULL, "sh-sci.8" },
+	{ "hscif1", NULL, "sh-sci.9" },
+	{ "du0", "du.0", "rcar-du-r8a7790" },
+	{ "du1", "du.1", "rcar-du-r8a7790" },
+	{ "du2", "du.2", "rcar-du-r8a7790" },
+	{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
+	{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
+};
+
 static void __init lager_add_standard_devices(void)
 {
-	/*
-	 * This is a really crude hack to provide clkdev support to platform
-	 * devices until they get moved to DT.
-	 */
-	static const struct clk_name {
-		const char *clk;
-		const char *con_id;
-		const char *dev_id;
-	} clk_names[] = {
-		{ "cmt0", NULL, "sh_cmt.0" },
-		{ "scifa0", NULL, "sh-sci.0" },
-		{ "scifa1", NULL, "sh-sci.1" },
-		{ "scifb0", NULL, "sh-sci.2" },
-		{ "scifb1", NULL, "sh-sci.3" },
-		{ "scifb2", NULL, "sh-sci.4" },
-		{ "scifa2", NULL, "sh-sci.5" },
-		{ "scif0", NULL, "sh-sci.6" },
-		{ "scif1", NULL, "sh-sci.7" },
-		{ "hscif0", NULL, "sh-sci.8" },
-		{ "hscif1", NULL, "sh-sci.9" },
-		{ "du0", "du.0", "rcar-du-r8a7790" },
-		{ "du1", "du.1", "rcar-du-r8a7790" },
-		{ "du2", "du.2", "rcar-du-r8a7790" },
-		{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
-		{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
-	};
-	struct clk *clk;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
-		clk = clk_get(NULL, clk_names[i].clk);
-		if (!IS_ERR(clk)) {
-			clk_register_clkdev(clk, clk_names[i].con_id,
-					    clk_names[i].dev_id);
-			clk_put(clk);
-		}
-	}
-
+	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
 	r8a7790_add_dt_devices();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
#4 lore raw

PATCH v2 2/3 ARM: shmobile: Use shmobile_clk_workaround() on Lager

Quoted 28 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Lager DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-lager-reference.c |   65 +++++++++---------------
 1 file changed, 25 insertions(+), 40 deletions(-)
arch/arm/mach-shmobile/board-lager-reference.c +1 -2
@@ -18,12 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>

arch/arm/mach-shmobile/board-lager-reference.c static void __init lager_add_du_device(v · line 92

Quoted 8 lines
arch/arm/mach-shmobile/board-lager-reference.c +5 -0
@@ -86,46 +85,32 @@ static void __init lager_add_du_device(v
 	platform_device_register_full(&info);
 }
 
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {

Should this be annotated as __initconst?
Likewise for the Koelsch variant of this patch.

Quoted 63 lines
arch/arm/mach-shmobile/board-lager-reference.c +19 -38
+	{ "cmt0", NULL, "sh_cmt.0" },
+	{ "scifa0", NULL, "sh-sci.0" },
+	{ "scifa1", NULL, "sh-sci.1" },
+	{ "scifb0", NULL, "sh-sci.2" },
+	{ "scifb1", NULL, "sh-sci.3" },
+	{ "scifb2", NULL, "sh-sci.4" },
+	{ "scifa2", NULL, "sh-sci.5" },
+	{ "scif0", NULL, "sh-sci.6" },
+	{ "scif1", NULL, "sh-sci.7" },
+	{ "hscif0", NULL, "sh-sci.8" },
+	{ "hscif1", NULL, "sh-sci.9" },
+	{ "du0", "du.0", "rcar-du-r8a7790" },
+	{ "du1", "du.1", "rcar-du-r8a7790" },
+	{ "du2", "du.2", "rcar-du-r8a7790" },
+	{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
+	{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
+};
+
 static void __init lager_add_standard_devices(void)
 {
-	/*
-	 * This is a really crude hack to provide clkdev support to platform
-	 * devices until they get moved to DT.
-	 */
-	static const struct clk_name {
-		const char *clk;
-		const char *con_id;
-		const char *dev_id;
-	} clk_names[] = {
-		{ "cmt0", NULL, "sh_cmt.0" },
-		{ "scifa0", NULL, "sh-sci.0" },
-		{ "scifa1", NULL, "sh-sci.1" },
-		{ "scifb0", NULL, "sh-sci.2" },
-		{ "scifb1", NULL, "sh-sci.3" },
-		{ "scifb2", NULL, "sh-sci.4" },
-		{ "scifa2", NULL, "sh-sci.5" },
-		{ "scif0", NULL, "sh-sci.6" },
-		{ "scif1", NULL, "sh-sci.7" },
-		{ "hscif0", NULL, "sh-sci.8" },
-		{ "hscif1", NULL, "sh-sci.9" },
-		{ "du0", "du.0", "rcar-du-r8a7790" },
-		{ "du1", "du.1", "rcar-du-r8a7790" },
-		{ "du2", "du.2", "rcar-du-r8a7790" },
-		{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
-		{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
-	};
-	struct clk *clk;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
-		clk = clk_get(NULL, clk_names[i].clk);
-		if (!IS_ERR(clk)) {
-			clk_register_clkdev(clk, clk_names[i].con_id,
-					    clk_names[i].dev_id);
-			clk_put(clk);
-		}
-	}
-
+	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
 	r8a7790_add_dt_devices();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
#5 lore raw

PATCH v2 2/3 ARM: shmobile: Use shmobile_clk_workaround() on Lager

Quoted 32 lines · Simon Horman
Quoted 31 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Lager DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-lager-reference.c |   65 +++++++++---------------
 1 file changed, 25 insertions(+), 40 deletions(-)
arch/arm/mach-shmobile/board-lager-reference.c +1 -2
@@ -18,12 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>
@@ -86,46 +85,32 @@ static void __init lager_add_du_device(v
 	platform_device_register_full(&info);
 }
 
Quoted 8 lines

arch/arm/mach-shmobile/board-lager-reference.c static void __init lager_add_du_device(v · line 92

Quoted 5 lines
arch/arm/mach-shmobile/board-lager-reference.c +5 -0
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {

Should this be annotated as __initconst?
Likewise for the Koelsch variant of this patch.

Btw, I'm happy to handle this as an incremental patch if you like.

Quoted 69 lines
Quoted 54 lines
arch/arm/mach-shmobile/board-lager-reference.c +18 -32
+	{ "cmt0", NULL, "sh_cmt.0" },
+	{ "scifa0", NULL, "sh-sci.0" },
+	{ "scifa1", NULL, "sh-sci.1" },
+	{ "scifb0", NULL, "sh-sci.2" },
+	{ "scifb1", NULL, "sh-sci.3" },
+	{ "scifb2", NULL, "sh-sci.4" },
+	{ "scifa2", NULL, "sh-sci.5" },
+	{ "scif0", NULL, "sh-sci.6" },
+	{ "scif1", NULL, "sh-sci.7" },
+	{ "hscif0", NULL, "sh-sci.8" },
+	{ "hscif1", NULL, "sh-sci.9" },
+	{ "du0", "du.0", "rcar-du-r8a7790" },
+	{ "du1", "du.1", "rcar-du-r8a7790" },
+	{ "du2", "du.2", "rcar-du-r8a7790" },
+	{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
+	{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
+};
+
 static void __init lager_add_standard_devices(void)
 {
-	/*
-	 * This is a really crude hack to provide clkdev support to platform
-	 * devices until they get moved to DT.
-	 */
-	static const struct clk_name {
-		const char *clk;
-		const char *con_id;
-		const char *dev_id;
-	} clk_names[] = {
-		{ "cmt0", NULL, "sh_cmt.0" },
-		{ "scifa0", NULL, "sh-sci.0" },
-		{ "scifa1", NULL, "sh-sci.1" },
-		{ "scifb0", NULL, "sh-sci.2" },
-		{ "scifb1", NULL, "sh-sci.3" },
-		{ "scifb2", NULL, "sh-sci.4" },
-		{ "scifa2", NULL, "sh-sci.5" },
-		{ "scif0", NULL, "sh-sci.6" },
-		{ "scif1", NULL, "sh-sci.7" },
-		{ "hscif0", NULL, "sh-sci.8" },
-		{ "hscif1", NULL, "sh-sci.9" },
-		{ "du0", "du.0", "rcar-du-r8a7790" },
-		{ "du1", "du.1", "rcar-du-r8a7790" },
-		{ "du2", "du.2", "rcar-du-r8a7790" },
-		{ "lvds0", "lvds.0", "rcar-du-r8a7790" },
-		{ "lvds1", "lvds.1", "rcar-du-r8a7790" },
-	};
-	struct clk *clk;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
-		clk = clk_get(NULL, clk_names[i].clk);
-		if (!IS_ERR(clk)) {

arch/arm/mach-shmobile/board-lager-reference.c static void __init lager_add_du_device(v · line 116

Quoted 10 lines
arch/arm/mach-shmobile/board-lager-reference.c +1 -6
-			clk_register_clkdev(clk, clk_names[i].con_id,
-					    clk_names[i].dev_id);
-			clk_put(clk);
-		}
-	}
-
+	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
 	r8a7790_add_dt_devices();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#6 lore raw

PATCH v2 2/3 ARM: shmobile: Use shmobile_clk_workaround() on Lager

Quoted 42 lines · Simon Horman
Quoted 32 lines · Simon Horman
Quoted 31 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Lager DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-lager-reference.c |   65 +++++++++---------------
 1 file changed, 25 insertions(+), 40 deletions(-)
arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 renamed from arch/arm/mach-shmobile/board-lager-reference.c +1 -2
@@ -18,12 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>
@@ -86,46 +85,32 @@ static void __init lager_add_du_device(v
    platform_device_register_full(&info);
 }
 
Quoted 8 lines

arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 static void __init lager_add_du_device(v · line 92

Quoted 5 lines
arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 renamed from arch/arm/mach-shmobile/board-lager-reference.c +5 -0
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {

Should this be annotated as __initconst?
Likewise for the Koelsch variant of this patch.

Quoted 1 line

Btw, I'm happy to handle this as an incremental patch if you like.

Yes, that would be greatly appreciated!

Thanks,

/ magnus

#7 lore raw

PATCH v2 2/3 ARM: shmobile: Use shmobile_clk_workaround() on Lager

Quoted 43 lines · Magnus Damm
Quoted 42 lines · Simon Horman
Quoted 40 lines · Simon Horman
Quoted 28 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Lager DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-lager-reference.c |   65 +++++++++---------------
 1 file changed, 25 insertions(+), 40 deletions(-)
arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 renamed from arch/arm/mach-shmobile/board-lager-reference.c +1 -2
@@ -18,12 +18,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>

arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 static void __init lager_add_du_device(v · line 92

Quoted 8 lines
arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900 renamed from arch/arm/mach-shmobile/board-lager-reference.c +5 -0
@@ -86,46 +85,32 @@ static void __init lager_add_du_device(v
    platform_device_register_full(&info);
 }
 
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {

Should this be annotated as __initconst?
Likewise for the Koelsch variant of this patch.

Quoted 3 lines
Quoted 1 line

Btw, I'm happy to handle this as an incremental patch if you like.

Yes, that would be greatly appreciated!

Thanks, I have queued it up.

author maintainer
#8 lore raw

PATCH v2 3/3 ARM: shmobile: Use shmobile_clk_workaround() on Koelsch

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Koelsch DT reference code to use the newly introduced function shmobile_clk_workaround().

---

 arch/arm/mach-shmobile/board-koelsch-reference.c |   71 ++++++++--------------
 1 file changed, 28 insertions(+), 43 deletions(-)
arch/arm/mach-shmobile/board-koelsch-reference.c +28 -43
@@ -19,12 +19,11 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk.h>
-#include <linux/clkdev.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/rcar-du.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/rcar-gen2.h>
@@ -82,49 +81,35 @@ static void __init koelsch_add_du_device
 	platform_device_register_full(&info);
 }
 
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] = {
+	{ "cmt0", NULL, "sh_cmt.0" },
+	{ "scifa0", NULL, "sh-sci.0" },
+	{ "scifa1", NULL, "sh-sci.1" },
+	{ "scifb0", NULL, "sh-sci.2" },
+	{ "scifb1", NULL, "sh-sci.3" },
+	{ "scifb2", NULL, "sh-sci.4" },
+	{ "scifa2", NULL, "sh-sci.5" },
+	{ "scif0", NULL, "sh-sci.6" },
+	{ "scif1", NULL, "sh-sci.7" },
+	{ "scif2", NULL, "sh-sci.8" },
+	{ "scif3", NULL, "sh-sci.9" },
+	{ "scif4", NULL, "sh-sci.10" },
+	{ "scif5", NULL, "sh-sci.11" },
+	{ "scifa3", NULL, "sh-sci.12" },
+	{ "scifa4", NULL, "sh-sci.13" },
+	{ "scifa5", NULL, "sh-sci.14" },
+	{ "du0", "du.0", "rcar-du-r8a7791" },
+	{ "du1", "du.1", "rcar-du-r8a7791" },
+	{ "lvds0", "lvds.0", "rcar-du-r8a7791" },
+};
+
 static void __init koelsch_add_standard_devices(void)
 {
-	/*
-	 * This is a really crude hack to provide clkdev support to the CMT and
-	 * DU devices until they get moved to DT.
-	 */
-	static const struct clk_name {
-		const char *clk;
-		const char *con_id;
-		const char *dev_id;
-	} clk_names[] = {
-		{ "cmt0", NULL, "sh_cmt.0" },
-		{ "scifa0", NULL, "sh-sci.0" },
-		{ "scifa1", NULL, "sh-sci.1" },
-		{ "scifb0", NULL, "sh-sci.2" },
-		{ "scifb1", NULL, "sh-sci.3" },
-		{ "scifb2", NULL, "sh-sci.4" },
-		{ "scifa2", NULL, "sh-sci.5" },
-		{ "scif0", NULL, "sh-sci.6" },
-		{ "scif1", NULL, "sh-sci.7" },
-		{ "scif2", NULL, "sh-sci.8" },
-		{ "scif3", NULL, "sh-sci.9" },
-		{ "scif4", NULL, "sh-sci.10" },
-		{ "scif5", NULL, "sh-sci.11" },
-		{ "scifa3", NULL, "sh-sci.12" },
-		{ "scifa4", NULL, "sh-sci.13" },
-		{ "scifa5", NULL, "sh-sci.14" },
-		{ "du0", "du.0", "rcar-du-r8a7791" },
-		{ "du1", "du.1", "rcar-du-r8a7791" },
-		{ "lvds0", "lvds.0", "rcar-du-r8a7791" },
-	};
-	struct clk *clk;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
-		clk = clk_get(NULL, clk_names[i].clk);
-		if (!IS_ERR(clk)) {
-			clk_register_clkdev(clk, clk_names[i].con_id,
-					    clk_names[i].dev_id);
-			clk_put(clk);
-		}
-	}
-
+	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
 	r8a7791_add_dt_devices();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
#9 lore raw

PATCH v2 3/3 ARM: shmobile: Use shmobile_clk_workaround() on Koelsch

Quoted 6 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Koelsch DT reference code to use the newly introduced function shmobile_clk_workaround().

Thanks, I have queued this up.

#10 lore raw

v2 cover ARM: shmobile: Break out and extend clock workaround V2

In reply to Magnus Damm
Quoted 5 lines · Magnus Damm

ARM: shmobile: Break out and extend clock workaround V2

[PATCH v2 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() [PATCH 02/03] ARM: shmobile: Use shmobile_clk_workaround() on Lager [PATCH 03/03] ARM: shmobile: Use shmobile_clk_workaround() on Koelsch

If the series is v2 please annotate all patches in the series as v2, even if they haven't changed.

Quoted 25 lines

These patches consolidates the clkdev workaround present in the DT reference version of board code for Lager and Koelsch, and it also extends it to allow static enablement of a selected set of clocks during boot. The latter is needed for USB PCI support patches that have been posted.

---

Changes since V1:
- Reworked dependencies, updated header file path in patch [1/3].

Written against renesas.git tag renesas-devel-v3.14-rc6-20140311

 arch/arm/mach-shmobile/Makefile                  |    2 
 arch/arm/mach-shmobile/board-koelsch-reference.c |   71 ++++++++--------------
 arch/arm/mach-shmobile/board-lager-reference.c   |   65 +++++++-------------
 arch/arm/mach-shmobile/clock.c                   |   29 ++++++++
 arch/arm/mach-shmobile/include/mach/clock.h      |   16 ++++
 5 files changed, 99 insertions(+), 84 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html