summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2020-03-05 12:52:46 +0800
committerCommit Bot <commit-bot@chromium.org>2020-03-06 06:28:02 +0000
commitc56609d7ca4fcbc16d54a866435481c890861d96 (patch)
treef9c04ebf09ef4f5a8d85bbacf204de09dcaf7f2f
parent76093f1d2953118642cc8a80a63c7e8f0e5dd102 (diff)
downloadchrome-ec-c56609d7ca4fcbc16d54a866435481c890861d96.tar.gz
asurada: initial board commit
Minimal set of code that is compilable and let people starts working on the board. Configs are disabled to make this CL smaller. Will add back in subsequent CLs. BUG=b:150341271 TEST=make BOARD=asurada BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I10cc4bebf0c30b7b5e05a73cf28cd596b64f1937 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2088825 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
-rw-r--r--board/asurada/battery.c26
-rw-r--r--board/asurada/board.c112
-rw-r--r--board/asurada/board.h82
-rw-r--r--board/asurada/build.mk13
-rw-r--r--board/asurada/ec.tasklist17
-rw-r--r--board/asurada/gpio.inc30
6 files changed, 280 insertions, 0 deletions
diff --git a/board/asurada/battery.c b/board/asurada/battery.c
new file mode 100644
index 0000000000..48acb86657
--- /dev/null
+++ b/board/asurada/battery.c
@@ -0,0 +1,26 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "battery.h"
+#include "battery_fuel_gauge.h"
+#include "gpio.h"
+
+const struct board_batt_params board_battery_info[] = {
+ [BATTERY_DUMMY] = {
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_DUMMY;
+
+enum battery_present battery_hw_present(void)
+{
+ return BP_NO;
+}
+
+enum battery_present battery_is_present(void)
+{
+ return BP_NO;
+}
diff --git a/board/asurada/board.c b/board/asurada/board.c
new file mode 100644
index 0000000000..3def8e0bd4
--- /dev/null
+++ b/board/asurada/board.c
@@ -0,0 +1,112 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+/* Asurada board configuration */
+
+#include "adc.h"
+#include "adc_chip.h"
+#include "charger.h"
+#include "common.h"
+#include "console.h"
+#include "driver/charger/isl923x.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "keyboard_scan.h"
+#include "pwm.h"
+#include "pwm_chip.h"
+#include "timer.h"
+
+
+#include "gpio_list.h"
+
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+/*
+ * PWM channels. Must be in the exactly same order as in enum pwm_channel.
+ * There total three 16 bits clock prescaler registers for all pwm channels,
+ * so use the same frequency and prescaler register setting is required if
+ * number of pwm channel greater than three.
+ */
+const struct pwm_t pwm_channels[] = {
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+/* Wake-up pins for hibernate */
+const enum gpio_signal hibernate_wake_pins[] = {
+ GPIO_POWER_BUTTON_L, GPIO_LID_OPEN
+};
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+
+/* Initialize board. */
+static void board_init(void)
+{
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
+const struct adc_t adc_channels[] = {
+ /* Convert to mV (3000mV/1024). */
+ {"BOARD_ID_0", 3000, 1024, 0, CHIP_ADC_CH1}, /* GPI0, ADC0 */
+ {"BOARD_ID_1", 3000, 1024, 0, CHIP_ADC_CH2}, /* GPI1, ADC1 */
+};
+BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+
+/* Keyboard scan setting */
+struct keyboard_scan_config keyscan_config = {
+ .output_settle_us = 35,
+ .debounce_down_us = 5 * MSEC,
+ .debounce_up_us = 40 * MSEC,
+ .scan_period_us = 3 * MSEC,
+ .min_post_scan_delay_us = 1000,
+ .poll_timeout_us = 100 * MSEC,
+ .actual_key_mask = {
+ 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
+ 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
+ },
+};
+
+/*
+ * I2C channels (A, B, and C) are using the same timing registers (00h~07h)
+ * at default.
+ * In order to set frequency independently for each channels,
+ * We use timing registers 09h~0Bh, and the supported frequency will be:
+ * 50KHz, 100KHz, 400KHz, or 1MHz.
+ * I2C channels (D, E and F) can be set different frequency on different ports.
+ * The I2C(D/E/F) frequency depend on the frequency of SMBus Module and
+ * the individual prescale register.
+ * The frequency of SMBus module is 24MHz on default.
+ * The allowed range of I2C(D/E/F) frequency is as following setting.
+ * SMBus Module Freq = PLL_CLOCK / ((IT83XX_ECPM_SCDCR2 & 0x0F) + 1)
+ * (SMBus Module Freq / 510) <= I2C Freq <= (SMBus Module Freq / 8)
+ * Channel D has multi-function and can be used as UART interface.
+ * Channel F is reserved for EC debug.
+ */
+
+/* I2C ports */
+const struct i2c_port_t i2c_ports[] = {
+ {"battery", IT83XX_I2C_CH_A, 100, GPIO_I2C_A_SCL, GPIO_I2C_A_SDA},
+ {"sensor", IT83XX_I2C_CH_B, 100, GPIO_I2C_B_SCL, GPIO_I2C_B_SDA},
+ {"usb0", IT83XX_I2C_CH_C, 100, GPIO_I2C_C_SCL, GPIO_I2C_C_SDA},
+ {"usb1", IT83XX_I2C_CH_E, 100, GPIO_I2C_E_SCL, GPIO_I2C_E_SDA},
+};
+
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+int extpower_is_present(void)
+{
+ return 0;
+}
+
+int board_get_version(void)
+{
+ return 0;
+}
diff --git a/board/asurada/board.h b/board/asurada/board.h
new file mode 100644
index 0000000000..c9e6c96c80
--- /dev/null
+++ b/board/asurada/board.h
@@ -0,0 +1,82 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+/* Asurada development board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+/* Optional features */
+#define CONFIG_BOARD_VERSION_CUSTOM
+#define CONFIG_I2C
+#define CONFIG_I2C_MASTER
+#define CONFIG_LOW_POWER_IDLE
+#define CONFIG_LOW_POWER_S0
+#define CONFIG_POWER_BUTTON
+#define CONFIG_PWM
+
+/* Battery */
+#define CONFIG_BATTERY_SMART
+#define CONFIG_BATTERY_FUEL_GAUGE
+
+/* BC12 */
+/* #define CONFIG_BC12_DETECT_PI3USB9201 */
+
+/* Charger */
+#define CONFIG_CHARGER
+#define CONFIG_CHARGER_ISL9238
+#define CONFIG_CHARGER_INPUT_CURRENT 512
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 /* BOARD_RS1 */
+#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* BOARD_RS2 */
+#define CONFIG_CHARGER_OTG
+#define CONFIG_CHARGE_RAMP_HW
+
+/* Keyboard */
+/*
+ * #define CONFIG_KEYBOARD_BOARD_CONFIG
+ * #define CONFIG_KEYBOARD_PROTOCOL_MKBP
+ * #define CONFIG_MKBP_USE_GPIO
+ */
+
+/* PD */
+
+/* Optional console commands */
+#define CONFIG_CMD_FLASH
+#define CONFIG_CMD_SCRATCHPAD
+#define CONFIG_CMD_STACKOVERFLOW
+
+/* UART */
+#undef CONFIG_UART_TX_BUF_SIZE
+#define CONFIG_UART_TX_BUF_SIZE 4096
+
+#ifndef __ASSEMBLER__
+
+#include "gpio_signal.h"
+#include "registers.h"
+
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_C
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_C
+
+#include "gpio_signal.h"
+
+enum battery_type {
+ BATTERY_DUMMY,
+ BATTERY_TYPE_COUNT,
+};
+
+enum pwm_channel {
+ PWM_CH_COUNT,
+};
+
+enum adc_channel {
+ ADC_BOARD_ID_0,
+ ADC_BOARD_ID_1,
+ /* Number of ADC channels */
+ ADC_CH_COUNT,
+};
+
+int board_get_version(void);
+
+#endif /* !__ASSEMBLER__ */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/asurada/build.mk b/board/asurada/build.mk
new file mode 100644
index 0000000000..d1d9cde5aa
--- /dev/null
+++ b/board/asurada/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Board specific files build
+
+# the IC is ITE IT8xxx2
+CHIP:=it83xx
+CHIP_FAMILY:=it8xxx2
+CHIP_VARIANT:=it83202bx
+
+board-y=board.o battery.o
diff --git a/board/asurada/ec.tasklist b/board/asurada/ec.tasklist
new file mode 100644
index 0000000000..e294460eca
--- /dev/null
+++ b/board/asurada/ec.tasklist
@@ -0,0 +1,17 @@
+/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+/**
+ TODO: missing CHIPSET and MOTIONSENSE task
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
+
diff --git a/board/asurada/gpio.inc b/board/asurada/gpio.inc
new file mode 100644
index 0000000000..ec5e7209c3
--- /dev/null
+++ b/board/asurada/gpio.inc
@@ -0,0 +1,30 @@
+/* -*- mode:c -*-
+ *
+ * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Declare symbolic names for all the GPIOs that we care about.
+ * Note: Those with interrupt handlers must be declared first. */
+
+UNIMPLEMENTED(UART1_RX)
+UNIMPLEMENTED(PCH_SMI_L)
+UNIMPLEMENTED(PCH_SCI_L)
+UNIMPLEMENTED(PCH_WAKE_L)
+UNIMPLEMENTED(PCH_PLTRST_L)
+
+UNIMPLEMENTED(I2C_A_SCL)
+UNIMPLEMENTED(I2C_A_SDA)
+UNIMPLEMENTED(I2C_B_SCL)
+UNIMPLEMENTED(I2C_B_SDA)
+UNIMPLEMENTED(I2C_C_SCL)
+UNIMPLEMENTED(I2C_C_SDA)
+UNIMPLEMENTED(I2C_E_SCL)
+UNIMPLEMENTED(I2C_E_SDA)
+
+UNIMPLEMENTED(POWER_BUTTON_L)
+UNIMPLEMENTED(LID_OPEN)
+UNIMPLEMENTED(WP_L)
+
+UNIMPLEMENTED(ENTERING_RW)