diff options
author | Craig Hesling <hesling@chromium.org> | 2020-02-17 18:49:39 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-25 22:58:10 +0000 |
commit | 1707e1ea83a9df8162c18321fc5a529d38f58870 (patch) | |
tree | 28101eecad0d86680b57428c777d1409943ad2e4 /board | |
parent | 9d52617b841bcf3cc8f38df7a5d36cf74b4e4c66 (diff) | |
download | chrome-ec-1707e1ea83a9df8162c18321fc5a529d38f58870.tar.gz |
nucleo-dartmonkey: Add fingerprint support
This adds the support for the fingerprint sensor
and fingerprint system.
BRANCH=none
BUG=b:130296790
TEST=none
Change-Id: Ib6a555f0b0a5fd30487dbf8c314096de3e4f2fcf
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2061349
Diffstat (limited to 'board')
-rw-r--r-- | board/nucleo-dartmonkey/board.c | 27 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/board.h | 24 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/build.mk | 1 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/ec.tasklist | 3 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/fpsensor_detect.c | 16 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/gpio.inc | 10 |
6 files changed, 79 insertions, 2 deletions
diff --git a/board/nucleo-dartmonkey/board.c b/board/nucleo-dartmonkey/board.c index e06408c404..da70b6610c 100644 --- a/board/nucleo-dartmonkey/board.c +++ b/board/nucleo-dartmonkey/board.c @@ -50,11 +50,38 @@ static void slp_event(enum gpio_signal signal) hook_call_deferred(&ap_deferred_data, 0); } +#ifndef HAS_TASK_FPSENSOR +void fps_event(enum gpio_signal signal) +{ +} +#endif + #include "gpio_list.h" +/* SPI devices */ +const struct spi_device_t spi_devices[] = { + /* Fingerprint sensor (SCLK at 4Mhz) */ + { .port = CONFIG_SPI_FP_PORT, .div = 3, .gpio_cs = 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(); + /* Enable interrupt on PCH power signals */ gpio_enable_interrupt(GPIO_PCH_SLP_S3_L); gpio_enable_interrupt(GPIO_PCH_SLP_S0_L); diff --git a/board/nucleo-dartmonkey/board.h b/board/nucleo-dartmonkey/board.h index 041d0e36ec..00ef075129 100644 --- a/board/nucleo-dartmonkey/board.h +++ b/board/nucleo-dartmonkey/board.h @@ -28,8 +28,30 @@ #define CONFIG_CONSOLE_COMMAND_FLAGS #define CONFIG_RESTRICTED_CONSOLE_COMMANDS -#ifndef __ASSEMBLER__ +/* Fingerprint needs to store a secrect in the anti-rollback block */ +#define CONFIG_ROLLBACK_SECRET_SIZE 32 + +/* SPI configuration for the fingerprint sensor */ +#define CONFIG_SPI_MASTER +#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */ + +#ifdef SECTION_IS_RW + /* Select fingerprint sensor */ +# define CONFIG_FP_SENSOR_FPC1145 +# define CONFIG_CMD_FPSENSOR_DEBUG + /* Special memory regions to store large arrays */ +# define FP_FRAME_SECTION __SECTION(ahb4) +# define FP_TEMPLATE_SECTION __SECTION(ahb) + /* + * Use the malloc code only in the RW section (for the private library), + * we cannot enable it in RO since it is not compatible with the RW + * verification (shared_mem_init done too late). + */ +# define CONFIG_MALLOC +#endif /* SECTION_IS_RW */ +#ifndef __ASSEMBLER__ + void fps_event(enum gpio_signal signal); #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/nucleo-dartmonkey/build.mk b/board/nucleo-dartmonkey/build.mk index 5b8c705a8c..b26b249720 100644 --- a/board/nucleo-dartmonkey/build.mk +++ b/board/nucleo-dartmonkey/build.mk @@ -7,6 +7,7 @@ BASEBOARD:=nucleo-h743zi board-y=board.o +board-y+=fpsensor_detect.o # Enable on device tests test-list-y=aes sha256 sha256_unrolled diff --git a/board/nucleo-dartmonkey/ec.tasklist b/board/nucleo-dartmonkey/ec.tasklist index 593ee85a65..80e226637b 100644 --- a/board/nucleo-dartmonkey/ec.tasklist +++ b/board/nucleo-dartmonkey/ec.tasklist @@ -8,4 +8,5 @@ /** * See CONFIG_TASK_LIST in config.h for details. */ -#define CONFIG_TASK_LIST BASEBOARD_CONFIG_TASK_LIST +#define CONFIG_TASK_LIST BASEBOARD_CONFIG_TASK_LIST \ + TASK_ALWAYS_RW(FPSENSOR, fp_task, NULL, 4096) diff --git a/board/nucleo-dartmonkey/fpsensor_detect.c b/board/nucleo-dartmonkey/fpsensor_detect.c new file mode 100644 index 0000000000..72b9b89e11 --- /dev/null +++ b/board/nucleo-dartmonkey/fpsensor_detect.c @@ -0,0 +1,16 @@ +/* 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 "fpsensor_detect.h" + +enum fp_sensor_type get_fp_sensor_type(void) +{ + return FP_SENSOR_TYPE_FPC; +} + +enum fp_transport_type get_fp_transport_type(void) +{ + return FP_TRANSPORT_TYPE_SPI; +} diff --git a/board/nucleo-dartmonkey/gpio.inc b/board/nucleo-dartmonkey/gpio.inc index c8cfde046c..e20027a8ff 100644 --- a/board/nucleo-dartmonkey/gpio.inc +++ b/board/nucleo-dartmonkey/gpio.inc @@ -16,3 +16,13 @@ /* Interrupts */ GPIO_INT(PCH_SLP_S0_L, PIN(D, 13), GPIO_INT_BOTH, slp_event) GPIO_INT(PCH_SLP_S3_L, PIN(A, 11), GPIO_INT_BOTH, slp_event) + +/* Output for User Presence */ +GPIO(USER_PRES_L, PIN(C, 5), GPIO_ODR_HIGH) + +/* Fingerprint Sensor */ +GPIO_INT(FPS_INT, PIN(A, 0), GPIO_INT_RISING, fps_event) +GPIO(FP_RST_ODL, PIN(E, 0), GPIO_OUT_HIGH) +GPIO(SPI4_NSS, PIN(E, 4), GPIO_OUT_HIGH) +/* SPI4 master to sensor: PE2/5/6 (CLK/MISO/MOSI) */ +ALTERNATE(PIN_MASK(E, 0x0064), GPIO_ALT_SPI, MODULE_SPI_MASTER, 0) |