SPI
The expansion pin SPI information for Rockchip platforms is as follows:
| Board | SoC | Platform | Expansion Pins |
|---|---|---|---|
| K1 | RK3568 | Rockchip | SPI X1 |
| K1B | RK3568 | Rockchip | SPI X1 |
| K3 | RK3562 | Rockchip | None |
| K7 | RK3576 | Rockchip | SPI X1 |
| K7C | RK3576 | Rockchip | SPI X1 |
| K8 | RK3588 | Rockchip | SPI X2 |
The expansion pin SPI information for Allwinner platforms is as follows:
| Board | SoC | Platform | Expansion Pins |
|---|---|---|---|
| K2B | H618 | Allwinner | SPI X1 |
| K2C | H618 | Allwinner | SPI X1 |
| K4B | T113-S3 | Allwinner | SPI X1 |
| K5C | A133 | Allwinner | SPI X1 |
DTS Node Configuration
Allwinner
Example DTS node configuration for a dh2228 device on the Allwinner platform's spi0 bus:
spi0: spi@05010000 {
status = "okay";
dh2228@2 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <100000>;
};
};
Rockchip
Example DTS node configuration for a spidev device on the Rockchip platform's spi4 bus:
&spi4 {
pinctrl-names = "default";
pinctrl-0 = <&spi4_cs0n &spi4m2_pins>;
status = "okay";
cs-gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_LOW>;
spidev0: spidev@0 {
compatible = "rockchip,spidev";
status = "okay";
reg = <0>;
spi-max-frequency = <24000000>;
};
};
Hardware Usage Example
- SPI Pins
SPI on K7 is located at pins 8, 10, 12, and 16.

- Hardware Installation
Short-circuit MISO and MOSI for loopback testing.

spidev_test Testing
- Install spidev_test Tool
Download source code: https://github.com/torvalds/linux/blob/master/tools/spi/spidev_test.c
- Compile spidev_test
- List SPI Device Nodes
- Test Specified Device
- Test Output
root@linaro-alip:/# gcc spidev_test.c -o spidev_test
root@linaro-alip:/# chmod +x spidev_test
root@linaro-alip:/# ls /dev/spi*
/dev/spidev4.0
root@linaro-alip:/# ./spidev_test -D /dev/spidev4.0 -v -l -p "hello"
spi mode: 0x20
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | 68 65 6C 6C 6F __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |hello|
RX | 68 65 6C 6C 6F __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |hello|
root@linaro-alip:/#