summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Chao <scott.chao@bitland.corp-partner.google.com>2020-03-25 23:02:07 -0400
committerCommit Bot <commit-bot@chromium.org>2020-03-26 11:36:36 +0000
commit39088753b33270156592866df2a21927f0f2b653 (patch)
treec369fa5c0664812c2cb2e7a11da71e337d4241af
parenta88bd6dd2ce985f15cee44e95562639a4112f283 (diff)
downloadchrome-ec-39088753b33270156592866df2a21927f0f2b653.tar.gz
damu: enable bit-bang for battery smbus
EC using PA5/PC4 as i2c pin for battery. BUG=b:152456966 BRANCH=kukui TEST=make -j BOARD=damu TEST=make buildall TEST=On board testing to wait until we receive proto1 board. Signed-off-by: Scott Chao <scott.chao@bitland.corp-partner.google.com> Change-Id: I0064b8fde634fc3824593102e5fe8bc64563b0d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2120877 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--board/damu/board.c6
-rw-r--r--board/damu/board.h7
-rw-r--r--board/damu/ec.tasklist2
-rw-r--r--board/damu/gpio.inc2
4 files changed, 16 insertions, 1 deletions
diff --git a/board/damu/board.c b/board/damu/board.c
index 36d946a1bb..673978c05d 100644
--- a/board/damu/board.c
+++ b/board/damu/board.c
@@ -27,6 +27,7 @@
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
+#include "i2c_bitbang.h"
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
@@ -73,6 +74,11 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+const struct i2c_port_t i2c_bitbang_ports[] = {
+ {"battery", 2, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA, .drv = &bitbang_drv},
+};
+const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
+
#define BC12_I2C_ADDR PI3USB9201_I2C_ADDR_3
/* power signal list. Must match order of enum power_signal. */
diff --git a/board/damu/board.h b/board/damu/board.h
index 348d09d55b..c1c74cdc27 100644
--- a/board/damu/board.h
+++ b/board/damu/board.h
@@ -35,6 +35,13 @@
#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 200
+#define CONFIG_I2C_BITBANG
+#undef I2C_BITBANG_PORT_COUNT
+#define I2C_BITBANG_PORT_COUNT 1
+#undef CONFIG_I2C_NACK_RETRY_COUNT
+#define CONFIG_I2C_NACK_RETRY_COUNT 3
+#define CONFIG_SMBUS_PEC
+
#define CONFIG_USB_PD_TCPM_FUSB302
#define CONFIG_USB_PD_DISCHARGE_GPIO
#define CONFIG_USB_PD_TCPC_LOW_POWER
diff --git a/board/damu/ec.tasklist b/board/damu/ec.tasklist
index 4b7574652e..283af8595a 100644
--- a/board/damu/ec.tasklist
+++ b/board/damu/ec.tasklist
@@ -7,7 +7,7 @@
* See CONFIG_TASK_LIST in config.h for details.
*/
#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
diff --git a/board/damu/gpio.inc b/board/damu/gpio.inc
index d9b1856948..6b4a5ce117 100644
--- a/board/damu/gpio.inc
+++ b/board/damu/gpio.inc
@@ -56,6 +56,8 @@ GPIO(I2C1_SCL, PIN(B, 8), GPIO_INPUT)
GPIO(I2C1_SDA, PIN(B, 9), GPIO_INPUT)
GPIO(I2C2_SCL, PIN(A, 11), GPIO_INPUT)
GPIO(I2C2_SDA, PIN(A, 12), GPIO_INPUT)
+GPIO(I2C3_SCL, PIN(A, 5), GPIO_ODR_HIGH)
+GPIO(I2C3_SDA, PIN(C, 4), GPIO_ODR_HIGH)
/* Analog pins */
GPIO(BOARD_ID, PIN(C, 0), GPIO_ANALOG)