1
0
Fork 0

MLK-16013-20 staging: typec: Add bist test mode support

BIST(Built In Self-Test – Power Delivery testing mechanism for
the PHY Layer), see PD 3.0 spec 5.9 Built in Self-Test (BIST), is
added to support BIST message handling in PD compliance test.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
pull/10/head
Li Jun 2017-07-27 21:38:13 +08:00 committed by Jason Liu
parent 772248ed7a
commit e4c6f14104
4 changed files with 21 additions and 0 deletions

View File

@ -426,6 +426,15 @@ static int tcpci_vbus_detect(struct tcpc_dev *tcpc, bool enable)
return 0;
}
static void tcpci_bist_mode(struct tcpc_dev *tcpc, bool enable)
{
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
regmap_update_bits(tcpci->regmap, TCPC_TCPC_CTRL,
TCPC_TCPC_CTRL_BIST_MODE,
enable ? TCPC_TCPC_CTRL_BIST_MODE : 0);
}
static int tcpci_init(struct tcpc_dev *tcpc)
{
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
@ -602,6 +611,7 @@ static int tcpci_probe(struct i2c_client *client,
tcpci->tcpc.vbus_detect = tcpci_vbus_detect;
tcpci->tcpc.vbus_discharge = tcpci_vbus_force_discharge;
tcpci->tcpc.get_vbus_vol = tcpci_get_vbus_vol;
tcpci->tcpc.bist_mode = tcpci_bist_mode;
tcpci->tcpc.set_pd_rx = tcpci_set_pd_rx;
tcpci->tcpc.set_roles = tcpci_set_roles;

View File

@ -45,6 +45,7 @@
#define TCPC_CONFIG_STD_OUTPUT 0x18
#define TCPC_TCPC_CTRL 0x19
#define TCPC_TCPC_CTRL_BIST_MODE BIT(1)
#define TCPC_TCPC_CTRL_ORIENTATION BIT(0)
#define TCPC_ROLE_CTRL 0x1a

View File

@ -1951,6 +1951,13 @@ static void tcpm_typec_connect(struct tcpm_port *port)
}
}
static void tcpm_bist_handle(struct tcpm_port *port, bool enable)
{
/* Enable or disable BIST test mode */
if (port->tcpc && port->tcpc->bist_mode)
port->tcpc->bist_mode(port->tcpc, enable);
}
static int tcpm_src_attach(struct tcpm_port *port)
{
enum typec_cc_polarity polarity =
@ -2044,6 +2051,7 @@ static void tcpm_reset_port(struct tcpm_port *port)
*/
port->rx_msgid = -1;
tcpm_bist_handle(port, false);
port->tcpc->set_pd_rx(port->tcpc, false);
tcpm_init_vbus(port); /* also disables charging */
tcpm_init_vconn(port);
@ -2826,6 +2834,7 @@ static void run_state_machine(struct tcpm_port *port)
break;
case BIST_RX:
tcpm_bist_handle(port, true);
switch (BDO_MODE_MASK(port->bist_request)) {
case BDO_MODE_CARRIER2:
tcpm_pd_transmit(port, TCPC_TX_BIST_MODE_2, NULL);

View File

@ -139,6 +139,7 @@ struct tcpc_dev {
const struct pd_message *msg);
int (*vbus_detect)(struct tcpc_dev *dev, bool enable);
int (*vbus_discharge)(struct tcpc_dev *tcpc, bool enable);
void (*bist_mode)(struct tcpc_dev *tcpc, bool enable);
struct tcpc_mux_dev *mux;
};