Re: [Discussion] Global vs Local devicetree overlays for addon board + connector setups
From: Geert Uytterhoeven
Date: Mon May 05 2025 - 02:44:07 EST
On Sun, 4 May 2025 at 15:13, Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, May 04, 2025 at 06:30:24PM +0530, Ayush Singh wrote:
> > On 5/4/25 18:20, Greg Kroah-Hartman wrote:
> > > On Sun, May 04, 2025 at 06:03:26PM +0530, Ayush Singh wrote:
> > > > > It depends on the bus the device is added.
> > > > > when an overlay is applied by the kernel, OF_RECONFIG_* events are
> > > > > triggered. Some buses handle them:
> > > > >
> > > > > $ git grep OF_RECONFIG_CHANGE
> > > > > drivers/bus/imx-weim.c: case OF_RECONFIG_CHANGE_ADD:
> > > > > drivers/bus/imx-weim.c: case OF_RECONFIG_CHANGE_REMOVE:
> > > > > drivers/gpio/gpiolib-of.c: case OF_RECONFIG_CHANGE_ADD:
> > > > > drivers/gpio/gpiolib-of.c: case OF_RECONFIG_CHANGE_REMOVE:
> > > > > drivers/i2c/i2c-core-of.c: case OF_RECONFIG_CHANGE_ADD:
> > > > > drivers/i2c/i2c-core-of.c: case OF_RECONFIG_CHANGE_REMOVE:
> > > > > drivers/of/dynamic.c: * Return: OF_RECONFIG_CHANGE_REMOVE on device going from enabled to
> > > > > drivers/of/dynamic.c: * disabled, OF_RECONFIG_CHANGE_ADD on device going from disabled to
> > > > > drivers/of/dynamic.c: return new_state ? OF_RECONFIG_CHANGE_ADD : OF_RECONFIG_CHANGE_REMOVE;
> > > > > drivers/of/platform.c: case OF_RECONFIG_CHANGE_ADD:
> > > > > drivers/of/platform.c: case OF_RECONFIG_CHANGE_REMOVE:
> > > > > drivers/spi/spi.c: case OF_RECONFIG_CHANGE_ADD:
> > > > > drivers/spi/spi.c: case OF_RECONFIG_CHANGE_REMOVE:
> > > > > include/linux/of.h: OF_RECONFIG_CHANGE_ADD,
> > > > > include/linux/of.h: OF_RECONFIG_CHANGE_REMOVE,
> > > >
> > > > Well, if some bus does handle the event, I guess it is a bug in the
> > > > subsystems that do not? Maybe Greg Kroah-Hartman can clarify the expected
Support for OF_RECONFIG_* events was added only to buses where users
had a need for it (spi, i2c, platform, weim) and to the GPIO subsystem
(for hogs). More can be added...
> > > > behavior here? Maybe we are in transition phase here.
> > > Perhaps those other busses just do not have OF devices and so they never
> > > needed to add that functionality to them?
> > >
> > > If they do, then by all means add that code. OF devices are not
> > > possible for many bus types, so there shouldn't be a need to add this to
> > > the driver core, right?
> >
> > UART devices are pretty common in both Beagle capes and MikroBUS. So I think
> > that will probably need to be added at some point.
>
> uarts are not a bus, they are a type of device that is implemented by
> many different bus drivers (pci, USB, etc.)
It depends...
https://elixir.bootlin.com/linux/v6.14.5/source/Documentation/devicetree/bindings/serial/serial.yaml#L90
It makes perfect sense to add support for OF_RECONFIG_* events to the
serial bus, so people can attach e.g. a bluetooth or GNSS device to a
serial header on their board (or even to a legacy serial port on a PC),
load a DT overlay, and enjoy a working device.
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