[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ae65e3c-f1fa-4ca9-8d74-12d92c51c5c6@freemail.hu>
Date: Mon, 20 May 2024 19:20:12 +0200
From: Szőke Benjamin <egyszeregy@...email.hu>
To: Mark Brown <broonie@...nel.org>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] spidev: Introduce "linux,spidev-name" property for
device tree of spidev.
2024. 05. 20. 15:20 keltezéssel, Mark Brown írta:
> On Sun, May 19, 2024 at 11:13:46PM +0200, egyszeregy@...email.hu wrote:
>> From: Benjamin Szőke <egyszeregy@...email.hu>
>>
>> Optionally, spidev may have a "linux,spidev-name" property.
>> This is a string which is defining a custom suffix name for spi device in
>> /dev/spidev-<name> format. It helps to improve software portability between
>> various SoCs and reduce complexities of hardware related codes in SWs.
>
> This seems like what udev rules are for?
Hi,
Goal of this patch is to introduce this new mode to assign a custom name from
lowlevel device tree to a spidev device. As i know udev can do it, but to do it
from device tree is the best and easier way for this feature in my opinion.
It is more maintainable then use udev in userspace for it.
For example there are three different SoCs: i.MX7, i.MX9, ZynqMP.
In Yocto project, the Linux image's SW environment is nicely configurable
independently from what is the target MACHNIE. But if i like to deploy a SW
which uses peripheries like gpiobanks, i2c-dev, spidev these /dev/... name will
be totally different on each SoCs, more over in ZynqMP and any other Adaptive
SoC platform, the index number for the spidev, gpiobanks or other can be not
deterministic if it probed in run-time. Goal is to easily make a Linux OS image
which can support multiple SoCs in SW point of view easily.
So, in Yocto project build system point of view the best, if any Machine
specific settings is stored in the device tree files of the target machine in
driver levels/config, because it will be deterministic in 100% sure and it will
be nicely separated from the SW meta layers which may not contains any machine
specific hacking with udev and so on.
So this way to assign a custom name for a spidev from device tree is more
efficient and more maintainable in SW developing point of view in embedded Linux
and Yocto/buildroot world because i need to just define a name like
linux,spidev-name = "sensor"; then use it with a fixed name in my generic SW
under /dev/spidev-sensor name. And there are no need to care about what will be
the index number of this spidev randomly after boot and how need to make an ugly
append layer for udev config and make it for all of machine variants separately.
My opinion udev is ugly to use for it, and no longer beneficial for new Adaptive
SoCs where they can be not deterministic what kind of index number they got in
driver probing for many gpio, spidev, i2c-dev peripheries (you do not have info
about that which need to mapping for what custom name, it can be different in
many time based on PL FW). It is much better, safe and easier to assign this
custom suffix/name explicitly from device tree, moreover it is a driver related
things, i think the best place is in device tree for it not in a sys config file
for udev.
DT binding would need to be documented later in a separated patch as a guideline
mentioned it in Linux repo.
Powered by blists - more mailing lists