Not able to create a spi device in Android 12.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to create a spi device in Android 12.1

Jump to solution
824 Views
dgeier315
Contributor III

We are migrating from Android 12.0 to 12.1.   The Android 12.0 build was modified to use spi-imx.c from AN13633 (Using Enhanced Configurable SPI (ECSPI) as Slave in Linux for i.MX 8M
Series).   When migrating to 12.1, the probe of the driver returns an error code of -22. 

[ 0.399225] spi_imx 30820000.spi: bitbang start failed with -22

[ 0.399241] spi_imx: probe of 30820000.spi failed with error -22

When I changed out the spi-imx.c from 12.1 for the one from AN13633, The probe appears to work, but now spi_busnum_to_master() fails.

[   88.391582] spiCtrl_init: MASTER not found

I don't see what has changed from Android 12.0 to 12.1.   Any insights would be appreciated.

#define MASTER_BUS_NUM 0

   //Register information about your device:

   struct spi_board_info spi_device_info = {

       .modalias = "PECL-master-command-port",

       .max_speed_hz = 13000000, //speed your device (slave) can handle

       .bus_num = MASTER_BUS_NUM,

       .chip_select = 0,

       .mode = 0,

   };

  

   pr_debug("%s: Start\n", __func__);

    /* To send data we have to know what spi port/pins should be used. This information

    * can be found in the device-tree. */

   master = spi_busnum_to_master( spi_device_info.bus_num );

   if ( !master ) {

       pr_err("%s: MASTER not found\n", __func__);

       return -ENODEV;

   }

Device Tree:

&ecspi1 {

    #address-cells = <1>;

    #size-cells = <0>;

    fsl,spi-num-chipselects = <1>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_ecspi1>;

    //cs-gpios = GP_ECSPI1_CS;

    status = "okay";

};

 

0 Kudos
Reply
1 Solution
784 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

The real bus number may change, you can try other value.

Or you can dump the real bus index when probe.

View solution in original post

0 Kudos
Reply
2 Replies
785 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

The real bus number may change, you can try other value.

Or you can dump the real bus index when probe.

0 Kudos
Reply
757 Views
dgeier315
Contributor III
The bus numbers have been fixed for many versions of Android. What causes the bus number to change?
0 Kudos
Reply