summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-03-01 16:38:36 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-02 19:08:30 +0000
commit685b451618248477207c828275f82833403c05e8 (patch)
treeec9c77110122f9471d79227ebcd7cb9c352e01fc
parent8dda15e08fdbebd70e5a0ba5c05c27a942bc47e8 (diff)
downloadchrome-ec-685b451618248477207c828275f82833403c05e8.tar.gz
zephyr: delbin: bring-up named-i2cs
Add required formalisms (named-i2cs and i2c_map.h) to get i2c working with Zephyr shim. BUG=b:180410072 BRANCH=none TEST=compile with CBI code (follow-up CL) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3a50331ca5a42fa45840c24c381513ba4fb7c262 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727853 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/projects/delbin/boards/arm/delbin/delbin.dts25
-rw-r--r--zephyr/projects/delbin/include/i2c_map.h16
2 files changed, 41 insertions, 0 deletions
diff --git a/zephyr/projects/delbin/boards/arm/delbin/delbin.dts b/zephyr/projects/delbin/boards/arm/delbin/delbin.dts
index 379821d0a3..7b09e33ec9 100644
--- a/zephyr/projects/delbin/boards/arm/delbin/delbin.dts
+++ b/zephyr/projects/delbin/boards/arm/delbin/delbin.dts
@@ -30,6 +30,31 @@
named-i2c-ports {
compatible = "named-i2c-ports";
+
+ sensor {
+ i2c-port = <&i2c0_0>;
+ label = "SENSOR";
+ };
+ usb-c0 {
+ i2c-port = <&i2c1_0>;
+ label = "USB_C0";
+ };
+ usb-c1 {
+ i2c-port = <&i2c2_0>;
+ label = "USB_C1";
+ };
+ usb1-mix {
+ i2c-port = <&i2c3_0>;
+ label = "USB_1_MIX";
+ };
+ power {
+ i2c-port = <&i2c5_0>;
+ label = "POWER";
+ };
+ eeprom {
+ i2c-port = <&i2c7_0>;
+ label = "EEPROM";
+ };
};
named-gpios {
diff --git a/zephyr/projects/delbin/include/i2c_map.h b/zephyr/projects/delbin/include/i2c_map.h
index aa4c5f970f..3bd7380014 100644
--- a/zephyr/projects/delbin/include/i2c_map.h
+++ b/zephyr/projects/delbin/include/i2c_map.h
@@ -6,4 +6,20 @@
#ifndef __ZEPHYR_I2C_MAP_H
#define __ZEPHYR_I2C_MAP_H
+#include <devicetree.h>
+
+#include "i2c/i2c.h"
+
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NAMED_I2C(sensor)
+#define I2C_PORT_USB_C0 NAMED_I2C(usb_c0)
+#define I2C_PORT_USB_C1 NAMED_I2C(usb_c1)
+#define I2C_PORT_USB_1_MIX NAMED_I2C(usb1_mix)
+#define I2C_PORT_POWER NAMED_I2C(power)
+#define I2C_PORT_EEPROM NAMED_I2C(eeprom)
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
#endif /* __ZEPHYR_I2C_MAP_H */