summaryrefslogtreecommitdiff
path: root/board/jacuzzi
diff options
context:
space:
mode:
Diffstat (limited to 'board/jacuzzi')
-rw-r--r--board/jacuzzi/board.c15
-rw-r--r--board/jacuzzi/board.h15
-rw-r--r--board/jacuzzi/ec.tasklist2
-rw-r--r--board/jacuzzi/gpio.inc2
4 files changed, 31 insertions, 3 deletions
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index 0626e97b37..799d36ba9c 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/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"
@@ -66,10 +67,19 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
{"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
+#ifdef BOARD_JACUZZI
{"other", 1, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
+#else /* Juniper */
+ {"other", 1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
+#endif
};
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. */
@@ -415,3 +425,8 @@ int board_get_charger_i2c(void)
/* TODO(b:138415463): confirm the bus allocation for future builds */
return board_get_version() == 1 ? 2 : 1;
}
+
+int board_get_battery_i2c(void)
+{
+ return board_get_version() >= 1 ? 2 : 1;
+}
diff --git a/board/jacuzzi/board.h b/board/jacuzzi/board.h
index 288d5e3faf..777fd581b9 100644
--- a/board/jacuzzi/board.h
+++ b/board/jacuzzi/board.h
@@ -32,6 +32,12 @@
#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 200
+#define CONFIG_I2C_BITBANG
+#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
@@ -60,11 +66,15 @@
#define I2C_PORT_BC12 0
#define I2C_PORT_TCPC0 0
#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 1
#define I2C_PORT_CHARGER board_get_charger_i2c()
#define I2C_PORT_SENSORS 1
#define I2C_PORT_IO_EXPANDER_IT8801 1
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#ifdef BOARD_JACUZZI
+#define I2C_PORT_BATTERY 1
+#else /* Juniper */
+#define I2C_PORT_BATTERY 2
+#endif
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
@@ -148,8 +158,9 @@ void board_reset_pd_mcu(void);
int board_get_version(void);
int board_is_sourcing_vbus(int port);
-/* returns the i2c port number of charger */
+/* returns the i2c port number of charger/battery */
int board_get_charger_i2c(void);
+int board_get_battery_i2c(void);
#endif /* !__ASSEMBLER__ */
diff --git a/board/jacuzzi/ec.tasklist b/board/jacuzzi/ec.tasklist
index 283af8595a..a1e20808cc 100644
--- a/board/jacuzzi/ec.tasklist
+++ b/board/jacuzzi/ec.tasklist
@@ -14,7 +14,7 @@
TASK_ALWAYS_RW(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \
TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, 1024) \
diff --git a/board/jacuzzi/gpio.inc b/board/jacuzzi/gpio.inc
index ccb8eaea85..d253709824 100644
--- a/board/jacuzzi/gpio.inc
+++ b/board/jacuzzi/gpio.inc
@@ -53,6 +53,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)