aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-dove/common.c
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2012-08-15 13:07:31 -0400
committerJason Cooper <jason@lakedaemon.net>2012-09-21 13:07:20 -0400
commit521674718af0f20fada7311a74c3f8fe23767d55 (patch)
treeaf2e7c6a8d1fcedb26ad9345fffcd778511190af /arch/arm/mach-dove/common.c
parent5817d10b8b8a6003bfb7551d0c3feb92deb74ed2 (diff)
ARM: dove: add clock gating control
This patch adds clock gates from the clock gating control register available on dove. All clock gates are hooked up to tclk, except for gigabit ethernet controller (ge) which is a child of gephy to allow both enabled/disabled at the same time. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-dove/common.c')
-rw-r--r--arch/arm/mach-dove/common.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 8629e3043acd..38e2cc3b206b 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -24,6 +24,7 @@
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
26#include <mach/dove.h> 26#include <mach/dove.h>
27#include <mach/pm.h>
27#include <mach/bridge-regs.h> 28#include <mach/bridge-regs.h>
28#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
29#include <linux/irq.h> 30#include <linux/irq.h>
@@ -69,14 +70,68 @@ void __init dove_map_io(void)
69 * CLK tree 70 * CLK tree
70 ****************************************************************************/ 71 ****************************************************************************/
71static int dove_tclk; 72static int dove_tclk;
73
74static DEFINE_SPINLOCK(gating_lock);
72static struct clk *tclk; 75static struct clk *tclk;
73 76
77static struct clk __init *dove_register_gate(const char *name,
78 const char *parent, u8 bit_idx)
79{
80 return clk_register_gate(NULL, name, parent, 0,
81 (void __iomem *)CLOCK_GATING_CONTROL,
82 bit_idx, 0, &gating_lock);
83}
84
74static void __init dove_clk_init(void) 85static void __init dove_clk_init(void)
75{ 86{
87 struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
88 struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
89 struct clk *xor0, *xor1, *ge, *gephy;
90
76 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, 91 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
77 dove_tclk); 92 dove_tclk);
78 93
79 orion_clkdev_init(tclk); 94 usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
95 usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
96 sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
97 pex0 = dove_register_gate("pex0", "tclk", CLOCK_GATING_BIT_PCIE0);
98 pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
99 sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
100 sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
101 nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
102 camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
103 i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
104 i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
105 crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
106 ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
107 pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
108 xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
109 xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
110 gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
111 ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
112
113 orion_clkdev_add(NULL, "orion_spi.0", tclk);
114 orion_clkdev_add(NULL, "orion_spi.1", tclk);
115 orion_clkdev_add(NULL, "orion_wdt", tclk);
116 orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
117
118 orion_clkdev_add(NULL, "orion-ehci.0", usb0);
119 orion_clkdev_add(NULL, "orion-ehci.1", usb1);
120 orion_clkdev_add(NULL, "mv643xx_eth.0", ge);
121 orion_clkdev_add("0", "sata_mv.0", sata);
122 orion_clkdev_add("0", "pcie", pex0);
123 orion_clkdev_add("1", "pcie", pex1);
124 orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
125 orion_clkdev_add(NULL, "sdhci-dove.1", sdio1);
126 orion_clkdev_add(NULL, "orion_nand", nand);
127 orion_clkdev_add(NULL, "cafe1000-ccic.0", camera);
128 orion_clkdev_add(NULL, "kirkwood-i2s.0", i2s0);
129 orion_clkdev_add(NULL, "kirkwood-i2s.1", i2s1);
130 orion_clkdev_add(NULL, "mv_crypto", crypto);
131 orion_clkdev_add(NULL, "dove-ac97", ac97);
132 orion_clkdev_add(NULL, "dove-pdma", pdma);
133 orion_clkdev_add(NULL, "mv_xor_shared.0", xor0);
134 orion_clkdev_add(NULL, "mv_xor_shared.1", xor1);
80} 135}
81 136
82/***************************************************************************** 137/*****************************************************************************