mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <r.hieber@pengutronix.de>
To: Pascal Vizeli <pvizeli@syshack.ch>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] drivers: of: implement overlay support
Date: Mon, 4 Jun 2018 13:04:00 +0200	[thread overview]
Message-ID: <20180604110400.vtvbxiocuteqk7ww@pengutronix.de> (raw)
In-Reply-To: <20180602211715.10989-1-pvizeli@syshack.ch>

On Sat, Jun 02, 2018 at 09:17:13PM +0000, Pascal Vizeli wrote:
> diff --git a/Documentation/user/devicetree.rst b/Documentation/user/devicetree.rst
> index 17934d86e..b2220997d 100644
> --- a/Documentation/user/devicetree.rst
> +++ b/Documentation/user/devicetree.rst
> @@ -21,7 +21,7 @@ The internal devicetree
>  -----------------------
>  
>  The devicetree consulted by barebox plays a special role. It is referred to
> -as the "internal devicetree." The barebox devicetree commands work on this
> +as the "internal devicetree". The barebox devicetree commands work on this
>  devicetree. The devicetree source (DTS) files are kept in sync with the kernel DTS
>  files. As the FDT files are meant to be backward compatible, it should always be possible
>  to start a kernel with the barebox internal devicetree. However, since the barebox
> @@ -83,3 +83,102 @@ you can exchange the internal devicetree during runtime using the
>  
>     oftree -f
>     oftree -l /new/dtb
> +
> +Devicetree overlays
> +-------------------
> +
> +Since version 3.19, the Linux kernel supports applying "devicetree overlays" to
> +its loaded device tree. This can be used to inform the kernel about additional
> +non-discoverable devices after the system has booted, which is useful for modular
> +boards and FPGAs. The details of the overlay format are specified in the Linux
> +`kernel documentation <https://www.kernel.org/doc/Documentation/devicetree/overlay-notes.txt>`_
> +and an updated DTC is required to compile the overlays.
> +
> +The use cases for overlays in barebox are a bit different:
> +
> +* some of the modular devices are needed to boot Linux to userspace, but barebox
> +  can detect which module variant is connected
> +* one of several parallel or LVDS displays (which use timing data from devicetree)
> +  can be connected to the SoC and should be used for boot messages
> +* a generic Linux (distribution) kernel should be booted on a modular
> +  system and support additional hardware on modules
> +
> +barebox supports applying overlays in the internal devicetree was well using the
> +:ref:`command_oftree` command with option ``-o``:
> +
> +.. code-block:: sh

That highlighting looks weird with mixed languages. I suggest 

  .. code-block:: none

instead. (Ideally, this should also be used for all the other code
blocks on that page, IMO ☺)

 - Roland

> +
> +   $ ./barebox -d arch/sandbox/dts/sandbox.dtb -i arch/sandbox/dts/sandbox-overlay.dtbo
> +   add fd0 backed by file arch/sandbox/dts/sandbox-overlay.dtbo
> +
> +   barebox 2015.02.0 #26 Wed Mar 4 09:41:19 CET 2015
> +   ...
> +   barebox@barebox sandbox:/ of_dump
> +   ...
> +     dummy@0 {
> +       status = "disabled";
> +       linux,phandle = <0x1>;
> +       phandle = <0x1>;
> +     };
> +     dummy@1 {
> +       status = "disabled";
> +       linux,phandle = <0x2>;
> +       phandle = <0x2>;
> +     };
> +     __symbols__ {
> +       dummy0 = "/dummy@0";
> +       dummy1 = "/dummy@1";
> +     };
> +   ...
> +   barebox@barebox sandbox:/ of_dump -f /dev/fd0
> +    {
> +     fragment@0 {
> +       target = <0xdeadbeef>;
> +       __overlay__ {
> +         status = "okay";
> +         child {
> +           compatible = "barebox,dummy";
> +         };
> +       };
> +     };
> +     fragment@1 {
> +       target = <0xdeadbeef>;
> +       __overlay__ {
> +         status = "okay";
> +         child {
> +           compatible = "barebox,dummy";
> +         };
> +       };
> +     };
> +     __fixups__ {
> +       dummy0 = "/fragment@0:target:0";
> +       dummy1 = "/fragment@1:target:0";
> +     };
> +   };
> +   barebox@barebox sandbox:/ oftree -o /dev/fd0
> +   barebox@barebox sandbox:/ of_dump
> +   ...
> +     dummy@0 {
> +       linux,phandle = <0x1>;
> +       phandle = <0x1>;
> +       status = "okay";
> +       child {
> +         compatible = "barebox,dummy";
> +       };
> +     };
> +     dummy@1 {
> +       linux,phandle = <0x2>;
> +       phandle = <0x2>;
> +       status = "okay";
> +       child {
> +         compatible = "barebox,dummy";
> +       };
> +     };
> +     __symbols__ {
> +       dummy0 = "/dummy@0";
> +       dummy1 = "/dummy@1";
> +     };
> +   ...
> +
> +If you need to use a different base devicetree instead of the one compiled into
> +barebox, it needs to be replaced as described in the previous section.

[...]
-- 
Roland Hieber                     | r.hieber@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-06-04 11:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 21:17 Pascal Vizeli
2018-06-02 21:17 ` [PATCH 2/3] scripts/dtc: Update to upstream version 1.4.6 Pascal Vizeli
2018-06-02 21:17 ` [PATCH 3/3] drivers: of: bugfix local fixups resolving Pascal Vizeli
2018-06-04 11:04 ` Roland Hieber [this message]
2018-06-05  6:46 ` [PATCH 1/3] drivers: of: implement overlay support Sascha Hauer

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=20180604110400.vtvbxiocuteqk7ww@pengutronix.de \
    --to=r.hieber@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=pvizeli@syshack.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox