aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwanzongshun <mcuos.com@gmail.com>2009-07-14 10:10:43 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-07-17 08:38:17 -0400
commitdb58e90fdbe9d12b431ae8d8e856961ce75d74f0 (patch)
tree3367a0abc6e955ecb16cbc8f33873a015b70230c
parentd2c241955095b129459985a8c02d85b70984b945 (diff)
[ARM] 5602/1: Add sub clock api for w90p910 platform
Add sub clock api for w90p910 platform. Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-w90x900/clock.c18
-rw-r--r--arch/arm/mach-w90x900/clock.h8
-rw-r--r--arch/arm/mach-w90x900/w90p910.c6
3 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index f420613cd395..49cf1fbc14eb 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -25,6 +25,8 @@
25 25
26#include "clock.h" 26#include "clock.h"
27 27
28#define SUBCLK 0x24
29
28static DEFINE_SPINLOCK(clocks_lock); 30static DEFINE_SPINLOCK(clocks_lock);
29 31
30int clk_enable(struct clk *clk) 32int clk_enable(struct clk *clk)
@@ -68,6 +70,22 @@ void w90x900_clk_enable(struct clk *clk, int enable)
68 __raw_writel(clken, W90X900_VA_CLKPWR); 70 __raw_writel(clken, W90X900_VA_CLKPWR);
69} 71}
70 72
73void w90x900_subclk_enable(struct clk *clk, int enable)
74{
75 unsigned int clocks = clk->cken;
76 unsigned long clken;
77
78 clken = __raw_readl(W90X900_VA_CLKPWR + SUBCLK);
79
80 if (enable)
81 clken |= clocks;
82 else
83 clken &= ~clocks;
84
85 __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
86}
87
88
71void clks_register(struct clk_lookup *clks, size_t num) 89void clks_register(struct clk_lookup *clks, size_t num)
72{ 90{
73 int i; 91 int i;
diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h
index 4f27bda76d56..d2f0e50a70bf 100644
--- a/arch/arm/mach-w90x900/clock.h
+++ b/arch/arm/mach-w90x900/clock.h
@@ -13,6 +13,7 @@
13#include <asm/clkdev.h> 13#include <asm/clkdev.h>
14 14
15void w90x900_clk_enable(struct clk *clk, int enable); 15void w90x900_clk_enable(struct clk *clk, int enable);
16void w90x900_subclk_enable(struct clk *clk, int enable);
16void clks_register(struct clk_lookup *clks, size_t num); 17void clks_register(struct clk_lookup *clks, size_t num);
17 18
18struct clk { 19struct clk {
@@ -27,6 +28,13 @@ struct clk clk_##_name = { \
27 .cken = (1 << _ctrlbit), \ 28 .cken = (1 << _ctrlbit), \
28 } 29 }
29 30
31#define DEFINE_SUBCLK(_name, _ctrlbit) \
32struct clk clk_##_name = { \
33 .enable = w90x900_subclk_enable, \
34 .cken = (1 << _ctrlbit), \
35 }
36
37
30#define DEF_CLKLOOK(_clk, _devname, _conname) \ 38#define DEF_CLKLOOK(_clk, _devname, _conname) \
31 { \ 39 { \
32 .clk = _clk, \ 40 .clk = _clk, \
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c
index 1c97e4930b7a..1bde69eac3df 100644
--- a/arch/arm/mach-w90x900/w90p910.c
+++ b/arch/arm/mach-w90x900/w90p910.c
@@ -57,9 +57,12 @@ static struct map_desc w90p910_iodesc[] __initdata = {
57static DEFINE_CLK(lcd, 0); 57static DEFINE_CLK(lcd, 0);
58static DEFINE_CLK(audio, 1); 58static DEFINE_CLK(audio, 1);
59static DEFINE_CLK(fmi, 4); 59static DEFINE_CLK(fmi, 4);
60static DEFINE_SUBCLK(ms, 0);
61static DEFINE_SUBCLK(sd, 1);
60static DEFINE_CLK(dmac, 5); 62static DEFINE_CLK(dmac, 5);
61static DEFINE_CLK(atapi, 6); 63static DEFINE_CLK(atapi, 6);
62static DEFINE_CLK(emc, 7); 64static DEFINE_CLK(emc, 7);
65static DEFINE_SUBCLK(rmii, 2);
63static DEFINE_CLK(usbd, 8); 66static DEFINE_CLK(usbd, 8);
64static DEFINE_CLK(usbh, 9); 67static DEFINE_CLK(usbh, 9);
65static DEFINE_CLK(g2d, 10);; 68static DEFINE_CLK(g2d, 10);;
@@ -75,9 +78,12 @@ static struct clk_lookup w90p910_clkregs[] = {
75 DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), 78 DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL),
76 DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), 79 DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL),
77 DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), 80 DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL),
81 DEF_CLKLOOK(&clk_ms, "w90p910-fmi", "MS"),
82 DEF_CLKLOOK(&clk_sd, "w90p910-fmi", "SD"),
78 DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), 83 DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL),
79 DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), 84 DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL),
80 DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), 85 DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL),
86 DEF_CLKLOOK(&clk_rmii, "w90p910-emc", "RMII"),
81 DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), 87 DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL),
82 DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), 88 DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL),
83 DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), 89 DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL),