路徑 : ~/yocto/build/tmp-glibc/work-shared/numaker-iot-ma35d16f90/kernel-source/arch/arm64/boot/dts/nuvoton/ma35d1.dtsi
spi0: spi@40600000 {
compatible = "nuvoton,ma35d1-spi";
reg = <0x0 0x40600000 0x0 0x10000>;
interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk SPI0_GATE>;
dmas = <&pdma1 4>,<&pdma1 5>;
dma-names = "tx","rx";
pdma_reqsel_tx = <60>;
pdma_reqsel_rx = <61>;
use_pdma = <0>;
num_cs = <2>;
lsb = <0>;
sleep = <0>;
txbitlen = <8>;
bus_num = <2>;
spimode = <0>;
mrxphase = <0>;
spi-max-frequency = <10000000>;
status = "disabled";
};
路徑 : ~/yocto/build/tmp-glibc/work-shared/numaker-iot-ma35d16f90/kernel-source/arch/arm64/boot/dts/nuvoton/ma35d1-iot-512m.dts
CS = PG0
CLK = PB9
MOSI = PL14
MISO =PL15
使用PDMA 所以下面給1
速度最高給12M (後面會蓋掉前面設定!)
&spi0 {
status = "okay";
pinctrl-names = "default";
use_pdma = <1>;
spi-max-frequency = <30000000>;
pinctrl-0 = <&pinctrl_spi0>;
spidev@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <12000000>;
};
};
&pinctrl {
spi0 {
pinctrl_spi0: spi0grp{
nuvoton,pins =
<SYS_GPG_MFPL_PG0MFP_SPI0_SS0 &pcfg_default>,
<SYS_GPB_MFPH_PB8MFP_SPI0_SS1 &pcfg_default>,
<SYS_GPB_MFPH_PB9MFP_SPI0_CLK &pcfg_default>,
<SYS_GPL_MFPH_PL14MFP_SPI0_MOSI &pcfg_default>,
<SYS_GPL_MFPH_PL15MFP_SPI0_MISO &pcfg_default>;
};
};
};
路徑 : ~/yocto/build/tmp-glibc/work-shared/numaker-iot-ma35d16f90/kernel-source/drivers/spi
static int nuvoton_spi_data_xfer(struct nuvoton_spi *hw, const void *txbuf,
void *rxbuf, unsigned int len)
{
...
}
採用NUC980的 app https://github.com/OpenNuvoton/NUC980_Linux_Applications/blob/master/demos/spi/spidev_test.c
.SUFFIXES : .x .o .c .s
STRIP := aarch64-poky-linux-strip
#TARGET = spidev_test
#SRCS := spidev_test.c
all:
# $(CC) $(SRCS) -o $(TARGET)
clean:
rm -f *.o
rm -f *.x
rm -f *.flat
rm -f *.map
rm -f temp
rm -f *.img
rm -f $(TARGET)
rm -f *.gdb