mb/google/bluey: Implement PS8820 retimer configuration
Implement mainboard_usb_typec_configure to program the Parade PS8820 retimers over I2C. The function sets the USB3 mode registers for either normal or flipped orientation based on the polarity reported by the SoC. Additionally, update mainboard_init to perform standard I2C initialization for the retimer buses when this feature is enabled, ensuring the buses are ready for transactions during the USB sequencing. BUG=b:473489095 TEST=Verify USB SS detection on Quartz. Sample output: ``` firmware-shell: md 0x0a800420 8 0a800420: 000002a0 00000000 00000000 00000000 ................ 0a800430: 00001203 00000000 00000000 00000000 ................ firmware-shell: md 0x0a600420 8 0a600420: 000002a0 00000000 00000000 00000000 ................ 0a600430: 00001203 00000000 00000000 00000000 ................ ``` Change-Id: I14f86945aeea9b83a9433edd53f5023231ca859d Signed-off-by: Kapil Porwal <kapilporwal@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90707 Reviewed-by: Jayvik Desai <jayvik@google.com> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Pranava Y N <pranavayn@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
657bcd32d9
commit
f9efe53cb0
1 changed files with 33 additions and 4 deletions
|
|
@ -8,16 +8,42 @@
|
|||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <device/device.h>
|
||||
#include <device/i2c_simple.h>
|
||||
#include <ec/google/chromeec/ec.h>
|
||||
#include <gpio.h>
|
||||
#include <soc/clock.h>
|
||||
#include <soc/pcie.h>
|
||||
#include <soc/qupv3_config_common.h>
|
||||
#include <soc/qupv3_i2c_common.h>
|
||||
#include <soc/qup_se_handlers_common.h>
|
||||
#include "board.h"
|
||||
#include <soc/rpmh_config.h>
|
||||
#include <soc/usb/usb.h>
|
||||
|
||||
#define C0_RETIMER_I2C_BUS 0x03
|
||||
#define C1_RETIMER_I2C_BUS 0x07
|
||||
#define PS8820_SLAVE_ADDR 0x08
|
||||
|
||||
#define PS8820_USB_PORT_CONN_STATUS_REG 0x00
|
||||
#define USB3_MODE_NORMAL_VAL 0x21
|
||||
#define USB3_MODE_FLIP_VAL 0x23
|
||||
|
||||
void mainboard_usb_typec_configure(uint8_t port_num, bool inverse_polarity)
|
||||
{
|
||||
if (!CONFIG(MAINBOARD_HAS_PS8820_RETIMER))
|
||||
return;
|
||||
|
||||
/* There are only two ports (0 and 1) */
|
||||
if (port_num > 1) {
|
||||
printk(BIOS_WARNING, "Invalid USB Type-C port number (%d)!\n", port_num);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t bus = port_num ? C1_RETIMER_I2C_BUS : C0_RETIMER_I2C_BUS;
|
||||
uint8_t mode_value = inverse_polarity ? USB3_MODE_FLIP_VAL : USB3_MODE_NORMAL_VAL;
|
||||
i2c_writeb(bus, PS8820_SLAVE_ADDR, PS8820_USB_PORT_CONN_STATUS_REG, mode_value);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function calls the underlying PMIC/EC function only once during the
|
||||
* first execution and caches the result for all subsequent calls.
|
||||
|
|
@ -136,11 +162,14 @@ static void mainboard_init(struct device *dev)
|
|||
/* ADSP I2C (Charger/Fuel gauge) */
|
||||
qupv3_se_fw_load_and_init(QUPV3_2_SE4, SE_PROTOCOL_I2C, GSI);
|
||||
|
||||
/* USB-C0 Re-Timer I2C */
|
||||
qupv3_se_fw_load_and_init(QUPV3_0_SE3, SE_PROTOCOL_I2C, MIXED);
|
||||
|
||||
/* USB-C1 Re-Timer I2C */
|
||||
qupv3_se_fw_load_and_init(QUPV3_0_SE7, SE_PROTOCOL_I2C, MIXED);
|
||||
if (CONFIG(MAINBOARD_HAS_PS8820_RETIMER)) {
|
||||
i2c_init(QUPV3_0_SE3, I2C_SPEED_FAST); /* USB-C0 Re-Timer I2C */
|
||||
i2c_init(QUPV3_0_SE7, I2C_SPEED_FAST); /* USB-C1 Re-Timer I2C */
|
||||
} else {
|
||||
qupv3_se_fw_load_and_init(QUPV3_0_SE3, SE_PROTOCOL_I2C, MIXED); /* USB-C0 Re-Timer I2C */
|
||||
qupv3_se_fw_load_and_init(QUPV3_0_SE7, SE_PROTOCOL_I2C, MIXED); /* USB-C1 Re-Timer I2C */
|
||||
}
|
||||
|
||||
if (!CONFIG(MAINBOARD_NO_USB_A_PORT))
|
||||
qupv3_se_fw_load_and_init(QUPV3_0_SE1, SE_PROTOCOL_I2C, MIXED); /* USB-A retimer */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue