diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-10 16:15:45 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:38 -0500 |
commit | 5f3d1092a949b33d01c95b7f5e5a83672629f131 (patch) | |
tree | 538bea4efeec3c2900a1ca2205d8dca6ea9e3c7b /arch/arm/plat-mxc/devices | |
parent | 224b8c83641c2f31e3efc9bc5956636cc42cadf7 (diff) |
ARM: mx25: dynamically allocate mxc_pwm devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/devices')
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c index 3ebbc671638c..5a47d1e8553e 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c | |||
@@ -9,20 +9,35 @@ | |||
9 | #include <mach/hardware.h> | 9 | #include <mach/hardware.h> |
10 | #include <mach/devices-common.h> | 10 | #include <mach/devices-common.h> |
11 | 11 | ||
12 | #define imx_mxc_pwm_data_entry_single(soc) \ | 12 | #define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \ |
13 | { \ | 13 | { \ |
14 | .iobase = soc ## _PWM_BASE_ADDR, \ | 14 | .id = _id, \ |
15 | .irq = soc ## _INT_PWM, \ | 15 | .iobase = soc ## _PWM ## _hwid ## _BASE_ADDR, \ |
16 | .iosize = _size, \ | ||
17 | .irq = soc ## _INT_PWM ## _hwid, \ | ||
16 | } | 18 | } |
19 | #define imx_mxc_pwm_data_entry(soc, _id, _hwid, _size) \ | ||
20 | [_id] = imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) | ||
17 | 21 | ||
18 | #ifdef CONFIG_SOC_IMX21 | 22 | #ifdef CONFIG_SOC_IMX21 |
19 | const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst = | 23 | const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst = |
20 | imx_mxc_pwm_data_entry_single(MX21); | 24 | imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K); |
21 | #endif /* ifdef CONFIG_SOC_IMX21 */ | 25 | #endif /* ifdef CONFIG_SOC_IMX21 */ |
22 | 26 | ||
27 | #ifdef CONFIG_ARCH_MX25 | ||
28 | const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = { | ||
29 | #define imx25_mxc_pwm_data_entry(_id, _hwid) \ | ||
30 | imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K) | ||
31 | imx25_mxc_pwm_data_entry(0, 1), | ||
32 | imx25_mxc_pwm_data_entry(1, 2), | ||
33 | imx25_mxc_pwm_data_entry(2, 3), | ||
34 | imx25_mxc_pwm_data_entry(3, 4), | ||
35 | }; | ||
36 | #endif | ||
37 | |||
23 | #ifdef CONFIG_SOC_IMX27 | 38 | #ifdef CONFIG_SOC_IMX27 |
24 | const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst = | 39 | const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst = |
25 | imx_mxc_pwm_data_entry_single(MX27); | 40 | imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K); |
26 | #endif /* ifdef CONFIG_SOC_IMX27 */ | 41 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
27 | 42 | ||
28 | struct platform_device *__init imx_add_mxc_pwm( | 43 | struct platform_device *__init imx_add_mxc_pwm( |
@@ -31,7 +46,7 @@ struct platform_device *__init imx_add_mxc_pwm( | |||
31 | struct resource res[] = { | 46 | struct resource res[] = { |
32 | { | 47 | { |
33 | .start = data->iobase, | 48 | .start = data->iobase, |
34 | .end = data->iobase + SZ_4K - 1, | 49 | .end = data->iobase + data->iosize - 1, |
35 | .flags = IORESOURCE_MEM, | 50 | .flags = IORESOURCE_MEM, |
36 | }, { | 51 | }, { |
37 | .start = data->irq, | 52 | .start = data->irq, |
@@ -40,6 +55,6 @@ struct platform_device *__init imx_add_mxc_pwm( | |||
40 | }, | 55 | }, |
41 | }; | 56 | }; |
42 | 57 | ||
43 | return imx_add_platform_device("mxc_pwm", 0, | 58 | return imx_add_platform_device("mxc_pwm", data->id, |
44 | res, ARRAY_SIZE(res), NULL, 0); | 59 | res, ARRAY_SIZE(res), NULL, 0); |
45 | } | 60 | } |