summaryrefslogtreecommitdiff
path: root/zephyr/shim
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2022-08-10 14:11:20 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-26 18:37:55 +0000
commit8a6b84e62e3d717646bfc8764755a21c1b9a68c5 (patch)
tree7bd8aaa678418a6adc254049cdad4334dfa9c645 /zephyr/shim
parent933e50627a667c31f42b6f6e38860743b2a8540b (diff)
downloadchrome-ec-8a6b84e62e3d717646bfc8764755a21c1b9a68c5.tar.gz
zephyr: move mux nodes onto i2c buses
Move all USB-C mux nodes onto the i2c buses from named-usbc-port nodes. The change should simplify the upstream process of the mux chips drivers. BUG=b:240618099 TEST=zmake build -a; make sure usb-c works BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ieab80f2ccf2f47f93597e90f5afbda8072b71d49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3827181 Reviewed-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim')
-rw-r--r--zephyr/shim/include/usbc/anx7483_usb_mux.h15
-rw-r--r--zephyr/shim/include/usbc/bb_retimer_usb_mux.h14
-rw-r--r--zephyr/shim/include/usbc/it5205_usb_mux.h13
-rw-r--r--zephyr/shim/include/usbc/ps8743_usb_mux.h13
-rw-r--r--zephyr/shim/include/usbc/tcpci_usb_mux.h8
-rw-r--r--zephyr/shim/include/usbc/tusb1064_usb_mux.h41
6 files changed, 48 insertions, 56 deletions
diff --git a/zephyr/shim/include/usbc/anx7483_usb_mux.h b/zephyr/shim/include/usbc/anx7483_usb_mux.h
index 80585ce9ab..28fef71115 100644
--- a/zephyr/shim/include/usbc/anx7483_usb_mux.h
+++ b/zephyr/shim/include/usbc/anx7483_usb_mux.h
@@ -10,14 +10,13 @@
#define ANX7483_USB_MUX_COMPAT analogix_anx7483
-#define USB_MUX_CONFIG_ANX7483(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &anx7483_usb_retimer_driver, \
- .board_set = &anx7483_set_default_tuning, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_ANX7483(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &anx7483_usb_retimer_driver, \
+ .board_set = &anx7483_set_default_tuning, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#endif /* __ZEPHYR_SHIM_ANX7483_USB_MUX_H */
diff --git a/zephyr/shim/include/usbc/bb_retimer_usb_mux.h b/zephyr/shim/include/usbc/bb_retimer_usb_mux.h
index fb3f4ee68d..b5c9224f50 100644
--- a/zephyr/shim/include/usbc/bb_retimer_usb_mux.h
+++ b/zephyr/shim/include/usbc/bb_retimer_usb_mux.h
@@ -10,13 +10,13 @@
#define BB_RETIMER_USB_MUX_COMPAT intel_jhl8040r
-#define USB_MUX_CONFIG_BB_RETIMER(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &bb_usb_retimer, \
- .hpd_update = bb_retimer_hpd_update, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = DT_PROP(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_BB_RETIMER(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &bb_usb_retimer, \
+ .hpd_update = bb_retimer_hpd_update, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#define BB_RETIMER_CONTROLS_CONFIG(mux_id, port_id, idx) \
diff --git a/zephyr/shim/include/usbc/it5205_usb_mux.h b/zephyr/shim/include/usbc/it5205_usb_mux.h
index f3b4f7cf66..f2ce36d491 100644
--- a/zephyr/shim/include/usbc/it5205_usb_mux.h
+++ b/zephyr/shim/include/usbc/it5205_usb_mux.h
@@ -10,13 +10,12 @@
#define IT5205_USB_MUX_COMPAT ite_it5205
-#define USB_MUX_CONFIG_IT5205(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &it5205_usb_mux_driver, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_IT5205(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &it5205_usb_mux_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#endif /* __ZEPHYR_SHIM_IT5205_USB_MUX_H */
diff --git a/zephyr/shim/include/usbc/ps8743_usb_mux.h b/zephyr/shim/include/usbc/ps8743_usb_mux.h
index 9630abe447..0436bbcffd 100644
--- a/zephyr/shim/include/usbc/ps8743_usb_mux.h
+++ b/zephyr/shim/include/usbc/ps8743_usb_mux.h
@@ -10,13 +10,12 @@
#define PS8743_USB_MUX_COMPAT parade_ps8743
-#define USB_MUX_CONFIG_PS8743(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &ps8743_usb_mux_driver, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_PS8743(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &ps8743_usb_mux_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#endif /* __ZEPHYR_SHIM_PS8743_USB_MUX_H */
diff --git a/zephyr/shim/include/usbc/tcpci_usb_mux.h b/zephyr/shim/include/usbc/tcpci_usb_mux.h
index 74a2fe8ffc..d228d1a003 100644
--- a/zephyr/shim/include/usbc/tcpci_usb_mux.h
+++ b/zephyr/shim/include/usbc/tcpci_usb_mux.h
@@ -25,8 +25,8 @@
.driver = &tcpci_tcpm_usb_mux_driver, \
.hpd_update = \
USB_MUX_CALLBACK_OR_NULL(mux_id, hpd_update), \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = DT_PROP(mux_id, i2c_addr_flags), \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
/** Use I2C configuration from TCPC */
@@ -38,11 +38,9 @@
USB_MUX_CALLBACK_OR_NULL(mux_id, hpd_update), \
}
-/** This macro will fail if only port or i2c_addr_flags property is present */
#define USB_MUX_CONFIG_TCPCI_TCPM(mux_id, port_id, idx) \
COND_CODE_1( \
- UTIL_OR(DT_NODE_HAS_PROP(mux_id, port), \
- DT_NODE_HAS_PROP(mux_id, i2c_addr_flags)), \
+ DT_NODE_HAS_PROP(mux_id, reg), \
(USB_MUX_CONFIG_TCPCI_TCPM_WITH_I2C(mux_id, port_id, idx)), \
(USB_MUX_CONFIG_TCPCI_TCPM_WO_I2C(mux_id, port_id, idx)))
diff --git a/zephyr/shim/include/usbc/tusb1064_usb_mux.h b/zephyr/shim/include/usbc/tusb1064_usb_mux.h
index 17f0ff7d21..bb366d13c4 100644
--- a/zephyr/shim/include/usbc/tusb1064_usb_mux.h
+++ b/zephyr/shim/include/usbc/tusb1064_usb_mux.h
@@ -11,32 +11,29 @@
#define TUSB1064_USB_MUX_COMPAT ti_tusb1064
#if defined(CONFIG_USB_MUX_TUSB1044)
-#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &tusb1064_usb_mux_driver, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
- .hpd_update = &tusb1044_hpd_update, \
+#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &tusb1064_usb_mux_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
+ .hpd_update = &tusb1044_hpd_update, \
}
#elif defined(CONFIG_USB_MUX_TUSB546)
-#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &tusb1064_usb_mux_driver, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &tusb1064_usb_mux_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#else
-#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
- { \
- USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
- .driver = &tusb1064_usb_mux_driver, \
- .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \
- .i2c_addr_flags = \
- DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \
+#define USB_MUX_CONFIG_TUSB1064(mux_id, port_id, idx) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \
+ .driver = &tusb1064_usb_mux_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
}
#endif /* defined(CONFIG_USB_MUX_TUSB1044) */