spi device name

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

spi device name

2,201 Views
niklasmolin
Senior Contributor I

Hi.

I'm trying to use 2 ecspi buses.

The problem is that only device name for one bus shows up.

So I think it uses the same name.

If I for instance have:

&ecspi1 {

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

  cs-gpios = <&gpio4 9 0>, <&gpio5 9 0>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi1_2>;

  status = "okay";

        chip1: spidev@0 {

               compatible = "spidev";

               spi-max-frequency = <20000000>;

               reg = <0>;

        };

        chip2: spidev@1 {

               compatible = "spidev";

               spi-max-frequency = <20000000>;

               reg = <1>;

        };

};

&ecspi3 {

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

  cs-gpios = <&gpio4 24 0>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi3_1>;

  status = "okay";

        chip3: spidev@0 {

               compatible = "spidev";

               spi-max-frequency = <20000000>;

               reg = <0>;

        };

};

I will only see spidev32766.0 and spidev32766.1 in the /dev directory

Shouldn't the SPI bus number also be included in the device name?

How do I change the name the device will have in /dev?

Thanks,

Niklas

Labels (2)
0 Kudos
2 Replies

803 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Have you change the spi_board_info spi_device_info struct?

I believe this is the one that has the bus number:

struct spi_board_info {

  char modalias[SPI_NAME_SIZE];

  const void * platform_data;

  void * controller_data;

  int irq;

  u32 max_speed_hz;

  u16 bus_num;

  u16 chip_select;

  u16 mode;

};

Maybe this other discussion helps.

spidev

I hope this helps,

Alejandro

0 Kudos

803 Views
niklasmolin
Senior Contributor I

It seems like they are using a different name scheme now.

My question is, how do I easily check how the spi driver name translates to the specific bus number.

I can't just hard code the spi-driver name in my code, since it might change when I start the kernel.

It seems to be some information in /sys/bus/spi....., but how do I get that information from my code?

Thanks,

Niklas

0 Kudos