Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74418 )
Change subject: Mainboard/lenovo/x200: Configure ck505 clockgen ......................................................................
Mainboard/lenovo/x200: Configure ck505 clockgen
The clockgen is behind an smbus mux which is implemented with a gpio. This adds a callback inside the ck505 code to configure the mux.
UNTESTED and not checked if applicable on x301.
Change-Id: Iec9bbbaed43b74e8782f6963e491dbfa3b8b5247 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/drivers/i2c/ck505/ck505.c M src/mainboard/lenovo/x200/Kconfig M src/mainboard/lenovo/x200/devicetree.cb M src/mainboard/lenovo/x200/mainboard.c 4 files changed, 50 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/74418/1
diff --git a/src/drivers/i2c/ck505/ck505.c b/src/drivers/i2c/ck505/ck505.c index 58eaec6..a3858ad 100644 --- a/src/drivers/i2c/ck505/ck505.c +++ b/src/drivers/i2c/ck505/ck505.c @@ -5,9 +5,18 @@ #include <device/device.h> #include <device/smbus.h> #include "chip.h" +#include "ck505.h"
#define SMBUS_BLOCK_SIZE 32
+__weak void ck505_set_mux_enable(void) +{ +} + +__weak void ck505_set_mux_disable(void) +{ +} + static void ck505_init(struct device *dev) { struct drivers_i2c_ck505_config *config; @@ -18,6 +27,8 @@ if (!dev->enabled || dev->path.type != DEVICE_PATH_I2C) return;
+ ck505_set_mux_enable(); + config = dev->chip_info;
dev_nregs = smbus_block_read(dev, 0, sizeof(block), block); @@ -41,6 +52,8 @@
if (smbus_block_write(dev, 0, dev_nregs, block) < 0) printk(BIOS_ERR, "Failed writing ck505 configuration!\n"); + + ck505_set_mux_disable(); }
static struct device_operations ck505_operations = { diff --git a/src/mainboard/lenovo/x200/Kconfig b/src/mainboard/lenovo/x200/Kconfig index 6b22fb3..c926691 100644 --- a/src/mainboard/lenovo/x200/Kconfig +++ b/src/mainboard/lenovo/x200/Kconfig @@ -21,6 +21,7 @@ select DRIVERS_LENOVO_WACOM select MAINBOARD_HAS_LIBGFXINIT select MAINBOARD_USES_IFD_GBE_REGION + select DRIVERS_I2C_CK505
config VBOOT select VBOOT_VBNV_FLASH diff --git a/src/mainboard/lenovo/x200/devicetree.cb b/src/mainboard/lenovo/x200/devicetree.cb index 7871cfd..ca1dc9e 100644 --- a/src/mainboard/lenovo/x200/devicetree.cb +++ b/src/mainboard/lenovo/x200/devicetree.cb @@ -165,6 +165,15 @@ device i2c 5e on end device i2c 5f on end end + chip drivers/i2c/ck505 + register "mask" = "{ 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff }" + register "regs" = "{ 0x11, 0xf1, 0x9f, + 0xdf, 0x41, 0x00, 0x25, 0x06, + 0x80, 0x00 }" + device i2c 69 on end + end end device pci 1f.5 off end # SATA/IDE 2 device pci 1f.6 off end # Thermal diff --git a/src/mainboard/lenovo/x200/mainboard.c b/src/mainboard/lenovo/x200/mainboard.c index 4b2f253..1c96c69 100644 --- a/src/mainboard/lenovo/x200/mainboard.c +++ b/src/mainboard/lenovo/x200/mainboard.c @@ -3,6 +3,18 @@ #include <device/device.h> #include <drivers/intel/gma/int15.h> #include <drivers/lenovo/lenovo.h> +#include <drivers/i2c/ck505/ck505.h> +#include <southbridge/intel/common/gpio.h> + +void ck505_set_mux_enable(void) +{ + set_gpio(42, GPIO_LEVEL_HIGH); +} + +void ck505_set_mux_disable(void) +{ + set_gpio(42, GPIO_LEVEL_LOW); +}
static void fill_ssdt(const struct device *device) {