[U-Boot] [PATCH 0/3] dtoc: Add support for 64-bit addresses

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Mon Aug 14 14:36:16 UTC 2017


Simon,

> On 20 Jun 2017, at 05:34, Simon Glass <sjg at chromium.org> wrote:
> 
> This series updates dtoc to support 64-bit addresses automatically. These
> appear in C code as fdt64_t arrays:
> 
> struct dtd_test1 {
> 	fdt64_t		reg[2];
> 
> };
> 
> static struct dtd_test1 dtv_test1 = {
> 	.reg		= {0x123400000000, 0x5678},
> };
> 
> C code can then process these address and size parents easily. This
> feature is controlled by the #address-cells and #size-cells values of the
> parent.
> 
> 
> Simon Glass (3):
>  dtoc: Adjust Node to record its parent
>  dtoc: Add a 64-bit type and a way to convert cells into 64 bits
>  dtoc: Add support for 32 or 64-bit addresses
> 
> tools/dtoc/dtb_platdata.py         |  62 +++++++++++
> tools/dtoc/dtoc_test_addr32.dts    |  27 +++++
> tools/dtoc/dtoc_test_addr32_64.dts |  33 ++++++
> tools/dtoc/dtoc_test_addr64.dts    |  33 ++++++
> tools/dtoc/dtoc_test_addr64_32.dts |  33 ++++++
> tools/dtoc/fdt.py                  |  14 +--
> tools/dtoc/fdt_util.py             |  14 +++
> tools/dtoc/test_dtoc.py            | 212 +++++++++++++++++++++++++++++++++++++
> 8 files changed, 422 insertions(+), 6 deletions(-)
> create mode 100644 tools/dtoc/dtoc_test_addr32.dts
> create mode 100644 tools/dtoc/dtoc_test_addr32_64.dts
> create mode 100644 tools/dtoc/dtoc_test_addr64.dts
> create mode 100644 tools/dtoc/dtoc_test_addr64_32.dts
> 
>
While testing this for the TPL stage of the RK3368, I triggered an error:
> Traceback (most recent call last):
>   File "./tools/dtoc/dtoc", line 76, in <module>
>     options.output)
>   File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/dtb_platdata.py", line 510, in run_steps
>     plat.scan_reg_sizes()
>   File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/dtb_platdata.py", line 297, in scan_reg_sizes
>     addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na)
>   File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/fdt_util.py", line 41, in fdt_cells_to_cpu
>     out = long(fdt32_to_cpu(val[0]))
>   File "/hgst-3tb/home/ptomsich/rk3399-spl/u-boot/tools/dtoc/fdt_util.py", line 30, in fdt32_to_cpu
>     return struct.unpack('>I', val)[0]
> struct.error: unpack requires a string argument of length 4
with the following DTS snippet:
> 	spi at ff120000 {
> 		compatible = "rockchip,rk3368-spi", "rockchip,rk3066-spi";
> 		reg = <0x0 0xff120000 0x0 0x1000>;
> 		clocks = <0xb 0x42 0xb 0x153>;
> 		clock-names = "spiclk", "apb_pclk";
> 		interrupts = <0x0 0x2d 0x4>;
> 		#address-cells = <0x1>;
> 		#size-cells = <0x0>;
> 		status = "okay";
> 		u-boot,dm-pre-reloc;
> 
> 		w25q32dw at 0 {
> 			u-boot,dm-pre-reloc;
> 			compatible = "spi-flash";
> 			reg = <0x0>;
> 			spi-max-frequency = <0x2f34f60>;
> 			spi-cpol;
> 			spi-cpha;
> 		};
> 	};

A bit of debug code shows that the error occurs during the processing of the 'w25q32dw at 0’ node.

Note that this is not a showstopper for the RK3368, as OF_PLATDATA is only used for TPL, which
performs a return-to-bootrom anyway (and I will be making this more explicit by using the 'dm-spl’
and ‘dm-tpl’ decorators).

Regards,
Phil.



More information about the U-Boot mailing list