From b5a0fdab0680fd93b0b7b08a139a5fdcbb679ee6 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 26 Jan 2021 11:36:48 -0800 Subject: spi: Pass in spi_device as argument to spi_enable instead of port Rather than passing in the port and iterating over the global spi_devices variable, pass in the specific spi_device that is being enabled/disabled. The spi_device_t struct has the port. This change makes the functions in spi.h more consistent since they now all take a spi_device_t*. This change is the first step in making the SPI configuration more dynamic. BRANCH=none BUG=b:177908650 TEST=git grep 'spi_enable(CONFIG' => no results TEST=make buildall TEST=Flash dragonclaw v0.2 and view console to verify FP sensor ID Signed-off-by: Tom Hughes Change-Id: I64124e0ebcf898e88496acb77703b5f59ae931c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654081 Commit-Queue: Abe Levkoy Reviewed-by: Abe Levkoy --- board/rainier/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'board/rainier/board.c') diff --git a/board/rainier/board.c b/board/rainier/board.c index 2d5140eed6..3fa159a8f0 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -200,7 +200,7 @@ static void board_spi_enable(void) STM32_RCC_APB1RSTR |= STM32_RCC_PB1_SPI2; STM32_RCC_APB1RSTR &= ~STM32_RCC_PB1_SPI2; - spi_enable(CONFIG_SPI_ACCEL_PORT, 1); + spi_enable(&spi_devices[0], 1); } DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable, @@ -208,7 +208,7 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, static void board_spi_disable(void) { - spi_enable(CONFIG_SPI_ACCEL_PORT, 0); + spi_enable(&spi_devices[0], 0); /* Disable clocks to SPI2 module */ STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2; -- cgit v1.2.1