Need Help Getting SPIDEV to Work on Khadas Edge-V

Which system do you use? Android, Ubuntu, OOWOW or others?

focal - Ubuntu 20.04

Which version of system do you use? Please provide the version of the system here:

Linux Khadas 6.0.0

Please describe your issue below:

I’m currently working on a project with my Khadas Edge-V and I’m trying to get the SPIDEV interface up and running.
I’ve been modifying the dtsi file to enable SPIDEV, but I’m running into some issues and not making much progress.
I’d really appreciate any guidance or pointers from those of you who’ve successfully set up SPIDEV on this board.

What I’ve Done So Far:

Here’s what I’ve done in the dtsi file so far:

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
index 8be9bf378800..afec1ac80b5b 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
@@ -561,7 +561,7 @@ &i2c8 {
 &i2s0 {
        rockchip,playback-channels = <8>;
        rockchip,capture-channels = <8>;
-       status = "okay";
+       status = "disable";
 };
 
+&spi3 {
+       status = "okay";
+       max-freq = <48000000>;
+       spidev@0 {
+               status = "okay";
+               compatible = "rockchip,spidev";
+               spi-max-frequency = <100000000>;
+               reg = <0>;
+       };
+};

I also made sure to activate relevant options in the kernel.

Despite these efforts, I’m still unable to get the SPIDEV to show in /dev/.

Has anyone successfully enabled SPIDEV on the Edge-V?
If so, could you share your approach or let me know if there’s something I’m missing?
Any advice on debugging or additional steps to try would be amazing!

Cheers

1 Like

Hello, I have the same problem. I have not modified the .dtsi files. I only created the “/overlays/edgev” folder and added the spi3.dts file:

/dts-v1/;
/plugin/;

/ {
	fragment@0 {
		target = <&spi3>;
		__overlay__ {
			status = "okay";
		};
	};
};

I found this overlay on the khadas-edge-4.4.y branch of the khadas/linux repo.
A little help from the khadas team would be much appreciated! :sweat_smile:
Have a nice day

index 8be9bf378800..afec1ac80b5b 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
@@ -561,7 +561,7 @@ &i2c8 {
 &i2s0 {
        rockchip,playback-channels = <8>;
        rockchip,capture-channels = <8>;
-       status = "okay";
+       status = "disable";
 };
 
+&spi3 {
+       status = "okay";
+       max-freq = <48000000>;
+       spidev@0 {
+               status = "okay";
+               compatible = "rockchip,spidev";
+               spi-max-frequency = <100000000>;
+               reg = <0>;
+               label = "spidev0";
+       };
+};

That is just a guess since the label is missing. If you can find the mux data make sure that you have spi on that i2c pin group. I don’t have an edge-v board to verify any of this.

I spent all of yesterday trying to verify the mux data and make sure that SPI is correctly set on the I2C pin group, but unfortunately, it still didn’t work.

I double-checked my dtsi modifications and tried various configurations, but no luck so far.

Do you have any other ideas or tips on what else I could try?
Maybe there’s something specific to the Edge-V that I’m missing?

Appreciate any further advice!

1 Like

If you updated the label and it still does not show then its either a kernal module is not loading or the mux is not correct preventing it from loading. If it loads the label will be in /dev. Do you have a link to the dtsi base device tree and amlogic mux information?

Also, if Khadas does not mention that the spi is available it is more than likely not due to the mux. Some of these SoC have very robust config options and others only a couple of options, then hope you don’t have a conflict. If the manual states it will work then it should work.

How are you compiling it and does the dtsi have #includes?