MLK-17313-3 imx8mq_evk: Add USB PD power sink support
authorYe Li <ye.li@nxp.com>
Mon, 8 Jan 2018 14:09:43 +0000 (08:09 -0600)
committerYe Li <ye.li@nxp.com>
Wed, 10 Jan 2018 05:47:14 +0000 (23:47 -0600)
Enable the TCPC driver for i.MX8MQ EVK board. When booting with dead battery,
the TCPC driver will setup USB PD connection to negotiate the power with PD
power charger.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Jun Li <jun.li@nxp.com>
board/freescale/imx8mq_evk/Kconfig
board/freescale/imx8mq_evk/imx8m_evk.c
configs/imx8mq_evk_defconfig

index 421b081..3f3bddf 100644 (file)
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "imx8mq_evk"
 
+source "board/freescale/common/Kconfig"
+
 endif
index 618f77c..ed5c912 100644 (file)
@@ -23,6 +23,8 @@
 #include <spl.h>
 #include <power/pmic.h>
 #include <power/pfuze100_pmic.h>
+#include <dm.h>
+#include "../common/tcpc.h"
 #include "../common/pfuze.h"
 #include <usb.h>
 #include <dwc3-uboot.h>
@@ -224,6 +226,32 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
+#ifdef CONFIG_USB_TCPC
+struct tcpc_port port;
+struct tcpc_port_config port_config = {
+       .i2c_bus = 0,
+       .addr = 0x50,
+       .port_type = TYPEC_PORT_UFP,
+       .max_snk_mv = 20000,
+       .max_snk_ma = 3000,
+       .max_snk_mw = 15000,
+       .op_snk_mv = 9000,
+};
+
+static int setup_typec(void)
+{
+       int ret;
+
+       ret = tcpc_init(&port, port_config, NULL);
+       if (ret) {
+               printf("%s: tcpc init failed, err=%d\n",
+                       __func__, ret);
+       }
+
+       return ret;
+}
+#endif
+
 int board_init(void)
 {
        board_qspi_init();
@@ -232,6 +260,9 @@ int board_init(void)
        setup_fec();
 #endif
 
+#ifdef CONFIG_USB_TCPC
+       setup_typec();
+#endif
        return 0;
 }
 
index f1ca4b2..671f0e0 100644 (file)
@@ -34,3 +34,4 @@ CONFIG_DM_THERMAL=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT=y
 CONFIG_SPL_LOAD_FIT=y
+CONFIG_USB_TCPC=y