[U-Boot] [PATCH 2/2 v2] 8xx, kup4: add FDT support

Scott Wood scottwood at freescale.com
Mon Jul 19 19:48:03 CEST 2010


On Mon, 19 Jul 2010 14:13:53 +0200
Heiko Schocher <hs at denx.de> wrote:

> +int fdt_set_node_and_value(void *blob,
> +				char *nodename,
> +				char *regname,
> +				void *var,
> +				int size)
> +{
> +	int ret = 0;
> +	int nodeoffset = 0;
> +
> +	nodeoffset = fdt_path_offset(blob, nodename);
> +	if (nodeoffset >= 0) {
> +		ret = fdt_setprop(blob, nodeoffset, regname, var,
> +					size);
> +		if (ret < 0) {
> +			printf("%s: cannot set %s/%s property; err: %s\n",
> +			__func__, nodename, regname, fdt_strerror(ret));
> +		}
> +	} else {
> +		printf("%s: cannot find %s node err:%s\n", __func__,
> +			nodename, fdt_strerror(nodeoffset));
> +	}
> +	return ret;
> +}

How is this different from do_fixup_by_path()?

> +/*
> + * update "brg" property in the blob
> + */
> +void ft_blob_update(void *blob, bd_t *bd)
> +{
> +	uchar enetaddr[6];
> +	ulong brg_data = 0;
> +
> +	/* BRG */
> +	brg_data = cpu_to_be32(bd->bi_busfreq);
> +	fdt_set_node_and_value(blob,
> +				"/soc/cpm", "brg-frequency",
> +				&brg_data, sizeof(brg_data));

This binding is deprecated -- the device tree should have a brg node, in
which ft_cpu_setup() will fill in clock-frequency.

See Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm.txt in Linux.

You can keep brg-frequency around in addition if you need to support kernels
from the short period of time that was old enough to not know about the brg
node, but new enough to support device trees at all.  Maybe put it in
ft_cpu_setup(), replacing the existing fixup a couple of other 8xx
boards do (but not all of them).

> +	/* MAC addr */
> +	if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
> +		fdt_set_node_and_value(blob,
> +					"ethernet0", "local-mac-address",
> +					enetaddr, sizeof(u8) * 6);
> +	}

ft_cpu_setup() calls fdt_fixup_ethernet() which should handle this.

-Scott



More information about the U-Boot mailing list