summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/chell/board.c5
-rw-r--r--board/glados/board.c5
-rw-r--r--board/kunimitsu/board.c5
-rw-r--r--board/lars/board.c7
-rw-r--r--board/oak/board.c5
-rw-r--r--board/pdeval-stm32f072/PD_evaluation.md4
-rw-r--r--board/pdeval-stm32f072/board.c8
-rw-r--r--board/pdeval-stm32f072/board.h4
-rw-r--r--board/strago/board.c4
-rw-r--r--board/wheatley/board.c5
10 files changed, 50 insertions, 2 deletions
diff --git a/board/chell/board.c b/board/chell/board.c
index d6a78a1018..4706474487 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -110,6 +110,11 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+};
+
/* SPI devices */
const struct spi_device_t spi_devices[] = {
{ CONFIG_SPI_FLASH_PORT, 0, GPIO_PVT_CS0},
diff --git a/board/glados/board.c b/board/glados/board.c
index f26b1ff156..299e04fbae 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -130,6 +130,11 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+};
+
/* SPI devices */
const struct spi_device_t spi_devices[] = {
{ CONFIG_SPI_FLASH_PORT, 0, GPIO_PVT_CS0},
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c
index cebbadb83b..7344656908 100644
--- a/board/kunimitsu/board.c
+++ b/board/kunimitsu/board.c
@@ -123,6 +123,11 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+};
+
#ifndef BOARD_KUNIMITSU_V3
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_t fans[] = {
diff --git a/board/lars/board.c b/board/lars/board.c
index 0a9b5ea0ed..67342480ea 100644
--- a/board/lars/board.c
+++ b/board/lars/board.c
@@ -116,6 +116,13 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+#if CONFIG_USB_PD_PORT_COUNT >= 2
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+#endif
+};
+
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_t fans[] = {
{.flags = FAN_USE_RPM_MODE,
diff --git a/board/oak/board.c b/board/oak/board.c
index 7e204a33b5..687ad628dc 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -104,6 +104,11 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+};
+
struct mutex pericom_mux_lock;
struct pi3usb9281_config pi3usb9281_chips[] = {
{
diff --git a/board/pdeval-stm32f072/PD_evaluation.md b/board/pdeval-stm32f072/PD_evaluation.md
index b7fec09f35..395466f477 100644
--- a/board/pdeval-stm32f072/PD_evaluation.md
+++ b/board/pdeval-stm32f072/PD_evaluation.md
@@ -38,8 +38,8 @@ then document the new `CONFIG_USB_PD_TCPM_` variable in the [include/config.h](.
In [board/pdeval-stm32f072/board.h](board.h), you can update `CONFIG_USB_PD_PORT_COUNT` to the actual number of ports on your board.
You also need to create/delete the corresponding `PD_Cx` tasks in [board/pdeval-stm32f072/ec.tasklist](ec.tasklist).
-By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running with a 100kHz clock.
-To change the pins or speed, you need to edit `i2c_ports` in [board/pdeval-stm32f072/board.c](board.c), update `I2C_PORT_TCPC` in [board/pdeval-stm32f072/board.h](board.h) with the right controller number, and change the pin mux in [board/pdeval-stm32f072/gpio.inc](gpio.inc).
+By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running with a 100kHz clock, and tries to talk to TCPCs at i2c slave addresses 0x9c and 0x9e.
+To change the pins or speed, you need to edit `i2c_ports` in [board/pdeval-stm32f072/board.c](board.c), update `I2C_PORT_TCPC` in [board/pdeval-stm32f072/board.h](board.h) with the right controller number, and change the pin mux in [board/pdeval-stm32f072/gpio.inc](gpio.inc). To change TCPC i2c slave addresses, update `TCPC1_I2C_ADDR` and `TCPC2_I2C_ADDR` in [board/pdeval-stm32f072/board.h](board.h).
The I2C bus needs pull-up resistors on SCL/SDA. If your setup doesn't have external pull-ups on those lines, you can activate the chip internal pull-ups (but they are a bit weak for I2C) by editing [board/pdeval-stm32f072/gpio.inc](gpio.inc) and updating the alternate mode configuration flags with `GPIO_PULL_UP` e.g. :
`ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, GPIO_PULL_UP) /* I2C MASTER:PB6/7 */`
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index 3daedb5ae1..6fd472eee5 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -14,6 +14,7 @@
#include "task.h"
#include "usb_descriptor.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
void button_event(enum gpio_signal signal);
@@ -53,3 +54,10 @@ const struct i2c_port_t i2c_ports[] = {
{"tcpc", I2C_PORT_TCPC, 100 /* kHz */, GPIO_I2C0_SCL, GPIO_I2C0_SDA}
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, TCPC1_I2C_ADDR},
+#if CONFIG_USB_PD_PORT_COUNT >= 2
+ {I2C_PORT_TCPC, TCPC2_I2C_ADDR},
+#endif
+};
diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h
index 8358420b93..2d2b4edc29 100644
--- a/board/pdeval-stm32f072/board.h
+++ b/board/pdeval-stm32f072/board.h
@@ -46,6 +46,10 @@
#define I2C_PORT_TCPC 0
#define I2C_PORT_PD_MCU 0
+/* TCPC I2C slave addresses */
+#define TCPC1_I2C_ADDR 0x9c
+#define TCPC2_I2C_ADDR 0x9e
+
/* Timer selection */
/* USB Configuration */
diff --git a/board/strago/board.c b/board/strago/board.c
index 79e99b83ee..441835b0ea 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -108,6 +108,10 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+};
+
/* SPI master ports */
const struct spi_device_t spi_devices[] = {
{ CONFIG_SPI_FLASH_PORT, 0, GPIO_PVT_CS0},
diff --git a/board/wheatley/board.c b/board/wheatley/board.c
index 85ebedb53c..247edea7d0 100644
--- a/board/wheatley/board.c
+++ b/board/wheatley/board.c
@@ -123,6 +123,11 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
+ {I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
+};
+
const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
GPIO_LID_OPEN,