summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-10-17 04:37:10 -0500
committerPeter Stuge <peter@stuge.se>2015-10-24 02:06:52 +0200
commitf7e0a1aaaaeb98d1452aaa48fe94c371199213d6 (patch)
tree58dd72dc561670f10683b46d1c87d5ea66a113fa /src/drivers
parentacbdade5cd02c0abed1f1a6c65501893bc6bd679 (diff)
downloadcoreboot-f7e0a1aaaaeb98d1452aaa48fe94c371199213d6.tar.gz
coreboot-f7e0a1aaaaeb98d1452aaa48fe94c371199213d6.tar.bz2
coreboot-f7e0a1aaaaeb98d1452aaa48fe94c371199213d6.zip
drivers/i2c/w83795: Add option to use auxiliary SMBUS controller
Change-Id: I5a9b5eba992853b84b0cb6c3a1764edf42ac49b2 Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: http://review.coreboot.org/12080 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Peter Stuge <peter@stuge.se> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/i2c/w83795/chip.h7
-rw-r--r--src/drivers/i2c/w83795/w83795.c17
2 files changed, 24 insertions, 0 deletions
diff --git a/src/drivers/i2c/w83795/chip.h b/src/drivers/i2c/w83795/chip.h
index c8a42ea971af..9a3f8475fbe7 100644
--- a/src/drivers/i2c/w83795/chip.h
+++ b/src/drivers/i2c/w83795/chip.h
@@ -139,4 +139,11 @@ struct drivers_i2c_w83795_config {
uint8_t fan6_duty; /* % of full speed (0-100) */
uint8_t fan7_duty; /* % of full speed (0-100) */
uint8_t fan8_duty; /* % of full speed (0-100) */
+
+ uint8_t smbus_aux; /* 0 == device located on primary SMBUS,
+ * 1 == device located on first auxiliary
+ * SMBUS channel,
+ * <n> == device located on <n> auxiliary
+ * SMBUS channel
+ */
};
diff --git a/src/drivers/i2c/w83795/w83795.c b/src/drivers/i2c/w83795/w83795.c
index 4a6486b57cb4..850b2d6a715b 100644
--- a/src/drivers/i2c/w83795/w83795.c
+++ b/src/drivers/i2c/w83795/w83795.c
@@ -146,7 +146,18 @@ static void w83795_init(struct device *dev, w83795_fan_mode_t mode, u8 dts_src)
uint8_t val;
uint16_t limit_value;
+#if IS_ENABLED(CONFIG_SMBUS_HAS_AUX_CHANNELS)
+ uint8_t smbus_aux_channel_prev = smbus_get_current_channel();
+ smbus_switch_to_channel(config->smbus_aux);
+ printk(BIOS_DEBUG, "Set SMBUS controller to channel %d\n", config->smbus_aux);
+#endif
+
if (smbus_read_byte(dev, 0x00) < 0) {
+#if IS_ENABLED(CONFIG_SMBUS_HAS_AUX_CHANNELS)
+ /* Restore SMBUS channel setting */
+ smbus_switch_to_channel(smbus_aux_channel_prev);
+ printk(BIOS_DEBUG, "Set SMBUS controller to channel %d\n", smbus_aux_channel_prev);
+#endif
printk(BIOS_ERR, "W83795G/ADG Nuvoton H/W Monitor not found\n");
return;
}
@@ -338,6 +349,12 @@ static void w83795_init(struct device *dev, w83795_fan_mode_t mode, u8 dts_src)
val = w83795_read(dev, W83795_REG_CONFIG);
val |= W83795_REG_CONFIG_START;
w83795_write(dev, W83795_REG_CONFIG, val);
+
+#if IS_ENABLED(CONFIG_SMBUS_HAS_AUX_CHANNELS)
+ /* Restore SMBUS channel setting */
+ smbus_switch_to_channel(smbus_aux_channel_prev);
+ printk(BIOS_DEBUG, "Set SMBUS controller to channel %d\n", smbus_aux_channel_prev);
+#endif
}
static void w83795_hwm_init(struct device *dev)