The Milk-V Duo has the SPI2 bus exposed via header pins. However, the node for SPI2 in dts is not enabled by default, nor are the config entries for dwspi drivers in kernel.
I’ve played with SDK and got SPI data out of it. Here are the steps:
- Pinmux setup
It seems to be relatively easy to edit the board_init function in uboot init.
Uncomment the line at u-boot-2021.10/board/cvitek/cv180x/board.c:230
//pinmux_config(PINMUX_SPI2);
- Edit devicetree
Add the following node in build/boards/cv180x/cv1800b_sophpi_duo_sd/dts_riscv/cv1800b_sophpi_duo_sd.dts :
&spi2 {
status = "okay";
cs-gpios = <&porta 18 0>;
spidev@0 {
status = "okay";
};
};
- Enable kernel drivers
Add the following entries in build/boards/cv180x/cv1800b_sophpi_duo_sd/linux/cvitek_cv1800b_sophpi_duo_sd_defconfig (or your own config file)
CONFIG_SPI_MASTER=y
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_DESIGNWARE=y
CONFIG_SPI_DW_MMIO=y
Then the spidev should show up