All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Ian Lepore <ian-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>,
	Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	U-Boot Mailing List
	<u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org>,
	Benjamin Herrenschmidt
	<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
	Joe Hershberger <joe.hershberger-acOepvfBmUk@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [U-Boot] [PATCH v3 01/11] dm: serial: Update binding for PL01x serial UART
Date: Fri, 14 Aug 2015 09:43:22 +0200	[thread overview]
Message-ID: <CAMuHMdX81zTEgnsNru8wa=q=6UEAby9cbGJcVMXgyqoqgQSK1A@mail.gmail.com> (raw)
In-Reply-To: <55CCF20C.9000104-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

On Thu, Aug 13, 2015 at 9:37 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 08/13/2015 01:04 PM, Ian Lepore wrote:
>> As the FreeBSD person who got our first SoC (imx6, only partially
>> supported) converted to use the Linux DT files rather than our own
>> homebrew mess we started with, I would say that my opinion of the
>> existing DT information is that it is an extension of Linux device
>> drivers written in a different language.
>>
>> The information available is in no way independent of the Linux device
>> drivers, it is exactly the information those drivers need.  It is often
>> not the information needed in another OS with independently written
>> drivers.  And especially it is not ordered and structured in a way that
>> works well with the device enumeration and instantiation models used by
>> another OS.
>>
>> A great case in point would be i2c eeproms.  What a perfect opportunity
>> DT would be to describe everything about the eeprom parts (total
>> capacity, page read/write size, whether the page address bits extend
>> into the bus-slave address bits, etc).  It seems to me that anything
                                    ^^^
This is the important "etc" below.

>> claiming to be an independent description of the hardware would have to
>> include such things.  Instead, all the bindings define is the compatible
>> string.  That's crazy.  Why?  Well, when I went and looked at the Linux
>> eeprom drivers it became clear why:  that's all they need to know,
>> because everything else is hard-coded in tables in the driver source.
>>
>> So if I want to write a FreeBSD i2c eeprom driver that uses DT data,
>> what are my choices?  I have exactly one:  make my driver essentially a
>> clone of the Linux driver, with all the same data hard-coded in source.
>>
>> All in all, it's not impossible for another OS to work with the DT
>> information that begins its life in Linux, but it's not really easy.
>
> In fairness, that's got nothing to do with Linux, but it's a general
> decision re: the level of detail to put into DT. There's always a discussion
> about which level of detail to represent in DT when new bindings are
> created.
>
> The type of an I2C device completely defines all of its properties; the
> model name/... is enough to fully describe its behaviour. That's a good
> reason to put just that information into DT, to avoid redundancy.
>
> In some cases, bindings have tended towards placing just the compatible
> value into the DT (e.g. your example). This does require drivers to be able
> to look up that information from the compatible value.
>
> That case tends to be more common since what's really important about DT is
> cleanly representing the resource interactions between devices; let the
> drivers know all the details of the device's internals, and let DT describe
> any point where the device/driver has to interact with the system or other
> devices/drivers around it.

Exactly.

The important part in your i2c eeprom example is the "etc".
Suppose you use a generic compatible value, and lots of properties to
describe the device.

Over time, when adding support for new devices with new features, you will
add new properties. No problem, you can assume default values if a property
is missing.
One day, when adding new features, you will discover a slight difference in
behavior between two different i2c eeproms that were described the same before.
Oops.

P.S. I'd ike to point people to my presentation "Engaging Device Trees" at
     ELC2014 (http://elinux.org/File:Engaging_Device_Trees_0.pdf).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 01/11] dm: serial: Update binding for PL01x serial UART
Date: Fri, 14 Aug 2015 09:43:22 +0200	[thread overview]
Message-ID: <CAMuHMdX81zTEgnsNru8wa=q=6UEAby9cbGJcVMXgyqoqgQSK1A@mail.gmail.com> (raw)
In-Reply-To: <55CCF20C.9000104@wwwdotorg.org>

On Thu, Aug 13, 2015 at 9:37 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 08/13/2015 01:04 PM, Ian Lepore wrote:
>> As the FreeBSD person who got our first SoC (imx6, only partially
>> supported) converted to use the Linux DT files rather than our own
>> homebrew mess we started with, I would say that my opinion of the
>> existing DT information is that it is an extension of Linux device
>> drivers written in a different language.
>>
>> The information available is in no way independent of the Linux device
>> drivers, it is exactly the information those drivers need.  It is often
>> not the information needed in another OS with independently written
>> drivers.  And especially it is not ordered and structured in a way that
>> works well with the device enumeration and instantiation models used by
>> another OS.
>>
>> A great case in point would be i2c eeproms.  What a perfect opportunity
>> DT would be to describe everything about the eeprom parts (total
>> capacity, page read/write size, whether the page address bits extend
>> into the bus-slave address bits, etc).  It seems to me that anything
                                    ^^^
This is the important "etc" below.

>> claiming to be an independent description of the hardware would have to
>> include such things.  Instead, all the bindings define is the compatible
>> string.  That's crazy.  Why?  Well, when I went and looked at the Linux
>> eeprom drivers it became clear why:  that's all they need to know,
>> because everything else is hard-coded in tables in the driver source.
>>
>> So if I want to write a FreeBSD i2c eeprom driver that uses DT data,
>> what are my choices?  I have exactly one:  make my driver essentially a
>> clone of the Linux driver, with all the same data hard-coded in source.
>>
>> All in all, it's not impossible for another OS to work with the DT
>> information that begins its life in Linux, but it's not really easy.
>
> In fairness, that's got nothing to do with Linux, but it's a general
> decision re: the level of detail to put into DT. There's always a discussion
> about which level of detail to represent in DT when new bindings are
> created.
>
> The type of an I2C device completely defines all of its properties; the
> model name/... is enough to fully describe its behaviour. That's a good
> reason to put just that information into DT, to avoid redundancy.
>
> In some cases, bindings have tended towards placing just the compatible
> value into the DT (e.g. your example). This does require drivers to be able
> to look up that information from the compatible value.
>
> That case tends to be more common since what's really important about DT is
> cleanly representing the resource interactions between devices; let the
> drivers know all the details of the device's internals, and let DT describe
> any point where the device/driver has to interact with the system or other
> devices/drivers around it.

Exactly.

The important part in your i2c eeprom example is the "etc".
Suppose you use a generic compatible value, and lots of properties to
describe the device.

Over time, when adding support for new devices with new features, you will
add new properties. No problem, you can assume default values if a property
is missing.
One day, when adding new features, you will discover a slight difference in
behavior between two different i2c eeproms that were described the same before.
Oops.

P.S. I'd ike to point people to my presentation "Engaging Device Trees" at
     ELC2014 (http://elinux.org/File:Engaging_Device_Trees_0.pdf).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

  parent reply	other threads:[~2015-08-14  7:43 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 13:42 [PATCH v3 00/11] arm: rpi: Enable USB and Ethernet driver model Raspberry Pi Simon Glass
2015-08-07 13:42 ` [U-Boot] " Simon Glass
     [not found] ` <1438954951-13329-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-08-07 13:42   ` [PATCH v3 01/11] dm: serial: Update binding for PL01x serial UART Simon Glass
2015-08-07 13:42     ` [U-Boot] " Simon Glass
2015-08-11  3:57     ` Stephen Warren
2015-08-11  3:57       ` [U-Boot] " Stephen Warren
     [not found]       ` <55C972BA.5050706-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-08-11  4:11         ` Simon Glass
2015-08-11  4:11           ` [U-Boot] " Simon Glass
     [not found]           ` <CAPnjgZ2XdOPGMfAPHGy4c7vuc+exrirXkZ5DF+wHKGmAPg8ZjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-11  4:24             ` Stephen Warren
2015-08-11  4:24               ` [U-Boot] " Stephen Warren
     [not found]     ` <1438954951-13329-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-08-11 13:00       ` Linus Walleij
2015-08-11 13:00         ` [U-Boot] " Linus Walleij
     [not found]         ` <CACRpkdZa2O1MqCVT8q2P0u0ciXK+6HFbQQGXB_-chimg=FbzQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-13 15:59           ` Simon Glass
2015-08-13 15:59             ` [U-Boot] " Simon Glass
     [not found]             ` <CAPnjgZ3V1KS7POEhsvj63OSB29MUtyaZGBoFR8JGPnaN=-fXVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-13 16:02               ` Stephen Warren
2015-08-13 16:02                 ` [U-Boot] " Stephen Warren
2015-08-13 18:13                 ` Tom Rini
2015-08-13 18:13                   ` [U-Boot] " Tom Rini
2015-08-13 19:04                   ` Ian Lepore
2015-08-13 19:04                     ` Ian Lepore
     [not found]                     ` <1439492679.242.35.camel-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
2015-08-13 19:37                       ` Stephen Warren
2015-08-13 19:37                         ` Stephen Warren
     [not found]                         ` <55CCF20C.9000104-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-08-14  7:43                           ` Geert Uytterhoeven [this message]
2015-08-14  7:43                             ` Geert Uytterhoeven
2015-08-14 10:22                       ` Linus Walleij
2015-08-14 10:22                         ` Linus Walleij
2015-08-14 14:27                       ` Rob Herring
2015-08-14 14:27                         ` Rob Herring
     [not found]                         ` <CAL_JsqL8tcECpdwCxatd6ULS8z0UU160OXr8S0ZGTTRRrUaeSQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-14 17:45                           ` Ian Lepore
2015-08-14 17:45                             ` Ian Lepore
     [not found]                             ` <1439574356.242.60.camel-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
2015-08-14 18:42                               ` Stephen Warren
2015-08-14 18:42                                 ` Stephen Warren
2015-08-17  7:46                               ` Linus Walleij
2015-08-17  7:46                                 ` Linus Walleij
2015-08-14 19:32                     ` Pantelis Antoniou
2015-08-14 19:32                       ` [U-Boot] " Pantelis Antoniou
2015-08-13 22:24               ` Rob Herring
2015-08-13 22:24                 ` [U-Boot] " Rob Herring
2015-08-07 13:42 ` [U-Boot] [PATCH v3 02/11] arm: rpi: Define CONFIG_TFTP_TSIZE to show tftp size info Simon Glass
2015-08-11  3:58   ` Stephen Warren
2016-05-23 15:39     ` Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 03/11] arm: rpi: Bring in kernel device tree files Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 04/11] arm: rpi: Device tree modifications for U-Boot Simon Glass
2015-08-11  4:00   ` Stephen Warren
2015-08-11  4:17     ` Simon Glass
2015-08-11  4:25       ` Stephen Warren
2015-08-12 13:28         ` Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 05/11] arm: rpi: Add device tree files for Raspberry Pi 2 Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 06/11] arm: rpi: Enable device tree control for Rasberry Pi Simon Glass
2015-08-11  3:47   ` Stephen Warren
2015-08-14 19:20     ` Simon Glass
2015-08-15  3:32       ` Stephen Warren
2015-08-15 13:59         ` Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 07/11] arm: rpi: Enable device tree control for Rasberry Pi 2 Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 08/11] arm: rpi: Drop the UART console platform data Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 09/11] arm: rpi: Drop the GPIO " Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 10/11] arm: rpi: Move to driver model for USB Simon Glass
2015-08-07 13:42 ` [U-Boot] [PATCH v3 11/11] arm: rpi: Use driver model for Ethernet Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdX81zTEgnsNru8wa=q=6UEAby9cbGJcVMXgyqoqgQSK1A@mail.gmail.com' \
    --to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=ian-h+KGxgPPiopAfugRpC6u6w@public.gmane.org \
    --cc=joe.hershberger-acOepvfBmUk@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
    --cc=u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.