SPI on A10 Lime

Started by jerry, January 29, 2014, 05:17:45 PM

Previous topic - Next topic

jerry

Looking at the default configuration for the Linux kernel, I see that it doesn't generate SPI support.  Is there a reason for this?

TIA.

samuele

I'm intrested in SPI support too... looking at the a10-olinuxino-lime.fex seems that SPI si not enabled.. maybe we have to edit this file and rebuild the BSP...

Lurch

There was a notice (maybe on the A20 forum) that the Allwinner SPI code was broken.
You can try, but don't be disappointed if it doesn't work yet.

samuele

Hi Lurch,
perhaps you were referring to this post https://www.olimex.com/forum/index.php?topic=1773.msg9476#msg9476.
The SoC on the OLinuXino-Lime is an A10 (aka sun4i), so, referring to the previous link, it seems that for sun4i the linux-sunxi SPI driver should work... but it seems strange to me that Olimex didn't enable any SPI port by default on such board... needs some further investigations...

fiosca

Interested to have it working too!
If somebody has time to spend investigating if SPI driver works... please post results!


fjnxg4fe

#5
One step further!  :)

Try this kernel config:

CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_SUN4I=y
CONFIG_SPI_SPIDEV=y


Try this fex config:

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

[spi1_para]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PA00<4><default><default><default>
spi_sclk = port:PA01<4><default><default><default>
spi_mosi = port:PA02<4><default><default><default>
spi_miso = port:PA03<4><default><default><default>

[spi2_para]
spi_used = 1
spi_cs_bitmap = 1
#spi_cs0 = port:PB14<2><default><default><default>
#spi_sclk = port:PB15<2><default><default><default>
#spi_mosi = port:PB16<2><default><default><default>
#spi_miso = port:PB17<2><default><default><default>
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 = 0
spi_cs_bitmap = 1
spi_cs0 = port:PA05<3><default><default><default>
spi_sclk = port:PI06<3><default><default><default>
spi_mosi = port:PI07<3><default><default><default>
spi_miso = port:PI08<3><default><default><default>
spi_cs1 = port:PA09<3><default><default><default>

[spi_devices]
spi_dev_num = 1

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


I got this result:

root@a10Lime:~# dmesg|grep spi
[    1.313213] [spi]: sw spi init !!
[    1.320359] [spi]: Found 1 spi devices in config files
[    1.331770] [spi]: boards num modalias         max_spd_hz       bus_num  cs   mode
[    1.342571] [spi]: spi_board0 irq gpio not used
[    1.353519] [spi]: 0          spidev           12000000         2        0    0x0   
[    1.364404] [spi]: bus num = 2, spi used = 1
[    1.374596] [spi]: source = sdram_pll_p, src_clk = 480000000, mclk 96000000
[    1.387413] sun4i-spi sun4i-spi.2: master is unqueued, this is deprecated
[    1.400984] [spi]: allwinners SoC SPI Driver loaded for Bus SPI-2 with 2 Slaves attached
[    1.416894] [spi]: [spi-2]: driver probe succeed, base f1c17000, irq 12, dma_tx_id 40, dma_rx_id 41!


Time for testing...  8)

8) And the device /dev/spidev2.0 is found.