[PATCH] fw_env: autodetect NAND erase size and env sectors
From: Anthony Loiseau As already done for NOR chips, if device ESIZE and ENVSECTORS static configurations are both zero, then autodetect them at runtime. Cc: Joe Hershberger Cc: Stefan Agner Signed-off-by: Anthony Loiseau --- tools/env/README | 3 +++ tools/env/fw_env.c | 11 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/env/README b/tools/env/README index 480a893202..b8c6a7e197 100644 --- a/tools/env/README +++ b/tools/env/README @@ -58,6 +58,9 @@ DEVICEx_ENVSECTORS defines the number of sectors that may be used for this environment instance. On NAND this is used to limit the range within which bad blocks are skipped, on NOR it is not used. +If DEVICEx_ESIZE and DEVICEx_ENVSECTORS are both zero, then a runtime +detection is attempted for NOR and NAND mtd types. + To prevent losing changes to the environment and to prevent confusing the MTD drivers, a lock file at /run/fw_printenv.lock is used to serialize access to the environment. diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index c9a8774ace..9f57f19d80 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1659,8 +1659,15 @@ static int check_device_config(int dev) } DEVTYPE(dev) = mtdinfo.type; if (DEVESIZE(dev) == 0 && ENVSECTORS(dev) == 0 && - mtdinfo.type == MTD_NORFLASH) - DEVESIZE(dev) = mtdinfo.erasesize; + mtdinfo.erasesize > 0) { + if (mtdinfo.type == MTD_NORFLASH) + DEVESIZE(dev) = mtdinfo.erasesize; + else if (mtdinfo.type == MTD_NANDFLASH) { + DEVESIZE(dev) = mtdinfo.erasesize; + ENVSECTORS(dev) = + mtdinfo.size / mtdinfo.erasesize; + } + } if (DEVESIZE(dev) == 0) /* Assume the erase size is the same as the env-size */ DEVESIZE(dev) = ENVSIZE(dev); -- 2.11.0
fw_env: auto-detect NAND characteristics
Hello, Please find attached a patch proposal which modifies fw_env so NAND chip erase size as well as environment sector counts are guessed at runtime if they are both statically configured as zero. This actually extend a previous similar behavior which was NOR-specific, useful when a same RootFS is executed with several flash chips. Be aware that I did not test this exact patch for real. I extracted it from my older u-boot-flsc 2016 tree on which it works well, and built it using a sandbox configuration, without running it. I only checked my gcc was happy with those lines (no warning added). My feeling is that this patch is small enough to be confident it will work on master as it worked on my old tree. Opened to any review or request, best rergards, Anthony Loiseau
[PATCH v2 0/1] fw_env: auto-detect NAND characteristics
From: Anthony Loiseau Hello, Here is a patch proposal which modifies fw_env so NAND chip erase size as well as environment sector counts are guessed at runtime if they are both statically configured as zero. This actually extends a previous similar behavior which was NOR-specific, useful when a same RootFS is executed with several flash chips, see e282c422e0b. Be aware that I did not test this exact patch for real. I extracted it from my older u-boot-flsc 2016 tree on which it works well, and built it using a sandbox configuration, without running it. I only checked my gcc was happy with those lines (no warnings added). My feeling is that this patch is small enough to feel confident it will work on master as it worked on my old tree. Opened to any reviews or requests, best rergards, Anthony Loiseau v1: initial buggy submission (broken thread) stephan toradex email no more valid v2: fix cover letter use another email for Stefan cc Rasmus (author of the changed lines) Cc: Joe Hershberger cc: Stefan Agner cc: Rasmus Villemoes Signed-off-by: Anthony Loiseau Anthony Loiseau (1): fw_env: autodetect NAND erase size and env sectors tools/env/README | 3 +++ tools/env/fw_env.c | 11 +-- 2 files changed, 12 insertions(+), 2 deletions(-) -- 2.11.0
[PATCH v2 1/1] fw_env: autodetect NAND erase size and env sectors
From: Anthony Loiseau As already done for NOR chips, if device ESIZE and ENVSECTORS static configurations are both zero, then autodetect them at runtime. Cc: Joe Hershberger cc: Stefan Agner cc: Rasmus Villemoes Signed-off-by: Anthony Loiseau --- tools/env/README | 3 +++ tools/env/fw_env.c | 11 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/env/README b/tools/env/README index 480a893202..b8c6a7e197 100644 --- a/tools/env/README +++ b/tools/env/README @@ -58,6 +58,9 @@ DEVICEx_ENVSECTORS defines the number of sectors that may be used for this environment instance. On NAND this is used to limit the range within which bad blocks are skipped, on NOR it is not used. +If DEVICEx_ESIZE and DEVICEx_ENVSECTORS are both zero, then a runtime +detection is attempted for NOR and NAND mtd types. + To prevent losing changes to the environment and to prevent confusing the MTD drivers, a lock file at /run/fw_printenv.lock is used to serialize access to the environment. diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index c9a8774ace..9f57f19d80 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1659,8 +1659,15 @@ static int check_device_config(int dev) } DEVTYPE(dev) = mtdinfo.type; if (DEVESIZE(dev) == 0 && ENVSECTORS(dev) == 0 && - mtdinfo.type == MTD_NORFLASH) - DEVESIZE(dev) = mtdinfo.erasesize; + mtdinfo.erasesize > 0) { + if (mtdinfo.type == MTD_NORFLASH) + DEVESIZE(dev) = mtdinfo.erasesize; + else if (mtdinfo.type == MTD_NANDFLASH) { + DEVESIZE(dev) = mtdinfo.erasesize; + ENVSECTORS(dev) = + mtdinfo.size / mtdinfo.erasesize; + } + } if (DEVESIZE(dev) == 0) /* Assume the erase size is the same as the env-size */ DEVESIZE(dev) = ENVSIZE(dev); -- 2.11.0
[PATCH 0/1] MAINTAINERS: fix folders within glob pattern
From: Anthony Loiseau This patch fixes few folders I think mishandled within MAINTAINERS file. For example, files within drivers/clk/tegra/ were not affilated to ARM TEGRA because rule "F: drivers/*/tegra*" does not match them. See MAINTAINERS file embedded documentation on top. The same for tools/env/* files which where not affiliated to Environment section despite the "F: tools/env*" rule. It worth be noted that despite I successfully tested this update for Arm Tegra and Environment sections, Arm TI related updates does nothing. My feeling is that those updates are good and wanted but another issue remains. It looks like all sections maintained by Tom Rini are entirely ignored, I don't know why and did not dig into it deeply. Example of test: ./scripts/get_maintainer.pl -f drivers/clk/tegra/Makefile now lists Arm Tegra maintainers were it did not. Cc: Tom Rini Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Tom Rini Cc: Joe Hershberger Signed-off-by: Anthony Loiseau Anthony Loiseau (1): MAINTAINERS: fix folders within glob pattern MAINTAINERS | 5 + 1 file changed, 5 insertions(+) -- 2.11.0
[PATCH 1/1] MAINTAINERS: fix folders within glob pattern
From: Anthony Loiseau A "F: foo*" entry does not match any foo*/ folder nor its subtree, another "F: foo*/" entry is needed for that. Add missing foo*/ entries where an existing folder was ignored, so this folder and its subtree is properly covered. Arm tegra, Arm TI and Environment sections are affected. Cc: Tom Rini Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Tom Rini Cc: Joe Hershberger Signed-off-by: Anthony Loiseau --- MAINTAINERS | 5 + 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 969514468c..8c57d142d7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -675,6 +675,7 @@ F: arch/arm/dts/tegra* F: arch/arm/include/asm/arch-tegra*/ F: arch/arm/mach-tegra/ F: drivers/*/tegra* +F: drivers/*/tegra*/ ARM TI M: Tom Rini @@ -690,6 +691,7 @@ F: arch/arm/include/asm/arch-omap*/ F: arch/arm/include/asm/ti-common/ F: board/ti/ F: drivers/dma/ti* +F: drivers/dma/ti*/ F: drivers/firmware/ti_sci.* F: drivers/gpio/omap_gpio.c F: drivers/memory/ti-aemif.c @@ -701,6 +703,7 @@ F: drivers/phy/omap-usb2-phy.c F: drivers/phy/phy-ti-am654.c F: drivers/phy/ti-pipe3-phy.c F: drivers/ram/k3* +F: drivers/ram/k3*/ F: drivers/remoteproc/ipu_rproc.c F: drivers/remoteproc/k3_system_controller.c F: drivers/remoteproc/pruc_rpoc.c @@ -1029,8 +1032,10 @@ ENVIRONMENT M: Joe Hershberger S: Maintained F: env/ +F: include/env/ F: include/env* F: test/env/ +F: tools/env/ F: tools/env* F: tools/mkenvimage.c -- 2.11.0
[PATCH 0/1] get_maintainer.pl: slightly modify penguin_chief
From: Anthony Loiseau Please find a patch proposal which slightly modifies get_maintainer.pl penguin_chief list. This proposal aims to workaround get_maintainer.pl behavior for ARM, ARM_TI and THE_REST sections (see MAINTAINERS file) for which Tom Rini was not outputed as a maintainer by get_maintainer.pl. Root issue is that get_maintainer.pl threats penguin_chiefs this way: - with --git-chief-penguins, penguin_chiefs are appended to all results - with --no-git-chief-penguins (the default), penguin chiefs are stripped out of all results That is, since Tom Rini is set as a penguin chief inside get_maintainer.pl, get_maintainer.pl never outputs him as a maintainer with usual uses. This issue does not hurt that much for upstream Linux code since Linus Torvalds is not listed in MAINTAINERS file except for THE_REST, but sections coverage is good so "THE REST" section almost never triggers. I saw several options to fix this: - OPT1: get in touch with Linux upstream to change --no-git-chief-penguins behavior so it does nothing instead of stripping chiefs from results - OPT2: take advantage of case-sensitive (name, email) comparison to keep Tom Rini chief as Tom RINI. - OPT3: clear penguin_chiefs, breaking --git-chief-penguins - OPT4: implement OPT1 here >From an email discussion on LKML [1] my understanding is that upstream votes for downstream edits here, hence this patch proposal for OPT2. Note of interest: this fixes "THE REST" catch all sectioni too, resulting in Tom Rini listed as (maintainer:THE REST) for all repo files. If you think developers automatically fills patch emails to/cc from get_maintainer.pl output, then you may want to break it again by setting its maintainer as Tom RINI. [1] https://lore.kernel.org/lkml/13fd63b7e8e0f197842ae1f1264e50c9614d0667.ca...@perches.com/T/ Regards, Anthony Cc: Tom Rini Anthony Loiseau (1): get_maintainer.pl: slightly modify penguin_chief scripts/get_maintainer.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0
[PATCH 1/1] get_maintainer.pl: slightly modify penguin_chief
From: Anthony Loiseau Penguin chiefs are actually stripped out from get_maintainer results unless --git-chief-penguins is provided, which appends them to all results instead. This is a issue for U-Boot since Tom Rini (penguin chief) is also maintainer of some sub-trees ("ARM", "ARM TI" and "THE REST"). Hopefully, this match is performed case-senditive over name and email, therefore upper-casing Tom Rini last name workarounds the issue. Important note: This also fixes "THE REST" catch all section resulting in Tom Rini listed as (maintainer:THE REST) for all files. Hope there is not too much developers scripting their patch email header from get_maintainer.pl output, otherwise Tom Rini may be flooded. Cc: Tom Rini Signed-off-by: Anthony Loiseau --- scripts/get_maintainer.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 6c58578e98..71cf18c2b3 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -80,7 +80,7 @@ my %commit_author_hash; my %commit_signer_hash; my @penguin_chief = (); -push(@penguin_chief, "Tom Rini:trini\@konsulko.com"); +push(@penguin_chief, "Tom RINI:trini\@konsulko.com"); my @penguin_chief_names = (); foreach my $chief (@penguin_chief) { -- 2.11.0