From 7fefef5078d427e5b9e22e19352d492029cea6f2 Mon Sep 17 00:00:00 2001 From: Simon Glass <sjg@chromium.org> Date: Sat, 28 Dec 2019 10:44:54 -0700 Subject: [PATCH] common: Move device-tree setup functions to fdt_support.h These functions relate to setting up the device tree for booting the OS. The fdt_support.h header file supports similar functions, so move these there. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/riscv/lib/bootm.c | 1 + board/esd/vme8349/vme8349.c | 1 + board/freescale/b4860qds/b4860qds.c | 1 + board/freescale/corenet_ds/corenet_ds.c | 1 + board/freescale/ls1012afrdm/ls1012afrdm.c | 1 + board/freescale/ls1012ardb/ls1012ardb.c | 1 + board/freescale/ls1021aiot/ls1021aiot.c | 1 + board/freescale/ls1021aqds/ls1021aqds.c | 1 + board/freescale/ls1021atsn/ls1021atsn.c | 1 + board/freescale/ls1021atwr/ls1021atwr.c | 1 + board/freescale/mpc8313erdb/mpc8313erdb.c | 1 + board/freescale/mpc8323erdb/mpc8323erdb.c | 1 + board/freescale/mpc832xemds/mpc832xemds.c | 1 + board/freescale/mpc8349emds/mpc8349emds.c | 1 + board/freescale/mpc8349itx/mpc8349itx.c | 1 + board/freescale/p2041rdb/p2041rdb.c | 1 + board/freescale/t102xqds/t102xqds.c | 1 + board/freescale/t102xrdb/t102xrdb.c | 1 + board/freescale/t1040qds/t1040qds.c | 1 + board/freescale/t104xrdb/t104xrdb.c | 1 + board/freescale/t208xqds/t208xqds.c | 1 + board/freescale/t208xrdb/t208xrdb.c | 1 + board/freescale/t4qds/t4240emu.c | 1 + board/freescale/t4qds/t4240qds.c | 1 + board/freescale/t4rdb/t4240rdb.c | 1 + board/hisilicon/hikey/hikey.c | 1 + board/ids/ids8313/ids8313.c | 1 + board/keymile/km83xx/km83xx.c | 1 + board/keymile/kmp204x/kmp204x.c | 1 + board/sbc8349/sbc8349.c | 1 + board/ti/am43xx/board.c | 1 + board/ti/am57xx/board.c | 1 + board/ti/dra7xx/evm.c | 1 + board/tqc/tqm834x/tqm834x.c | 1 + board/varisys/cyrus/cyrus.c | 1 + board/ve8313/ve8313.c | 1 + include/common.h | 12 ------------ include/fdt_support.h | 14 ++++++++++++++ 38 files changed, 50 insertions(+), 12 deletions(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index e96137a50cb..d1d1573c622 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -9,6 +9,7 @@ #include <common.h> #include <command.h> #include <dm.h> +#include <fdt_support.h> #include <dm/root.h> #include <image.h> #include <asm/byteorder.h> diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c index 4c220fa8e13..49d085acf98 100644 --- a/board/esd/vme8349/vme8349.c +++ b/board/esd/vme8349/vme8349.c @@ -12,6 +12,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <ioports.h> #include <mpc83xx.h> #include <asm/mpc8349_pci.h> diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c index 45650b4f088..e7f684bfb3a 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <irq_func.h> diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index c2fa60e321b..66eea32e077 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <netdev.h> #include <linux/compiler.h> diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c index 31e41ce1696..d138c9384eb 100644 --- a/board/freescale/ls1012afrdm/ls1012afrdm.c +++ b/board/freescale/ls1012afrdm/ls1012afrdm.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <i2c.h> #include <asm/io.h> #include <asm/arch/clock.h> diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index e4527c19b88..90c1824e467 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <i2c.h> #include <asm/io.h> #include <asm/arch/clock.h> diff --git a/board/freescale/ls1021aiot/ls1021aiot.c b/board/freescale/ls1021aiot/ls1021aiot.c index eda5cc7a9ed..8de13c88f64 100644 --- a/board/freescale/ls1021aiot/ls1021aiot.c +++ b/board/freescale/ls1021aiot/ls1021aiot.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <asm/arch/immap_ls102xa.h> #include <asm/arch/clock.h> diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c index 3efdbe9a690..377f4b7bce0 100644 --- a/board/freescale/ls1021aqds/ls1021aqds.c +++ b/board/freescale/ls1021aqds/ls1021aqds.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <asm/io.h> diff --git a/board/freescale/ls1021atsn/ls1021atsn.c b/board/freescale/ls1021atsn/ls1021atsn.c index 8039fd55f47..532ca89d945 100644 --- a/board/freescale/ls1021atsn/ls1021atsn.c +++ b/board/freescale/ls1021atsn/ls1021atsn.c @@ -2,6 +2,7 @@ /* Copyright 2016-2019 NXP Semiconductors */ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <asm/arch-ls102xa/ls102xa_soc.h> #include <asm/arch/ls102xa_devdis.h> diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index c4ff6775c3b..3f09c5150c6 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <asm/io.h> diff --git a/board/freescale/mpc8313erdb/mpc8313erdb.c b/board/freescale/mpc8313erdb/mpc8313erdb.c index 55a3529296d..1445d29bad2 100644 --- a/board/freescale/mpc8313erdb/mpc8313erdb.c +++ b/board/freescale/mpc8313erdb/mpc8313erdb.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <init.h> #if defined(CONFIG_OF_LIBFDT) #include <linux/libfdt.h> diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c index 6c47cb2b383..e513d0bfd53 100644 --- a/board/freescale/mpc8323erdb/mpc8323erdb.c +++ b/board/freescale/mpc8323erdb/mpc8323erdb.c @@ -12,6 +12,7 @@ #include <common.h> #include <eeprom.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <ioports.h> #include <mpc83xx.h> diff --git a/board/freescale/mpc832xemds/mpc832xemds.c b/board/freescale/mpc832xemds/mpc832xemds.c index c9f2ac44a62..d4922fe1e12 100644 --- a/board/freescale/mpc832xemds/mpc832xemds.c +++ b/board/freescale/mpc832xemds/mpc832xemds.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <ioports.h> #include <mpc83xx.h> diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c index 913b5843e95..0996b87c0fc 100644 --- a/board/freescale/mpc8349emds/mpc8349emds.c +++ b/board/freescale/mpc8349emds/mpc8349emds.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <ioports.h> #include <mpc83xx.h> #include <asm/mpc8349_pci.h> diff --git a/board/freescale/mpc8349itx/mpc8349itx.c b/board/freescale/mpc8349itx/mpc8349itx.c index 81b3f00b56e..a2e284f1a22 100644 --- a/board/freescale/mpc8349itx/mpc8349itx.c +++ b/board/freescale/mpc8349itx/mpc8349itx.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <ioports.h> #include <mpc83xx.h> #include <i2c.h> diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c index 78f89fc4cb7..95ed0ef429e 100644 --- a/board/freescale/p2041rdb/p2041rdb.c +++ b/board/freescale/p2041rdb/p2041rdb.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <netdev.h> #include <linux/compiler.h> diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c index 85f8517d798..e42337e47a4 100644 --- a/board/freescale/t102xqds/t102xqds.c +++ b/board/freescale/t102xqds/t102xqds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index ab07c1f8ddb..eee09a57019 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c index 61dedf4c06c..92dd9237ec7 100644 --- a/board/freescale/t1040qds/t1040qds.c +++ b/board/freescale/t1040qds/t1040qds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c index 7dacd0c5f1f..dc3b59d26f9 100644 --- a/board/freescale/t104xrdb/t104xrdb.c +++ b/board/freescale/t104xrdb/t104xrdb.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <hwconfig.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c index 6c34db42199..79cc1543f95 100644 --- a/board/freescale/t208xqds/t208xqds.c +++ b/board/freescale/t208xqds/t208xqds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c index 3ac61f009c9..b5c20112d0e 100644 --- a/board/freescale/t208xrdb/t208xrdb.c +++ b/board/freescale/t208xrdb/t208xrdb.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c index da050bf800f..104b40a1109 100644 --- a/board/freescale/t4qds/t4240emu.c +++ b/board/freescale/t4qds/t4240emu.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c index 11f7489fa21..5608774afd1 100644 --- a/board/freescale/t4qds/t4240qds.c +++ b/board/freescale/t4qds/t4240qds.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <irq_func.h> diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c index 48aa6b6822e..8015666eccd 100644 --- a/board/freescale/t4rdb/t4240rdb.c +++ b/board/freescale/t4rdb/t4240rdb.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <netdev.h> diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c index 940ae82c45b..28f5cf7fc4c 100644 --- a/board/hisilicon/hikey/hikey.c +++ b/board/hisilicon/hikey/hikey.c @@ -5,6 +5,7 @@ */ #include <common.h> #include <dm.h> +#include <fdt_support.h> #include <dm/platform_data/serial_pl01x.h> #include <errno.h> #include <malloc.h> diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c index caa36064f05..2b6e4df86f2 100644 --- a/board/ids/ids8313/ids8313.c +++ b/board/ids/ids8313/ids8313.c @@ -12,6 +12,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <mpc83xx.h> #include <spi.h> #include <linux/libfdt.h> diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index feca7be3727..23bbdcccacf 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -15,6 +15,7 @@ #include <common.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <ioports.h> #include <mpc83xx.h> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c index 9e1956c8b7f..cfb23a53f74 100644 --- a/board/keymile/kmp204x/kmp204x.c +++ b/board/keymile/kmp204x/kmp204x.c @@ -9,6 +9,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <netdev.h> #include <linux/compiler.h> diff --git a/board/sbc8349/sbc8349.c b/board/sbc8349/sbc8349.c index a647de6b112..9051392cd09 100644 --- a/board/sbc8349/sbc8349.c +++ b/board/sbc8349/sbc8349.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <ioports.h> #include <mpc83xx.h> #include <asm/mpc8349_pci.h> diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index d12f1ebfdf9..36f86926bc3 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -10,6 +10,7 @@ #include <common.h> #include <eeprom.h> #include <env.h> +#include <fdt_support.h> #include <i2c.h> #include <init.h> #include <linux/errno.h> diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index c755821b74f..c57473c8024 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -9,6 +9,7 @@ #include <common.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <palmas.h> #include <sata.h> diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index 79b8363b868..94001a4dc39 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -11,6 +11,7 @@ */ #include <common.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <palmas.h> #include <sata.h> diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c index 04941b26be4..95f95a5c820 100644 --- a/board/tqc/tqm834x/tqm834x.c +++ b/board/tqc/tqm834x/tqm834x.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <ioports.h> #include <mpc83xx.h> #include <asm/mpc8349_pci.h> diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c index 0515ebbad24..13429072c79 100644 --- a/board/varisys/cyrus/cyrus.c +++ b/board/varisys/cyrus/cyrus.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <fdt_support.h> #include <init.h> #include <netdev.h> #include <linux/compiler.h> diff --git a/board/ve8313/ve8313.c b/board/ve8313/ve8313.c index 781a07f1d83..2ea762ccfa4 100644 --- a/board/ve8313/ve8313.c +++ b/board/ve8313/ve8313.c @@ -9,6 +9,7 @@ */ #include <common.h> +#include <fdt_support.h> #include <init.h> #include <linux/libfdt.h> #include <pci.h> diff --git a/include/common.h b/include/common.h index 4ee14f78d0a..463eeb5d43f 100644 --- a/include/common.h +++ b/include/common.h @@ -59,16 +59,6 @@ void hang (void) __attribute__ ((noreturn)); #include <display_options.h> -/** - * arch_fixup_fdt() - Write arch-specific information to fdt - * - * Defined in arch/$(ARCH)/lib/bootm-fdt.c - * - * @blob: FDT blob to write to - * @return 0 if ok, or -ve FDT_ERR_... on failure - */ -int arch_fixup_fdt(void *blob); - /* common/cmd_source.c */ int source (ulong addr, const char *fit_uname); @@ -90,8 +80,6 @@ void upmconfig (unsigned int, unsigned int *, unsigned int); ulong get_tbclk (void); void reset_misc (void); void reset_cpu (ulong addr); -void ft_cpu_setup(void *blob, bd_t *bd); -void ft_pci_setup(void *blob, bd_t *bd); /* $(CPU)/speed.c */ int get_clocks (void); diff --git a/include/fdt_support.h b/include/fdt_support.h index 3f4bc643d44..ba14acd7f62 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -12,6 +12,20 @@ #include <asm/u-boot.h> #include <linux/libfdt.h> +/** + * arch_fixup_fdt() - Write arch-specific information to fdt + * + * Defined in arch/$(ARCH)/lib/bootm-fdt.c + * + * @blob: FDT blob to write to + * @return 0 if ok, or -ve FDT_ERR_... on failure + */ +int arch_fixup_fdt(void *blob); + +void ft_cpu_setup(void *blob, bd_t *bd); + +void ft_pci_setup(void *blob, bd_t *bd); + u32 fdt_getprop_u32_default_node(const void *fdt, int off, int cell, const char *prop, const u32 dflt); u32 fdt_getprop_u32_default(const void *fdt, const char *path, -- GitLab