summaryrefslogtreecommitdiff
path: root/board/anahera
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2022-02-25 14:51:42 +0800
committerCommit Bot <commit-bot@chromium.org>2022-03-12 07:38:27 +0000
commitd8c9c40325f6205529381c4fc3455965dec34021 (patch)
treed2ef80c21a516eb0888f5e8e433e725410724745 /board/anahera
parentf10cb56534d77e1e3d27c2245cea895e00de97bd (diff)
downloadchrome-ec-d8c9c40325f6205529381c4fc3455965dec34021.tar.gz
anahera: Add USBA retimer support
BUG=b:203837657 BRANCH=none TEST=PS8811 is detected on the console. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I4c3fc68cd256e090fd99e57016b596fc3fbfb2fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3490451 Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'board/anahera')
-rw-r--r--board/anahera/board.h4
-rw-r--r--board/anahera/i2c.c4
-rw-r--r--board/anahera/usbc_config.c36
-rw-r--r--board/anahera/usbc_config.h8
4 files changed, 50 insertions, 2 deletions
diff --git a/board/anahera/board.h b/board/anahera/board.h
index d2ad607ec4..b4336e950f 100644
--- a/board/anahera/board.h
+++ b/board/anahera/board.h
@@ -27,6 +27,7 @@
/* USB Type A Features */
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
+#define CONFIG_USBC_RETIMER_PS8811
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
@@ -109,6 +110,9 @@
#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_A0_RETIMER NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_A1_RETIMER NPCX_I2C_PORT6_1
+
#define I2C_ADDR_EEPROM_FLAGS 0x50
/*
diff --git a/board/anahera/i2c.c b/board/anahera/i2c.c
index 8c648416ab..7748066514 100644
--- a/board/anahera/i2c.c
+++ b/board/anahera/i2c.c
@@ -20,7 +20,7 @@ const struct i2c_port_t i2c_ports[] = {
},
{
/* I2C2 */
- .name = "ppc0",
+ .name = "ppc0,usba0_retimer",
.port = I2C_PORT_USB_C0_PPC,
.kbps = 1000,
.scl = GPIO_EC_I2C_USB_C0_PPC_BC_SCL,
@@ -52,7 +52,7 @@ const struct i2c_port_t i2c_ports[] = {
},
{
/* I2C6 */
- .name = "ppc1,retimer1",
+ .name = "ppc1,retimer1,usba1_retimer",
.port = I2C_PORT_USB_C1_PPC,
.kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_MIX_SCL,
diff --git a/board/anahera/usbc_config.c b/board/anahera/usbc_config.c
index e0742edb85..9c90e0af5e 100644
--- a/board/anahera/usbc_config.c
+++ b/board/anahera/usbc_config.c
@@ -12,6 +12,7 @@
#include "driver/bc12/pi3usb9201_public.h"
#include "driver/ppc/syv682x_public.h"
#include "driver/retimer/bb_retimer_public.h"
+#include "driver/retimer/ps8811.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
@@ -301,3 +302,38 @@ __override bool board_is_dts_port(int port)
{
return port == USBC_PORT_C0;
}
+
+const struct usb_mux usba_ps8811[] = {
+ [USBA_PORT_A0] = {
+ .usb_port = USBA_PORT_A0,
+ .i2c_port = I2C_PORT_USB_A0_RETIMER,
+ .i2c_addr_flags = PS8811_I2C_ADDR_FLAGS0,
+ },
+ [USBA_PORT_A1] = {
+ .usb_port = USBA_PORT_A1,
+ .i2c_port = I2C_PORT_USB_A1_RETIMER,
+ .i2c_addr_flags = PS8811_I2C_ADDR_FLAGS0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(usba_ps8811) == USBA_PORT_COUNT);
+
+static int usba_retimer_init(int port)
+{
+ int rv;
+ int val;
+ const struct usb_mux *me = &usba_ps8811[port];
+
+ rv = ps8811_i2c_read(me, PS8811_REG_PAGE1,
+ PS8811_REG1_USB_BEQ_LEVEL, &val);
+
+ return rv;
+}
+
+void board_chipset_startup(void)
+{
+ int i;
+
+ for (i = 0; i < USBA_PORT_COUNT; ++i)
+ usba_retimer_init(i);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
diff --git a/board/anahera/usbc_config.h b/board/anahera/usbc_config.h
index c314466f77..a34964af3b 100644
--- a/board/anahera/usbc_config.h
+++ b/board/anahera/usbc_config.h
@@ -10,6 +10,14 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+/* USB-A ports */
+enum usba_port {
+ USBA_PORT_A0 = 0,
+ USBA_PORT_A1,
+ USBA_PORT_COUNT
+};
+
+/* USB-C ports */
enum usbc_port {
USBC_PORT_C0 = 0,
USBC_PORT_C1,