Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358799
b: refs/heads/master
c: b08369a
h: refs/heads/master
i:
  358797: 5cd6f19
  358795: f3c32c6
  358791: e98b6dd
  358783: 1f60830
v: v3
  • Loading branch information
Alexander Stein authored and Wolfram Sang committed Feb 11, 2013
1 parent 45e2021 commit 1ac1909
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4182b434bf760355a1516b1d3d9f73aa419eeeec
refs/heads/master: b08369a174a183e88baa98ab5e3566a617a3a7f8
17 changes: 17 additions & 0 deletions trunk/drivers/i2c/busses/i2c-isch.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
/* SCH SMBus address offsets */
#define SMBHSTCNT (0 + sch_smba)
#define SMBHSTSTS (1 + sch_smba)
#define SMBHSTCLK (2 + sch_smba)
#define SMBHSTADD (4 + sch_smba) /* TSA */
#define SMBHSTCMD (5 + sch_smba)
#define SMBHSTDAT0 (6 + sch_smba)
Expand All @@ -58,6 +59,9 @@

static unsigned short sch_smba;
static struct i2c_adapter sch_adapter;
static int backbone_speed = 33000; /* backbone speed in kHz */
module_param(backbone_speed, int, S_IRUSR | S_IWUSR);
MODULE_PARM_DESC(backbone_speed, "Backbone speed in kHz, (default = 33000)");

/*
* Start the i2c transaction -- the i2c_access will prepare the transaction
Expand Down Expand Up @@ -156,6 +160,19 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
dev_dbg(&sch_adapter.dev, "SMBus busy (%02x)\n", temp);
return -EAGAIN;
}
temp = inw(SMBHSTCLK);
if (!temp) {
/*
* We can't determine if we have 33 or 25 MHz clock for
* SMBus, so expect 33 MHz and calculate a bus clock of
* 100 kHz. If we actually run at 25 MHz the bus will be
* run ~75 kHz instead which should do no harm.
*/
dev_notice(&sch_adapter.dev,
"Clock divider unitialized. Setting defaults\n");
outw(backbone_speed / (4 * 100), SMBHSTCLK);
}

dev_dbg(&sch_adapter.dev, "access size: %d %s\n", size,
(read_write)?"READ":"WRITE");
switch (size) {
Expand Down

0 comments on commit 1ac1909

Please sign in to comment.