AnsweredAssumed Answered

Problems interfacing i.MX6 SBC with board through SPI in Linux

Question asked by David Pocock on Aug 13, 2018

am trying to get the TRF7970A-based DLP7970ABP NFC Booster Pack board connected through SPI with a NXP/Freescale i.MX6Quad Cortex A9 SBC, and then to test it with neard.

I have tested adding spidev first to the device tree following this guide and I was able to successfully probe it and create an SPI loopback as the guide suggests. The device tree looked like this:

ecspi1 {
   fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi1>;
   status = "okay";

   spidev0: spi@0 {
      #address-cells = <1>;
      #size-cells = <1>;
      compatible = "spidev";
      reg = <0>;
      spi-max-frequency = <2000000>;
      status = "okay";   
   };
};

 

I then removed spidev node and replaced it with a node for the TRF7970A:

ecspi1 {
   fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi1>;
   status = "okay";

   nfc@0 {
       #address-cells = <1>;
       #size-cells = <1>;
       compatible = "ti,trf7970a";
       reg = <0>;
       spi-max-frequency = <2000000>;
       interrupt-parent = <&gpio2>;
       interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
       ti,enable-gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>;
       vin-supply = <&bperi>;
       autosuspend-delay = <30000>;
       irq-status-read-quirk;
       en2-rf-quirk;
       clock-frequency = <13560000>;
       status = "okay";
   };
};

I get the following messages while the kernel boots up (the following is a result of dmesg | grep spi):

spi_imx 2008000.ecspi: probed
trf7970a spi0.0: No EN2 GPIO property
spi0.0 supply vdd-io not found, using dummy regulator

The message on the second line comes from this line in the trf7970a.c driver file.

I have read the trf7970a.txt guidelines and that is why I omitted an EN2 parameter, as I thought it was optional. vdd-io is also optional.

No spi device is coming up in /dev/ as spidev did, and modprobe trf7970a does not return anything.

The pin description of ecspi1 is the following:

ecspi1 {
   pinctrl_ecspi1: ecspi1 {
     fsl,pins = <
       MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1
       MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
       MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
       MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x100b1
       MX6QDL_PAD_KEY_COL2__GPIO4_IO10 0x100b1
       MX6QDL_PAD_EIM_CS0__GPIO2_IO23 0x100b1
     >;
   };
};

The following are the the pinouts for the SBC and NFC board I'm using:

imx6 sbc spi pinoutDLP-7979ABP pinout

Apart from the obvious ones, I have connected:
SBC pin 5 (SS0) to pin 9 (Slave Select) of the TI board 
SBC pin 6 (SS1) to pin 10 (Enable)
SBC pin 7 (SPI_IRQ) to pin 18 (IRQ (1) default) 

 

I would like to test this device with neard, installed from this recipe, but I reckon something is wrong with the SPI parameters in the device tree node so I don't think I can do much with neard for now.

 

Do you think it's a wiring issue, an SPI node setup issue or some parameters are wrong in the device tree? I am quite lost at this point, any help is appreciated.

Outcomes