[U-Boot] [PATCH 0/5] ARM: uniphier: consolidate defconfig files

Masahiro Yamada (5): ARM: uniphier: set DTB file name to fdt_file environment ARM: uniphier: drop fdt_file from CONFIG_EXTRA_ENV_SETTINGS ARM: uniphier: merge ph1_ld4_defconfig and ph1_sld8_defconfig ARM: uniphier: support ProXstream2, PH1-LD6b boards in single defconfig ARM: uniphier: rename defconfig files
MAINTAINERS | 2 +- arch/arm/mach-uniphier/board_late_init.c | 35 +++++++++++++++++++++ configs/ph1_sld8_defconfig | 30 ------------------ ...1_ld4_defconfig => uniphier_ld4_sld8_defconfig} | 1 + ...{ph1_pro4_defconfig => uniphier_pro4_defconfig} | 0 ...{ph1_pro5_defconfig => uniphier_pro5_defconfig} | 0 ...ld6b_defconfig => uniphier_pxs2_ld6b_defconfig} | 3 +- ...{ph1_sld3_defconfig => uniphier_sld3_defconfig} | 0 doc/README.uniphier | 36 ++++++++++++---------- include/configs/uniphier.h | 1 - 10 files changed, 59 insertions(+), 49 deletions(-) delete mode 100644 configs/ph1_sld8_defconfig rename configs/{ph1_ld4_defconfig => uniphier_ld4_sld8_defconfig} (95%) rename configs/{ph1_pro4_defconfig => uniphier_pro4_defconfig} (100%) rename configs/{ph1_pro5_defconfig => uniphier_pro5_defconfig} (100%) rename configs/{ph1_ld6b_defconfig => uniphier_pxs2_ld6b_defconfig} (88%) rename configs/{ph1_sld3_defconfig => uniphier_sld3_defconfig} (100%)

When we want to boot Linux with a DTB file downloaded from a TFTP server or somewhere, we need to know the file name to be downloaded.
Assume the U-Boot configuration is shared among some similar boards. If they are similar enough, the difference only appears in device trees. The build procedure would be like this:
- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a - Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b - Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c
In this case, the U-Boot image contains nothing about the DTB file name it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this purpose because it is painful to change it from "make menuconfig" for each board.)
This commit allows to lookup the DTB file name based on the compatible string and set it to "fdt_file" environment. Then "tftpboot $fdt_file" will download the file we want.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/mach-uniphier/board_late_init.c | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c index a7530eb..c2a3261 100644 --- a/arch/arm/mach-uniphier/board_late_init.c +++ b/arch/arm/mach-uniphier/board_late_init.c @@ -6,6 +6,7 @@
#include <common.h> #include <spl.h> +#include <libfdt.h> #include <nand.h> #include <linux/io.h> #include <../drivers/mtd/nand/denali.h> @@ -25,6 +26,38 @@ static void nand_denali_wp_disable(void) #endif }
+struct uniphier_fdt_file { + const char *compatible; + const char *file_name; +}; + +static const struct uniphier_fdt_file uniphier_fdt_files[] = { + { "socionext,ph1-ld4-ref", "uniphier-ph1-ld4-ref.dtb", }, + { "socionext,ph1-ld6b-ref", "uniphier-ph1-ld6b-ref.dtb", }, + { "socionext,ph1-ld10-ref", "uniphier-ph1-ld10-ref.dtb", }, + { "socionext,ph1-pro4-ref", "uniphier-ph1-pro4-ref.dtb", }, + { "socionext,ph1-pro5-4kbox", "uniphier-ph1-pro5-4kbox.dtb", }, + { "socionext,ph1-sld3-ref", "uniphier-ph1-sld3-ref.dtb", }, + { "socionext,ph1-sld8-ref", "uniphier-ph1-sld8-ref.dtb", }, + { "socionext,proxstream2-gentil", "uniphier-proxstream2-gentil.dtb", }, + { "socionext,proxstream2-vodka", "uniphier-proxstream2-vodka.dtb", }, +}; + +static void uniphier_set_fdt_file(void) +{ + DECLARE_GLOBAL_DATA_PTR; + int i; + + /* lookup DTB file name based on the compatible string */ + for (i = 0; i < ARRAY_SIZE(uniphier_fdt_files); i++) { + if (!fdt_node_check_compatible(gd->fdt_blob, 0, + uniphier_fdt_files[i].compatible)) { + setenv("fdt_file", uniphier_fdt_files[i].file_name); + return; + } + } +} + int board_late_init(void) { puts("MODE: "); @@ -48,5 +81,7 @@ int board_late_init(void) return -1; }
+ uniphier_set_fdt_file(); + return 0; }

Now this environment is run-time set to the DTB name U-Boot is really running with. Drop the static define.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
include/configs/uniphier.h | 1 - 1 file changed, 1 deletion(-)
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 0562598..b1106de 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -193,7 +193,6 @@ "fdt_addr=0x00100000\0" \ "fdt_addr_r=0x84100000\0" \ "fdt_size=0x00008000\0" \ - "fdt_file=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "kernel_addr=0x00200000\0" \ "kernel_addr_r=0x84200000\0" \ "kernel_size=0x00800000\0" \

These two are similar enough to be merged into a single defconfig file. Distinguish one from another by "DEVICE_TREE" from the command line. The how-to-build in doc/README.uniphier should be also updated.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
MAINTAINERS | 1 + configs/ph1_sld8_defconfig | 30 ---------------------- ...1_ld4_defconfig => uniphier_ld4_sld8_defconfig} | 1 + doc/README.uniphier | 12 ++++----- 4 files changed, 8 insertions(+), 36 deletions(-) delete mode 100644 configs/ph1_sld8_defconfig rename configs/{ph1_ld4_defconfig => uniphier_ld4_sld8_defconfig} (95%)
diff --git a/MAINTAINERS b/MAINTAINERS index 394be1e..18d8fce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -162,6 +162,7 @@ S: Maintained T: git git://git.denx.de/u-boot-uniphier.git F: arch/arm/mach-uniphier/ F: configs/ph1_*_defconfig +F: configs/uniphier_*_defconfig N: uniphier
ARM ZYNQ diff --git a/configs/ph1_sld8_defconfig b/configs/ph1_sld8_defconfig deleted file mode 100644 index 4474ec3..0000000 --- a/configs/ph1_sld8_defconfig +++ /dev/null @@ -1,30 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_UNIPHIER=y -CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_ARCH_UNIPHIER_PH1_SLD8=y -CONFIG_MICRO_SUPPORT_CARD=y -CONFIG_SYS_TEXT_BASE=0x84000000 -CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-sld8-ref" -CONFIG_HUSH_PARSER=y -# CONFIG_CMD_XIMG is not set -# CONFIG_CMD_ENV_EXISTS is not set -CONFIG_CMD_NAND=y -CONFIG_CMD_I2C=y -CONFIG_CMD_USB=y -# CONFIG_CMD_FPGA is not set -CONFIG_CMD_TFTPPUT=y -CONFIG_CMD_PING=y -CONFIG_CMD_TIME=y -# CONFIG_CMD_MISC is not set -CONFIG_NET_RANDOM_ETHADDR=y -CONFIG_SPL_SIMPLE_BUS=y -CONFIG_NAND_DENALI=y -CONFIG_SYS_NAND_DENALI_64BIT=y -CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8 -CONFIG_SPL_NAND_DENALI=y -CONFIG_PINCTRL=y -CONFIG_SPL_PINCTRL=y -CONFIG_UNIPHIER_SERIAL=y -CONFIG_USB=y -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_STORAGE=y diff --git a/configs/ph1_ld4_defconfig b/configs/uniphier_ld4_sld8_defconfig similarity index 95% rename from configs/ph1_ld4_defconfig rename to configs/uniphier_ld4_sld8_defconfig index 2ddd1eb..ee3cbad 100644 --- a/configs/ph1_ld4_defconfig +++ b/configs/uniphier_ld4_sld8_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_UNIPHIER=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ARCH_UNIPHIER_PH1_LD4=y +CONFIG_ARCH_UNIPHIER_PH1_SLD8=y CONFIG_MICRO_SUPPORT_CARD=y CONFIG_SYS_TEXT_BASE=0x84000000 CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-ld4-ref" diff --git a/doc/README.uniphier b/doc/README.uniphier index 57b947b..68cc05d 100644 --- a/doc/README.uniphier +++ b/doc/README.uniphier @@ -32,18 +32,18 @@ PH1-sLD3: $ make ph1_sld3_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
-PH1-LD4: - $ make ph1_ld4_defconfig +PH1-LD4 reference board: + $ make uniphier_ld4_sld8_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
+PH1-sLD8 reference board: + $ make uniphier_ld4_sld8_defconfig + $ make CROSS_COMPILE=arm-linux-gnueabi- DEVICE_TREE=uniphier-ph1-sld8-ref + PH1-Pro4: $ make ph1_pro4_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
-PH1-sLD8: - $ make ph1_sld8_defconfig - $ make CROSS_COMPILE=arm-linux-gnueabi- - PH1-Pro5: $ make ph1_pro5_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-

These boards are similar enough to be supported in a single defconfig file. Distinguish one from another by "DEVICE_TREE" from the command line. The how-to-build in doc/README.uniphier should be also updated.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
.../{ph1_ld6b_defconfig => uniphier_pxs2_ld6b_defconfig} | 3 ++- doc/README.uniphier | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename configs/{ph1_ld6b_defconfig => uniphier_pxs2_ld6b_defconfig} (88%)
diff --git a/configs/ph1_ld6b_defconfig b/configs/uniphier_pxs2_ld6b_defconfig similarity index 88% rename from configs/ph1_ld6b_defconfig rename to configs/uniphier_pxs2_ld6b_defconfig index bbcb344..f8cb794 100644 --- a/configs/ph1_ld6b_defconfig +++ b/configs/uniphier_pxs2_ld6b_defconfig @@ -1,10 +1,11 @@ CONFIG_ARM=y CONFIG_ARCH_UNIPHIER=y CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_ARCH_UNIPHIER_PROXSTREAM2=y CONFIG_ARCH_UNIPHIER_PH1_LD6B=y CONFIG_MICRO_SUPPORT_CARD=y CONFIG_SYS_TEXT_BASE=0x84000000 -CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-ld6b-ref" +CONFIG_DEFAULT_DEVICE_TREE="uniphier-proxstream2-vodka" CONFIG_HUSH_PARSER=y # CONFIG_CMD_XIMG is not set # CONFIG_CMD_ENV_EXISTS is not set diff --git a/doc/README.uniphier b/doc/README.uniphier index 68cc05d..7562e6f 100644 --- a/doc/README.uniphier +++ b/doc/README.uniphier @@ -48,14 +48,18 @@ PH1-Pro5: $ make ph1_pro5_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
-ProXstream2: - $ make pxs2_defconfig - $ make CROSS_COMPILE=arm-linux-gnueabi- +ProXstream2 Gentil board: + $ make uniphier_pxs2_ld6b_defconfig + $ make CROSS_COMPILE=arm-linux-gnueabi- DEVICE_TREE=uniphier-proxstream2-gentil
-PH1-LD6b: - $ make ph1_ld6b_defconfig +ProXstream2 Vodka board: + $ make uniphier_pxs2_ld6b_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
+PH1-LD6b reference board: + $ make uniphier_pxs2_ld6b_defconfig + $ make CROSS_COMPILE=arm-linux-gnueabi- DEVICE_TREE=uniphier-ph1-ld6b-ref + You may wish to change the "CROSS_COMPILE=arm-linux-gnueabi-" to use your favorite compiler.

Rename rest of defconfig files of UniPhier SoC family to have the prefix uniphier_.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
MAINTAINERS | 1 - configs/{ph1_pro4_defconfig => uniphier_pro4_defconfig} | 0 configs/{ph1_pro5_defconfig => uniphier_pro5_defconfig} | 0 configs/{ph1_sld3_defconfig => uniphier_sld3_defconfig} | 0 doc/README.uniphier | 12 ++++++------ 5 files changed, 6 insertions(+), 7 deletions(-) rename configs/{ph1_pro4_defconfig => uniphier_pro4_defconfig} (100%) rename configs/{ph1_pro5_defconfig => uniphier_pro5_defconfig} (100%) rename configs/{ph1_sld3_defconfig => uniphier_sld3_defconfig} (100%)
diff --git a/MAINTAINERS b/MAINTAINERS index 18d8fce..5b3c93a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -161,7 +161,6 @@ M: Masahiro Yamada yamada.masahiro@socionext.com S: Maintained T: git git://git.denx.de/u-boot-uniphier.git F: arch/arm/mach-uniphier/ -F: configs/ph1_*_defconfig F: configs/uniphier_*_defconfig N: uniphier
diff --git a/configs/ph1_pro4_defconfig b/configs/uniphier_pro4_defconfig similarity index 100% rename from configs/ph1_pro4_defconfig rename to configs/uniphier_pro4_defconfig diff --git a/configs/ph1_pro5_defconfig b/configs/uniphier_pro5_defconfig similarity index 100% rename from configs/ph1_pro5_defconfig rename to configs/uniphier_pro5_defconfig diff --git a/configs/ph1_sld3_defconfig b/configs/uniphier_sld3_defconfig similarity index 100% rename from configs/ph1_sld3_defconfig rename to configs/uniphier_sld3_defconfig diff --git a/doc/README.uniphier b/doc/README.uniphier index 7562e6f..f0f5346 100644 --- a/doc/README.uniphier +++ b/doc/README.uniphier @@ -28,8 +28,8 @@ Tested toolchains Compile the source ------------------
-PH1-sLD3: - $ make ph1_sld3_defconfig +PH1-sLD3 reference board: + $ make uniphier_sld3_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
PH1-LD4 reference board: @@ -40,12 +40,12 @@ PH1-sLD8 reference board: $ make uniphier_ld4_sld8_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi- DEVICE_TREE=uniphier-ph1-sld8-ref
-PH1-Pro4: - $ make ph1_pro4_defconfig +PH1-Pro4 reference board: + $ make uniphier_pro4_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
-PH1-Pro5: - $ make ph1_pro5_defconfig +PH1-Pro5 4KBOX Board: + $ make uniphier_pro5_defconfig $ make CROSS_COMPILE=arm-linux-gnueabi-
ProXstream2 Gentil board:

2015-12-17 18:00 GMT+09:00 Masahiro Yamada yamada.masahiro@socionext.com:
Masahiro Yamada (5): ARM: uniphier: set DTB file name to fdt_file environment ARM: uniphier: drop fdt_file from CONFIG_EXTRA_ENV_SETTINGS ARM: uniphier: merge ph1_ld4_defconfig and ph1_sld8_defconfig ARM: uniphier: support ProXstream2, PH1-LD6b boards in single defconfig ARM: uniphier: rename defconfig files
Series, applied to u-boot-uniphier/master.
participants (1)
-
Masahiro Yamada