Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3351
Tool/software:
The documentation for the am335x SDK v9 states both SPI slave mode is supported and is not supported. Is SPI slave mode supported with DMA enabled?
Features Not Supported
Below contains a list of features not supported by the Linux driver. Note this isn’t meant to be an exhaustive list and only takes into account features the SPI peripheral in the SoC is capable of but is currently not supported in the Linux driver.
-
SPI slave mode is supported only with DMA enabled.
-
SPI slave mode isn’t supported.
In am33xx-l4.dtsi, we find SPI0 and SPI1 nodes,
target-module@30000 { /* 0x48030000, ap 77 08.0 */
compatible = "ti,sysc-omap2", "ti,sysc";
reg = <0x30000 0x4>,
<0x30110 0x4>,
<0x30114 0x4>;
reg-names = "rev", "sysc", "syss";
ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
SYSC_OMAP2_SOFTRESET |
SYSC_OMAP2_AUTOIDLE)>;
ti,sysc-sidle = <SYSC_IDLE_FORCE>,
<SYSC_IDLE_NO>,
<SYSC_IDLE_SMART>;
ti,syss-mask = <1>;
/* Domains (P, C): per_pwrdm, l4ls_clkdm */
clocks = <&l4ls_clkctrl AM3_L4LS_SPI0_CLKCTRL 0>;
clock-names = "fck";
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x30000 0x1000>;
spi0: spi@0 {
compatible = "ti,omap4-mcspi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0 0x400>;
interrupts = <65>;
ti,spi-num-cs = <2>;
dmas = <&edma 16 0
&edma 17 0
&edma 18 0
&edma 19 0>;
dma-names = "tx0", "rx0", "tx1", "rx1";
status = "disabled";
};
};
target-module@a0000 { /* 0x481a0000, ap 79 24.0 */
compatible = "ti,sysc-omap2", "ti,sysc";
reg = <0xa0000 0x4>,
<0xa0110 0x4>,
<0xa0114 0x4>;
reg-names = "rev", "sysc", "syss";
ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
SYSC_OMAP2_SOFTRESET |
SYSC_OMAP2_AUTOIDLE)>;
ti,sysc-sidle = <SYSC_IDLE_FORCE>,
<SYSC_IDLE_NO>,
<SYSC_IDLE_SMART>;
ti,syss-mask = <1>;
/* Domains (P, C): per_pwrdm, l4ls_clkdm */
clocks = <&l4ls_clkctrl AM3_L4LS_SPI1_CLKCTRL 0>;
clock-names = "fck";
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0xa0000 0x1000>;
spi1: spi@0 {
compatible = "ti,omap4-mcspi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0 0x400>;
interrupts = <125>;
ti,spi-num-cs = <2>;
dmas = <&edma 42 0
&edma 43 0
&edma 44 0
&edma 45 0>;
dma-names = "tx0", "rx0", "tx1", "rx1";
status = "disabled";
};
};
Assuming slave mode is supported, can you provide example device tree nodes for both Master on SPI1 and Slave on SPI0 with DMA enabled? Most of the SPI-related threads pre-date SDK9.
This is what I have so far for SPI0 and SPI1 in the dts.
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
ti,pindir-d0-out-d1-in = <1>;
spislave@0 { /* Define a SPI device at chip select 0 in slave mode */
compatible = "spislave"; /* Use the generic SPI slave-mode driver */
spi-max-frequency = <32000000>; /* Set max SPI clock speed to 16MHz */
spi-cpha;
reg = <0>; /* Chip select 0 */
spi-slave; /* Enable slave mode */
};
};
&spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
spimaster@0 { /* Define a SPI device at chip select 0 */
compatible = "spidev"; /* Use the generic SPI user-mode driver */
spi-max-frequency = <16000000>; /* Set max SPI clock speed to 16MHz */
spi-cpha;
reg = <0>; /* Chip select 0 */
};
The SPI related kernel configs are:
CONFIG_SPI_OMAP24XX=m
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_SLAVE=y
# modprobe spi_omap2_mcspi # modprobe spidev # lsmod Module Size Used by spidev 20480 0 spi_omap2_mcspi 24576 0 omap_sham 28672 0 omap_aes_driver 24576 0 omap_crypto 16384 1 omap_aes_driver crypto_engine 20480 2 omap_aes_driver,omap_sham omap_wdt 16384 0 rtc_omap 20480 1 wkup_m3_ipc 16384 0 wkup_m3_rproc 16384 1

