Skip to contentSkip to conversation

spidev instantiated from DT

DISCUSSION Giuseppe Lippolis 2 participants 2 messages Dec 11, 2016 – Dec 12, 2016 SPI

lore
Share & tools
lore
#0 lore raw

Dear All,
in the spidev.c driver there is a check preventing to export the SPI subsystem to the userspace.
The commit message state:

spi: spidev: Warn loudly if instantiated from DT as "spidev"

Since spidev is a detail of how Linux controls a device rather than a description of the hardware in the system we should never have a node described as "spidev" in DT, any SPI device could be a spidev so this is just not a useful description.

In order to help prevent users from writing such device trees generate a warning if spidev is instantiated as a DT node without an ID in the
match
table.

Currently in the spidec.c are registered two devices to use "legally" this driver:

    { .compatible = "rohm,dh2228fv" },
    { .compatible = "lineartechnology,ltc2488" },

I cannot fully understand the rationale.
I have a board mounting an spi device. Currently no dedicated driver for this devices exists.
So in my opinion, now, make sense to describe a device-tree with a "generic" driver, allowing the userspace to control the device. When at the end a dedicated driver will be available an update of the device tree will be possible.

In alternative, make sense to add a dedicated .compatible = "xxx,yyy" statements to attach the spidev driver to the specific device and allowing the DT description as soon as a dedicated driver will be not available?

Can someone clarify me these points?

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Hi Giuseppe,

Quoted 18 lines · Giuseppe Lippolis

in the spidev.c driver there is a check preventing to export the SPI subsystem to the userspace.
The commit message state:

spi: spidev: Warn loudly if instantiated from DT as "spidev"

Since spidev is a detail of how Linux controls a device rather than a description of the hardware in the system we should never have a node described as "spidev" in DT, any SPI device could be a spidev so this is just not a useful description.

In order to help prevent users from writing such device trees generate a warning if spidev is instantiated as a DT node without an ID in the
match
table.

Quoted 8 lines

Currently in the spidec.c are registered two devices to use "legally" this driver:

    { .compatible = "rohm,dh2228fv" },
    { .compatible = "lineartechnology,ltc2488" },

I cannot fully understand the rationale.
I have a board mounting an spi device. Currently no dedicated driver for this devices exists.

But you can still describe the SPI device in DT, right?
Then you can add its compatible value to spidev.c now, until a dedicated driver becomes available.

Quoted 4 lines

So in my opinion, now, make sense to describe a device-tree with a "generic" driver, allowing the userspace to control the device. When at the end a dedicated driver will be available an update of the device tree will be possible.

Hmm... So you would change DT, which describes the hardware, while the actual hardware hasn't changed?

Does that help to understand the rationale?

Quoted 3 lines

In alternative, make sense to add a dedicated .compatible = "xxx,yyy" statements to attach the spidev driver to the specific device and allowing the DT description as soon as a dedicated driver will be not available?

Please add the dedicated compatible statement to spidev.c.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html