include: move various macros to include/linux/kernel.h

U-Boot has imported various utility macros from Linux
scattering them to various places without consistency.

In include/common.h are min, max, min3, max3, ARRAY_SIZE, ALIGN,
container_of, DIV_ROUND_UP, etc.
In include/linux/compat.h are min_t, max_t, round_up, round_down,
etc.
We also have duplicated defines of min_t in some *.c files.

Moreover, we are suffering from too cluttered include/common.h.

This commit moves various macros that originate in
include/linux/kernel.h of Linux to their original position.

Note:
This commit simply moves the macros; the macros roundup,
min, max, min2, max3, ARRAY_SIZE are different
from those of Linux at this point.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Series-version: 3
Series-changes: 3
  - Move also mult_frac
linux/kernel.h: import more macros

These macros seem to be useful for U-Boot too (or at least
harmless).  Imported from Linux 3.18-rc2.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
linux/kernel.h: add typechecking to roundup macro

This commit replaces roundup macro with the one from Linux Kernel.

DEFINE_ALIGN_BUFFER must be fixed because typechecking can not
be used in this context.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
linux/kernel.h: sync min, max, min3, max3 macros with Linux

U-Boot has never cared about the type when we get max/min of two
values, but Linux Kernel does.  This commit gets min, max, min3, max3
macros synced with the kernel introducing type checks.

Many of references of those macros must be fixed to suppress warnings.
We have two options:
 - Use min, max, min3, max3 only when the arguments have the same type
   (or add casts to the arguments)
 - Use min_t/max_t instead with the appropriate type for the first
   argument

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Pavel Machek <pavel@denx.de>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Series-changes: 2
 - Fix a typo:  s/introduing/introducing/
 - Change arch/arm/cpu/arm1176/tnetv107x/clock.c
     #define MAXPOSTDIV    8UL  seems better than adding a cast.
linux/compat.h: remove redundant defines

__user and __iomem are defined in include/linux/compiler.h
MAX_ERRNO is defined in include/linux/err.h

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
usb: ehci: fix Interrupt on Doorbell flag of USBCMD

CMD_IAAD (Interrupt on Async Advance Doorbell) is bit 6, not bit 5.
While we are here, sort the flags.

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

Some (not all) of ARMv7 boards define CONFIG_ARMV7, which is useless.
Besides, it is never referenced.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cover-letter:
Delete CONFIG_ARM<CPU_NAME> and use CONFIG_CPU_<CPU_NAME>

Since commit 2e07c249a67e055 (kconfig: arm: introduce symbol for ARM CPUs),
every ARM board is supposed to select CONFIG_CPU_<CPU_NAME>.
(CONFIG_CPU_ARM720T, CONFIG_CPU_ARM920T, CONFIG_CPU_V7, etc.)

We no longer need CONFIG_ARM920T, CONFIG_ARMV7, etc.
These macros have been defined inconsistently.
For example, some ARMv7 boards define CONFIG_ARMV7 in header files,
but some ARMv7 boards do not.
Macros defines based on a whim seems useless.

Going forward, let's use CONFIG_CPU_*.

I built all the ARM boards and compared MD5SUM.
I confirmed all the checksum matched with/without this series,
so I am sure this series does not change the output binaries at all.

END
ARM: remove CONFIG_ARM1176 defines

CONFIG_ARM1176 is defined for some boards but not referenced at all.

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

CONFIG_CPU_ARM920T was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM920T and replaces the
only reference in drivers/usb/host/ohci-hcd.c with CONFIG_CPU_ARM920T.

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

CONFIG_CPU_ARM926EJS was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM926EJS and replaces
the only reference in arch/arm/lib/cache.c with CONFIG_CPU_ARM926EJS.

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

CONFIG_CPU_ARM1136 was introduced into Kconfig by commit 2e07c249a67e
(kconfig: arm: introduce symbol for ARM CPUs).

This commit removes all the defines of CONFIG_ARM1136 and replaces
the only reference in arch/arm/lib/cache.c with CONFIG_CPU_ARM1136.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
kbuild: Discend into SOC directory from CPU directory

Only some CPUs of some architectures have an SOC directory.

It seems reasonable to descend into the SOC directory
from one-level upper, CPU directory rather than from the top
Makefile.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
x86: use CONFIG_SYS_COREBOOT to desend into coreboot/ directory

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
sh: use more descriptive prompts for board select menu

The current prompts were added by a conversion tool
based on board directory names when switching to Kconfig.

Use better prompts mostly taken from from arch/sh/boards/*
of Linux Kernel.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Commit-notes:

Nobuhiro,
Please feel free to fix these prompts as you like.

END
Cover-letter:
sh: refactor SuperH Kconfig files

Kconfig conversion was almost automatically by a tool.

Let's tidy up board choice prompts and macro defines.

END
sh: move CONFIG_{SH2,SH2A,SH3,SH4} to Kconfig

This commit moves CONFIG_SH2, CONFIG_SH2A, CONFIG_SH3, CONFIG_SH4
to Kconfig renaming into CONFIG_CPU_SH2, CONFIG_CPU_SH2A,
CONFIG_CPU_SH3, CONFIG_CPU_SH4, respectively because
arch/sh/Kconfig of Linux uses CONFIG_CPU_SH* convention.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
sh: consolidate CONFIG_SYS_CPU defines

Now each board selects one of CONFIG_CPU_SH2, CONFIG_CPU_SH3,
CONFIG_CPU_SH4, so let's move CONFIG_SYS_CPU definition to
arch/sh/Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
sh: define CONFIG_CPU_SH4A for some boards

Precisely, these boards are SH4A rather than SH4.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
sh: move -m options to arch/sh/config.mk

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
generic-board: make compile-time noise for non-generic boards

Commit 0f605c1501f6 (Start the deprecation process for generic board)
added a run-time warning message.  Let's be noisier for non-generic
boards to inform the dead line of the conversion.

This commit intentionally outputs a warning message to stdout.
We still have many unconverted boards.  If we print the message
to stderr, MAKEALL and buildman will report tons of broken boards
and really important information will be buried.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Series-cc: Vagrant Cascadian <vagrant@debian.org>
Series-cc: sjg
Series-version: 3
Series-changes: 2
  - Mention to see doc/README.generic-board

Series-changes: 3
  - Print warning messages to stdout rather than stderr

Commit-notes:

Which is better v2(below) and this version?
http://patchwork.ozlabs.org/patch/402048/

The difference between the two is which stream is used, stdout or stderr.

END
dm: do not check dm_root before searching in uclass_root

The function uclass_find() looks for a uclass in the linked
list of gd->uclass_root; gd->dm_root has nothing to do with
gd->uclass_root.  Remove this confusing code.

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