Skip to content

drivers: spi: gecko: Add new driver for SPI communication via EUSART #153349

drivers: spi: gecko: Add new driver for SPI communication via EUSART

drivers: spi: gecko: Add new driver for SPI communication via EUSART #153349

Triggered via pull request October 7, 2024 22:05
Status Failure
Total duration 2m 28s
Artifacts 1

compliance.yml

on: pull_request
Run compliance checks on patch series (PR)
2m 19s
Run compliance checks on patch series (PR)
Fit to window
Zoom out
Zoom in

Annotations

7 errors, 2 warnings, and 10 notices
TRAILING_WHITESPACE: drivers/spi/spi_gecko_eusart.c#L180
drivers/spi/spi_gecko_eusart.c:180 trailing whitespace
Run compliance checks on patch series (PR)
Process completed with exit code 5.
Run compliance checks on patch series (PR): Checkpatch.txt#L1
See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more details. TRAILING_WHITESPACE: trailing whitespace File:drivers/spi/spi_gecko_eusart.c Line:180
Run compliance checks on patch series (PR): YAMLLint.txt#L1
Check YAML files with YAMLLint. YAMLLint (new-line-at-end-of-file):no new line character at the end of file File:dts/bindings/spi/silabs,gecko-spi-eusart.yaml Line:21 Column:19
Run compliance checks on patch series (PR): GitDiffCheck.txt#L1
Git conflict markers and whitespace errors are not allowed in added changes c161eee68eceb3e3d2df7385d9336cb46a20f365: drivers/spi/spi_gecko_eusart.c:180: trailing whitespace.
Run compliance checks on patch series (PR): Nits.txt#L1
See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more details. Missing newline at end of 'dts/bindings/spi/silabs,gecko-spi-eusart.yaml'. Check your text editor settings.
Run compliance checks on patch series (PR)
Process completed with exit code 1.
YAMLLint (new-line-at-end-of-file): dts/bindings/spi/silabs#L21
dts/bindings/spi/silabs,gecko-spi-eusart.yaml:21 no new line character at the end of file
Run compliance checks on patch series (PR): ClangFormat.txt#L1
See https://docs.zephyrproject.org/latest/contribute/guidelines.html#clang-format for more details. You may want to run clang-format on this change: -#define GET_GECKO_EUSART_CLOCK(idx) \ - .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ +#define GET_GECKO_EUSART_CLOCK(idx) \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ .clock_cfg = SILABS_DT_INST_CLOCK_CFG(idx), #else #if (EUSART_COUNT == 1) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : -1) +#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 : -1) #elif (EUSART_COUNT == 2) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 : ((ref) == EUSART1) ? cmuClock_EUSART1 : -1) #elif (EUSART_COUNT == 3) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : ((ref) == EUSART2) ? cmuClock_EUSART2 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 \ + : ((ref) == EUSART1) ? cmuClock_EUSART1 \ + : ((ref) == EUSART2) ? cmuClock_EUSART2 \ + : -1) #elif (EUSART_COUNT == 4) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : ((ref) == EUSART2) ? cmuClock_EUSART2 \ - : ((ref) == EUSART3) ? cmuClock_EUSART3 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 \ + : ((ref) == EUSART1) ? cmuClock_EUSART1 \ + : ((ref) == EUSART2) ? cmuClock_EUSART2 \ + : ((ref) == EUSART3) ? cmuClock_EUSART3 \ + : -1) #else #error "Undefined number of USARTs." #endif /* USART_COUNT */ -#define GET_GECKO_EUSART_CLOCK(id) \ - .clock = CLOCK_EUSART((EUSART_TypeDef *)DT_INST_REG_ADDR(id)), +#define GET_GECKO_EUSART_CLOCK(id) .clock = CLOCK_EUSART((EUSART_TypeDef *)DT_INST_REG_ADDR(id)), File:drivers/spi/spi_gecko_eusart.c Line:56 You may want to run clang-format on this change: - #ifdef CONFIG_CLOCK_CONTROL +#ifdef CONFIG_CLOCK_CONTROL File:drivers/spi/spi_gecko_eusart.c Line:89 You may want to run clang-format on this change: - err = clock_control_on(gecko_config->clock_dev, - (clock_control_subsys_t)&gecko_config->clock_cfg); + err = clock_control_on(gecko_config->clock_dev, + (clock_control_subsys_t)&gecko_config->clock_cfg); File:drivers/spi/spi_gecko_eusart.c Line:182 You may want to run clang-format on this change: -#define SPI_INIT(n) \ - PINCTRL_DT_INST_DEFINE(n); \ - static struct spi_gecko_eusart_data spi_gecko_eusart_data_##n = { \ - SPI_CONTEXT_INIT_LOCK(spi_gecko_eusart_data_##n, ctx), \ - SPI_CONTEXT_INIT_SYNC(spi_gecko_eusart_data_##n, ctx), \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx)}; \ - static struct spi_gecko_eusart_config spi_gecko_eusart_cfg_##n = { \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ - .base = (EUSART_TypeDef *)DT_INST_REG_ADDR(n), \ - GET_GECKO_EUSART_CLOCK(n) \ - .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000) \ - }; \ - DEVICE_DT_INST_DEFINE(n, spi_gecko_eusart_init, NULL, &spi_gecko_eusart_data_##n, \ - &spi_gecko_eusart_cfg_##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ +#define SPI_INIT(n)
You may want to run clang-format on this change: drivers/spi/spi_gecko_eusart.c#L56
drivers/spi/spi_gecko_eusart.c:56 -#define GET_GECKO_EUSART_CLOCK(idx) \ - .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ +#define GET_GECKO_EUSART_CLOCK(idx) \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ .clock_cfg = SILABS_DT_INST_CLOCK_CFG(idx), #else #if (EUSART_COUNT == 1) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : -1) +#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 : -1) #elif (EUSART_COUNT == 2) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 : ((ref) == EUSART1) ? cmuClock_EUSART1 : -1) #elif (EUSART_COUNT == 3) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : ((ref) == EUSART2) ? cmuClock_EUSART2 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 \ + : ((ref) == EUSART1) ? cmuClock_EUSART1 \ + : ((ref) == EUSART2) ? cmuClock_EUSART2 \ + : -1) #elif (EUSART_COUNT == 4) -#define CLOCK_EUSART(ref) (((ref) == EUSART0) ? cmuClock_EUSART0 \ - : ((ref) == EUSART1) ? cmuClock_EUSART1 \ - : ((ref) == EUSART2) ? cmuClock_EUSART2 \ - : ((ref) == EUSART3) ? cmuClock_EUSART3 \ - : -1) +#define CLOCK_EUSART(ref) \ + (((ref) == EUSART0) ? cmuClock_EUSART0 \ + : ((ref) == EUSART1) ? cmuClock_EUSART1 \ + : ((ref) == EUSART2) ? cmuClock_EUSART2 \ + : ((ref) == EUSART3) ? cmuClock_EUSART3 \ + : -1) #else #error "Undefined number of USARTs." #endif /* USART_COUNT */ -#define GET_GECKO_EUSART_CLOCK(id) \ - .clock = CLOCK_EUSART((EUSART_TypeDef *)DT_INST_REG_ADDR(id)), +#define GET_GECKO_EUSART_CLOCK(id) .clock = CLOCK_EUSART((EUSART_TypeDef *)DT_INST_REG_ADDR(id)),
You may want to run clang-format on this change: drivers/spi/spi_gecko_eusart.c#L89
drivers/spi/spi_gecko_eusart.c:89 - #ifdef CONFIG_CLOCK_CONTROL +#ifdef CONFIG_CLOCK_CONTROL
You may want to run clang-format on this change: drivers/spi/spi_gecko_eusart.c#L182
drivers/spi/spi_gecko_eusart.c:182 - err = clock_control_on(gecko_config->clock_dev, - (clock_control_subsys_t)&gecko_config->clock_cfg); + err = clock_control_on(gecko_config->clock_dev, + (clock_control_subsys_t)&gecko_config->clock_cfg);
You may want to run clang-format on this change: drivers/spi/spi_gecko_eusart.c#L360
drivers/spi/spi_gecko_eusart.c:360 -#define SPI_INIT(n) \ - PINCTRL_DT_INST_DEFINE(n); \ - static struct spi_gecko_eusart_data spi_gecko_eusart_data_##n = { \ - SPI_CONTEXT_INIT_LOCK(spi_gecko_eusart_data_##n, ctx), \ - SPI_CONTEXT_INIT_SYNC(spi_gecko_eusart_data_##n, ctx), \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx)}; \ - static struct spi_gecko_eusart_config spi_gecko_eusart_cfg_##n = { \ - .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ - .base = (EUSART_TypeDef *)DT_INST_REG_ADDR(n), \ - GET_GECKO_EUSART_CLOCK(n) \ - .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000) \ - }; \ - DEVICE_DT_INST_DEFINE(n, spi_gecko_eusart_init, NULL, &spi_gecko_eusart_data_##n, \ - &spi_gecko_eusart_cfg_##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ +#define SPI_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ + static struct spi_gecko_eusart_data spi_gecko_eusart_data_##n = { \ + SPI_CONTEXT_INIT_LOCK(spi_gecko_eusart_data_##n, ctx), \ + SPI_CONTEXT_INIT_SYNC(spi_gecko_eusart_data_##n, ctx), \ + SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx)}; \ + static struct spi_gecko_eusart_config spi_gecko_eusart_cfg_##n = { \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ + .base = (EUSART_TypeDef *)DT_INST_REG_ADDR(n), \ + GET_GECKO_EUSART_CLOCK(n).clock_frequency = \ + DT_INST_PROP_OR(n, clock_frequency, 1000000)}; \ + DEVICE_DT_INST_DEFINE(n, spi_gecko_eusart_init, NULL, &spi_gecko_eusart_data_##n, \ + &spi_gecko_eusart_cfg_##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L84
drivers/spi/spi_gecko_usart.c:84 -#define GET_GECKO_USART_CLOCK(idx) \ - .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ +#define GET_GECKO_USART_CLOCK(idx) \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ .clock_cfg = SILABS_DT_INST_CLOCK_CFG(idx), #elif DT_NODE_HAS_PROP(n, peripheral_id) -#define CLOCK_USART(id) _CONCAT(cmuClock_USART, id) -#define GET_GECKO_USART_CLOCK(n) \ - .clock = CLOCK_USART(DT_INST_PROP(n, peripheral_id)), +#define CLOCK_USART(id) _CONCAT(cmuClock_USART, id) +#define GET_GECKO_USART_CLOCK(n) .clock = CLOCK_USART(DT_INST_PROP(n, peripheral_id)), #else #if (USART_COUNT == 1) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : -1) +#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 : -1) #elif (USART_COUNT == 2) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : ((ref) == USART1) ? cmuClock_USART1 \ - : -1) +#define CLOCK_USART(ref) \ + (((ref) == USART0) ? cmuClock_USART0 : ((ref) == USART1) ? cmuClock_USART1 : -1) #elif (USART_COUNT == 3) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : ((ref) == USART1) ? cmuClock_USART1 \ - : ((ref) == USART2) ? cmuClock_USART2 \ - : -1) +#define CLOCK_USART(ref) \ + (((ref) == USART0) ? cmuClock_USART0 \ + : ((ref) == USART1) ? cmuClock_USART1 \ + : ((ref) == USART2) ? cmuClock_USART2 \ + : -1) #elif (USART_COUNT == 4) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : ((ref) == USART1) ? cmuClock_USART1 \ - : ((ref) == USART2) ? cmuClock_USART2 \ - : ((ref) == USART3) ? cmuClock_USART3 \ - : -1) +#define CLOCK_USART(ref) \ + (((ref) == USART0) ? cmuClock_USART0 \ + : ((ref) == USART1) ? cmuClock_USART1 \ + : ((ref) == USART2) ? cmuClock_USART2 \ + : ((ref) == USART3) ? cmuClock_USART3 \ + : -1) #elif (USART_COUNT == 5) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : ((ref) == USART1) ? cmuClock_USART1 \ - : ((ref) == USART2) ? cmuClock_USART2 \ - : ((ref) == USART3) ? cmuClock_USART3 \ - : ((ref) == USART4) ? cmuClock_USART4 \ - : -1) +#define CLOCK_USART(ref) \ + (((ref) == USART0) ? cmuClock_USART0 \ + : ((ref) == USART1) ? cmuClock_USART1 \ + : ((ref) == USART2) ? cmuClock_USART2 \ + : ((ref) == USART3) ? cmuClock_USART3 \ + : ((ref) == USART4) ? cmuClock_USART4 \ + : -1) #elif (USART_COUNT == 6) -#define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ - : ((ref) == USART1) ? cmuClock_USART1 \ - : ((ref) == USART2) ? cmuClock_USART2 \ - : ((ref) == USART3) ? cmuClock_USART3 \ - : ((ref) == USART4) ? cmuClock_USART4 \ - : ((ref) == USART5) ? cmuClock_USART5 \ - : -1) +#define CLOCK_USART(ref) \ + (((ref) == USART0) ? cmuClock_USART0
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L119
drivers/spi/spi_gecko_usart.c:119 - /* Helper Functions */ -static int spi_config(const struct device *dev, - const struct spi_config *config, - uint16_t *control) +static int spi_config(const struct device *dev, const struct spi_config *config, uint16_t *control)
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L214
drivers/spi/spi_gecko_usart.c:214 - gecko_config->base->FRAME = usartDatabits8 - | USART_FRAME_STOPBITS_DEFAULT - | USART_FRAME_PARITY_DEFAULT; + gecko_config->base->FRAME = + usartDatabits8 | USART_FRAME_STOPBITS_DEFAULT | USART_FRAME_PARITY_DEFAULT;
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L255
drivers/spi/spi_gecko_usart.c:255 -static int spi_gecko_shift_frames(USART_TypeDef *usart, - struct spi_gecko_data *data) +static int spi_gecko_shift_frames(USART_TypeDef *usart, struct spi_gecko_data *data)
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L275
drivers/spi/spi_gecko_usart.c:275 - -static void spi_gecko_xfer(const struct device *dev, - const struct spi_config *config) +static void spi_gecko_xfer(const struct device *dev, const struct spi_config *config)
You may want to run clang-format on this change: drivers/spi/spi_gecko_usart.c#L318
drivers/spi/spi_gecko_usart.c:318 - GPIO_PinModeSet(config->pin_rx.port, config->pin_rx.pin, - config->pin_rx.mode, config->pin_rx.out); - GPIO_PinModeSet(config->pin_tx.port, config->pin_tx.pin, - config->pin_tx.mode, config->pin_tx.out); - GPIO_PinModeSet(config->pin_clk.port, config->pin_clk.pin, - config->pin_clk.mode, config->pin_clk.out); + GPIO_PinModeSet(config->pin_rx.port, config->pin_rx.pin, config->pin_rx.mode, + config->pin_rx.out); + GPIO_PinModeSet(config->pin_tx.port, config->pin_tx.pin, config->pin_tx.mode, + config->pin_tx.out); + GPIO_PinModeSet(config->pin_clk.port, config->pin_clk.pin, config->pin_clk.mode, + config->pin_clk.out); /* disable all pins while configuring */ config->base->ROUTEPEN = 0; - config->base->ROUTELOC0 = - (config->loc_tx << _USART_ROUTELOC0_TXLOC_SHIFT) | - (config->loc_rx << _USART_ROUTELOC0_RXLOC_SHIFT) | - (config->loc_clk << _USART_ROUTELOC0_CLKLOC_SHIFT); + config->base->ROUTELOC0 = (config->loc_tx << _USART_ROUTELOC0_TXLOC_SHIFT) | + (config->loc_rx << _USART_ROUTELOC0_RXLOC_SHIFT) | + (config->loc_clk << _USART_ROUTELOC0_CLKLOC_SHIFT); config->base->ROUTELOC1 = _USART_ROUTELOC1_RESETVALUE; - config->base->ROUTEPEN = USART_ROUTEPEN_RXPEN | USART_ROUTEPEN_TXPEN | - USART_ROUTEPEN_CLKPEN; + config->base->ROUTEPEN = + USART_ROUTEPEN_RXPEN | USART_ROUTEPEN_TXPEN | USART_ROUTEPEN_CLKPEN; } #endif /* !CONFIG_PINCTRL */ -

Artifacts

Produced during runtime
Name Size
compliance.xml
3.33 KB