drivers: spi: support for Nuvoton numaker m2l31x

Update m2l31x.dtsi for spi support and update spi_numaker.c
for dummy TX data.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
This commit is contained in:
cyliang tw 2024-03-27 12:09:55 +08:00 committed by Fabio Baltieri
parent 0967f13c3f
commit 820a70242f
2 changed files with 54 additions and 0 deletions

View file

@ -186,6 +186,16 @@ static int spi_numaker_txrx(const struct device *dev)
}
LOG_DBG("%s --> TX [0x%x] done", __func__, tx_frame);
} else {
/* Write dummy data to TX register */
SPI_WRITE_TX(dev_cfg->spi, 0x00U);
time_out_cnt = SystemCoreClock; /* 1 second time-out */
while (SPI_IS_BUSY(dev_cfg->spi)) {
if (--time_out_cnt == 0) {
LOG_ERR("Wait for SPI time-out");
return -EIO;
}
}
}
/* Read received data */

View file

@ -213,6 +213,50 @@
status = "disabled";
interrupts = <21 2>;
};
spi0: spi@40061000 {
compatible = "nuvoton,numaker-spi";
reg = <0x40061000 0x6c>;
interrupts = <23 0>;
resets = <&rst NUMAKER_SPI0_RST>;
clocks = <&pcc NUMAKER_SPI0_MODULE NUMAKER_CLK_CLKSEL2_SPI0SEL_HIRC 0>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
spi1: spi@40062000 {
compatible = "nuvoton,numaker-spi";
reg = <0x40062000 0x6c>;
interrupts = <51 0>;
resets = <&rst NUMAKER_SPI1_RST>;
clocks = <&pcc NUMAKER_SPI1_MODULE NUMAKER_CLK_CLKSEL2_SPI1SEL_HIRC 0>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
spi2: spi@40063000 {
compatible = "nuvoton,numaker-spi";
reg = <0x40063000 0x6c>;
interrupts = <52 0>;
resets = <&rst NUMAKER_SPI2_RST>;
clocks = <&pcc NUMAKER_SPI2_MODULE NUMAKER_CLK_CLKSEL3_SPI2SEL_HIRC 0>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
spi3: spi@40064000 {
compatible = "nuvoton,numaker-spi";
reg = <0x40064000 0x6c>;
interrupts = <62 0>;
resets = <&rst NUMAKER_SPI3_RST>;
clocks = <&pcc NUMAKER_SPI3_MODULE NUMAKER_CLK_CLKSEL3_SPI3SEL_HIRC 0>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
};
};