chip/npcx/spi.c: Format with clang-format
BRANCH=none
TEST=none
@@ -52,16 +52,17 @@ void spi_freq_changed(void)
uint8_t prescaler_divider = 0;
/* Set clock prescaler divider to SPI module*/
- prescaler_divider = (uint8_t)((uint32_t)clock_get_apb2_freq()
- / 2 / SPI_CLK);
+ prescaler_divider =
+ (uint8_t)((uint32_t)clock_get_apb2_freq() / 2 / SPI_CLK);
if (prescaler_divider >= 1)
prescaler_divider = prescaler_divider - 1;
if (prescaler_divider > 0x7F)
prescaler_divider = 0x7F;
/* Set core clock division factor in order to obtain the SPI clock */
- NPCX_SPI_CTL1 = (NPCX_SPI_CTL1&(~(((1<<7)-1)<<NPCX_SPI_CTL1_SCDV)))
- |(prescaler_divider<<NPCX_SPI_CTL1_SCDV);
+ NPCX_SPI_CTL1 =
+ (NPCX_SPI_CTL1 & (~(((1 << 7) - 1) << NPCX_SPI_CTL1_SCDV))) |
+ (prescaler_divider << NPCX_SPI_CTL1_SCDV);
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, spi_freq_changed, HOOK_PRIO_FIRST);
@@ -105,7 +106,6 @@ int spi_enable(const struct spi_device_t *spi_device, int enable)
return EC_SUCCESS;
}
-
/**
* Flush an SPI transaction and receive data from peripheral.
*
@@ -118,8 +118,8 @@ int spi_enable(const struct spi_device_t *spi_device, int enable)
* @notes set controller transaction mode in npcx chip
*/
int spi_transaction(const struct spi_device_t *spi_device,
- const uint8_t *txdata, int txlen,
- uint8_t *rxdata, int rxlen)
+ const uint8_t *txdata, int txlen, uint8_t *rxdata,
+ int rxlen)
{
int i = 0;
enum gpio_signal gpio = spi_device->gpio_cs;
@@ -205,8 +205,8 @@ static void spi_init(void)
CLEAR_BIT(NPCX_SPI_CTL1, NPCX_SPI_CTL1_SCIDL);
CPRINTS("nSPI_COMP=%x", IS_BIT_SET(NPCX_STRPST, NPCX_STRPST_SPI_COMP));
- CPRINTS("SPI_SP_SEL=%x", IS_BIT_SET(NPCX_DEV_CTL4,
- NPCX_DEV_CTL4_SPI_SP_SEL));
+ CPRINTS("SPI_SP_SEL=%x",
+ IS_BIT_SET(NPCX_DEV_CTL4, NPCX_DEV_CTL4_SPI_SP_SEL));
/* Cleaning junk data in the buffer */
clear_databuf();
}
@@ -253,7 +253,6 @@ static int command_spirom(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(spirom, command_spirom,
- NULL,
+DECLARE_CONSOLE_COMMAND(spirom, command_spirom, NULL,
"Test reading SPI EEPROM");
#endif
