Commit e47bb515c57853c1f41474dae199cb033e747f66

Authored by Magnus Damm
Committed by Paul Mundt
1 parent 645e522ee0

ARM: mach-shmobile: Use shared clock framework

Teach SH-Mobile ARM how to make use of the shared SH clock
framework. This commit is one atomic switch that dumps the
local hackery and instead links in the shared clock framework
code in drivers/sh. A few local functions are kept in clock.c.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 6 changed files with 54 additions and 38 deletions Side-by-side Diff

arch/arm/mach-shmobile/Kconfig
... ... @@ -84,5 +84,8 @@
84 84  
85 85 endmenu
86 86  
  87 +config SH_CLK_CPG
  88 + bool
  89 +
87 90 endif
arch/arm/mach-shmobile/Makefile
... ... @@ -3,7 +3,7 @@
3 3 #
4 4  
5 5 # Common objects
6   -obj-y := timer.o console.o
  6 +obj-y := timer.o console.o clock.o
7 7  
8 8 # CPU objects
9 9 obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
arch/arm/mach-shmobile/clock-sh7367.c
... ... @@ -21,42 +21,8 @@
21 21 #include <linux/kernel.h>
22 22 #include <linux/list.h>
23 23 #include <linux/clk.h>
24   -
25   -struct clk {
26   - const char *name;
27   - unsigned long rate;
28   -};
29   -
  24 +#include <linux/sh_clk.h>
30 25 #include <asm/clkdev.h>
31   -
32   -int __clk_get(struct clk *clk)
33   -{
34   - return 1;
35   -}
36   -EXPORT_SYMBOL(__clk_get);
37   -
38   -void __clk_put(struct clk *clk)
39   -{
40   -}
41   -EXPORT_SYMBOL(__clk_put);
42   -
43   -
44   -int clk_enable(struct clk *clk)
45   -{
46   - return 0;
47   -}
48   -EXPORT_SYMBOL(clk_enable);
49   -
50   -void clk_disable(struct clk *clk)
51   -{
52   -}
53   -EXPORT_SYMBOL(clk_disable);
54   -
55   -unsigned long clk_get_rate(struct clk *clk)
56   -{
57   - return clk ? clk->rate : 0;
58   -}
59   -EXPORT_SYMBOL(clk_get_rate);
60 26  
61 27 /* a static peripheral clock for now - enough to get sh-sci working */
62 28 static struct clk peripheral_clk = {
arch/arm/mach-shmobile/clock.c
  1 +/*
  2 + * SH-Mobile Timer
  3 + *
  4 + * Copyright (C) 2010 Magnus Damm
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; version 2 of the License.
  9 + *
  10 + * This program is distributed in the hope that it will be useful,
  11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13 + * GNU General Public License for more details.
  14 + *
  15 + * You should have received a copy of the GNU General Public License
  16 + * along with this program; if not, write to the Free Software
  17 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18 + *
  19 + */
  20 +#include <linux/kernel.h>
  21 +#include <linux/init.h>
  22 +#include <linux/sh_clk.h>
  23 +
  24 +int __init clk_init(void)
  25 +{
  26 + /* Kick the child clocks.. */
  27 + recalculate_root_clocks();
  28 +
  29 + /* Enable the necessary init clocks */
  30 + clk_enable_init_clocks();
  31 +
  32 + return 0;
  33 +}
  34 +
  35 +int __clk_get(struct clk *clk)
  36 +{
  37 + return 1;
  38 +}
  39 +EXPORT_SYMBOL(__clk_get);
  40 +
  41 +void __clk_put(struct clk *clk)
  42 +{
  43 +}
  44 +EXPORT_SYMBOL(__clk_put);
arch/arm/mach-shmobile/include/mach/common.h
... ... @@ -4,6 +4,8 @@
4 4 extern struct sys_timer shmobile_timer;
5 5 extern void shmobile_setup_console(void);
6 6  
  7 +extern int clk_init(void);
  8 +
7 9 extern void sh7367_init_irq(void);
8 10 extern void sh7367_add_early_devices(void);
9 11 extern void sh7367_add_standard_devices(void);
1 1 #
2 2 # Makefile for the SuperH specific drivers.
3 3 #
  4 +obj-y := clk.o intc.o
  5 +
4 6 obj-$(CONFIG_SUPERHYWAY) += superhyway/
5 7 obj-$(CONFIG_MAPLE) += maple/
  8 +
6 9 obj-$(CONFIG_GENERIC_GPIO) += pfc.o
7   -obj-$(CONFIG_SUPERH) += clk.o
8 10 obj-$(CONFIG_SH_CLK_CPG) += clk-cpg.o
9   -obj-y += intc.o