diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-12-28 05:46:03 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-12-28 05:46:03 -0500 |
commit | 15db3e823c3246e3bd31fe454f5c8927eb85caf2 (patch) | |
tree | f91811c5872ede20ec86f4256a9f60befa6b8a61 /arch/arm | |
parent | d7bd1b8a6104bcdc53611689fec8715a236a22c8 (diff) | |
parent | edf3ff5bac2582b57de4e7c6569fee5d7c1c0a42 (diff) |
Merge branch 'drivers/rtc-sa1100' into next/drivers
* drivers/rtc-sa1100:
ARM: sa1100: clean up of the clock support
ARM: pxa: add dummy clock for sa1100-rtc
RTC: sa1100: support sa1100, pxa and mmp soc families
RTC: sa1100: remove redundant code of setting alarm
RTC: sa1100: Clean out ost register
Conflicts:
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/devices.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa25x.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa300.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa320.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa95x.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/clock.c | 91 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 20 |
10 files changed, 113 insertions, 26 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b8c69726839c..34d13ff3901c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -741,7 +741,7 @@ config ARCH_SA1100 | |||
741 | select ARCH_HAS_CPUFREQ | 741 | select ARCH_HAS_CPUFREQ |
742 | select CPU_FREQ | 742 | select CPU_FREQ |
743 | select GENERIC_CLOCKEVENTS | 743 | select GENERIC_CLOCKEVENTS |
744 | select HAVE_CLK | 744 | select CLKDEV_LOOKUP |
745 | select HAVE_SCHED_CLOCK | 745 | select HAVE_SCHED_CLOCK |
746 | select TICK_ONESHOT | 746 | select TICK_ONESHOT |
747 | select ARCH_REQUIRE_GPIOLIB | 747 | select ARCH_REQUIRE_GPIOLIB |
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 5bc13121eac5..18fd177073f4 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -415,9 +415,29 @@ static struct resource pxa_rtc_resources[] = { | |||
415 | }, | 415 | }, |
416 | }; | 416 | }; |
417 | 417 | ||
418 | static struct resource sa1100_rtc_resources[] = { | ||
419 | [0] = { | ||
420 | .start = 0x40900000, | ||
421 | .end = 0x409000ff, | ||
422 | .flags = IORESOURCE_MEM, | ||
423 | }, | ||
424 | [1] = { | ||
425 | .start = IRQ_RTC1Hz, | ||
426 | .end = IRQ_RTC1Hz, | ||
427 | .flags = IORESOURCE_IRQ, | ||
428 | }, | ||
429 | [2] = { | ||
430 | .start = IRQ_RTCAlrm, | ||
431 | .end = IRQ_RTCAlrm, | ||
432 | .flags = IORESOURCE_IRQ, | ||
433 | }, | ||
434 | }; | ||
435 | |||
418 | struct platform_device sa1100_device_rtc = { | 436 | struct platform_device sa1100_device_rtc = { |
419 | .name = "sa1100-rtc", | 437 | .name = "sa1100-rtc", |
420 | .id = -1, | 438 | .id = -1, |
439 | .num_resources = ARRAY_SIZE(sa1100_rtc_resources), | ||
440 | .resource = sa1100_rtc_resources, | ||
421 | }; | 441 | }; |
422 | 442 | ||
423 | struct platform_device pxa_device_rtc = { | 443 | struct platform_device pxa_device_rtc = { |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 8a775f631c55..adf058fa97ee 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -210,6 +210,7 @@ static struct clk_lookup pxa25x_clkregs[] = { | |||
210 | INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), | 210 | INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), |
211 | INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), | 211 | INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), |
212 | INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), | 212 | INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), |
213 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
213 | }; | 214 | }; |
214 | 215 | ||
215 | static struct clk_lookup pxa25x_hwuart_clkreg = | 216 | static struct clk_lookup pxa25x_hwuart_clkreg = |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 6c49e66057e3..180bd8675d4b 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -231,6 +231,7 @@ static struct clk_lookup pxa27x_clkregs[] = { | |||
231 | INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), | 231 | INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), |
232 | INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), | 232 | INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), |
233 | INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), | 233 | INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), |
234 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
234 | }; | 235 | }; |
235 | 236 | ||
236 | #ifdef CONFIG_PM | 237 | #ifdef CONFIG_PM |
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c index 40bb16501d86..0388eda7878a 100644 --- a/arch/arm/mach-pxa/pxa300.c +++ b/arch/arm/mach-pxa/pxa300.c | |||
@@ -89,6 +89,7 @@ static DEFINE_PXA3_CKEN(gcu, PXA300_GCU, 0, 0); | |||
89 | static struct clk_lookup common_clkregs[] = { | 89 | static struct clk_lookup common_clkregs[] = { |
90 | INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", NULL), | 90 | INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", NULL), |
91 | INIT_CLKREG(&clk_gcu, "pxa3xx-gcu", NULL), | 91 | INIT_CLKREG(&clk_gcu, "pxa3xx-gcu", NULL), |
92 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | static DEFINE_PXA3_CKEN(pxa310_mmc3, MMC3, 19500000, 0); | 95 | static DEFINE_PXA3_CKEN(pxa310_mmc3, MMC3, 19500000, 0); |
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c index 8d614ecd8e99..d487e1ff4c9a 100644 --- a/arch/arm/mach-pxa/pxa320.c +++ b/arch/arm/mach-pxa/pxa320.c | |||
@@ -83,6 +83,7 @@ static DEFINE_PXA3_CKEN(gcu, PXA320_GCU, 0, 0); | |||
83 | static struct clk_lookup pxa320_clkregs[] = { | 83 | static struct clk_lookup pxa320_clkregs[] = { |
84 | INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", NULL), | 84 | INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", NULL), |
85 | INIT_CLKREG(&clk_gcu, "pxa3xx-gcu", NULL), | 85 | INIT_CLKREG(&clk_gcu, "pxa3xx-gcu", NULL), |
86 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
86 | }; | 87 | }; |
87 | 88 | ||
88 | static int __init pxa320_init(void) | 89 | static int __init pxa320_init(void) |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 4f402afa6609..f107c71c7589 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -67,6 +67,7 @@ static struct clk_lookup pxa3xx_clkregs[] = { | |||
67 | INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"), | 67 | INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"), |
68 | /* Power I2C clock is always on */ | 68 | /* Power I2C clock is always on */ |
69 | INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL), | 69 | INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL), |
70 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
70 | INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL), | 71 | INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL), |
71 | INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"), | 72 | INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"), |
72 | INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"), | 73 | INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"), |
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c index d082a583df78..fccc644702e6 100644 --- a/arch/arm/mach-pxa/pxa95x.c +++ b/arch/arm/mach-pxa/pxa95x.c | |||
@@ -217,6 +217,7 @@ static struct clk_lookup pxa95x_clkregs[] = { | |||
217 | INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"), | 217 | INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"), |
218 | /* Power I2C clock is always on */ | 218 | /* Power I2C clock is always on */ |
219 | INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL), | 219 | INIT_CLKREG(&clk_dummy, "pxa3xx-pwri2c.1", NULL), |
220 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
220 | INIT_CLKREG(&clk_pxa95x_lcd, "pxa2xx-fb", NULL), | 221 | INIT_CLKREG(&clk_pxa95x_lcd, "pxa2xx-fb", NULL), |
221 | INIT_CLKREG(&clk_pxa95x_ffuart, "pxa2xx-uart.0", NULL), | 222 | INIT_CLKREG(&clk_pxa95x_ffuart, "pxa2xx-uart.0", NULL), |
222 | INIT_CLKREG(&clk_pxa95x_btuart, "pxa2xx-uart.1", NULL), | 223 | INIT_CLKREG(&clk_pxa95x_btuart, "pxa2xx-uart.1", NULL), |
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index dab3c6347a8f..d6df9f6c9f7e 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -11,17 +11,39 @@ | |||
11 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
14 | #include <linux/io.h> | ||
15 | #include <linux/clkdev.h> | ||
14 | 16 | ||
15 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
16 | 18 | ||
17 | /* | 19 | struct clkops { |
18 | * Very simple clock implementation - we only have one clock to deal with. | 20 | void (*enable)(struct clk *); |
19 | */ | 21 | void (*disable)(struct clk *); |
22 | unsigned long (*getrate)(struct clk *); | ||
23 | }; | ||
24 | |||
20 | struct clk { | 25 | struct clk { |
26 | const struct clkops *ops; | ||
27 | unsigned long rate; | ||
21 | unsigned int enabled; | 28 | unsigned int enabled; |
22 | }; | 29 | }; |
23 | 30 | ||
24 | static void clk_gpio27_enable(void) | 31 | #define INIT_CLKREG(_clk, _devname, _conname) \ |
32 | { \ | ||
33 | .clk = _clk, \ | ||
34 | .dev_id = _devname, \ | ||
35 | .con_id = _conname, \ | ||
36 | } | ||
37 | |||
38 | #define DEFINE_CLK(_name, _ops, _rate) \ | ||
39 | struct clk clk_##_name = { \ | ||
40 | .ops = _ops, \ | ||
41 | .rate = _rate, \ | ||
42 | } | ||
43 | |||
44 | static DEFINE_SPINLOCK(clocks_lock); | ||
45 | |||
46 | static void clk_gpio27_enable(struct clk *clk) | ||
25 | { | 47 | { |
26 | /* | 48 | /* |
27 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: | 49 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: |
@@ -32,38 +54,22 @@ static void clk_gpio27_enable(void) | |||
32 | TUCR = TUCR_3_6864MHz; | 54 | TUCR = TUCR_3_6864MHz; |
33 | } | 55 | } |
34 | 56 | ||
35 | static void clk_gpio27_disable(void) | 57 | static void clk_gpio27_disable(struct clk *clk) |
36 | { | 58 | { |
37 | TUCR = 0; | 59 | TUCR = 0; |
38 | GPDR &= ~GPIO_32_768kHz; | 60 | GPDR &= ~GPIO_32_768kHz; |
39 | GAFR &= ~GPIO_32_768kHz; | 61 | GAFR &= ~GPIO_32_768kHz; |
40 | } | 62 | } |
41 | 63 | ||
42 | static struct clk clk_gpio27; | ||
43 | |||
44 | static DEFINE_SPINLOCK(clocks_lock); | ||
45 | |||
46 | struct clk *clk_get(struct device *dev, const char *id) | ||
47 | { | ||
48 | const char *devname = dev_name(dev); | ||
49 | |||
50 | return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27; | ||
51 | } | ||
52 | EXPORT_SYMBOL(clk_get); | ||
53 | |||
54 | void clk_put(struct clk *clk) | ||
55 | { | ||
56 | } | ||
57 | EXPORT_SYMBOL(clk_put); | ||
58 | |||
59 | int clk_enable(struct clk *clk) | 64 | int clk_enable(struct clk *clk) |
60 | { | 65 | { |
61 | unsigned long flags; | 66 | unsigned long flags; |
62 | 67 | ||
63 | spin_lock_irqsave(&clocks_lock, flags); | 68 | spin_lock_irqsave(&clocks_lock, flags); |
64 | if (clk->enabled++ == 0) | 69 | if (clk->enabled++ == 0) |
65 | clk_gpio27_enable(); | 70 | clk->ops->enable(clk); |
66 | spin_unlock_irqrestore(&clocks_lock, flags); | 71 | spin_unlock_irqrestore(&clocks_lock, flags); |
72 | |||
67 | return 0; | 73 | return 0; |
68 | } | 74 | } |
69 | EXPORT_SYMBOL(clk_enable); | 75 | EXPORT_SYMBOL(clk_enable); |
@@ -76,13 +82,48 @@ void clk_disable(struct clk *clk) | |||
76 | 82 | ||
77 | spin_lock_irqsave(&clocks_lock, flags); | 83 | spin_lock_irqsave(&clocks_lock, flags); |
78 | if (--clk->enabled == 0) | 84 | if (--clk->enabled == 0) |
79 | clk_gpio27_disable(); | 85 | clk->ops->disable(clk); |
80 | spin_unlock_irqrestore(&clocks_lock, flags); | 86 | spin_unlock_irqrestore(&clocks_lock, flags); |
81 | } | 87 | } |
82 | EXPORT_SYMBOL(clk_disable); | 88 | EXPORT_SYMBOL(clk_disable); |
83 | 89 | ||
84 | unsigned long clk_get_rate(struct clk *clk) | 90 | unsigned long clk_get_rate(struct clk *clk) |
85 | { | 91 | { |
86 | return 3686400; | 92 | unsigned long rate; |
93 | |||
94 | rate = clk->rate; | ||
95 | if (clk->ops->getrate) | ||
96 | rate = clk->ops->getrate(clk); | ||
97 | |||
98 | return rate; | ||
87 | } | 99 | } |
88 | EXPORT_SYMBOL(clk_get_rate); | 100 | EXPORT_SYMBOL(clk_get_rate); |
101 | |||
102 | const struct clkops clk_gpio27_ops = { | ||
103 | .enable = clk_gpio27_enable, | ||
104 | .disable = clk_gpio27_disable, | ||
105 | }; | ||
106 | |||
107 | static void clk_dummy_enable(struct clk *clk) { } | ||
108 | static void clk_dummy_disable(struct clk *clk) { } | ||
109 | |||
110 | const struct clkops clk_dummy_ops = { | ||
111 | .enable = clk_dummy_enable, | ||
112 | .disable = clk_dummy_disable, | ||
113 | }; | ||
114 | |||
115 | static DEFINE_CLK(gpio27, &clk_gpio27_ops, 3686400); | ||
116 | static DEFINE_CLK(dummy, &clk_dummy_ops, 0); | ||
117 | |||
118 | static struct clk_lookup sa11xx_clkregs[] = { | ||
119 | INIT_CLKREG(&clk_gpio27, "sa1111.0", NULL), | ||
120 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
121 | }; | ||
122 | |||
123 | static int __init sa11xx_clk_init(void) | ||
124 | { | ||
125 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | postcore_initcall(sa11xx_clk_init); | ||
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 5fa5ae1f39e1..3eff179d4fd7 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -334,9 +334,29 @@ void sa11x0_register_irda(struct irda_platform_data *irda) | |||
334 | sa11x0_register_device(&sa11x0ir_device, irda); | 334 | sa11x0_register_device(&sa11x0ir_device, irda); |
335 | } | 335 | } |
336 | 336 | ||
337 | static struct resource sa11x0rtc_resources[] = { | ||
338 | [0] = { | ||
339 | .start = 0x90010000, | ||
340 | .end = 0x900100ff, | ||
341 | .flags = IORESOURCE_MEM, | ||
342 | }, | ||
343 | [1] = { | ||
344 | .start = IRQ_RTC1Hz, | ||
345 | .end = IRQ_RTC1Hz, | ||
346 | .flags = IORESOURCE_IRQ, | ||
347 | }, | ||
348 | [2] = { | ||
349 | .start = IRQ_RTCAlrm, | ||
350 | .end = IRQ_RTCAlrm, | ||
351 | .flags = IORESOURCE_IRQ, | ||
352 | }, | ||
353 | }; | ||
354 | |||
337 | static struct platform_device sa11x0rtc_device = { | 355 | static struct platform_device sa11x0rtc_device = { |
338 | .name = "sa1100-rtc", | 356 | .name = "sa1100-rtc", |
339 | .id = -1, | 357 | .id = -1, |
358 | .resource = sa11x0rtc_resources, | ||
359 | .num_resources = ARRAY_SIZE(sa11x0rtc_resources), | ||
340 | }; | 360 | }; |
341 | 361 | ||
342 | static struct platform_device *sa11x0_devices[] __initdata = { | 362 | static struct platform_device *sa11x0_devices[] __initdata = { |