GDPR-2 what is the best way to enable SPI?
I'm running the LibreELEC-LePotato.arm-8.90.5 build as-is.
GDPR-2 what is the best way to enable SPI?
I'm running the LibreELEC-LePotato.arm-8.90.5 build as-is.
Is it in hyperion.ng new version?
It is in both hyperion and hyperion.ng if you compile it yourself with the right flags enabled.
The binary is included in the hyperion add-on from the LibreELEC repo in kodi which is what I'm testing against for now.
The only issue with hyperion-aml is it doesn't appear to capture the kodi GUI but I haven't looked into it farther than confirming that it grabs video correctly.
I'll keep experimenting and with some luck might find it.
Worst case I'll write a script to iterate over a range of values and record all nodes from the error messages.
My script iterated over the range 0x00 to 0x7A without finding anything that didn't error out.
It appears &spi_pins doesn't have a phandle to find.
Upon further research I found this explanation on Device Tree Mysteries which clarifies the syntax of using the full path instead of a label but fdt doesn't appear to like it as there is no pinctrl-0 node in /proc/device-tree/spicc upon boot when using it.
kszaq Do you have any ideas on where I should focus next?
I feel very close to a solution but also very far away.
I'll probably try getting up and running on the mainline linux build to see if it works there and possibly illuminates the issue on LibreELEC.
Thanks for any/all feedback, support, ideas...
I'll keep looking at it and would appreciate any ideas y'all might have.
I pulled the dtb from the mainline linux build from LibreTech which has the supposedly functional spi overlay, then replaced the one from kszaq with it and was still able to boot.
I had noticed that /proc/device-tree/spicc/ did not reflect any fdt command with &references so I assume they were erroring out.
By comparing the dts source with the decompiled version I was able to replace the references with real values which are then reflected in /proc/device-tree properly.
I'm very confident in the values for cs-gpios, they are defined here and multiple times in the decompiled version, but much less so for pinctrl-0 because there are no other references to &spi_pins and I had to guess.
fdt set /aliases spi0 /soc/cbus@c1100000/spi@8d80
fdt set /spicc status okay
fdt set /spicc pinctrl-0 <0x65>
fdt set /spicc pinctrl-names default
fdt set /spicc cs-gpios <0x1d 0x59 0x1>
fdt mknode /spicc spidev@0
fdt set /spicc/spidev@0 compatible "linux, spidev"
fdt set /spicc/spidev@0 reg <0>
fdt set /spicc/spidev@0 spi-max-frequency <30000000>
This resulted in the following dmesg output:
[ 0.283014@0] spicc c1108d80.spicc: dma_en=0
[ 0.283043@0] spicc c1108d80.spicc: irq = 0x71
[ 0.283053@0] spicc c1108d80.spicc: delay_control=21
[ 0.283063@0] spicc c1108d80.spicc: enhance=0
[ 0.284688@0] spicc c1108d80.spicc: could not find pctldev for node /i2s_platform, deferring probe
[ 0.284703@0] spicc c1108d80.spicc: get pinctrl fail
[ 0.284713@0] spicc c1108d80.spicc: of error=-517
[ 0.284732@0] platform c1108d80.spicc: Driver spicc requests probe deferral
Trying other values of pinctrl-0 results errors referencing other nodes such as this for 0x49:
...
[ 0.286320@0] spicc c1108d80.spicc: could not find pctldev for node /unifykey/key_4, deferring probe
[ 0.286336@0] spicc c1108d80.spicc: get pinctrl fail
[ 0.286346@0] spicc c1108d80.spicc: of error=-517
[ 0.286364@0] platform c1108d80.spicc: Driver spicc requests probe deferral
The only clue I have for the proper value of &spi_pins is from the compiled source:
__symbols__ {
...
spi_pins = "/soc/periphs@c8834000/pinctrl@4b0/spi";
...
}
...
pinctrl@4b0 {
compatible = "amlogic,meson-gxl-periphs-pinctrl";
#address-cells = <0x2>;
#size-cells = <0x2>;
ranges;
gpio-line-names = "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Eth Link LED", "Eth Activity LED", "HDMI HPD", "HDMI SDA", "HDMI SCL", "HDMI_5V_EN", "9J1 Header Pin2", "Analog Audio Mute", "2J3 Header Pin6", "2J3 Header Pin5", "2J3 Header Pin4", "2J3 Header Pin3", "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk", "eMMC Reset", "eMMC CMD", "ALT BOOT MODE", "", "", "", "eMMC Data Strobe", "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD", "SDCard D3", "SDCard D2", "SDCard Det", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Green LED", "VCCK Enable", "7J1 Header Pin27", "7J1 Header Pin28", "VCCK Regulator", "VDDEE Regulator", "7J1 Header Pin22", "7J1 Header Pin26", "7J1 Header Pin36", "7J1 Header Pin38", "7J1 Header Pin40", "7J1 Header Pin37", "7J1 Header Pin33", "7J1 Header Pin35", "7J1 Header Pin19", "7J1 Header Pin21", "7J1 Header Pin24", "7J1 Header Pin23", "7J1 Header Pin8", "7J1 Header Pin10", "7J1 Header Pin16", "7J1 Header Pin18", "7J1 Header Pin32", "7J1 Header Pin29", "7J1 Header Pin31", "7J1 Header Pin7", "", "7J1 Header Pin15";
linux,phandle = <0x16>;
phandle = <0x16>;
bank@4b0 {
reg = <0x0 0x4b0 0x0 0x28 0x0 0x4e8 0x0 0x14 0x0 0x520 0x0 0x14 0x0 0x430 0x0 0x40>;
reg-names = "mux", "pull", "pull-enable", "gpio";
gpio-controller;
#gpio-cells = <0x2>;
gpio-ranges = <0x16 0x0 0xa 0x65>;
linux,phandle = <0x1d>;
phandle = <0x1d>;
};
...
spi {
linux,phandle = <0x65>;
phandle = <0x65>;
mux {
groups = "spi_miso", "spi_mosi", "spi_sclk";
function = "spi";
};
};
...
}
Display More
I'm pretty sure all that remains is finding the right value for pinctrl-0/&spi_pins.
I'll keep experimenting and with some luck might find it.
Worst case I'll write a script to iterate over a range of values and record all nodes from the error messages.
But the problem remains how to grab the frames. Efforst should go in that direction
I've already tested the hyperion-aml frame grabber and it captures the video output fine.
What you can try is edit boot.ini and add this line right before "bootm prep": fdt set /spicc status okay
This should enable SPICC node and load the driver. Whether it works and how - you tell me.
kszaq Thanks for the info!
I'll give that a shot when I get home.
I've added the following to my boot.ini:
fdt set /spicc status okay
fdt mknode /spicc spidev
fdt set /spicc/spidev compatible linux,spidev
fdt set /spicc/spidev reg <0>
fdt set /spicc/spidev spi-max-frequency <30000000>
Which resulted in the very promising:
# dmesg | grep spi
[ 0.284883@0] spicc c1108d80.spicc: dma_en=0
[ 0.284911@0] spicc c1108d80.spicc: irq = 0x71
[ 0.284921@0] spicc c1108d80.spicc: delay_control=21
[ 0.284931@0] spicc c1108d80.spicc: enhance=0
[ 0.285112@0] spicc c1108d80.spicc: master is unqueued, this is deprecated
[ 0.285227@0] spi spi0.0: chip_select=0 cs_gpio=-2 mode=0 speed=30000000
[ 0.285474@0] spicc c1108d80.spicc: cs_num=1
[ 16.598820@3] spidev spi0.0: chip_select=0 cs_gpio=-2 mode=0 speed=30000000
[ 16.598836@3] spidev spi0.0: chip_select=0 cs_gpio=-2 mode=0 speed=30000000
[ 16.598843@3] spidev spi0.0: chip_select=0 cs_gpio=-2 mode=0 speed=10000000
Display More
However my SPI devices don't seem to be getting any data.
I attempted to translate the rest of the overlay as follows, but I'm less confident about the syntax here:
fdt set /aliases spi0 /soc/cbus@c1100000/spi@8d80
fdt set /spicc pinctrl-0 <&spi_pins>
fdt set /spicc pinctrl-names default
fdt set /spicc cs-gpios <&gpio 89 1>
This didn't change the dmesg output or get my hardware working so not sure it had any effect.
The line about aliases seems especially dodgy.
I'll keep looking at it and would appreciate any ideas y'all might have.
Cheers
straylit Device tree overlays do not work with legacy Amlogic u-boot and kernel as far as I know.
What you can try is edit boot.ini and add this line right before "bootm prep": fdt set /spicc status okay
This should enable SPICC node and load the driver. Whether it works and how - you tell me.
kszaq Thanks for the info!
I'll give that a shot when I get home.
If that doesn't work perhaps I could apply the overlay to your device tree source file by hand before compiling with dtc to create my own dtb.
On that note, is there a file missing from your s905-device-trees repo?
There are references to a gxl_p212_2g.dts but I don't see it in there and can't get gxl_p212_2g_lepotato.dts to compile without it.
Thanks again!
Does anyone know how to enable SPI support on the LePotato?
It is my understanding that the 905x, unlike the 905, does have hardware SPI support so it should be possible.
After splitting dtb.img and converting to dts, I can see that the SPI section is present but disabled.
I found the overlays needed for SPI and spidev on libre computer projects's github.
I'm now looking into how to either enable these overlays or rebuild the device tree blob with them built-in.
If successful this will allow the LePotato to use hyperion, ambilight or boblight with SPI/APA102 devices directly.
Howdy!
I'm running a fresh installation of kszaq's 8.2.2.3 LePotato build and it has been working great so far.
Does anyone know how to enable SPI support on the LePotato?
It is my understanding that the 905x, unlike the 905, does have hardware SPI support so it should be possible.
On a Pi I would add "dtparam=spi=on" to /boot/config.txt but I can't seem to find the equivalent for this board.
Perhaps there's a "setenv ..." for it in /flash/boot.ini?
Or maybe I just need to load the correct module?
I see entries for "SPICC_PINS" in the dtb.img file which gives me hope but there is no corresponding /dev/spidev0.0
If anyone could point me in the right direction I would appreciate it!
Thanks to all and especially thanks to kszaq for this great build.