From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Rowand Subject: Re: [PATCH 1/5] arm: devtree: Set system_rev from DT "/revision" Date: Mon, 28 Dec 2015 13:01:22 -0800 Message-ID: <5681A322.2090204@gmail.com> References: <1436214373-12969-1-git-send-email-pali.rohar@gmail.com> <1436214373-12969-2-git-send-email-pali.rohar@gmail.com> <20151224190237.GA17343@pali> Reply-To: frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <20151224190237.GA17343@pali> Sender: devicetree-spec-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: =?UTF-8?B?UGFsaSBSb2jDoXI=?= Cc: Russell King , Laura Abbott , Grant Likely , Rob Herring , Will Deacon , Ivaylo Dimitrov , Sebastian Reichel , Pavel Machek , Tony Lindgren , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Devicetree Spec List List-Id: linux-omap@vger.kernel.org Adding devicetree-spec, and commenting below. On 12/24/2015 11:02 AM, Pali Roh=C3=A1r wrote: > On Monday 06 July 2015 22:26:09 Pali Roh=C3=A1r wrote: >> With this patch "/revision" DT entry is used to set global system_re= v >> variable. DT "/revision" is expected to be u32 numeric value. >> >> TODO: add documentation >> >> Signed-off-by: Pali Roh=C3=A1r >> --- >> 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 >> #include >> #include >> +#include >> =20 >> #include >> #include >> @@ -26,6 +27,7 @@ >> #include >> #include >> #include >> +#include >> =20 >> =20 >> #ifdef CONFIG_SMP >> @@ -204,6 +206,8 @@ static const void * __init arch_get_next_mach(co= nst char *const **match) >> const struct machine_desc * __init setup_machine_fdt(unsigned int d= t_phys) >> { >> const struct machine_desc *mdesc, *mdesc_best =3D NULL; >> + unsigned long dt_root; >> + const u32 *rev; >> =20 >> #ifdef CONFIG_ARCH_MULTIPLATFORM >> DT_MACHINE_START(GENERIC_DT, "Generic DT based system") >> @@ -215,17 +219,16 @@ const struct machine_desc * __init setup_machi= ne_fdt(unsigned int dt_phys) >> if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys))) >> return NULL; >> =20 >> + dt_root =3D of_get_flat_dt_root(); >> mdesc =3D of_flat_dt_match_machine(mdesc_best, arch_get_next_mach)= ; >> =20 >> if (!mdesc) { >> const char *prop; >> int size; >> - unsigned long dt_root; >> =20 >> early_print("\nError: unrecognized/unsupported " >> "device tree compatible list:\n[ "); >> =20 >> - dt_root =3D of_get_flat_dt_root(); >> prop =3D 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_machin= e_fdt(unsigned int dt_phys) >> /* Change machine number to match the mdesc we're using */ >> __machine_arch_type =3D mdesc->nr; >> =20 >> + /* Set system revision from DT */ >> + rev =3D of_get_flat_dt_prop(dt_root, "revision", NULL); >> + if (rev) >> + system_rev =3D fdt32_to_cpu(*rev); >> + >> return mdesc; >> } >=20 > This patch and second one (with subject "[PATCH 2/5] arm: boot: conve= rt > ATAG_REVISION to DT "/revision" entry") are still needed. >=20 > 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