Skip to contentSkip to conversation

clk: add common of_clk_init() function

PATCH In review Prashant Gaikwad 9 participants 27 messages Jan 4, 2013 – Feb 1, 2013 1 message not in the archive

Subsystems (12)
lore
Share & tools
lore

Prashant Gaikwad

author maintainer
#0 lore raw

PATCH 1/7 clk: add common of_clk_init() function

Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it.

Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren.

---
 drivers/clk/clk-fixed-rate.c      |    1 +
 drivers/clk/clk.c                 |    9 +++++++++
 include/asm-generic/vmlinux.lds.h |   10 ++++++++++
 include/linux/clk-provider.h      |    6 ++++++
 4 files changed, 26 insertions(+), 0 deletions(-)
drivers/clk/clk-fixed-rate.c +1 -0
index af78ed6..f2104df 100644
@@ -101,4 +101,5 @@ void __init of_fixed_clk_setup(struct device_node *node)
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }
 EXPORT_SYMBOL_GPL(of_fixed_clk_setup);
+CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
 #endif
drivers/clk/clk.c +9 -0
index 037b48a..fb38dd8 100644
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/device.h>
+#include <linux/init.h>
 
 static DEFINE_SPINLOCK(enable_lock);
 static DEFINE_MUTEX(prepare_lock);
@@ -1805,6 +1806,11 @@ struct of_clk_provider {
 	void *data;
 };
 
+extern struct of_device_id __clk_of_table[];
+
+static const struct of_device_id __clk_of_table_sentinel
+	__used __section(__clk_of_table_end);
+
 static LIST_HEAD(of_clk_providers);
 static DEFINE_MUTEX(of_clk_lock);
 
@@ -1933,6 +1939,9 @@ void __init of_clk_init(const struct of_device_id *matches)
 {
 	struct device_node *np;
 
+	if (!matches)
+		matches = __clk_of_table;
+
 	for_each_matching_node(np, matches) {
 		const struct of_device_id *match = of_match_node(matches, np);
 		of_clk_init_cb_t clk_init_cb = match->data;
include/asm-generic/vmlinux.lds.h +10 -0
index 1e744c5..8282f7c 100644
@@ -158,6 +158,15 @@
 #define CLKSRC_OF_TABLES()
 #endif
 
+#ifdef CONFIG_COMMON_CLK
+#define CLK_OF_TABLES() . = ALIGN(8);				\
+			VMLINUX_SYMBOL(__clk_of_table) = .;	\
+			*(__clk_of_table)			\
+			*(__clk_of_table_end)
+#else
+#define CLK_OF_TABLES()
+#endif
+
 #define KERNEL_DTB()							\
 	STRUCT_ALIGN();							\
 	VMLINUX_SYMBOL(__dtb_start) = .;				\
@@ -502,6 +511,7 @@
 	CPU_DISCARD(init.rodata)					\
 	MEM_DISCARD(init.rodata)					\
 	CLKSRC_OF_TABLES()						\
+	CLK_OF_TABLES()							\
 	KERNEL_DTB()
 
 #define INIT_TEXT							\
include/linux/clk-provider.h +6 -0
index 4989b8a..7f197d7 100644
@@ -379,7 +379,13 @@ struct clk_onecell_data {
 };
 struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
 const char *of_clk_get_parent_name(struct device_node *np, int index);
+
 void of_clk_init(const struct of_device_id *matches);
 
+#define CLK_OF_DECLARE(name, compat, fn)			\
+	static const struct of_device_id __clk_of_table_##name	\
+		__used __section(__clk_of_table)		\
+		= { .compatible = compat, .data = fn };
+
 #endif /* CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */
Signature · 1 line
1.7.4.1
author maintainer
#1 lore raw

PATCH 2/7 clk: tegra: Use common of_clk_init() function

Use common of_clk_init() function for clocks initialization.

---
 arch/arm/mach-tegra/common.c    |    4 ++--
 drivers/clk/tegra/clk-tegra20.c |    3 ++-
 drivers/clk/tegra/clk-tegra30.c |    3 ++-
 drivers/clk/tegra/clk.c         |   11 -----------
 drivers/clk/tegra/clk.h         |   12 ------------
 include/linux/clk/tegra.h       |    1 -
 6 files changed, 6 insertions(+), 28 deletions(-)
arch/arm/mach-tegra/common.c +2 -2
index 3a7280d..4fde6a9 100644
@@ -22,7 +22,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/of_irq.h>
-#include <linux/clk/tegra.h>
+#include <linux/clk-provider.h>
 
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/hardware/gic.h>
@@ -64,7 +64,7 @@ static const struct of_device_id tegra_dt_irq_match[] __initconst = {
 
 void __init tegra_dt_init_irq(void)
 {
-	tegra_clocks_init();
+	of_clk_init(NULL);
 	tegra_init_irq();
 	of_irq_init(tegra_dt_irq_match);
 }
drivers/clk/tegra/clk-tegra20.c +2 -1
index 32a3d81..3436ad9 100644
@@ -1193,7 +1193,7 @@ static const struct of_device_id apb_match[] __initconst = {
 	{},
 };
 
-void __init tegra20_clock_init(struct device_node *np)
+static void __init tegra20_clock_init(struct device_node *np)
 {
 	int i;
 	struct device_node *node;
@@ -1253,3 +1253,4 @@ void __init tegra20_clock_init(struct device_node *np)
 
 	tegra_cpu_car_ops = &tegra20_cpu_car_ops;
 }
+CLK_OF_DECLARE(tegra20, "nvidia,tegra20-car", tegra20_clock_init);
drivers/clk/tegra/clk-tegra30.c +2 -1
index 30fb743..f17e857 100644
@@ -1971,7 +1971,7 @@ static const struct of_device_id apb_match[] __initconst = {
 	{},
 };
 
-void __init tegra30_clock_init(struct device_node *np)
+static void __init tegra30_clock_init(struct device_node *np)
 {
 	struct device_node *node;
 	int i;
@@ -2031,3 +2031,4 @@ void __init tegra30_clock_init(struct device_node *np)
 
 	tegra_cpu_car_ops = &tegra30_cpu_car_ops;
 }
+CLK_OF_DECLARE(tegra30, "nvidia,tegra30-car", tegra30_clock_init);
drivers/clk/tegra/clk.c +0 -11
index a603b9a..ce4441a 100644
@@ -72,14 +72,3 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl,
 			}
 	}
 }
-
-static const struct of_device_id tegra_dt_clk_match[] = {
-	{ .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init },
-	{ .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init },
-	{ }
-};
-
-void __init tegra_clocks_init(void)
-{
-	of_clk_init(tegra_dt_clk_match);
-}
drivers/clk/tegra/clk.h +0 -12
index f1ed1d0..7fdf8e6 100644
@@ -476,16 +476,4 @@ void tegra_init_from_table(struct tegra_clk_init_table *tbl,
 void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
 				struct clk *clks[], int clk_max);
 
-#ifdef CONFIG_ARCH_TEGRA_2x_SOC
-void tegra20_clock_init(struct device_node *np);
-#else
-static inline void tegra20_clock_init(struct device_node *np) {}
-#endif /* CONFIG_ARCH_TEGRA_2x_SOC */
-
-#ifdef CONFIG_ARCH_TEGRA_3x_SOC
-void tegra30_clock_init(struct device_node *np);
-#else
-static inline void tegra30_clock_init(struct device_node *np) {}
-#endif /* CONFIG_ARCH_TEGRA_3x_SOC */
-
 #endif /* TEGRA_CLK_H */
include/linux/clk/tegra.h +0 -1
index 404d6f9..2e8b399 100644
@@ -122,6 +122,5 @@ static inline void tegra_cpu_clock_resume(void)
 
 void tegra_periph_reset_deassert(struct clk *c);
 void tegra_periph_reset_assert(struct clk *c);
-void tegra_clocks_init(void);
 
 #endif /* __LINUX_CLK_TEGRA_H_ */
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoted 4 lines · Prashant Gaikwad

Use common of_clk_init() function for clocks initialization.

 drivers/clk/tegra/clk-tegra20.c |    3 ++-
 drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type
-> This would usually go through the clk tree.
2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series
-> This would usually go through the clk tree.

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

author maintainer
#3 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoted 14 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad

Use common of_clk_init() function for clocks initialization.

  drivers/clk/tegra/clk-tegra20.c |    3 ++-
  drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

    -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

Quoted 6 lines
    -> This would usually go through the clk tree.

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

#4 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoting Prashant Gaikwad (2013-01-04 18:44:48)

Quoted 17 lines · Stephen Warren
Quoted 16 lines · Prashant Gaikwad
Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

  drivers/clk/tegra/clk-tegra20.c |    3 ++-
  drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

    -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

    -> This would usually go through the clk tree.
Quoted 7 lines
Quoted 4 lines

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

Patch (1) still has some unaddressed comments, and is not a real dependency for this series. Since all of the patches have received their Tested-by's then I propose to merge all patches from this series into clk-next, which exception of patch 2/7 (the Tegra patch).

This reduces your Tegra CCF conversion dependencies and you can role the necessary of_clk_init change into your Tegra CCF conversion branch (it has my implicit Ack and can be taken through your tree).

Let me know if this is OK for you.

Thanks,
Mike

#5 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoted 23 lines · Mike Turquette

Quoting Prashant Gaikwad (2013-01-04 18:44:48)

Quoted 22 lines · Stephen Warren
Quoted 20 lines · Prashant Gaikwad
Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

  drivers/clk/tegra/clk-tegra20.c |    3 ++-
  drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

    -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

    -> This would usually go through the clk tree.

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

Quoted 5 lines
Quoted 2 lines

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

Patch (1) still has some unaddressed comments, and is not a real dependency for this series.

I assume "Patch (1)" refers to the list of series a couple emails above, not the first patch in the series you're replying to; that threw me for a moment.

Quoted 9 lines

Since all of the patches have received their
Tested-by's then I propose to merge all patches from this series into clk-next, which exception of patch 2/7 (the Tegra patch).

This reduces your Tegra CCF conversion dependencies and you can role the necessary of_clk_init change into your Tegra CCF conversion branch (it has my implicit Ack and can be taken through your tree).

Let me know if this is OK for you.

OK, I'm happy to merge your clock tree into the Tegra tree and then apply 2/7 on top of the Tegra CCF work.

A message that is not in the archive (sent off-list or not yet received): 20130125005729.10623.61165@quantum

#7 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoted 43 lines · Mike Turquette

Quoting Stephen Warren (2013-01-24 11:32:37)

Quoted 42 lines · Mike Turquette
Quoted 23 lines

Quoting Prashant Gaikwad (2013-01-04 18:44:48)

Quoted 22 lines · Stephen Warren
Quoted 20 lines · Prashant Gaikwad
Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

  drivers/clk/tegra/clk-tegra20.c |    3 ++-
  drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

    -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

    -> This would usually go through the clk tree.

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

Quoted 5 lines
Quoted 2 lines

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

Patch (1) still has some unaddressed comments, and is not a real dependency for this series.

I assume "Patch (1)" refers to the list of series a couple emails above, not the first patch in the series you're replying to; that threw me for a moment.

Quoted 8 lines

Since all of the patches have received their
Tested-by's then I propose to merge all patches from this series into clk-next, which exception of patch 2/7 (the Tegra patch).

This reduces your Tegra CCF conversion dependencies and you can role the necessary of_clk_init change into your Tegra CCF conversion branch (it has my implicit Ack and can be taken through your tree).

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Let me know if this is OK for you.

OK, I'm happy to merge your clock tree into the Tegra tree and then apply 2/7 on top of the Tegra CCF work.

Hmm, maybe the clk tree needs to be a dependency branch of arm-soc again, as it has in the past. Would that help with any Tegra merge pain?

Yes, I think that's what would end up happening if I merge the clk tree into the Tegra tree anyway.

author maintainer
#8 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoted 41 lines · Stephen Warren
Quoted 40 lines · Mike Turquette

Quoting Stephen Warren (2013-01-24 11:32:37)

Quoted 39 lines · Mike Turquette
Quoted 18 lines

Quoting Prashant Gaikwad (2013-01-04 18:44:48)

Quoted 17 lines · Stephen Warren
Quoted 16 lines · Prashant Gaikwad
Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

   drivers/clk/tegra/clk-tegra20.c |    3 ++-
   drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

     -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

     -> This would usually go through the clk tree.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

Patch (1) still has some unaddressed comments, and is not a real dependency for this series.

I assume "Patch (1)" refers to the list of series a couple emails above, not the first patch in the series you're replying to; that threw me for a moment.

Quoted 8 lines

Since all of the patches have received their
Tested-by's then I propose to merge all patches from this series into clk-next, which exception of patch 2/7 (the Tegra patch).

This reduces your Tegra CCF conversion dependencies and you can role the necessary of_clk_init change into your Tegra CCF conversion branch (it has my implicit Ack and can be taken through your tree).

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Let me know if this is OK for you.

OK, I'm happy to merge your clock tree into the Tegra tree and then apply 2/7 on top of the Tegra CCF work.

Hmm, maybe the clk tree needs to be a dependency branch of arm-soc again, as it has in the past. Would that help with any Tegra merge pain?

Yes, I think that's what would end up happening if I merge the clk tree into the Tegra tree anyway.

Hi Mike,

Have you merged these patches for 3.9?

#9 lore raw

Re: [PATCH 2/7] clk: tegra: Use common of_clk_init() function

Quoting Prashant Gaikwad (2013-01-31 20:49:47)

Quoted 48 lines · Stephen Warren
Quoted 47 lines · Mike Turquette
Quoted 46 lines

Quoting Stephen Warren (2013-01-24 11:32:37)

Quoted 35 lines · Mike Turquette
Quoted 18 lines

Quoting Prashant Gaikwad (2013-01-04 18:44:48)

Quoted 17 lines · Stephen Warren
Quoted 16 lines · Prashant Gaikwad
Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

   drivers/clk/tegra/clk-tegra20.c |    3 ++-
   drivers/clk/tegra/clk-tegra30.c |    3 ++-

Oh, so this series is written assuming that the Tegra CCF rework is already applied then? That makes the dependencies quite painful, since I think we'll end up with the following order being needed:

1) clk: Add composite clock type

     -> This would usually go through the clk tree.

2) The Tegra CCF rework series
-> This must go through the Tegra tree due to lots of dependencies and merge conflicts with other Tegra patches.
3) This series

     -> This would usually go through the clk tree.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Is it possible to re-order the dependencies as (1) (3) (2), so that Mike can apply (1) and (3) to the clock tree, then I can use the clk tree as the basis for a branch in the Tegra tree to apply (2) and all the other Tegra patches that will conflict with (2)?

If Mike approves the concept and implementation in (1) and (3) then I will repost (2) and (3) with dependencies re-ordered.

Patch (1) still has some unaddressed comments, and is not a real dependency for this series.

I assume "Patch (1)" refers to the list of series a couple emails above, not the first patch in the series you're replying to; that threw me for a moment.

Quoted 4 lines

Since all of the patches have received their
Tested-by's then I propose to merge all patches from this series into clk-next, which exception of patch 2/7 (the Tegra patch).

Quoted 7 lines
Quoted 5 lines

This reduces your Tegra CCF conversion dependencies and you can role the necessary of_clk_init change into your Tegra CCF conversion branch (it has my implicit Ack and can be taken through your tree).

Let me know if this is OK for you.

OK, I'm happy to merge your clock tree into the Tegra tree and then apply 2/7 on top of the Tegra CCF work.

Hmm, maybe the clk tree needs to be a dependency branch of arm-soc again, as it has in the past. Would that help with any Tegra merge pain?

Quoted 6 lines
Quoted 2 lines

Yes, I think that's what would end up happening if I merge the clk tree into the Tegra tree anyway.

Hi Mike,

Have you merged these patches for 3.9?

Yes, these have been sitting in clk-next for a few days now.

Regards,
Mike

author maintainer
#10 lore raw

PATCH 3/7 clk: sunxi: Use common of_clk_init() function

In reply to Prashant Gaikwad

Use common of_clk_init() function to initialize clocks.

---
 drivers/clk/clk-sunxi.c           |   30 ------------------------------
 drivers/clocksource/sunxi_timer.c |    4 ++--
 include/linux/clk/sunxi.h         |   22 ----------------------
 3 files changed, 2 insertions(+), 54 deletions(-)
 delete mode 100644 drivers/clk/clk-sunxi.c
 delete mode 100644 include/linux/clk/sunxi.h
drivers/clk/clk-sunxi.c deleted +0 -30
deleted file mode 100644
index 0e831b5..0000000
@@ -1,30 +0,0 @@
-/*
- * Copyright 2012 Maxime Ripard
- *
- * Maxime Ripard <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/clk-provider.h>
-#include <linux/clkdev.h>
-#include <linux/clk/sunxi.h>
-#include <linux/of.h>
-
-static const __initconst struct of_device_id clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{}
-};
-
-void __init sunxi_init_clocks(void)
-{
-	of_clk_init(clk_match);
-}
drivers/clocksource/sunxi_timer.c +2 -2
index 6c2ed56..08e1756 100644
@@ -23,7 +23,7 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/sunxi_timer.h>
-#include <linux/clk/sunxi.h>
+#include <linux/clk-provider.h>
 
 #define TIMER_CTL_REG		0x00
 #define TIMER_CTL_ENABLE		(1 << 0)
@@ -124,7 +124,7 @@ void __init sunxi_timer_init(void)
 	if (irq <= 0)
 		panic("Can't parse IRQ");
 
-	sunxi_init_clocks();
+	of_clk_init(NULL);
 
 	clk = of_clk_get(node, 0);
 	if (IS_ERR(clk))
include/linux/clk/sunxi.h deleted +0 -22
deleted file mode 100644
index e074fdd..0000000
@@ -1,22 +0,0 @@
-/*
- * Copyright 2012 Maxime Ripard
- *
- * Maxime Ripard <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __LINUX_CLK_SUNXI_H_
-#define __LINUX_CLK_SUNXI_H_
-
-void __init sunxi_init_clocks(void);
-
-#endif
Signature · 1 line
1.7.4.1
author maintainer
#11 lore raw

PATCH 4/7 clk: highbank: Use common of_clk_init() function

In reply to Prashant Gaikwad

Use common of_clk_init() function for clocks initialization.

---
 arch/arm/mach-highbank/core.h     |    1 -
 arch/arm/mach-highbank/highbank.c |    3 ++-
 drivers/clk/clk-highbank.c        |   18 ++++--------------
 3 files changed, 6 insertions(+), 16 deletions(-)
arch/arm/mach-highbank/core.h +0 -1
index 80235b4..3f65206 100644
@@ -2,7 +2,6 @@
 #define __HIGHBANK_CORE_H
 
 extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
-extern void highbank_clocks_init(void);
 extern void highbank_restart(char, const char *);
 extern void __iomem *scu_base_addr;
 
arch/arm/mach-highbank/highbank.c +2 -1
index f6ca285..fb148da 100644
@@ -25,6 +25,7 @@
 #include <linux/of_address.h>
 #include <linux/smp.h>
 #include <linux/amba/bus.h>
+#include <linux/clk-provider.h>
 
 #include <asm/arch_timer.h>
 #include <asm/cacheflush.h>
@@ -116,7 +117,7 @@ static void __init highbank_timer_init(void)
 	WARN_ON(!timer_base);
 	irq = irq_of_parse_and_map(np, 0);
 
-	highbank_clocks_init();
+	of_clk_init(NULL);
 	lookup.clk = of_clk_get(np, 0);
 	clkdev_add(&lookup);
 
drivers/clk/clk-highbank.c +4 -14
index 52fecad..5d1de2e 100644
@@ -314,33 +314,23 @@ static void __init hb_pll_init(struct device_node *node)
 {
 	hb_clk_init(node, &clk_pll_ops);
 }
+CLK_OF_DECLARE(hb_pll, "calxeda,hb-pll-clock", hb_pll_init);
 
 static void __init hb_a9periph_init(struct device_node *node)
 {
 	hb_clk_init(node, &a9periphclk_ops);
 }
+CLK_OF_DECLARE(hb_a9periph, "calxeda,hb-a9periph-clock", hb_a9periph_init);
 
 static void __init hb_a9bus_init(struct device_node *node)
 {
 	struct clk *clk = hb_clk_init(node, &a9bclk_ops);
 	clk_prepare_enable(clk);
 }
+CLK_OF_DECLARE(hb_a9bus, "calxeda,hb-a9bus-clock", hb_a9bus_init);
 
 static void __init hb_emmc_init(struct device_node *node)
 {
 	hb_clk_init(node, &periclk_ops);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "calxeda,hb-pll-clock", .data = hb_pll_init, },
-	{ .compatible = "calxeda,hb-a9periph-clock", .data = hb_a9periph_init, },
-	{ .compatible = "calxeda,hb-a9bus-clock", .data = hb_a9bus_init, },
-	{ .compatible = "calxeda,hb-emmc-clock", .data = hb_emmc_init, },
-	{}
-};
-
-void __init highbank_clocks_init(void)
-{
-	of_clk_init(clk_match);
-}
+CLK_OF_DECLARE(hb_emmc, "calxeda,hb-emmc-clock", hb_emmc_init);
Signature · 1 line
1.7.4.1
#12 lore raw

Re: [PATCH 4/7] clk: highbank: Use common of_clk_init() function

Quoting Prashant Gaikwad (2013-01-03 23:00:55)

Quoted 3 lines

Use common of_clk_init() function for clocks initialization.

Rob,

Can I get a Tested-by from you before I take this?

Thanks,
Mike

Quoted 83 lines
---
 arch/arm/mach-highbank/core.h     |    1 -
 arch/arm/mach-highbank/highbank.c |    3 ++-
 drivers/clk/clk-highbank.c        |   18 ++++--------------
 3 files changed, 6 insertions(+), 16 deletions(-)
arch/arm/mach-highbank/core.h +0 -1
index 80235b4..3f65206 100644
@@ -2,7 +2,6 @@
 #define __HIGHBANK_CORE_H
 
 extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
-extern void highbank_clocks_init(void);
 extern void highbank_restart(char, const char *);
 extern void __iomem *scu_base_addr;
 
arch/arm/mach-highbank/highbank.c +2 -1
index f6ca285..fb148da 100644
@@ -25,6 +25,7 @@
 #include <linux/of_address.h>
 #include <linux/smp.h>
 #include <linux/amba/bus.h>
+#include <linux/clk-provider.h>
 
 #include <asm/arch_timer.h>
 #include <asm/cacheflush.h>
@@ -116,7 +117,7 @@ static void __init highbank_timer_init(void)
        WARN_ON(!timer_base);
        irq = irq_of_parse_and_map(np, 0);
 
-       highbank_clocks_init();
+       of_clk_init(NULL);
        lookup.clk = of_clk_get(np, 0);
        clkdev_add(&lookup);
 
drivers/clk/clk-highbank.c +4 -14
index 52fecad..5d1de2e 100644
@@ -314,33 +314,23 @@ static void __init hb_pll_init(struct device_node *node)
 {
        hb_clk_init(node, &clk_pll_ops);
 }
+CLK_OF_DECLARE(hb_pll, "calxeda,hb-pll-clock", hb_pll_init);
 
 static void __init hb_a9periph_init(struct device_node *node)
 {
        hb_clk_init(node, &a9periphclk_ops);
 }
+CLK_OF_DECLARE(hb_a9periph, "calxeda,hb-a9periph-clock", hb_a9periph_init);
 
 static void __init hb_a9bus_init(struct device_node *node)
 {
        struct clk *clk = hb_clk_init(node, &a9bclk_ops);
        clk_prepare_enable(clk);
 }
+CLK_OF_DECLARE(hb_a9bus, "calxeda,hb-a9bus-clock", hb_a9bus_init);
 
 static void __init hb_emmc_init(struct device_node *node)
 {
        hb_clk_init(node, &periclk_ops);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-       { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-       { .compatible = "calxeda,hb-pll-clock", .data = hb_pll_init, },
-       { .compatible = "calxeda,hb-a9periph-clock", .data = hb_a9periph_init, },
-       { .compatible = "calxeda,hb-a9bus-clock", .data = hb_a9bus_init, },
-       { .compatible = "calxeda,hb-emmc-clock", .data = hb_emmc_init, },
-       {}
-};
-
-void __init highbank_clocks_init(void)
-{
-       of_clk_init(clk_match);
-}
+CLK_OF_DECLARE(hb_emmc, "calxeda,hb-emmc-clock", hb_emmc_init);
Signature · 1 line
1.7.4.1
author maintainer
#13 lore raw

PATCH 5/7 clk: vt8500: Use common of_clk_init() function

In reply to Prashant Gaikwad

Use common of_clk_init() function for clock initialization.

---
 drivers/clk/clk-vt8500.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/clk/clk-vt8500.c +4 -11
index fe25570..3ce1c3e 100644
@@ -272,7 +272,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
 	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
 	clk_register_clkdev(clk, clk_name, NULL);
 }
-
+CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init);
 
 /* PLL clock related functions */
 
@@ -502,20 +502,13 @@ static void __init vt8500_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_VT8500);
 }
+CLK_OF_DECLARE(vt8500_pll, "via,vt8500-pll-clock", vt8500_pll_init);
 
 static void __init wm8650_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_WM8650);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "via,vt8500-pll-clock", .data = vt8500_pll_init, },
-	{ .compatible = "wm,wm8650-pll-clock", .data = wm8650_pll_init, },
-	{ .compatible = "via,vt8500-device-clock",
-					.data = vtwm_device_clk_init, },
-	{ /* sentinel */ }
-};
+CLK_OF_DECLARE(wm8650_pll, "wm,wm8650-pll-clock", wm8650_pll_init);
 
 void __init vtwm_clk_init(void __iomem *base)
 {
@@ -524,5 +517,5 @@ void __init vtwm_clk_init(void __iomem *base)
 
 	pmc_base = base;
 
-	of_clk_init(clk_match);
+	of_clk_init(NULL);
 }
Signature · 1 line
1.7.4.1
#14 lore raw

Re: [PATCH 5/7] clk: vt8500: Use common of_clk_init() function

Quoting Prashant Gaikwad (2013-01-03 23:00:56)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Tony,

Can I get a Tested-by from you before I take this in?

Thanks,
Mike

Quoted 49 lines
---
 drivers/clk/clk-vt8500.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/clk/clk-vt8500.c +4 -11
index fe25570..3ce1c3e 100644
@@ -272,7 +272,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
        rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
        clk_register_clkdev(clk, clk_name, NULL);
 }
-
+CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init);
 
 /* PLL clock related functions */
 
@@ -502,20 +502,13 @@ static void __init vt8500_pll_init(struct device_node *node)
 {
        vtwm_pll_clk_init(node, PLL_TYPE_VT8500);
 }
+CLK_OF_DECLARE(vt8500_pll, "via,vt8500-pll-clock", vt8500_pll_init);
 
 static void __init wm8650_pll_init(struct device_node *node)
 {
        vtwm_pll_clk_init(node, PLL_TYPE_WM8650);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-       { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-       { .compatible = "via,vt8500-pll-clock", .data = vt8500_pll_init, },
-       { .compatible = "wm,wm8650-pll-clock", .data = wm8650_pll_init, },
-       { .compatible = "via,vt8500-device-clock",
-                                       .data = vtwm_device_clk_init, },
-       { /* sentinel */ }
-};
+CLK_OF_DECLARE(wm8650_pll, "wm,wm8650-pll-clock", wm8650_pll_init);
 
 void __init vtwm_clk_init(void __iomem *base)
 {
@@ -524,5 +517,5 @@ void __init vtwm_clk_init(void __iomem *base)
 
        pmc_base = base;
 
-       of_clk_init(clk_match);
+       of_clk_init(NULL);
 }
Signature · 1 line
1.7.4.1
Tested-by
#15 lore raw

Re: [PATCH 5/7] clk: vt8500: Use common of_clk_init() function

Quoted 9 lines · Mike Turquette

Quoting Prashant Gaikwad (2013-01-03 23:00:56)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Tony,

Can I get a Tested-by from you before I take this in?

FYI: This will need another patch to complete as we added another set of clocks to this clk-vt8500.c for 3.9.

Quoted 57 lines

Thanks,
Mike

Quoted 49 lines
---
 drivers/clk/clk-vt8500.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/clk/clk-vt8500.c +4 -11
index fe25570..3ce1c3e 100644
@@ -272,7 +272,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
        rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
        clk_register_clkdev(clk, clk_name, NULL);
 }
-
+CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init);
 
 /* PLL clock related functions */
 
@@ -502,20 +502,13 @@ static void __init vt8500_pll_init(struct device_node *node)
 {
        vtwm_pll_clk_init(node, PLL_TYPE_VT8500);
 }
+CLK_OF_DECLARE(vt8500_pll, "via,vt8500-pll-clock", vt8500_pll_init);
 
 static void __init wm8650_pll_init(struct device_node *node)
 {
        vtwm_pll_clk_init(node, PLL_TYPE_WM8650);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-       { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-       { .compatible = "via,vt8500-pll-clock", .data = vt8500_pll_init, },
-       { .compatible = "wm,wm8650-pll-clock", .data = wm8650_pll_init, },
-       { .compatible = "via,vt8500-device-clock",
-                                       .data = vtwm_device_clk_init, },
-       { /* sentinel */ }
-};
+CLK_OF_DECLARE(wm8650_pll, "wm,wm8650-pll-clock", wm8650_pll_init);
 
 void __init vtwm_clk_init(void __iomem *base)
 {
@@ -524,5 +517,5 @@ void __init vtwm_clk_init(void __iomem *base)
 
        pmc_base = base;
 
-       of_clk_init(clk_match);
+       of_clk_init(NULL);
 }
Signature · 1 line
1.7.4.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#16 lore raw

PATCH 5/7 clk: vt8500: Use common of_clk_init() function

Quoting Tony Prisk (2013-01-18 13:08:00)

Quoted 6 lines · Mike Turquette
Quoted 5 lines

Quoting Prashant Gaikwad (2013-01-03 23:00:56)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Quoted 9 lines
Quoted 4 lines

Tony,

Can I get a Tested-by from you before I take this in?

FYI: This will need another patch to complete as we added another set of clocks to this clk-vt8500.c for 3.9.

Tony, is the following patch correct?

Quoted 1 line

From 5b6e0adb69674c684c33503f50010644b049029c Mon Sep 17 00:00:00 2001

From: Prashant Gaikwad <[email protected]>
Date: Fri, 4 Jan 2013 12:30:56 +0530
Subject: [PATCH] clk: vt8500: Use common of_clk_init() function

Use common of_clk_init() function for clock initialization.

[mturquette at linaro.org: added entry for wm8750-pll-clock]
---
 drivers/clk/clk-vt8500.c |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/clk/clk-vt8500.c +5 -12
index 2515d4f..b5538bb 100644
@@ -291,7 +291,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
 	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
 	clk_register_clkdev(clk, clk_name, NULL);
 }
-
+CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init);
 
 /* PLL clock related functions */
 
@@ -612,26 +612,19 @@ static void __init vt8500_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_VT8500);
 }
+CLK_OF_DECLARE(vt8500_pll, "via,vt8500-pll-clock", vt8500_pll_init);
 
 static void __init wm8650_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_WM8650);
 }
+CLK_OF_DECLARE(wm8650_pll, "wm,wm8650-pll-clock", wm8650_pll_init);
 
 static void __init wm8750_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_WM8750);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "via,vt8500-pll-clock", .data = vt8500_pll_init, },
-	{ .compatible = "wm,wm8650-pll-clock", .data = wm8650_pll_init, },
-	{ .compatible = "wm,wm8750-pll-clock", .data = wm8750_pll_init, },
-	{ .compatible = "via,vt8500-device-clock",
-					.data = vtwm_device_clk_init, },
-	{ /* sentinel */ }
-};
+CLK_OF_DECLARE(wm8750_pll, "wm,wm8750-pll-clock", wm8750_pll_init);
 
 void __init vtwm_clk_init(void __iomem *base)
 {
@@ -640,5 +633,5 @@ void __init vtwm_clk_init(void __iomem *base)
 
 	pmc_base = base;
 
-	of_clk_init(clk_match);
+	of_clk_init(NULL);
 }
Signature · 1 line
1.7.10.4
Tested-by Acked-by on v1 5/7
#17 lore raw

Re: [PATCH 5/7] clk: vt8500: Use common of_clk_init() function

Quoted 81 lines · Mike Turquette

Quoting Tony Prisk (2013-01-18 13:08:00)

Quoted 6 lines · Mike Turquette
Quoted 5 lines

Quoting Prashant Gaikwad (2013-01-03 23:00:56)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Quoted 9 lines
Quoted 4 lines

Tony,

Can I get a Tested-by from you before I take this in?

FYI: This will need another patch to complete as we added another set of clocks to this clk-vt8500.c for 3.9.

Tony, is the following patch correct?

From 5b6e0adb69674c684c33503f50010644b049029c Mon Sep 17 00:00:00 2001
From: Prashant Gaikwad <[email protected]>
Date: Fri, 4 Jan 2013 12:30:56 +0530
Subject: [PATCH] clk: vt8500: Use common of_clk_init() function

Use common of_clk_init() function for clock initialization.

---
 drivers/clk/clk-vt8500.c |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/clk/clk-vt8500.c +4 -11
index 2515d4f..b5538bb 100644
@@ -291,7 +291,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
 	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
 	clk_register_clkdev(clk, clk_name, NULL);
 }
-
+CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init);
 
 /* PLL clock related functions */
 
@@ -612,26 +612,19 @@ static void __init vt8500_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_VT8500);
 }
+CLK_OF_DECLARE(vt8500_pll, "via,vt8500-pll-clock", vt8500_pll_init);
 
 static void __init wm8650_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_WM8650);
 }
+CLK_OF_DECLARE(wm8650_pll, "wm,wm8650-pll-clock", wm8650_pll_init);
 
 static void __init wm8750_pll_init(struct device_node *node)
 {
 	vtwm_pll_clk_init(node, PLL_TYPE_WM8750);
 }
-
-static const __initconst struct of_device_id clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "via,vt8500-pll-clock", .data = vt8500_pll_init, },
-	{ .compatible = "wm,wm8650-pll-clock", .data = wm8650_pll_init, },
-	{ .compatible = "wm,wm8750-pll-clock", .data = wm8750_pll_init, },
-	{ .compatible = "via,vt8500-device-clock",
-					.data = vtwm_device_clk_init, },
-	{ /* sentinel */ }
-};
+CLK_OF_DECLARE(wm8750_pll, "wm,wm8750-pll-clock", wm8750_pll_init);
 
 void __init vtwm_clk_init(void __iomem *base)
 {

drivers/clk/clk-vt8500.c void __init vtwm_clk_init(void __iomem *base) · line 637

Quoted 6 lines
drivers/clk/clk-vt8500.c +1 -1
@@ -640,5 +633,5 @@ void __init vtwm_clk_init(void __iomem *base)
 
 	pmc_base = base;
 
-	of_clk_init(clk_match);
+	of_clk_init(NULL);
 }

Yeap - this patch is fine.

Take your pick which signoff you want :)

Regards
Tony P

author maintainer
#18 lore raw

PATCH 6/7 clk: zynq: Use common of_clk_init() function

In reply to Prashant Gaikwad

Use common of_clk_init() function for clock initialization.

---
 drivers/clk/clk-zynq.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
drivers/clk/clk-zynq.c +4 -10
index 37a3051..b14a25f 100644
@@ -81,6 +81,7 @@ static void __init zynq_pll_clk_setup(struct device_node *np)
 	if (WARN_ON(ret))
 		return;
 }
+CLK_OF_DECLARE(zynq_pll, "xlnx,zynq-pll", zynq_pll_clk_setup);
 
 struct zynq_periph_clk {
 	struct clk_hw		hw;
@@ -187,6 +188,7 @@ static void __init zynq_periph_clk_setup(struct device_node *np)
 	if (WARN_ON(err))
 		return;
 }
+CLK_OF_DECLARE(zynq_periph, "xlnx,zynq-periph-clock", zynq_periph_clk_setup);
 
 /* CPU Clock domain is modelled as a mux with 4 children subclks, whose
  * derivative rates depend on CLK_621_TRUE
@@ -366,18 +368,10 @@ static void __init zynq_cpu_clk_setup(struct device_node *np)
 	if (WARN_ON(err))
 		return;
 }
-
-static const __initconst struct of_device_id zynq_clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "xlnx,zynq-pll", .data = zynq_pll_clk_setup, },
-	{ .compatible = "xlnx,zynq-periph-clock",
-		.data = zynq_periph_clk_setup, },
-	{ .compatible = "xlnx,zynq-cpu-clock", .data = zynq_cpu_clk_setup, },
-	{}
-};
+CLK_OF_DECLARE(zynq_cpu, "xlnx,zynq-cpu-clock", zynq_cpu_clk_setup);
 
 void __init xilinx_zynq_clocks_init(void __iomem *slcr)
 {
 	slcr_base = slcr;
-	of_clk_init(zynq_clk_match);
+	of_clk_init(NULL);
 }
Signature · 1 line
1.7.4.1
author maintainer
#19 lore raw

PATCH 7/7 clk: vexpress: Use common of_clk_init() function

In reply to Prashant Gaikwad

Use common of_clk_init() function for clock initialization.

---
 drivers/clk/versatile/clk-vexpress-osc.c |    1 +
 drivers/clk/versatile/clk-vexpress.c     |    8 +-------
 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/clk/versatile/clk-vexpress-osc.c +1 -0
index dcb6ae0..256c8be 100644
@@ -144,3 +144,4 @@ error:
 		vexpress_config_func_put(osc->func);
 	kfree(osc);
 }
+CLK_OF_DECLARE(vexpress_soc, "arm,vexpress-osc", vexpress_osc_of_setup);
drivers/clk/versatile/clk-vexpress.c +1 -7
index c742ac7..f889f2f 100644
@@ -99,19 +99,13 @@ struct clk *vexpress_sp810_of_get(struct of_phandle_args *clkspec, void *data)
 	return vexpress_sp810_timerclken[clkspec->args[0]];
 }
 
-static const __initconst struct of_device_id vexpress_fixed_clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
-	{}
-};
-
 void __init vexpress_clk_of_init(void)
 {
 	struct device_node *node;
 	struct clk *clk;
 	struct clk *refclk, *timclk;
 
-	of_clk_init(vexpress_fixed_clk_match);
+	of_clk_init(NULL);
 
 	node = of_find_compatible_node(NULL, NULL, "arm,sp810");
 	vexpress_sp810_init(of_iomap(node, 0));
Signature · 1 line
1.7.4.1
#20 lore raw

Re: [PATCH 7/7] clk: vexpress: Use common of_clk_init() function

Quoting Prashant Gaikwad (2013-01-03 23:00:58)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Pawel or Linus,

Can I get a Tested-by before I take this series into clk-next?

Thanks,
Mike

Quoted 41 lines
---
 drivers/clk/versatile/clk-vexpress-osc.c |    1 +
 drivers/clk/versatile/clk-vexpress.c     |    8 +-------
 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/clk/versatile/clk-vexpress-osc.c +1 -0
index dcb6ae0..256c8be 100644
@@ -144,3 +144,4 @@ error:
                vexpress_config_func_put(osc->func);
        kfree(osc);
 }
+CLK_OF_DECLARE(vexpress_soc, "arm,vexpress-osc", vexpress_osc_of_setup);
drivers/clk/versatile/clk-vexpress.c +1 -7
index c742ac7..f889f2f 100644
@@ -99,19 +99,13 @@ struct clk *vexpress_sp810_of_get(struct of_phandle_args *clkspec, void *data)
        return vexpress_sp810_timerclken[clkspec->args[0]];
 }
 
-static const __initconst struct of_device_id vexpress_fixed_clk_match[] = {
-       { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-       { .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
-       {}
-};
-
 void __init vexpress_clk_of_init(void)
 {
        struct device_node *node;
        struct clk *clk;
        struct clk *refclk, *timclk;
 
-       of_clk_init(vexpress_fixed_clk_match);
+       of_clk_init(NULL);
 
        node = of_find_compatible_node(NULL, NULL, "arm,sp810");
        vexpress_sp810_init(of_iomap(node, 0));
Signature · 1 line
1.7.4.1
#21 lore raw

Re: [PATCH 7/7] clk: vexpress: Use common of_clk_init() function

Quoted 8 lines · Mike Turquette

Quoting Prashant Gaikwad (2013-01-03 23:00:58)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Pawel or Linus,

Can I get a Tested-by before I take this series into clk-next?

I'll just got back to work and will test it soon, most likely tomorrow.

Cheers!

Pawel

#22 lore raw

Re: [PATCH 7/7] clk: vexpress: Use common of_clk_init() function

In reply to Mike Turquette
Quoted 8 lines · Mike Turquette

Quoting Prashant Gaikwad (2013-01-03 23:00:58)

Quoted 3 lines

Use common of_clk_init() function for clock initialization.

Pawel or Linus,

Can I get a Tested-by before I take this series into clk-next?

For this specific patch, I don't have a vexpress board, sorry...

Yours,
Linus Walleij

Reviewed-by Tested-by on v1 1/7
#24 lore raw
In reply to Prashant Gaikwad
Quoted 9 lines · Prashant Gaikwad

Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it.

Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren.

---

Prashant-

Sorry for the late response, but I finally got a chance to give this patchset a spin on Zynq. For patches 1 and 6:

Josh

author maintainer
#25 lore raw
Quoted 14 lines · Josh Cartwright

* PGP Signed by an unknown key

Quoted 9 lines · Prashant Gaikwad

Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it.

Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren.

---

Prashant-

Quoted 7 lines

Sorry for the late response, but I finally got a chance to give this patchset a spin on Zynq. For patches 1 and 6:

Josh

Thanks Josh!!

Quoted 2 lines

* Unknown Key
* 0x846F0FA5

Acked-by on v1 1/7
#26 lore raw
In reply to Prashant Gaikwad

Hi Prashant,

Quoted 6 lines · Prashant Gaikwad

Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it.

Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren.

I finally had some time to test your changes on sunxi, and you can add for patches 1 and 3:

Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Tested-by on v1 1/7
#27 lore raw
In reply to Prashant Gaikwad
Quoted 9 lines · Prashant Gaikwad

Modify of_clk_init function so that it will determine which driver to initialize based on device tree instead of each driver registering to it.

Based on a similar patch for drivers/irqchip by Thomas Petazzoni and drivers/clocksource by Stephen Warren.

---

For this and highbank:

Quoted 97 lines
 drivers/clk/clk-fixed-rate.c      |    1 +
 drivers/clk/clk.c                 |    9 +++++++++
 include/asm-generic/vmlinux.lds.h |   10 ++++++++++
 include/linux/clk-provider.h      |    6 ++++++
 4 files changed, 26 insertions(+), 0 deletions(-)
drivers/clk/clk-fixed-rate.c +1 -0
index af78ed6..f2104df 100644
@@ -101,4 +101,5 @@ void __init of_fixed_clk_setup(struct device_node *node)
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }
 EXPORT_SYMBOL_GPL(of_fixed_clk_setup);
+CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
 #endif
drivers/clk/clk.c +9 -0
index 037b48a..fb38dd8 100644
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/device.h>
+#include <linux/init.h>
 
 static DEFINE_SPINLOCK(enable_lock);
 static DEFINE_MUTEX(prepare_lock);
@@ -1805,6 +1806,11 @@ struct of_clk_provider {
 	void *data;
 };
 
+extern struct of_device_id __clk_of_table[];
+
+static const struct of_device_id __clk_of_table_sentinel
+	__used __section(__clk_of_table_end);
+
 static LIST_HEAD(of_clk_providers);
 static DEFINE_MUTEX(of_clk_lock);
 
@@ -1933,6 +1939,9 @@ void __init of_clk_init(const struct of_device_id *matches)
 {
 	struct device_node *np;
 
+	if (!matches)
+		matches = __clk_of_table;
+
 	for_each_matching_node(np, matches) {
 		const struct of_device_id *match = of_match_node(matches, np);
 		of_clk_init_cb_t clk_init_cb = match->data;
include/asm-generic/vmlinux.lds.h +10 -0
index 1e744c5..8282f7c 100644
@@ -158,6 +158,15 @@
 #define CLKSRC_OF_TABLES()
 #endif
 
+#ifdef CONFIG_COMMON_CLK
+#define CLK_OF_TABLES() . = ALIGN(8);				\
+			VMLINUX_SYMBOL(__clk_of_table) = .;	\
+			*(__clk_of_table)			\
+			*(__clk_of_table_end)
+#else
+#define CLK_OF_TABLES()
+#endif
+
 #define KERNEL_DTB()							\
 	STRUCT_ALIGN();							\
 	VMLINUX_SYMBOL(__dtb_start) = .;				\
@@ -502,6 +511,7 @@
 	CPU_DISCARD(init.rodata)					\
 	MEM_DISCARD(init.rodata)					\
 	CLKSRC_OF_TABLES()						\
+	CLK_OF_TABLES()							\
 	KERNEL_DTB()
 
 #define INIT_TEXT							\
include/linux/clk-provider.h +6 -0
index 4989b8a..7f197d7 100644
@@ -379,7 +379,13 @@ struct clk_onecell_data {
 };
 struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
 const char *of_clk_get_parent_name(struct device_node *np, int index);
+
 void of_clk_init(const struct of_device_id *matches);
 
+#define CLK_OF_DECLARE(name, compat, fn)			\
+	static const struct of_device_id __clk_of_table_##name	\
+		__used __section(__clk_of_table)		\
+		= { .compatible = compat, .data = fn };
+
 #endif /* CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */