diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig index b0831efadefc735a50eab381aba45b355c6dd300..ae23211dbadc386e4a58cd6189c9c224d0e3c21a 100644 --- a/arch/arm/mach-mx3/Kconfig +++ b/arch/arm/mach-mx3/Kconfig @@ -84,6 +84,7 @@ config MACH_MX31LITE select IMX_HAVE_PLATFORM_MXC_EHCI select IMX_HAVE_PLATFORM_MXC_MMC select IMX_HAVE_PLATFORM_MXC_NAND + select IMX_HAVE_PLATFORM_MXC_RTC select IMX_HAVE_PLATFORM_SPI_IMX help 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 cf621d273aa3f363ec264100876e0a9a4acbbb11..3059b3e33dec76c2649b14fade78473499f4f364 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; #define imx31_add_mxc_nand(pdata) \ imx_add_mxc_nand(&imx31_mxc_nand_data, pdata) +extern const struct imx_mxc_rtc_data imx31_mxc_rtc_data; +#define imx31_add_mxc_rtc(pdata) \ + imx_add_mxc_rtc(&imx31_mxc_rtc_data) + extern const struct imx_mxc_w1_data imx31_mxc_w1_data; #define imx31_add_mxc_w1(pdata) \ 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 b6672db788fb8145ff41931ffc5849335ef61535..0701ee45c548162e455979b3102cddbd76dfd233 100644 --- a/arch/arm/mach-mx3/devices.c +++ b/arch/arm/mach-mx3/devices.c @@ -94,22 +94,3 @@ struct platform_device mx3_camera = { .coherent_dma_mask = DMA_BIT_MASK(32), }, }; - -static struct resource imx_rtc_resources[] = { - { - .start = MX31_RTC_BASE_ADDR, - .end = MX31_RTC_BASE_ADDR + 0x3fff, - .flags = IORESOURCE_MEM, - }, - { - .start = MX31_INT_RTC, - .flags = IORESOURCE_IRQ, - }, -}; - -struct platform_device imx_rtc_device0 = { - .name = "mxc_rtc", - .id = -1, - .num_resources = ARRAY_SIZE(imx_rtc_resources), - .resource = imx_rtc_resources, -}; diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h index 121962c568d10ca449ea00f1150489de2ea5746a..d23f85375655f11505d78930a911c67dd28438c3 100644 --- a/arch/arm/mach-mx3/devices.h +++ b/arch/arm/mach-mx3/devices.h @@ -1,4 +1,3 @@ extern struct platform_device mx3_ipu; extern struct platform_device mx3_fb; extern struct platform_device mx3_camera; -extern 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 3124ea837ac7969d9877f4f1f1633db73ca889a5..04fab659947cd3107d143635765aff18a0fed922 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) imx31_add_spi_imx0(&spi0_pdata); platform_device_register(&litekit_led_device); imx31_add_imx2_wdt(NULL); - mxc_register_device(&imx_rtc_device0, NULL); + imx31_add_mxc_rtc(NULL); } diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index b9ab1d58b5e768dc80d5818f9034623157d94e67..0e8d7ab7898a2f7dc1239aab7054410bfc537f09 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 bool select ARCH_HAS_RNGA +config IMX_HAVE_PLATFORM_MXC_RTC + bool + config IMX_HAVE_PLATFORM_MXC_W1 bool diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 75cd2ece90538f10b66127c0a45f2145b81e523f..ca227eaea7cc37fac1c7fec913cb513f245d0dc5 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 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o obj-$(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 0000000000000000000000000000000000000000..16d0ec4df5f65c7905896bfead4353ba643ebf14 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-mxc_rtc.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010-2011 Pengutronix + * Uwe Kleine-Koenig + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ +#include +#include + +#define imx_mxc_rtc_data_entry_single(soc) \ + { \ + .iobase = soc ## _RTC_BASE_ADDR, \ + .irq = soc ## _INT_RTC, \ + } + +#ifdef CONFIG_SOC_IMX31 +const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst = + imx_mxc_rtc_data_entry_single(MX31); +#endif /* ifdef CONFIG_SOC_IMX31 */ + +struct platform_device *__init imx_add_mxc_rtc( + const struct imx_mxc_rtc_data *data) +{ + struct resource res[] = { + { + .start = data->iobase, + .end = data->iobase + SZ_16K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = data->irq, + .end = data->irq, + .flags = IORESOURCE_IRQ, + }, + }; + + return imx_add_platform_device("mxc_rtc", -1, + res, ARRAY_SIZE(res), NULL, 0); +} diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 8658c9caa650ca12be1e182827f3fb5e0c43da19..b0bc1987c1d334ee42bb29558759d0bac7d8267c 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 { struct platform_device *__init imx_add_mxc_pwm( const struct imx_mxc_pwm_data *data); +/* mxc_rtc */ +struct imx_mxc_rtc_data { + resource_size_t iobase; + resource_size_t irq; +}; +struct platform_device *__init imx_add_mxc_rtc( + const struct imx_mxc_rtc_data *data); + +/* mxc_w1 */ struct imx_mxc_w1_data { resource_size_t iobase; };