From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartlomiej Sieka Date: Tue, 04 Sep 2007 18:34:44 +0200 Subject: [U-Boot-Users] [PATCH 2/2] Migrate 5xxx boards from CONFIG_OF_FLAT_TREE to CONFIG_OF_LIBFDT In-Reply-To: <20070904134845.20181.48009.stgit@trillian.cg.shawcable.net> References: <20070904134525.20181.41612.stgit@trillian.cg.shawcable.net> <20070904134845.20181.48009.stgit@trillian.cg.shawcable.net> Message-ID: <46DD8924.3030505@semihalf.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Grant Likely wrote: > From: Grant Likely > > Affects boards: icecube (lite5200), jupiter, motionpro, tqm5200 > > Tested on: lite5200b > > Signed-off-by: Grant Likely > --- Hi Grant, Thanks for including motionpro changes with this patch; see my comments below. [...] > diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c > index 1eac2bb..e8a928a 100644 > --- a/cpu/mpc5xxx/cpu.c > +++ b/cpu/mpc5xxx/cpu.c > @@ -25,14 +25,18 @@ > * CPU specific code for the MPC5xxx CPUs > */ > > +#undef DEBUG > + Is this needed? > #include > #include > #include > #include > +#include > #include > > -#if defined(CONFIG_OF_FLAT_TREE) > -#include > +#if defined(CONFIG_OF_LIBFDT) > +#include > +#include Are we using this? > #endif > > DECLARE_GLOBAL_DATA_PTR; > @@ -109,31 +113,46 @@ unsigned long get_tbclk (void) > return (tbclk); > } > > + > /* ------------------------------------------------------------------------- */ > > -#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? Regards, Bartlomiej