Thanks Kazumoto.


Please have a review of attached patch. Are you OK with that? If yes, I would like to integrate this into hikey (

-Guodong Xu

Date: Tue, 10 Nov 2015 09:52:13 +0900
Subject: Re: [Dev] SPI on HiKey

Zhong Kaihua wrote:
> Clock_sys 21,which is divided from syspll, is used for both work clock and
> bus clock on hi6220. If you refer to the docs at
> Documentation/devicetree/bindings/spi/, you may find that some other SOCs
> also work like that.

Thanks for your explanations!

> BTW, we are interested in how you test SPI on Hikey board. Can you share
> your test methods and test case to us? We are evaluating if we should
> upsteam our DTSI patch to the mainline branch, and we do not have related
> test environment.

I've heard that the SPI suport is in testing with linaro folks already.
Anyway, here is a step-by-step trial with the tiny patch attatched.
I'm using uefi with the recent edk2 that enables SPI0:

commit 04ba756e8996b1bdcd10ff484779cc95352a8e4a
Author: Haojian Zhuang <haojian.zhuang at>
Date: Fri Oct 9 20:12:11 2015 +0800

Merge pull request #51 from hzhuang1/unreset_spi

HiKeyPkg: unreset SPI0

which is on hikey branch of

[On host:]
git clone
cd linux
git checkout hikey
git branch working-hikey
cat $SOMEWHERE/hikey-spi.patch | patch -p1
cp kernel.conf .config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
#Check spidev support
# Device Drivers->SPI support->[*] User mode SPI device driver support
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
#Install it

#Get latest spidev test, for example
#and send it to the target.
[On target with the new kernel:]
[Confirm that there is f7106000.spi under /sys/devices/smb]
[Compile spidev_test.c]
$gcc -O2 -o spidev_test spidev_test.c

[Target root:]
[Loop test where connecting SDO to SDI on HiKey]
#./spidev_test -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@....�..................�.

[Send two bytes to some device. This is the result from gyroscope of ST LSM9DS0.]
#./spidev_test -D /dev/spidev0.0 -p "\x8f\x00"
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | 00 D4 __ __ __ __ __ __ | .�


_______________________________________________ Dev mailing list