diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-10 22:15:45 +0100 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 10:01:38 +0100 |
commit | 5f3d1092a949b33d01c95b7f5e5a83672629f131 (patch) | |
tree | 538bea4efeec3c2900a1ca2205d8dca6ea9e3c7b /arch/arm/plat-mxc/devices | |
parent | 224b8c83641c2f31e3efc9bc5956636cc42cadf7 (diff) | |
download | blackbird-op-linux-5f3d1092a949b33d01c95b7f5e5a83672629f131.tar.gz blackbird-op-linux-5f3d1092a949b33d01c95b7f5e5a83672629f131.zip |
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 @@ #include <mach/hardware.h> #include <mach/devices-common.h> -#define imx_mxc_pwm_data_entry_single(soc) \ +#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \ { \ - .iobase = soc ## _PWM_BASE_ADDR, \ - .irq = soc ## _INT_PWM, \ + .id = _id, \ + .iobase = soc ## _PWM ## _hwid ## _BASE_ADDR, \ + .iosize = _size, \ + .irq = soc ## _INT_PWM ## _hwid, \ } +#define imx_mxc_pwm_data_entry(soc, _id, _hwid, _size) \ + [_id] = imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) #ifdef CONFIG_SOC_IMX21 const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst = - imx_mxc_pwm_data_entry_single(MX21); + imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K); #endif /* ifdef CONFIG_SOC_IMX21 */ +#ifdef CONFIG_ARCH_MX25 +const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = { +#define imx25_mxc_pwm_data_entry(_id, _hwid) \ + imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K) + imx25_mxc_pwm_data_entry(0, 1), + imx25_mxc_pwm_data_entry(1, 2), + imx25_mxc_pwm_data_entry(2, 3), + imx25_mxc_pwm_data_entry(3, 4), +}; +#endif + #ifdef CONFIG_SOC_IMX27 const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst = - imx_mxc_pwm_data_entry_single(MX27); + imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K); #endif /* ifdef CONFIG_SOC_IMX27 */ struct platform_device *__init imx_add_mxc_pwm( @@ -31,7 +46,7 @@ struct platform_device *__init imx_add_mxc_pwm( struct resource res[] = { { .start = data->iobase, - .end = data->iobase + SZ_4K - 1, + .end = data->iobase + data->iosize - 1, .flags = IORESOURCE_MEM, }, { .start = data->irq, @@ -40,6 +55,6 @@ struct platform_device *__init imx_add_mxc_pwm( }, }; - return imx_add_platform_device("mxc_pwm", 0, + return imx_add_platform_device("mxc_pwm", data->id, res, ARRAY_SIZE(res), NULL, 0); } |