aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-03-01 05:04:34 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-05-19 07:11:16 -0400
commit83422671c3e93b8ef77805fbad74173a1636d5f1 (patch)
treea79df1808e6aabe5dac7bb59da23c42e11894b2b /arch/arm
parent3da25ccee303add545e49cef5c6cdeb0c1d94300 (diff)
ARM: mx3: dynamically allocate "mxc_rtc" devices
LAKML-Reference: 1299271882-2130-2-git-send-email-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mx3/Kconfig1
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h4
-rw-r--r--arch/arm/mach-mx3/devices.c19
-rw-r--r--arch/arm/mach-mx3/devices.h1
-rw-r--r--arch/arm/mach-mx3/mx31lite-db.c2
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_rtc.c40
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h9
9 files changed, 59 insertions, 21 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index b0831efadef..ae23211dbad 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -84,6 +84,7 @@ config MACH_MX31LITE
84 select IMX_HAVE_PLATFORM_MXC_EHCI 84 select IMX_HAVE_PLATFORM_MXC_EHCI
85 select IMX_HAVE_PLATFORM_MXC_MMC 85 select IMX_HAVE_PLATFORM_MXC_MMC
86 select IMX_HAVE_PLATFORM_MXC_NAND 86 select IMX_HAVE_PLATFORM_MXC_NAND
87 select IMX_HAVE_PLATFORM_MXC_RTC
87 select IMX_HAVE_PLATFORM_SPI_IMX 88 select IMX_HAVE_PLATFORM_SPI_IMX
88 help 89 help
89 Include support for MX31 LITEKIT platform. This includes specific 90 Include support for MX31 LITEKIT platform. This includes specific
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
index cf621d273aa..3059b3e33de 100644
--- a/arch/arm/mach-mx3/devices-imx31.h
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -56,6 +56,10 @@ extern const struct imx_mxc_nand_data imx31_mxc_nand_data;
56#define imx31_add_mxc_nand(pdata) \ 56#define imx31_add_mxc_nand(pdata) \
57 imx_add_mxc_nand(&imx31_mxc_nand_data, pdata) 57 imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
58 58
59extern const struct imx_mxc_rtc_data imx31_mxc_rtc_data;
60#define imx31_add_mxc_rtc(pdata) \
61 imx_add_mxc_rtc(&imx31_mxc_rtc_data)
62
59extern const struct imx_mxc_w1_data imx31_mxc_w1_data; 63extern const struct imx_mxc_w1_data imx31_mxc_w1_data;
60#define imx31_add_mxc_w1(pdata) \ 64#define imx31_add_mxc_w1(pdata) \
61 imx_add_mxc_w1(&imx31_mxc_w1_data) 65 imx_add_mxc_w1(&imx31_mxc_w1_data)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index b6672db788f..0701ee45c54 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -94,22 +94,3 @@ struct platform_device mx3_camera = {
94 .coherent_dma_mask = DMA_BIT_MASK(32), 94 .coherent_dma_mask = DMA_BIT_MASK(32),
95 }, 95 },
96}; 96};
97
98static struct resource imx_rtc_resources[] = {
99 {
100 .start = MX31_RTC_BASE_ADDR,
101 .end = MX31_RTC_BASE_ADDR + 0x3fff,
102 .flags = IORESOURCE_MEM,
103 },
104 {
105 .start = MX31_INT_RTC,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110struct platform_device imx_rtc_device0 = {
111 .name = "mxc_rtc",
112 .id = -1,
113 .num_resources = ARRAY_SIZE(imx_rtc_resources),
114 .resource = imx_rtc_resources,
115};
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 121962c568d..d23f8537565 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -1,4 +1,3 @@
1extern struct platform_device mx3_ipu; 1extern struct platform_device mx3_ipu;
2extern struct platform_device mx3_fb; 2extern struct platform_device mx3_fb;
3extern struct platform_device mx3_camera; 3extern struct platform_device mx3_camera;
4extern struct platform_device imx_rtc_device0;
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 3124ea837ac..04fab659947 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -200,5 +200,5 @@ void __init mx31lite_db_init(void)
200 imx31_add_spi_imx0(&spi0_pdata); 200 imx31_add_spi_imx0(&spi0_pdata);
201 platform_device_register(&litekit_led_device); 201 platform_device_register(&litekit_led_device);
202 imx31_add_imx2_wdt(NULL); 202 imx31_add_imx2_wdt(NULL);
203 mxc_register_device(&imx_rtc_device0, NULL); 203 imx31_add_mxc_rtc(NULL);
204} 204}
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index b9ab1d58b5e..0e8d7ab7898 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -63,6 +63,9 @@ config IMX_HAVE_PLATFORM_MXC_RNGA
63 bool 63 bool
64 select ARCH_HAS_RNGA 64 select ARCH_HAS_RNGA
65 65
66config IMX_HAVE_PLATFORM_MXC_RTC
67 bool
68
66config IMX_HAVE_PLATFORM_MXC_W1 69config IMX_HAVE_PLATFORM_MXC_W1
67 bool 70 bool
68 71
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 75cd2ece905..ca227eaea7c 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
19obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 19obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
20obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o 20obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
21obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o 21obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o
22obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
22obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 23obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
23obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o 24obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
24obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 25obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_rtc.c b/arch/arm/plat-mxc/devices/platform-mxc_rtc.c
new file mode 100644
index 00000000000..16d0ec4df5f
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-mxc_rtc.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2010-2011 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 <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_mxc_rtc_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _RTC_BASE_ADDR, \
15 .irq = soc ## _INT_RTC, \
16 }
17
18#ifdef CONFIG_SOC_IMX31
19const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
20 imx_mxc_rtc_data_entry_single(MX31);
21#endif /* ifdef CONFIG_SOC_IMX31 */
22
23struct platform_device *__init imx_add_mxc_rtc(
24 const struct imx_mxc_rtc_data *data)
25{
26 struct resource res[] = {
27 {
28 .start = data->iobase,
29 .end = data->iobase + SZ_16K - 1,
30 .flags = IORESOURCE_MEM,
31 }, {
32 .start = data->irq,
33 .end = data->irq,
34 .flags = IORESOURCE_IRQ,
35 },
36 };
37
38 return imx_add_platform_device("mxc_rtc", -1,
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 8658c9caa65..b0bc1987c1d 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -237,6 +237,15 @@ struct imx_mxc_pwm_data {
237struct platform_device *__init imx_add_mxc_pwm( 237struct platform_device *__init imx_add_mxc_pwm(
238 const struct imx_mxc_pwm_data *data); 238 const struct imx_mxc_pwm_data *data);
239 239
240/* mxc_rtc */
241struct imx_mxc_rtc_data {
242 resource_size_t iobase;
243 resource_size_t irq;
244};
245struct platform_device *__init imx_add_mxc_rtc(
246 const struct imx_mxc_rtc_data *data);
247
248/* mxc_w1 */
240struct imx_mxc_w1_data { 249struct imx_mxc_w1_data {
241 resource_size_t iobase; 250 resource_size_t iobase;
242}; 251};