cosmetic: kbuild: clean-up coding style (sync with Linux 3.16-rc1)

Import the following trivial commits from Linux v3.16-rc1:

 bb66fc6 kbuild: trivial - use tabs for code indent where possible
 7eb6e34 kbuild: trivial - remove trailing empty lines
 3fbb43d kbuild: trivial - fix comment block indent
 38385f8 kbuild: trivial - remove trailing spaces

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Don't send: MAKEALL: Display MD5SUM

 === Do not send to ML, Do not merge into the mailline ===

 What is this ?
 --------------

When you change some makefiles and you want to confirm
your changes are harmless, this patch will be helpful.

With this patch, MAKEALL will display md5sum of
 -  ./u-boot.bin
 -  spl/u-boot-spl.bin (if it exists)
 -  tpl/u-boot-tpl.bin (if it exists)
 -  examples/standalone/hello_world.bin (if it exists)

If the same md5sum is displayed, it means your commits
still generate the same outputs.

Timestamp and version information must be disabled,
otherwise MAKEALL will show the different md5sum at every build.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
microblaze: workaround for build error
bfin: workaround
Don't send: tools: Add remove_redundant_config
Don't send: tools: add find_unused_source
Don't send: tools: Add find_unused_header
Don't send: tools: delete_spaces
Don't send: tools: check_config

Check if specified CONFIG is defined or not.
spl: consolidate arch/arm/include/asm/arch-*/spl.h

arch/arm/include/asm/spl.h requires all SoCs to have
arch/arm/include/asm/arch-*/spl.h.

But many of them just define BOOT_DEVICE_* macros.

Those macros are used in the "switch (boot_device) { ... }"
statement in common/spl/spl.c.

So they should not be archtecture specific, but described as
a simpile enumeration.

This commit merges most of arch/arm/include/asm/arch-*/spl.h
into arch/arm/include/asm/spl.h.

With a little more effort, arch-zynq/spl.h and arch-socfpga/spl.h
will be merged, while I am not sure about OMAP and Exynos.

Series-to: u-boot
Series-version: 2
Series-changes: 2
  - Add BOOT_DEVICE_SATA (request from Tim Harvey)
  - Add "|| defined(CONFIG_EXYNOS4210)"
    Most exynos boards define CONFIG_EXYNOS4 or CONFIG_EXYNOS5.
    But there is one exception: smdkv310.
    This board defines neither CONFIG_EXYNOS4 nor CONFIG_EXYNOS5.
    For this board, "if defined(CONFIG_EXYNOS4210)" should be checked.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>
CC: Stefano Babic <sbabic@denx.de>
CC: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
Tested-by: Bo Shen <voice.shen@atmel.com> [on sama5d3xek board for at91 part]
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>
arm: include config.h in arch/arm/lib/vectors.S

Commit 41623c91 moved exception handling to arch/arm/lib/vectors.S,
but it missed to include <config.h>.

This mistake causes two problems.

[1]
"enbw_cmc", "da850evm_direct_nor", "calimain" boards are broken.

They expect CONFIG_SYS_DV_NOR_BOOT_CFG (= 0x00000011) at the beginning
of the boot image.

But it is missing since commit 41623c91 because
CONFIG_SYS_DV_NOR_BOOT_CFG is never defined in arch/arm/lib/vectors.S.

[2]
Boards with CONFIG_USE_IRQ fail with undefined reference error
of "IRQ_STACK_START" and "FIQ_STACK_START".

This is _potential_ problem because currently there is no board
enabling CONFIG_USE_IRQ.
But we cannot deny the possibility some board may enable it in future.

(If we are not willing to support interrupt feature, all references
to CONFIG_USE_IRQ should be dropped immediately.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Series-to: uboot
Series-version: 2
Series-changes: 2
  - Rephrase commit subject and description. (No change in code-diff)

Cover-letter:
ARM: bug fixes of commit 41623c91 (arch/arm/lib/vectors.S)

END
arm: fix a double-definition error of _start symbol

The symbol "_start" is defined twice in arch/arm/lib/vectors.S:
around line 48 and line 54.

If CONFIG_SYS_DV_NOR_BOOT_CFG is defined (as on calimain board),
build fails:

  arch/arm/lib/vectors.S: Assembler messages:
  arch/arm/lib/vectors.S:54: Error: symbol `_start' is already defined
  make[1]: *** [arch/arm/lib/vectors.o] Error 1
  make: *** [arch/arm/lib] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Series-changes: 2
  - No change  (Resend as a series)
sandbox: change local_irq_save() to macro

local_irq_save() should be a macro, not a function
because local_irq_save() saves flag to the given argument.

GCC is silent about this issue, but Clang warns:

In file included from lib/asm-offsets.c:15:
In file included from include/common.h:20:
In file included from include/linux/bitops.h:110:
arch/sandbox/include/asm/bitops.h:59:17:
 warning: variable 'flags' is uninitialized when used here
      [-Wuninitialized]
        local_irq_save(flags);
                       ^~~~~

That change causes another warning:

In file included from include/linux/bitops.h:110:0,
                 from include/common.h:20,
                 from lib/asm-offsets.c:15:
arch/sandbox/include/asm/bitops.h: In function ‘test_and_set_bit’:
arch/sandbox/include/asm/bitops.h:56:16: warning: unused variable ‘flags’ [-Wunused-variable]

So, flags should be set to __always_unused.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
Series-to: uboot
Series-version: 2
Series-changes: 2
  - I forgot to "git add arch/sandbox/include/asm/bitops.h" in v1
    Resending.
kconfig: import Kconfig files from Linux 3.16-rc1

Import
  - scripts/kconfig/*
  - include/linux/kconfig.h
from Linux 3.16-rc1.

Series-to: u-boot@lists.denx.de
Series-cc: Simon Glass <sjg@chromium.org>
Series-cc: Tom Rini <trini@ti.com>
Series-cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Series-cc: Wolfgang Denk <wd@denx.de>
Series-version: 3
Series-changes: 3
 - Fetch source files from the latest Linux tag
Series-changes: 2
 - Fetch source files from the latest Linux tag

Cover-letter:
Kconfig for U-Boot
This series introduces Kconfig.

Besides Linux Kernel, Kconfig is used in some projects,
such as, BusyBox, Buildroot.

But our situation is a little more complicated.
For one board, we need to generate 3 images at most:
Full image, SPL and TPL.

Each image needs its own configuration input.

 How does Kconfig in U-Boot work?
 --------------------------------

For boards without SPL support, it works as in Linux Kernel.
"make <board>_defconfig" creates .config for you.
You can use "make config", "make menuconfig" etc. to create a new .config
from scratch or update the existing one.

"make silentoldconfig", if it is necessary, is automatically invoked,
creating or updating include/config/auto.conf and
include/generated/autoconf.h.

For boards with SPL/TPL support, another .config file is created
under spl/tpl directory.

To sum up, the location of Kconfig related files is as follows:

  [1] Full U-boot
    - configs/<board>_defconfig        (default configuration)
    - .config                          (saved config list)
    - include/config/auto.conf         (for use in makefiles)
    - include/generated/autoconf.h     (for use in C sources)
    - include/config/*                 (for if_changed_dep)

  [2] SPL
    - configs/spl/<board>_defconfig    (default configuration)
    - spl/.config                      (saved config list)
    - spl/include/config/auto.conf     (for use in makefiles)
    - spl/include/generated/autoconf.h (for use in C sources)
    - spl/include/config/*             (for if_changed_dep)

  [3] TPL
    - configs/tpl/<board>_defconfig    (default configuration)
    - tpl/.config                      (saved config list)
    - tpl/include/config/auto.conf     (for use in makefiles)
    - tpl/include/generated/autoconf.h (for use in C sources)
    - tpl/include/config/*             (for if_changed_dep)

 How to configure and build?
 ---------------------------

For board configuration, "make <board>_defconfig" is used instead of
"make <board>_config". The other things are the same as before.

 Coexistence of Kconfig and board header
 ---------------------------------------

For a long time, we have used C header files to define the set of CONFIGs.

It would take really long term (one year? two year? I don't know)
to migrate from board headers to Kconfig.

So, two different infractructure must coexist in the interim.

CONFIG macros defined in C headers are collected into
include/autoconf.mk, spl/include/autoconf.mk, tpl/include/autoconf.mk
for use in makefiles.

 Build Test
 ----------

I built all boards excepts some already broken ones.
I also checked MD5SUM of output binaries for all of them.

I believe this series should not break any boards.
But if you notice something got broken, please let me know.

Besides, I confirmed out-of-tree build, parallel build (-j make option)
works correctly.

 How to apply this series
 ------------------------

I confirmed this series can be applied on commit f23adc9f.

 Known Problems
 --------------

[1] MAKEALL and buildman have not been not adjusted yet

boards.cfg is not necessary for Kconfig. I want to delete it.

But before that, we must rework MAKEALL and buildman to search defconfig
files instead of boards.cfg.

[2] Many targets in one choice

Especially in ARM and PowerPC, there are too many target boards
in one choice.

This should be refactored in follow-up patches
by increasing the hierarchy and grouping the similar boards family.

END
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Do not apply: tools: add genkconfig

 ========================================
 Do not apply this patch to the main line
 ========================================

 What is this tool?
 ------------------

This tool converts boards.cfg to defconfig and Kconfig files.

It automatically generates
 - arch/${ARCH}/Kconfig
 - board/${VENDOR}/${BOARD}/Kconfig
 - board/${BOARD}/Kconfig
 - configs/${TARGET_BOARD}_defconfig

 How to use?
 -----------

Open tools/print_allconfigs with an editor.

Adjust cross compilers part for your environment.

  # Specify your favoriate cross tools
  CROSS_COMPILE_ARC=arc-linux-
  CROSS_COMPILE_AARCH64=aarch64-linux-gnu-
  CROSS_COMPILE_ARM=arm-unknown-linux-gnueabi-
   [snip]
  CROSS_COMPILE_X86=i386-linux-

And then, run "tools/genkconfig".

 Why is this patch here?
 -----------------------

The file boards.cfg is touched very frequently.
All the time, new/old boards are being added/removed.

The next commit was generated based on the u-boot/master at the time
I posted it.
It will become out-dated soon.

You can update it with this tool.

Series-changes: 2
 - Do not output CONFIG_BOARD_MAINTAINERS and CONFIG_BOARD_STATUS
 - Delete board/Kconfig and move "source board/*/*/Kconfig"
   statements to arch/*/Kconfig.
fix tool
kconfig: add board Kconfig and defconfig files

This commit adds:
 - arch/${ARCH}/Kconfig
    provide a menu to select target boards
 - board/${VENDOR}/${BOARD}/Kconfig or board/${BOARD}/Kconfig
    set CONFIG macros to the appropriate values for each board
 - configs/${TARGET_BOARD}_defconfig
    default setting of each board

(This commit was automatically generated by a conversion script
based on boards.cfg)

In Linux Kernel, defconfig files are located under
arch/${ARCH}/configs/ directory.
It works in Linux Kernel since ARCH is always given from the
command line for cross compile.

But in U-Boot, ARCH is not given from the command line.
Which means we cannot know ARCH until the board configuration is done.
That is why all the "*_defconfig" files should be gathered into a
single directory ./configs/.
(The problem is configs/ directory contains about 1200 files!)

Besides, we must have separate defconfig for SPL and TPL too,
if they are supported.
SPL, TPL has its defconfig files under configs/spl/, configs/tpl/,
respectively.

Series-changes: 2
  - Re-generate based on the latest boards.cfg
fix tool
kconfig: add basic Kconfig files

This commit adds more Kconfig files, which were written by hand.

Series-changes: 2
  - Do not include "board/Kconfig"
  - Drop CONFIG_BUILD_MODE
include: define CONFIG_SPL and CONFIG_TPL as 1

We are about to switch to Kconfig in the next commit.
But there are something to get done beforehand.

In Kconfig, include/generated/autoconf.h defines boolean
CONFIG macros as 1.

CONFIG_SPL and CONFIG_TPL, if defined, must be set to 1.
Otherwise, when switching to Kconfig, the build log
would be sprinkled with warning messages like this:
  warning: "CONFIG_SPL" redefined [enabled by default]

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Series-changes: 2
  - Rebase on the current u-boot/master