summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonjoon Lee <woojoo.lee@samsung.com>2016-04-30 16:51:50 +0900
committerchrome-bot <chrome-bot@chromium.org>2016-05-06 00:25:15 -0700
commitbe930e3425919f071e07bbcfa49c66863e2170c4 (patch)
treefa1323224dea419ec7815a6d09bab70871d1ee4a
parent2c162ddade721473eb3fbe7d6ae139def581af2c (diff)
downloadchrome-ec-be930e3425919f071e07bbcfa49c66863e2170c4.tar.gz
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 <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/341576 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--chip/npcx/spi.c8
1 files 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