diff options
author | Edward Hill <ecgh@chromium.org> | 2020-02-25 14:53:22 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-27 00:56:12 +0000 |
commit | 4baea4e432c476e66d1defb81391ce982e3cdfd8 (patch) | |
tree | 06da51510acdea97552250a2f70ac75d0f715b7d /baseboard/zork | |
parent | 3e8d6447b38d8083ef6e6c6321e0e5b8b9f9c38f (diff) | |
download | chrome-ec-4baea4e432c476e66d1defb81391ce982e3cdfd8.tar.gz |
zork: Create baseboard variants for trembyle/dalboz
BUG=b:150110428
BRANCH=none
TEST=none
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: I30503a0416325fc8573a4a62b3bc3ff943b5008e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2071390
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'baseboard/zork')
-rw-r--r-- | baseboard/zork/baseboard.c | 56 | ||||
-rw-r--r-- | baseboard/zork/baseboard.h | 5 | ||||
-rw-r--r-- | baseboard/zork/build.mk | 2 | ||||
-rw-r--r-- | baseboard/zork/variant_dalboz.c | 23 | ||||
-rw-r--r-- | baseboard/zork/variant_trembyle.c | 70 |
5 files changed, 100 insertions, 56 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index d9030fe178..42cceca866 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -22,7 +22,6 @@ #include "driver/ppc/nx20p348x.h" #include "driver/retimer/pi3dpx1207.h" #include "driver/retimer/ps8802.h" -#include "driver/retimer/ps8811.h" #include "driver/retimer/ps8818.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/nct38xx.h" @@ -454,61 +453,6 @@ void bc12_interrupt(enum gpio_signal signal) } /***************************************************************************** - * USB-A Retimer tuning - */ -#define PS8811_ACCESS_RETRIES 2 - -/* PS8811 gain tuning */ -static void ps8811_tuning_init(void) -{ - int rv; - int retry; - - /* Turn on the retimers */ - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 1); - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1); - - /* USB-A0 can run with default settings */ - for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { - int val; - - rv = i2c_read8(I2C_PORT_USBA0, - PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, - PS8811_REG1_USB_BEQ_LEVEL, &val); - if (!rv) - break; - } - if (rv) { - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); - CPRINTSUSB("C0: PS8811 not detected"); - } - - /* USB-A1 needs to increase gain to get over MB/DB connector */ - for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { - rv = i2c_write8(I2C_PORT_USBA1, - PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, - PS8811_REG1_USB_BEQ_LEVEL, - PS8811_BEQ_I2C_LEVEL_UP_13DB | - PS8811_BEQ_PIN_LEVEL_UP_18DB); - if (!rv) - break; - } - if (rv) { - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); - CPRINTSUSB("C1: PS8811 not detected"); - } -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, ps8811_tuning_init, HOOK_PRIO_DEFAULT); - -static void ps8811_retimer_off(void) -{ - /* Turn on the retimers */ - ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); - ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, ps8811_retimer_off, HOOK_PRIO_DEFAULT); - -/***************************************************************************** * Custom Zork USB-C1 Retimer/MUX driver */ diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h index e4f29ad839..89fdd3f287 100644 --- a/baseboard/zork/baseboard.h +++ b/baseboard/zork/baseboard.h @@ -8,6 +8,11 @@ #ifndef __CROS_EC_BASEBOARD_H #define __CROS_EC_BASEBOARD_H +#if (defined(VARIANT_ZORK_TREMBYLE) \ + + defined(VARIANT_ZORK_DALBOZ)) != 1 +#error Must choose VARIANT_ZORK_TREMBYLE or VARIANT_ZORK_DALBOZ +#endif + /* NPCX7 config */ #define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */ #define NPCX_TACH_SEL2 0 /* No tach. */ diff --git a/baseboard/zork/build.mk b/baseboard/zork/build.mk index c8ae965325..7709c1d6e8 100644 --- a/baseboard/zork/build.mk +++ b/baseboard/zork/build.mk @@ -8,3 +8,5 @@ baseboard-y=baseboard.o baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o +baseboard-$(VARIANT_ZORK_TREMBYLE)+=variant_trembyle.o +baseboard-$(VARIANT_ZORK_DALBOZ)+=variant_dalboz.o diff --git a/baseboard/zork/variant_dalboz.c b/baseboard/zork/variant_dalboz.c new file mode 100644 index 0000000000..e3d1a7417d --- /dev/null +++ b/baseboard/zork/variant_dalboz.c @@ -0,0 +1,23 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "console.h" +#include "gpio.h" +#include "hooks.h" +#include "i2c.h" +#include "ioexpander.h" + +static void usba_retimer_on(void) +{ + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1); +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, usba_retimer_on, HOOK_PRIO_DEFAULT); + +static void usba_retimer_off(void) +{ + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, usba_retimer_off, HOOK_PRIO_DEFAULT); diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c new file mode 100644 index 0000000000..b8f70c6295 --- /dev/null +++ b/baseboard/zork/variant_trembyle.c @@ -0,0 +1,70 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "console.h" +#include "driver/retimer/ps8811.h" +#include "gpio.h" +#include "hooks.h" +#include "i2c.h" +#include "ioexpander.h" + +#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) +#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) + +/***************************************************************************** + * USB-A Retimer tuning + */ +#define PS8811_ACCESS_RETRIES 2 + +/* PS8811 gain tuning */ +static void ps8811_tuning_init(void) +{ + int rv; + int retry; + + /* Turn on the retimers */ + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 1); + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 1); + + /* USB-A0 can run with default settings */ + for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { + int val; + + rv = i2c_read8(I2C_PORT_USBA0, + PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, + PS8811_REG1_USB_BEQ_LEVEL, &val); + if (!rv) + break; + } + if (rv) { + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); + CPRINTSUSB("C0: PS8811 not detected"); + } + + /* USB-A1 needs to increase gain to get over MB/DB connector */ + for (retry = 0; retry < PS8811_ACCESS_RETRIES; ++retry) { + rv = i2c_write8(I2C_PORT_USBA1, + PS8811_I2C_ADDR_FLAGS + PS8811_REG_PAGE1, + PS8811_REG1_USB_BEQ_LEVEL, + PS8811_BEQ_I2C_LEVEL_UP_13DB | + PS8811_BEQ_PIN_LEVEL_UP_18DB); + if (!rv) + break; + } + if (rv) { + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); + CPRINTSUSB("C1: PS8811 not detected"); + } +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, ps8811_tuning_init, HOOK_PRIO_DEFAULT); + +static void ps8811_retimer_off(void) +{ + /* Turn on the retimers */ + ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0); + ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, ps8811_retimer_off, HOOK_PRIO_DEFAULT); |