diff options
author | Banajit Goswami <banajit.g@samsung.com> | 2011-02-28 11:54:51 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-03-02 20:09:58 -0500 |
commit | 2ce30137094969123a8846ca4f68c2628ea4a658 (patch) | |
tree | d9bd096eedc9cb8b4d977c0342b8aa60d709925b | |
parent | dd9c1549edef02290edced639f67b54a25abbe0e (diff) |
ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung
This patch does the following:-
1. It moves file pwm.c from plat-s3c24xx to plat-samsung. This will
enable all machines with Samsung SoCs to make use of the same code.
2. The device definitions have been separated to a new file dev-pwm.c
for better clarity and structure.
3. It will enable all Samsung S3C and S5P series SoC's to use common
PWM Kconfig definition.
Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r-- | arch/arm/mach-s3c64xx/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 13 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-pwm.c | 53 | ||||
-rw-r--r-- | arch/arm/plat-samsung/pwm.c | 33 |
6 files changed, 69 insertions, 42 deletions
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 579d2f0f4dd0..f3a953f02dd6 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -231,7 +231,7 @@ config MACH_HMT | |||
231 | select S3C_DEV_NAND | 231 | select S3C_DEV_NAND |
232 | select S3C_DEV_USB_HOST | 232 | select S3C_DEV_USB_HOST |
233 | select S3C64XX_SETUP_FB_24BPP | 233 | select S3C64XX_SETUP_FB_24BPP |
234 | select HAVE_PWM | 234 | select SAMSUNG_DEV_PWM |
235 | help | 235 | help |
236 | Machine support for the Airgoo HMT | 236 | Machine support for the Airgoo HMT |
237 | 237 | ||
@@ -249,8 +249,8 @@ config MACH_SMARTQ | |||
249 | select S3C64XX_SETUP_SDHCI | 249 | select S3C64XX_SETUP_SDHCI |
250 | select S3C64XX_SETUP_FB_24BPP | 250 | select S3C64XX_SETUP_FB_24BPP |
251 | select SAMSUNG_DEV_ADC | 251 | select SAMSUNG_DEV_ADC |
252 | select SAMSUNG_DEV_PWM | ||
252 | select SAMSUNG_DEV_TS | 253 | select SAMSUNG_DEV_TS |
253 | select HAVE_PWM | ||
254 | help | 254 | help |
255 | Shared machine support for SmartQ 5/7 | 255 | Shared machine support for SmartQ 5/7 |
256 | 256 | ||
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index eb105e61c746..d9c4096ebf45 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig | |||
@@ -56,13 +56,6 @@ config S3C24XX_DCLK | |||
56 | help | 56 | help |
57 | Clock code for supporting DCLK/CLKOUT on S3C24XX architectures | 57 | Clock code for supporting DCLK/CLKOUT on S3C24XX architectures |
58 | 58 | ||
59 | config S3C24XX_PWM | ||
60 | bool "PWM device support" | ||
61 | select HAVE_PWM | ||
62 | help | ||
63 | Support for exporting the PWM timer blocks via the pwm device | ||
64 | system. | ||
65 | |||
66 | # gpio configurations | 59 | # gpio configurations |
67 | 60 | ||
68 | config S3C24XX_GPIO_EXTRA | 61 | config S3C24XX_GPIO_EXTRA |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 32be05cf82a3..be72100b81b4 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -273,6 +273,19 @@ config SAMSUNG_DEV_KEYPAD | |||
273 | help | 273 | help |
274 | Compile in platform device definitions for keypad | 274 | Compile in platform device definitions for keypad |
275 | 275 | ||
276 | config SAMSUNG_DEV_PWM | ||
277 | bool | ||
278 | default y if ARCH_S3C2410 | ||
279 | help | ||
280 | Compile in platform device definition for PWM Timer | ||
281 | |||
282 | config S3C24XX_PWM | ||
283 | bool "PWM device support" | ||
284 | select HAVE_PWM | ||
285 | help | ||
286 | Support for exporting the PWM timer blocks via the pwm device | ||
287 | system | ||
288 | |||
276 | # DMA | 289 | # DMA |
277 | 290 | ||
278 | config S3C_DMA | 291 | config S3C_DMA |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 29932f88a8d6..e9de58a2e294 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o | |||
59 | obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o | 59 | obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o |
60 | obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o | 60 | obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o |
61 | obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o | 61 | obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o |
62 | obj-$(CONFIG_SAMSUNG_DEV_PWM) += dev-pwm.o | ||
62 | 63 | ||
63 | # DMA support | 64 | # DMA support |
64 | 65 | ||
diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c new file mode 100644 index 000000000000..dab47b0e1900 --- /dev/null +++ b/arch/arm/plat-samsung/dev-pwm.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* linux/arch/arm/plat-samsung/dev-pwm.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright (c) 2007 Ben Dooks | ||
7 | * Copyright (c) 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org> | ||
9 | * | ||
10 | * S3C series device definition for the PWM timer | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | #include <mach/irqs.h> | ||
21 | |||
22 | #include <plat/devs.h> | ||
23 | |||
24 | #define TIMER_RESOURCE_SIZE (1) | ||
25 | |||
26 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
27 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
28 | [0] = { \ | ||
29 | .start = _irq, \ | ||
30 | .end = _irq, \ | ||
31 | .flags = IORESOURCE_IRQ \ | ||
32 | } \ | ||
33 | } | ||
34 | |||
35 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
36 | .name = "s3c24xx-pwm", \ | ||
37 | .id = _tmr_no, \ | ||
38 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
39 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
40 | |||
41 | /* | ||
42 | * since we already have an static mapping for the timer, | ||
43 | * we do not bother setting any IO resource for the base. | ||
44 | */ | ||
45 | |||
46 | struct platform_device s3c_device_timer[] = { | ||
47 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
48 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
49 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
50 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
51 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
52 | }; | ||
53 | EXPORT_SYMBOL(s3c_device_timer); | ||
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c index 2eeb49fa056d..f37457c52064 100644 --- a/arch/arm/plat-samsung/pwm.c +++ b/arch/arm/plat-samsung/pwm.c | |||
@@ -20,10 +20,8 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/pwm.h> | 21 | #include <linux/pwm.h> |
22 | 22 | ||
23 | #include <mach/irqs.h> | ||
24 | #include <mach/map.h> | 23 | #include <mach/map.h> |
25 | 24 | ||
26 | #include <plat/devs.h> | ||
27 | #include <plat/regs-timer.h> | 25 | #include <plat/regs-timer.h> |
28 | 26 | ||
29 | struct pwm_device { | 27 | struct pwm_device { |
@@ -47,37 +45,6 @@ struct pwm_device { | |||
47 | 45 | ||
48 | static struct clk *clk_scaler[2]; | 46 | static struct clk *clk_scaler[2]; |
49 | 47 | ||
50 | /* Standard setup for a timer block. */ | ||
51 | |||
52 | #define TIMER_RESOURCE_SIZE (1) | ||
53 | |||
54 | #define TIMER_RESOURCE(_tmr, _irq) \ | ||
55 | (struct resource [TIMER_RESOURCE_SIZE]) { \ | ||
56 | [0] = { \ | ||
57 | .start = _irq, \ | ||
58 | .end = _irq, \ | ||
59 | .flags = IORESOURCE_IRQ \ | ||
60 | } \ | ||
61 | } | ||
62 | |||
63 | #define DEFINE_S3C_TIMER(_tmr_no, _irq) \ | ||
64 | .name = "s3c24xx-pwm", \ | ||
65 | .id = _tmr_no, \ | ||
66 | .num_resources = TIMER_RESOURCE_SIZE, \ | ||
67 | .resource = TIMER_RESOURCE(_tmr_no, _irq), \ | ||
68 | |||
69 | /* since we already have an static mapping for the timer, we do not | ||
70 | * bother setting any IO resource for the base. | ||
71 | */ | ||
72 | |||
73 | struct platform_device s3c_device_timer[] = { | ||
74 | [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, | ||
75 | [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, | ||
76 | [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, | ||
77 | [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, | ||
78 | [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, | ||
79 | }; | ||
80 | |||
81 | static inline int pwm_is_tdiv(struct pwm_device *pwm) | 48 | static inline int pwm_is_tdiv(struct pwm_device *pwm) |
82 | { | 49 | { |
83 | return clk_get_parent(pwm->clk) == pwm->clk_div; | 50 | return clk_get_parent(pwm->clk) == pwm->clk_div; |