* [PATCH 01/03] ARM: shmobile: Introduce shmobile_clk_workaround()
2014-02-24 7:29 [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Magnus Damm
@ 2014-02-24 7:29 ` Magnus Damm
2014-02-28 19:55 ` Wolfram Sang
2014-02-24 7:29 ` [PATCH 02/03] ARM: shmobile: Use shmobile_clk_workaround() on Lager Magnus Damm
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Magnus Damm @ 2014-02-24 7:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
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.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
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(-)
--- 0016/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile 2014-02-24 15:45:31.000000000 +0900
@@ -23,8 +23,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
--- 0013/arch/arm/mach-shmobile/clock.c
+++ work/arch/arm/mach-shmobile/clock.c 2014-02-24 15:56:51.000000000 +0900
@@ -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 "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 "clock.h"
@@ -58,3 +84,6 @@ void __clk_put(struct clk *clk)
{
}
EXPORT_SYMBOL(__clk_put);
+
+#endif /* CONFIG_COMMON_CLK */
+
--- 0001/arch/arm/mach-shmobile/include/mach/clock.h
+++ work/arch/arm/mach-shmobile/include/mach/clock.h 2014-02-24 15:45:31.000000000 +0900
@@ -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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 02/03] ARM: shmobile: Use shmobile_clk_workaround() on Lager
2014-02-24 7:29 [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Magnus Damm
2014-02-24 7:29 ` [PATCH 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() Magnus Damm
@ 2014-02-24 7:29 ` Magnus Damm
2014-02-24 7:30 ` [PATCH 03/03] ARM: shmobile: Use shmobile_clk_workaround() on Koelsch Magnus Damm
2014-03-07 2:05 ` [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Simon Horman
3 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2014-02-24 7:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Convert the Lager DT reference code to use the newly introduced
function shmobile_clk_workaround().
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/board-lager-reference.c | 65 +++++++++---------------
1 file changed, 25 insertions(+), 40 deletions(-)
--- 0001/arch/arm/mach-shmobile/board-lager-reference.c
+++ work/arch/arm/mach-shmobile/board-lager-reference.c 2014-02-24 16:17:32.000000000 +0900
@@ -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);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 03/03] ARM: shmobile: Use shmobile_clk_workaround() on Koelsch
2014-02-24 7:29 [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Magnus Damm
2014-02-24 7:29 ` [PATCH 01/03] ARM: shmobile: Introduce shmobile_clk_workaround() Magnus Damm
2014-02-24 7:29 ` [PATCH 02/03] ARM: shmobile: Use shmobile_clk_workaround() on Lager Magnus Damm
@ 2014-02-24 7:30 ` Magnus Damm
2014-03-07 2:05 ` [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Simon Horman
3 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2014-02-24 7:30 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Convert the Koelsch DT reference code to use the newly introduced
function shmobile_clk_workaround().
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/board-koelsch-reference.c | 71 ++++++++--------------
1 file changed, 28 insertions(+), 43 deletions(-)
--- 0001/arch/arm/mach-shmobile/board-koelsch-reference.c
+++ work/arch/arm/mach-shmobile/board-koelsch-reference.c 2014-02-24 15:50:57.000000000 +0900
@@ -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);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround
2014-02-24 7:29 [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Magnus Damm
` (2 preceding siblings ...)
2014-02-24 7:30 ` [PATCH 03/03] ARM: shmobile: Use shmobile_clk_workaround() on Koelsch Magnus Damm
@ 2014-03-07 2:05 ` Simon Horman
2014-03-11 4:11 ` Simon Horman
3 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2014-03-07 2:05 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 24, 2014 at 04:29:21PM +0900, Magnus Damm wrote:
> ARM: shmobile: Break out and extend clock workaround
>
> [PATCH 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
> will be posted shortly.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
Thanks, I have queued these up.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround
2014-03-07 2:05 ` [PATCH 00/03] ARM: shmobile: Break out and extend clock workaround Simon Horman
@ 2014-03-11 4:11 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2014-03-11 4:11 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 07, 2014 at 11:05:26AM +0900, Simon Horman wrote:
> On Mon, Feb 24, 2014 at 04:29:21PM +0900, Magnus Damm wrote:
> > ARM: shmobile: Break out and extend clock workaround
> >
> > [PATCH 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
> > will be posted shortly.
> >
> > Signed-off-by: Magnus Damm <damm@opensource.se>
>
> Thanks, I have queued these up.
It seems that the #include "clock.h" line in the
first patch of the series depends on "ARM: shmobile: Add temporary include
workaround" which I have dropped as Olof objected to it.
Accordingly I am dropping this series too.
^ permalink raw reply [flat|nested] 7+ messages in thread