From be930e3425919f071e07bbcfa49c66863e2170c4 Mon Sep 17 00:00:00 2001 From: Wonjoon Lee Date: Sat, 30 Apr 2016 16:51:50 +0900 Subject: [PATCH] npcx: spi: disable all port from board struct We have two port(as is FALSH_, ACCEL_) on SPI defines Let's prevent build error so that We can use particular enable/disable port BUG=None TEST=Buildall is OK Change-Id: Ib6fe14c4edd91947bde0a2da1c889da31db291a4 Signed-off-by: Wonjoon Lee Reviewed-on: https://chromium-review.googlesource.com/341576 Reviewed-by: Shawn N --- chip/npcx/spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chip/npcx/spi.c b/chip/npcx/spi.c index a41dcf89eb..04a05e6942 100644 --- a/chip/npcx/spi.c +++ b/chip/npcx/spi.c @@ -186,12 +186,14 @@ int spi_transaction(const struct spi_device_t *spi_device, */ static void spi_init(void) { + int i; /* Enable clock for SPI peripheral */ clock_enable_peripheral(CGC_OFFSET_SPI, CGC_SPI_MASK, CGC_MODE_RUN | CGC_MODE_SLEEP); /* Disabling spi module */ - spi_enable(CONFIG_SPI_FLASH_PORT, 0); + for (i = 0; i < spi_devices_used; i++) + spi_enable(spi_devices[i].port, 0); /* Disabling spi irq */ CLEAR_BIT(NPCX_SPI_CTL1, NPCX_SPI_CTL1_EIR); @@ -217,7 +219,7 @@ DECLARE_HOOK(HOOK_INIT, spi_init, HOOK_PRIO_INIT_SPI); /*****************************************************************************/ /* Console commands */ - +#ifdef CONFIG_CMD_SPI_FLASH static int printrx(const char *desc, const uint8_t *txdata, int txlen, int rxlen) { @@ -236,7 +238,6 @@ static int printrx(const char *desc, const uint8_t *txdata, int txlen, return EC_SUCCESS; } - static int command_spirom(int argc, char **argv) { uint8_t txmandev[] = {0x90, 0x00, 0x00, 0x00}; @@ -261,3 +262,4 @@ DECLARE_CONSOLE_COMMAND(spirom, command_spirom, NULL, "Test reading SPI EEPROM", NULL); +#endif