[U-Boot-Users] [PATCH 2/2] Migrate 5xxx boards from CONFIG_OF_FLAT_TREE to CONFIG_OF_LIBFDT
Grant Likely
grant.likely at secretlab.ca
Fri Sep 7 16:19:43 CEST 2007
On 9/4/07, Grant Likely <grant.likely at secretlab.ca> wrote:
> On 9/4/07, Bartlomiej Sieka <tur at semihalf.com> wrote:
> > > -#ifdef CONFIG_OF_FLAT_TREE
> > > -void
> > > -ft_cpu_setup(void *blob, bd_t *bd)
> > > +#ifdef CONFIG_OF_LIBFDT
> > > +static void do_fixup(void *fdt, const char *node, const char *prop,
> > > + const void *val, int len, int create)
> > > +{
> > > +#if defined(DEBUG)
> > > + int i;
> > > + debug("Updating property '%s/%s' = ", node, prop);
> > > + for (i = 0; i < len; i++)
> > > + debug(" %.2x", *(u8*)(val+i));
> > > + debug("\n");
> > > +#endif
> > > + int rc = fdt_find_and_setprop(fdt, node, prop, val, len, create);
> > > + if (rc)
> > > + printf("Unable to update property %s:%s, err=%s\n",
> > > + node, prop, fdt_strerror(rc));
> > > +}
> > > +
> > > +static void do_fixup_u32(void *fdt, const char *node, const char *prop,
> > > + u32 val, int create)
> > > +{
> > > + val = cpu_to_be32(val);
> >
> > Shouldn't this be cpu_to_fdt32()? In such a case we need libfdt_env.h of
> > course.
> >
> > > + do_fixup(fdt, node, prop, &val, sizeof(val), create);
> > > +}
> >
> > I don't think do_fixup() and do_fixup_u32() should be in
> > cpu/mpc5xxx/cpu.c - they can and should be used by 83xx (and others)
> > without modification. Is libfdt really out of the question because of
> > printf() calls?
>
> I think so. libfdt is *supposed* to be cross platform code that is
> used by u-boot, dtc, etc. Unfortunately there has already been drift
> in this regard, :-( I think libfdt functions should provide feedback
> via the return code, and let callers take care of formating output.
> The fixup functions in cpu.c is purely shorthand to keep the body of
> ft_setup_cpu tidy (so it doesn't need the same boilerplate for each
> function call to check the results), but I do agree that they are
> useful to more than just 5xxx. So where should they go? And as a
> secondary question, do we put them there now, or move them in the next
> merge window?
... How about putting them in common/fdt_support.c?
Cheers,
g.
>
> Cheers,
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely at secretlab.ca
> (403) 399-0195
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195
More information about the U-Boot
mailing list