Jump to content

Recipe for enabling SPI on Pine64?


esawdust

Recommended Posts

There was a huge thread a year ago about enabling SPI on Pine64, but it seemed to sometimes apply to longsleep generated kernel vs what I would think would be an out-of-the box build for Pine64 using the Armbian configuration.   It wasn't clear to me exactly what needed to be done with today's build configuration, if anything.

 

My ultimate goal is to integrate the IndustrialBerry ENC28J60 dual ethernet port card with Pine64.  http://www.industrialberry.com/ethernetberry-v-1-1/  They have a recipe for RaspPi.  I'm hoping there might be a similar type of recipe geared to the Pine64.

 

Using the Armbian configurator, I insured the SPI bits were enabled (took the default of AllWinner SPI controllers/drivers),    I also enabled the Microchip / ENC28J60 kernel module (did the 'm' build.)  I also enabled spidev

 

I'm unclear about what to do after building it with these things enabled.  I don't see any /dev/spi0 or /dev/spi1 or /sys/class/spi_master/* or spidev/* entries.  It's as though it didn't get enabled even though everything got built fine.    The .ko for ENC28J60 got built and it loads with no error.

 

I had read that uart3 and uart4 needed to be disabled, but I'm unclear about how to do that via the Armbian configuration (menuconfig style) tool.  I didn't do anything to any uart configuration.

 

Has anyone developed a recipe for enabling SPI on Pine64 and would be willing to share it or point me in the right direction?  I'm willing to document such a recipe if I can get the support to get over the humps.

 

Thank you.

Link to comment
Share on other sites

In Armbian Mainline, the SPI is enabled using an overlay. For that you need to add "overlays=spi-spidev" in /boot/armbianEnvt.txt and then reboot.

For longsleep images, I think you need to enable the SPI simply by changing 'status="disalbed"' to 'status="okay"' in its DT.

 

Link to comment
Share on other sites

Hi Martin,

I built an Armbian dev image and made sure the AllWinner SPI drivers were enabled and the Microchip ENC28J60 driver was enabled (as 'm'odule).  I also enabled the 'user mode SPI' which I presume is that which includes the spi-dev bits.

 

My armbianEnv.txt contents are:

 

$ cat armbianEnv.txt 
verbosity=1
overlay_prefix=sun50i-a64
rootdev=UUID=c8042baa-b5cf-4cf8-9c62-ad382253fe06
rootfstype=ext4
overlays=spi-spidev

After booting, I'm not seeing any /dev/spi0 or /dev/spi1 devices nor anything listed under /sys/class/spi_master

 

I also tried an armbianEnv.txt of: 

 

The boot log shows no signs of life of SPI:

$ cat armbianEnv.txt 
verbosity=1
overlay_prefix=sun50i-a64
rootdev=UUID=c8042baa-b5cf-4cf8-9c62-ad382253fe06
rootfstype=ext4
overlays=spi-spidev i2c0 i2c1 spi-add-cs1

I did see /dev/i2c-0 and /dev/i2c-1 show up after that.  But I was expecting something spi related in /dev/ or /sys/class.  
 

$ dmesg | grep -i spi
$ 
$ sudo grep -i spi /var/log/syslog
$ 

I'm running the manline and used the desktop build option (though the desktop doesn't come up, but that's a different topic.)

$ uname -a
Linux pine64 4.11.6-sun50iw1 #21 SMP Fri Jun 23 21:16:31 CEST 2017 aarch64 aarch64 aarch64 GNU/Linux

I found the spidev.ko under /lib/modules/4.11.6-sun50iw1 and could insmod it, but again, no indication anywhere that SPI became activated.

 

What do you suggest for next steps to diagnose the problem?  Should I see entries under /dev/ and/or /sys/class/spi_master/ ?

 

Link to comment
Share on other sites

As per the README.sun50i-a64-overlays if you are enabling spi-spidev you also need to set

param_spidev_spi_bus=0

or

param_spidev_spi_bus=1

depending on which SPI controller you want to activate.

 

For the ENC28J60 you need to make a custom overlay using the bindings documentation for this device: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/devicetree/bindings/net/microchip,enc28j60.txt

You don't need to activate SPIdev because it will conflict with the ENC28J60 since they will be trying to use the same bus and chip select.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines