From 48aee0afb62ee4ce11dd882600cfbcda60efb563 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 26 Oct 2020 09:31:42 +0100 Subject: cmd: Kconfig: migrate CONFIG_SYS_PROMPT_HUSH_PS2 Move CONFIG_SYS_PROMPT_HUSH_PS2 in Kconfig, depending on CONFIG_HUSH_PARSER, and remove the default value defined in cli_hush.c under __U_BOOT__. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- scripts/config_whitelist.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 8b4fcba395..31acc36d4c 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -3508,7 +3508,6 @@ CONFIG_SYS_POST_WATCHDOG CONFIG_SYS_POST_WORD_ADDR CONFIG_SYS_PPC_DDR_WIMGE CONFIG_SYS_PQSPAR -CONFIG_SYS_PROMPT_HUSH_PS2 CONFIG_SYS_PSDPAR CONFIG_SYS_PSSR_VAL CONFIG_SYS_PTCPAR -- cgit From b7bbd553de0d9752f919dfc616f560f6f2504c14 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Dec 2020 16:55:24 -0700 Subject: checkpatch: Add warnings for unexpected struct names As a way of keeping the driver declarations more consistent, add a warning if the struct used does not end with _priv or _plat. Signed-off-by: Simon Glass --- scripts/checkpatch.pl | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4ed7e124c9..01ab570a16 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2320,6 +2320,23 @@ sub get_raw_comment { return $comment; } +# Args: +# line: Patch line to check +# auto: Auto variable name, e.g. "per_child_auto" +# suffix: Suffix to expect on member, e.g. "_priv" +# warning: Warning name, e.g. "PRIV_AUTO" +sub u_boot_struct_name { + my ($line, $auto, $suffix, $warning) = @_; + + # Use _priv as a suffix for the device-private data struct + if ($line =~ /^\+\s*\.${auto}\s*=\s*sizeof\(struct\((\w+)\).*/) { + my $struct_name = $1; + if ($struct_name !~ /^\w+${suffix}/) { + WARN($warning, "struct \'$struct_name\' should have a ${suffix} suffix"); + } + } +} + # Checks specific to U-Boot sub u_boot_line { my ($realfile, $line, $rawline, $herecurr) = @_; @@ -2371,6 +2388,27 @@ sub u_boot_line { ERROR("CONFIG_IS_ENABLED_CONFIG", "CONFIG_IS_ENABLED() takes values without the CONFIG_ prefix\n" . $herecurr); } + + # Use _priv as a suffix for the device-private data struct + if ($line =~ /^\+\s*\.priv_auto\s*=\s*sizeof\(struct\((\w+)\).*/) { + my $struct_name = $1; + if ($struct_name !~ /^\w+_priv/) { + WARN("PRIV_AUTO", "struct \'$struct_name\' should have a _priv suffix"); + } + } + + # Check struct names for the 'auto' members of struct driver + u_boot_struct_name($line, "priv_auto", "_priv", "PRIV_AUTO"); + u_boot_struct_name($line, "plat_auto", "_plat", "PLAT_AUTO"); + u_boot_struct_name($line, "per_child_auto", "_priv", "CHILD_PRIV_AUTO"); + u_boot_struct_name($line, "per_child_plat_auto", "_plat", + "CHILD_PLAT_AUTO"); + + # Now the ones for struct uclass, skipping those in common with above + u_boot_struct_name($line, "per_device_auto", "_priv", + "DEVICE_PRIV_AUTO"); + u_boot_struct_name($line, "per_device_plat_auto", "_plat", + "DEVICE_PLAT_AUTO"); } sub process { -- cgit From 53db2eec7aa60b07f11c9d46f12041b571319dbc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:13 -0700 Subject: Makefile: Build a separate .dtb for TPL At present both SPL and TPL use the same devicetree binary. While there is logic to run fdtgrep separately on each one, it does not actually happen. Add a new TPL rule and use that instead. Make this rule conditional on there actually being a TPL. Do the same for SPL for consistency. Note that the SPL and TPL dtbs are build by a Makefule rule used for U-Boot proper. This is the 'dtbs' target in dts/Makefile. So the check for CONFIG_TPL_BUILD in cmd_fdtgrep never actually works at present. We don't support CONFIG_OF_EMBED for TPL at present. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 9f1f7445d7..8ebe6a9840 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -31,8 +31,10 @@ endif ifeq ($(CONFIG_TPL_BUILD),y) SPL_BIN := u-boot-tpl +SPL_NAME := tpl else SPL_BIN := u-boot-spl +SPL_NAME := spl endif ifdef CONFIG_SPL_BUILD @@ -298,7 +300,7 @@ $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; -$(obj)/$(SPL_BIN).dtb: dts/dt-spl.dtb FORCE +$(obj)/$(SPL_BIN).dtb: dts/dt-$(SPL_NAME).dtb FORCE $(call if_changed,copy) pythonpath = PYTHONPATH=scripts/dtc/pylibfdt -- cgit From de3e372abdb553ff3a79f12830bb90252059f662 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:14 -0700 Subject: Makefile: Build SPL dtbs in the spl/ directory Rather than putting these in the top-level dts/ directory (which is intended for U-Boot proper), put them in the correct subdirectory for SPL (either spl/ or tpl/). This is where other SPL targets are kept, so this is more consistent. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 8ebe6a9840..e83e93e5fc 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -300,7 +300,7 @@ $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; -$(obj)/$(SPL_BIN).dtb: dts/dt-$(SPL_NAME).dtb FORCE +$(obj)/$(SPL_BIN).dtb: $(obj)/dts/dt-$(SPL_NAME).dtb FORCE $(call if_changed,copy) pythonpath = PYTHONPATH=scripts/dtc/pylibfdt -- cgit From c7674fcb0748a9a15853be7728c3ae887feb75c8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:15 -0700 Subject: Makefile: Tidy up SPL dtb production Use the SPL_NAME variable to simplify the rules. Drop the SPL targets clean-files since the SPL and TPL dts/ directories are removed by existing rules. Move the SPL rules into a new spl_dtbs to avoid the complicated $(if) construct. Also drop unused pieces from the 'targets' variable. With this, SPL and TPL have separate dtbs which respect the various u-boot,dm-spl / u-boot,dm-tpl tags. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index e83e93e5fc..c92963833b 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -37,6 +37,8 @@ SPL_BIN := u-boot-spl SPL_NAME := spl endif +export SPL_NAME + ifdef CONFIG_SPL_BUILD SPL_ := SPL_ ifeq ($(CONFIG_TPL_BUILD),y) @@ -459,9 +461,8 @@ endif PHONY += FORCE FORCE: -PHONY += dtbs -dtbs: - $(Q)$(MAKE) $(build)=dts dtbs +$(obj)/dts/dt-$(SPL_NAME).dtb: dts/dt.dtb + $(Q)$(MAKE) $(build)=$(obj)/dts spl_dtbs # Declare the contents of the .PHONY variable as phony. We keep that # information in a variable so we can use it in if_changed and friends. -- cgit From aa88ac884c998ab521b3a433e963bc001d31e5d8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:16 -0700 Subject: Makefile: Use common args for dtoc At present the dtoc commmand line is repeated twice in the Makefile. Use a variable to avoid this, so it is easier to add more conditional arguments. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index c92963833b..161c15b200 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -307,11 +307,14 @@ $(obj)/$(SPL_BIN).dtb: $(obj)/dts/dt-$(SPL_NAME).dtb FORCE pythonpath = PYTHONPATH=scripts/dtc/pylibfdt +DTOC_ARGS := $(pythonpath) $(srctree)/tools/dtoc/dtoc \ + -d $(obj)/$(SPL_BIN).dtb + quiet_cmd_dtocc = DTOC C $@ -cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata +cmd_dtocc = $(DTOC_ARGS) -o $@ platdata quiet_cmd_dtoch = DTOC H $@ -cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct +cmd_dtoch = $(DTOC_ARGS) -o $@ struct quiet_cmd_plat = PLAT $@ cmd_plat = $(CC) $(c_flags) -c $< -o $(filter-out $(PHONY),$@) -- cgit From be3bd3bb177ec913050745131687089c1ff69c44 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 28 Dec 2020 20:34:53 -0700 Subject: Makefile: Invoke dtoc only once Update the Makefile to run dtoc only once, generating all required files. This saves time since there is a lot of processing in each invocation of dtoc. We already have a variable for the object files to build, so use that instead of repeating the same filenames. Add a C version of this also, for the same reason. This makes it easier to add new C files (generated by dtoc) to the build later, as needed. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 161c15b200..3d60cf5120 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -121,6 +121,7 @@ u-boot-spl-init := $(head-y) u-boot-spl-main := $(libs-y) ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA u-boot-spl-platdata := $(obj)/dts/dt-platdata.o +u-boot-spl-platdata_c := $(patsubst %.o,%.c,$(u-boot-spl-platdata)) endif # Linker Script @@ -310,17 +311,15 @@ pythonpath = PYTHONPATH=scripts/dtc/pylibfdt DTOC_ARGS := $(pythonpath) $(srctree)/tools/dtoc/dtoc \ -d $(obj)/$(SPL_BIN).dtb -quiet_cmd_dtocc = DTOC C $@ -cmd_dtocc = $(DTOC_ARGS) -o $@ platdata - -quiet_cmd_dtoch = DTOC H $@ -cmd_dtoch = $(DTOC_ARGS) -o $@ struct +quiet_cmd_dtoc = DTOC $@ +cmd_dtoc = $(DTOC_ARGS) -c $(obj)/dts -C include/generated all quiet_cmd_plat = PLAT $@ cmd_plat = $(CC) $(c_flags) -c $< -o $(filter-out $(PHONY),$@) -targets += $(obj)/dts/dt-platdata.o -$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c \ +targets += $(u-boot-spl-platdata) + +$(obj)/dts/dt-%.o: $(obj)/dts/dt-%.c \ include/generated/dt-structs-gen.h prepare FORCE $(call if_changed,plat) @@ -328,11 +327,9 @@ PHONY += dts_dir dts_dir: $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) -include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir FORCE - $(call if_changed,dtoch) - -$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir FORCE - $(call if_changed,dtocc) +include/generated/dt-structs-gen.h $(u-boot-spl-platdata_c) &: \ + $(obj)/$(SPL_BIN).dtb dts_dir FORCE + $(call if_changed,dtoc) ifdef CONFIG_SAMSUNG ifdef CONFIG_VAR_SIZE_SPL -- cgit From f31fa99a9ed92c223fbf56e07eae57e7bdea19ae Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 28 Dec 2020 20:35:01 -0700 Subject: dtoc: Rename dt-platdata.c to dt-plat.c Use this new name to be consistent with the rest of U-Boot, which talks about 'plat' for the platform data, which is what this file holds. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 3d60cf5120..87021e22e5 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -120,7 +120,7 @@ endif u-boot-spl-init := $(head-y) u-boot-spl-main := $(libs-y) ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA -u-boot-spl-platdata := $(obj)/dts/dt-platdata.o +u-boot-spl-platdata := $(obj)/dts/dt-plat.o u-boot-spl-platdata_c := $(patsubst %.o,%.c,$(u-boot-spl-platdata)) endif -- cgit