summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeichao Wang <peichao.wang@bitland.corp-partner.google.com>2018-09-19 10:55:12 +0800
committerFurquan Shaikh <furquan@google.com>2018-09-26 01:00:03 +0000
commitcfab6f69b6c47154df97a8d81cb4ef31e6953945 (patch)
treeb68e4cbda199009158e8143bcacddc1a8d46ace8
parent1f42a38e0fb9b4f080000cb7401a5939e68ca584 (diff)
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 <peichao.wang@bitland.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/28669 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Jett Rink <jettrink@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/google/octopus/variants/phaser/gpio.c41
-rw-r--r--src/mainboard/google/octopus/variants/phaser/variant.c14
2 files changed, 52 insertions, 3 deletions
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 <boardid.h>
#include <gpio.h>
#include <soc/gpio.h>
+#include <ec/google/chromeec/ec.h>
+#include <console/console.h>
+
+#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 <soc/gpio.h>
#include <soc/pci_devs.h>
#include <string.h>
+#include <ec/google/chromeec/ec.h>
+
+#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;