]> err.no Git - linux-2.6/commitdiff
i2c-sibyte: SWARM I2C board initialization
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 14 Jul 2008 20:38:33 +0000 (22:38 +0200)
committerJean Delvare <khali@mahadeva.delvare>
Mon, 14 Jul 2008 20:38:33 +0000 (22:38 +0200)
 The standard rtc-m41t80.c driver cannot be used with the SWARM as it is,
because the board does not provide setup information for the I2C core.
As a result the bus and the address to probe for the M41T80 chip is not
known.

 Here is a set of changes that fix the problem:

1. swarm-i2c.c -- SWARM I2C board setup, currently for the M41T80 chip on
   the bus #1 only (there is a MAX6654 temperature sensor on the bus #0
   which may be added in the future if we have a driver for that chip).

2. The i2c-sibyte.c BCM1250A SMBus controller driver now registers its
   buses as numbered so that board setup is correctly applied.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
arch/mips/sibyte/swarm/Makefile
arch/mips/sibyte/swarm/swarm-i2c.c [new file with mode: 0644]
drivers/i2c/busses/i2c-sibyte.c

index 1775755a2619e8359c2402db68c8c7bc5bdaeb92..255d692bfa188c6df2d59d9a167644396d4d1b15 100644 (file)
@@ -1,3 +1,4 @@
 obj-y                          := setup.o rtc_xicor1241.o rtc_m41t81.o
 
+obj-$(CONFIG_I2C_BOARDINFO)    += swarm-i2c.o
 obj-$(CONFIG_KGDB)             += dbg_io.o
diff --git a/arch/mips/sibyte/swarm/swarm-i2c.c b/arch/mips/sibyte/swarm/swarm-i2c.c
new file mode 100644 (file)
index 0000000..4282ac9
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ *     arch/mips/sibyte/swarm/swarm-i2c.c
+ *
+ *     Broadcom BCM91250A (SWARM), etc. I2C platform setup.
+ *
+ *     Copyright (c) 2008  Maciej W. Rozycki
+ *
+ *     This program is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License
+ *     as published by the Free Software Foundation; either version
+ *     2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+
+static struct i2c_board_info swarm_i2c_info1[] __initdata = {
+       {
+               I2C_BOARD_INFO("m41t81", 0x68),
+       },
+};
+
+static int __init swarm_i2c_init(void)
+{
+       int err;
+
+       err = i2c_register_board_info(1, swarm_i2c_info1,
+                                     ARRAY_SIZE(swarm_i2c_info1));
+       if (err < 0)
+               printk(KERN_ERR
+                      "swarm-i2c: cannot register board I2C devices\n");
+       return err;
+}
+
+arch_initcall(swarm_i2c_init);
index ac8822e7a5b482a5963bade401bbf62e71e88c7a..4ddefbf238e97f797a5a4627d7887ab4357b3af2 100644 (file)
@@ -143,7 +143,7 @@ static int __init i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
        csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ));
        csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL));
 
-       return i2c_add_adapter(i2c_adap);
+       return i2c_add_numbered_adapter(i2c_adap);
 }
 
 
@@ -159,6 +159,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
                .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
                .algo           = NULL,
                .algo_data      = &sibyte_board_data[0],
+               .nr             = 0,
                .name           = "SiByte SMBus 0",
        },
        {
@@ -167,6 +168,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
                .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
                .algo           = NULL,
                .algo_data      = &sibyte_board_data[1],
+               .nr             = 1,
                .name           = "SiByte SMBus 1",
        },
 };