aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-isch.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index 4099f79c2280..8c38aaa7417c 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -40,6 +40,7 @@
40/* SCH SMBus address offsets */ 40/* SCH SMBus address offsets */
41#define SMBHSTCNT (0 + sch_smba) 41#define SMBHSTCNT (0 + sch_smba)
42#define SMBHSTSTS (1 + sch_smba) 42#define SMBHSTSTS (1 + sch_smba)
43#define SMBHSTCLK (2 + sch_smba)
43#define SMBHSTADD (4 + sch_smba) /* TSA */ 44#define SMBHSTADD (4 + sch_smba) /* TSA */
44#define SMBHSTCMD (5 + sch_smba) 45#define SMBHSTCMD (5 + sch_smba)
45#define SMBHSTDAT0 (6 + sch_smba) 46#define SMBHSTDAT0 (6 + sch_smba)
@@ -58,6 +59,9 @@
58 59
59static unsigned short sch_smba; 60static unsigned short sch_smba;
60static struct i2c_adapter sch_adapter; 61static struct i2c_adapter sch_adapter;
62static int backbone_speed = 33000; /* backbone speed in kHz */
63module_param(backbone_speed, int, S_IRUSR | S_IWUSR);
64MODULE_PARM_DESC(backbone_speed, "Backbone speed in kHz, (default = 33000)");
61 65
62/* 66/*
63 * Start the i2c transaction -- the i2c_access will prepare the transaction 67 * Start the i2c transaction -- the i2c_access will prepare the transaction
@@ -156,6 +160,19 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
156 dev_dbg(&sch_adapter.dev, "SMBus busy (%02x)\n", temp); 160 dev_dbg(&sch_adapter.dev, "SMBus busy (%02x)\n", temp);
157 return -EAGAIN; 161 return -EAGAIN;
158 } 162 }
163 temp = inw(SMBHSTCLK);
164 if (!temp) {
165 /*
166 * We can't determine if we have 33 or 25 MHz clock for
167 * SMBus, so expect 33 MHz and calculate a bus clock of
168 * 100 kHz. If we actually run at 25 MHz the bus will be
169 * run ~75 kHz instead which should do no harm.
170 */
171 dev_notice(&sch_adapter.dev,
172 "Clock divider unitialized. Setting defaults\n");
173 outw(backbone_speed / (4 * 100), SMBHSTCLK);
174 }
175
159 dev_dbg(&sch_adapter.dev, "access size: %d %s\n", size, 176 dev_dbg(&sch_adapter.dev, "access size: %d %s\n", size,
160 (read_write)?"READ":"WRITE"); 177 (read_write)?"READ":"WRITE");
161 switch (size) { 178 switch (size) {