summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <david.huang@quanta.corp-partner.google.com>2023-02-23 14:25:50 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-22 05:04:34 +0000
commit704068237c02438c1db3c63800630f57f093ec11 (patch)
treedc7c6e710067052329dc62e5b82b6366836889e9
parent749d46afe328a8a00d86b3cde72267f748c53c37 (diff)
downloadchrome-ec-704068237c02438c1db3c63800630f57f093ec11.tar.gz
constitution: add pse function
Add pse function BUG=b:267539938 BRANCH=None TEST=make BOARD=constitution Change-Id: Iec7434ed25c860823461a19ce24f140f3757342d Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4286389 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/constitution/board.c15
-rw-r--r--board/constitution/board.h5
-rw-r--r--board/constitution/gpio.inc7
-rw-r--r--board/constitution/i2c.c8
4 files changed, 35 insertions, 0 deletions
diff --git a/board/constitution/board.c b/board/constitution/board.c
index 277d7ead4f..f955ca783d 100644
--- a/board/constitution/board.c
+++ b/board/constitution/board.c
@@ -19,6 +19,7 @@
#include "peripheral_charger.h"
#include "power.h"
#include "power_button.h"
+#include "pse_ltc4291.h"
#include "switch.h"
#include "throttle_ap.h"
#include "usbc_config.h"
@@ -33,6 +34,20 @@
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
+/*
+ * The LTC4291 is a power over ethernet (PoE) power sourcing equipment (PSE)
+ * controller.
+ *
+ * Port 1: 100W
+ * Port 2-4: 15W
+ */
+const int pse_port_hpmd[4] = {
+ LTC4291_HPMD_MAX,
+ LTC4291_HPMD_MIN,
+ LTC4291_HPMD_MIN,
+ LTC4291_HPMD_MIN,
+};
+
/******************************************************************************/
/* USB-A charging control */
diff --git a/board/constitution/board.h b/board/constitution/board.h
index ce31073f06..2cf9f24c61 100644
--- a/board/constitution/board.h
+++ b/board/constitution/board.h
@@ -107,6 +107,8 @@
#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_PSE NPCX_I2C_PORT5_0
+
#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
@@ -136,6 +138,9 @@
/* ADC */
#define CONFIG_ADC
+/* PSE */
+#define CONFIG_PSE_LTC4291
+
/*
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
diff --git a/board/constitution/gpio.inc b/board/constitution/gpio.inc
index 3c8c69e04e..7e58ed9c2d 100644
--- a/board/constitution/gpio.inc
+++ b/board/constitution/gpio.inc
@@ -35,6 +35,10 @@ GPIO_INT(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT | GPIO_PULL_UP | GPIO
GPIO_INT(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
GPIO_INT(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
+/* PSE controller */
+GPIO(EC_PSE_PWM_INT, PIN(9, 6), GPIO_INPUT)
+GPIO(EC_RST_LTC4291, PIN(9, 7), GPIO_OUT_HIGH)
+
/* CCD */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
@@ -88,6 +92,8 @@ GPIO(HDMI_CEC_OUT, PIN(D, 3), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
GPIO(HDMI_CEC_PULL_UP, PIN(C, 2), GPIO_OUT_HIGH)
/* I2C SCL/SDA */
+GPIO(EC_I2C_LTC_SCL, PIN(3, 3), GPIO_INPUT)
+GPIO(EC_I2C_LTC_SDA, PIN(3, 6), GPIO_INPUT)
GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT)
GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT)
GPIO(EC_I2C_DP_SCL, PIN(B, 5), GPIO_INPUT)
@@ -142,6 +148,7 @@ IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW)
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
/* I2C alternate functions */
+ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* GPIO33/I2C5_SCL0/CTS_L, GPIO36/RTS_L/I2C5_SDA0 */
ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* GPIO87/I2C1_SDA0 */
ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* GPIO92/I2C2_SCL0, GPIO91/I2C2_SDA0, GPIO90/I2C1_SCL0 */
ALTERNATE(PIN_MASK(B, 0x0c), 0, MODULE_I2C, 0) /* GPIOB3/I2C7_SCL0/DCD_L, GPIOB2/I2C7_SDA0/DSR_L */
diff --git a/board/constitution/i2c.c b/board/constitution/i2c.c
index 7147dbf290..436f84a44a 100644
--- a/board/constitution/i2c.c
+++ b/board/constitution/i2c.c
@@ -50,6 +50,14 @@ const struct i2c_port_t i2c_ports[] = {
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
},
{
+ /* I2C5 */
+ .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_LTC_SCL,
+ .sda = GPIO_EC_I2C_LTC_SDA,
+ },
+ {
/* I2C6 */
.name = "ppc1",
.port = I2C_PORT_USB_C1_PPC,