oweals/u-boot.git
6 years agodrivers/ddr/fsl: Dual-license DDR driver
York Sun [Wed, 7 Feb 2018 19:47:22 +0000 (11:47 -0800)]
drivers/ddr/fsl: Dual-license DDR driver

To make this driver easier to be reused, dual-license DDR driver.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Simon Glass <sjg@chromium.org>
CC: Tom Rini <trini@konsulko.com>
CC: Heinrich Schuchardt <xypron.glpk@gmx.de>
CC: Thomas Schaefer <thomas.schaefer@kontron.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Robert P. J. Day <rpjday@crashcourse.ca>
CC: Alexander Merkle <alexander.merkle@lauterbach.com>
CC: Joakim Tjernlund <joakim.tjernlund@transmode.se>
CC: Curt Brune <curt@cumulusnetworks.com>
CC: Valentin Longchamp <valentin.longchamp@keymile.com>
CC: Wolfgang Denk <wd@denx.de>
CC: Anatolij Gustschin <agust@denx.de>
CC: Ira W. Snyder <iws@ovro.caltech.edu>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Kyle Moffett <Kyle.D.Moffett@boeing.com>
CC: Sebastien Carlier <sebastien.carlier@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Peter Tyser <ptyser@xes-inc.com>
CC: Paul Gortmaker <paul.gortmaker@windriver.com>
CC: Peter Tyser <ptyser@xes-inc.com>
CC: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
6 years agoPowerPC: phy: enable all phylib drivers when use phylib and tsec enet
Zhao Qiang [Wed, 7 Feb 2018 02:01:56 +0000 (10:01 +0800)]
PowerPC: phy: enable all phylib drivers when use phylib and tsec enet

config_phylib_all_drivers.h should be included when CONFIG_PHYLIB and
CONFIG_TSEC_ENET are defined.

Fixes: 3146f0c017 ("Move PHYLIB to Kconfig")
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agocrypto/fsl: instantiate all rng state handles
Lukas Auer [Thu, 25 Jan 2018 13:11:17 +0000 (14:11 +0100)]
crypto/fsl: instantiate all rng state handles

Extend the instantiate_rng() function and the corresponding CAAM job
descriptor to instantiate all RNG state handles. This moves the RNG
instantiation code in line with the CAAM kernel driver.

Previously, only the first state handle was instantiated. The second
one was instantiated by the CAAM kernel driver. This works if the
kernel runs in secure mode, but fails in non-secure mode since the
kernel driver uses DEC0 directly instead of over the job ring
interface. Instantiating all RNG state handles in u-boot removes the
need for using DEC0 in the kernel driver, making it possible to use
the CAAM in non-secure mode.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1012ardb: Add distro secure boot support
Vinitha Pillai-B57223 [Tue, 9 Jan 2018 17:33:42 +0000 (23:03 +0530)]
armv8: ls1012ardb: Add distro secure boot support

Enable validation of boot.scr script prior to its execution dependent
on "secureboot" flag in environment. Enable fall back option to
qspi boot in case of secure boot.

Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Signed-off-by: Vinitha Pillai <vinitha.pillai@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: Remove dependency of SERDES for LSCH2 and LSCH3
Sriram Dash [Tue, 30 Jan 2018 10:28:44 +0000 (15:58 +0530)]
armv8: Remove dependency of SERDES for LSCH2 and LSCH3

Remove dependency of SYS_HAS_SERDES for Layerscape Chasis 2 and
Layerscape Chasis 3.

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1088a: qspi: Enable XIP mode above 16 MB addresses
Rajat Srivastava [Fri, 2 Feb 2018 12:22:07 +0000 (17:52 +0530)]
armv8: ls1088a: qspi: Enable XIP mode above 16 MB addresses

Currently in LS1088A, XIP mode in QSPI works up to 16 MB
addresses. This patch enables QSPI support in XIP mode for
addresses above 16 MB as well.

Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoARMv8: ls1046a: Enable PCIe and E1000 in lpuart defconfig
Hou Zhiqiang [Mon, 5 Feb 2018 05:46:47 +0000 (13:46 +0800)]
ARMv8: ls1046a: Enable PCIe and E1000 in lpuart defconfig

Enable PCIe and E1000 in ls1046aqds lpuart defconfig.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoMove most CONFIG_HAVE_BLOCK_DEVICE to Kconfig
Adam Ford [Tue, 6 Feb 2018 18:43:56 +0000 (12:43 -0600)]
Move most CONFIG_HAVE_BLOCK_DEVICE to Kconfig

config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE
based on a list of enabled options.  Moving HAVE_BLOCK_DEVICE to
Kconfig allows us to drastically shrink the logic in
config_fallbacks.h

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoblock: Migrate SystemACE chip to Kconfig
Tom Rini [Thu, 8 Feb 2018 18:49:48 +0000 (13:49 -0500)]
block: Migrate SystemACE chip to Kconfig

Migrate the base and sub-options to Kconfig.  Note that we only enable
this in the base sandbox config now.

Cc: Alexey Brodkin <alexey.brodkin@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Is this driver still used anywhere?  It's fishy that it's only enabled
in sandbox anymore.

6 years agoConvert LIB_UUID to Kconfig
Adam Ford [Tue, 6 Feb 2018 18:14:28 +0000 (12:14 -0600)]
Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected.  This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoConvert CONFIG LIB_HW_RAND to Kconfig
Adam Ford [Tue, 6 Feb 2018 16:18:18 +0000 (10:18 -0600)]
Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected.  By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoConvert CONFIG_APBH_DMA et al to Kconfig
Adam Ford [Tue, 6 Feb 2018 14:34:45 +0000 (08:34 -0600)]
Convert CONFIG_APBH_DMA et al to Kconfig

This converts the following to Kconfig:
   CONFIG_APBH_DMA
   CONFIG_APBH_DMA_BURST
   CONFIG_APBH_DMA_BURST8

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
[trini: Add in MMC as well]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoKconfig: Select networking commands only when NET is enabled
Michal Simek [Tue, 6 Feb 2018 12:28:36 +0000 (13:28 +0100)]
Kconfig: Select networking commands only when NET is enabled

There is no reason to unconditially select network commands as distro
defaults without networking enable.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoKconfig: net: phylib: Phylib should depends on NET
Michal Simek [Tue, 6 Feb 2018 12:23:52 +0000 (13:23 +0100)]
Kconfig: net: phylib: Phylib should depends on NET

There is no value to enable phylib without networking support.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoomap4: sdp4430: Enable CONFIG_NET for this platform
Michal Simek [Thu, 8 Feb 2018 07:58:59 +0000 (08:58 +0100)]
omap4: sdp4430: Enable CONFIG_NET for this platform

Distro default configuration contains also dhcp and pxe setting which
can't working without enabling CONFIG_NET.
EFI is not required that's why it is not enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoconfigs: stm32: Enable CONFIG_ENV_VARS_UBOOT_CONFIG
Patrice Chotard [Tue, 6 Feb 2018 09:47:59 +0000 (10:47 +0100)]
configs: stm32: Enable CONFIG_ENV_VARS_UBOOT_CONFIG

Enable CONFIG_ENV_VARS_UBOOT_CONFIG for all STM32 boards
It allows to retrieve the SoC name into the "soc" environment
variable.

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agoConvert CONFIG_NAND_MXS to Kconfig
Stefan Agner [Tue, 6 Feb 2018 08:44:37 +0000 (09:44 +0100)]
Convert CONFIG_NAND_MXS to Kconfig

This converts CONFIG_NAND_MXS to Kconfig.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agospl: use ARCH_MX23/28 to specify SPL_LDSCRIPT
Stefan Agner [Tue, 6 Feb 2018 08:44:36 +0000 (09:44 +0100)]
spl: use ARCH_MX23/28 to specify SPL_LDSCRIPT

Simplify SPL_LDSCRIPT config by using the new arch Kconfig
configurations ARCH_MX23 and ARCH_MX28.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agoarm: imx: mx28: Move MX28 selection to Kconfig
Stefan Agner [Tue, 6 Feb 2018 08:44:35 +0000 (09:44 +0100)]
arm: imx: mx28: Move MX28 selection to Kconfig

The motivation for moving MX28 selection to Kconfig is to be able
to better handle NAND MXS selection through Kconfig.

This selection method also aligns with the way other i.MX SoCs are
selected in U-Boot.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agoarm: imx: mx23: Move MX23 selection to Kconfig
Stefan Agner [Tue, 6 Feb 2018 08:44:34 +0000 (09:44 +0100)]
arm: imx: mx23: Move MX23 selection to Kconfig

The motivation for moving MX23 selection to Kconfig is to be able
to better handle NAND MXS selection through Kconfig.

This selection method also aligns with the way other i.MX SoCs are
selected in U-Boot.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agoConvert CONFIG_MXC_GPIO to Kconfig
Adam Ford [Sun, 4 Feb 2018 15:32:43 +0000 (09:32 -0600)]
Convert CONFIG_MXC_GPIO to Kconfig

This converts the following to Kconfig:
   CONFIG_MXC_GPIO

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfigs: imx6q_logic: Move CONFIG_PHY_SMSC to defconfig
Adam Ford [Sun, 4 Feb 2018 15:07:01 +0000 (09:07 -0600)]
configs: imx6q_logic: Move CONFIG_PHY_SMSC to defconfig

Since CONFIG_PHY_SMSC was already in Kconfig, move this from
header file to defconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfigs: imx6q_logic: Move CONFIG_MXC_UART to Kconfig
Adam Ford [Sun, 4 Feb 2018 14:54:13 +0000 (08:54 -0600)]
configs: imx6q_logic: Move CONFIG_MXC_UART to Kconfig

Since CONFIG_MXC_UART is already in Kconfig, move this from
the header to imx6q_logic_defconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agodoc: watchdog: Remove Blackfin related documentation entry
Lukasz Majewski [Mon, 5 Feb 2018 22:42:57 +0000 (23:42 +0100)]
doc: watchdog: Remove Blackfin related documentation entry

This commit cleans up the README.watchdog by removing the reminescent of
ADI's Blackfin architecture removed some time ago.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
6 years agoARM: omap3: evm: Remove CONFIG_SYS_NS16550_REG_SIZE undefine
Derald D. Woods [Mon, 5 Feb 2018 01:04:50 +0000 (19:04 -0600)]
ARM: omap3: evm: Remove CONFIG_SYS_NS16550_REG_SIZE undefine

This commit removes an attempt to workaround a previous compilation
warning that is is now fixed in "include/configs/ti_omap3_common.h".

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoARM: omap3: ti_omap3_common: Fix CONFIG_SYS_NS16550_REG_SIZE compiler warning
Derald D. Woods [Mon, 5 Feb 2018 01:04:49 +0000 (19:04 -0600)]
ARM: omap3: ti_omap3_common: Fix CONFIG_SYS_NS16550_REG_SIZE compiler warning

This commit fixes the following compiler warnings when DM_SERIAL is
enabled.

---8<-------------------------------------------------------------------
...

  CC      spl/board/ti/evm/evm.o
In file included from /solution/scm/u-boot-master/board/ti/evm/evm.c:16:0:
/solution/scm/u-boot-master/include/ns16550.h:31:0: warning: "CONFIG_SYS_NS16550_REG_SIZE" redefined
 #define CONFIG_SYS_NS16550_REG_SIZE (-1)

In file included from /solution/scm/u-boot-master/include/configs/omap3_evm.h:22:0,
                 from include/config.h:5,
                 from /solution/scm/u-boot-master/include/common.h:21,
                 from /solution/scm/u-boot-master/board/ti/evm/evm.c:14:
/solution/scm/u-boot-master/include/configs/ti_omap3_common.h:33:0: note: this is the location of the previous definition
 # define CONFIG_SYS_NS16550_REG_SIZE (-4)

  LD      spl/board/ti/evm/built-in.o

...

  CC      spl/drivers/serial/ns16550.o
In file included from /solution/scm/u-boot-master/drivers/serial/ns16550.c:11:0:
/solution/scm/u-boot-master/include/ns16550.h:31:0: warning: "CONFIG_SYS_NS16550_REG_SIZE" redefined
 #define CONFIG_SYS_NS16550_REG_SIZE (-1)

In file included from /solution/scm/u-boot-master/include/configs/omap3_evm.h:22:0,
                 from include/config.h:5,
                 from /solution/scm/u-boot-master/include/common.h:21,
                 from /solution/scm/u-boot-master/drivers/serial/ns16550.c:7:
/solution/scm/u-boot-master/include/configs/ti_omap3_common.h:33:0: note: this is the location of the previous definition
 # define CONFIG_SYS_NS16550_REG_SIZE (-4)

  LD      spl/drivers/serial/built-in.o

...
---8<-------------------------------------------------------------------

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agospl: eMMC/SD: Provide one __weak spl_boot_mode() function
Lukasz Majewski [Sat, 3 Feb 2018 07:29:52 +0000 (08:29 +0100)]
spl: eMMC/SD: Provide one __weak spl_boot_mode() function

The goal of this patch is to clean up the code related to choosing SPL
MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function,
which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

To achieve the goal, all per mach/arch implementations eligible for
unification has been replaced with one __weak implementation.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoARM: dts: keystone-k2g-ice: Add support for QSPI
Vignesh R [Wed, 31 Jan 2018 15:38:27 +0000 (21:08 +0530)]
ARM: dts: keystone-k2g-ice: Add support for QSPI

K2G ICE has a s25fl256s1 QSPI NOR flash connected to QSPI at CS0. Add DT
entries for the same.

Signed-off-by: Vignesh R <vigneshr@ti.com>
6 years agoARM: k2g: Add pinmux data for QSPI on K2G ICE
Vignesh R [Wed, 31 Jan 2018 15:38:26 +0000 (21:08 +0530)]
ARM: k2g: Add pinmux data for QSPI on K2G ICE

Add pinmux for QSPI pins on K2G ICE board.

Signed-off-by: Vignesh R <vigneshr@ti.com>
6 years agoatcspi200: avoid possible NULL dereference
Heinrich Schuchardt [Wed, 31 Jan 2018 00:05:54 +0000 (01:05 +0100)]
atcspi200: avoid possible NULL dereference

Check if ns before and not after dereferencing it.

Indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agopart: Allocate only one legacy_mbr buffer
Alexey Brodkin [Mon, 29 Jan 2018 19:58:24 +0000 (22:58 +0300)]
part: Allocate only one legacy_mbr buffer

Commit ff98cb90514d ("part: extract MBR signature from partitions")
blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from
"unsigned char" to "legacy_mbr" which caused allocation of size =
(typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough
for "legacy_mbr" structure.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Tom Rini <trini@konsulko.com>
6 years agomove booti_setup to arch/arm/lig/image.c
Bin Chen [Sat, 27 Jan 2018 05:59:09 +0000 (16:59 +1100)]
move booti_setup to arch/arm/lig/image.c

Follow bootz's pattern by moving the booti_setup to arch/arm/lib.
This allows to use booti_setup in other paths, e.g booting
an Android image containing Image format.

Note that kernel relocation is move out of booti_setup and it is the
caller's responsibility to do it and allows them do it differently. say,
cmd/booti.c just do a manually, while in the bootm path, we can use
bootm_load_os(with some changes).

Signed-off-by: Bin Chen <bin.chen@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoparse the second area of android image
Bin Chen [Sat, 27 Jan 2018 05:59:08 +0000 (16:59 +1100)]
parse the second area of android image

The second area of android image was intended to put a 2nd stage
bootloader but in practice were rarely used (in my knowledge).

An proposal was made to the AOSP to (re)use the second area as the dtb[1],
This patch itself doesn't depend on that proposal being accepted but it won't
be that helpful as well if that proposal won't be accepted. But don't do
any harm as well.

[1] https://android-review.googlesource.com/#/c/417447/
Signed-off-by: Bin Chen <bin.chen@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 years agoMerge git://git.denx.de/u-boot-ubi
Tom Rini [Tue, 6 Feb 2018 17:17:00 +0000 (12:17 -0500)]
Merge git://git.denx.de/u-boot-ubi

6 years agoMerge git://git.denx.de/u-boot-i2c
Tom Rini [Tue, 6 Feb 2018 17:16:46 +0000 (12:16 -0500)]
Merge git://git.denx.de/u-boot-i2c

6 years agoubi: Ensure no fastmap flush after uif_close
Martin Townsend [Thu, 18 Jan 2018 08:07:33 +0000 (08:07 +0000)]
ubi: Ensure no fastmap flush after uif_close

On detach UBI attempts to update fastmap after closing user interfaces
but at this point UBI volumes have already been free()'ed and fastmap
can no longer access these data structures.

Signed-off-by: Martin Townsend <mtownsend1973@gmail.com>
Cc: hs@denx.de
Cc: kmpark@infradead.org
Cc: richard@sigma-star.at
6 years agoi2c: mvtwsi.c: Avoid NULL dereference
Heinrich Schuchardt [Tue, 30 Jan 2018 23:57:17 +0000 (00:57 +0100)]
i2c: mvtwsi.c: Avoid NULL dereference

For '#ifndef CONFIG_DM_I2C' twsi_i2c_init() passes NULL as
4th parameter to __twsi_i2c_init().

Identified with cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoi2c: ihs_i2c: Factor out send_buffer method
Mario Six [Mon, 15 Jan 2018 10:08:12 +0000 (11:08 +0100)]
i2c: ihs_i2c: Factor out send_buffer method

Simplify the driver logic by extracting a common send_buffer method.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoi2c: ihs_i2c: Make DM compatible
Mario Six [Mon, 15 Jan 2018 10:08:11 +0000 (11:08 +0100)]
i2c: ihs_i2c: Make DM compatible

Make the ihs_i2c driver DM-compatible; for legacy boards, the old functions are
retained within #ifdefs.

No board uses the new DM driver yet; this patch only lays the foundation for
future support.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoi2c: ihs_i2c: Prepare DM conversion
Mario Six [Mon, 15 Jan 2018 10:08:10 +0000 (11:08 +0100)]
i2c: ihs_i2c: Prepare DM conversion

Prepare the function interface of the ihs_i2c driver for DM conversion
in a future patch.

While we're at it, fix some style violations, and make the code more readable.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoi2c: fsl_i2c: Make live-tree compatible
Mario Six [Mon, 15 Jan 2018 10:08:09 +0000 (11:08 +0100)]
i2c: fsl_i2c: Make live-tree compatible

Make the fsl_i2c driver compatible with a live device tree.

Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoi2c: fsl_i2c: Remove inline declarations
Mario Six [Mon, 15 Jan 2018 10:08:08 +0000 (11:08 +0100)]
i2c: fsl_i2c: Remove inline declarations

Some functions in the fsl_i2c driver are declared as inline, even though
they are quite large, which needlessly increases the size of the
resulting binary.

This patch removes the inline declarations.

Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoi2c: fsl_i2c: Fix style violations
Mario Six [Mon, 15 Jan 2018 10:08:07 +0000 (11:08 +0100)]
i2c: fsl_i2c: Fix style violations

Fix some style violations in the fsl_i2c I2C driver, and use shorter
type names for variables in some cases.

Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agousb: ulpi: kconfig: Remove meaningless choice default
Ulf Magnusson [Tue, 30 Jan 2018 13:07:05 +0000 (14:07 +0100)]
usb: ulpi: kconfig: Remove meaningless choice default

'default' on a choice refers to the symbol selected by default, not to
the choice mode, so 'default n' is meaningless.

No functional changes. Optional choices implicitly default to n mode
(and there is no way to make them default to another mode).

Discovered in Kconfiglib (https://github.com/ulfalizer/Kconfiglib),
which prints the following warning:

warning: the default selection n (undefined) of <choice> (defined at drivers/usb/ulpi/Kconfig:3) is not contained in the choice

I've added a corresponding warning to the C tools too, which is
currently in linux-next: https://patchwork.kernel.org/patch/9983667/

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
6 years agoam335x, shc: kconfig: Fix misspelled choice default
Ulf Magnusson [Tue, 30 Jan 2018 13:04:43 +0000 (14:04 +0100)]
am335x, shc: kconfig: Fix misspelled choice default

There is no EMMC symbol in the "enable different boot versions for the
shc board" choice. SHC_EMMC was probably intended.

No functional changes. Kconfig choices fall back on using the first
(visible) symbol in the choice as the default if the default symbol is
not visible.

Discovered in Kconfiglib (https://github.com/ulfalizer/Kconfiglib),
which prints the following warning:

warning: the default selection EMMC (undefined) of <choice> (defined at board/bosch/shc/Kconfig:15) is not contained in the choice

I've added a corresponding warning to the C tools too, which is
currently in linux-next: https://patchwork.kernel.org/patch/9983667/

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
6 years agoFix FreeBSD endian checks
Justin Hibbits [Tue, 30 Jan 2018 04:23:36 +0000 (22:23 -0600)]
Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names.  Define the names
the same as the OpenBSD block below it.

6 years agocmd: Make CONFIG_CMD_FPGA depend on CONFIG_FPGA
Tuomas Tynkkynen [Sat, 27 Jan 2018 18:28:40 +0000 (20:28 +0200)]
cmd: Make CONFIG_CMD_FPGA depend on CONFIG_FPGA

cmd/Makefile has:

ifdef CONFIG_FPGA
obj-$(CONFIG_CMD_FPGA) += fpga.o
endif

which means that if CONFIG_FPGA is not set, CONFIG_CMD_FPGA silently
does nothing. Let's remove that Makefile conditional and instead express
this equivalent dependency in Kconfig, so a lot of redundant

 # CONFIG_CMD_FPGA is not set

can be removed from board defconfigs that don't actually have an FPGA.

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
6 years agofpga: Resync various CONFIG_FPGA_* symbols
Tuomas Tynkkynen [Sat, 27 Jan 2018 18:28:39 +0000 (20:28 +0200)]
fpga: Resync various CONFIG_FPGA_* symbols

These are declared in Kconfig, but some #defines have crept in.

CONFIG_FPGA
CONFIG_FPGA_ALTERA
CONFIG_FPGA_CYCLON2
CONFIG_FPGA_SOCFPGA
CONFIG_FPGA_XILINX
CONFIG_FPGA_ZYNQMPPL

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
6 years agousb: dwc2: make casts of ep->dma_buf consistent
Tom Rini [Mon, 5 Feb 2018 14:51:50 +0000 (09:51 -0500)]
usb: dwc2: make casts of ep->dma_buf consistent

In most places in the code we cast this to an unsigned long, but in one
place we cast to an unsigned int.  For consistency and to fix a warning
on 64bit targets, always cast this to unsigned long.  For the long term
we should however change the declaration of dma_buf.

Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMAINTAINERS: board: qcom: db410c, db820c: update email.
Jorge Ramirez-Ortiz [Sun, 4 Feb 2018 09:35:08 +0000 (10:35 +0100)]
MAINTAINERS: board: qcom: db410c, db820c: update email.

Update email address.

Signed-off-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
6 years agotravis.yml: run buildman with option -E
Daniel Schwierzeck [Fri, 26 Jan 2018 15:31:07 +0000 (16:31 +0100)]
travis.yml: run buildman with option -E

This forces all compiler warnings to be treated as errors.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agotravis.yml: fix 'set +e' in build script
Daniel Schwierzeck [Fri, 26 Jan 2018 15:31:06 +0000 (16:31 +0100)]
travis.yml: fix 'set +e' in build script

The build script should not manipulate shell flags (especially '-e').
A non-zero exit value can also be catched with 'cmd || ret=$?'.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agobuildman: add option -E for treating compiler warnings as errors
Daniel Schwierzeck [Fri, 26 Jan 2018 15:31:05 +0000 (16:31 +0100)]
buildman: add option -E for treating compiler warnings as errors

Add a new option '-E' for treating all compiler warnings as errors.
Eventually this will pass 'KCFLAGS=-Werror' to Kbuild.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoREADME: add doc for how to supply user specific compiler flags to Kbuild
Daniel Schwierzeck [Fri, 26 Jan 2018 15:31:04 +0000 (16:31 +0100)]
README: add doc for how to supply user specific compiler flags to Kbuild

Probably not all users are aware of this possibility, thus add a
pointer to the README. Also add a useful example.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoMAINTAINERS: Update email address for Maxime Ripard
Maxime Ripard [Fri, 2 Feb 2018 20:45:23 +0000 (21:45 +0100)]
MAINTAINERS: Update email address for Maxime Ripard

Free Electrons is no more and is now known as Bootlin, change my email
address accordingly.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Sun, 4 Feb 2018 13:30:31 +0000 (08:30 -0500)]
Merge git://git.denx.de/u-boot-dm

6 years agoMerge git://git.denx.de/u-boot-imx
Tom Rini [Sun, 4 Feb 2018 13:30:13 +0000 (08:30 -0500)]
Merge git://git.denx.de/u-boot-imx

6 years agoimx: mx7: run sec_init for CAAM RNG
Bryan O'Donoghue [Fri, 26 Jan 2018 16:27:58 +0000 (16:27 +0000)]
imx: mx7: run sec_init for CAAM RNG

This patch adds a sec_init call into arch_misc_init(). Doing so in
conjunction with the patch "drivers/crypto/fsl: assign job-rings to
non-TrustZone" enables use of the CAAM in Linux when OPTEE/TrustZone is
active.

u-boot will initialise the RNG and assign ownership of the job-ring
registers to a non-TrustZone context. With recent changes by Lukas Auer to
fully initialize the RNG in sec_init() this means that u-boot will hand-off
the CAAM in a state that Linux then can use the CAAM without touching the
reserved DECO registers.

This change is safe both for the OPTEE/TrustZone boot path and the regular
non-OPTEE/TrustZone boot path.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Marco Franchi <marco.franchi@nxp.com>
Cc: Vanessa Maegima <vanessa.maegima@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agodrivers/crypto/fsl: assign job-rings to non-TrustZone
Bryan O'Donoghue [Fri, 26 Jan 2018 16:27:14 +0000 (16:27 +0000)]
drivers/crypto/fsl: assign job-rings to non-TrustZone

After enabling TrustZone various parts of the CAAM silicon become
inaccessible to non TrustZone contexts. The job-ring registers are designed
to allow non TrustZone contexts like Linux to still submit jobs to CAAM
even after TrustZone has been enabled.

The default job-ring permissions after the BootROM look like this for
job-ring zero.

ms=0x00008001 ls=0x00008001

The MS field is JRaMIDR_MS (job ring MID most significant).

Referring to "Security Reference Manual for i.MX 7Dual and 7Solo
Applications Processors, Rev. 0, 03/2017" section 8.10.4 we see that
JROWN_NS controls whether or not a job-ring is accessible from non
TrustZone.

Bit 15 (TrustZone) is the logical inverse of bit 3 hence the above value of
0x8001 shows that JROWN_NS=0 and TrustZone=1.

Clearly then as soon as TrustZone becomes active the job-ring registers are
no longer accessible from Linux, which is not what we want.

This patch explicitly sets all job-ring registers to JROWN_NS=1 (non
TrustZone) by default and to the Non-Secure MID 001. Both settings are
required to successfully assign a job-ring to non-secure mode. If a piece
of TrustZone firmware requires ownership of job-ring registers it can unset
the JROWN_NS bit itself.

This patch in conjunction with a modification of the Linux kernel to skip
HWRNG initialisation makes CAAM usable to Linux with TrustZone enabled.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Alex Porosanu <alexandru.porosanu@nxp.com>
Cc: Ruchika Gupta <ruchika.gupta@nxp.com>
Cc: Aneesh Bansal <aneesh.bansal@nxp.com>
Link: https://github.com/OP-TEE/optee_os/issues/1408
Link: https://tinyurl.com/yam5gv9a
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
6 years agoi2c: imx: Take mx6dqp in consideration in the I2C_PADS_INFO macro
Eran Matityahu [Fri, 26 Jan 2018 14:11:37 +0000 (16:11 +0200)]
i2c: imx: Take mx6dqp in consideration in the I2C_PADS_INFO macro

We should take the MX6DP and MX6QP options in consideration
in the I2C_PADS_INFO macro.

Based on a patch by Pierluigi Passaro <pierluigi.p@variscite.com>

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoiomux-v3: Take mx6dqp in consideration for imx_iomux_v3_setup_pad()
Eran Matityahu [Fri, 26 Jan 2018 14:09:55 +0000 (16:09 +0200)]
iomux-v3: Take mx6dqp in consideration for imx_iomux_v3_setup_pad()

We should take the MX6DP and MX6QP options in consideration
when defining imx_iomux_v3_setup_pad().

Based on a patch by Pierluigi Passaro <pierluigi.p@variscite.com>

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agodoc: mxc_hab: Improve the config option list
Fabio Estevam [Sun, 21 Jan 2018 17:57:32 +0000 (15:57 -0200)]
doc: mxc_hab: Improve the config option list

The original text is from the time that the config options were not
converted to Kconfig.

After the conversion to Kconfig only CONFIG_SECURE_BOOT and
CONFIG_CMD_DEKBLOB need to be selected by the user.

The other config options are automatically selected by the Kconfig
logic.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Breno Lima <breno.lima@nxp.com>
6 years agoarm: dts: imx6ull: move input include to base device tree
Stefan Agner [Thu, 25 Jan 2018 12:56:48 +0000 (13:56 +0100)]
arm: dts: imx6ull: move input include to base device tree

The input keycode KEY_POWER is used in the imx6ull.dtsi file,
hence include the input header where used.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agomx6sabresd: Add fastboot support
Fabio Estevam [Mon, 29 Jan 2018 13:11:57 +0000 (11:11 -0200)]
mx6sabresd: Add fastboot support

fastboot tool is a convenient way to flash the eMMC, so
add support for it.

Examples of usages:

On the mx6sabresd:

=> fastboot 0

On the Linux PC connected via USB:

$ sudo fastboot getvar bootloader-version -i 0x0525
bootloader-version: U-Boot 2018.01-00550-g7517cfe
finished. total time: 0.000s

$ sudo fastboot reboot -i 0x0525

(this causes the mx6sabresd to reboot)

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
6 years agomx6sabresd: Select CONFIG_CMD_USB_MASS_STORAGE
Fabio Estevam [Sun, 28 Jan 2018 14:49:03 +0000 (12:49 -0200)]
mx6sabresd: Select CONFIG_CMD_USB_MASS_STORAGE

Select CONFIG_CMD_USB_MASS_STORAGE so that the 'ums' can be used.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6sabre_common: Allow building CONFIG_USB_FUNCTION_MASS_STORAGE
Fabio Estevam [Sun, 28 Jan 2018 14:49:02 +0000 (12:49 -0200)]
mx6sabre_common: Allow building CONFIG_USB_FUNCTION_MASS_STORAGE

Selecting CONFIG_USB_FUNCTION_MASS_STORAGE=y in the defconfig leads to
the following error:

cmd/built-in.o: In function `do_usb_mass_storage':
cmd/usb_mass_storage.c:217: undefined reference to `fsg_main_thread'
cmd/usb_mass_storage.c:170: undefined reference to `fsg_init'

CONFIG_USB_FUNCTION_MASS_STORAGE option is built only for
the non-SPL case as per the logic in drivers/usb/gadget/Makefile,
so remove the incorrect CONFIG_SPL ifdefery to fix the build
failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
6 years agoboard: tbs2910: add private imx config
Soeren Moch [Sun, 28 Jan 2018 11:26:34 +0000 (12:26 +0100)]
board: tbs2910: add private imx config

Add board specific imx config file with recommended IPU Qos settings
and adapted DDR configuration.

Signed-off-by: Soeren Moch <smoch@web.de>
6 years agoimx: mx25: Remove SION bit in all pin-mux that are safe
Michael Trimarchi [Thu, 25 Jan 2018 13:06:11 +0000 (14:06 +0100)]
imx: mx25: Remove SION bit in all pin-mux that are safe

SION bit should be used in the situation that we need
to read back the value of a pin and should not be set by
default macro.

We get some malfunction as raised by following thread

https://www.spinics.net/lists/linux-usb/msg162574.html

As reported by this application note:
https://www.nxp.com/docs/en/application-note/AN5078.pdf

The software input on (SION) bit is an option to force an input
path to be active regardless of the value driven by the
corresponding module. It is used when the nature direction
of a pin depending on selected alternative function is an output,
but it is needed to read the real logic value on a pin.

The SION bit can be used in:
• Loopback: the module of a selected alternative function drives
the pad and also receives the pad value as an input
• GPIO capture: the module of a selected alternative function
drives the pin and the value is captured by the GPIO

SION bit is not necessary when the pin is configured as a peripheral
apart specific silicon bug. If an application needs to have this
set, this should be done in board file or in dts file

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoimx: mx7dsabresd: enable UHS and HS200
Peng Fan [Sun, 21 Jan 2018 11:00:25 +0000 (19:00 +0800)]
imx: mx7dsabresd: enable UHS and HS200

Enable UHS and HS200 for mx7dsabresd.

Read Speed improvement:
Kingston SD10VG2/16GB SDHC 3.0 card
22.2MB/s -> 73.7MB/s
eMMC5.0 MTFC8GACAEAM:
68MB/s -> 87MB/s

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
6 years agommc: fsl_esdhc: support SDR104 and HS200
Peng Fan [Sun, 21 Jan 2018 11:00:24 +0000 (19:00 +0800)]
mmc: fsl_esdhc: support SDR104 and HS200

Introduce SDR104 and HS200 support
The implementation takes linux kernel sdhci.c and sdhci-esdhc-imx.c
as reference.
 - Implement esdhc_change_pinstate to dynamically change pad settings
 - Implement esdhc_set_timing
 - Implement esdhc_set_voltage to switch voltage
 - Implement fsl_esdhc_execute_tuning to execute time process
 - Enlarge the cfg->f_max to 200MHz.
 - Parse fsl,tuning-step, fsl,tuning-start-tap and
   fsl,strobe-dll-delay-target from device tree.
 - Parse no-1-8-v property
 - Introduce esdhc_soc_data to indicate the flags and caps

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
6 years agoARM: dts: add pinmux and tuning settings for HS200/SDR104
Peng Fan [Sun, 21 Jan 2018 11:00:23 +0000 (19:00 +0800)]
ARM: dts: add pinmux and tuning settings for HS200/SDR104

The pinmux and tuning settings are from
https://source.codeaurora.org/external/imx/linux-imx/tree/arch/
arm/boot/dts/imx7s.dtsi?h=imx_4.9.11_1.0.0_ga
https://source.codeaurora.org/external/imx/linux-imx/tree/arch/
arm/boot/dts/imx7d-sdb.dts?h=imx_4.9.11_1.0.0_ga

To support HS200 and SDR104, we need change pinmux settings dynamically.
And configure tuning step and start tuning tap, otherwise you may
see tuning failure.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
6 years agommc: fsl_esdhc: add strobe and tuning entry
Peng Fan [Sun, 21 Jan 2018 11:00:22 +0000 (19:00 +0800)]
mmc: fsl_esdhc: add strobe and tuning entry

Add entries that will be used for tuning control.
The whole layout not changed, just expand reserved3[84] and
rename other reservedx in sequence.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
6 years agomx6memcal: fix comment in board header file
Eric Nelson [Thu, 18 Jan 2018 15:36:26 +0000 (08:36 -0700)]
mx6memcal: fix comment in board header file

The board header file included a reference to the starting point
from nitrogen6x.h, but since so much changed, the file bears
little resemblance to that file.

Signed-off-by: Eric Nelson <eric@nelint.com>
6 years agomx6memcal: enable SDP support
Eric Nelson [Thu, 18 Jan 2018 14:47:32 +0000 (07:47 -0700)]
mx6memcal: enable SDP support

The initial implementation of mx6memcal reset the CPU after
running the memory calibration procedure because the generic
board has no information about which boot devices are available.

Now that we have SDP support in SPL, use it to allow a full
U-Boot to be uploaded (i.e. to use "mtest").

Signed-off-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6memcal: launder through savedefconfig
Eric Nelson [Thu, 18 Jan 2018 14:47:31 +0000 (07:47 -0700)]
mx6memcal: launder through savedefconfig

This patch just changes the order of configuration items in
mx6memcal_defconfig to match the Kconfig layout, making it easier
to track changes made using menuconfig.

Signed-off-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoarm: imx: mx53loco: remove usage of mx53_dram_size
Patrick Bruenn [Tue, 16 Jan 2018 06:59:04 +0000 (07:59 +0100)]
arm: imx: mx53loco: remove usage of mx53_dram_size

Static variables are not available during board_init_f().
'static uint32_t mx53_dram_size[2];' was used in board specific
dram_init(), dram_init_banksize() and get_effective_memsize() to avoid
multiple calls to get_ram_size().

Reused dram initialization functions from arch/arm/mach-imx/mx5/mx53_dram.c

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agoarm: imx: m53evk: remove usage of mx53_dram_size
Patrick Bruenn [Tue, 16 Jan 2018 06:59:03 +0000 (07:59 +0100)]
arm: imx: m53evk: remove usage of mx53_dram_size

Static variables are not available during board_init_f().
'static uint32_t mx53_dram_size[2];' was used in board specific
dram_init(), dram_init_banksize() and get_effective_memsize() to avoid
multiple calls to get_ram_size().

Reused dram initialization functions from arch/arm/mach-imx/mx5/mx53_dram.c

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agoarm: imx: cx9020: move dram init into common place
Patrick Bruenn [Tue, 16 Jan 2018 06:59:02 +0000 (07:59 +0100)]
arm: imx: cx9020: move dram init into common place

Move dram_init(), dram_init_banksize() and get_effective_memsize() to
arch/arm/mach-imx/mx5/mx53_dram.c, where it can be reused by m53evk and
mx53loco.

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agoarm: imx: cx9020: remove usage of mx53_dram_size
Patrick Bruenn [Tue, 16 Jan 2018 06:59:01 +0000 (07:59 +0100)]
arm: imx: cx9020: remove usage of mx53_dram_size

Static variables are not available during board_init_f().
'static uint32_t mx53_dram_size[2];' was used in board specific
dram_init(), dram_init_banksize() and get_effective_memsize() to avoid
multiple calls to get_ram_size().

However multiple calls are better than undefined behavior...
This fixes:
https://lists.denx.de/pipermail/u-boot/2017-November/313214.html
https://lists.denx.de/pipermail/u-boot/2017-December/314480.html

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agoboard,ge,bx50v3 - rtc time validation
Nandor Han [Wed, 10 Jan 2018 19:31:38 +0000 (20:31 +0100)]
board,ge,bx50v3 - rtc time validation

Validate the time at startup:
 - in case rtc error add to kernel command line RTC_ERROR
 - clamp date to 1-Jan-2036

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoconfigs: ge_bx50v3: automatic partition selection and video output failure message
Ian Ray [Wed, 10 Jan 2018 19:31:37 +0000 (20:31 +0100)]
configs: ge_bx50v3: automatic partition selection and video output failure message

The exact definition of a successful boot is defined by user-space.
Determine the boot partition automatically.  A partition is selected if
file `/boot/bootcause/firstboot' exists (meaning that the partition has
freshly installed software) OR if file `/boot/fitImage' exists.

When userspace determines that new software was successfully installed,
it must (1) delete `/boot/fitImage' on the _inactive_ partition and (2)
remove `/boot/bootcause/firstboot'.

Enable video, but do not display logos or other version information.
Silence kernel console logging by default.

Print a message to VGA screen in case of boot failure and reset bootcount
to allow the user to attempt boot again.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: bx50v3: mount rootfs read-only
Hannu Lounento [Wed, 10 Jan 2018 19:31:36 +0000 (20:31 +0100)]
board: ge: bx50v3: mount rootfs read-only

Change the kernel command line to mount the root filesystem read-only in
order to be able to run filesystem check on it on boot.

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoconfigs: ge_bx50v3: enable bootcount
Ian Ray [Wed, 10 Jan 2018 19:31:35 +0000 (20:31 +0100)]
configs: ge_bx50v3: enable bootcount

Enable bootcount using an EXT file.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoconfig: ge_bx50v3: read boot script
Ian Ray [Wed, 10 Jan 2018 19:31:34 +0000 (20:31 +0100)]
config: ge_bx50v3: read boot script

Read boot script from shared partition, if available.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: bx50v3: Support FIT and select configuration based on VPD
Ian Ray [Wed, 10 Jan 2018 19:31:33 +0000 (20:31 +0100)]
board: ge: bx50v3: Support FIT and select configuration based on VPD

Modify configuration to support FIT. Set variable `confidx' from VPD,
in order to load the correct device tree. Modify/simplify U-Boot
environment to support loading FIT image.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: bx50v3: Enable hardware watchdog
Martyn Welch [Wed, 10 Jan 2018 19:31:32 +0000 (20:31 +0100)]
board: ge: bx50v3: Enable hardware watchdog

Enable the hardware watchdog on bx50v3 to cause it to reset in the event
the board hangs.

Configure GPIO_9 pin as WDOG1_B so that a watchdog timeout results in a
full system reset.

The watchdog is used and reconfigured by systemd approximately 1.7 seconds
into boot. Adding a few seconds for U-Boot and a few more seconds as a
safety margin.

Note that the PCIe controller is _not_ put back into a safe state prior
to board reset.  This is a problem if board reset is implemented as CPU
reset.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: bx50v3: program MAC address to I210
Hannu Lounento [Wed, 10 Jan 2018 19:31:31 +0000 (20:31 +0100)]
board: ge: bx50v3: program MAC address to I210

There are two I210s on the b850v3 and one on the b450v3 and b650v3.
One is connected to Marvell 88e6240 which is already programmed.

Follow the flow documented in doc/README.enetaddr: set the
enet[0-9]*addr environment variable and let the driver program the
hardware.

The mapping from the driver's index to the environment variable's name
is documented in README: Note for Redundant Ethernet Interfaces. It is
assumed that eth_devices for the controllers on the board are always
indexed in the same order.

The environment variables are removed after programming the hardware
because the variables seem to influence MAC addresses also after U-Boot.
Specifically the MAC address of FEC (MC interface) would be incorrectly
set: 'ethaddr', which maps to the first I210 chip and is set to I210's
default address read from the driver by eth_write_hwaddr in eth_legacy.c
because the variable is undefined (not set even by bx50v3.c), would
result in the eth0 interface's MAC address to be set to I210's default
address.

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: bx50v3: move FEC MAC address programming to driver
Martyn Welch [Wed, 10 Jan 2018 19:31:30 +0000 (20:31 +0100)]
board: ge: bx50v3: move FEC MAC address programming to driver

Instead of programming the hardware directly in the board
implementation, follow the flow documented in doc/README.enetaddr: set
the enet[0-9]*addr environment variable and let the driver program the
hardware.

This avoids duplicating the implementation as it already exists in the
driver (drivers/net/fec_mxc.c: fec_set_hwaddr).

The mapping from the driver's index to the environment variable's name
is documented in README: Note for Redundant Ethernet Interfaces. It is
assumed that eth_devices for the controllers on the board are always
indexed in the same order, i.e. FEC always has the index 2.

The FEC driver does *not* set the flag Set MAC Address on Transmit (bit
set_eth0_mac_address used to do but this is unnecessary as the Linux
networking stack fills in the MAC address.

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoconfigs: Add network device support for bx50v3 products
Ian Ray [Wed, 10 Jan 2018 19:31:29 +0000 (20:31 +0100)]
configs: Add network device support for bx50v3 products

Modify b450v3, b650v3 and b850v3 defconfigs to enable the network devices
found in these products.

Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoboard: ge: Enable access to i2c bus 1 and 2
Martyn Welch [Wed, 10 Jan 2018 19:31:28 +0000 (20:31 +0100)]
board: ge: Enable access to i2c bus 1 and 2

The change in i2c configuration added to support access to the VPD has
inadvertantly caused access to i2c buses 1 & 2 to be lost. This has
resulted in the configuration for the PMIC to be attempted on the wrong
bus and thus isn't taking effect.

Add the required configuration to return access to buses 1 & 2. In order
to ensure that any users of the bus numbering prior to addition in VPD
patches work, add buses before configuration related to mux on bus 0 and
tweak VPD bus usage to fit new numbering scheme.

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agortc: adding RX8010SJ rtc driver
Nandor Han [Wed, 10 Jan 2018 19:31:27 +0000 (20:31 +0100)]
rtc: adding RX8010SJ rtc driver

Add a new driver for RX8010SJ rtc chip. The driver implements both
formats of U-Boot driver model.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agonet: e1000: implement eth_write_hwaddr
Hannu Lounento [Wed, 10 Jan 2018 19:31:26 +0000 (20:31 +0100)]
net: e1000: implement eth_write_hwaddr

Implement programming MAC address to the hardware, i.e. external flash
seen as EEPROM.

MAC address is only written if it differs from what is already stored in
flash or if reading the current MAC address fails.

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agonet: e1000: split e1000_read_mac_addr
Hannu Lounento [Wed, 10 Jan 2018 19:31:25 +0000 (20:31 +0100)]
net: e1000: split e1000_read_mac_addr

Split the implementation of e1000_read_mac_addr into eeprom and register
versions called by e1000_read_mac_addr.

This allows for calling e1000_read_mac_addr when MAC address is needed
with no constraints where it is read from, and for calling the register
and, especially, the eeprom version directly in order to specify where
to read the address from.

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agonet: e1000: add support for writing to EEPROM
Hannu Lounento [Wed, 10 Jan 2018 19:31:24 +0000 (20:31 +0100)]
net: e1000: add support for writing to EEPROM

Port functions for writing to EEPROM, updating the checksum and
committing data to flash from the Linux kernel igb driver.

Functions were ported from Linux 4.8-rc2 (694d0d0bb20).

Signed-off-by: Hannu Lounento <hannu.lounento@ge.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
6 years agoimx: mx8m: add ddr controller memory map
Peng Fan [Wed, 10 Jan 2018 05:20:47 +0000 (13:20 +0800)]
imx: mx8m: add ddr controller memory map

Add ddrc memory map and enum types used in ddr initialization.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
6 years agopower: pmic/regulator allow dm be omitted by SPL
Peng Fan [Wed, 10 Jan 2018 05:20:46 +0000 (13:20 +0800)]
power: pmic/regulator allow dm be omitted by SPL

Allow the dm driver be omitted by SPL.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
6 years agoimx: imx8mq: add dtsi file
Peng Fan [Wed, 10 Jan 2018 05:20:45 +0000 (13:20 +0800)]
imx: imx8mq: add dtsi file

Add dtsi file for i.MX8MQ.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
6 years agonet: fec: fix build warnings for 64bits support
Ye Li [Wed, 10 Jan 2018 05:20:44 +0000 (13:20 +0800)]
net: fec: fix build warnings for 64bits support

When building for 64bits system, we get some warnings about type
cast between pointer and integer. This patch eliminates the warnings
by using ulong/long type which is 32bits on 32bits system or 64bits on
64bits system.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agonet: fec: do not access reserved register for i.MX8M
Peng Fan [Wed, 10 Jan 2018 05:20:43 +0000 (13:20 +0800)]
net: fec: do not access reserved register for i.MX8M

The MIB RAM and FIFO receive start register does not exist on
i.MX8M. Accessing these register will cause system hang.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agogpio: mxc: add i.MX8M support
Peng Fan [Wed, 10 Jan 2018 05:20:42 +0000 (13:20 +0800)]
gpio: mxc: add i.MX8M support

Add i.MX8M GPIO support.
There are 4 GPIO banks on i.MX8M.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>