From: Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>
To: Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: "Pantelis Antoniou"
<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
"Simon Glass" <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
"Boris Brezillon"
<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
"Alexander Kaplan" <alex-MflLfwwFzuz+yO7R74ARew@public.gmane.org>,
"Thomas Petazzoni"
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Antoine Ténart"
<antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
"Hans de Goede"
<hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Tom Rini" <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org
Subject: Re: [PATCH v2 8/9] cmd: fdt: add fdt overlay application subcommand
Date: Thu, 09 Jun 2016 20:45:35 -0700 [thread overview]
Message-ID: <356d7b74b13a49ecbbf43aa51feba534@agner.ch> (raw)
In-Reply-To: <1464340402-2249-9-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
On 2016-05-27 02:13, Maxime Ripard wrote:
> The device tree overlays are a good way to deal with user-modifyable
> boards or boards with some kind of an expansion mechanism where we can
> easily plug new board in (like the BBB or the raspberry pi).
>
> However, so far, the usual mechanism to deal with it was to have in Linux
> some driver detecting the expansion boards plugged in and then request
> these overlays using the firmware interface.
>
> That works in most cases, but in some cases, you might want to have the
> overlays applied before the userspace comes in. Either because the new
> board requires some kind of an early initialization, or because your root
> filesystem is accessed through that expansion board.
>
> The easiest solution in such a case is to simply have the component before
> Linux applying that overlay, removing all these drawbacks.
>
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> cmd/fdt.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
Reviewed-by: Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>
>
> diff --git a/cmd/fdt.c b/cmd/fdt.c
> index 0f5923e75a41..6cbc9e525d6c 100644
> --- a/cmd/fdt.c
> +++ b/cmd/fdt.c
> @@ -639,6 +639,25 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[])
> #endif
>
> }
> + /* apply an overlay */
> + else if (strncmp(argv[1], "ap", 2) == 0) {
> + unsigned long addr;
> + struct fdt_header *blob;
> +
> + if (argc != 3)
> + return CMD_RET_USAGE;
> +
> + if (!working_fdt)
> + return CMD_RET_FAILURE;
> +
> + addr = simple_strtoul(argv[2], NULL, 16);
> + blob = map_sysmem(addr, 0);
> + if (!fdt_valid(&blob))
> + return CMD_RET_FAILURE;
> +
> + if (fdt_overlay_apply(working_fdt, blob))
> + return CMD_RET_FAILURE;
> + }
> /* resize the fdt */
> else if (strncmp(argv[1], "re", 2) == 0) {
> fdt_shrink_to_minimum(working_fdt);
> @@ -1025,6 +1044,7 @@ static int fdt_print(const char *pathp, char
> *prop, int depth)
> #ifdef CONFIG_SYS_LONGHELP
> static char fdt_help_text[] =
> "addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
> + "fdt apply <addr> - Apply overlay to the DT\n"
> #ifdef CONFIG_OF_BOARD_SETUP
> "fdt boardsetup - Do board-specific set up\n"
> #endif
next prev parent reply other threads:[~2016-06-10 3:45 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-27 9:13 [PATCH v2 0/9] cmd: fdt: Add device tree overlays support Maxime Ripard
[not found] ` <1464340402-2249-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-05-27 9:13 ` [PATCH v2 1/9] cmd: fdt: Narrow the check for fdt addr Maxime Ripard
[not found] ` <1464340402-2249-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 13:55 ` Pantelis Antoniou
2016-05-27 9:13 ` [PATCH v2 2/9] scripts: Makefile.lib: Sanitize DTB names Maxime Ripard
[not found] ` <1464340402-2249-3-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 13:59 ` Pantelis Antoniou
2016-05-27 9:13 ` [PATCH v2 3/9] vsprintf: Include stdarg for va_list Maxime Ripard
[not found] ` <1464340402-2249-4-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 14:00 ` Pantelis Antoniou
2016-05-27 9:13 ` [PATCH v2 4/9] libfdt: Add new headers and defines Maxime Ripard
[not found] ` <1464340402-2249-5-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 14:03 ` Pantelis Antoniou
[not found] ` <D44ABB0F-69B9-4DA6-8F8B-6F74A5B4BFE1-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-11 10:30 ` David Gibson
[not found] ` <20160611103035.GW9226-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-13 9:28 ` Maxime Ripard
2016-06-16 0:39 ` Simon Glass
2016-05-27 9:13 ` [PATCH v2 5/9] libfdt: Add iterator over properties Maxime Ripard
2016-06-10 2:51 ` Stefan Agner
2016-06-10 14:04 ` Pantelis Antoniou
[not found] ` <73A48AF0-F702-4C43-80A4-A18AC4AD59C6-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-13 9:35 ` Maxime Ripard
2016-05-27 9:13 ` [PATCH v2 6/9] libfdt: Add max phandle retrieval function Maxime Ripard
2016-06-10 2:55 ` Stefan Agner
[not found] ` <1464340402-2249-7-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 15:13 ` Pantelis Antoniou
2016-05-27 9:13 ` [PATCH v2 7/9] libfdt: Add overlay application function Maxime Ripard
2016-06-10 3:38 ` Stefan Agner
[not found] ` <1464340402-2249-8-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 14:28 ` Pantelis Antoniou
[not found] ` <34997AD3-B621-4823-920E-22E4A6F0E0D1-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-13 9:51 ` Maxime Ripard
2016-06-14 0:25 ` David Gibson
[not found] ` <20160614002550.GA4882-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-06-14 9:22 ` Pantelis Antoniou
[not found] ` <F0B62E6A-D5CE-4505-BC19-5EAB72A33ADE-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-15 3:14 ` David Gibson
2016-06-15 9:34 ` Pantelis Antoniou
[not found] ` <7E8A7CBD-D682-45E5-AD2C-19F137E5ED38-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-15 10:19 ` David Gibson
2016-06-15 10:23 ` Pantelis Antoniou
[not found] ` <F67FB562-88F6-4B3A-8952-ACA38AAC9256-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-06-15 14:49 ` Warner Losh
2016-05-27 9:13 ` [PATCH v2 8/9] cmd: fdt: add fdt overlay application subcommand Maxime Ripard
[not found] ` <1464340402-2249-9-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 3:45 ` Stefan Agner [this message]
2016-06-10 13:56 ` Pantelis Antoniou
2016-05-27 9:13 ` [PATCH v2 9/9] tests: Introduce DT overlay tests Maxime Ripard
[not found] ` <1464340402-2249-10-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-06-10 0:34 ` Simon Glass
2016-06-10 15:20 ` Pantelis Antoniou
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=356d7b74b13a49ecbbf43aa51feba534@agner.ch \
--to=stefan-xlvq0vzyd2y@public.gmane.org \
--cc=alex-MflLfwwFzuz+yO7R74ARew@public.gmane.org \
--cc=antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).