diff options
author | Andy Fleming <afleming@freescale.com> | 2008-03-31 20:45:56 -0500 |
---|---|---|
committer | Gerald Van Baren <vanbaren@cideas.com> | 2008-04-02 11:07:15 -0400 |
commit | 4abd844d8eb108736e1cf8fbf3dbf61f2d5fc11b (patch) | |
tree | f588abd874ccf7b01f422c62644652fb86f930c2 /common/cmd_nvedit.c | |
parent | 6fe2946f198481254a6ee9600d7456b8316a4083 (diff) | |
download | u-boot-imx-4abd844d8eb108736e1cf8fbf3dbf61f2d5fc11b.zip u-boot-imx-4abd844d8eb108736e1cf8fbf3dbf61f2d5fc11b.tar.gz u-boot-imx-4abd844d8eb108736e1cf8fbf3dbf61f2d5fc11b.tar.bz2 |
Fix fdt set command to conform to dts spec
The fdt set command was treating properties specified as <00> and <0011>
as byte streams, rather than as an array of cells. As we already have
syntax for expressing the desire for a stream of bytes ([ xx xx ...]),
we should use the <> syntax to describe arrays of cells, which are always
32-bits per element. If we imagine this likely (IMHO) scenario:
> fdt set /ethernet-phy@1 reg <1>
With the old code, this would create a bad fdt, since the reg cell would be
made to be one byte in length. But the cell must be 4 bytes, so this would
break mysteriously.
Also, the dts spec calls for constants inside the angle brackets (<>)
to conform to C constant standards as they pertain to base.
Take this scenario:
> fdt set /ethernet@f00 reg <0xe250000\ 0x1000>
The old fdt command would complain that it couldn't parse that. Or, if you
wanted to specify that a certain clock ran at 33 MHz, you'd be required to
do this:
> fdt set /mydev clock <1f78a40>
Whereas the new code will accept decimal numbers.
While I was in there, I extended the fdt command parser to handle property
strings which are split across multiple arguments:
> fdt set /ethernet@f00 interrupts < 33 2 34 2 36 2 >
> fdt p /ethernet@f00
ethernet@f00 {
interrupts = <0x21 0x2 0x22 0x2 0x24 0x2>;
};
Lastly, the fdt print code was rearranged slightly to print arrays of cells
if the length of the property is a multiple of 4 bytes, and to not print
leading zeros.
Signed-off-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'common/cmd_nvedit.c')
0 files changed, 0 insertions, 0 deletions