diff options
author | xiong.huang <xiong.huang@bitland.corp-partner.google.com> | 2020-02-25 12:08:50 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-26 07:46:48 +0000 |
commit | f46434f387d4fcf83aa9b215f8b6f03ec4da1222 (patch) | |
tree | 5a0820501e3c66ebfae8a49ec29b2d35b01451e5 /board/kodama | |
parent | 697ff17b762f9464bf204ebdb6daa23cb26eddd3 (diff) | |
download | chrome-ec-f46434f387d4fcf83aa9b215f8b6f03ec4da1222.tar.gz |
RELAND: kodama: enable i2c bitbang
This is a reland of CL:1876290 for kodama in master.
firmware-kukui-12573.B has landed this function.
Original commit message:
> - Enable bitbang driver
> - increase the console/hook stack size because accessing bitbang i2c bus
> - requires more stack memory than before
BUG=none
TEST=1) make buildall
2) boot on Kodama
3) Get battery information normally
BRANCH=kukui
Change-Id: I05f9e0f7df2369bcbddfa9be55aec03ce821ea8b
Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2071540
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/kodama')
-rw-r--r-- | board/kodama/board.c | 11 | ||||
-rw-r--r-- | board/kodama/board.h | 12 | ||||
-rw-r--r-- | board/kodama/ec.tasklist | 2 | ||||
-rw-r--r-- | board/kodama/gpio.inc | 3 |
4 files changed, 24 insertions, 4 deletions
diff --git a/board/kodama/board.c b/board/kodama/board.c index 5afb5c89fd..abc44c43d4 100644 --- a/board/kodama/board.c +++ b/board/kodama/board.c @@ -24,6 +24,7 @@ #include "hooks.h" #include "host_command.h" #include "i2c.h" +#include "i2c_bitbang.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -68,6 +69,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); + /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"}, @@ -372,3 +378,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) return voltage < 4400; } + +int board_get_battery_i2c(void) +{ + return board_get_version() >= 2 ? 2 : 1; +} diff --git a/board/kodama/board.h b/board/kodama/board.h index 805359538b..de220618e9 100644 --- a/board/kodama/board.h +++ b/board/kodama/board.h @@ -28,6 +28,12 @@ #define CONFIG_BATTERY_HW_PRESENT_CUSTOM +#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 + /* free flash space */ #ifdef SECTION_IS_RO #undef CONFIG_USB_PD_DEBUG_LEVEL @@ -58,9 +64,9 @@ #define I2C_PORT_CHARGER 0 #define I2C_PORT_TCPC0 0 #define I2C_PORT_USB_MUX 0 -#define I2C_PORT_BATTERY 1 -#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY #define I2C_PORT_ACCEL 1 +#define I2C_PORT_BATTERY board_get_battery_i2c() +#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY /* Define the host events which are allowed to wakeup AP in S3. */ #define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ @@ -119,6 +125,8 @@ int board_get_version(void); int board_is_sourcing_vbus(int port); void pogo_adc_interrupt(enum gpio_signal signal); int board_discharge_on_ac(int enable); +/* returns the i2c port number of battery */ +int board_get_battery_i2c(void); #endif /* !__ASSEMBLER__ */ diff --git a/board/kodama/ec.tasklist b/board/kodama/ec.tasklist index bfa61707e1..df944a1b07 100644 --- a/board/kodama/ec.tasklist +++ b/board/kodama/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, usb_charger_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/kodama/gpio.inc b/board/kodama/gpio.inc index 461d34d4d5..b54d6f5ed5 100644 --- a/board/kodama/gpio.inc +++ b/board/kodama/gpio.inc @@ -63,6 +63,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(B, 6), GPIO_ODR_HIGH) +GPIO(I2C3_SDA, PIN(D, 2), GPIO_ODR_HIGH) /* Analog pins */ GPIO(BOARD_ID, PIN(C, 0), GPIO_ANALOG) @@ -83,7 +85,6 @@ GPIO(USB_C0_HPD_OD, PIN(F, 1), GPIO_ODR_LOW) GPIO(BOOTBLOCK_EN_L, PIN(C, 1), GPIO_ODR_HIGH) GPIO(BATT_CUTOFF_INDICATOR, PIN(A, 5), GPIO_OUT_LOW) GPIO(EN_PP3300_POGO, PIN(A, 13), GPIO_OUT_LOW) -GPIO(EN_POGO_CHARGE_L, PIN(B, 6), GPIO_OUT_HIGH) GPIO(BC12_DET_EN, PIN(C, 4), GPIO_OUT_LOW) UNIMPLEMENTED(EN_PP5000_USBC) |