[U-Boot-Users] [RFC][PATCH] fdt fixup

gvb.uboot gvb.uboot at gmail.com
Fri Nov 2 00:53:54 CET 2007


Kumar Gala wrote:
> This code adds a generic fixup mechanism that allows us to get ride of
> needing explicit paths to device nodes.
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 7a81469..2c1e8ac 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -363,4 +363,125 @@ int fdt_bd_t(void *fdt)
>  }
>  #endif /* ifdef CONFIG_OF_HAS_BD_T */
> 
> +/*
> + * "Setter" functions used to add/modify FDT entries.
> + */
> +#ifdef CONFIG_HAS_ETH0
> +static int fdt_set_eth0(void *blob, int nodeoffset, const char *name, bd_t *bd)
> +{
> +	/* Fix it up if it exists, don't create it if it doesn't exist */
> +	if (fdt_get_property(blob, nodeoffset, name, 0)) {
> +		return fdt_setprop(blob, nodeoffset, name, bd->bi_enetaddr, 6);
> +	}
> +	return 0;
> +}

[snip a bunch more setter functions]

Hi Kumar,

The direction Grant Likely went with 5xxx and where Sergej was heading 
with 82xx (if only I got around to applying his patch) and where I want 
to go is to replace the table-driven methodology with direct calls to 
more generic functions, eliminating the hordes of specialized "setter" 
functions (all nearly identical).

Discussions and patches:
<http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/32573/focus=32573>
<http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/32577>

If we get the mpc5xxx style setter functions combined with your 
fdt_node_offset_by_prop_and_compat() finding changes, I think we would 
be in fat city.

Best regards,
gvb

P.S. Is David done changing libfdt yet??? ;-)  I saw you are still 
keeping up with him...




More information about the U-Boot mailing list