summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeifu Zhao <leifu.zhao@intel.com>2019-10-08 13:23:11 +0800
committerCommit Bot <commit-bot@chromium.org>2019-11-09 00:24:09 +0000
commitc11e35229eea194394d06944b75f0ad7e012d941 (patch)
tree847bc6c7874afa778c050945fe85af357ee2250b
parentd8db28afe8e93a358ab8e9b656cfcb4f4681a222 (diff)
downloadchrome-ec-c11e35229eea194394d06944b75f0ad7e012d941.tar.gz
ish: board enablement for tgl rvp platform
Board level enablement for tgl rvp platform. BUG=b:141519691 BRANCH=none TEST=tested on tgl rvp Signed-off-by: Leifu Zhao <leifu.zhao@intel.com> Change-Id: I5a2ce355ca7c384c82500d0295035fae3cdb183e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1846787 Reviewed-by: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com> Commit-Queue: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com> Auto-Submit: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
-rw-r--r--board/tglrvp_ish/board.c82
-rw-r--r--board/tglrvp_ish/board.h99
-rw-r--r--board/tglrvp_ish/build.mk13
-rw-r--r--board/tglrvp_ish/ec.tasklist17
-rw-r--r--board/tglrvp_ish/gpio.inc12
5 files changed, 223 insertions, 0 deletions
diff --git a/board/tglrvp_ish/board.c b/board/tglrvp_ish/board.c
new file mode 100644
index 0000000000..313f7ced8a
--- /dev/null
+++ b/board/tglrvp_ish/board.c
@@ -0,0 +1,82 @@
+/* Copyright 2019 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.
+ */
+
+/* TGL RVP ISH board-specific configuration */
+
+#include "accelgyro_lsm6dsm.h"
+#include "console.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "i2c.h"
+#include "motion_sense.h"
+#include "power.h"
+#include "task.h"
+
+#include "gpio_list.h" /* has to be included last */
+
+/* I2C port map */
+const struct i2c_port_t i2c_ports[] = {
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 1000
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+/* Sensor config */
+static struct mutex g_base_mutex;
+/* sensor private data */
+static struct lsm6dsm_data lsm6dsm_a_data;
+
+/* Drivers */
+struct motion_sensor_t motion_sensors[] = {
+ [BASE_ACCEL] = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_LSM6DS3,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &lsm6dsm_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
+ MOTIONSENSE_TYPE_ACCEL),
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR1_FLAGS,
+ .rot_standard_ref = NULL, /* TODO rotate correctly */
+ .default_range = 4, /* g */
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 13000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ },
+ },
+};
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+int chipset_in_state(int state_mask)
+{
+ return state_mask & CHIPSET_STATE_ON;
+}
+
+int chipset_in_or_transitioning_to_state(int state_mask)
+{
+ return state_mask & CHIPSET_STATE_ON;
+}
+
+void chipset_force_shutdown(enum chipset_shutdown_reason reason)
+{
+}
+
+int board_idle_task(void *unused)
+{
+ while (1)
+ task_wait_event(-1);
+}
diff --git a/board/tglrvp_ish/board.h b/board/tglrvp_ish/board.h
new file mode 100644
index 0000000000..1f99061cec
--- /dev/null
+++ b/board/tglrvp_ish/board.h
@@ -0,0 +1,99 @@
+/* Copyright 2019 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.
+ */
+
+/* TGL RVP ISH board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+/*
+ * Allow dangerous commands.
+ * TODO: Don't use this on production systems.
+ */
+#define CONFIG_SYSTEM_UNLOCKED
+
+/*
+ * By default, enable all console messages except HC, ACPI and event
+ * The sensor stack is generating a lot of activity.
+ */
+#undef CONFIG_HOSTCMD_DEBUG_MODE
+#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
+
+/* ISH specific */
+#undef CONFIG_DEBUG_ASSERT
+#define CONFIG_CLOCK_CRYSTAL
+#define CONFIG_ISH_UART_0
+/* EC */
+#define CONFIG_FLASH_SIZE 0x80000
+#define CONFIG_FPU
+#define CONFIG_I2C
+#define CONFIG_I2C_MASTER
+
+#define CONFIG_ACCELGYRO_LSM6DSM /* For LSM6DS3 */
+#define CONFIG_ACCEL_INTERRUPTS
+/* Enable sensor fifo, must also define the _SIZE and _THRES */
+#define CONFIG_ACCEL_FIFO
+/* FIFO size is a power of 2. */
+#define CONFIG_ACCEL_FIFO_SIZE 256
+/* Depends on how fast the AP boots and typical ODRs. */
+#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(BASE_ACCEL)
+
+#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+
+#define CONFIG_MKBP_EVENT
+#define CONFIG_MKBP_USE_HECI
+
+/* Host command over HECI */
+#define CONFIG_HOSTCMD_HECI
+
+/* I2C ports */
+#define I2C_PORT_SENSOR ISH_I2C1
+#define CONFIG_CMD_I2C_XFER
+
+/* EC Console Commands */
+#define CONFIG_CMD_ACCELS
+#define CONFIG_CMD_ACCEL_INFO
+#define CONFIG_CMD_TIMERINFO
+
+/* Undefined features */
+#undef CONFIG_CMD_HASH
+#undef CONFIG_CMD_I2C_SCAN
+#undef CONFIG_CMD_KEYBOARD
+#undef CONFIG_CMD_POWER_AP
+#undef CONFIG_CMD_POWERINDEBUG
+#undef CONFIG_CMD_SHMEM
+#undef CONFIG_EXTPOWER
+#undef CONFIG_KEYBOARD_KSO_BASE
+#undef CONFIG_FLASH
+#undef CONFIG_FMAP
+#undef CONFIG_LID_SWITCH
+#undef CONFIG_SWITCH
+#undef CONFIG_WATCHDOG
+
+/* Modules we want to exclude */
+#undef CONFIG_CMD_HASH
+#undef CONFIG_CMD_TEMP_SENSOR
+#undef CONFIG_ADC
+#undef CONFIG_SHA256
+
+#ifndef __ASSEMBLER__
+
+#include "gpio_signal.h"
+#include "registers.h"
+
+/* Motion sensors */
+enum sensor_id {
+ LID_ACCEL,
+ LID_GYRO,
+ BASE_ACCEL,
+ LID_MAG,
+ SENSOR_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/tglrvp_ish/build.mk b/board/tglrvp_ish/build.mk
new file mode 100644
index 0000000000..74ec3c865f
--- /dev/null
+++ b/board/tglrvp_ish/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# Copyright 2019 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
+#
+
+CHIP:=ish
+CHIP_FAMILY:=ish5
+CHIP_VARIANT:=ish5p4
+
+board-y=board.o
diff --git a/board/tglrvp_ish/ec.tasklist b/board/tglrvp_ish/ec.tasklist
new file mode 100644
index 0000000000..a4db486e9a
--- /dev/null
+++ b/board/tglrvp_ish/ec.tasklist
@@ -0,0 +1,17 @@
+/* Copyright 2019 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.
+ */
+
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, HUGE_TASK_STACK_SIZE, 0) \
+ TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE, 0) \
+ TASK_NOTEST(CHIPSET, board_idle_task, NULL, IDLE_TASK_STACK_SIZE, 0) \
+ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE, 0) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE, 0) \
+ TASK_ALWAYS(HECI_RX, heci_rx_task, NULL, HUGE_TASK_STACK_SIZE, 0) \
+ TASK_ALWAYS(IPC_MNG, ipc_mng_task, NULL, LARGER_TASK_STACK_SIZE, 0)
diff --git a/board/tglrvp_ish/gpio.inc b/board/tglrvp_ish/gpio.inc
new file mode 100644
index 0000000000..286309e388
--- /dev/null
+++ b/board/tglrvp_ish/gpio.inc
@@ -0,0 +1,12 @@
+/* -*- mode:c -*-
+ *
+ * Copyright 2019 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.
+ */
+
+/*
+ * We don't have a ENTERING_RW signal wired to the cr50 but common code needs
+ * it to be defined.
+ */
+UNIMPLEMENTED(ENTERING_RW)