[PATCH 2/5] drivers: spi: spidev: add compatible for arduino spi mcu interface

Riccardo Mereu posted 5 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 2/5] drivers: spi: spidev: add compatible for arduino spi mcu interface
Posted by Riccardo Mereu 1 month, 1 week ago
Add compatible entry in spidev describing in Arduino boards one of the
interfaces between microprocessor and  microcontroller.

Signed-off-by: Riccardo Mereu <r.mereu@arduino.cc>
---
 drivers/spi/spidev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 5300c942a2a4..f0dd516c2083 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -704,6 +704,7 @@ static const struct class spidev_class = {
  */
 static const struct spi_device_id spidev_spi_ids[] = {
 	{ .name = /* abb */ "spi-sensor" },
+	{ .name = /* arduino */ "mcu" },
 	{ .name = /* cisco */ "spi-petra" },
 	{ .name = /* dh */ "dhcom-board" },
 	{ .name = /* elgin */ "jg10309-01" },
@@ -737,6 +738,7 @@ static int spidev_of_check(struct device *dev)
 
 static const struct of_device_id spidev_dt_ids[] = {
 	{ .compatible = "abb,spi-sensor", .data = &spidev_of_check },
+	{ .compatible = "arduino,mcu", .data = &spidev_of_check },
 	{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
 	{ .compatible = "dh,dhcom-board", .data = &spidev_of_check },
 	{ .compatible = "elgin,jg10309-01", .data = &spidev_of_check },
-- 
2.51.2
Re: [PATCH 2/5] drivers: spi: spidev: add compatible for arduino spi mcu interface
Posted by Krzysztof Kozlowski 1 month, 1 week ago
On 06/11/2025 16:31, Riccardo Mereu wrote:
> Add compatible entry in spidev describing in Arduino boards one of the
> interfaces between microprocessor and  microcontroller.
> 
> Signed-off-by: Riccardo Mereu <r.mereu@arduino.cc>


Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

It is almost never "drivers" (with one or two exceptions).

> ---
>  drivers/spi/spidev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> index 5300c942a2a4..f0dd516c2083 100644
> --- a/drivers/spi/spidev.c
> +++ b/drivers/spi/spidev.c
> @@ -704,6 +704,7 @@ static const struct class spidev_class = {
>   */
>  static const struct spi_device_id spidev_spi_ids[] = {
>  	{ .name = /* abb */ "spi-sensor" },
> +	{ .name = /* arduino */ "mcu" },
>  	{ .name = /* cisco */ "spi-petra" },
>  	{ .name = /* dh */ "dhcom-board" },
>  	{ .name = /* elgin */ "jg10309-01" },
> @@ -737,6 +738,7 @@ static int spidev_of_check(struct device *dev)
>  
>  static const struct of_device_id spidev_dt_ids[] = {
>  	{ .compatible = "abb,spi-sensor", .data = &spidev_of_check },
> +	{ .compatible = "arduino,mcu", .data = &spidev_of_check },

That's way too generic, IMO. First, I am not aware of Arduino boards
mounted on top of regular development boards, so basically you are not
describing actual hardware setup but what could be potentially plugged
into box with Linux... and then it is like saying "you can plug
anything" because MCU covers everything, like calling it "Raspberry
Pi-clone".

Best regards,
Krzysztof
Re: [PATCH 2/5] drivers: spi: spidev: add compatible for arduino spi mcu interface
Posted by Riccardo Mereu Linux Kernel 1 month, 1 week ago
On Fri, Nov 7, 2025 at 8:13 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> > ---
> >  drivers/spi/spidev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> > index 5300c942a2a4..f0dd516c2083 100644
> > --- a/drivers/spi/spidev.c
> > +++ b/drivers/spi/spidev.c
> > @@ -704,6 +704,7 @@ static const struct class spidev_class = {
> >   */
> >  static const struct spi_device_id spidev_spi_ids[] = {
> >       { .name = /* abb */ "spi-sensor" },
> > +     { .name = /* arduino */ "mcu" },
> >       { .name = /* cisco */ "spi-petra" },
> >       { .name = /* dh */ "dhcom-board" },
> >       { .name = /* elgin */ "jg10309-01" },
> > @@ -737,6 +738,7 @@ static int spidev_of_check(struct device *dev)
> >
> >  static const struct of_device_id spidev_dt_ids[] = {
> >       { .compatible = "abb,spi-sensor", .data = &spidev_of_check },
> > +     { .compatible = "arduino,mcu", .data = &spidev_of_check },
>
> That's way too generic, IMO. First, I am not aware of Arduino boards
> mounted on top of regular development boards, so basically you are not
> describing actual hardware setup but what could be potentially plugged
> into box with Linux... and then it is like saying "you can plug
> anything" because MCU covers everything, like calling it "Raspberry
> Pi-clone".

This is used to describe one of the interfaces between the
microcontroller and the microprocessor on the Arduino UnoQ board.
Since this could be used in other layouts in the future, we thought to
keep it generic enough to reuse it.
If this isn't possible, do you have any suggestions?

>
> Best regards,
> Krzysztof
Re: [PATCH 2/5] drivers: spi: spidev: add compatible for arduino spi mcu interface
Posted by Conor Dooley 1 month, 1 week ago
On Tue, Nov 11, 2025 at 02:33:09PM +0100, Riccardo Mereu Linux Kernel wrote:
> On Fri, Nov 7, 2025 at 8:13 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > > ---
> > >  drivers/spi/spidev.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> > > index 5300c942a2a4..f0dd516c2083 100644
> > > --- a/drivers/spi/spidev.c
> > > +++ b/drivers/spi/spidev.c
> > > @@ -704,6 +704,7 @@ static const struct class spidev_class = {
> > >   */
> > >  static const struct spi_device_id spidev_spi_ids[] = {
> > >       { .name = /* abb */ "spi-sensor" },
> > > +     { .name = /* arduino */ "mcu" },
> > >       { .name = /* cisco */ "spi-petra" },
> > >       { .name = /* dh */ "dhcom-board" },
> > >       { .name = /* elgin */ "jg10309-01" },
> > > @@ -737,6 +738,7 @@ static int spidev_of_check(struct device *dev)
> > >
> > >  static const struct of_device_id spidev_dt_ids[] = {
> > >       { .compatible = "abb,spi-sensor", .data = &spidev_of_check },
> > > +     { .compatible = "arduino,mcu", .data = &spidev_of_check },
> >
> > That's way too generic, IMO. First, I am not aware of Arduino boards
> > mounted on top of regular development boards, so basically you are not
> > describing actual hardware setup but what could be potentially plugged
> > into box with Linux... and then it is like saying "you can plug
> > anything" because MCU covers everything, like calling it "Raspberry
> > Pi-clone".
> 
> This is used to describe one of the interfaces between the
> microcontroller and the microprocessor on the Arduino UnoQ board.
> Since this could be used in other layouts in the future, we thought to
> keep it generic enough to reuse it.

If it is generic enough to reuse in the future, you can have a fallback
compatible. If it isn't used again with the exact same interface,
congrats you have avoided confusing compatible naming!

> If this isn't possible, do you have any suggestions?

arduino,unoq-mcu?

Then in the future if the duoq board comes along you can do

compatible = "arduino,duoq-mcu", "arduino,unoq-mcu";

btw, thanks for actually introducing a compatible for this, and not
pretending that you have rohm dac that doesn't even exist like a lot of
people :)

Cheers,
Conor.