Hi Morimoto-san, On Wed, 9 Apr 2025 at 03:05, Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> wrote: > Renesas MSIOF (Clock-Synchronized Serial Interface with FIFO) can work as > both SPI and I2S. MSIOF-I2S will use Audio Graph Card/Card2 driver which > Of-Graph in DT. > > MSIOF-SPI/I2S are using same DT compatible properties. > MSIOF-I2S uses Of-Graph for Audio-Graph-Card/Card2, > MSIOF-SPI doesn't use Of-Graph. > > Check "port" node when driver probing > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Still, some comment below > --- a/drivers/spi/spi-sh-msiof.c > +++ b/drivers/spi/spi-sh-msiof.c > @@ -20,6 +20,7 @@ > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/of_graph.h> > #include <linux/platform_device.h> > #include <linux/pm_runtime.h> > #include <linux/sh_dma.h> > @@ -1276,10 +1277,19 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) > const struct sh_msiof_chipdata *chipdata; > struct sh_msiof_spi_info *info; > struct sh_msiof_spi_priv *p; > + struct device_node *port; If you would add "__free(device_node)", you could drop the of_node_put() below. > unsigned long clksrc; > int i; > int ret; > > + /* Check whether MSIOF is used as I2S mode or SPI mode by checking "port" node */ > + port = of_graph_get_next_port(pdev->dev.of_node, NULL); This is actually checking for both "ports" and "port". If you know the subnode is called "port", you could simplify to of_get_child_by_name(). > + if (port) { > + /* It was MSIOF-I2S */ > + of_node_put(port); > + return -ENODEV; > + } > + > chipdata = of_device_get_match_data(&pdev->dev); > if (chipdata) { > info = sh_msiof_spi_parse_dt(&pdev->dev); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx 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