瀏覽代碼

[ARM] pxa/cm-x300: add rtc-v3020 device registration

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Mike Rapoport 16 年之前
父節點
當前提交
1858ced3f9
共有 1 個文件被更改,包括 38 次插入0 次删除
  1. 38 0
      arch/arm/mach-pxa/cm-x300.c

+ 38 - 0
arch/arm/mach-pxa/cm-x300.c

@@ -21,6 +21,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio.h>
 #include <linux/dm9000.h>
 #include <linux/dm9000.h>
 #include <linux/leds.h>
 #include <linux/leds.h>
+#include <linux/rtc-v3020.h>
 
 
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/i2c/pca953x.h>
@@ -46,6 +47,11 @@
 
 
 #define	CM_X300_MMC2_IRQ	IRQ_GPIO(GPIO82_MMC2_IRQ)
 #define	CM_X300_MMC2_IRQ	IRQ_GPIO(GPIO82_MMC2_IRQ)
 
 
+#define GPIO95_RTC_CS		(95)
+#define GPIO96_RTC_WR		(96)
+#define GPIO97_RTC_RD		(97)
+#define GPIO98_RTC_IO		(98)
+
 static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
 static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
 	/* LCD */
 	/* LCD */
 	GPIO54_LCD_LDD_0,
 	GPIO54_LCD_LDD_0,
@@ -135,6 +141,12 @@ static mfp_cfg_t cm_x300_mfp_cfg[] __initdata = {
 	GPIO85_GPIO,			/* MMC WP */
 	GPIO85_GPIO,			/* MMC WP */
 	GPIO99_GPIO,			/* Ethernet IRQ */
 	GPIO99_GPIO,			/* Ethernet IRQ */
 
 
+	/* RTC GPIOs */
+	GPIO95_GPIO,			/* RTC CS */
+	GPIO96_GPIO,			/* RTC WR */
+	GPIO97_GPIO,			/* RTC RD */
+	GPIO98_GPIO,			/* RTC IO */
+
 	/* Standard I2C */
 	/* Standard I2C */
 	GPIO21_I2C_SCL,
 	GPIO21_I2C_SCL,
 	GPIO22_I2C_SDA,
 	GPIO22_I2C_SDA,
@@ -442,6 +454,31 @@ static void __init cm_x300_init_i2c(void)
 static inline void cm_x300_init_i2c(void) {}
 static inline void cm_x300_init_i2c(void) {}
 #endif
 #endif
 
 
+#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
+struct v3020_platform_data cm_x300_v3020_pdata = {
+	.use_gpio	= 1,
+	.gpio_cs	= GPIO95_RTC_CS,
+	.gpio_wr	= GPIO96_RTC_WR,
+	.gpio_rd	= GPIO97_RTC_RD,
+	.gpio_io	= GPIO98_RTC_IO,
+};
+
+static struct platform_device cm_x300_rtc_device = {
+	.name		= "v3020",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &cm_x300_v3020_pdata,
+	}
+};
+
+static void __init cm_x300_init_rtc(void)
+{
+	platform_device_register(&cm_x300_rtc_device);
+}
+#else
+static inline void cm_x300_init_rtc(void) {}
+#endif
+
 static void __init cm_x300_init(void)
 static void __init cm_x300_init(void)
 {
 {
 	/* board-processor specific GPIO initialization */
 	/* board-processor specific GPIO initialization */
@@ -454,6 +491,7 @@ static void __init cm_x300_init(void)
 	cm_x300_init_nand();
 	cm_x300_init_nand();
 	cm_x300_init_leds();
 	cm_x300_init_leds();
 	cm_x300_init_i2c();
 	cm_x300_init_i2c();
+	cm_x300_init_rtc();
 }
 }
 
 
 MACHINE_START(CM_X300, "CM-X300 module")
 MACHINE_START(CM_X300, "CM-X300 module")