No SPIDEV device on Allwinner H3

This forum is for topics dealing with problems with software specifically in the ARMv7h repo.

No SPIDEV device on Allwinner H3

Postby vinibali » Sun Jun 20, 2021 7:10 am

Hi!
The modified DTS has been recompiled to enable both the SPI GPIOs, and the status is okay in the /sys/firmware, but none of the port became available on the dev path. Any ideas?
$this->bbcode_second_pass_code('', '
$ lsmod | grep spi
spidev 20480 0
spi_sun6i 16384 0
$ cat /sys/firmware/devicetree/base/soc/spi@1c6*/status
okayokay
$ ls /dev/s
shm/ snapshot snd/ stderr stdin stdout
')
vinibali
 
Posts: 14
Joined: Wed Oct 23, 2019 1:45 pm

Re: No SPIDEV device on Allwinner H3

Postby vinibali » Tue Jun 29, 2021 5:45 am

Really strange, I have an MTD device in place...
Can somebody explain this to me?
Why this is not shown as an spidev device?
$this->bbcode_second_pass_code('', '
$ sudo mtdinfo
Count of MTD devices: 1
Present MTD devices: mtd0
Sysfs interface supported: yes
$ cat /proc/mtd
dev: size erasesize name
mtd0: 01000000 00001000 "spi0.0"
')
vinibali
 
Posts: 14
Joined: Wed Oct 23, 2019 1:45 pm

Re: No SPIDEV device on Allwinner H3

Postby vinibali » Tue Jun 29, 2021 5:50 am

Some relevant lines on the DMESG
$this->bbcode_second_pass_code('', '
[ 12.050247] spi-nor spi0.0: found w25q128, expected mx25l1606e
[ 12.056322] spi-nor spi0.0: w25q128 (16384 Kbytes)
[ 12.116514] sun6i-spi 1c68000.spi: chipselect 0 already in use
[ 12.156833] spi_master spi0: spi_device register error /soc/spi@1c68000/spidev@0
[ 12.180088] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/spidev@0
')
vinibali
 
Posts: 14
Joined: Wed Oct 23, 2019 1:45 pm

Re: No SPIDEV device on Allwinner H3

Postby vinibali » Tue Jul 20, 2021 8:20 pm

Just to note, it's clear now, the flash entry is for the mtd device, apart from the the spidev is responsible for the spidev. Pretty obvious, but I paste the edited dtsi file, which I used for the zero.
Long story sort, spi devices needs to be enabled (status from disabled to okay), and spidev subdevice must be defined, using both spidev and flash for the same device is not recommended. Make the diff on your own, I think it's not so visible if I just paste the diff output here.

Original DTB file:
$this->bbcode_second_pass_code('', '
spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x1c68000 0x1000>;
interrupts = <0x00 0x41 0x04>;
clocks = <0x03 0x1e 0x03 0x52>;
clock-names = "ahb\0mod";
dmas = <0x14 0x17 0x14 0x17>;
dma-names = "rx\0tx";
pinctrl-names = "default";
pinctrl-0 = <0x15>;
resets = <0x03 0x0f>;
status = "disabled";
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x50>;

flash@0 {
#address-cells = <0x01>;
#size-cells = <0x01>;
compatible = "mxicy,mx25l1606e\0winbond,w25q128";
reg = <0x00>;
spi-max-frequency = <0x2625a00>;
};
};

spi@1c69000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x1c69000 0x1000>;
interrupts = <0x00 0x42 0x04>;
clocks = <0x03 0x1f 0x03 0x53>;
clock-names = "ahb\0mod";
dmas = <0x14 0x18 0x14 0x18>;
dma-names = "rx\0tx";
pinctrl-names = "default";
pinctrl-0 = <0x16>;
resets = <0x03 0x10>;
status = "disabled";
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x51>;
};
')

Edited DTB file:
$this->bbcode_second_pass_code('', '
spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x1c68000 0x1000>;
interrupts = <0x00 0x41 0x04>;
clocks = <0x03 0x1e 0x03 0x52>;
clock-names = "ahb\0mod";
dmas = <0x14 0x17 0x14 0x17>;
dma-names = "rx\0tx";
pinctrl-names = "default";
pinctrl-0 = <0x15>;
resets = <0x03 0x0f>;
status = "okay";
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x50>;

spidev@0 {
spi-max-frequency = <0xf4240>;
reg = <0x00>;
status = "okay";
compatible = "spidev";
};

flash@0 {
#address-cells = <0x01>;
#size-cells = <0x01>;
compatible = "mxicy,mx25l1606e\0winbond,w25q128";
reg = <0x00>;
spi-max-frequency = <0x2625a00>;
};
};

spi@1c69000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x1c69000 0x1000>;
interrupts = <0x00 0x42 0x04>;
clocks = <0x03 0x1f 0x03 0x53>;
clock-names = "ahb\0mod";
dmas = <0x14 0x18 0x14 0x18>;
dma-names = "rx\0tx";
pinctrl-names = "default";
pinctrl-0 = <0x16>;
resets = <0x03 0x10>;
status = "okay";
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x51>;

spidev@0 {
spi-max-frequency = <0xf4240>;
reg = <0x00>;
status = "okay";
compatible = "spidev";
};
};
')
vinibali
 
Posts: 14
Joined: Wed Oct 23, 2019 1:45 pm

Re: No SPIDEV device on Allwinner H3

Postby vinibali » Tue Jul 20, 2021 8:21 pm

Side by side diff:
$this->bbcode_second_pass_code('', '

spi@1c68000 { spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi" compatible = "allwinner,sun8i-h3-spi"
reg = <0x1c68000 0x1000>; reg = <0x1c68000 0x1000>;
interrupts = <0x00 0x41 0x04>; interrupts = <0x00 0x41 0x04>;
clocks = <0x03 0x1e 0x03 0x52>; clocks = <0x03 0x1e 0x03 0x52>;
clock-names = "ahb\0mod"; clock-names = "ahb\0mod";
dmas = <0x14 0x17 0x14 0x17>; dmas = <0x14 0x17 0x14 0x17>;
dma-names = "rx\0tx"; dma-names = "rx\0tx";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <0x15>; pinctrl-0 = <0x15>;
resets = <0x03 0x0f>; resets = <0x03 0x0f>;
status = "okay"; | status = "disabled";
#address-cells = <0x01>; #address-cells = <0x01>;
#size-cells = <0x00>; #size-cells = <0x00>;
phandle = <0x50>; phandle = <0x50>;

spidev@0 { <
spi-max-frequency = <0xf4240> <
reg = <0x00>; <
status = "okay"; <
compatible = "spidev"; <
}; <
<
flash@0 { flash@0 {
#address-cells = <0x01>; #address-cells = <0x01>;
#size-cells = <0x01>; #size-cells = <0x01>;
compatible = "mxicy,mx25l1606 compatible = "mxicy,mx25l1606
reg = <0x00>; reg = <0x00>;
spi-max-frequency = <0x2625a0 spi-max-frequency = <0x2625a0
}; };
}; };

spi@1c69000 { spi@1c69000 {
compatible = "allwinner,sun8i-h3-spi" compatible = "allwinner,sun8i-h3-spi"
reg = <0x1c69000 0x1000>; reg = <0x1c69000 0x1000>;
interrupts = <0x00 0x42 0x04>; interrupts = <0x00 0x42 0x04>;
clocks = <0x03 0x1f 0x03 0x53>; clocks = <0x03 0x1f 0x03 0x53>;
clock-names = "ahb\0mod"; clock-names = "ahb\0mod";
dmas = <0x14 0x18 0x14 0x18>; dmas = <0x14 0x18 0x14 0x18>;
dma-names = "rx\0tx"; dma-names = "rx\0tx";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <0x16>; pinctrl-0 = <0x16>;
resets = <0x03 0x10>; resets = <0x03 0x10>;
status = "okay"; | status = "disabled";
#address-cells = <0x01>; #address-cells = <0x01>;
#size-cells = <0x00>; #size-cells = <0x00>;
phandle = <0x51>; phandle = <0x51>;
<
spidev@0 { <
spi-max-frequency = <0xf4240> <
reg = <0x00>; <
status = "okay"; <
compatible = "spidev"; <
}; <
};

')
vinibali
 
Posts: 14
Joined: Wed Oct 23, 2019 1:45 pm


Return to ARMv7h

Who is online

Users browsing this forum: No registered users and 3 guests