malefor: reset PD chip
Fill API board_reset_pd_mcu() for resetting DB PD chip.
BRANCH=none
TEST=make buildall -j
@@ -339,7 +339,32 @@ static const struct usb_mux mux_config_p1_usb3 = {
void board_reset_pd_mcu(void)
{
- /* TODO(b/159024035): Malefor: check USB PD reset operation */
+ int val;
+
+ gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
+ PS8815_PWR_H_RST_H_DELAY_MS));
+ gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
+ msleep(PS8815_FW_INIT_DELAY_MS);
+
+ /*
+ * b/144397088
+ * ps8815 firmware 0x01 needs special configuration
+ */
+
+ CPRINTS("%s: patching ps8815 registers", __func__);
+
+ if (i2c_read8(I2C_PORT_USB_C1,
+ PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ CPRINTS("ps8815: reg 0x0f was %02x", val);
+
+ if (i2c_write8(I2C_PORT_USB_C1,
+ PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ CPRINTS("ps8815: reg 0x0f set to 0x31");
+
+ if (i2c_read8(I2C_PORT_USB_C1,
+ PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ CPRINTS("ps8815: reg 0x0f now %02x", val);
}
__override void board_cbi_init(void)
