mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
reef: Print tcpc firmware version
BUG=chrome-os-partner:56866 BRANCH=master TEST=prints firmware version at boot up;make buildall -j Change-Id: Idb067186924e6706ccfc69a64f2febd61f396074 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/380317 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
0fbbafc151
commit
70bea45fa7
@@ -238,6 +238,22 @@ void board_reset_pd_mcu(void)
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
void board_print_tcpc_fw_version(int port)
|
||||
{
|
||||
int rv;
|
||||
int version;
|
||||
|
||||
if (port)
|
||||
rv = ps8751_tcpc_get_fw_version(port, &version);
|
||||
else
|
||||
rv = anx74xx_tcpc_get_fw_version(port, &version);
|
||||
|
||||
if (!rv)
|
||||
CPRINTS("TCPC p%d FW VER: 0x%x", port, version);
|
||||
}
|
||||
#endif
|
||||
|
||||
void board_tcpc_init(void)
|
||||
{
|
||||
/* Only reset TCPC if not sysjump */
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS
|
||||
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
|
||||
#define CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
|
||||
#define CONFIG_USB_PD_TCPM_ANX74XX
|
||||
#define CONFIG_USB_PD_TCPM_PS8751
|
||||
@@ -280,6 +281,7 @@ void board_reset_pd_mcu(void);
|
||||
int board_get_version(void);
|
||||
|
||||
void board_set_tcpc_power_mode(int port, int mode);
|
||||
void board_print_tcpc_fw_version(int port);
|
||||
|
||||
/* Sensors without hardware FIFO are in forced mode */
|
||||
#define CONFIG_ACCEL_FORCE_MODE_MASK \
|
||||
|
||||
@@ -545,6 +545,13 @@ static int anx74xx_tcpm_set_polarity(int port, int polarity)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
int anx74xx_tcpc_get_fw_version(int port, int *version)
|
||||
{
|
||||
return tcpc_read(port, ANX74XX_REG_FW_VERSION, version);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int anx74xx_tcpm_set_vconn(int port, int enable)
|
||||
{
|
||||
int reg, rv = EC_SUCCESS;
|
||||
@@ -852,6 +859,10 @@ int anx74xx_tcpm_init(int port)
|
||||
if (rv)
|
||||
return EC_ERROR_UNKNOWN;
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
board_print_tcpc_fw_version(port);
|
||||
#endif
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,5 +160,6 @@ extern const struct usb_mux_driver anx74xx_tcpm_usb_mux_driver;
|
||||
void anx74xx_tcpc_set_vbus(int port, int enable);
|
||||
void anx74xx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq);
|
||||
void anx74xx_tcpc_clear_hpd_status(int port);
|
||||
int anx74xx_tcpc_get_fw_version(int port, int *version);
|
||||
|
||||
#endif /* __CROS_EC_USB_PD_TCPM_ANX74XX_H */
|
||||
|
||||
@@ -60,3 +60,10 @@ void ps8751_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
|
||||
dp_set_irq(port, hpd_irq);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
int ps8751_tcpc_get_fw_version(int port, int *version)
|
||||
{
|
||||
return tcpc_read(port, PS8751_REG_VERSION, version);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
#define PS8751_VENDOR_ID 0x1DA0
|
||||
#define PS8751_PRODUCT_ID 0x8751
|
||||
|
||||
#define PS8751_REG_VERSION 0x90
|
||||
#define PS8751_REG_CTRL_1 0xD0
|
||||
#define PS8751_REG_CTRL_1_HPD (1 << 0)
|
||||
#define PS8751_REG_CTRL_1_IRQ (1 << 1)
|
||||
|
||||
void ps8751_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq);
|
||||
int ps8751_tcpc_get_fw_version(int port, int *version);
|
||||
#endif /* __CROS_EC_USB_PD_TCPM_PS8751_H */
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ static int init_alert_mask(int port)
|
||||
/* Set the alert mask in TCPC */
|
||||
rv = tcpc_write16(port, TCPC_REG_ALERT_MASK, mask);
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
board_print_tcpc_fw_version(port);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -2038,6 +2038,9 @@
|
||||
/* Use TCPC module (type-C port controller) */
|
||||
#undef CONFIG_USB_PD_TCPC
|
||||
|
||||
/* Get TCPC firmware version */
|
||||
#undef CONFIG_USB_PD_TCPC_FW_VERSION
|
||||
|
||||
/*
|
||||
* Track VBUS level in TCPC module. This will only be needed if we're acting
|
||||
* as an external TCPC.
|
||||
|
||||
Reference in New Issue
Block a user