From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Sun, 24 Feb 2019 08:39:59 -0800 Subject: [U-Boot] [RFC 03/22] thunderx: add FDT support In-Reply-To: <20190222180319.32221-4-tharvey@gateworks.com> References: <20190222180319.32221-1-tharvey@gateworks.com> <20190222180319.32221-4-tharvey@gateworks.com> Message-ID: <189844e2-9adf-96b3-81c4-48e80b7e6819@csgraf.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 22.02.19 19:03, Tim Harvey wrote: > The thunderx boards use the Cavium Bringup and Diagnostics Kit (BDK) as a > secondary program loader (SPL). This initial boot firmware loads the > device-tree and passes it to the next layer of software in X1. > > Signed-off-by: Tim Harvey In the long run we maybe want to standardize on CONFIG_OF_PRIOR_STAGE for aarch64 as well and then move rpi as well as this target over to it. But for now, I think this solution is very reasonable. > --- > arch/arm/mach-thunderx/Makefile | 2 +- > arch/arm/mach-thunderx/fdt.c | 50 ++++++++++++++++++++++++++ > arch/arm/mach-thunderx/lowlevel_init.S | 31 ++++++++++++++++ > board/cavium/thunderx/thunderx.c | 12 +++++-- > 4 files changed, 92 insertions(+), 3 deletions(-) > create mode 100644 arch/arm/mach-thunderx/fdt.c > create mode 100644 arch/arm/mach-thunderx/lowlevel_init.S > > diff --git a/arch/arm/mach-thunderx/Makefile b/arch/arm/mach-thunderx/Makefile > index 34b6ecc2f9..fb457cb3e0 100644 > --- a/arch/arm/mach-thunderx/Makefile > +++ b/arch/arm/mach-thunderx/Makefile > @@ -1,2 +1,2 @@ > # SPDX-License-Identifier: GPL-2.0+ > -obj-y := atf.o > +obj-y := atf.o lowlevel_init.o fdt.o > diff --git a/arch/arm/mach-thunderx/fdt.c b/arch/arm/mach-thunderx/fdt.c > new file mode 100644 > index 0000000000..31f1128e9f > --- /dev/null > +++ b/arch/arm/mach-thunderx/fdt.c > @@ -0,0 +1,50 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/** > + * Copyright (C) 2014, Cavium Inc. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +/* From lowlevel_init.S */ > +extern unsigned long fdt_base_addr; > + > +/** > + * If the firmware passed a device tree use it for U-Boot > + * > + * @return FDT base address received from ATF in x1 register > + */ > +void *board_fdt_blob_setup(void) > +{ > + if (fdt_magic(fdt_base_addr) != FDT_MAGIC) > + return NULL; > + return (void *)fdt_base_addr; > +} > + > +int ft_board_setup(void *blob, bd_t *bd) > +{ > + int offset; > + int ret = 0; > + > + debug("%s\n", __func__); > + ret = fdt_check_header(blob); > + if (ret < 0) { > + printf("ERROR: %s\n", fdt_strerror(ret)); > + return ret; > + } > + > + /* remove "cavium, bdk" node from DT */ > + if (blob) { > + offset = fdt_path_offset(blob, "/cavium,bdk"); > + if(offset >= 0) { > + ret = fdt_del_node(blob, offset); > + debug("%s deleted 'cavium,bdk' node\n", __func__); Why remove it? Alex