tools: Import Kconfiglib

Kconfiglib is the flexible Python Kconfig parser and library
created by Ulf Magnusson.
(https://github.com/ulfalizer/Kconfiglib)

This commit imports kconfiglib.py from
commit ce84c22e58fa59cb93679d4ead03c3cd1387965e,
with ISC SPDX-License-Identifier.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Cc: Ulf Magnusson <ulfalizer@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Series-changes: 3
  - Fix the SPDX license identifier.
       GPL-2.0+  =>  ISC

Series-changes: 2
  - Newly added
tools/genboardscfg.py: improve performance more with Kconfiglib

The idea of using Kconfiglib was given by Tom Rini.
It allows us to scan lots of defconfigs very quickly.
This commit also uses multiprocessing for further acceleration.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Suggested-by: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
Series-cc: Tom Rini <trini@ti.com>
Series-cc: sjg
Series-cc: wd
Series-cc: Ulf Magnusson <ulfalizer@gmail.com>
Series-version: 3
Series-changes: 2
  - Do not install Kconfiglib
  - Comments fixes, cleanups based on Simon's review.

Series-changes: 3
  - A minor comment fix

Cover-letter:
Add ISC SPDX, import Kconfiglib and improve genboardscfg.py

END
mx6qsabreauto: Remove imx6q-sabreauto.dts

Commit fa9c021632473 ("mx6: add example DTB for mx6qsabreauto") introduced
'imx6q-sabreauto.dts' but it adds no real value as the dts file only contains
the 'model' and 'compatible' strings.

After this commit the final binary is also changed from 'u-boot.imx' to
'u-boot-dtb.imx', which may confuse users.

So revert it until a more complete and useful device tree could be provided.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Don't send: tools: moveconfig.py
Don't send: tools: move_config
Don't send: tools: savedefconfig.py
kconfig: fix savedefconfig to output empty defconfig

Commit 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script)
introduced a minor regression.

make alldefconfig; make savedefconfig
should create an empty 'defconfig'.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Series-cc: sjg
Series-cc: trini
Series-version: 2
Series-changes: 2
  - Resend as a series.
  - Change the commit subject

Cover-letter:
Kconfig: Fix various bugs

Commit 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script)
introduced various bugs.

We are trying to be user-friendly, not developer-friendly,
but it causes my headache...

END
kconfig: fix whitespace handling bug of savedefconfig

Commit 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script)
introduced another regression.

Shell usually handles whitespaces as separators,
so "make saveconfig" outputs

  # CONFIG_FOO is not set

into:

  #
  CONFIG_FOO
  is
  not
  set

Whitespaces should not be treated as separators here.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-changes: 2
  - Resend as a series
  - Change the commit subject
kconfig: fix savedefconfig to handle TPL correctly

Since 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script),
"make savedefconfig" of TPL boards has not been working.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-changes: 2
  - Newly added
kconfig: fix a bug of "make config"

Since 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script),
"make config" is not working because of a missing '$' before '(Q)'.

Besides, "make config" should be invoked via scripts/multiconfig.sh
to avoid a warning message:
Kconfig:11:warning: environment variable KCONFIG_OBJDIR undefined

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-changes: 2
  - Newly added
kconfig: show an error message when defconfig is not found

When a non-existing defconfig is specified,
display an easy-to-understand message
(fake the error message on Linux Kernel):

  $ make foo_defconfig
  ***
  *** Can't find default configuration "confis/foo_defconfig"!
  ***

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-version: 2
Series-changes: 2
  - Echo the error message to stderr
kconfig: add sanity checks for SPL configuration

For the SPL configuration, "make <dir>/<target>" is used.
Here,
  <dir> is either "spl" or "tpl"
  <target> is one of "config", "menuconfig", "xconfig", etc.

This commit adds two checks:

[1] If <dir> is given an unsupported subimage, the configuration
    should error out like this:

  $ make qpl/menuconfig
  ***
  *** "make qpl/menuconfig" is not supported.
  ***

[2] Make sure that "CONFIG_SPL" is enabled in the ".config" before
    running "make spl/menuconfig.  Otherwise, the SPL image
    is not built at all.  Having "spl/.config" makes no sense.
    In such a case, the configuration should exit with a message:

  $ make spl/menuconfig
  ***
  *** Create ".config" with "CONFIG_SPL" enabled
  *** before "make spl/menuconfig".
  ***

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Series-version: 2
Series-changes: 2
  - Replace "$objdir" with "$2" in check_enabled_subimage()

Series-cc: sjg
Commit-notes:

This check was proposed by Simon in his review
before getting the Kconfig series in.

END
tools/genboardscfg.py: pick up also commented maitainers

We are still keeping invalid email addressed in MAINTAINERS
because they carry information.

The problem is that scripts/get_maintainer.pl adds emails in the
"M:" field including invalid ones.

We want to comment out invalid email addresses in MAINTAINERS
to prevent scripts/get_maintainer.pl from picking them up.
On the other hand, we want to collect them for boards.cfg
to know the last known maintainer of each board.

This commit adjusts tools/genboardscfg.py to parse also
the commented "M:" fields, which is useful for the next commit.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
MAINTAINERS: comment out invalid maintainers

The "S:    Orphan" in MAINTAINERS means that the maintainer in the
"M:" field is unreachable (i.e. the email address is not working).
(Refer to the definition of "Orphan" adopted in U-Boot
in the log of commit 31f1b654b2f395b69faa5d0d3c1eb0803923bd3b,
"boards.cfg: move boards with invalid emails to Orphan")

For patch files adding global changes, scripts/get_maintainer.pl
adds bunch of such invalid email addresses, which results in
tons of annoying bounce emails.

This commit can be reproduced by the following command:

find . -name MAINTAINERS | xargs sed -i -e '
/^M:[[:blank:]]/ {
      N
      /S:[[:blank:]]Orphan/s/^/#/
}
'

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cover-letter:
Comment out invalid email addresses in MAINTAINERS

END
Series-cc: sjg
Series-cc: trini
MAINTAINERS: comment out blank M: field

Since commit ddaf5c8f3030050fcd356a1e49e3ee8f8f52c6d4
(patman: RunPipe() should not pipe stdout/stderr unless asked),
Patman spits lots of "Invalid MAINTAINERS address: '-'"
error messages for patches with global changes.
It takes too long for Patman to process them.

Anyway, "M:    -" does not carry any important information.
Rather, it is just like a place holder in case of assigning
a new board maintainer.  Let's comment out.

This commit can be reproduced by the following command:

find . -name MAINTAINERS | xargs sed -i -e '/^M:[[:blank:]]*-$/s/^/#/'

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
MAINTAINERS: orphan SPEAr boards

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
exynos: update maintainer of Snow and SMDK5420 board

The email address of Rajeshwari Shinde <rajeshwari.s@samsung.com>
is not working.

Squash the maintainership of Snow board to
Chander Kashyap, the maintainer of SMDK5250 board.

Likewise, pass the maintainership of SMDK5420 board to
Akshay Saraswat, the maintainer of Peach Pit.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Chander Kashyap <k.chander@samsung.com>
Cc: Akshay Saraswat <akshay.s@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Commit-notes:

The error message I got from the mail server is as follows:

   ----- The following addresses had permanent fatal errors -----
  <rajeshwari.s@samsung.com>
    (reason: 550 5.1.1 Recipient address rejected: User unknown)

Chander, Akshay,

Please let me know if this change is not acceptable for you.

END
vexpress64: kconfig: consolidate CONFIG_TARGET_VEXPRESS_AEMV8A_SEMI

We do not have to distinguish CONFIG_TARGET_VEXPRESS_AEMV8A_SEMI
from CONFIG_TARGET_VEXPRESS_AEMV8A.  Rename the former to the latter.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Steve Rae <srae@broadcom.com>
Cc: David Feng <fenghua@phytium.com.cn>
Patch-cc: Steve Rae <srae@broadcom.com>
Series-changes: 2
  - Rebase again!
kconfig: armv8: move CONFIG_ARM64 to Kconfig

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-changes: 2
  - Rebase again!
arm: debug: import debug files from Linux 3.16

U-Boot does not have arch/arm/kernel, include/uapi directories,
This commit copies files as follows:

  Location in Linux               -> Location in U-Boot

  arch/arm/kernel/debug.S         -> arch/arm/lib/debug.S
  arch/arm/include/debug/8250.S   -> arch/arm/include/debug/8250.S
  include/uapi/linux/serial_reg.h -> include/linux/serial_reg.h

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>