summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Semjonovs <asemjonovs@google.com>2022-05-12 15:25:53 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-16 15:46:16 +0000
commitddcdd9bce0ea443c494ec5a57c00ccaacec776bc (patch)
tree2681acf9ed3d679947d104c5db31a6b6a948e23e
parent2b84534991fe772f6150c8d53e0a563af4895ada (diff)
downloadchrome-ec-ddcdd9bce0ea443c494ec5a57c00ccaacec776bc.tar.gz
zephyr: tcpm: Add flags property to TCPC yaml
Updated ps8xxx device to include TCPC config flags BUG=b:231291434 BRANCH=NONE TEST=Attach USBC to DUT and make sure device is detected. Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I9d38ad8ed988bb6d2c57976261dde65cdfe0075b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3645317 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--include/usb_pd_tcpm.h8
-rw-r--r--zephyr/dts/bindings/usbc/parade,ps8xxx.yaml6
-rw-r--r--zephyr/include/dt-bindings/usb_pd_tcpm.h33
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx.h1
4 files changed, 48 insertions, 0 deletions
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 3d99e035f9..641c7afd5c 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -495,6 +495,12 @@ struct tcpm_drv {
int (*reset_bist_type_2)(int port);
};
+#ifdef CONFIG_ZEPHYR
+
+#include "dt-bindings/usb_pd_tcpm.h"
+
+#else /* !CONFIG_ZEPHYR */
+
/*
* Macros for tcpc_config_t flags field.
*
@@ -519,6 +525,8 @@ struct tcpm_drv {
#define TCPC_FLAGS_CONTROL_FRS BIT(7)
#define TCPC_FLAGS_VBUS_MONITOR BIT(8)
+#endif /* !CONFIG_ZEPHYR */
+
struct tcpc_config_t {
enum ec_bus_type bus_type; /* enum ec_bus_type */
union {
diff --git a/zephyr/dts/bindings/usbc/parade,ps8xxx.yaml b/zephyr/dts/bindings/usbc/parade,ps8xxx.yaml
index 6c1098b784..8a65e736c9 100644
--- a/zephyr/dts/bindings/usbc/parade,ps8xxx.yaml
+++ b/zephyr/dts/bindings/usbc/parade,ps8xxx.yaml
@@ -21,3 +21,9 @@ properties:
- "PS8XXX_I2C_ADDR4_FLAGS"
description: |
I2C address of controller
+
+ tcpc-flags:
+ type: int
+ default: 0
+ description: |
+ TCPC configuration flags
diff --git a/zephyr/include/dt-bindings/usb_pd_tcpm.h b/zephyr/include/dt-bindings/usb_pd_tcpm.h
new file mode 100644
index 0000000000..77a982bdda
--- /dev/null
+++ b/zephyr/include/dt-bindings/usb_pd_tcpm.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef DT_BINDINGS_USB_PD_TCPM_H_
+#define DT_BINDINGS_USB_PD_TCPM_H_
+
+/*
+ * Macros for tcpc_config_t flags field.
+ *
+ * Bit 0 --> Polarity for TCPC alert. Set to 1 if alert is active high.
+ * Bit 1 --> Set to 1 if TCPC alert line is open-drain instead of push-pull.
+ * Bit 2 --> Polarity for TCPC reset. Set to 1 if reset line is active high.
+ * Bit 3 --> Set to 1 if TCPC is using TCPCI Revision 2.0
+ * Bit 4 --> Set to 1 if TCPC is using TCPCI Revision 2.0 but does not support
+ * the vSafe0V bit in the EXTENDED_STATUS_REGISTER
+ * Bit 5 --> Set to 1 to prevent TCPC setting debug accessory control
+ * Bit 6 --> TCPC controls VCONN (even when CONFIG_USB_PD_TCPC_VCONN is off)
+ * Bit 7 --> TCPC controls FRS (even when CONFIG_USB_PD_FRS_TCPC is off)
+ * Bit 8 --> TCPC enable VBUS monitoring
+ */
+#define TCPC_FLAGS_ALERT_ACTIVE_HIGH BIT(0)
+#define TCPC_FLAGS_ALERT_OD BIT(1)
+#define TCPC_FLAGS_RESET_ACTIVE_HIGH BIT(2)
+#define TCPC_FLAGS_TCPCI_REV2_0 BIT(3)
+#define TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V BIT(4)
+#define TCPC_FLAGS_NO_DEBUG_ACC_CONTROL BIT(5)
+#define TCPC_FLAGS_CONTROL_VCONN BIT(6)
+#define TCPC_FLAGS_CONTROL_FRS BIT(7)
+#define TCPC_FLAGS_VBUS_MONITOR BIT(8)
+
+#endif
diff --git a/zephyr/shim/include/usbc/tcpc_ps8xxx.h b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
index e42f806f3c..d47f6cc9df 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
@@ -17,4 +17,5 @@
id, i2c_addr_flags), \
}, \
.drv = &ps8xxx_tcpm_drv, \
+ .flags = DT_PROP(id, tcpc_flags), \
},