diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-21 14:10:01 -0700 |
---|---|---|
committer | Tom Hughes <tomhughes@chromium.org> | 2022-09-22 12:49:33 -0700 |
commit | 2bcf863b492fe7ed8105c853814dba6ed32ba719 (patch) | |
tree | fcf6ce5810f9ff9e3c8cce434812dd75492269ed /board/c2d2/board.c | |
parent | e5fb0b9ba488614b5684e640530f00821ab7b943 (diff) | |
parent | 28712dae9d7ed1e694f7622cc083afa71090d4d5 (diff) | |
download | chrome-ec-firmware-fpmcu-bloonchipper-release.tar.gz |
Merge remote-tracking branch cros/main into firmware-fpmcu-bloonchipper-releasefirmware-fpmcu-bloonchipper-release
Generated by: ./util/update_release_branch.py --board bloonchipper
--relevant_paths_file ./util/fingerprint-relevant-paths.txt firmware-
fpmcu-bloonchipper-release
Relevant changes:
git log --oneline e5fb0b9ba4..28712dae9d -- board/hatch_fp
board/bloonchipper common/fpsensor docs/fingerprint driver/fingerprint
util/getversion.sh
ded9307b79 util/getversion.sh: Fix version when not in a git repo
956055e692 board: change Google USB vendor info
71b2ef709d Update license boilerplate text in source code files
33e11afda0 Revert "fpsensor: Build fpsensor source file with C++"
c8d0360723 fpsensor: Build fpsensor source file with C++
bc113abd53 fpsensor: Fix g++ compiler error
150a58a0dc fpsensor: Fix fp_set_sensor_mode return type
b33b5ce85b fpsensor: Remove nested designators for C++ compatibility
2e864b2539 tree-wide: const-ify argv for console commands
56d8b360f9 test: Add test for get ikm failure when seed not set
3a3d6c3690 test: Add test for fpsensor trivial key failure
233e6bbd08 fpsensor_crypto: Abstract calls to hmac_SHA256
0a041b285b docs/fingerprint: Typo correction
c03fab67e2 docs/fingerprint: Fix the path of fputils.py
0b5d4baf5a util/getversion.sh: Fix empty file list handling
6e128fe760 FPMCU dev board environment with Satlab
3eb29b6aa5 builtin: Move ssize_t to sys/types.h
345d62ebd1 docs/fingerprint: Update power numbers for latest dartmonkey release
c25ffdb316 common: Conditionally support printf %l and %i modifiers
9a3c514b45 test: Add a test to check if the debugger is connected
54e603413f Move standard library tests to their own file
43fa6b4bf8 docs/fingerprint: Update power numbers for latest bloonchipper release
25536f9a84 driver/fingerprint/fpc/bep/fpc_sensor_spi.c: Format with clang-format
4face99efd driver/fingerprint/fpc/libfp/fpc_sensor_pal.h: Format with clang-format
738de2b575 trng: Rename rand to trng_rand
14b8270edd docs/fingerprint: Update dragonclaw power numbers
0b268f93d1 driver/fingerprint/fpc/libfp/fpc_private.c: Format with clang-format
f80da163f2 driver/fingerprint/fpc/libfp/fpc_private.h: Format with clang-format
5e9c85c9b1 driver/fingerprint/fpc/libfp/fpc_sensor_pal.c: Format with clang-format
c1f9dd3cf8 driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h: Format with clang-format
eb1e1bed8d driver/fingerprint/fpc/libfp/fpc1145_private.h: Format with clang-format
6e7b611821 driver/fingerprint/fpc/bep/fpc_bio_algorithm.h: Format with clang-format
e0589cd5e2 driver/fingerprint/fpc/bep/fpc1035_private.h: Format with clang-format
7905e556a0 common/fpsensor/fpsensor_crypto.c: Format with clang-format
21289d170c driver/fingerprint/fpc/bep/fpc1025_private.h: Format with clang-format
98a20f937e common/fpsensor/fpsensor_state.c: Format with clang-format
a2d255d8af common/fpsensor/fpsensor.c: Format with clang-format
73055eeb3f driver/fingerprint/fpc/bep/fpc_private.c: Format with clang-format
0f7b5cb509 common/fpsensor/fpsensor_private.h: Format with clang-format
1ceade6e65 driver/fingerprint/fpc/bep/fpc_private.h: Format with clang-format
dc3e9008b8 board/hatch_fp/board.h: Format with clang-format
dca9d74321 Revert "trng: Rename rand to trng_rand"
a6b0b3554f trng: Rename rand to trng_rand
28d0b75b70 third_party/boringssl: Remove unused header
BRANCH=None
BUG=b:246424843 b:234181908 b:244781166 b:234181908 b:244387210
BUG=b:242720240 chromium:1098010 b:180945056 b:236025198 b:234181908
BUG=b:234181908 b:237344361 b:131913998 b:236386294 b:234143158
BUG=b:234781655 b:215613183 b:242720910
TEST=`make -j buildall`
TEST=./test/run_device_tests.py --board bloonchipper
Test "aes": PASSED
Test "cec": PASSED
Test "cortexm_fpu": PASSED
Test "crc": PASSED
Test "flash_physical": PASSED
Test "flash_write_protect": PASSED
Test "fpsensor_hw": PASSED
Test "fpsensor_spi_ro": PASSED
Test "fpsensor_spi_rw": PASSED
Test "fpsensor_uart_ro": PASSED
Test "fpsensor_uart_rw": PASSED
Test "mpu_ro": PASSED
Test "mpu_rw": PASSED
Test "mutex": PASSED
Test "pingpong": PASSED
Test "printf": PASSED
Test "queue": PASSED
Test "rollback_region0": PASSED
Test "rollback_region1": PASSED
Test "rollback_entropy": PASSED
Test "rtc": PASSED
Test "sha256": PASSED
Test "sha256_unrolled": PASSED
Test "static_if": PASSED
Test "stdlib": PASSED
Test "system_is_locked_wp_on": PASSED
Test "system_is_locked_wp_off": PASSED
Test "timer_dos": PASSED
Test "utils": PASSED
Test "utils_str": PASSED
Test "stm32f_rtc": PASSED
Test "panic_data_bloonchipper_v2.0.4277": PASSED
Test "panic_data_bloonchipper_v2.0.5938": PASSED
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I264ad0ffe7afcd507a1e483c6e934a9c4fea47c3
Diffstat (limited to 'board/c2d2/board.c')
-rw-r--r-- | board/c2d2/board.c | 228 |
1 files changed, 93 insertions, 135 deletions
diff --git a/board/c2d2/board.c b/board/c2d2/board.c index 24b314118e..fa6373c861 100644 --- a/board/c2d2/board.c +++ b/board/c2d2/board.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -30,8 +30,8 @@ #include "gpio_list.h" -#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) +#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args) /* Forward declarations */ static void update_vrefs_and_shifters(void); @@ -41,19 +41,19 @@ static bool is_ec_i2c_enabled(void); /* Global state tracking current pin configuration and operations */ static struct mutex vref_bus_state_mutex; static int vref_monitor_disable; -#define VREF_MON_DIS_H1_RST_HELD BIT(0) -#define VREF_MON_DIS_EC_PWR_HELD BIT(1) -#define VREF_MON_DIS_SPI_MODE BIT(2) +#define VREF_MON_DIS_H1_RST_HELD BIT(0) +#define VREF_MON_DIS_EC_PWR_HELD BIT(1) +#define VREF_MON_DIS_SPI_MODE BIT(2) /* * Tracks if bus pins are locked by a function like UART holding, I2C, * or SPI. */ enum bus_lock { - BUS_UNLOCKED, /* Normal UART; pins available for other functions */ - BUS_UART_HELD, /* UART locked to pins while holding RX low */ - BUS_SPI, /* SPI locked to pins */ - BUS_I2C, /* I2C bus locked to pins */ + BUS_UNLOCKED, /* Normal UART; pins available for other functions */ + BUS_UART_HELD, /* UART locked to pins while holding RX low */ + BUS_SPI, /* SPI locked to pins */ + BUS_I2C, /* I2C bus locked to pins */ }; /* A0/A1 (H1 UART or SPI) */ enum bus_lock h1_pins; @@ -77,7 +77,7 @@ static const char *lock_to_string(const enum bus_lock val) return names[val]; } -static int command_bus_status(int argc, char **argv) +static int command_bus_status(int argc, const char **argv) { if (argc > 1) return EC_ERROR_PARAM_COUNT; @@ -88,11 +88,9 @@ static int command_bus_status(int argc, char **argv) return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(bus_status, command_bus_status, - "", +DECLARE_CONSOLE_COMMAND(bus_status, command_bus_status, "", "Gets the bus state for swappable pins"); - /****************************************************************************** ** Chip-specific board configuration */ @@ -114,12 +112,11 @@ void board_config_pre_init(void) * i2c : no dma * tim16/17: no dma */ - STM32_SYSCFG_CFGR1 |= BIT(24); /* Remap SPI2_RX to channel 6 */ - STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */ - STM32_SYSCFG_CFGR1 |= BIT(10); /* Remap USART1 RX/TX DMA */ + STM32_SYSCFG_CFGR1 |= BIT(24); /* Remap SPI2_RX to channel 6 */ + STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */ + STM32_SYSCFG_CFGR1 |= BIT(10); /* Remap USART1 RX/TX DMA */ } - /****************************************************************************** ** ADC channels */ @@ -147,18 +144,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); * Define the strings used in our USB descriptors. */ const void *const usb_strings[] = { - [USB_STR_DESC] = usb_string_desc, - [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), - [USB_STR_PRODUCT] = USB_STRING_DESC("C2D2"), - [USB_STR_SERIALNO] = 0, - [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), - [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("CR50"), - [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"), - [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("C2D2 Shell"), - [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"), - [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"), - [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"), - [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("EC"), + [USB_STR_DESC] = usb_string_desc, + [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"), + [USB_STR_PRODUCT] = USB_STRING_DESC("C2D2"), + [USB_STR_SERIALNO] = 0, + [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), + [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("CR50"), + [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"), + [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("C2D2 Shell"), + [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"), + [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"), + [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"), + [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("EC"), }; BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); @@ -174,7 +171,7 @@ const struct i2c_port_t i2c_ports[] = { .port = I2C_PORT_EC, .kbps = 100, .scl = GPIO_UART_DBG_TX_EC_RX_SCL, - .sda = GPIO_UART_EC_TX_DBG_RX_SDA, + .sda = GPIO_UART_EC_TX_DBG_RX_SDA, .flags = I2C_PORT_FLAG_DYNAMIC_SPEED, }, { @@ -182,7 +179,7 @@ const struct i2c_port_t i2c_ports[] = { .port = I2C_PORT_AUX, .kbps = 100, .scl = GPIO_UART_DBG_TX_AP_RX_INA_SCL, - .sda = GPIO_UART_AP_TX_DBG_RX_INA_SDA, + .sda = GPIO_UART_AP_TX_DBG_RX_INA_SDA, .flags = I2C_PORT_FLAG_DYNAMIC_SPEED, }, }; @@ -203,14 +200,19 @@ const struct ite_dfu_config_t ite_dfu_config = { * let the i2c transactions fail instead of using the USB endpoint disable * status. */ -int usb_i2c_board_is_enabled(void) { return 1; } +int usb_i2c_board_is_enabled(void) +{ + return 1; +} /****************************************************************************** * Forward UARTs as a USB serial interface. */ -#define USB_STREAM_RX_SIZE 32 -#define USB_STREAM_TX_SIZE 64 +#define USB_STREAM_RX_SIZE 32 +#define USB_STREAM_TX_SIZE 64 +#define USART_TO_USB_SIZE 1024 +#define USB_TO_USART_SIZE 64 /****************************************************************************** * Forward USART1 (EC) as a simple USB serial interface. @@ -219,33 +221,22 @@ int usb_i2c_board_is_enabled(void) { return 1; } static struct usart_config const usart1; struct usb_stream_config const usart1_usb; -static struct queue const usart1_to_usb = QUEUE_DIRECT(128, uint8_t, - usart1.producer, usart1_usb.consumer); -static struct queue const usb_to_usart1 = QUEUE_DIRECT(64, uint8_t, - usart1_usb.producer, usart1.consumer); +static struct queue const usart1_to_usb = QUEUE_DIRECT( + USART_TO_USB_SIZE, uint8_t, usart1.producer, usart1_usb.consumer); +static struct queue const usb_to_usart1 = QUEUE_DIRECT( + USB_TO_USART_SIZE, uint8_t, usart1_usb.producer, usart1.consumer); static struct usart_rx_dma const usart1_rx_dma = USART_RX_DMA(STM32_DMAC_CH5, 32); static struct usart_config const usart1 = - USART_CONFIG(usart1_hw, - usart1_rx_dma.usart_rx, - usart_tx_interrupt, - 115200, - 0, - usart1_to_usb, - usb_to_usart1); - -USB_STREAM_CONFIG_USART_IFACE(usart1_usb, - USB_IFACE_USART1_STREAM, - USB_STR_USART1_STREAM_NAME, - USB_EP_USART1_STREAM, - USB_STREAM_RX_SIZE, - USB_STREAM_TX_SIZE, - usb_to_usart1, - usart1_to_usb, - usart1) + USART_CONFIG(usart1_hw, usart1_rx_dma.usart_rx, usart_tx_interrupt, + 115200, 0, usart1_to_usb, usb_to_usart1); +USB_STREAM_CONFIG_USART_IFACE(usart1_usb, USB_IFACE_USART1_STREAM, + USB_STR_USART1_STREAM_NAME, USB_EP_USART1_STREAM, + USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, + usb_to_usart1, usart1_to_usb, usart1) /****************************************************************************** * Forward USART3 (CPU) as a simple USB serial interface. @@ -254,33 +245,22 @@ USB_STREAM_CONFIG_USART_IFACE(usart1_usb, static struct usart_config const usart3; struct usb_stream_config const usart3_usb; -static struct queue const usart3_to_usb = QUEUE_DIRECT(1024, uint8_t, - usart3.producer, usart3_usb.consumer); -static struct queue const usb_to_usart3 = QUEUE_DIRECT(64, uint8_t, - usart3_usb.producer, usart3.consumer); +static struct queue const usart3_to_usb = QUEUE_DIRECT( + USART_TO_USB_SIZE, uint8_t, usart3.producer, usart3_usb.consumer); +static struct queue const usb_to_usart3 = QUEUE_DIRECT( + USB_TO_USART_SIZE, uint8_t, usart3_usb.producer, usart3.consumer); static struct usart_rx_dma const usart3_rx_dma = USART_RX_DMA(STM32_DMAC_CH3, 32); static struct usart_config const usart3 = - USART_CONFIG(usart3_hw, - usart3_rx_dma.usart_rx, - usart_tx_interrupt, - 115200, - 0, - usart3_to_usb, - usb_to_usart3); - -USB_STREAM_CONFIG_USART_IFACE(usart3_usb, - USB_IFACE_USART3_STREAM, - USB_STR_USART3_STREAM_NAME, - USB_EP_USART3_STREAM, - USB_STREAM_RX_SIZE, - USB_STREAM_TX_SIZE, - usb_to_usart3, - usart3_to_usb, - usart3) + USART_CONFIG(usart3_hw, usart3_rx_dma.usart_rx, usart_tx_interrupt, + 115200, 0, usart3_to_usb, usb_to_usart3); +USB_STREAM_CONFIG_USART_IFACE(usart3_usb, USB_IFACE_USART3_STREAM, + USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM, + USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, + usb_to_usart3, usart3_to_usb, usart3) /****************************************************************************** * Forward USART4 (cr50) as a simple USB serial interface. @@ -291,29 +271,19 @@ USB_STREAM_CONFIG_USART_IFACE(usart3_usb, static struct usart_config const usart4; struct usb_stream_config const usart4_usb; -static struct queue const usart4_to_usb = QUEUE_DIRECT(1024, uint8_t, - usart4.producer, usart4_usb.consumer); -static struct queue const usb_to_usart4 = QUEUE_DIRECT(64, uint8_t, - usart4_usb.producer, usart4.consumer); +static struct queue const usart4_to_usb = QUEUE_DIRECT( + USART_TO_USB_SIZE, uint8_t, usart4.producer, usart4_usb.consumer); +static struct queue const usb_to_usart4 = QUEUE_DIRECT( + USB_TO_USART_SIZE, uint8_t, usart4_usb.producer, usart4.consumer); static struct usart_config const usart4 = - USART_CONFIG(usart4_hw, - usart_rx_interrupt, - usart_tx_interrupt, - 115200, - 0, - usart4_to_usb, - usb_to_usart4); - -USB_STREAM_CONFIG_USART_IFACE(usart4_usb, - USB_IFACE_USART4_STREAM, - USB_STR_USART4_STREAM_NAME, - USB_EP_USART4_STREAM, - USB_STREAM_RX_SIZE, - USB_STREAM_TX_SIZE, - usb_to_usart4, - usart4_to_usb, - usart4) + USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 115200, + 0, usart4_to_usb, usb_to_usart4); + +USB_STREAM_CONFIG_USART_IFACE(usart4_usb, USB_IFACE_USART4_STREAM, + USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM, + USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, + usb_to_usart4, usart4_to_usb, usart4) /****************************************************************************** * Set up SPI over USB @@ -322,7 +292,7 @@ USB_STREAM_CONFIG_USART_IFACE(usart4_usb, /* SPI devices */ const struct spi_device_t spi_devices[] = { - { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CSN}, + { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CSN }, }; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); @@ -364,7 +334,7 @@ USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, /****************************************************************************** * Check parity setting on usarts. */ -static int command_uart_parity(int argc, char **argv) +static int command_uart_parity(int argc, const char **argv) { int parity = 0, newparity; struct usart_config const *usart; @@ -398,14 +368,13 @@ static int command_uart_parity(int argc, char **argv) return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(parity, command_uart_parity, - "usart[2|3|4] [0|1|2]", +DECLARE_CONSOLE_COMMAND(parity, command_uart_parity, "usart[2|3|4] [0|1|2]", "Set parity on uart"); /****************************************************************************** * Set baud rate setting on usarts. */ -static int command_uart_baud(int argc, char **argv) +static int command_uart_baud(int argc, const char **argv) { int baud = 0; struct usart_config const *usart; @@ -431,14 +400,13 @@ static int command_uart_baud(int argc, char **argv) return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(baud, command_uart_baud, - "usart[2|3|4] rate", +DECLARE_CONSOLE_COMMAND(baud, command_uart_baud, "usart[2|3|4] rate", "Set baud rate on uart"); /****************************************************************************** * Hold the usart pins low while disabling it, or return it to normal. */ -static int command_hold_usart_low(int argc, char **argv) +static int command_hold_usart_low(int argc, const char **argv) { enum bus_lock *bus; enum gpio_signal rx; @@ -501,7 +469,7 @@ static int command_hold_usart_low(int argc, char **argv) /* Print status for get and set case. */ ccprintf("USART status: %s\n", - *bus == BUS_UART_HELD ? "held low" : "normal"); + *bus == BUS_UART_HELD ? "held low" : "normal"); return EC_SUCCESS; @@ -513,7 +481,6 @@ DECLARE_CONSOLE_COMMAND(hold_usart_low, command_hold_usart_low, "usart[1|3|4] [0|1]?", "Get/set the hold-low state for usart port"); - /****************************************************************************** * Console commands SPI programming */ @@ -523,7 +490,7 @@ enum vref { PP3300 = 3300, }; -static int command_enable_spi(int argc, char **argv) +static int command_enable_spi(int argc, const char **argv) { static enum vref current_spi_vref_state; @@ -650,8 +617,7 @@ busy_error_unlock: mutex_unlock(&vref_bus_state_mutex); return EC_ERROR_BUSY; } -DECLARE_CONSOLE_COMMAND(enable_spi, command_enable_spi, - "[0|1800|3300]?", +DECLARE_CONSOLE_COMMAND(enable_spi, command_enable_spi, "[0|1800|3300]?", "Get/set the SPI Vref"); /****************************************************************************** @@ -686,7 +652,7 @@ static inline int to_kbps(enum i2c_freq freq) } } -static int command_enable_i2c(int argc, char **argv) +static int command_enable_i2c(int argc, const char **argv) { int i2c_index; enum bus_lock *bus; @@ -770,7 +736,7 @@ DECLARE_CONSOLE_COMMAND(enable_i2c, command_enable_i2c, * Console commands for asserting H1 reset and EC Power button */ -static int command_vref_alternate(int argc, char **argv, +static int command_vref_alternate(int argc, const char **argv, const enum gpio_signal vref_signal, const enum gpio_signal en_signal, const int state_flag, @@ -819,7 +785,6 @@ static int command_vref_alternate(int argc, char **argv, ccprintf("%s held: %s\n", print_name, vref_monitor_disable & state_flag ? "yes" : "no"); - return EC_SUCCESS; busy_error_unlock: @@ -827,24 +792,23 @@ busy_error_unlock: return EC_ERROR_BUSY; } -static int command_pwr_button(int argc, char **argv) +static int command_pwr_button(int argc, const char **argv) { return command_vref_alternate(argc, argv, GPIO_SPIVREF_HOLDN_ECVREF_H1_PWRBTN_ODL, GPIO_EN_SPIVREF_HOLDN_ECVREF_H1_PWRBTN, VREF_MON_DIS_EC_PWR_HELD, "Power button"); } -DECLARE_CONSOLE_COMMAND(pwr_button, command_pwr_button, - "[0|1]?", +DECLARE_CONSOLE_COMMAND(pwr_button, command_pwr_button, "[0|1]?", "Get/set the power button state"); -static int command_h1_reset(int argc, char **argv) +static int command_h1_reset(int argc, const char **argv) { if ((argc == 2) && !strncasecmp("pulse", argv[1], strlen(argv[1]))) { int rv; int c = 2; - char *cmd_on[] = {"", "1", ""}; - char *cmd_off[] = {"", "0", ""}; + const char *cmd_on[] = { "", "1", "" }; + const char *cmd_off[] = { "", "0", "" }; rv = command_vref_alternate(c, cmd_on, GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL, @@ -853,11 +817,10 @@ static int command_h1_reset(int argc, char **argv) "H1 reset"); if (rv == EC_SUCCESS) { msleep(100); - rv = command_vref_alternate - (c, cmd_off, - GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL, - GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST, - VREF_MON_DIS_H1_RST_HELD, "H1 reset"); + rv = command_vref_alternate( + c, cmd_off, GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL, + GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST, + VREF_MON_DIS_H1_RST_HELD, "H1 reset"); } return rv; } @@ -867,11 +830,9 @@ static int command_h1_reset(int argc, char **argv) GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST, VREF_MON_DIS_H1_RST_HELD, "H1 reset"); } -DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset, - "[0|1|pulse]?", +DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset, "[0|1|pulse]?", "Get/set the h1 reset state"); - /****************************************************************************** * Vref detection logic */ @@ -880,14 +841,13 @@ DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset, static enum vref h1_vref; static enum vref ec_vref; -static int command_h1_vref_present(int argc, char **argv) +static int command_h1_vref_present(int argc, const char **argv) { ccprintf("H1 Vref: %s\n", h1_vref ? "on" : "off"); return EC_SUCCESS; } -DECLARE_CONSOLE_COMMAND(h1_vref, command_h1_vref_present, - "", +DECLARE_CONSOLE_COMMAND(h1_vref, command_h1_vref_present, "", "Get if the h1 vref is present"); /* Voltage thresholds for rail detection */ @@ -1033,11 +993,9 @@ static void update_vrefs_and_shifters(void) void set_up_comparator(void) { /* Overwrite any previous values. This is the only comparator usage */ - STM32_COMP_CSR = STM32_COMP_CMP2HYST_HI | - STM32_COMP_CMP2OUTSEL_NONE | + STM32_COMP_CSR = STM32_COMP_CMP2HYST_HI | STM32_COMP_CMP2OUTSEL_NONE | STM32_COMP_CMP2INSEL_INM5 | /* Watch DAC_OUT2 (PA5) */ - STM32_COMP_CMP2MODE_LSPEED | - STM32_COMP_CMP2EN; + STM32_COMP_CMP2MODE_LSPEED | STM32_COMP_CMP2EN; /* Set Falling and Rising interrupts for COMP2 */ STM32_EXTI_FTSR |= EXTI_COMP2_EVENT; |