summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/banshee/board.c30
-rw-r--r--board/banshee/board.h9
-rw-r--r--board/banshee/i2c.c14
3 files changed, 48 insertions, 5 deletions
diff --git a/board/banshee/board.c b/board/banshee/board.c
index adb233c85f..c751400d79 100644
--- a/board/banshee/board.c
+++ b/board/banshee/board.c
@@ -10,6 +10,7 @@
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
+#include "cros_board_info.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "hooks.h"
@@ -75,12 +76,19 @@ void battery_present_interrupt(enum gpio_signal signal)
hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
}
-void board_init(void)
+static void configure_keyboard(void)
{
- int board_id = get_board_id();
+ uint32_t cbi_val;
+ uint32_t board_id = 1;
- gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL);
- hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
+ /* Board ID */
+ if (cbi_get_board_version(&cbi_val) != EC_SUCCESS ||
+ cbi_val > UINT8_MAX)
+ CPRINTS("CBI: Read Board ID failed");
+ else
+ board_id = cbi_val;
+
+ CPRINTS("Read Board ID: %d", board_id);
if (board_id == 0) {
/* keyboard_col2_inverted on board id 0 */
@@ -102,6 +110,18 @@ void board_init(void)
GPIO_ALT_FUNC_DEFAULT);
}
- board_id_keyboard_col_inverted(board_id);
+ board_id_keyboard_col_inverted((int)board_id);
+}
+
+void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL);
+ hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+__override void board_pre_task_i2c_peripheral_init(void)
+{
+ /* Configure board specific keyboard */
+ configure_keyboard();
+}
diff --git a/board/banshee/board.h b/board/banshee/board.h
index e90e1f84f0..2627ce7556 100644
--- a/board/banshee/board.h
+++ b/board/banshee/board.h
@@ -194,6 +194,15 @@
#include "registers.h"
#include "usbc_config.h"
+/* I2C access in polling mode before task is initialized */
+#define CONFIG_I2C_BITBANG
+
+enum banshee_bitbang_i2c_channel {
+ I2C_BITBANG_CHAN_BRD_ID,
+ I2C_BITBANG_CHAN_COUNT
+};
+#define I2C_BITBANG_PORT_COUNT I2C_BITBANG_CHAN_COUNT
+
enum adc_channel {
ADC_TEMP_SENSOR_1_DDR_SOC,
ADC_TEMP_SENSOR_2_AMBIENT,
diff --git a/board/banshee/i2c.c b/board/banshee/i2c.c
index 17dc4cc400..556f27822e 100644
--- a/board/banshee/i2c.c
+++ b/board/banshee/i2c.c
@@ -7,6 +7,7 @@
#include "compile_time_macros.h"
#include "hooks.h"
#include "i2c.h"
+#include "i2c_bitbang.h"
#define BOARD_ID_FAST_PLUS_CAPABLE 2
@@ -78,3 +79,16 @@ 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[] = {
+ [I2C_BITBANG_CHAN_BRD_ID] = {
+ .name = "bitbang_brd_id",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_MISC_SCL_R,
+ .sda = GPIO_EC_I2C_MISC_SDA_R,
+ .drv = &bitbang_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(i2c_bitbang_ports) == I2C_BITBANG_CHAN_COUNT);
+const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);