summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-10-27 16:02:20 +0200
committerchrome-bot <chrome-bot@chromium.org>2018-01-08 17:22:48 -0800
commitf5798790ad05477f52ce0001bfc52a5512c87d9b (patch)
tree83ad2719d75893a6937c0e3ace914cface6c7907
parentd56195cfdbc1a3efcf7009ebe120fdb7d1a4f26c (diff)
downloadchrome-ec-f5798790ad05477f52ce0001bfc52a5512c87d9b.tar.gz
stm32: add meowth_fp board
Configure it as a fingerprint MCU. Currently use ZerbleBarn as a proxy for it. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:67081508 TEST=flash and run the image on ZerbleBarn, do a finger image acquisition with the 'fptest' console command. Change-Id: I6e060c2d1e950ec81092088e1793b186fc0a5fa0 Reviewed-on: https://chromium-review.googlesource.com/806169 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/meowth_fp/board.c42
-rw-r--r--board/meowth_fp/board.h57
-rw-r--r--board/meowth_fp/build.mk12
-rw-r--r--board/meowth_fp/ec.tasklist22
-rw-r--r--board/meowth_fp/gpio.inc25
-rwxr-xr-xutil/flash_ec3
6 files changed, 160 insertions, 1 deletions
diff --git a/board/meowth_fp/board.c b/board/meowth_fp/board.c
new file mode 100644
index 0000000000..a777936e33
--- /dev/null
+++ b/board/meowth_fp/board.c
@@ -0,0 +1,42 @@
+/* Copyright 2017 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.
+ */
+/* Meowth Fingerprint MCU configuration */
+
+#include "common.h"
+#include "console.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "registers.h"
+#include "spi.h"
+#include "task.h"
+#include "util.h"
+
+#include "gpio_list.h"
+
+/* SPI devices */
+const struct spi_device_t spi_devices[] = {
+ /* Fingerprint sensor (SCLK at 4Mhz) */
+ { CONFIG_SPI_FP_PORT, 3, GPIO_SPI4_NSS }
+};
+const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
+
+static void spi_configure(void)
+{
+ /* Configure SPI GPIOs */
+ gpio_config_module(MODULE_SPI_MASTER, 1);
+ /* Set all SPI master signal pins to very high speed: pins E2/4/5/6 */
+ STM32_GPIO_OSPEEDR(GPIO_E) |= 0x00003f30;
+ /* Enable clocks to SPI4 module (master) */
+ STM32_RCC_APB2ENR |= STM32_RCC_PB2_SPI4;
+
+ spi_enable(CONFIG_SPI_FP_PORT, 1);
+}
+
+/* Initialize board. */
+static void board_init(void)
+{
+ spi_configure();
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/meowth_fp/board.h b/board/meowth_fp/board.h
new file mode 100644
index 0000000000..d753fcc16b
--- /dev/null
+++ b/board/meowth_fp/board.h
@@ -0,0 +1,57 @@
+/* Copyright 2017 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.
+ */
+
+/* Meowth Fingerprint MCU configuration */
+
+#ifndef __BOARD_H
+#define __BOARD_H
+
+/* the UART console is on USART1 */
+#undef CONFIG_UART_CONSOLE
+#define CONFIG_UART_CONSOLE 1
+#define CONFIG_UART_TX_DMA
+#define CONFIG_UART_TX_DMA_PH DMAMUX1_REQ_USART1_TX
+
+/* Optional features */
+#undef CONFIG_ADC
+#define CONFIG_DMA
+#define CONFIG_FPU
+#undef CONFIG_HIBERNATE
+#undef CONFIG_I2C
+#undef CONFIG_LID_SWITCH
+#define CONFIG_MKBP_EVENT
+#define CONFIG_PRINTF_LEGACY_LI_FORMAT
+#define CONFIG_STM_HWTIMER32
+#undef CONFIG_TASK_PROFILING
+#define CONFIG_WATCHDOG_HELP
+#define CONFIG_WP_ALWAYS
+
+/* Temporary */
+#undef CONFIG_FLASH
+#undef CONFIG_FLASH_PHYSICAL
+
+#define CONFIG_CMD_FLASH
+
+/* SPI configuration for the fingerprint sensor */
+#define CONFIG_SPI_MASTER
+#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */
+#define CONFIG_FP_SENSOR_FPC1145
+#define CONFIG_CMD_FPSENSOR_DEBUG
+
+#define CONFIG_CMD_SPI_XFER
+
+#ifndef __ASSEMBLER__
+
+/* Timer selection */
+#define TIM_CLOCK32 2
+#define TIM_WATCHDOG 16
+
+#include "gpio_signal.h"
+
+void fps_event(enum gpio_signal signal);
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __BOARD_H */
diff --git a/board/meowth_fp/build.mk b/board/meowth_fp/build.mk
new file mode 100644
index 0000000000..e69fbd3f2e
--- /dev/null
+++ b/board/meowth_fp/build.mk
@@ -0,0 +1,12 @@
+# Copyright 2017 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 STmicro STM32H743
+CHIP:=stm32
+CHIP_FAMILY:=stm32h7
+CHIP_VARIANT:=stm32h7x3
+
+board-y=board.o
diff --git a/board/meowth_fp/ec.tasklist b/board/meowth_fp/ec.tasklist
new file mode 100644
index 0000000000..493ada1d16
--- /dev/null
+++ b/board/meowth_fp/ec.tasklist
@@ -0,0 +1,22 @@
+/* Copyright 2017 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.
+ */
+
+/**
+ * List of enabled tasks in the priority order
+ *
+ * The first one has the lowest priority.
+ *
+ * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and
+ * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries,
+ * where :
+ * 'n' in the name of the task
+ * 'r' in the main routine of the task
+ * 'd' in an opaque parameter passed to the routine at startup
+ * 's' is the stack size in bytes; must be a multiple of 8
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(FPSENSOR, fp_task, NULL, 4096) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/meowth_fp/gpio.inc b/board/meowth_fp/gpio.inc
new file mode 100644
index 0000000000..2b369c2f73
--- /dev/null
+++ b/board/meowth_fp/gpio.inc
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017 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.
+ */
+
+/* Interrupts */
+GPIO_INT(FPS_INT, PIN(A, 0), GPIO_INT_RISING, fps_event)
+/* interrupt not yet in use */
+GPIO(SPI1_NSS, PIN(A, 4), GPIO_INPUT)
+
+/* Outputs */
+GPIO(EC_INT_L, PIN(A, 1), GPIO_INPUT) /* Enabled when PCH is up */
+GPIO(FP_RST_ODL, PIN(E, 0), GPIO_ODR_HIGH)
+GPIO(SPI4_NSS, PIN(E, 4), GPIO_OUT_HIGH)
+
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
+
+/* USART1: PA9/PA10 */
+ALTERNATE(PIN_MASK(A, 0x0600), GPIO_ALT_USART, MODULE_UART, GPIO_PULL_UP)
+/* SPI1 slave from the AP: PA4/5/6/7 */
+ALTERNATE(PIN_MASK(A, 0x00f0), GPIO_ALT_SPI, MODULE_SPI, 0)
+/* SPI4 master to sensor: PE2/5/6 */
+ALTERNATE(PIN_MASK(E, 0x0064), GPIO_ALT_SPI, MODULE_SPI_MASTER, 0)
diff --git a/util/flash_ec b/util/flash_ec
index ec5a6fa893..ae9fcbd6fb 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -65,6 +65,7 @@ BOARDS_STM32=(
hammer
jerry
kitty
+ meowth_fp
minimuffin
oak
oak_pd
@@ -441,7 +442,7 @@ function servo_ec_uart() {
case "${BOARD}" in
oak_pd|samus_pd|strago_pd ) MCU="usbpd" ;;
chell_pd|glados_pd ) MCU="usbpd" ;;
- eve_fp ) MCU="usbpd" ;;
+ eve_fp|meowth_fp ) MCU="usbpd" ;;
dingdong|hoho|twinkie ) DUT_CONTROL_CMD="true" ; MCU="ec" ;;
*) MCU="ec" ;;
esac