From cfab6f69b6c47154df97a8d81cb4ef31e6953945 Mon Sep 17 00:00:00 2001 From: Peichao Wang Date: Wed, 19 Sep 2018 10:55:12 +0800 Subject: mb/google/octopus: Close unused I2C bus 7 include SCL and SDA for Phaser Since I2C bus 7 attached the touchscreen device however Phaser units that haven't it. So for avoiding side effects, we need close I2C bus 7 SCL and SDA respectively. BUG=none TEST=according to sku_id (Phaser: 0x1, Phaser360: 0x2, Phaser360s: 0x3) distinguish whether close these gpios. Change-Id: I8ad17761f2a053dc329bbec0a0a3284d47289666 Signed-off-by: Peichao.Wang Reviewed-on: https://review.coreboot.org/28669 Reviewed-by: Furquan Shaikh Reviewed-by: Jett Rink Tested-by: build bot (Jenkins) --- .../google/octopus/variants/phaser/gpio.c | 41 ++++++++++++++++++++-- .../google/octopus/variants/phaser/variant.c | 14 ++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'src/mainboard/google/octopus') diff --git a/src/mainboard/google/octopus/variants/phaser/gpio.c b/src/mainboard/google/octopus/variants/phaser/gpio.c index 1c39e6592e..fb84a1624b 100644 --- a/src/mainboard/google/octopus/variants/phaser/gpio.c +++ b/src/mainboard/google/octopus/variants/phaser/gpio.c @@ -18,6 +18,10 @@ #include #include #include +#include +#include + +#define SKU_UNKNOWN 0xFFFFFFFF static const struct pad_config default_override_table[] = { PAD_NC(GPIO_52, UP_20K), @@ -39,6 +43,31 @@ static const struct pad_config default_override_table[] = { PAD_NC(GPIO_214, DN_20K), }; +static const struct pad_config sku1_default_override_table[] = { + /* disable I2C7 SCL and SDA */ + PAD_NC(GPIO_114, UP_20K), /* LPSS_I2C7_SDA */ + PAD_NC(GPIO_115, UP_20K), /* LPSS_I2C7_SCL */ + + PAD_NC(GPIO_52, UP_20K), + PAD_NC(GPIO_53, UP_20K), + PAD_NC(GPIO_67, UP_20K), + PAD_NC(GPIO_117, UP_20K), + PAD_NC(GPIO_143, UP_20K), + + /* EN_PP3300_TOUCHSCREEN */ + PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 0, DEEP, NONE, Tx0RxDCRx0, + DISPUPD), + + PAD_NC(GPIO_161, DN_20K), + + /* EN_PP3300_WLAN_L */ + PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_178, 0, DEEP, NONE, Tx0RxDCRx0, + DISPUPD), + + PAD_NC(GPIO_213, DN_20K), + PAD_NC(GPIO_214, DN_20K), +}; + static const struct pad_config bid0_override_table[] = { PAD_NC(GPIO_52, UP_20K), PAD_NC(GPIO_53, UP_20K), @@ -52,6 +81,7 @@ static const struct pad_config bid0_override_table[] = { const struct pad_config *variant_override_gpio_table(size_t *num) { const struct pad_config *c; + uint32_t sku_id = SKU_UNKNOWN; switch (board_id()) { case 0: @@ -60,10 +90,15 @@ const struct pad_config *variant_override_gpio_table(size_t *num) *num = ARRAY_SIZE(bid0_override_table); break; default: - c = default_override_table; - *num = ARRAY_SIZE(default_override_table); + google_chromeec_cbi_get_sku_id(&sku_id); + if (sku_id == 1) { + c = sku1_default_override_table; + *num = ARRAY_SIZE(sku1_default_override_table); + } else { + c = default_override_table; + *num = ARRAY_SIZE(default_override_table); + } } - return c; } diff --git a/src/mainboard/google/octopus/variants/phaser/variant.c b/src/mainboard/google/octopus/variants/phaser/variant.c index 1ead5e230c..f04d8585cc 100644 --- a/src/mainboard/google/octopus/variants/phaser/variant.c +++ b/src/mainboard/google/octopus/variants/phaser/variant.c @@ -22,6 +22,9 @@ #include #include #include +#include + +#define SKU_UNKNOWN 0xFFFFFFFF extern struct chip_operations drivers_i2c_generic_ops; extern struct chip_operations drivers_i2c_hid_ops; @@ -29,6 +32,7 @@ extern struct chip_operations drivers_i2c_hid_ops; void variant_update_devtree(struct device *dev) { uint32_t bid; + uint32_t sku_id = SKU_UNKNOWN; struct device *touchscreen_i2c_host; struct device *child; const struct bus *children_bus; @@ -46,6 +50,16 @@ void variant_update_devtree(struct device *dev) if (touchscreen_i2c_host == NULL) return; + /* According to the sku id decide whether update touch + * screen device information: + * 1. sku id is 1 then dev->enabled = 0. + */ + google_chromeec_cbi_get_sku_id(&sku_id); + if (sku_id == 1) { + touchscreen_i2c_host->enabled = 0; + return; + } + children_bus = touchscreen_i2c_host->link_list; child = NULL; -- cgit v1.2.3