Is SPI Working?
#1
Question 
Hello all, thanks for all of the community support.

I have a project that depends on SPI, but i'm not sure SPI is enabled in the Kernel or not. 

I don't see anything related to SPI in the /dev folder.

I'm running the latest downloaded  (xubuntu-xenial-mate-20160528-longsleep-pine64).

If I need to enable this i'm assuming I need to sync up to github but then mod defconfig with spi enabled.

Has anyone else done this? I've never built a custom kernel before.
  Reply
#2
You need to change the device tree to make use of spi to match whatever spi driver / device you want to use.
  Reply
#3
(06-08-2016, 01:49 PM)longsleep Wrote: You need to change the device tree to make use of spi to match whatever spi driver / device you want to use.

It looks like they are enabled 
here -> https://github.com/longsleep/build-pine6...pine64.dts

and here ->https://github.com/longsleep/linux-pine64/blob/pine64-hacks/arch/arm64/configs/sun50iw1p1smp_linux_defconfig

Is there something else I will need to do? Sorry, i'm new to kernels etc.
  Reply
#4
Unfortunately, both SPI0 and SPI1 are currently disabled, see at line 1838 :
https://github.com/longsleep/build-pine6....dts#L1838
Few weeks ago, I've tried to enable them, but unfortunately, they have some thing wrong in their definitions, since as soon they are enabled, the kernel boots and their some crash in vfe and other stuff and end up with root login in serial debug and I could see that ethernet is not working, even doing "ifconfig" completely hangs.
It must be something like wrong clock or wrong interrupts, and this are for both SPI0 and SPI1.
If at least we could get SPI0, that would be nice.
(I still trying to figure out by comparing longsleep kernel with the one starting to appear in mainline)
  Reply
#5
(06-08-2016, 02:51 PM)martinayotte Wrote: Unfortunately, both SPI0 and SPI1 are currently disabled, see at line 1838 :
https://github.com/longsleep/build-pine6....dts#L1838
Few weeks ago, I've tried to enable them, but unfortunately, they have some thing wrong in their definitions, since as soon they are enabled, the kernel boots and their some crash in vfe and other stuff and end up with root login in serial debug and I could see that ethernet is not working, even doing "ifconfig" completely hangs.
It must be something like wrong clock or wrong interrupts, and this are for both SPI0 and SPI1.
If at least we could get SPI0, that would be nice.
(I still trying to figure out by comparing longsleep kernel with the one starting to appear in mainline)

Great, thanks for all of your info on this Martin. If there is anything I can do to help let me know. I believe the PI has SPI enabled/working with a debian jessie build, does the mainline kernel build you are looking into have any other details regarding SPI?

I have another Atmel processor board (AT91SAM3U) that I have drivers/libs etc for, but not sure that helps anything. 


I will be sure to keep updated on the SPI progress as I will need it for a planned project.
  Reply
#6
(06-08-2016, 01:49 PM)longsleep Wrote: You need to change the device tree to make use of spi to match whatever spi driver / device you want to use.

Hi Master longsleep. Do you have any news about the SPI? I have 2 boards stopped waiting for this. My research made me crash the kernel 2 times. I am a really newbie in Linux.

It's sad see the 2 boards stopped and think to buy a Rasp3.

Thanks
  Reply
#7
I don't know if this can help and i don't know how to implement.

http://linux-sunxi.org/SPIdev

I tried to use make menuconfig to enable SPI but it crashes before start.
I updates the .config file manually and make oldconfig but it stopped with a message:

drivers/net/wireless/bcmdhd/Kconfig:50:warning: defaults for choice values not supported
#
# configuration written to .config
#

I don't know what to do. Any light?
  Reply
#8
"drivers/net/wireless/bcmdhd" has nothing to do with SPI, so maybe your .config is broken.

About SPI itself, I didn't have spent much since my last trials back in June. It is on my to-do list.
  Reply
#9
(07-17-2016, 07:38 AM)martinayotte Wrote: "drivers/net/wireless/bcmdhd" has nothing to do with SPI, so maybe your .config is broken.

About SPI itself, I didn't have spent much since my last trials back in June. It is on my to-do list.
Thanks Martin. I saw it is a wireless driver. Big Grin

About the .config, i used the original file on  /usr/src/linux-headers-3.10.102-0-pine64-longsleep. 
I just changed:
CONFIG_SPI_SUN4I=y
CONFIG_SPI_SUN6I=y
CONFIG_SPI_SPIDEV=y

This was already set:
CONFIG_SPI=y
CONFIG_SPI_MASTER=y

This i did not add:
CONFIG_EXPERIMENTAL=y
  Reply
#10
You don't need CONFIG_SPI_SUN4I/CONFIG_SPI_SUN6I, but you need CONFIG_SPI_SUNXI=y

EDIT : BTW, the CONFIG_SPI_SPIDEV can also be done as modules, ie. : CONFIG_SPI_SPIDEV=m





Quote:martinayotte
   Unfortunately, both SPI0 and SPI1 are currently disabled, see at line 1838 :
   https://github.com/longsleep/build-pine6....dts#L1838
   Few weeks ago, I've tried to enable them, but unfortunately, they have some thing wrong in their definitions, since as soon they are enabled, the kernel boots and their some crash in vfe and other stuff and end up with root login in serial debug and I could see that ethernet is not working, even doing "ifconfig" completely hangs.


(quoting myself Tongue )

Ok ! I've spent more time on the case, and I've finally figured out !!! Rolleyes

In the AllWinner specs, the EMAC is mapped at address 0x1c30000 and supposed to use 64K of memory, but in the DTS, the register mapping is mapping 256K, which overlap many other peripherals such as the GPU, the HighSpeed Timer, the DRAM Controller and the SPIs.
When I've enabled with "okay" the SPIs, they were grabbing their respective memory spaces, and then when Networking was turned on, I was getting this message in dmesg :

sunxi-gmac 1c30000.eth: can't request region for resource [mem 0x01c30000-0x01c6ffff]

This gave me the clue !!! why "eth" is trying to map such addresses so big where it is clearly overlaps the SPIs ?

Looking at DTS, and even in the AllWinner original one, we can see :

               eth@01c30000 {
                       compatible = "allwinner,sunxi-gmac";
                       reg = <0x0 0x1c30000 0x0 0x40000 0x0 0x1c00000 0x0 0x30>;

Changing that with the following solve the issue, I've now both networking and SPIs running :

               eth@01c30000 {
                       compatible = "allwinner,sunxi-gmac";
                       reg = <0x0 0x1c30000 0x0 0x10000 0x0 0x1c00000 0x0 0x30>;
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  touch screen not working mike280z 1 4,004 12-22-2016, 12:46 PM
Last Post: Bluphire
  RaZberry Module (z-wave) need support to get it working! Luxus 13 21,064 11-03-2016, 02:04 AM
Last Post: Luxus

Forum Jump:


Users browsing this thread: 3 Guest(s)