How to enable SPI2 on Hikey960 board


#1

Hi,

I am trying to use SPI2 available on LS connector of Hikey960 board to interface with infineon’s TPM2.0 evalkit. For that we modified below changes inside spi2 node of hi3660.dtsi file.

            spi2: spi@ffd68000 {
                    compatible = "arm,pl022", "arm,primecell";
                    reg = <0x0 0xffd68000 0x0 0x1000>;
                    #address-cells = <1>;
                    #size-cells = <0>;
                    interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
                    clocks = <&crg_ctrl HI3660_CLK_GATE_SPI2>;
                    clock-names = "apb_pclk";
                    pinctrl-names = "default";
                    pinctrl-0 = <&spi2_cfg_func>;
                    num-cs = <1>;
                    cs-gpios = <&gpio27 2 0>;
                    status = "okay";
                    //label = "LS-SPI0";

                    spidev0: tpm_tis_spi@0 {
                            compatible = "tcg,tpm_tis_spi";
                            reg = <0>;      /* CE1 */
                            spi-max-frequency = <500000>;
                    };
            };

But could not able to see proper SPI pattern on the connector. On oscilloscope I am seeing unexpected signal pattern. It looks like those connector pins were shared with some other functionality. On kernel’s dmesg I could see failure during spi device probe. I am not able to understand hikey960 pin control configurations or pin mux settings in dts, please let us know if we missed any thing in above configuration.

Thanks in advance.

regards
Vinod


#2

Which OS/version are you using ? I know we had some issues in the past due to missing DMA (https://bugs.96boards.org/show_bug.cgi?id=555). Can you try with a lower frequency (e.g 10MHZ) and see if it changes anything ?

They should be correctly configured, If an other susbsystem/driver would request same pin(s) you should see a pin config error in dmesg. Could you provide link to the dmesg log (pastebin.com)?


#3

Hi Loic,

Thanks for the response.

OS version - Android Oreo ( android-8.1.0_r22 ) with Kernel version 4.9.92.

Regarding spi clock, I believe current configuration is less than 10Mhz. Please find the Dmesg log( https://pastebin.com/VPEJFKKE ), Please note, we have not interfaced TPM2.0 module for this log, also there are some extra debug messages included by us to debug SPI transfer.


#4

Hi,

Its working with default dts settings. Thanks.