diff options
author | Edward Hill <ecgh@chromium.org> | 2020-04-14 15:55:21 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-15 20:31:29 +0000 |
commit | 3ef3d621aa82cf1092c4f4f995bf4b604932ae0a (patch) | |
tree | 803cf57991806d880bbc53e552417329f20eabed /baseboard | |
parent | 2097501f72619ca189cc0a9ac39af3149c3f9315 (diff) | |
download | chrome-ec-3ef3d621aa82cf1092c4f4f995bf4b604932ae0a.tar.gz |
Dalboz: Move battery I2C on V1 HW
Split i2c_ports[] into Trembyle and Dalboz variants.
Change I2C_PORT_BATTERY to I2C7 for Dalboz V1 HW.
Check for V0 HW on boot to re-map back to I2C2.
BUG=b:153459542
BRANCH=none
TEST=battery still works on V0 HW
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: Ic3b115ef3bae66da63c1aebe8d2ae47e9705baa6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2149751
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/zork/baseboard.c | 60 | ||||
-rw-r--r-- | baseboard/zork/baseboard.h | 12 | ||||
-rw-r--r-- | baseboard/zork/variant_dalboz.c | 60 | ||||
-rw-r--r-- | baseboard/zork/variant_trembyle.c | 60 |
4 files changed, 129 insertions, 63 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index bdcb25cb76..ba7b55ed19 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -105,66 +105,6 @@ const struct power_signal_info power_signal_list[] = { }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); -const struct i2c_port_t i2c_ports[] = { - { - .name = "tcpc0", - .port = I2C_PORT_TCPC0, - .kbps = 400, - .scl = GPIO_EC_I2C_USB_A0_C0_SCL, - .sda = GPIO_EC_I2C_USB_A0_C0_SDA, - }, - { - .name = "tcpc1", - .port = I2C_PORT_TCPC1, - .kbps = 400, - .scl = GPIO_EC_I2C_USB_A1_C1_SCL, - .sda = GPIO_EC_I2C_USB_A1_C1_SDA, - }, - { - .name = "power", - .port = I2C_PORT_BATTERY, - .kbps = 100, - .scl = GPIO_EC_I2C_POWER_SCL, - .sda = GPIO_EC_I2C_POWER_SDA, - }, - { - .name = "ap_mux", - .port = I2C_PORT_USB_AP_MUX, - .kbps = 400, - .scl = GPIO_EC_I2C_USBC_AP_MUX_SCL, - .sda = GPIO_EC_I2C_USBC_AP_MUX_SDA, - }, - { - .name = "thermal", - .port = I2C_PORT_THERMAL, - .kbps = 400, - .scl = GPIO_FCH_SIC, - .sda = GPIO_FCH_SID, - }, - { - .name = "sensor", - .port = I2C_PORT_SENSOR, - .kbps = 400, - .scl = GPIO_EC_I2C_SENSOR_CBI_SCL, - .sda = GPIO_EC_I2C_SENSOR_CBI_SDA, - }, - { - .name = "ap_audio", - .port = I2C_PORT_AP_AUDIO, - .kbps = 400, - .scl = GPIO_FCH_I2C_AUDIO_SCL, - .sda = GPIO_FCH_I2C_AUDIO_SDA, - }, - { - .name = "ap_hdmi", - .port = I2C_PORT_AP_HDMI, - .kbps = 400, - .scl = GPIO_FCH_I2C_HDMI_HUB_3V3_SCL, - .sda = GPIO_FCH_I2C_HDMI_HUB_3V3_SDA, - }, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - struct ppc_config_t ppc_chips[] = { [USBC_PORT_C0] = { /* Device does not talk I2C */ diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h index 4780a70f97..e8bf12fdf4 100644 --- a/baseboard/zork/baseboard.h +++ b/baseboard/zork/baseboard.h @@ -218,15 +218,21 @@ #define I2C_PORT_USBA0 NPCX_I2C_PORT0_0 #define I2C_PORT_TCPC1 NPCX_I2C_PORT1_0 #define I2C_PORT_USBA1 NPCX_I2C_PORT1_0 -#define I2C_PORT_BATTERY NPCX_I2C_PORT2_0 -#define I2C_PORT_CHARGER I2C_PORT_BATTERY +#define I2C_PORT_CHARGER NPCX_I2C_PORT2_0 #define I2C_PORT_USB_AP_MUX NPCX_I2C_PORT3_0 #define I2C_PORT_THERMAL NPCX_I2C_PORT4_1 #define I2C_PORT_SENSOR NPCX_I2C_PORT5_0 #define I2C_PORT_ACCEL I2C_PORT_SENSOR #define I2C_PORT_EEPROM I2C_PORT_SENSOR #define I2C_PORT_AP_AUDIO NPCX_I2C_PORT6_1 -#define I2C_PORT_AP_HDMI NPCX_I2C_PORT7_0 + +#if defined(VARIANT_ZORK_TREMBYLE) + #define I2C_PORT_BATTERY NPCX_I2C_PORT2_0 + #define I2C_PORT_AP_HDMI NPCX_I2C_PORT7_0 +#elif defined(VARIANT_ZORK_DALBOZ) + #define I2C_PORT_BATTERY_V0 NPCX_I2C_PORT2_0 + #define I2C_PORT_BATTERY_V1 NPCX_I2C_PORT7_0 +#endif #define I2C_ADDR_EEPROM_FLAGS 0x50 #define PS8743_I2C_ADDR_FLAGS 0x11 diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c index 01a30ab19c..41307d6da4 100644 --- a/baseboard/zork/variant_dalboz.c +++ b/baseboard/zork/variant_dalboz.c @@ -14,6 +14,66 @@ #include "ioexpander.h" #include "usb_mux.h" +const struct i2c_port_t i2c_ports[] = { + { + .name = "tcpc0", + .port = I2C_PORT_TCPC0, + .kbps = 400, + .scl = GPIO_EC_I2C_USB_A0_C0_SCL, + .sda = GPIO_EC_I2C_USB_A0_C0_SDA, + }, + { + .name = "tcpc1", + .port = I2C_PORT_TCPC1, + .kbps = 400, + .scl = GPIO_EC_I2C_USB_A1_C1_SCL, + .sda = GPIO_EC_I2C_USB_A1_C1_SDA, + }, + { + .name = "charger", + .port = I2C_PORT_CHARGER, + .kbps = 100, + .scl = GPIO_EC_I2C_POWER_SCL, + .sda = GPIO_EC_I2C_POWER_SDA, + }, + { + .name = "ap_mux", + .port = I2C_PORT_USB_AP_MUX, + .kbps = 400, + .scl = GPIO_EC_I2C_USBC_AP_MUX_SCL, + .sda = GPIO_EC_I2C_USBC_AP_MUX_SDA, + }, + { + .name = "thermal", + .port = I2C_PORT_THERMAL, + .kbps = 400, + .scl = GPIO_FCH_SIC, + .sda = GPIO_FCH_SID, + }, + { + .name = "sensor", + .port = I2C_PORT_SENSOR, + .kbps = 400, + .scl = GPIO_EC_I2C_SENSOR_CBI_SCL, + .sda = GPIO_EC_I2C_SENSOR_CBI_SDA, + }, + { + .name = "ap_audio", + .port = I2C_PORT_AP_AUDIO, + .kbps = 400, + .scl = GPIO_I2C_AUDIO_USB_HUB_SCL, + .sda = GPIO_I2C_AUDIO_USB_HUB_SDA, + }, + { + .name = "battery", + .port = I2C_PORT_BATTERY_V1, + .kbps = 100, + .scl = GPIO_EC_I2C_BATT_SCL, + .sda = GPIO_EC_I2C_BATT_SDA, + }, +}; +const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + /***************************************************************************** * IO expander */ diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c index 75dce91948..c58b9bbeee 100644 --- a/baseboard/zork/variant_trembyle.c +++ b/baseboard/zork/variant_trembyle.c @@ -24,6 +24,66 @@ #define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) +const struct i2c_port_t i2c_ports[] = { + { + .name = "tcpc0", + .port = I2C_PORT_TCPC0, + .kbps = 400, + .scl = GPIO_EC_I2C_USB_A0_C0_SCL, + .sda = GPIO_EC_I2C_USB_A0_C0_SDA, + }, + { + .name = "tcpc1", + .port = I2C_PORT_TCPC1, + .kbps = 400, + .scl = GPIO_EC_I2C_USB_A1_C1_SCL, + .sda = GPIO_EC_I2C_USB_A1_C1_SDA, + }, + { + .name = "power", + .port = I2C_PORT_BATTERY, + .kbps = 100, + .scl = GPIO_EC_I2C_POWER_SCL, + .sda = GPIO_EC_I2C_POWER_SDA, + }, + { + .name = "ap_mux", + .port = I2C_PORT_USB_AP_MUX, + .kbps = 400, + .scl = GPIO_EC_I2C_USBC_AP_MUX_SCL, + .sda = GPIO_EC_I2C_USBC_AP_MUX_SDA, + }, + { + .name = "thermal", + .port = I2C_PORT_THERMAL, + .kbps = 400, + .scl = GPIO_FCH_SIC, + .sda = GPIO_FCH_SID, + }, + { + .name = "sensor", + .port = I2C_PORT_SENSOR, + .kbps = 400, + .scl = GPIO_EC_I2C_SENSOR_CBI_SCL, + .sda = GPIO_EC_I2C_SENSOR_CBI_SDA, + }, + { + .name = "ap_audio", + .port = I2C_PORT_AP_AUDIO, + .kbps = 400, + .scl = GPIO_FCH_I2C_AUDIO_SCL, + .sda = GPIO_FCH_I2C_AUDIO_SDA, + }, + { + .name = "ap_hdmi", + .port = I2C_PORT_AP_HDMI, + .kbps = 400, + .scl = GPIO_FCH_I2C_HDMI_HUB_3V3_SCL, + .sda = GPIO_FCH_I2C_HDMI_HUB_3V3_SDA, + }, +}; +const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + /***************************************************************************** * TCPC */ |