-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Activating/using SPI on SOQuartz #32
Comments
Okay, first we need to enable the SPI bus and add a "dummy" device on chip select 0. This is SPI3, so we need the following overlay, which you can save as
Install Then, copy the resulting This only enabled the bus for us with a dummy device that won't bind a driver, not yet the spidev character device. The spidev character device is enabled by binding the spidev driver to our dummy device, which we will do now. We should now have a
Tada, you should now have a Please note that if the particular SPI device you're trying to interface with already has a kernel driver, you should use that instead, and not some python jank that bashes around spidevs. Let me know if this works for you. |
Working on it! The echo is working to create the spidev. Stuck now on the chip select. |
I came across this issue online. Having similar problems. It is not clear to me from the rk36xx.dtsi file if both chip select pins are activated when you change &spi3 status to "okay". I thought that if I use the following, it would activate cs1.
If I do that I correctly get the following:
But if I then check in this directory (/sys/bus/spi/devices) nothing shows up, where if I use reg=<0> I get something for spi3.0:
For /sys/bus/platform/drivers/rockchip-spi, we get for both cases (attempting 3.1. and 3.0):
|
Problem solved... you need to add this:
as in:
Now can see: Then applying the binding (echo commands) we get - note here I changed overlay to include both cs pins:
|
@CounterPillow, I have a question for you about creating and then using your own SPI driver. The above only explains how to link SPIDEV. Creating the overlay is fairly straightforward but then I am stuck on the rest. E.g.
Now from your above comments I can now "bind" spidev to spi 3 using the echo command and this then shows up in /dev/ However, I do not know how to get my qca7000 showing up in my /dev/ folder as well. I assume I will first need to create a kernel driver module, but then what. Any guidance is greatly appreciated. Thanks |
@Gerriko compatible should be |
@CounterPillow thanks for feedback. I'm still figuring out the basics, so I could well be heading up the wrong path here, but my aim was to create a network device driver module and then load using something like modprobe (or insmod). However, when trying to install the kernel 6.1x header files to "make" my dummy test device driver, my Pine board with Plebian could not find them (when using apt-get install). So where would I get these? Otherwise, are you suggesting that it's better to build a kernel with those parameters enabled. If so, which build routine are you using (Armbian?). Anyway, this touches on another unrelated point. If I need to downgrade the kernel to version 4.4, what would be the Plebian build process? |
That would be redundant as a driver for this already exists.
Please do not use anything by Armbian. We can do things properly using mainline sources.
If everything works, file a bug against Debian's kernel package asking them to turn on the option for you. That way you'll no longer have to build your own kernels, and everyone gets to enjoy the support for this hardware turned on.
4.4 is literally older than this hardware so that won't work. |
Would something like Buildroot not be easier to with work here... although upon checking I see the SOQuartz is not listed in the Buildroot configs folder - only pine64_defconfig and pine64_sopine_defconfig are available. So maybe not, but thought there is no harm in checking. Otherwise when I try and use Hence, I keep going back to this idea of simply copying the QCA7000 .c & .h source code (as commonly available) and then amending the Makefile to compile the .ko file for me (the part I am struggling with). But if you say the kernel option is best bet, I will persevere with the kernel config and rebuild process. |
I decided to at least give it a dry run through. When following step 3 (with olddefconfig) on my x86 laptop it returned the message So, it seems I have misunderstood step 2, in that I could not figure out where to place the board's As I couldn't find any documentation online to give direction, I am now wondering where to place the old config file and whether I need to also rename. |
Place your old config file into a file named |
@CounterPillow had a few hiccups along the way with missing packages on laptop (and not enough disk space) but after installing (and cleaning up space) it all worked fine and I now have the qcaspi as a kernel module on the Pine SOQuartz. Thank you for your assistance. It is very much appreciated. |
Not too far from SPI, would GPIO pins be working out of the box? Anybody knows the physical pins for Cluster6C? |
GPIO is actually far from SPI, but yes they work out of the box. Use libgpiod to address them. You'll just need to translate the |
@adminy I wrote some documentation for GPIO here https://plebian.org/running/gpio/ But as I said, this has little to do with SPI. However I intend to close this issue once I have a similar level of documentation for SPI. |
Nice clear GPIO documentation, BTW 👍
…On Fri 12 May 2023, 06:24 Nicolas F., ***@***.***> wrote:
@adminy <https://github.com/adminy> I wrote some documentation for GPIO
here https://plebian.org/running/gpio/
But as I said, this has little to do with SPI.
However I intend to close this issue once I have a similar level of
documentation for SPI.
—
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC23YAX3RHI4UYJDOZVSXFTXFXCRJANCNFSM6AAAAAAWQJ67RU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Just realized I should probably be commenting/asking here
Discussion was here. https://www.reddit.com/r/PINE64official/comments/122qcyv/comment/jenpkh2/?utm_source=share&utm_medium=web2x&context=3
Argh. Confusion reigns.
The devices I'd like to use are "normal" devices and don't seem to need or have fancy drivers in other hardware like Pis. (Or where there's a standard Qualcomm driver).
And when I look in the Linux kernel, I see things like this.
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts
Which shows the board for the SOQuartz, but with SPI "disabled". If I set that to "okay" then i still don't see any SPI devices in /dev (which is what I naively expect).
And there's https://github.com/torvalds/linux/blob/master/drivers/spi/spi-rockchip.c, which seems to be the SPI config for the underlying chip.
And this, https://github.com/torvalds/linux/blob/master/drivers/spi/spidev.c , which is the definition of spidev which (again naively) I expected to use with the generic devices I'm aiming to use. spiidev might be hacky, but many code examples use it.
So I'm not sure what i need to add...what I'd put in a device tree overlay. I just want to get a Pine64 SOQuartz running SPI in the same (simple) way that a Pi CM4 does.
If there's something I can do to help support this, I would be happy to. But now I'm just confused.
With Plebian, it seems like a great start to be able to use SOQuartz in a fairly normal way as if it was a Pi CM4. But with SPI I'm stuck.
H
The text was updated successfully, but these errors were encountered: