project/bcm63xx/u-boot.git
7 years agospl: spl_mmc.c Correct blk_dread() return value check
Tom Rini [Tue, 15 Aug 2017 01:01:30 +0000 (21:01 -0400)]
spl: spl_mmc.c Correct blk_dread() return value check

The function blk_dread will return -ENOSYS on failure or on success the
number of blocks read, which must be the number asked to read (otherwise
it failed somewhere).  Correct this check.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocmd/read.c: Fix checking blk_dread return value
Tom Rini [Tue, 15 Aug 2017 00:58:50 +0000 (20:58 -0400)]
cmd/read.c: Fix checking blk_dread return value

The function blk_dread will return -ENOSYS on failure or on success the
number of blocks read, which must be the number asked to read (otherwise
it failed somewhere).  Correct this check.

Reported-by: Coverity (CID: 166335)
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agomtdparts: Fix various issues reported by Coverity
Tom Rini [Tue, 15 Aug 2017 00:42:27 +0000 (20:42 -0400)]
mtdparts: Fix various issues reported by Coverity

Now that sandbox is building cmd/mtdparts.c Coverity has looked at the
code and found a number of issues.  In index_partitions() it is possible
that part will be NULL, so re-work the checks and debug statements to
take this into account.  We have a number of string buffers that we
print to in the exact size of, and use string functions on, so we need
to ensure they are large enough to be NULL terminated.  In
device_parse() it is not possible for num_partitions to be 0 (we would
have hit a different error first) so remove logically dead code.
Finally, in parse_mtdparts() if we have an error we need to free the
memory allocated to dev.

Cc: Lothar Waßmann <LW@KARO-electronics.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Reported-by: Coverity (CID: 166334, 166333, 166332, 166329, 166328)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agohash: Compile only hardware or software versions of SHA algorithms
Tom Rini [Mon, 14 Aug 2017 20:38:07 +0000 (16:38 -0400)]
hash: Compile only hardware or software versions of SHA algorithms

Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved
CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and
CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in the case of
SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 which
enables SHA SW library by default.  But in the case of platforms with
SHA HW library support, SHA SW library becomes redundant and increases
size of SPL by approx 18K.  Rework the code so that we have named
members and only have either software or hardware versions of the
algorithm, depending on the relevant config options.  Update the comment
around hash_algo to reflect this as well.

Reported-by: Sumit Garg <sumit.garg@nxp.com>
Cc: Sumit Garg <sumit.garg@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sumit Garg <sumit.garg@nxp.com>
7 years agoMakefile: honor PYTHON configuration properly
Clément Bœsch [Mon, 14 Aug 2017 06:59:11 +0000 (08:59 +0200)]
Makefile: honor PYTHON configuration properly

On some systems `python` is `python3` (for instance, Archlinux). The
`PYTHON` variable can be used to point to `python2` to have a successful
build.

The use of `PYTHON` is currently limited in the Makefile and needs to be
extended in other places:

First, pylibfdt is required to be a Python 2 binding (binman imports
pylibfdt and is only compatible Python 2), so its setup.py needs to be
called accordingly. An alternative would be to change the libfdt
setup.py shebang to python2, but the binding is actually portable. Also,
it would break on system where there is no such thing as `python2`.

Secondly, the libfdt import checks need to be done against Python 2 as
well since the Python 2 compiled modules (in this case _libdft.so) can
not be imported from Python 3.

Note on the libfdt imports: "@if ! PYTHONPATH=tools $(PYTHON) -c 'import
libfdt'; then..." is probably simpler than the currently sub-optimal
pipe.
Reviewed-by: Jonathan Gray <jsg@jsg.id.au>
7 years agoMerge git://git.denx.de/u-boot-video
Tom Rini [Sun, 20 Aug 2017 02:11:05 +0000 (22:11 -0400)]
Merge git://git.denx.de/u-boot-video

7 years agolcd: avoid possible NULL dereference
xypron.glpk@gmx.de [Sun, 30 Jul 2017 19:59:23 +0000 (21:59 +0200)]
lcd: avoid possible NULL dereference

Do not dereference bmp before the check if it is NULL.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Fri, 18 Aug 2017 22:24:58 +0000 (18:24 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

EFI Fixes for 2017.09:
  - Fix GOP w/o display
  - Fix LocateHandle
  - Fix exit return value truncation
  - Fix missing EFIAPI in efi_locate_handle (for x86)

7 years agoMerge branch 'master' of git://git.denx.de/u-boot-mmc
Tom Rini [Fri, 18 Aug 2017 22:24:36 +0000 (18:24 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-mmc

7 years agoMerge branch 'master' of git://git.denx.de/u-boot-coldfire
Tom Rini [Fri, 18 Aug 2017 22:24:08 +0000 (18:24 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-coldfire

7 years agoMerge branch 'master' of git://git.denx.de/u-boot-rockchip
Tom Rini [Fri, 18 Aug 2017 22:23:58 +0000 (18:23 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-rockchip

7 years agorockchip: rk322x: pinctrl: fix IO MASK error on sdcard pin
Kever Yang [Thu, 17 Aug 2017 07:17:36 +0000 (15:17 +0800)]
rockchip: rk322x: pinctrl: fix IO MASK error on sdcard pin

Fix the IOMUX setting for SDcard CMD pin at the same time.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: pinctrl: using compatible name same with dts
Kever Yang [Thu, 17 Aug 2017 07:17:35 +0000 (15:17 +0800)]
rockchip: rk322x: pinctrl: using compatible name same with dts

The dts from kernel is using rk3228-pinctrl as compatible name,
need to sync with it to make the driver work.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: update MACRO for mmc clksel reg
Kever Yang [Thu, 3 Aug 2017 12:07:45 +0000 (20:07 +0800)]
rockchip: rk322x: update MACRO for mmc clksel reg

The description for eMMC/SDIO/SDMMC src is not correct,
update the CRU_CLKSEL11_CON value definition according to TRM.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: update dram bank size
Kever Yang [Fri, 21 Jul 2017 10:21:07 +0000 (18:21 +0800)]
rockchip: rk322x: update dram bank size

The DRAM start address is not 0, so need to update the last bank size
as:
DRAM start addr + DRAM_SIZE - last bank start addr

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3399: spl: remove unused header inclusion
Philipp Tomsich [Wed, 16 Aug 2017 17:24:02 +0000 (19:24 +0200)]
rockchip: rk3399: spl: remove unused header inclusion

fdtdec.h is included, but not used in rk3399-board-spl.c: remove the
'#include'-statement.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3399-evb: remove redundant gmac node
Kever Yang [Wed, 9 Aug 2017 10:51:30 +0000 (18:51 +0800)]
rockchip: dts: rk3399-evb: remove redundant gmac node

There are two same gmac node, remove one.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoefi_loader: do not cast return value in EFI_EXIT
xypron.glpk@gmx.de [Thu, 17 Aug 2017 16:57:36 +0000 (18:57 +0200)]
efi_loader: do not cast return value in EFI_EXIT

UEFI API functions have different return types.
Some return a value of type EFI_STATUS other don't.

We therefore should not cast the return value of EFI_EXIT
to another type than the expression passed to EFI_EXIT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agommc: Support generic PCI SD host controller
Bin Meng [Wed, 9 Aug 2017 07:21:00 +0000 (00:21 -0700)]
mmc: Support generic PCI SD host controller

This changes pci_mmc driver to use PCI_CLASS_SYSTEM_SDHCI instead of
individual vendor id & device id pair to support generic PCI SD host
controller.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agom68k: add board stmark2, mcf5441x based
Angelo Dureghello [Sun, 6 Aug 2017 23:17:18 +0000 (01:17 +0200)]
m68k: add board stmark2, mcf5441x based

Sysam stmark2 board is a generic and fully (hw and sw) open board, with
a mcf54415 Coldfire CPU, 128MB of DDR2, 16MB of SPI flash and SD card
as non volatile memories, and a wifi module included on-board.
The board is actually used mainly for Coldfire custodian testing activity
related to the mcf5441x Coldfire family.

For further information please see: http://sysam.it/cff_stmark2.html

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---

Changes in v2:
 - remove CMD_REGINFO
 - add board information in commit message

7 years agom68k: mcf5445x: allow CS0 to be undefined
Angelo Dureghello [Sun, 14 May 2017 22:17:48 +0000 (00:17 +0200)]
m68k: mcf5445x: allow CS0 to be undefined

On some boards, CONFIG_SYS_CS0_BASE can be undefined, since
CS0 is not connected to any signal.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
7 years agom68k: fix cache.c for Coldfire V4E
Angelo Dureghello [Wed, 31 May 2017 19:32:48 +0000 (21:32 +0200)]
m68k: fix cache.c for Coldfire V4E

- fix cache.c CONFIG_CF_V4e to CONFIG_CF_V4E
- fix cache.c to properly enable/disable cache for V4E

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
7 years agom68k: mcf5445x: move early ddr init as board-specific
Angelo Dureghello [Sun, 14 May 2017 19:42:27 +0000 (21:42 +0200)]
m68k: mcf5445x: move early ddr init as board-specific

For certain boot types and sbf, for V4 cpu's, an early ddr/sdram init
is required. This patch moves this ddr/sdram early initalization
away from start.S (to be board related).

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
7 years agospl: fix Makefile for NOR, XIP and YMODEM
Philipp Tomsich [Thu, 17 Aug 2017 08:06:59 +0000 (10:06 +0200)]
spl: fix Makefile for NOR, XIP and YMODEM

During the the conversion to $(SPL_TPL_), the SPL_ fragment was
left over for the NOR, XIP and YMODEM boot methods in SPL, making
these unselectable.

This commit fixes this by dropping the spurious 'SPL_' fragment
from each line.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reported-by: Bo Shen <voice.shen@gmail.com>
Fixes: f94e643 (spl: consistently use $(SPL_TPL_) to select features for SPL and TPL builds)
7 years agorockchip: dts: rk3399-firefly: update gmac parameter
Kever Yang [Tue, 1 Aug 2017 01:40:04 +0000 (09:40 +0800)]
rockchip: dts: rk3399-firefly: update gmac parameter

Update the tx_delay and rx_delay to match the timing for
rk3399-firefly board to improve the stability of gmac data
transfer.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agocmd: mmc: add mmc partconf read capability
Angelo Dureghello [Tue, 1 Aug 2017 12:27:10 +0000 (14:27 +0200)]
cmd: mmc: add mmc partconf read capability

This patch allows to show the EXT_CSD[179] partition_config
register info, just by specifying the dev param:

  U-Boot> mmc partconf 0
  EXT_CSD[179], PARTITION_CONFIG:
  BOOT_ACK: 0x0
  BOOT_PARTITION_ENABLE: 0x0
  PARTITION_ACCESS: 0x0

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
7 years agodm: mmc: Drop CONFIG_DM_MMC_OPS
Simon Glass [Sat, 29 Jul 2017 17:35:31 +0000 (11:35 -0600)]
dm: mmc: Drop CONFIG_DM_MMC_OPS

All boards which use DM_MMC have now been converted to use DM_MMC_OPS.
Drop the option and good riddance.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: Correct Kconfig condition for SPL_DM_MMC_OPS
Simon Glass [Sat, 29 Jul 2017 17:35:30 +0000 (11:35 -0600)]
dm: mmc: Correct Kconfig condition for SPL_DM_MMC_OPS

This should depend on SPL_DM_MMC, not SPL_DM. For it and update the only
affected board's defconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: imx: Move i.MX devices to use CONFIG_DM_MMC_OPS
Simon Glass [Sat, 29 Jul 2017 17:35:29 +0000 (11:35 -0600)]
dm: imx: Move i.MX devices to use CONFIG_DM_MMC_OPS

Now that the driver supports it, move these boards over to use driver
model fully for MMC.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: imx: cm_fx6: Enable more driver model support
Simon Glass [Sat, 29 Jul 2017 17:35:28 +0000 (11:35 -0600)]
dm: imx: cm_fx6: Enable more driver model support

Enable driver model for MMC (including BLK), SATA and USB. Note that USB
does not yet work correctly since the nodes are disabled. Hopefully this
can be resolved by the maintainer.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: imx: cm_fx6: Add MMC support for CONFIG_BLK
Simon Glass [Sat, 29 Jul 2017 17:35:27 +0000 (11:35 -0600)]
dm: imx: cm_fx6: Add MMC support for CONFIG_BLK

When CONFIG_BLK is enabled our weak board_mmc_init() will not be called.
Since there is no clock driver for MX6 yet, we must manually enable the
clocks.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: imx: cm_fx6: Add device tree for cm_fx6
Simon Glass [Sat, 29 Jul 2017 17:35:26 +0000 (11:35 -0600)]
dm: imx: cm_fx6: Add device tree for cm_fx6

Add this file so we can use device-tree control for cm_fx6. It comes from
linux 4.12.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: imx: cm_fx6: Support driver model for SATA
Simon Glass [Sat, 29 Jul 2017 17:35:25 +0000 (11:35 -0600)]
dm: imx: cm_fx6: Support driver model for SATA

Add support for using driver model for SATA with the cm_fx6 board. The old
code remains for now to permit testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Update to support MMC operations
Simon Glass [Sat, 29 Jul 2017 17:35:24 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Update to support MMC operations

This driver does not currently support CONFIG_DM_MMC_OPS. Update it to
fully convert it to driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Update to support livetree
Simon Glass [Sat, 29 Jul 2017 17:35:23 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Update to support livetree

Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Drop mmc_init() call from fsl_esdhc_init()
Simon Glass [Sat, 29 Jul 2017 17:35:22 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Drop mmc_init() call from fsl_esdhc_init()

We want to use fsl_esdhc_init() with driver model. Move the mmc_init() out
of this function so that we can use it for our common init.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Set up platform data
Simon Glass [Sat, 29 Jul 2017 17:35:21 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Set up platform data

With driver model we want to store the mmc and configuration structure in
platform data. Set up structure up and use it for non-DM as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Detect init failure
Simon Glass [Sat, 29 Jul 2017 17:35:20 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Detect init failure

Since esdhc_init_common() can fail it should return an error code. Update
this and also adjust the timeout mechanism to use get_timer(), which is a
more common approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Detect reset failure
Simon Glass [Sat, 29 Jul 2017 17:35:19 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Detect reset failure

Since esdhc_reset() can fail it should return an error code. Update this
and also adjust the timeout mechanism to use get_timer(), which is a more
common approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Set up common versions of operations
Simon Glass [Sat, 29 Jul 2017 17:35:18 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Set up common versions of operations

Driver model wants to use the core functions in this file but accesses the
driver-private data in a different way. Move the code into new 'common'
functions and set up stubs to call these. Also sort the operations into
alphabetical order for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: mmc: fsl_esdhc: Pass private data to internal functions
Simon Glass [Sat, 29 Jul 2017 17:35:17 +0000 (11:35 -0600)]
dm: mmc: fsl_esdhc: Pass private data to internal functions

With driver model we will not use mmc->priv to access driver-private data.
To accomodate this, update internal functions so that we can pass the
private data directly. This will allow the caller to obtain it as it
prefers.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dwc_ahsata: Add support for driver model
Simon Glass [Sat, 29 Jul 2017 17:35:16 +0000 (11:35 -0600)]
dm: sata: dwc_ahsata: Add support for driver model

Update this driver to support driver model. This involves implementing the
AHCI operations and reusing existing common code.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: Update the AHCI uclass to support operations
Simon Glass [Sat, 29 Jul 2017 17:35:15 +0000 (11:35 -0600)]
dm: sata: Update the AHCI uclass to support operations

At present the AHCI uclass is just a shell and we still use the global
functions to access SATA. Fix this by adding operations to the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: imx: Allow driver model to be used for sata
Simon Glass [Sat, 29 Jul 2017 17:35:14 +0000 (11:35 -0600)]
dm: sata: imx: Allow driver model to be used for sata

Update the sata call to work with driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: Support driver model with the 'sata' command
Simon Glass [Sat, 29 Jul 2017 17:35:13 +0000 (11:35 -0600)]
dm: sata: Support driver model with the 'sata' command

Update this command to support driver model. This has a different way of
starting and stopping SATA.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Set up common versions of operations
Simon Glass [Sat, 29 Jul 2017 17:35:12 +0000 (11:35 -0600)]
dm: sata: dw_sata: Set up common versions of operations

Driver model wants to use the core functions in this file but accesses the
uclass-private data in a different way. Move the code into new 'common'
functions and set up stubs to call these.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: More ahci_init_one() futher down
Simon Glass [Sat, 29 Jul 2017 17:35:11 +0000 (11:35 -0600)]
dm: sata: dw_sata: More ahci_init_one() futher down

This function will not be used with driver model and it relates to the
other exported functions. Move it down next to them.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Drop is_ready
Simon Glass [Sat, 29 Jul 2017 17:35:10 +0000 (11:35 -0600)]
dm: sata: dw_sata: Drop is_ready

This variable is set but never used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Rename the dwc_ahsata private header
Simon Glass [Sat, 29 Jul 2017 17:35:09 +0000 (11:35 -0600)]
dm: sata: dw_sata: Rename the dwc_ahsata private header

Rename dwc_ahsata.h to indicate that it is a private header file. We plan
to create another header with some public functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Sort #include directives
Simon Glass [Sat, 29 Jul 2017 17:35:08 +0000 (11:35 -0600)]
dm: sata: dw_sata: Sort #include directives

Sort the header file inclusions into the correct order.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Drop unnecessary brackets
Simon Glass [Sat, 29 Jul 2017 17:35:07 +0000 (11:35 -0600)]
dm: sata: dw_sata: Drop unnecessary brackets

There is a strange &(var) coding style in this driver. Adjust it to use
&var instead, which is more usual.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Pass uc_priv to internal functions
Simon Glass [Sat, 29 Jul 2017 17:35:06 +0000 (11:35 -0600)]
dm: sata: dw_sata: Pass uc_priv to internal functions

With driver model sata_dev_desc[] does not exist. We still want to use the
common code of this driver so update it to pass struct ahci_uc_priv * to
each of these functions, instead of an integer which must be looked up in
sata_dev_desc[].

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Drop unnecessary casts
Simon Glass [Sat, 29 Jul 2017 17:35:05 +0000 (11:35 -0600)]
dm: sata: dw_sata: Drop unnecessary casts

Most of the casts in this driver are not necessary. With driver model we
do not cast from void *. Update the driver to follow this rule.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Rename 'probe_ent' to uc_priv
Simon Glass [Sat, 29 Jul 2017 17:35:04 +0000 (11:35 -0600)]
dm: sata: dw_sata: Rename 'probe_ent' to uc_priv

With driver model this becomes uclass-private data. Rename the parameter
varable to reflect this.

With the driver model conversion we will not have any exported functions.
Move all exported functions to be together at the end of the file so that
we can deal with them in one #ifdef block.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Move exported functions to the end
Simon Glass [Sat, 29 Jul 2017 17:35:03 +0000 (11:35 -0600)]
dm: sata: dw_sata: Move exported functions to the end

With the driver model conversion we will not have any exported functions.
Move all exported functions to be together at the end of the file so that
we can deal with them in one #ifdef block.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dw_sata: Drop dwc_ahsata_rw_ncq_cmd()
Simon Glass [Sat, 29 Jul 2017 17:35:02 +0000 (11:35 -0600)]
dm: sata: dw_sata: Drop dwc_ahsata_rw_ncq_cmd()

This function is not called from anywhere. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: sata: dwc_ahsata: Make functions static
Simon Glass [Sat, 29 Jul 2017 17:35:01 +0000 (11:35 -0600)]
dm: sata: dwc_ahsata: Make functions static

Some functions are not called from outside this file. Make these static
to make that obvious.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: core: Add a comment about the device_remove() flags
Simon Glass [Sat, 29 Jul 2017 17:35:00 +0000 (11:35 -0600)]
dm: core: Add a comment about the device_remove() flags

We should explain which flags are used for this function. Update the
comment to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: blk: Update return value in blk_create_devicef()
Simon Glass [Sat, 29 Jul 2017 17:34:59 +0000 (11:34 -0600)]
dm: blk: Update return value in blk_create_devicef()

This returns 'ret' but the value is always zero. Update it to simply
return 0, for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: usb: Adjust the 'usb' command to use blk_common_cmd()
Simon Glass [Sat, 29 Jul 2017 17:34:58 +0000 (11:34 -0600)]
dm: usb: Adjust the 'usb' command to use blk_common_cmd()

Instead of having separate code in the 'usb' command, adjust it to use
the common function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: ide: Adjust the 'ide' command to use blk_common_cmd()
Simon Glass [Sat, 29 Jul 2017 17:34:57 +0000 (11:34 -0600)]
dm: ide: Adjust the 'ide' command to use blk_common_cmd()

Instead of having separate code in the 'ide' command, adjust it to use
the common function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: scsi: Adjust the 'scsi' command to use blk_common_cmd()
Simon Glass [Sat, 29 Jul 2017 17:34:56 +0000 (11:34 -0600)]
dm: scsi: Adjust the 'scsi' command to use blk_common_cmd()

Instead of having separate code in the 'scsi' command, adjust it to use
the common function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: sata: Adjust the 'sata' command to use blk_common_cmd()
Simon Glass [Sat, 29 Jul 2017 17:34:55 +0000 (11:34 -0600)]
dm: sata: Adjust the 'sata' command to use blk_common_cmd()

Instead of having separate code in the 'sata' command, adjust it to use
the common function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: blk: Add a generic function for block device commands
Simon Glass [Sat, 29 Jul 2017 17:34:54 +0000 (11:34 -0600)]
dm: blk: Add a generic function for block device commands

Most block devices provide a command (e.g. 'sata', 'scsi', 'ide') and
these commands generally do the same thing. This makes it harder to
maintain this code and keep it consistent.

We now have a block device interface which is either implemented by driver
model (when CONFIG_BLK is enabled) or with a legacy interface. Therefore
it is possible to handle most of what these commands do with generic code.

Add a new generic function to process block-device commands using the
interface type and the current device number for that type.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: blk: Add a function to find an interface-type name
Simon Glass [Sat, 29 Jul 2017 17:34:53 +0000 (11:34 -0600)]
dm: blk: Add a function to find an interface-type name

Add a function to find the name of an interface type (e.g. "sata", "scsi")
from the interface type enum.

This is useful for generic code (not specific to SATA or SCSI, for
example) that wants to display the type of interface it is dealing with.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: core: Avoid calling dm_scan_fdt_dev() with of-platdata
Simon Glass [Sat, 29 Jul 2017 17:34:52 +0000 (11:34 -0600)]
dm: core: Avoid calling dm_scan_fdt_dev() with of-platdata

We cannot call dm_scan_fdt_dev() with of-platdata since there is no device
tree. Fix this with an #if check.

Fixes: 3be9a37 (dm: syscon: scan sub-nodes of the syscon node)
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agommc: gen_atmel_mci: Fix wrong arguments used of bind()
Wenyou.Yang@microchip.com [Wed, 26 Jul 2017 06:35:42 +0000 (14:35 +0800)]
mmc: gen_atmel_mci: Fix wrong arguments used of bind()

The bind() method is called before the device is probed and so the
device has no private data, should use the platform data, and set up
a new struct to hold the mmc and cfg members.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: sd_sdhi: Enable clock using clock framework
Marek Vasut [Fri, 21 Jul 2017 21:22:56 +0000 (23:22 +0200)]
mmc: sd_sdhi: Enable clock using clock framework

Since we now have clock driver for the RCar Gen3 , add support for
enabling the clock into the SH SDHI driver to prevent hacks in the
board files.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agommc: sh_sdhi: Fix the ACMD handling
Marek Vasut [Fri, 21 Jul 2017 21:22:55 +0000 (23:22 +0200)]
mmc: sh_sdhi: Fix the ACMD handling

The command handling in this driver is awful, esp. because the driver
depends on command numbers to determine whether this is APPCMD or not.
Also, handling of command RSP response types is totally wrong.

This patch at least plucks out some of the custom command encoding and
fixes the APPCMD handling. The RSP handling still needs work, yet that
might not be needed as it turns out the uniphier-sd.c driver is in much
better shape and supports the same IP, so we might be able to just drop
this driver in favor of the uniphier one.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agommc: sh_sdhi: Add DM and DT probing support
Marek Vasut [Fri, 21 Jul 2017 21:22:54 +0000 (23:22 +0200)]
mmc: sh_sdhi: Add DM and DT probing support

Add MMC DM and DT probing support into the SH SDHI driver.
This patch abstracts out the common bits of the send command
and set ios functions, so they can be used both by DM and non
DM setups and adds the DM probe support.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agommc: uniphier-sd: Fix long response processing
Marek Vasut [Fri, 21 Jul 2017 21:11:59 +0000 (23:11 +0200)]
mmc: uniphier-sd: Fix long response processing

The long response entry 0..3 LSByte comes from the next response
register MSByte, not from the next response register LSByte. Fix
this to make the driver report correct values in response 136 .

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoMerge git://git.denx.de/u-boot-tegra
Tom Rini [Wed, 16 Aug 2017 22:12:58 +0000 (18:12 -0400)]
Merge git://git.denx.de/u-boot-tegra

7 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Wed, 16 Aug 2017 22:12:35 +0000 (18:12 -0400)]
Merge git://git.denx.de/u-boot-sunxi

Update A20-OLinuXino-Lime2-eMMC_defconfig to include CONFIG_SCSI

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge git://www.denx.de/git/u-boot-imx
Tom Rini [Wed, 16 Aug 2017 22:07:20 +0000 (18:07 -0400)]
Merge git://www.denx.de/git/u-boot-imx

Update pfla02 for setenv changes and PHYLIB/etc migration to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge git://git.denx.de/u-boot-spi
Tom Rini [Wed, 16 Aug 2017 22:07:15 +0000 (18:07 -0400)]
Merge git://git.denx.de/u-boot-spi

7 years agosf: Preserve QE bit when clearing BP# bits for Macronix flash
Bin Meng [Sun, 23 Jul 2017 14:44:37 +0000 (07:44 -0700)]
sf: Preserve QE bit when clearing BP# bits for Macronix flash

On some flash (like Macronix), QE (quad enable) bit is in the same
status register as BP# bits, and we need preserve its original value
during a reboot cycle as this is required by some platforms (like
Intel ICH SPI controller working under descriptor mode).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
[Refined code for readability]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
7 years agoenv: Adjust the load() method to return an error
Simon Glass [Thu, 3 Aug 2017 18:22:17 +0000 (12:22 -0600)]
env: Adjust the load() method to return an error

The load() methods have inconsistent behaviour on error. Some of them load
an empty default environment. Some load an environment containing an error
message. Others do nothing.

As a step in the right direction, have the method return an error code.
Then the caller could handle this itself in a consistent way.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Adjust the get_char() method to return an int
Simon Glass [Thu, 3 Aug 2017 18:22:16 +0000 (12:22 -0600)]
env: Adjust the get_char() method to return an int

In principle this can fail, e.g. if the index is out of range. Adjust the
driver signature to allow returning an error code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoenv: Rename some other getenv()-related functions
Simon Glass [Thu, 3 Aug 2017 18:22:15 +0000 (12:22 -0600)]
env: Rename some other getenv()-related functions

We are now using an env_ prefix for environment functions. Rename these
other functions as well, for consistency:

   getenv_vlan()
   getenv_bootm_size()
   getenv_bootm_low()
   getenv_bootm_mapsize()
   env_get_default()

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()
Simon Glass [Thu, 3 Aug 2017 18:22:14 +0000 (12:22 -0600)]
env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()

Rename this function for consistency with env_get().

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename getenv_hex(), getenv_yesno(), getenv_ulong()
Simon Glass [Thu, 3 Aug 2017 18:22:13 +0000 (12:22 -0600)]
env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename getenv/_f() to env_get()
Simon Glass [Thu, 3 Aug 2017 18:22:12 +0000 (12:22 -0600)]
env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()
Simon Glass [Thu, 3 Aug 2017 18:22:11 +0000 (12:22 -0600)]
env: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()

Rename this function for consistency with env_set().

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename common functions related to setenv()
Simon Glass [Thu, 3 Aug 2017 18:22:10 +0000 (12:22 -0600)]
env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoenv: Rename setenv() to env_set()
Simon Glass [Thu, 3 Aug 2017 18:22:09 +0000 (12:22 -0600)]
env: Rename setenv() to env_set()

We are now using an env_ prefix for environment functions. Rename setenv()
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoimx: mx7: fix build warning when CONFIG_IMX_RDC not enabled
Peng Fan [Sat, 12 Aug 2017 14:10:57 +0000 (22:10 +0800)]
imx: mx7: fix build warning when CONFIG_IMX_RDC not enabled

Fix build warning when CONFIG_IMX_RDC not defined in defconfig.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoimx: mx6sl: simplify code using setbits_le32
Peng Fan [Tue, 8 Aug 2017 08:21:39 +0000 (16:21 +0800)]
imx: mx6sl: simplify code using setbits_le32

Simplify code by removing set_preclk_from_osc with directly setbits_le32.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoimx: mx6sx: select OSC as uart's clk parent
Peng Fan [Tue, 8 Aug 2017 08:21:38 +0000 (16:21 +0800)]
imx: mx6sx: select OSC as uart's clk parent

As M4 is sourcing UART clk from OSC, to make UART work
when M4 is enabled, need to select OSC as clk parent,
24M OSC is enough for debug UART in uboot.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoimx: mx6: soc: fix mx6sll settings
Peng Fan [Tue, 8 Aug 2017 08:21:35 +0000 (16:21 +0800)]
imx: mx6: soc: fix mx6sll settings

There is not LDO_SOC/PU/ARM/MMDC1 on i.MX6SLL, also no need to gate/ungate
all PFDs to make PFD working.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoimx: mx6: select ARM_ERRATA_845369
Peng Fan [Tue, 8 Aug 2017 05:34:53 +0000 (13:34 +0800)]
imx: mx6: select ARM_ERRATA_845369

Select ARM_ERRATA_845369 for i.MX6DQ/DL/QP.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoarm: Implement workaround for Cortex-A9 errata 845369
Peng Fan [Tue, 8 Aug 2017 05:34:52 +0000 (13:34 +0800)]
arm: Implement workaround for Cortex-A9 errata 845369

Under very rare timing circumstances, transitioning into streaming
mode might create a data corruption. Present on Two or more processors
or 1 core with ACP, all revisions. This erratum can be worked round
by setting bit[22] of the undocumented Diagnostic Control Register to 1.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoARM: i.MX6: exclude the ARM errata from i.MX6 UP system
Peng Fan [Tue, 8 Aug 2017 05:34:51 +0000 (13:34 +0800)]
ARM: i.MX6: exclude the ARM errata from i.MX6 UP system

The ARM errata 751472, 794072, 761320 only applied
to the following configuration:

This erratum affects configurations with either:
- One processor if the ACP is present
- Two or more processors

i.MX6 family does not have the ACP and thus only the MPCore system
will be impacted, which are the i.MX6DQ, i.MX6DL, and i.MX6QP.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoimx: imx6ull: correct get_cpu_speed_grade_hz
Sébastien Szymanski [Wed, 2 Aug 2017 15:05:27 +0000 (17:05 +0200)]
imx: imx6ull: correct get_cpu_speed_grade_hz

i.MX6ULL has different speed grades than i.MX6UL.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
7 years agoimx: imx6ul: correct get_cpu_speed_grade_hz on 696MHz SoCs
Sébastien Szymanski [Wed, 2 Aug 2017 15:05:26 +0000 (17:05 +0200)]
imx: imx6ul: correct get_cpu_speed_grade_hz on 696MHz SoCs

Return the correct value when the speed grade is 696MHz.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
7 years agomx6sabreauto: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values
Breno Lima [Wed, 2 Aug 2017 17:08:41 +0000 (14:08 -0300)]
mx6sabreauto: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values

The IPU AXI QoS for the i.MX6QP and i.MX6DP processors have to be set as
commented in the code:
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */

Set IOMUXC_GPR6 and IOMUXC_GPR7 to 0x77177717 instead of 0x007F007F.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
7 years agomx6sabresd: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values
Breno Lima [Wed, 2 Aug 2017 17:03:49 +0000 (14:03 -0300)]
mx6sabresd: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values

The IPU AXI QoS for the i.MX6QP and i.MX6DP processors have to be set as
commented in the code:
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */

Set IOMUXC_GPR6 and IOMUXC_GPR7 to 0x77177717 instead of 0x007F007F.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
7 years agoimx6: clock: correct comment for PLL_VIDEO
Anatolij Gustschin [Wed, 2 Aug 2017 14:05:12 +0000 (16:05 +0200)]
imx6: clock: correct comment for PLL_VIDEO

This appear to be a copy-paste error, clean it up.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoimx6: use SION macro in SDn_CMD mux mode bitfield arguments
Anatolij Gustschin [Wed, 2 Aug 2017 13:56:11 +0000 (15:56 +0200)]
imx6: use SION macro in SDn_CMD mux mode bitfield arguments

Select SION by appropriate macro instead of constant.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoenv: Drop saveenv() in favour of env_save()
Simon Glass [Thu, 3 Aug 2017 18:22:08 +0000 (12:22 -0600)]
env: Drop saveenv() in favour of env_save()

Use the env_save() function directly now that there is only one
implementation of saveenv().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoenv: Drop env_relocate_spec() in favour of env_load()
Simon Glass [Thu, 3 Aug 2017 18:22:07 +0000 (12:22 -0600)]
env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>