i2c: kona: Resolve Kona I2C driver issue

- "i2c mw" command hangs (with some compilers)

Signed-off-by: Steve Rae <srae@broadcom.com>
mmc: return meaningful error codes from mmc_select_hwpart

Rather than just returning -1 everywhere, try to return something
meaningful from mmc_select_hwpart(). Note that most other MMC functions
don't do this, including functions called from mmc_select_hwpart(), so
I'm not sure how effective this will be. Still, it's one less place with
hard-coded -1.

Suggested-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
cmd_mmc: default to HW partition 0 if not specified

Currently, "mmc dev 0" does not change the selected HW partition. I
think it makes more sense if "mmc dev 0" is an alias for "mmc dev 0 0",
i.e. that HW partition 0 (main data area) is always selected by default
if the user didn't request a specific partition. Otherwise, the following
happens, which feels wrong:

Select HW partition 1 (boot0):
mmc dev 0 1

Doesn't change the HW partition, so it's still 1 (boot0):
mmc dev 0

With this patch, the second command above re-selects the main data area.

Note that some MMC devices (i.e. SD cards) don't support HW partitions.
However, this patch still works, since mmc_start_init() sets the current
partition number to 0, and mmc_select_hwpart() succeeds if the requested
partition is already selected.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
disk: default to HW partition 0 if not specified

Currently, get_device()/get_dev_hwpart() for MMC devices does not select
an explicit HW partition unless the user explicitly requests one, i.e. by
requesting device "mmc 0.0" rather than just "mmc 0". I think it makes
more sense if the default is to select HW partition 0 (main data area)
if the user didn't request a specific partition. Otherwise, the following
happens, which feels wrong:

Select HW partition 1 (boot0):
mmc dev 0 1

Attempts to access SW partition 1 on HW partition 1 (boot0), rather than
SW partition 1 on HW partition 0 (main data area):
ls mmc 0:1 /

With this patch, the second command above re-selects the main data area.

Many device types don't support HW partitions at all, so if HW partition
0 is selected (either explicitly or as the default) and there's no
select_hwpart function, we simply skip attempting to select a HW
partition.

Some MMC devices (i.e. SD cards) don't support HW partitions. However,
this patch still works, since mmc_start_init() sets the current
partition number to 0, and mmc_select_hwpart() succeeds if the requested
partition is already selected.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
cmd_mmc: add force_init parameter to init_mmc_device()

This allows callers to inject mmc->has_init = 0 between finding the
MMC device, and calling mmc_init(), which forces mmc_init() to rescan
the HW. Future changes will use this feature.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
cmd_mmc: Use init_mmc_device() from do_mmc_rescan()

The body of init_mmc_device() is now identical to that of do_mmc_rescan()
except for the error codes returned. Modify do_mmc_rescan() to simply
call init_mmc_device() and convert the error codes, to avoid code
duplication.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
cmd_mmc: make mmc dev always re-probe the HW

Currently, U-Boot behaves as follows:

- Begin with no SD card inserted in "mmc 1"
- Execute: mmc dev 1
- This fails, since there is no card
- User plugs in an SD card
- Execute: mmc dev 1
- This still fails, since the HW isn't reprobed.

With this change, U-Boot behaves as follows:

- Begin with no SD card inserted in "mmc 1"
- Execute: mmc dev 1
- This fails, since there is no card
- User plugs in an SD card
- Execute: mmc dev 1
- The newly present SD card is detected

I know that "mmc rescan" will force the HW to be reprobed, but I feel it
makes more sense if "mmc dev" always reprobes the HW after selecting the
current MMC device. This allows scripts to just execute "mmc dev", and
not have to also execute "mmc rescan" to check for media presense.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
mmc: free allocated memory on initialization errors

Cleanup to balance malloc/free calls.

Signed-off-by: Darwin Rambo <drambo@broadcom.com>
Reviewed-by: Steve Rae <srae@broadcom.com>
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Merge branch 'master' of git://git.denx.de/u-boot-mmc
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.
m68k: eliminate a warning in cpu_init

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

gd->bd is not used in fdt_support.c.

Series-to: u-boot@lists.denx.de
Series-version: 2
Cover-letter:
Refactoring and Endian bug fixes of fdt_support

END
fdt_support: refactor with fdt_find_or_add_subnode helper func

Some functions in fdt_support.c do the same routine:
search a node with a given name ("chosen", "memory", etc.)
or newly create it if it does not exist.

So this commit makes that routine to a helper function.