diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-04 05:09:10 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:25 -0500 |
commit | e0a1961df8ad898b661cf0adcf3519254f135a44 (patch) | |
tree | bc663100b851b8cf06157fa6a967393bef39a8a9 | |
parent | b2997cb12b302ee6d233808e32214d00afdcf128 (diff) |
ARM: imx: dynamically allocate imx2-wdt devices
Currently there is no platform data used in the driver. In case this
changes and for consistency NULL is passed unused to the soc specific
functions.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx21.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx27.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-cpuimx27.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-pca100.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-pcm038.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-imx2-wdt.c | 40 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 6 |
12 files changed, 64 insertions, 24 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index edf018211002..6b1662c55a5d 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -95,6 +95,7 @@ config MACH_MX27ADS | |||
95 | 95 | ||
96 | config MACH_PCM038 | 96 | config MACH_PCM038 |
97 | bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" | 97 | bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" |
98 | select IMX_HAVE_PLATFORM_IMX2_WDT | ||
98 | select IMX_HAVE_PLATFORM_IMX_I2C | 99 | select IMX_HAVE_PLATFORM_IMX_I2C |
99 | select IMX_HAVE_PLATFORM_IMX_UART | 100 | select IMX_HAVE_PLATFORM_IMX_UART |
100 | select IMX_HAVE_PLATFORM_MXC_NAND | 101 | select IMX_HAVE_PLATFORM_MXC_NAND |
@@ -121,6 +122,7 @@ endchoice | |||
121 | 122 | ||
122 | config MACH_CPUIMX27 | 123 | config MACH_CPUIMX27 |
123 | bool "Eukrea CPUIMX27 module" | 124 | bool "Eukrea CPUIMX27 module" |
125 | select IMX_HAVE_PLATFORM_IMX2_WDT | ||
124 | select IMX_HAVE_PLATFORM_IMX_I2C | 126 | select IMX_HAVE_PLATFORM_IMX_I2C |
125 | select IMX_HAVE_PLATFORM_IMX_UART | 127 | select IMX_HAVE_PLATFORM_IMX_UART |
126 | select IMX_HAVE_PLATFORM_MXC_NAND | 128 | select IMX_HAVE_PLATFORM_MXC_NAND |
@@ -185,6 +187,7 @@ config MACH_IMX27LITE | |||
185 | 187 | ||
186 | config MACH_PCA100 | 188 | config MACH_PCA100 |
187 | bool "Phytec phyCARD-s (pca100)" | 189 | bool "Phytec phyCARD-s (pca100)" |
190 | select IMX_HAVE_PLATFORM_IMX2_WDT | ||
188 | select IMX_HAVE_PLATFORM_IMX_I2C | 191 | select IMX_HAVE_PLATFORM_IMX_I2C |
189 | select IMX_HAVE_PLATFORM_IMX_SSI | 192 | select IMX_HAVE_PLATFORM_IMX_SSI |
190 | select IMX_HAVE_PLATFORM_IMX_UART | 193 | select IMX_HAVE_PLATFORM_IMX_UART |
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h index 61b0aa7fce98..738dbba6032e 100644 --- a/arch/arm/mach-imx/devices-imx21.h +++ b/arch/arm/mach-imx/devices-imx21.h | |||
@@ -9,6 +9,10 @@ | |||
9 | #include <mach/mx21.h> | 9 | #include <mach/mx21.h> |
10 | #include <mach/devices-common.h> | 10 | #include <mach/devices-common.h> |
11 | 11 | ||
12 | extern const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst; | ||
13 | #define imx21_add_imx2_wdt(pdata) \ | ||
14 | imx_add_imx2_wdt(&imx21_imx2_wdt_data) | ||
15 | |||
12 | extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst; | 16 | extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst; |
13 | #define imx21_add_imx_i2c(pdata) \ | 17 | #define imx21_add_imx_i2c(pdata) \ |
14 | imx_add_imx_i2c(&imx21_imx_i2c_data, pdata) | 18 | imx_add_imx_i2c(&imx21_imx_i2c_data, pdata) |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 84b3405e982d..b2d4c5136354 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -13,6 +13,10 @@ extern const struct imx_fec_data imx27_fec_data __initconst; | |||
13 | #define imx27_add_fec(pdata) \ | 13 | #define imx27_add_fec(pdata) \ |
14 | imx_add_fec(&imx27_fec_data, pdata) | 14 | imx_add_fec(&imx27_fec_data, pdata) |
15 | 15 | ||
16 | extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst; | ||
17 | #define imx27_add_imx2_wdt(pdata) \ | ||
18 | imx_add_imx2_wdt(&imx27_imx2_wdt_data) | ||
19 | |||
16 | extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst; | 20 | extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst; |
17 | #define imx27_add_imx_i2c(id, pdata) \ | 21 | #define imx27_add_imx_i2c(id, pdata) \ |
18 | imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) | 22 | imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) |
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index 0c5ade48d598..20655fb10a57 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -77,22 +77,6 @@ int __init imx1_register_gpios(void) | |||
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 79 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
80 | /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */ | ||
81 | static struct resource mxc_wdt_resources[] = { | ||
82 | { | ||
83 | .start = MX2x_WDOG_BASE_ADDR, | ||
84 | .end = MX2x_WDOG_BASE_ADDR + SZ_4K - 1, | ||
85 | .flags = IORESOURCE_MEM, | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | struct platform_device mxc_wdt = { | ||
90 | .name = "imx2-wdt", | ||
91 | .id = 0, | ||
92 | .num_resources = ARRAY_SIZE(mxc_wdt_resources), | ||
93 | .resource = mxc_wdt_resources, | ||
94 | }; | ||
95 | |||
96 | /* | 80 | /* |
97 | * lcdc: | 81 | * lcdc: |
98 | * - i.MX1: the basic controller | 82 | * - i.MX1: the basic controller |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index 3d020b91ef5d..f441b0256b93 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -1,5 +1,4 @@ | |||
1 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 1 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
2 | extern struct platform_device mxc_wdt; | ||
3 | extern struct platform_device mxc_fb_device; | 2 | extern struct platform_device mxc_fb_device; |
4 | extern struct platform_device mxc_pwm_device; | 3 | extern struct platform_device mxc_pwm_device; |
5 | extern struct platform_device mxc_sdhc_device0; | 4 | extern struct platform_device mxc_sdhc_device0; |
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c index 9baaf3df048e..5771d4e58879 100644 --- a/arch/arm/mach-imx/mach-cpuimx27.c +++ b/arch/arm/mach-imx/mach-cpuimx27.c | |||
@@ -157,7 +157,6 @@ cpuimx27_nand_board_info __initconst = { | |||
157 | 157 | ||
158 | static struct platform_device *platform_devices[] __initdata = { | 158 | static struct platform_device *platform_devices[] __initdata = { |
159 | &eukrea_cpuimx27_nor_mtd_device, | 159 | &eukrea_cpuimx27_nor_mtd_device, |
160 | &mxc_wdt, | ||
161 | }; | 160 | }; |
162 | 161 | ||
163 | static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = { | 162 | static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = { |
@@ -261,6 +260,7 @@ static void __init eukrea_cpuimx27_init(void) | |||
261 | 260 | ||
262 | imx27_add_fec(NULL); | 261 | imx27_add_fec(NULL); |
263 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 262 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
263 | imx27_add_imx2_wdt(NULL); | ||
264 | imx27_add_mxc_w1(NULL); | 264 | imx27_add_mxc_w1(NULL); |
265 | 265 | ||
266 | #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) | 266 | #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) |
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c index 39c580bc9225..11da9c226e90 100644 --- a/arch/arm/mach-imx/mach-pca100.c +++ b/arch/arm/mach-imx/mach-pca100.c | |||
@@ -171,10 +171,6 @@ pca100_nand_board_info __initconst = { | |||
171 | .hw_ecc = 1, | 171 | .hw_ecc = 1, |
172 | }; | 172 | }; |
173 | 173 | ||
174 | static struct platform_device *platform_devices[] __initdata = { | ||
175 | &mxc_wdt, | ||
176 | }; | ||
177 | |||
178 | static const struct imxi2c_platform_data pca100_i2c1_data __initconst = { | 174 | static const struct imxi2c_platform_data pca100_i2c1_data __initconst = { |
179 | .bitrate = 100000, | 175 | .bitrate = 100000, |
180 | }; | 176 | }; |
@@ -432,7 +428,7 @@ static void __init pca100_init(void) | |||
432 | mxc_register_device(&mxc_fb_device, &pca100_fb_data); | 428 | mxc_register_device(&mxc_fb_device, &pca100_fb_data); |
433 | 429 | ||
434 | imx27_add_fec(NULL); | 430 | imx27_add_fec(NULL); |
435 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 431 | imx27_add_imx2_wdt(NULL); |
436 | imx27_add_mxc_w1(NULL); | 432 | imx27_add_mxc_w1(NULL); |
437 | } | 433 | } |
438 | 434 | ||
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c index 2cfc4b96c503..3c9f2df89269 100644 --- a/arch/arm/mach-imx/mach-pcm038.c +++ b/arch/arm/mach-imx/mach-pcm038.c | |||
@@ -173,7 +173,6 @@ pcm038_nand_board_info __initconst = { | |||
173 | static struct platform_device *platform_devices[] __initdata = { | 173 | static struct platform_device *platform_devices[] __initdata = { |
174 | &pcm038_nor_mtd_device, | 174 | &pcm038_nor_mtd_device, |
175 | &pcm038_sram_mtd_device, | 175 | &pcm038_sram_mtd_device, |
176 | &mxc_wdt, | ||
177 | }; | 176 | }; |
178 | 177 | ||
179 | /* On pcm038 there's a sram attached to CS1, we enable the chipselect here and | 178 | /* On pcm038 there's a sram attached to CS1, we enable the chipselect here and |
@@ -325,6 +324,7 @@ static void __init pcm038_init(void) | |||
325 | 324 | ||
326 | imx27_add_fec(NULL); | 325 | imx27_add_fec(NULL); |
327 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 326 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
327 | imx27_add_imx2_wdt(NULL); | ||
328 | imx27_add_mxc_w1(NULL); | 328 | imx27_add_mxc_w1(NULL); |
329 | 329 | ||
330 | #ifdef CONFIG_MACH_PCM970_BASEBOARD | 330 | #ifdef CONFIG_MACH_PCM970_BASEBOARD |
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 37d7e001d72c..01b0d0cdf866 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -13,6 +13,9 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS | |||
13 | bool | 13 | bool |
14 | default y if ARCH_MX51 | 14 | default y if ARCH_MX51 |
15 | 15 | ||
16 | config IMX_HAVE_PLATFORM_IMX2_WDT | ||
17 | bool | ||
18 | |||
16 | config IMX_HAVE_PLATFORM_IMX_I2C | 19 | config IMX_HAVE_PLATFORM_IMX_I2C |
17 | bool | 20 | bool |
18 | 21 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 88392fc47c0a..224f6655c75f 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -2,6 +2,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o | |||
2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o | 2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o |
3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o | 4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o |
5 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o | ||
5 | obj-y += platform-imx-dma.o | 6 | obj-y += platform-imx-dma.o |
6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | 7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o |
7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o |
diff --git a/arch/arm/plat-mxc/devices/platform-imx2-wdt.c b/arch/arm/plat-mxc/devices/platform-imx2-wdt.c new file mode 100644 index 000000000000..86eb7f128168 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-imx2-wdt.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/hardware.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #define imx_imx2_wdt_data_entry_single(soc) \ | ||
14 | { \ | ||
15 | .iobase = soc ## _WDOG_BASE_ADDR, \ | ||
16 | } | ||
17 | |||
18 | #ifdef CONFIG_SOC_IMX21 | ||
19 | const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst = | ||
20 | imx_imx2_wdt_data_entry_single(MX21); | ||
21 | #endif /* ifdef CONFIG_SOC_IMX21 */ | ||
22 | |||
23 | #ifdef CONFIG_SOC_IMX27 | ||
24 | const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst = | ||
25 | imx_imx2_wdt_data_entry_single(MX27); | ||
26 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
27 | |||
28 | struct platform_device *__init imx_add_imx2_wdt( | ||
29 | const struct imx_imx2_wdt_data *data) | ||
30 | { | ||
31 | struct resource res[] = { | ||
32 | { | ||
33 | .start = data->iobase, | ||
34 | .end = data->iobase + SZ_4K - 1, | ||
35 | .flags = IORESOURCE_MEM, | ||
36 | }, | ||
37 | }; | ||
38 | return imx_add_platform_device("imx2-wdt", 0, | ||
39 | res, ARRAY_SIZE(res), NULL, 0); | ||
40 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index e31fc50384c8..a0ac84542298 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -43,6 +43,12 @@ struct platform_device *__init imx_add_flexcan(int id, | |||
43 | struct platform_device *__init imx_add_gpio_keys( | 43 | struct platform_device *__init imx_add_gpio_keys( |
44 | const struct gpio_keys_platform_data *pdata); | 44 | const struct gpio_keys_platform_data *pdata); |
45 | 45 | ||
46 | struct imx_imx2_wdt_data { | ||
47 | resource_size_t iobase; | ||
48 | }; | ||
49 | struct platform_device *__init imx_add_imx2_wdt( | ||
50 | const struct imx_imx2_wdt_data *data); | ||
51 | |||
46 | #include <mach/i2c.h> | 52 | #include <mach/i2c.h> |
47 | struct imx_imx_i2c_data { | 53 | struct imx_imx_i2c_data { |
48 | int id; | 54 | int id; |