[Solved] Olinuxino A20 and trouble in enabling SPI

Started by Tar, November 09, 2014, 02:51:12 PM

Previous topic - Next topic

Tar

Hi,

i just try to put things together. I`d like to have a kernel with Mali, LCD, Touchscreen support and SPI on UEXT. Full duplex would be nice but is not necessary in the first step.

So in addition to compiling a new kernel like in https://www.olimex.com/forum/index.php?topic=3857.0 i included the sun7i-spi.o module from the topic "Full Duplex SPI" https://www.olimex.com/forum/index.php?topic=3809.0 and added this module and spidev to my kernel statically.

Finally i adopted my script.bin and added the [spi_boardX], [spiX_para] and [spi_devices] sections.

In /sys/class/ i see 2 directories spidev and spi_master, but they are empty. So no devices under dev and, dmesg | grep spi is empty. Where should i look further?

Kind regards,

ingo

Edit: I missed the include of "obj-$(CONFIG_SPI_SUN7I)         += spi-sun7i.o" into the appropriate Makefile

Cosik


Tar

Quote from: Cosik on November 13, 2014, 10:37:45 PM
Hi,

Did you already solved your problem?

Hi Cosik,

unfortunately not. I am not sure, what has to be changed. On the one hand, the module is included statically into the kernel, but i don`t see anything about initialisation. On the other hand, the hardware has been enabled in the fex/script.bin. Could it be a problem of an old bootloader, that does not parse the script.bin correctly? This would be my next investigation.
I also have the possibility to debug anything via serial console, if it helps.

JohnS

I'd look at kernel (driver) issues, not bootloader.

John

Cosik

Hi,

1. Pleas show us what spidev you have in /dev/
2. Show yours fex script.

Tar

Hi,

here the relevant parts of my script.fex

[spi_board0]
modalias = "spidev"
max_speed_hz = 12000000
bus_num = 0
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0

[spi_board1]
modalias = "spidev"
max_speed_hz = 12000000
bus_num = 1
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0

[spi_board2]
modalias = "spidev"
max_speed_hz = 12000000
bus_num = 2
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0
[spi_board3]
modalias = "spidev"
max_speed_hz = 12000000
bus_num = 3
chip_select = 0
mode = 0
full_duplex = 1
manual_cs = 0

[spi0_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PI10<2><default><default><default>
spi_cs1 = port:PI14<2><default><default><default>
spi_sclk = port:PI11<2><default><default><default>
spi_mosi = port:PI12<2><default><default><default>
spi_miso = port:PI13<2><default><default><default>

[spi1_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PI16<3><default><default><default>
spi_sclk = port:PI17<3><default><default><default>
spi_mosi = port:PI18<3><default><default><default>
spi_miso = port:PI19<3><default><default><default>

[spi2_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PC19<3><default><default><default>
spi_sclk = port:PC20<3><default><default><default>
spi_mosi = port:PC21<3><default><default><default>
spi_miso = port:PC22<3><default><default><default>

[spi3_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PA05<3><default><default><default>
spi_cs1 = port:PA09<3><default><default><default>
spi_sclk = port:PA06<3><default><default><default>
spi_mosi = port:PA07<3><default><default><default>
spi_miso = port:PA08<3><default><default><default>

[spi_devices]
spi_dev_num = 4



dmesg | grep spi does not show anything


root@anor:/sys/class# ls -d spi*
spidev/     spi_master/
root@anor:/sys/class# ls -la spi*
spidev:
total 0
drwxr-xr-x  2 root root 0 May 16 00:18 .
drwxr-xr-x 53 root root 0 May 16 00:16 ..

spi_master:
total 0
drwxr-xr-x  2 root root 0 May 16 00:18 .
drwxr-xr-x 53 root root 0 May 16 00:16 ..


Cosik

please also list /dev directory
ls -la /dev/ | grep spi

And show kernel version
uname -a

In my tutorial I've made a mistake, I put wrong git link to kernel.

Please also show lsmod and list of modules of your current kernel.

Tar

ok, here we are:

root@anor:~# ls -la /dev/ | grep spi
root@anor:~#


root@anor:~# zgrep -i spi /proc/config.gz
CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_INLINE_SPIN_TRYLOCK is not set
# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK is not set
# CONFIG_INLINE_SPIN_LOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
CONFIG_UNINLINE_SPIN_UNLOCK=y
# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_REGMAP_SPI=y
CONFIG_SENSORS_LIS3_SPI=m
# CONFIG_SCSI_SPI_ATTRS is not set
CONFIG_LIBERTAS_SPI=m
CONFIG_TOUCHSCREEN_AD7879_SPI=m
CONFIG_TOUCHSCREEN_CYTTSP_SPI=m
CONFIG_INPUT_AD714X_SPI=m
CONFIG_INPUT_ADXL34X_SPI=m
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y
# SPI Master Controller Drivers
# CONFIG_SPI_ALTERA is not set
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_BUTTERFLY is not set
# CONFIG_SPI_GPIO is not set
# CONFIG_SPI_LM70_LLP is not set
# CONFIG_SPI_OC_TINY is not set
# CONFIG_SPI_PL022 is not set
# CONFIG_SPI_PXA2XX_PCI is not set
CONFIG_SPI_SUN7I=y
CONFIG_SUN7I_SPI_NDMA=y
# CONFIG_SPI_XILINX is not set
# CONFIG_SPI_DESIGNWARE is not set
# SPI Protocol Masters
CONFIG_SPI_SPIDEV=y
# CONFIG_SPI_TLE62X0 is not set
# SPI GPIO expanders:
# CONFIG_MFD_TPS65912_SPI is not set
# CONFIG_MFD_DA9052_SPI is not set
# CONFIG_MFD_WM831X_SPI is not set
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# SPI RTC drivers
# CONFIG_AD5624R_SPI is not set
# Hardware Spinlock drivers
# CONFIG_DEBUG_SPINLOCK is not set


root@anor:~# lsmod
Module                  Size  Used by
disp_ump                1037  0
mali_drm                3160  1
drm                   228218  2 mali_drm
mali                  142674  0
cpufreq_powersave       1377  0
cpufreq_conservative     6706  0
cpufreq_stats           6419  0
cpufreq_userspace       3578  0
nfsd                   96610  0
exportfs                3844  1 nfsd
sunxi_cedar_mod        10579  0
ump                    55044  4 mali,disp_ump
lcd                     4206  0
root@anor:~# uname -a
Linux anor 3.4.103+ #3 SMP PREEMPT Sun Nov 9 10:46:21 CET 2014 armv7l GNU/Linux
root@anor:~#

could my LCD-OLinuXino-4.3TS (4.3" LCD with Touchscreen) be a problem?
If it helps, i also may compile CONFIG_SPI_DEBUG into the kernel, but as far as i see the code, it only would add additional info. Main parts, like initialisation should print something either. But i`ll give it a try

Cosik

Hi,

Ok, please try to recompile kernel with enable DEBUG. Here is my SPI kernel config.
CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_INLINE_SPIN_TRYLOCK is not set
# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK is not set
# CONFIG_INLINE_SPIN_LOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
CONFIG_UNINLINE_SPIN_UNLOCK=y
# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_REGMAP_SPI=y
CONFIG_SENSORS_LIS3_SPI=m
# CONFIG_SCSI_SPI_ATTRS is not set
CONFIG_LIBERTAS_SPI=m
CONFIG_P54_SPI=m
CONFIG_P54_SPI_DEFAULT_EEPROM=y
CONFIG_WL1251_SPI=m
CONFIG_WL12XX_SPI=m
CONFIG_TOUCHSCREEN_AD7879_SPI=m
CONFIG_TOUCHSCREEN_CYTTSP_SPI=m
CONFIG_INPUT_AD714X_SPI=m
CONFIG_INPUT_ADXL34X_SPI=m
CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_MASTER=y
# SPI Master Controller Drivers
# CONFIG_SPI_ALTERA is not set
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_BUTTERFLY is not set
# CONFIG_SPI_GPIO is not set
# CONFIG_SPI_LM70_LLP is not set
# CONFIG_SPI_OC_TINY is not set
# CONFIG_SPI_PL022 is not set
# CONFIG_SPI_PXA2XX_PCI is not set
CONFIG_SPI_SUN7I=y
CONFIG_SUN7I_SPI_NDMA=y
# CONFIG_SPI_XILINX is not set
# CONFIG_SPI_DESIGNWARE is not set
# SPI Protocol Masters
CONFIG_SPI_SPIDEV=y
# CONFIG_SPI_TLE62X0 is not set
# SPI GPIO expanders:
# CONFIG_MFD_TPS65912_SPI is not set
# CONFIG_MFD_DA9052_SPI is not set
# CONFIG_MFD_WM831X_SPI is not set
CONFIG_SND_SPI=y
CONFIG_SND_SOC_I2C_AND_SPI=y
# SPI RTC drivers
# CONFIG_AD5624R_SPI is not set
# Hardware Spinlock drivers
# CONFIG_DEBUG_SPINLOCK is not set


Also please try to unplug each spi devices from yous board and then run it and check spi.

Tar

Hi Cosik,

i have to apologise, somehow the include into the Makefile got lost, so the code was compiled but not included. I just got my devices!

Many thanks :-)

Cosik


AnkyB

Hi,

I am also trying to use SPI on my A20Lime2-4gb( with latest debian8 jessie image). But having trouble to get it working. I think there is issue related to spi drivers but don't know how to resolve it. There is no file like spidevx.x is available in /dev directory. Under sys/bus/spi I see 2 directories drivers and devices, both are empty and /sys/class contains only spi_master directory, that too empty. I have enabled both spi ports in script.fex. my kernel version is Linux A20-OlinuXino 3.4.103-00033-g9alcd03-dirty SMP PREEMPT wed Oct 12 16:41:17 EEST 2016 armv71 GNU/Linux.
can you help me, how can I solve this?