[ARM] 5395/1: RealView: Add support for the DS1338 RTC chip
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 12 Feb 2009 14:58:20 +0000 (15:58 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 19 Feb 2009 11:30:25 +0000 (11:30 +0000)
This chip is on the I2C bus on the RealView and Versatile boards. The
patch adds the i2c_board_info definition for this device and registers
it with the I2C subsystem.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-realview/core.c
arch/arm/mach-realview/realview_pb1176.c
arch/arm/mach-versatile/core.c

index bd2aa4f16141d72895e655f63efe75cf6ffcd298..27b48be73676077e57f1e57433917331a4dcccfc 100644 (file)
@@ -158,11 +158,25 @@ static struct resource realview_i2c_resource = {
 
 struct platform_device realview_i2c_device = {
        .name           = "versatile-i2c",
-       .id             = -1,
+       .id             = 0,
        .num_resources  = 1,
        .resource       = &realview_i2c_resource,
 };
 
+static struct i2c_board_info realview_i2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
+               .type = "ds1338",
+       },
+};
+
+static int __init realview_i2c_init(void)
+{
+       return i2c_register_board_info(0, realview_i2c_board_info,
+                                      ARRAY_SIZE(realview_i2c_board_info));
+}
+arch_initcall(realview_i2c_init);
+
 #define REALVIEW_SYSMCI        (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET)
 
 static unsigned int realview_mmc_status(struct device *dev)
index 8f0683c22140fdced876f5e72c696151faec4ca4..d9d684d29e928f764e1e69313698b0be05b174af 100644 (file)
@@ -260,6 +260,7 @@ static void __init realview_pb1176_init(void)
 
        realview_flash_register(&realview_pb1176_flash_resource, 1);
        realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
+       platform_device_register(&realview_i2c_device);
 
        for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
                struct amba_device *d = amba_devs[i];
index 1c43494f5c422092d713a860e1623e83078b9d05..565776680d8c1d89a285405e160bf17aac629a59 100644 (file)
@@ -335,11 +335,25 @@ static struct resource versatile_i2c_resource = {
 
 static struct platform_device versatile_i2c_device = {
        .name                   = "versatile-i2c",
-       .id                     = -1,
+       .id                     = 0,
        .num_resources          = 1,
        .resource               = &versatile_i2c_resource,
 };
 
+static struct i2c_board_info versatile_i2c_board_info[] = {
+       {
+               I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
+               .type = "ds1338",
+       },
+};
+
+static int __init versatile_i2c_init(void)
+{
+       return i2c_register_board_info(0, versatile_i2c_board_info,
+                                      ARRAY_SIZE(versatile_i2c_board_info));
+}
+arch_initcall(versatile_i2c_init);
+
 #define VERSATILE_SYSMCI       (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_MCI_OFFSET)
 
 unsigned int mmc_status(struct device *dev)