[PATCH v2 17/35] common: Move device-tree setup functions to fdt_support.h

Simon Glass sjg at chromium.org
Sat Dec 28 18:44:54 CET 2019


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 at chromium.org>
---

Changes in v2: None

 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 e96137a50c..d1d1573c62 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 4c220fa8e1..49d085acf9 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 45650b4f08..e7f684bfb3 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 c2fa60e321..66eea32e07 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 31e41ce169..d138c9384e 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 e4527c19b8..90c1824e46 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 eda5cc7a9e..8de13c88f6 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 3efdbe9a69..377f4b7bce 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 8039fd55f4..532ca89d94 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 c4ff6775c3..3f09c5150c 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 55a3529296..1445d29bad 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 6c47cb2b38..e513d0bfd5 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 c9f2ac44a6..d4922fe1e1 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 913b5843e9..0996b87c0f 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 81b3f00b56..a2e284f1a2 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 78f89fc4cb..95ed0ef429 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 85f8517d79..e42337e47a 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 ab07c1f8dd..eee09a5701 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 61dedf4c06..92dd9237ec 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 7dacd0c5f1..dc3b59d26f 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 6c34db4219..79cc1543f9 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 3ac61f009c..b5c20112d0 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 da050bf800..104b40a110 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 11f7489fa2..5608774afd 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 48aa6b6822..8015666ecc 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 940ae82c45..28f5cf7fc4 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 caa36064f0..2b6e4df86f 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 5969d51395..161f5bd8d0 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 88914c80e8..d852a01024 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 a647de6b11..9051392cd0 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 d12f1ebfdf..36f86926bc 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 c755821b74..c57473c802 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 79b8363b86..94001a4dc3 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 04941b26be..95f95a5c82 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 0515ebbad2..13429072c7 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 781a07f1d8..2ea762ccfa 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 4ee14f78d0..463eeb5d43 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 2286ea7793..6c04c52eec 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -11,6 +11,20 @@
 
 #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,
-- 
2.24.1.735.g03f4e72817-goog



More information about the U-Boot mailing list