How to set gpio for spi?

Not sure on the details of prod-setting. But leave it as it is.
Also i didn’t apply that patch

1 Like

Hi
@b-sathishkumar Thank you for reply.
@DaneLLL @ShaneCCC @kayccc Should I modify pinmux@2430000 device tree hdr40-pin24 nvidia,enable-input value from <0x01> to <0x00>? Because our board is use CS0 to connect TPM.

Hi,
Yes, please enable it and try. I can see it set to ENABLE in

t23x/concord/kernel-dts/tegra234-p3737-0000-p3701-0000-hdr40.dts

hdr40-pin24 {
        nvidia,pins = "spi1_cs0_pz6";
        nvidia,function = "spi1";
        nvidia,pin-label = "spi1_cs0";
        nvidia,tristate = <TEGRA_PIN_DISABLE>;
        nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};

Somehow it is DISABLE in your screenshot. A bit strange here.

Hi, @DaneLLL
Below photo is my original set in my device tree,above photo is my guess , I think the nvidia,enable input have associate with my device tree slb9670 reg <0x00> set.

This set can make TPM work in below device tree:

But I want set TPM in spi0.0 .but it’s only work on spi0.1(reg<0x01>) can’t work when I set on spi0.0(reg<0x00>)

1 Like

Hi,
Is it possible the device is physically connected to B56 pin instead of E55 pin? And please check if CS0 has signal in the loopback test:

  1. Connect MOSI of SPI1 to MISO
  2. Execute $ sudo modprobe spidev
  3. Download/build this test file:
    https://raw.githubusercontent.com/torvalds/linux/v4.9/tools/spi/spidev_test.c
  4. Run the command and check if the result is expected:
$ sudo ./spidev_test -D /dev/spidev0.0 -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 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  | ......@.......................
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  | ......@.......................

or

$ sudo ./spidev_test -D /dev/spidev0.0 -v -p "HelloWorld123456789abcdef"
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  | HelloWorld123456789abcdef
RX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  | HelloWorld123456789abcdef
  1. Check signal of CS0 port while doing step 4.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.