From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] arm: preserve ATAGS in /chosen/atags in the Device Tree
Date: Thu, 6 Jun 2013 14:28:51 +0200 [thread overview]
Message-ID: <20130606142851.6dd17cad@skate> (raw)
In-Reply-To: <1370414409-29991-3-git-send-email-thomas.petazzoni@free-electrons.com>
Russell, Nicolas,
I'd be interested to hear your opinion about the below proposal, that
allows platform-specific code to do its own parsing of ATAGS
information, without cluttering the generic code.
Thanks!
Thomas
On Wed, 5 Jun 2013 08:40:06 +0200, Thomas Petazzoni wrote:
> Some platforms have custom ATAGS that are too specific to be parsed by
> generic code in atags_to_fdt.c, but that would nonetheless be
> useful. For example, Marvell bootloaders pass a custom ATAG that
> contain the MAC address for the various network interfaces of the
> board.
>
> This commit makes a small addition to the atags_to_fdt logic that
> consists in storing the ATAGS contents in the /chosen/atags node of
> the Device Tree. Some platform-specific can then later make use of
> this data to parse some custom ATAGs.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> arch/arm/boot/compressed/atags_to_fdt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
> index aabc02a..8b2ae61 100644
> --- a/arch/arm/boot/compressed/atags_to_fdt.c
> +++ b/arch/arm/boot/compressed/atags_to_fdt.c
> @@ -98,6 +98,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
> uint32_t mem_reg_property[2 * NR_BANKS];
> int memcount = 0;
> int ret;
> + int atagssize = 0;
>
> /* make sure we've got an aligned pointer */
> if ((u32)atag_list & 0x3)
> @@ -119,6 +120,7 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
> return ret;
>
> for_each_tag(atag, atag_list) {
> + atagssize += atag->hdr.size * 4;
> if (atag->hdr.tag == ATAG_CMDLINE) {
> /* Append the ATAGS command line to the device tree
> * command line.
> @@ -153,5 +155,9 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
> if (memcount)
> setprop(fdt, "/memory", "reg", mem_reg_property, 4*memcount);
>
> + if (atagssize)
> + setprop(fdt, "/chosen", "atags", atag_list,
> + atagssize);
> +
> return fdt_pack(fdt);
> }
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2013-06-06 12:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 6:40 [PATCH 0/5] Mechanism for platform-specific parsing of ATAGs Thomas Petazzoni
2013-06-05 6:40 ` [PATCH 1/5] ARM: mvebu: set aliases for ethernet controllers Thomas Petazzoni
2013-06-05 6:40 ` [PATCH 2/5] arm: preserve ATAGS in /chosen/atags in the Device Tree Thomas Petazzoni
2013-06-05 13:27 ` Jason Cooper
2013-06-06 12:28 ` Thomas Petazzoni [this message]
2013-06-06 17:27 ` Nicolas Pitre
2013-06-07 9:21 ` Thomas Petazzoni
2013-06-07 14:32 ` Jason Cooper
2013-06-07 17:16 ` Thomas Petazzoni
2013-06-07 17:59 ` Jason Cooper
2013-06-08 4:50 ` Nicolas Pitre
2013-06-08 14:54 ` Jason Cooper
2013-06-08 7:59 ` Russell King - ARM Linux
2013-06-08 18:54 ` Rob Herring
2013-06-08 18:59 ` Russell King - ARM Linux
2013-06-05 6:40 ` [PATCH 3/5] of: net: introduce a of_set_mac_address() helper function Thomas Petazzoni
2013-06-05 7:13 ` Andrew Lunn
2013-06-05 7:18 ` Thomas Petazzoni
2013-06-05 11:58 ` Grant Likely
2013-06-05 6:40 ` [PATCH 4/5] arm: mxs: use the newly introduced of_set_mac_address() helper Thomas Petazzoni
2013-06-05 6:40 ` [PATCH 5/5] arm: mvebu: parse ATAGS to find the network interfaces MAC addresses Thomas Petazzoni
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=20130606142851.6dd17cad@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.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).