lkml.org 
[lkml]   [2021]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: RFC: oftree based setup of composite board devices
On Thu, Feb 11, 2021 at 1:15 PM Enrico Weigelt, metux IT consult
<lkml@metux.net> wrote:
> On 10.02.21 11:30, Andy Shevchenko wrote:

> >> Use cases are boards with non-oftree firmware (ACPI, etc) where certain
> >> platform devices can't be directly enumerated via firmware. Traditionally
> >> we had to write board specific drivers that check for board identification
> >> (DMI strings, etc), then initialize the actual devices and their links
> >> (eg. gpio<->leds/buttons, ...). Often this can be expressed just by DT.
> >
> > In ACPI we support DT compatible strings, and we support overlays for
> > a long time. Would it work for you?
>
> please tell me more, how ACPI and DT can already work together ?

It's all in documentation.

https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html#device-tree-namespace-link-device-id
https://www.kernel.org/doc/html/latest/admin-guide/acpi/ssdt-overlays.html

Please, please, read documentation beforehand!

> You already know my apu board driver - that's my first example usecase.

Sorry, but I forgot about it. Can you summarize what is your use case
that really needs so intrusive and hard work?

> There're few things I don't know how to solve w/ overlays:
>
> * match rules shall be inside the DTS
> * future match rules shall also check for bios versions etc
> * adding new boards shall be possible by just adding another DTS to
> the tree (not a whole module)
> * supporting several board variants (w/ small differences) by one DTS
> * sometimes existing devices (eg. enumerated by acpi) need to be kicked
> out (buggy firmware, ...)
> * can't rely on any special userland tweaks

Show an example why either of the above is needed in your case and
tell what is the exact issue.

> >> The approach can be easily be extended to other kinds of composite devices,
> >> eg. PCI cards or USB dongles.
> >
> > What do you mean? PCI and USB are self-enumerated. What's wrong with them?
>
> In general yes, but of course you need drivers for them. Sometimes those
> devices are composites of other devices, wired up in some special way.
> Traditionally, we'd need to write a special driver that just don't do
> much more than instantiating other drivers.

Yes, that driver represents hardware. MFD already has some support for
composite devices. We have the auxiliary bus for some other
interesting cases, etc. Depending on the hardware in question you have
to choose a proper bus and locking (access synchronisation) schema.

> Those things could be expressed via DTS, so we don't need to write
> individual drivers anymore.

It seems you are trying to create something like "universal quirk".
Brave idea, but from my experience a fiasco is what will be out of it.
The hardware has a lot of different issues and levels of issues and it
is close to impossible to describe everything possible and predict the
future... Good luck!


...

> * need to split the information into several places (instead of having
> all in one DTS)
> * need to have one separate module board, or merge the dmi tables.

Have no idea what you are talking about here, sorry.

> My goal is having everything that describes a board into one DTS
> (source) file.

I'm confused, you are talking about non-DT platforms in the
cover-letter and now you are talking about DTS. AFAIK DTS allows you
to put everything in one source.


--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-02-11 13:00    [W:0.041 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site