replace DIV_ROUND with DIV_ROUND_CLOSEST

The Linux-compatible macro DIV_ROUND_CLOSEST is a bit more flexible
and safer than DIV_ROUND.

For example,
  foo = DIV_ROUND_CLOSEST(x, y++)
works expectedly, but
  foo = DIV_ROUND(x, y++)
does not. (y is incremented twice.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cover-letter:
Collect utility macros to include/linux/kernel.h synced with Linux
We have imported useful macros from Linux scattering them
to various places.

In include/common.h are min, max, min3, max3, ARRAY_SIZE, ALIGN,
container_of, DIV_ROUND_UP, roundup, 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.

I'd like to create include/linux/kernel.h and arrange
sprinkled Linux-originated macros in order.
I believe this work will be helpful when we import more macros
or sync include/linux/kenrel.h in the future.

I confirmed clean output of buildman.

No section: 'make-flags'
boards.cfg is up to date. Nothing to do.
Summary of 7 commits for 1175 boards (8 threads, 1 job per thread)
01: arm: interrupt_init: set sp in IRQ/FIQ modes
     nios2: +   nios2-generic
        sh: +   rsk7269 rsk7264 rsk7203
  blackfin: +   bf609-ezkit
       arm: +   maxbcm smdkv310 snow smdk5250 smdk5420 origen odroid db-mv784mp-gp s5pc210_universal trats peach-pit arndale trats2
   powerpc: +   TQM834x
02: replace DIV_ROUND with DIV_ROUND_CLOSEST
03: include/common.h: remove DIV_ROUND definition
04: include: move various macros to include/linux/kernel.h
05: linux/kernel.h: import more macros
06: linux/kernel.h: add typechecking to roundup macro
07: linux/kernel.h: sync min, max, min3, max3 macros with Linux

END
include/common.h: remove DIV_ROUND definition

All the references of DIV_ROUND have been replaced with
DIV_ROUND_CLOSEST.  Remove DIV_ROUND.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
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
  - 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>