spidev: spidev listed directly in DT

cancel
Showing results for 
Search instead for 
Did you mean: 

spidev: spidev listed directly in DT

7,174 Views
BrilliantovKiri
Senior Contributor I

Hello!

I work with custom board on iMX287 CPU and linux-fscl 4.1.3.

Board have slave SPI device, I describe it in dt-file:

ssp2: ssp@80014000 {

    ..................

    dm631@0 {

        reg = <1>;

        compatible = "spidev";

        spi-max-frequency = <10000000>;

    };

};

After booting I found follow message in linux log:

[1.087049] spidev spi1.1: buggy DT: spidev listed directly in DT
[1.093503] ------------[ cut here ]------------
[1.098231] WARNING: CPU: 0 PID: 1 at drivers/spi/spidev.c:730 spidev_probe+0x184/0x1c8()
[1.106572] Modules linked in:
[1.109723] CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.3+ #1
[1.115623] Hardware name: Freescale MXS (Device Tree)

For fix this message I modify spidev_dt_ids in driver/spi/spidev.c and change compatible string in dt-file.

After this boot log is clear, but I think my method is not very correct.

How can solve this problem without modify driver/spi/spidev.c? Now I see one way - write driver for device, may be I have another way?

Thank you and excuse my bad english.

Labels (1)
0 Kudos
4 Replies

3,636 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Kirill

also for spidev example one can look on

imx28-tx28.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos

3,636 Views
timgruijters
Contributor II

For anyone stumbling on this issue:

The error occurs because you have entered "spidev" in your compatible string. The dts should describe specific hardware, and "spidev" isn't sufficient. The warning occurs because the compatible string doesn't exist in the driver its of_device_id struct.

You can solve this in two ways. The correct way is to add a compatible string to spidev_dt_ids after drivers/spi/spidev.c:709, but you'll have to find out which string to use instead of "spidev". This is usually in the format "brand,product". Then use this string as compatible string in your device tree and the warning doesn't occur any more.

The fastest is to add "spidev" to the spidev_dt_ids after drivers/spi/spidev.c:709
{ compatible = "spidev" },

Additional reading:
https://github.com/raspberrypi/linux/issues/1054
spi - Linux, spidev: why it shouldn't be directly in devicetree? - Stack Overflow 

Off topic:
It doesn't matter if your node is called dm631@0, dm631@1 of even dm631@derp since it's only the name of the node. It doesn't have to match your register. However, for debugging purposes, it is comes in handy to do so. I don't remember if it's a naming convention or something, tho.

1,362 Views
SicScar
Contributor II

For me just "spidev" wasn't enough ! i added "brand,spidev" , that did the job! 

 

Thanks for your solution!

0 Kudos

3,636 Views
lategoodbye
Senior Contributor I

Hi Kirill,

the value behind the @ must match the reg value. But i'm not sure if this fixes the problem.

Stefan

0 Kudos