oweals/u-boot.git
7 years agosplash_source: Verify FIT magic
Niko Mauno [Thu, 3 Aug 2017 06:53:24 +0000 (09:53 +0300)]
splash_source: Verify FIT magic

Before reading entire FIT image, add sanity check by testing image
header against FDT_MAGIC. This should help avoid problems in situations
where FIT is not yet available from storage device, for example when
performing initial programming of device.

Cc: Anatolij Gustschin <agust@denx.de>
Acked-by: Tomas Melin <tomas.melin@vaisala.com>
7 years agovideo: ipuv3_fb: skip IPU shutdown if IPU was not enabled before
Anatolij Gustschin [Mon, 4 Sep 2017 21:33:45 +0000 (23:33 +0200)]
video: ipuv3_fb: skip IPU shutdown if IPU was not enabled before

Boards can skip display interface init using board_video_skip().
If display interface was not initialized (e.g. no ipuv3 framebuffer
registered or IPU clock disabled), booting Linux stops due to the
crash in IPU shutdown function, when accessing IPU registers.
Check IPU clock and skip shutdown if clock is not enabled.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
7 years agoPrepare v2017.09-rc4 v2017.09-rc4
Tom Rini [Mon, 4 Sep 2017 13:02:48 +0000 (09:02 -0400)]
Prepare v2017.09-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocrypto/fsl: fix obj-yy in Makefile
Clemens Gruber [Sun, 3 Sep 2017 17:17:10 +0000 (19:17 +0200)]
crypto/fsl: fix obj-yy in Makefile

When enabling CONFIG_CMD_BLOB and/or CONFIG_CMD_DEKBLOB, the build fails
with a linker error:
  ...
  LD      u-boot
arch/arm/mach-imx/built-in.o: In function `blob_encap_dek':
/home/clemens/dev/u-boot/arch/arm/mach-imx/cmd_dek.c:46: undefined
reference to `blob_dek'

This is due to an error in the Makefile, resulting in obj-yy/obj-yn/..
and fsl_blob.o is therefore not linked.

Fix it by splitting it up into two obj-y lines.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
7 years agogit: mailrc: Update e-mail address
Lukasz Majewski [Sun, 3 Sep 2017 16:13:11 +0000 (18:13 +0200)]
git: mailrc: Update e-mail address

Signed-off-by: Lukasz Majewski <lukma@denx.de>
7 years agoMakefile: Suppress output of python libfdt build command
Bin Meng [Sun, 3 Sep 2017 11:37:49 +0000 (04:37 -0700)]
Makefile: Suppress output of python libfdt build command

This should not be printed by default. Prefix it with $(Q).

Fixes ee95d10b: ("fdt: Build the new python libfdt module")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoMakefile: Quiesce libfdt build
Bin Meng [Sun, 3 Sep 2017 11:37:48 +0000 (04:37 -0700)]
Makefile: Quiesce libfdt build

Since commit 3809e302 "Makefile: honor PYTHON configuration properly",
the build commands of libfdt are printed while previously were not.

This adds the missing '--quiet' back.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoomap3: evm: Fixes for CONFIG_NAND, SPL_OS_BOOT, USB, and environment
Derald D. Woods [Sat, 2 Sep 2017 22:43:05 +0000 (17:43 -0500)]
omap3: evm: Fixes for CONFIG_NAND, SPL_OS_BOOT, USB, and environment

- Pass MTDPARTS kernel arguments to kernel
- Use Kconfig CONFIG_NAND instead of CONFIG_SYS_EXTRA_OPTIONS="NAND"
- Call 'usb_stop' on kernel start
- Update Falcon mode setup to match other OMAP3 boards
- Use "uEnv.txt" as boot script instead of "boot.scr"

7 years agoblock: Drop the ftide020 driver
Bin Meng [Sat, 2 Sep 2017 15:43:54 +0000 (08:43 -0700)]
block: Drop the ftide020 driver

This is not used in U-Boot.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoblock: ide: Drop CONFIG_IDE_LED
Bin Meng [Sat, 2 Sep 2017 15:43:53 +0000 (08:43 -0700)]
block: ide: Drop CONFIG_IDE_LED

This is actually not used. Drop it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoblock: ide: Drop CONFIG_IDE_INIT_POSTRESET
Bin Meng [Sat, 2 Sep 2017 15:43:52 +0000 (08:43 -0700)]
block: ide: Drop CONFIG_IDE_INIT_POSTRESET

This is not referenced anywhere. Drop it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Remove dead codes in nvme_setup_io_queues()
Bin Meng [Sat, 2 Sep 2017 15:15:37 +0000 (08:15 -0700)]
nvme: Remove dead codes in nvme_setup_io_queues()

Execution cannot reach this statement: "nr_io_queues = result;"

Reported-by: Coverity (CID: 166731)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agonvme: Fix potential sign extension issue in nvme_blk_rw()
Bin Meng [Sat, 2 Sep 2017 15:15:36 +0000 (08:15 -0700)]
nvme: Fix potential sign extension issue in nvme_blk_rw()

"lbas" with type "u16" (16 bits, unsigned) is promoted in
"lbas << ns->lba_shift" to type "int" (32 bits, signed), then
sign-extended to type "unsigned long long" (64 bits, unsigned).
If "lbas << ns->lba_shift" is greater than 0x7FFFFFFF, the upper
bits of the result will all be 1.

Fix it by casting "lbas" to "u32".

Reported-by: Coverity (CID: 166730)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agonvme: Fix wrong ndev->queues memset
Bin Meng [Sat, 2 Sep 2017 15:15:35 +0000 (08:15 -0700)]
nvme: Fix wrong ndev->queues memset

memset() was given a sizeof(NVME_Q_NUM * sizeof(struct nvme_queue *)
to clear, which is wrong.

Reported-by: Coverity (CID: 166729)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agodisk: part: fix typo
Heinrich Schuchardt [Tue, 29 Aug 2017 16:36:59 +0000 (18:36 +0200)]
disk: part: fix typo

%s/Desriptor/Descriptor/g

Fix lines over 80 characters with said typo.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agofix: fw_env: Prevent writing error message on special files, which don't support...
Lukasz Majewski [Sun, 27 Aug 2017 11:46:22 +0000 (13:46 +0200)]
fix: fw_env: Prevent writing error message on special files, which don't support fsync

According to fsync specification [1] some special files (e.g., a pipe, FIFO,
or socket) don't support synchronization and return either EROFS or EINVAL.

On the linux side the sys_fsync -> do_fsync() checks if the requested file
has f_op->fsync defined. If not it returns EINVAL [2].

This commit prevents writing error messages for files (devices), which
do not support fsync().

[1] - http://man7.org/linux/man-pages/man2/fsync.2.html
[2] - http://elixir.free-electrons.com/linux/v4.13-rc6/source/fs/sync.c#L183

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Michael Heimpold <mhei@heimpold.de>
7 years agobch: don't use __BSD_VISIBLE to test for fls
Jonathan Gray [Sun, 27 Aug 2017 10:45:14 +0000 (20:45 +1000)]
bch: don't use __BSD_VISIBLE to test for fls

Commit 4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d assumes fls is in libc
if __BSD_VISIBLE is defined.  This appears to only be true on FreeBSD
and DragonFlyBSD.  OpenBSD defines __BSD_VISIBLE and does not have fls
in strings.h/libc.

Switch the test for __BSD_VISIBLE to one for __DragonFly__ and
__FreeBSD__ to unbreak the build on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
7 years agoinclude/configs: remove numerous CONFIG_SYS_BARGSIZE definitions
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:06 +0000 (22:59 +0200)]
include/configs: remove numerous CONFIG_SYS_BARGSIZE definitions

This commit removes definitions of CONFIG_SYS_BARGSIZE defined to be
equal to CONFIG_SYS_CBSIZE in numerous configuration files.

We remove such definitions in two situations:

 - CONFIG_SYS_CBSIZE is otherwise not defined in the board
   configuration file, which means the default value of
   CONFIG_SYS_CBSIZE == 256 applies. In this case, the default value
   of CONFIG_SYS_BARGSIZE == 512 (common/image.c) is suitable, as it is
   larger.

 - CONFIG_SYS_CBSIZE is defined in the board configuration file, but
   to a value equal or less than 512. In this case, the default value
   of CONFIG_SYS_BARGSIZE == 512 (common.image.c) is suitable, as it
   is equal or larger.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/configs: remove default values of CONFIG_SYS_BARGSIZE
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:05 +0000 (22:59 +0200)]
include/configs: remove default values of CONFIG_SYS_BARGSIZE

CONFIG_SYS_BARGSIZE is already defined to 512 in common/image.c when
not defined. Therefore, there is no point in having board
configuration files define it to 512.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/configs: drop default definitions of CONFIG_SYS_MAXARGS
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:04 +0000 (22:59 +0200)]
include/configs: drop default definitions of CONFIG_SYS_MAXARGS

Now that include/config_fallbacks.h define a sane fallback for
CONFIG_SYS_MAXARGS, we can drop the definition of this constant in all
configurations that were using the default value.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/config_fallbacks.h: add default for CONFIG_SYS_MAXARGS
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:03 +0000 (22:59 +0200)]
include/config_fallbacks.h: add default for CONFIG_SYS_MAXARGS

CONFIG_SYS_MAXARGS contains the maximum number of arguments accepted
by U-Boot commands. Since the vast majority of the platforms define it
to 16, it makes sense to have a default definition to 16, which will
allow to remove this definition from a significant number of
platforms.

It will allow to remove the default definition from 216 platform .h
files, leaving only 56 platforms with non-default values (15, 24, 32,
48, 64, 96, 128 or 256).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/configs: drop default definitions of CONFIG_SYS_PBSIZE
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:02 +0000 (22:59 +0200)]
include/configs: drop default definitions of CONFIG_SYS_PBSIZE

Now that the fallback value of CONFIG_SYS_PBSIZE in
include/config_fallbacks.h has been adjusted, remove its definition
from a large number of board configuration files.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/config_fallbacks.h: change fallback for CONFIG_SYS_PBSIZE
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:01 +0000 (22:59 +0200)]
include/config_fallbacks.h: change fallback for CONFIG_SYS_PBSIZE

Most of the platforms are using CONFIG_SYS_CBSIZE +
sizeof(CONFIG_SYS_PROMPT) + 16 as their value for CONFIG_SYS_PBSIZE,
so let's adopt this for the fallback value of CONFIG_SYS_PBSIZE.

This will allow us to drop an explicit definition of CONFIG_SYS_PBSIZE
from a large number of platforms.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/configs: remove CONFIG_SYS_CBSIZE when the default value is used
Thomas Petazzoni [Wed, 23 Aug 2017 20:59:00 +0000 (22:59 +0200)]
include/configs: remove CONFIG_SYS_CBSIZE when the default value is used

Now that include/config_fallbacks.h define a sane fallback for
CONFIG_SYS_CBSIZE, we can drop the definition of this constant in all
configurations that were using the default value.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Drop <config.h> from stih410-b2260.h]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoinclude/config_fallbacks.h: add default for CONFIG_SYS_CBSIZE
Thomas Petazzoni [Wed, 23 Aug 2017 20:58:59 +0000 (22:58 +0200)]
include/config_fallbacks.h: add default for CONFIG_SYS_CBSIZE

CONFIG_SYS_CBSIZE contains the buffer size for input for the
console. The vast majority of platforms define them to some reasonable
value (256, 512 or 1024 bytes), and it is quite annoying to repeat
this definition for all platforms while it isn't really HW-related.

Therefore, let's provide a sane fallback value in config_fallbacks.h,
so that platforms can rely on it instead of having to explicitly
define it.

We use 1024 when KGDB is enabled, and 256 otherwise, which is what the
majority of the platforms are doing.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agopart: efi: Disable overlap check
Maxime Ripard [Wed, 23 Aug 2017 14:01:33 +0000 (16:01 +0200)]
part: efi: Disable overlap check

The current code checks that no partitions overlap with the GPT partition
table using the offset of the first LBA usable for that partition.

This works fine, unless you have a partition entry that is further away
than it usually is and you want to create partitions in the gap between the
GPT header and the GPT partition entries, for example to reflash a
bootloader that needs to be set there.

Rework the test to something a bit smarter that checks whether a partition
would overlap with either the GPT header or the partition entries, no
matter where it is on the disk.

Partitions that do not have a start LBA specified will still start at the
first LBA usable set in the GPT header, to avoid weird behaviours.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agopart: efi: make gpt_fill_pte take the device descriptor
Maxime Ripard [Wed, 23 Aug 2017 14:01:32 +0000 (16:01 +0200)]
part: efi: make gpt_fill_pte take the device descriptor

The gpt_fill_pte will need to access the device block size. Let's pass the
device descriptor as an argument.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agopart: efi: rework the partition start and size in gpt_fill_pte
Maxime Ripard [Wed, 23 Aug 2017 14:01:31 +0000 (16:01 +0200)]
part: efi: rework the partition start and size in gpt_fill_pte

The start variable is only used inside a loop, and is never affected inside
it, so it's a purely local variable.

In the same way the partition size is accessed several times, so we can
store it in a variable.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agopart: efi: Fix offset
Maxime Ripard [Wed, 23 Aug 2017 14:01:30 +0000 (16:01 +0200)]
part: efi: Fix offset

Both the config option and the DT options specify the offset to set the GPT
at in bytes, yet the code treats those values as block numbers.

Fix that.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Sun, 3 Sep 2017 00:50:59 +0000 (20:50 -0400)]
Merge git://git.denx.de/u-boot-x86

7 years agoKconfig: Add EEPROM options to Kconfig when I2C_EEPROM is set
Adam Ford [Sun, 13 Aug 2017 14:00:28 +0000 (09:00 -0500)]
Kconfig: Add EEPROM options to Kconfig when I2C_EEPROM is set

Add the following options to drivers/misc/Kconfig:
SYS_I2C_EEPROM_ADDR
SYS_I2C_EEPROM_BUS
SYS_EEPROM_SIZE
SYS_EEPROM_PAGE_WRITE_BITS
SYS_EEPROM_PAGE_WRITE_DELAY_MS
SYS_I2C_EEPROM_ADDR_LEN
SYS_I2C_EEPROM_ADDR_OVERFLOW

This does not migrate any boards, but provides a foundations for
those who want/need these options

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Migrate uniphier]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agox86: theadorable-x86-common: Remove "ip=dhcp" from default environment
Stefan Roese [Wed, 30 Aug 2017 07:40:17 +0000 (09:40 +0200)]
x86: theadorable-x86-common: Remove "ip=dhcp" from default environment

Without ethernet cable plugged, "ip=dhcp" leads to a complete hangup in
Linux booting and the system does not boot into userland at all. Since
its not required to have an active network connection on these board,
lets remove this statement from the default environment.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: baytrail: acpi: Add full reset bit to the reset register value in FADT
Bin Meng [Tue, 29 Aug 2017 05:09:11 +0000 (22:09 -0700)]
x86: baytrail: acpi: Add full reset bit to the reset register value in FADT

It was noticed a few times, that the reboot from Linux (reboot command)
is different from the reboot (reset command) under U-Boot. The U-Boot
version does seem to reset the board more deeply (PCI cards etc) than
the Linux reboot.

This is actually caused by missing full reset bit in the reset register
value in the ACPI FADT table.

Reported-by: Stefan Roese <sr@denx.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stefan Roese <sr@denx.de>
7 years agox86: ich-spi: Clear atomic preop only when SPI settings are not locked
Bin Meng [Sun, 27 Aug 2017 02:22:59 +0000 (19:22 -0700)]
x86: ich-spi: Clear atomic preop only when SPI settings are not locked

The atomic preop register can only be written when SPI settings are
not locked, otherwise it's read-only.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
7 years agox86: ich-spi: Remove useless assignment in ich_spi_xfer()
Bin Meng [Sun, 27 Aug 2017 02:22:58 +0000 (19:22 -0700)]
x86: ich-spi: Remove useless assignment in ich_spi_xfer()

In ich_spi_xfer() when the driver presets control fields, control
variable gets assigned twice. Apparently only the last assignment
takes effect. Remove the other one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
7 years agoomap3_logic: Move CONFIG_SYS_NAND_U_BOOT_OFFS to Kconfig
Adam Ford [Sun, 13 Aug 2017 13:21:39 +0000 (08:21 -0500)]
omap3_logic: Move CONFIG_SYS_NAND_U_BOOT_OFFS to Kconfig

Manually enable SYS_NAND_U_BOOT_LOCATIONS.
Set CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 and remove it from header

Signed-off-by: Adam Ford <aford173@gmail.com>
7 years agoConvert CONFIG_BCH to Kconfig
Adam Ford [Fri, 11 Aug 2017 14:46:05 +0000 (09:46 -0500)]
Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
   CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoConvert CONFIG_SPL_OMAP3_ID_NAND to Kconfig
Adam Ford [Fri, 11 Aug 2017 13:51:20 +0000 (08:51 -0500)]
Convert CONFIG_SPL_OMAP3_ID_NAND to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_OMAP3_ID_NAND

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoConvert CONFIG_SYS_I2C_BUS_MAX to Kconfig
Adam Ford [Fri, 11 Aug 2017 11:39:34 +0000 (06:39 -0500)]
Convert CONFIG_SYS_I2C_BUS_MAX to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_I2C_BUS_MAX

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
[trini: Fix AM43XX drop AM44XX]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoConfigs: Migrate I2C_BUS_MAX to CONFIG_SYS_I2C_BUS_MAX
Adam Ford [Fri, 11 Aug 2017 11:39:13 +0000 (06:39 -0500)]
Configs: Migrate I2C_BUS_MAX to CONFIG_SYS_I2C_BUS_MAX

For consistency with other platforms and in preparation of Kconfig
migration, let's change Several TI platforms that use I2C_BUS_MAX
to CONFIG_SYS_I2C_BUS_MAX

Signed-off-by: Adam Ford <aford173@gmail.com>
7 years agoKconfig: Migrate all of cmd/fastboot/Kconfig to defconfigs
Tom Rini [Fri, 25 Aug 2017 21:50:27 +0000 (17:50 -0400)]
Kconfig: Migrate all of cmd/fastboot/Kconfig to defconfigs

- Move ANDROID_IMAGE_SUPPORT to top level Kconfig under images as it's
  not strictly part of fastboot.
- Add some defaults for the fastboot buffer location and size
- Migrate all options listed in cmd/fastboot/Kconfig
- Cleanup the README

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoconfigs: Migrate all of the existing USB symbols, except fastboot
Tom Rini [Fri, 25 Aug 2017 21:50:26 +0000 (17:50 -0400)]
configs: Migrate all of the existing USB symbols, except fastboot

This syncs all of the currently Kconfig'd symbols out of the headers and
into the defconfig files.  This has two exceptions, first am335x_evm
needs to be converted to DM in SPL and then it can stop undef'ing
CONFIG_DM_USB.  Leaving this as-is results in a build failure, and
without work, run time failure.  The other case is am43xx_evm.h and in
turn am43xx_evm_usbhost_boot.  The problem here is that we need DWC3 USB
host mode in SPL, but still desire to have gadget mode in U-Boot proper.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoRevert "Merge git://git.denx.de/u-boot-video"
Tom Rini [Fri, 1 Sep 2017 20:17:17 +0000 (16:17 -0400)]
Revert "Merge git://git.denx.de/u-boot-video"

This reverts commit 1d20170467b079642be96996dcd71db64c3c365c, reversing
changes made to 6aee2ab68c362ace5a59f89a63abed82e0bf19e5.

The mxc_ipuv3_fb.c changes introduce build failures on some targets.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Fri, 1 Sep 2017 17:30:19 +0000 (13:30 -0400)]
Merge git://git.denx.de/u-boot-sunxi

7 years agoMerge git://git.denx.de/u-boot-video
Tom Rini [Fri, 1 Sep 2017 16:57:03 +0000 (12:57 -0400)]
Merge git://git.denx.de/u-boot-video

7 years agosunxi: Fix CONFIG_SUNXI_GMAC references
Dave Prue [Thu, 31 Aug 2017 17:21:01 +0000 (19:21 +0200)]
sunxi: Fix CONFIG_SUNXI_GMAC references

SUNXI_GMAC was still used to configure the code where as the
same has been renamed and moved to Kconfig in below commit
"sunxi: Move SUNXI_GMAC to Kconfig"
(sha1: 4d43d065db3262f9a9918ba72457bf36dfb8e0bb)

Signed-off-by: Dave Prue <dave@prue.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
[Tweek commit message, config_whitelist.txt, build-whitelist.sh]
Signed-off-by: Jagan Teki <jagan@openedev.com>
7 years agoMerge git://git.denx.de/u-boot-imx
Tom Rini [Fri, 1 Sep 2017 14:40:59 +0000 (10:40 -0400)]
Merge git://git.denx.de/u-boot-imx

Signed-off-by: Tom Rini <trini@konsulko.com>
Conflicts:
configs/imx6qdl_icore_mmc_defconfig
configs/imx6qdl_icore_rqs_defconfig

7 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Fri, 1 Sep 2017 14:33:21 +0000 (10:33 -0400)]
Merge git://git.denx.de/u-boot-marvell

7 years agoMerge git://git.denx.de/u-boot-uniphier
Tom Rini [Fri, 1 Sep 2017 14:32:35 +0000 (10:32 -0400)]
Merge git://git.denx.de/u-boot-uniphier

- add {ofnode,dev}_read_resource_byname
- provide DT probe hook to Denali NAND driver
- update clk/reset driver
- update DT
- misc cleanups

7 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Fri, 1 Sep 2017 14:31:07 +0000 (10:31 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

7 years agommc: sunxi: Only update timing mode bit when enabling new timing mode
Chen-Yu Tsai [Thu, 31 Aug 2017 13:57:48 +0000 (21:57 +0800)]
mmc: sunxi: Only update timing mode bit when enabling new timing mode

When enabling the new mmc timing mode, we inadvertently clear all the
remaining bits in the new timing mode register. The bits cleared
include a default phase delay on the output clock. The BSP kernel
states that the default values are supposed to be used. Clearing them
results in decreased performance or transfer errors on some boards.

Fixes: de9b1771c3b6 ("mmc: sunxi: Support new mode")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agoi.MX6Q: icorem6: Add falcon mode
Jagan Teki [Mon, 28 Aug 2017 11:15:48 +0000 (16:45 +0530)]
i.MX6Q: icorem6: Add falcon mode

Add Falcon mode support in Engicam i.CoreM6 board.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
7 years agoi.MX6Q: spl: Fix falcon to use dram_init_banksize
Jagan Teki [Mon, 28 Aug 2017 11:15:47 +0000 (16:45 +0530)]
i.MX6Q: spl: Fix falcon to use dram_init_banksize

Memory dt node update introduced by spl_fixup_fdt() in below
commit was making DDR configuration in-appropriate
to boot falcon mode. Hence added dram_init_banksize for
explicit assignment of  proper base and size of DDR.

"boot: fdt: Perform arch_fixup_fdt() on the given device tree for falcon boot"
(sha1: 6e7585bb64b12f632681c80c4b193349e1985d92)

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
7 years agoimx: remove SATA boot mode for i.MX 6UL and 6ULL
Stefan Agner [Tue, 29 Aug 2017 16:10:11 +0000 (09:10 -0700)]
imx: remove SATA boot mode for i.MX 6UL and 6ULL

The NXP i.MX 6UL and 6ULL do not support SATA and have no SATA
boot mode, hence remove it from the boot device detecion. This
fixes a build error introduced with 3bd1642d4d50 ("imx: fix USB
boot mode detection for i.MX 6UL and 6ULL")

Fixes: 3bd1642d4d50 ("imx: fix USB boot mode detection for i.MX 6UL and 6ULL")
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agoARM: mvebu: add "spi-flash" compatible string
Chris Packham [Tue, 29 Aug 2017 08:37:54 +0000 (20:37 +1200)]
ARM: mvebu: add "spi-flash" compatible string

U-boots spi-nor support is currently considered a work in progress. For
now to avoid issues it is necessary to add a "spi-flash" compatible
string. Eventually the "jedec,spi-nor" will be sufficient when the core
U-boot code is updated to support it.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Stefan Roese <sr@denx.de>
7 years agoARM: uniphier: enable Denali NAND driver for 64bit SoCs
Masahiro Yamada [Tue, 29 Aug 2017 15:51:30 +0000 (00:51 +0900)]
ARM: uniphier: enable Denali NAND driver for 64bit SoCs

Now the entry to the NAND driver init can be is controlled by DT;
it should not hurt to compile the driver all the time.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: set system bus pinmux for PXs3
Masahiro Yamada [Tue, 29 Aug 2017 06:42:20 +0000 (15:42 +0900)]
ARM: uniphier: set system bus pinmux for PXs3

The system bus is not enabled by default for NAND, eMMC boot
etc. of PXs3.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: move CONFIG_NAND to defconfig
Masahiro Yamada [Tue, 29 Aug 2017 06:41:32 +0000 (15:41 +0900)]
ARM: uniphier: move CONFIG_NAND to defconfig

This imply was added when the option was moved by the moveconfig tool,
but the intention is not clear.  Move it to defconfig.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: dts: uniphier: update PXs3 SoC/board DT
Masahiro Yamada [Tue, 29 Aug 2017 03:20:53 +0000 (12:20 +0900)]
ARM: dts: uniphier: update PXs3 SoC/board DT

Support PXs3 SoC and its reference development board.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: dts: uniphier: sync with Linux
Masahiro Yamada [Tue, 29 Aug 2017 03:20:52 +0000 (12:20 +0900)]
ARM: dts: uniphier: sync with Linux

Import updates queued up for Linux 4.14-rc1.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoreset: uniphier: add PXs3 support
Masahiro Yamada [Tue, 29 Aug 2017 03:20:51 +0000 (12:20 +0900)]
reset: uniphier: add PXs3 support

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoreset: uniphier: fix compatible for SD reset node for LD11/LD20
Masahiro Yamada [Tue, 29 Aug 2017 03:20:50 +0000 (12:20 +0900)]
reset: uniphier: fix compatible for SD reset node for LD11/LD20

LD20 has SD ctrl instead of MIO ctrl.  LD11 has both of them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoclk: uniphier: add System clock support
Masahiro Yamada [Mon, 28 Aug 2017 16:06:15 +0000 (01:06 +0900)]
clk: uniphier: add System clock support

Support system clocks for LD4, Pro4, sLD8, Pro5, PXs2/LD6b, LD11, LD20.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: fix DSPLL init code for LD20 SoC
Dai Okamura [Mon, 28 Aug 2017 12:57:15 +0000 (21:57 +0900)]
ARM: uniphier: fix DSPLL init code for LD20 SoC

Signed-off-by: Dai Okamura <okamura.dai@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: remove ad-hoc pin settings for NAND
Masahiro Yamada [Sat, 26 Aug 2017 08:58:03 +0000 (17:58 +0900)]
ARM: uniphier: remove ad-hoc pin settings for NAND

This is now set up by the pinctrl driver when the NAND driver is
probed.  Remove the legacy code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: enable CONFIG_NAND_DENALI_DT
Masahiro Yamada [Sat, 26 Aug 2017 08:58:02 +0000 (17:58 +0900)]
ARM: uniphier: enable CONFIG_NAND_DENALI_DT

Migrate to the DT-based NAND init entry.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: remove unneeded NAND config options
Masahiro Yamada [Sat, 26 Aug 2017 08:58:01 +0000 (17:58 +0900)]
ARM: uniphier: remove unneeded NAND config options

CONFIG_NAND_DENALI select's CONFIG_SYS_NAND_SELF_INIT, so the
NAND initialization process is driven by the driver itself.
CONFIG_SYS_NAND_MAX_CHIPS and CONFIG_SYS_NAND_BASE are unused.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: add PLL settings for PXs3
Masahiro Yamada [Sat, 26 Aug 2017 08:58:00 +0000 (17:58 +0900)]
ARM: uniphier: add PLL settings for PXs3

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: move PLLCTRL register macros to each SoC .c file
Masahiro Yamada [Sat, 26 Aug 2017 08:57:59 +0000 (17:57 +0900)]
ARM: uniphier: move PLLCTRL register macros to each SoC .c file

The new SoC PXs3 changed the address of PLL, but still uses the
same PLL name.  We can not define SC_*PLLCTRL in the common header.
Move them to per-SoC .c file.  Also, fix some PLL comments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: replace <common.h> with <linux/delay.h> in pll settings
Masahiro Yamada [Sat, 26 Aug 2017 08:57:58 +0000 (17:57 +0900)]
ARM: uniphier: replace <common.h> with <linux/delay.h> in pll settings

The #include <common.h> was added for mdelay().  Later, the declaration
of mdelay was moved to <linux/delay.h> by commit 5bc516ed661a ("delay:
collect {m, n, u}delay declarations to include/linux/delay.h").

There is no need to include <common.h> now.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agomtd: nand: denali_dt: add a DT driver
Masahiro Yamada [Fri, 25 Aug 2017 16:12:31 +0000 (01:12 +0900)]
mtd: nand: denali_dt: add a DT driver

A patch for NAND uclass support was proposed about half a year ago:
https://patchwork.ozlabs.org/patch/722282/

It was not merged and I do not see on-going work for this.

Without DM-based probing, we need to set up pinctrl etc. in an ad-hoc
way and give lots of crappy CONFIG options for base addresses and
properties, which are supposed to be specified by DT.  This is painful.

This commit just provides a probe hook to retrieve "reg" from DT and
allocate private data in a DM manner.  This DT driver is not essentially
a NAND driver, in fact it is (ab)using UCLASS_MISC.  Once UCLASS_NAND is
supported, it would be possible to migrate to it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoofnode: add {ofnode, dev}_read_resource_byname()
Masahiro Yamada [Fri, 25 Aug 2017 16:12:30 +0000 (01:12 +0900)]
ofnode: add {ofnode, dev}_read_resource_byname()

Linux supports platform_get_resource_byname() to look up a resource
by name.

We want a similar helper.  It is useful when a device node has named
register regions.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agovideo: ipuv3_fb: skip IPU shutdown if IPU was not enabled before
Anatolij Gustschin [Fri, 25 Aug 2017 13:10:43 +0000 (15:10 +0200)]
video: ipuv3_fb: skip IPU shutdown if IPU was not enabled before

Boards can skip display interface init using board_video_skip().
If display interface was not initialized (e.g. no ipuv3 framebuffer
registered or IPU clock disabled), booting Linux stops due to the
crash in IPU shutdown function, when accessing IPU registers.
Check IPU clock and skip shutdown if clock is not enabled.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
7 years agoicorem6: Fix to find MMC devices
Jagan Teki [Fri, 25 Aug 2017 14:50:44 +0000 (20:20 +0530)]
icorem6: Fix to find MMC devices

U-Boot proper is using DM_MMC so, enable CONFIG_BLK otherwise
find_mmc_device failed to detect MMC device.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoimx6: don't include unneeded boot_mode array in SPL
Anatolij Gustschin [Mon, 28 Aug 2017 15:51:33 +0000 (17:51 +0200)]
imx6: don't include unneeded boot_mode array in SPL

The soc_boot_modes array is only used by bmode command
and not needed in SPL. Don't include it into SPL.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agospl: do not repeat timer init on i.MX6
Anatolij Gustschin [Mon, 28 Aug 2017 15:46:33 +0000 (17:46 +0200)]
spl: do not repeat timer init on i.MX6

The GPT timer was already initialised in board_init_f() as
it is needed in dram init. Do not repeat timer init in
board_init_r().

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Stefano Babic <sbabic@denx.de>
7 years agoimx: timer: don't clear the GPT control register multiple times
Anatolij Gustschin [Mon, 28 Aug 2017 15:46:32 +0000 (17:46 +0200)]
imx: timer: don't clear the GPT control register multiple times

There is no need to clear the control register 100 times in a
loop, a single zero write clears the register. I didn't find any
justification why clearing this register in a loop is needed
(no info in i.MX6 errata or GPT timer linux driver, linux driver
uses single write to clear this control register).

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Stefano Babic <sbabic@denx.de>
7 years agopfla02: Fix RAM detection and support 1 bank SOM
Stefano Babic [Fri, 25 Aug 2017 11:02:53 +0000 (13:02 +0200)]
pfla02: Fix RAM detection and support 1 bank SOM

In case of 2 banks, the address space of the first CS must be defined
and not let to the higher value.

Add support for SOM with a single bank of RAM. It was tested with i.MX6Q
modules in the following configurations:

- 2 Banks, 4 GB
- 2 Banks, 1 GB
- 1 Bank,  1 GB

Signed-off-by: Stefano Babic <sbabic@denx.de>
7 years agoPrepare v2017.09-rc3 v2017.09-rc3
Tom Rini [Tue, 29 Aug 2017 02:42:44 +0000 (22:42 -0400)]
Prepare v2017.09-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Tue, 29 Aug 2017 02:42:12 +0000 (22:42 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

7 years agosplash_source: Verify FIT magic
Niko Mauno [Thu, 3 Aug 2017 06:53:24 +0000 (09:53 +0300)]
splash_source: Verify FIT magic

Before reading entire FIT image, add sanity check by testing image
header against FDT_MAGIC. This should help avoid problems in situations
where FIT is not yet available from storage device, for example when
performing initial programming of device.

Cc: Anatolij Gustschin <agust@denx.de>
Acked-by: Tomas Melin <tomas.melin@vaisala.com>
7 years agousb: dwc3: fix Kconfig dependency to accept host driver in drivers/usb/dwc3
Masahiro Yamada [Thu, 24 Aug 2017 16:30:20 +0000 (01:30 +0900)]
usb: dwc3: fix Kconfig dependency to accept host driver in drivers/usb/dwc3

We see the choice of USB_DWC3_HOST / _GADGET in drivers/usb/dwc3/Kconfig,
but we can not choose USB_DWC3_HOST unless USB_GADGET is defined.
This is strange.

Loosen the "depends on" and also move "select USB_GADGET_DUALSPEED" to
the correct place.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agommc: sunxi: fix legacy MMC initialisation
Maxime Ripard [Wed, 23 Aug 2017 11:41:33 +0000 (13:41 +0200)]
mmc: sunxi: fix legacy MMC initialisation

The driver-model rework changed, among other things, the way the private
data were moved around. It now uses the private field in the struct mmc.

However, the mmc_create argument was changed in the process to always pass
the array we used to have to store our private structures.

The basically means that all the MMC driver instances will now have the
private data of the first instance, which obviously doesn't work very well.

Pass the proper pointer to mmc_create.

Fixes: 034e226bc77e ("dm: mmc: sunxi: Pass private data around explicitly")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Tested-by: Chen-Yu Tsai <wens@csie.org>
Tested-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: bpi-m3: Enable eMMC
Jagan Teki [Mon, 28 Aug 2017 09:00:31 +0000 (14:30 +0530)]
sunxi: bpi-m3: Enable eMMC

Add CONFIG_MMC_SUNXI_SLOT_EXTRA=2 to use eMMC on
BPI_M3 board.

Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
7 years agosunxi: Enable MMC new mode for A83T
Maxime Ripard [Wed, 23 Aug 2017 10:03:42 +0000 (12:03 +0200)]
sunxi: Enable MMC new mode for A83T

The eMMC controller for the A83T uses the new operating mode. Enable it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agommc: sunxi: Support new mode
Maxime Ripard [Wed, 23 Aug 2017 10:03:41 +0000 (12:03 +0200)]
mmc: sunxi: Support new mode

Almost all of the newer Allwinner SoCs have a new operating mode for the
eMMC clocks that needs to be enabled in both the clock and the MMC
controller.

Details about that mode are sparse, and the name itself (new mode vs old
mode) doesn't give much details, but it seems that the it changes the
sampling of the MMC clock. One side effect is also that it divides the
parent clock rate by 2.

Add support for it through a Kconfig option.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agobootvx_fdt: fix missing 'fdt_fixup_ethernet(...)' on vxWorks boot
Hannes Schmelzer [Fri, 25 Aug 2017 12:27:37 +0000 (14:27 +0200)]
bootvx_fdt: fix missing 'fdt_fixup_ethernet(...)' on vxWorks boot

Before commit 26d6119 (fdt: Move fdt_fixup_ethernet to a common place)
the fdt_fixup_ethernet(...) was called during do_bootvx_fdt(...).

Afterwards the only (common) place for this fixup is during
image_setup_libfdt(...) and this is only called, at least on ARM
platform, from image_setup_linux(...).

All this ends up in the fact, that the fdt_fixup_ethernet(...) is only
called on booting a linux image and not on booting a vxWorks image.

We fix this with adding the fdt_fixup_ethernet(...) call again to
do_bootvx_fdt(...)

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agocommon: console: Fix duplicated CONFIG in silent env callback
Wilson Lee [Fri, 25 Aug 2017 07:06:29 +0000 (00:06 -0700)]
common: console: Fix duplicated CONFIG in silent env callback

The silent environment callback function does not update the silent
flag during silent env set or unset. That is because of duplicated
CONFIG keyword at preprocessor condition in silent environment
callback function and cause silent env callback unable to work.

This patch is to remove the duplicated CONFIG keywork in silent
environment callback function.

Signed-off-by: Wilson Lee <wilson.lee@ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
7 years agosandbox: Enable NVMe driver for build testing
Bin Meng [Tue, 22 Aug 2017 15:15:19 +0000 (08:15 -0700)]
sandbox: Enable NVMe driver for build testing

This enables NVMe driver on sandbox for build testing.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agosandbox: Add a dummy invalidate_dcache_range() function
Bin Meng [Tue, 22 Aug 2017 15:15:18 +0000 (08:15 -0700)]
sandbox: Add a dummy invalidate_dcache_range() function

This adds invalidate_dcache_range() so that some drivers can build
without error on sandbox.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Adjust the 'nvme' command to use blk_common_cmd()
Bin Meng [Tue, 22 Aug 2017 15:15:17 +0000 (08:15 -0700)]
nvme: Adjust the 'nvme' command to use blk_common_cmd()

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

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Get rid of the global variable nvme_info
Bin Meng [Tue, 22 Aug 2017 15:15:16 +0000 (08:15 -0700)]
nvme: Get rid of the global variable nvme_info

At present the NVMe uclass driver uses a global variable nvme_info
to store global information like namespace id, and NVMe controller
driver's priv struct has a blk_dev_start that is used to calculate
the namespace id based on the global information from nvme_info.

This is not a good design in the DM world and can be replaced with
the following changes:

- Encode the namespace id in the NVMe block device name during
  the NVMe uclass post probe
- Extract the namespace id from the device name during the NVMe
  block device probe
- Let BLK uclass calculate the devnum for us by passing -1 to
  blk_create_devicef() as the devnum

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Use blk_create_devicef() API
Bin Meng [Tue, 22 Aug 2017 15:15:15 +0000 (08:15 -0700)]
nvme: Use blk_create_devicef() API

The codes in nvme_uclass_post_probe() can be replaced to call the
blk_create_devicef() API directly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Apply cache operations on the DMA buffers
Bin Meng [Tue, 22 Aug 2017 15:15:14 +0000 (08:15 -0700)]
nvme: Apply cache operations on the DMA buffers

So far cache operations are only applied on the submission queue and
completion queue, but they are missing in other places like identify
and block read/write routines.

In order to correctly operate on the caches, the DMA buffer passed
to identify routine must be allocated properly on the stack with the
existing macro ALLOC_CACHE_ALIGN_BUFFER().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Consolidate block read and write routines
Bin Meng [Tue, 22 Aug 2017 15:15:13 +0000 (08:15 -0700)]
nvme: Consolidate block read and write routines

The NVMe block read and write routines are almost the same except
the command opcode. Let's consolidate them to avoid duplication.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Use macros to access NVMe queues
Bin Meng [Tue, 22 Aug 2017 15:15:12 +0000 (08:15 -0700)]
nvme: Use macros to access NVMe queues

NVMe driver only uses two queues. The first one is allocated to do
admin stuff, while the second one is for IO stuff. So far the driver
uses magic number (0/1) to access them. Change to use macros.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Respect timeout when en/disabling the controller
Bin Meng [Tue, 22 Aug 2017 15:15:11 +0000 (08:15 -0700)]
nvme: Respect timeout when en/disabling the controller

So far the driver unconditionally delays 10ms when en/disabling the
controller and still return 0 if 10ms times out. In fact, spec defines
a timeout value in the CAP register that is the worst case time that
host software shall wait for the controller to become ready.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Cache controller's capabilities
Bin Meng [Tue, 22 Aug 2017 15:15:10 +0000 (08:15 -0700)]
nvme: Cache controller's capabilities

Capabilities register is RO and accessed at various places in the
driver. Let's cache it in the controller driver's priv struct.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Fix endianness assignment to prp2 in nvme_identify()
Bin Meng [Tue, 22 Aug 2017 15:15:09 +0000 (08:15 -0700)]
nvme: Fix endianness assignment to prp2 in nvme_identify()

So far this is not causing any issue due to NVMe and x86 are using
the same endianness, but for correctness, it should be fixed.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agonvme: Fix ndev->queues allocation
Bin Meng [Tue, 22 Aug 2017 15:15:08 +0000 (08:15 -0700)]
nvme: Fix ndev->queues allocation

ndev->queues is a pointer to pointer, but the allocation wrongly
requests sizeof(struct nvme_queue). Fix it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>