devicetree-spec.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Pali Rohár" <pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Russell King" <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	"Laura Abbott" <lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"Grant Likely"
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"Rob Herring"
	<robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Will Deacon" <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	"Ivaylo Dimitrov"
	<ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Sebastian Reichel" <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>,
	"Pavel Machek" <pavel-+ZI9xUNit7I@public.gmane.org>,
	"Tony Lindgren" <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	"Andreas Färber" <afaerber-l3A5Bk7waGM@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	"Devicetree Spec List"
	<devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/5] arm: devtree: Set system_rev from DT "/revision"
Date: Mon, 28 Dec 2015 13:01:22 -0800	[thread overview]
Message-ID: <5681A322.2090204@gmail.com> (raw)
In-Reply-To: <20151224190237.GA17343@pali>

Adding devicetree-spec, and commenting below.

On 12/24/2015 11:02 AM, Pali Rohár wrote:
> On Monday 06 July 2015 22:26:09 Pali Rohár wrote:
>> With this patch "/revision" DT entry is used to set global system_rev
>> variable. DT "/revision" is expected to be u32 numeric value.
>>
>> TODO: add documentation
>>
>> Signed-off-by: Pali Rohár <pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>>  arch/arm/kernel/devtree.c |   12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
>> index 11c54de..7d82749 100644
>> --- a/arch/arm/kernel/devtree.c
>> +++ b/arch/arm/kernel/devtree.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/of_irq.h>
>>  #include <linux/of_platform.h>
>>  #include <linux/smp.h>
>> +#include <linux/libfdt_env.h>
>>  
>>  #include <asm/cputype.h>
>>  #include <asm/setup.h>
>> @@ -26,6 +27,7 @@
>>  #include <asm/smp_plat.h>
>>  #include <asm/mach/arch.h>
>>  #include <asm/mach-types.h>
>> +#include <asm/system_info.h>
>>  
>>  
>>  #ifdef CONFIG_SMP
>> @@ -204,6 +206,8 @@ static const void * __init arch_get_next_mach(const char *const **match)
>>  const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
>>  {
>>  	const struct machine_desc *mdesc, *mdesc_best = NULL;
>> +	unsigned long dt_root;
>> +	const u32 *rev;
>>  
>>  #ifdef CONFIG_ARCH_MULTIPLATFORM
>>  	DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
>> @@ -215,17 +219,16 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
>>  	if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
>>  		return NULL;
>>  
>> +	dt_root = of_get_flat_dt_root();
>>  	mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
>>  
>>  	if (!mdesc) {
>>  		const char *prop;
>>  		int size;
>> -		unsigned long dt_root;
>>  
>>  		early_print("\nError: unrecognized/unsupported "
>>  			    "device tree compatible list:\n[ ");
>>  
>> -		dt_root = of_get_flat_dt_root();
>>  		prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
>>  		while (size > 0) {
>>  			early_print("'%s' ", prop);
>> @@ -246,5 +249,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
>>  	/* Change machine number to match the mdesc we're using */
>>  	__machine_arch_type = mdesc->nr;
>>  
>> +	/* Set system revision from DT */
>> +	rev = of_get_flat_dt_prop(dt_root, "revision", NULL);
>> +	if (rev)
>> +		system_rev = fdt32_to_cpu(*rev);
>> +
>>  	return mdesc;
>>  }
> 
> This patch and second one (with subject "[PATCH 2/5] arm: boot: convert
> ATAG_REVISION to DT "/revision" entry") are still needed.
> 
> Are there any objections for them? If not, I will add missing DT
> documentation and will resend them.

Patch 2/5 copies the value from ATAG_REVISION into the fdt "/revision"
property.

If the use of /revision is limited to being a location to hold an ATAG
value to pass to the global variable system_rev, then it would make
sense to just copy directly from the ATAG value into system_rev in the
same board file where you are copying the ATAGs.

-Frank

       reply	other threads:[~2015-12-28 21:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1436214373-12969-1-git-send-email-pali.rohar@gmail.com>
     [not found] ` <1436214373-12969-2-git-send-email-pali.rohar@gmail.com>
     [not found]   ` <20151224190237.GA17343@pali>
2015-12-28 21:01     ` Frank Rowand [this message]
     [not found]       ` <5681A322.2090204-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-28 22:27         ` [PATCH 1/5] arm: devtree: Set system_rev from DT "/revision" Arnd Bergmann
2016-01-05 11:37           ` Pali Rohár
2016-01-05 11:45             ` Arnd Bergmann

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=5681A322.2090204@gmail.com \
    --to=frowand.list-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=afaerber-l3A5Bk7waGM@public.gmane.org \
    --cc=devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@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 read-only IMAP folder(s) and NNTP newsgroup(s).