aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2008-07-14 16:38:33 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:33 -0400
commit392a0408fdc4c9069c32a9a02b0088eae76c4618 (patch)
treeafc609b4dfa91e8d3a230e8a7044c6d848f5a4d9
parentcf898dc5e9dfd1487b28ca0176b68722f05d4d48 (diff)
i2c-sibyte: SWARM I2C board initialization
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>
-rw-r--r--arch/mips/sibyte/swarm/Makefile1
-rw-r--r--arch/mips/sibyte/swarm/swarm-i2c.c37
-rw-r--r--drivers/i2c/busses/i2c-sibyte.c4
3 files changed, 41 insertions, 1 deletions
diff --git a/arch/mips/sibyte/swarm/Makefile b/arch/mips/sibyte/swarm/Makefile
index 1775755a2619..255d692bfa18 100644
--- a/arch/mips/sibyte/swarm/Makefile
+++ b/arch/mips/sibyte/swarm/Makefile
@@ -1,3 +1,4 @@
1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o 1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o
2 2
3obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
3obj-$(CONFIG_KGDB) += dbg_io.o 4obj-$(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
index 000000000000..4282ac9d01d2
--- /dev/null
+++ b/arch/mips/sibyte/swarm/swarm-i2c.c
@@ -0,0 +1,37 @@
1/*
2 * arch/mips/sibyte/swarm/swarm-i2c.c
3 *
4 * Broadcom BCM91250A (SWARM), etc. I2C platform setup.
5 *
6 * Copyright (c) 2008 Maciej W. Rozycki
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <linux/i2c.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17
18
19static struct i2c_board_info swarm_i2c_info1[] __initdata = {
20 {
21 I2C_BOARD_INFO("m41t81", 0x68),
22 },
23};
24
25static int __init swarm_i2c_init(void)
26{
27 int err;
28
29 err = i2c_register_board_info(1, swarm_i2c_info1,
30 ARRAY_SIZE(swarm_i2c_info1));
31 if (err < 0)
32 printk(KERN_ERR
33 "swarm-i2c: cannot register board I2C devices\n");
34 return err;
35}
36
37arch_initcall(swarm_i2c_init);
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
index ac8822e7a5b4..4ddefbf238e9 100644
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -143,7 +143,7 @@ static int __init i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
143 csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); 143 csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ));
144 csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); 144 csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL));
145 145
146 return i2c_add_adapter(i2c_adap); 146 return i2c_add_numbered_adapter(i2c_adap);
147} 147}
148 148
149 149
@@ -159,6 +159,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
159 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, 159 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
160 .algo = NULL, 160 .algo = NULL,
161 .algo_data = &sibyte_board_data[0], 161 .algo_data = &sibyte_board_data[0],
162 .nr = 0,
162 .name = "SiByte SMBus 0", 163 .name = "SiByte SMBus 0",
163 }, 164 },
164 { 165 {
@@ -167,6 +168,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
167 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, 168 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
168 .algo = NULL, 169 .algo = NULL,
169 .algo_data = &sibyte_board_data[1], 170 .algo_data = &sibyte_board_data[1],
171 .nr = 1,
170 .name = "SiByte SMBus 1", 172 .name = "SiByte SMBus 1",
171 }, 173 },
172}; 174};