How to enable SPI on HiKey 960

Hi, after cloned the lastest android linux source and build, there is no spi node in /dev directory, dmesg shows:

[    1.710853] ssp-pl022 ffd68000.spi: could not find pctldev for node /soc/pinmux@fff11000/spi2_pmx_func, deferring probe
[    1.710881] ssp-pl022 ff3b3000.spi: could not find pctldev for node /soc/pinmux@ff3b6000/spi3_pmx_func, deferring probe

The path “/soc/pinmux@fff11000/spi2_pmx_func” I can find in Hikey960-pinctrl.dtsi.

  • I didn’t do any change with the code

Thanks for help.

Hi @jinfeng,

This means, SPI driver tried to access pinctrl handles before the pinctrl subsystem gets registered. This should be of no problem since the deferred driver probe will be triggered later during boot process.

Since you said that you haven’t done any modification to the source, can you please share the location of AOSP source from where you have cloned?

Thanks,
Mani

Thanks for your reply, the code location is:

https://android.googlesource.com/kernel/hikey-linaro

I searched almost every post about this, it is strange, there exist some difference with others’ source maybe ?

@jinfeng, sorry I forgot to ask the branch also! Which branch are you using?

Hi, I use this branch:

git checkout -b android-hikey-linaro-4.9 origin/android-hikey-linaro-4.9

And follow the guide:

https://source.android.com/setup/build/devices#960kernel

Did you add: overlay_mgr.overlay_dt_entry=hardware_cfg_spidev0 to your boot argument?

Forgive me, as I don’t have any SPI devices, so I don’t have much experience here.

@jstultz
after adding that I can now see:

console:/ # ls /dev | grep spi
spidev32766.0

and

console:/ # ls /sys/bus/spi/devices/                                           
spi32766.0
console:/ # ls /sys/bus/spi/devices/spi32766.0/                                
driver/      of_node/     spidev/      subsystem/
modalias     power/       statistics/  uevent

Assuming this means spi is now available, why don’t we have this added to AOSP source?

@ric96

SPIDEV is an (optional) kernel driver used to provide userspace interface to SPI subsystem. So this won’t be enabled by default! Either you have to populate the SPI node in devicetree or just apply the relevant devicetree overlay.

Hope this makes clear!

Thanks,
Mani

Hi all,

I’ve tried to overlay dt for spidev0 in device/linaro/hikey/hikey960/BoardConfig.mk by adding next line:

BOARD_KERNEL_CMDLINE += overlay_mgr.overlay_dt_entry=hardware_cfg_spidev0

But after that my hikey960 can’t boot normally, it tries (I see leds blinking) and after that goes to fastboot.

Any ideas why it happens?

Thanks in advance!