Re: [RESEND] [PATCH v2 1/2] arm: devtree: Set system_rev from DT revision

From: Pali RohÃr
Date: Mon Jul 06 2015 - 12:36:14 EST


On Monday 06 July 2015 18:20:35 Pali RohÃr wrote:
> > > "/chosen/linux,atags"
> >
> > This one. ATAGs are a Linux data struct.
> >
> > Rob
>
> Ok, and how read that property "/chosen/linux,atags" in function
> setup_machine_fdt() from file arch/arm/kernel/devtree.c ?
>
> of_get_flat_dt_prop() cannot be used unless somebody get me offset to
> node "/chosen"...
>
> Any idea?
>

fdt_path_offset() from libfdt.h seems to work...

Is solution like this one acceptable?

#include <linux/libfdt.h>
#include "atags.h"

... setup_machine_fdt(unsigned int dt_phys) {

dt_virt = phys_to_virt(dt_phys);
dt_chosen = fdt_path_offset(dt_virt, "/chosen");
atags = of_get_flat_dt_prop(dt_chosen, "linux,atags", NULL);
save_atags(atags);

}

(this is without checks for errors)

--
Pali RohÃr
pali.rohar@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.