From 325fd3462e0b4088f915a7583295334779f5270e Mon Sep 17 00:00:00 2001 From: Tommie Date: Mon, 23 Dec 2019 13:33:34 +0800 Subject: mb/google/octopus: Add two new sku IDs for foob Declare these sku IDs: -SKU: 1 Foob, 1-cam, no touch, no pen. -SKU: 9 Foob360, 2-cam, touch, pen. BUG=b:145837644 BRANCH=octopus TEST=emerge-octopus coreboot Signed-off-by: tong.lin Change-Id: Iffcbb3f6f945ea299ff687a383a82b88dcd11ea1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/37906 Tested-by: build bot (Jenkins) Reviewed-by: Marco Chen --- .../google/octopus/variants/foob/Makefile.inc | 2 +- src/mainboard/google/octopus/variants/foob/gpio.c | 45 +++++++++++++++++++++- .../google/octopus/variants/foob/variant.c | 36 +++++++++++++++++ 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 src/mainboard/google/octopus/variants/foob/variant.c (limited to 'src/mainboard/google/octopus') diff --git a/src/mainboard/google/octopus/variants/foob/Makefile.inc b/src/mainboard/google/octopus/variants/foob/Makefile.inc index 9fb63f5f43..a291304bc0 100644 --- a/src/mainboard/google/octopus/variants/foob/Makefile.inc +++ b/src/mainboard/google/octopus/variants/foob/Makefile.inc @@ -1,3 +1,3 @@ bootblock-y += gpio.c - ramstage-y += gpio.c +ramstage-y += variant.c diff --git a/src/mainboard/google/octopus/variants/foob/gpio.c b/src/mainboard/google/octopus/variants/foob/gpio.c index 27ce0eea61..dec2ff550d 100644 --- a/src/mainboard/google/octopus/variants/foob/gpio.c +++ b/src/mainboard/google/octopus/variants/foob/gpio.c @@ -20,6 +20,8 @@ #include #include +#define SKU_UNKNOWN 0xFFFFFFFF + static const struct pad_config default_override_table[] = { PAD_NC(GPIO_52, UP_20K), PAD_NC(GPIO_53, UP_20K), @@ -37,8 +39,47 @@ static const struct pad_config default_override_table[] = { PAD_NC(GPIO_214, DN_20K), }; +static const struct pad_config non_touchscreen_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_NC(GPIO_146, UP_20K), + + PAD_NC(GPIO_161, DN_20K), + + PAD_NC(GPIO_213, DN_20K), + PAD_NC(GPIO_214, DN_20K), +}; + +bool no_touchscreen_sku(uint32_t sku_id) +{ + if (sku_id != 9) + return true; + else + return false; +} + const struct pad_config *variant_override_gpio_table(size_t *num) { - *num = ARRAY_SIZE(default_override_table); - return default_override_table; + const struct pad_config *c; + uint32_t sku_id = SKU_UNKNOWN; + + sku_id = get_board_sku(); + if (no_touchscreen_sku(sku_id)) { + c = non_touchscreen_override_table; + *num = ARRAY_SIZE(non_touchscreen_override_table); + } else { + c = default_override_table; + *num = ARRAY_SIZE(default_override_table); + } + + return c; } diff --git a/src/mainboard/google/octopus/variants/foob/variant.c b/src/mainboard/google/octopus/variants/foob/variant.c new file mode 100644 index 0000000000..dcc11dd0bb --- /dev/null +++ b/src/mainboard/google/octopus/variants/foob/variant.c @@ -0,0 +1,36 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include + +#define SKU_UNKNOWN 0xFFFFFFFF + +void variant_update_devtree(struct device *dev) +{ + uint32_t sku_id = SKU_UNKNOWN; + struct device *touchscreen_i2c_host; + + touchscreen_i2c_host = pcidev_path_on_root(PCH_DEVFN_I2C7); + + if (touchscreen_i2c_host == NULL) + return; + + /* SKU ID 1 does not have a touchscreen device, hence disable it. */ + sku_id = get_board_sku(); + if (no_touchscreen_sku(sku_id)) + touchscreen_i2c_host->enabled = 0; +} -- cgit v1.2.3