oweals/u-boot.git
5 years agonet: ti: cpsw: Move cpsw_phy_sel() to _probe()
Faiz Abbas [Mon, 18 Mar 2019 08:24:32 +0000 (13:54 +0530)]
net: ti: cpsw: Move cpsw_phy_sel() to _probe()

cpsw_phy_sel() is a configuration step that should not be in
ofdata_to_platdata(). Add phy_sel_compat to the cpsw_platform_data
structure so that it is accessible in _probe. Then move the call of
cpsw_phy_sel() to _probe.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
5 years agonet: Add priv_pdata to eth_pdata
Faiz Abbas [Mon, 18 Mar 2019 08:24:31 +0000 (13:54 +0530)]
net: Add priv_pdata to eth_pdata

Add a priv member for eth_pdata for platform specific platform data.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
5 years agoarmv7R: K3: am654: Trigger panic on DDR init failures
Andreas Dannenberg [Mon, 11 Mar 2019 20:15:43 +0000 (15:15 -0500)]
armv7R: K3: am654: Trigger panic on DDR init failures

When initializing DDR from R5 SPL trigger U-Boot's panic facility
rather than simply returning from the board init function as there
is little point continuing code execution. Further, as panic implies
a board reset, so using it might potentially allow to recover from
this error in certain cases such as when the init failure was caused
by a temporary glitch of some sorts.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoconfigs: am65x_evm_a53: Enable CONFIG_OF_BOARD_SETUP
Lokesh Vutla [Fri, 8 Mar 2019 06:17:36 +0000 (11:47 +0530)]
configs: am65x_evm_a53: Enable CONFIG_OF_BOARD_SETUP

Enable CONFIG_OF_BOARD_SETUP so that msmc sram dt nodes
are updated correctly.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoboard: ti: am65x: Enable fixing up msmc sram node
Lokesh Vutla [Fri, 8 Mar 2019 06:17:35 +0000 (11:47 +0530)]
board: ti: am65x: Enable fixing up msmc sram node

Create a ft_board_setup() api that gets called as part of
DT fixup before jumping to kernel. In this ft_board_setup()
call fdt_fixup_msmc_ram that update msmc sram node.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoarm: k3: Add support for updating msmc dt node
Lokesh Vutla [Fri, 8 Mar 2019 06:17:34 +0000 (11:47 +0530)]
arm: k3: Add support for updating msmc dt node

Certain parts of msmc sram can be used by DMSC or can be
marked as L3 cache. Since the available size can vary, changing
DT every time the size varies might be painful. So, query this
information using TISCI cmd and fixup the DT for kernel.
Fixing up DT does the following:
- Create a sram node if not available
- update the reg property with available size
- update ranges property
- loop through available sub nodes and delete it if:
- mentioned size is out if available range
- subnode represents l3 cache or dmsc usage.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoarm: k3: Add a wrapper to get tisci handle
Lokesh Vutla [Fri, 8 Mar 2019 06:17:33 +0000 (11:47 +0530)]
arm: k3: Add a wrapper to get tisci handle

Create a wrapper to get the ti sci handle.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agofirmware: Add support for querying msmc memory
Lokesh Vutla [Fri, 8 Mar 2019 06:17:32 +0000 (11:47 +0530)]
firmware: Add support for querying msmc memory

DMSC can use certain amount of msmc memory available in the
system. Also certain part of msmc memory can be marked as L3
cache using board config. But users might not know what size
is being used and the remaining available msmc memory. In order
to fix this TISCI protocol provides a messages that can query
the available msmc memory in the system. Add support for this
message.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoconfigs: ti_omap5_common: Add NAND environment settings
Faiz Abbas [Wed, 27 Feb 2019 07:59:38 +0000 (13:29 +0530)]
configs: ti_omap5_common: Add NAND environment settings

Now that NAND is supported on DRA71x include various NAND environment
settings

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: dra71x-evm: Add Support for NAND
Faiz Abbas [Wed, 27 Feb 2019 07:59:37 +0000 (13:29 +0530)]
configs: dra71x-evm: Add Support for NAND

Add NAND support to dra71x-evm defconfig

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
5 years agoarm: dra7: Allow NAND to be enabled on DRA71x EVM.
Franklin S Cooper Jr [Wed, 27 Feb 2019 07:59:36 +0000 (13:29 +0530)]
arm: dra7: Allow NAND to be enabled on DRA71x EVM.

If SW 8 pins 0 and 1 indicate that NAND should be enabled then
the pins pinmux must be reconfigured for NAND mode.

Therefore, enable NAND by reconfiguring the pinmux.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
5 years agoboard: ti: dra71: Add pinmux settings for NAND on DRA71x EVM
Franklin S Cooper Jr [Wed, 27 Feb 2019 07:59:35 +0000 (13:29 +0530)]
board: ti: dra71: Add pinmux settings for NAND on DRA71x EVM

By default VOUT3 occupies the pins required for NAND. Therefore, create
a seperate entry that can be use to reconfigure these pins to work for
NAND.

On the EVM SWITCH 8 pins 0 and 1 will be used to determine if NAND is
enabled or not. For NAND to be selected pin 0 should be on and pin 1
should be off. Any other combination will assume NAND shouldn't be
enabled.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
5 years agoARM: davinci: da850evm: Enable SPL_OF_CONTROL without PLATDATA
Adam Ford [Tue, 26 Feb 2019 03:53:47 +0000 (21:53 -0600)]
ARM: davinci: da850evm: Enable SPL_OF_CONTROL without PLATDATA

With the memory mapping giving us some more avialable RAM, this
updates the da850-evm-u-boot.dtsi to include the serial port, SPI
and Flash nodes along with some dependent nodes in the SPL dtb.
This also removes the platform data initialization code for the
serial port and SPI Flash.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agodavinci: da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full
Adam Ford [Tue, 26 Feb 2019 03:53:46 +0000 (21:53 -0600)]
davinci: da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full

In order to fully support SPL_OF_CONTROL, we need BSS to be a bit
larger. This patch relocates BSS to SDRAM instead of SRAM which
is similar to how ARMv7 boards (like OMAP2+) do it.

This means two new variables are required:
CONFIG_SPL_BSS_START_ADDR  set to DAVINCI_DDR_EMIF_DATA_BASE
CONFIG_SPL_BSS_MAX_SIZE is set to 0x1080000 which is 1 byte
before the location where U-Boot will load.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoam335x, guardian: Add support for the bosch guardian board
Sjoerd Simons [Mon, 25 Feb 2019 15:33:00 +0000 (15:33 +0000)]
am335x, guardian: Add support for the bosch guardian board

Add support for the Bosch Guardian board.

CPU  : AM335X-GP rev 2.1
Model: Bosch AM335x Guardian
I2C:   ready
DRAM:  256 MiB
NAND:  512 MiB
MMC:   OMAP SD/MMC: 0

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Felix Brack <fb@ltec.ch>
5 years agoenv: Don't check CONFIG_ENV_OFFSET_REDUND for SPL build
Martyn Welch [Mon, 25 Feb 2019 15:32:59 +0000 (15:32 +0000)]
env: Don't check CONFIG_ENV_OFFSET_REDUND for SPL build

When booting using an SPL on am335x, if we want to support booting with
the boot ROM loader via USB (which uses RNDIS, making bootp and tftp
calls) we need to enable gadget eth in the SPL to load the main U-Boot
image. To enable CONFIG_SPL_ETH_SUPPORT, we must enable
CONFIG_SPL_ENV_SUPPORT as the environment is used by the eth support, but
we don't actually need to have environment variables saved in the SPL
environment. We do however have environment variables saved in the main
U-Boot image and enable CONFIG_ENV_OFFSET_REDUND (we are storing in raw
NAND). In such instances, even with the build config enabling both
CONFIG_CMD_SAVEENV and CONFIG_CMD_NAND, these options aren't set when
building the SPL, but CONFIG_ENV_OFFSET_REDUND still is.

Don't check this configuration option for SPL builds to enable the above
configuration.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoAdd support for the MT41K128M16JT125K memory modules
Sjoerd Simons [Mon, 25 Feb 2019 15:32:58 +0000 (15:32 +0000)]
Add support for the MT41K128M16JT125K memory modules

Add configuration for the MT41K128M16JT125K memory modules as used on the
Bosch Guardian device.

Based on a patch by:
    Govindaraji Sivanantham <Govindaraji.Sivanantham@in.bosch.com>

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
[checkpatch.pl cleanup by Martyn Welch]
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
5 years agoam57xx_evm_defconfig: Enable configs to support QSPI boot
Vignesh R [Fri, 22 Feb 2019 05:31:52 +0000 (11:01 +0530)]
am57xx_evm_defconfig: Enable configs to support QSPI boot

AM57xx IDK EVMs can boot out of QSPI. Enable configs to support QSPI
boot. Also enable configs for updating QSPI boot images over DFU.

Tested on AM572x IDK EVM.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoARM: dts: k2g-ice: add dt node for netcp
Murali Karicheri [Thu, 21 Feb 2019 17:02:07 +0000 (12:02 -0500)]
ARM: dts: k2g-ice: add dt node for netcp

This patch adds dt node for DP83867 phy used on K2G ICE board and
also enable netcp device nodes for the board.

EVM hardware spec recommends to add 0.25 nsec delay in the tx
direction and 2.25 nsec delay in the rx direction for internal
delay in the clock path to be on the safer side.

The board straps RX_DV/RX_CTRL pin of on board DP83867 phy in mode
1. Unfortunately, the phy data manual disallows this. Add
ti,dp83867-rxctrl-strap-quirk in the phy node to allow software to
enable workaround suggested for this incorrect strap setting. This
ensures proper operation of this PHY.

The dts bindings are kept in sync with that from 4.14.y linux
kernel. This required the pinmux device related bindings to be
commented out to allow for compilation.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agok2g: config enable ti phy dp83867 for k2g
Murali Karicheri [Thu, 21 Feb 2019 17:02:06 +0000 (12:02 -0500)]
k2g: config enable ti phy dp83867 for k2g

Enable ti phy dp83867 for k2g

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: dts: k2g-evm: remove unused phy-mode property from phy node
Murali Karicheri [Thu, 21 Feb 2019 17:02:05 +0000 (12:02 -0500)]
ARM: dts: k2g-evm: remove unused phy-mode property from phy node

This patch removes the unused phy-mode property from the phy dt node. On
K2G, currently link-interface determines if phy is used or not and is
already set to use rgmii. So this is not needed. Besides phy-mode should
be added to slave interface configuration of the cpsw driver, not in the
phy node.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: k2g: add a workaround to reset the phy
Murali Karicheri [Thu, 21 Feb 2019 17:02:04 +0000 (12:02 -0500)]
ARM: k2g: add a workaround to reset the phy

This patch adds a workaround to reset the phy one time during boot
using GPIO0 pin 10 to make sure, the Phy latches the configuration
from the input pins correctly.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: netcp: add support for phy with rgmii ids
Murali Karicheri [Thu, 21 Feb 2019 17:02:03 +0000 (12:02 -0500)]
net: netcp: add support for phy with rgmii ids

Enhance the netcp driver to support phys that can be configured
for internal delay (rgmii-id, rgmii-rxid, rgmii-txid)

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: k2g-gp-evm: update to rgmii pinmux configuration
Murali Karicheri [Thu, 21 Feb 2019 17:02:02 +0000 (12:02 -0500)]
ARM: k2g-gp-evm: update to rgmii pinmux configuration

This patch updates pinmux configuration for K2G GP EVM based on
data generated by the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agoARM: k2g-ice: Add pinmux support for rgmii interface
Murali Karicheri [Thu, 21 Feb 2019 17:02:01 +0000 (12:02 -0500)]
ARM: k2g-ice: Add pinmux support for rgmii interface

This add pinmux configuration for rgmii interface so that network
driver can be supported on K2G ICE boards. The pinmux configurations
for this are generated using the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default

As this required some BUFFER_CLASS definitions, same is re-used
from the linux defnitions in include/dt-bindings/pinctrl/keystone.h

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agodm: spi: Read default speed and mode values from DT
Patrick Delaunay [Wed, 27 Feb 2019 14:36:44 +0000 (15:36 +0100)]
dm: spi: Read default speed and mode values from DT

This patch update the behavior introduced by
commit 96907c0fe50a ("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_* but instead read from DT node. This will make sure that boards
with multiple SPI/QSPI controllers can be probed at different
bus frequencies and SPI modes.

Remove also use in boards of the value speed=0 (no more supported)
for ENV in SPI by using CONFIG_ENV_SPI_MAX_HZ=0.

DT values will be always used when available (full DM support of
SPI slave with available DT node) even if speed and mode are requested;
for example in splash screen support (in splash_sf_read_raw)
or in SPL boot (in spl_spi_load_image).
The caller of spi_get_bus_and_cs() no more need to force speed=0.

But the current behavior don't change if the SPI slave is not
present (device with generic driver is created automatically)
or if platdata is used (CONFIG_OF_PLATDATA).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agomtd: spi: Replace ad-hoc default implementation with spi_mem_op
Marek Vasut [Tue, 2 Apr 2019 00:52:53 +0000 (02:52 +0200)]
mtd: spi: Replace ad-hoc default implementation with spi_mem_op

Replace the ad-hoc erase operation implementation with a simple spi_mem_op
implementation of the same functionality. This is a minor optimization and
removal of the ad-hoc code.

This however also changes the behavior of the execution of the erase
opcode from two separate transfer requests to the SPI NOR driver to
one transfer request to the SPI NOR driver. The former was how U-Boot
behaved before the SPI NOR framework was imported and the later was
introduced by the SPI NOR framework. The former is more optimal, so
keep that.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: Jagan Teki <jagan@openedev.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Vignesh R <vigneshr@ti.com>
Tested-by: Ashish Kumar <Ashish.kumar@nxp.com>
5 years agospi: fsl_dspi fix to stop extra transmissions
Jared Bents [Fri, 22 Mar 2019 14:46:52 +0000 (09:46 -0500)]
spi: fsl_dspi fix to stop extra transmissions

Update to prevent a byte of zeros being transmitted between
each byte in the tx buffer when providing both a tx buffer
and a rx buffer.

Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: spi-mem: Check if exec_op function is set before calling it
Bernhard Messerklinger [Tue, 26 Mar 2019 09:01:24 +0000 (10:01 +0100)]
spi: spi-mem: Check if exec_op function is set before calling it

Add check if exec_op is set before calling it.
At the moment it is called unconditionally, which leads to a crash if it
is not set correctly.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agomtd: fix Coverity integer handling issue
Miquel Raynal [Sun, 18 Nov 2018 20:11:47 +0000 (21:11 +0100)]
mtd: fix Coverity integer handling issue

A Coverity robot reported an integer handling issue
(OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression:

    (mtd_div_by_ws(mtd->size, mtd) - mtd_div_by_ws(offs, mtd)) *
    mtd_oobavail(mtd, ops)

While such overflow will certainly never happen due to the numbers
handled, it is cleaner to fix this operation anyway.

The problem is that all the maths include 32-bit quantities, while the
result is stored in an explicit 64-bit value.

As maxooblen will just be compared with a size_t, let's change the
type of the variable to a size_t. This will not fix anything but will
clarify a bit the situation. Then, do an explicit cast to fix Coverity
warning.

Addresses-Coverity-ID: 184180 ("Integer handling issues")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
5 years agomtd: fix mtd_oobavail() incoherent returned value
Miquel Raynal [Sun, 18 Nov 2018 20:11:46 +0000 (21:11 +0100)]
mtd: fix mtd_oobavail() incoherent returned value

mtd_oobavail() returns either mtd->oovabail or mtd->oobsize. Both
values are unsigned 32-bit entities, so there is no reason to pretend
returning a signed one.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
5 years agomtd: spi: Add Macronix MX66U2G45F device
Marek Vasut [Thu, 7 Mar 2019 22:27:46 +0000 (23:27 +0100)]
mtd: spi: Add Macronix MX66U2G45F device

Add Macronix MX66U2G45F flash device description.
This is a 256 MiB part.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Vignesh R <vigneshr@ti.com>
[jagan: use 'g' instead of 'f' in flash name]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agodoc: device-tree-bindings: switch from spi-flash to jedec, spi-nor
Neil Armstrong [Sun, 10 Feb 2019 10:16:23 +0000 (10:16 +0000)]
doc: device-tree-bindings: switch from spi-flash to jedec, spi-nor

Since all DTS files has been switched to "jedec,spi-nor", remove
the "spi-flash" compatible from the bindings examples.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Patrick Delaunay <Patrick.delaunay@st.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: sf_probe: remove spi-flash compatible
Neil Armstrong [Sun, 10 Feb 2019 10:16:22 +0000 (10:16 +0000)]
mtd: sf_probe: remove spi-flash compatible

Now the "spi-flash" compatible has been removed in the DTS files,
remove this compatible from sf_probe to finally use the Linux "jedec,spi-nor"
compatible.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agox86: dts: switch spi-flash to jedec, spi-nor compatible
Neil Armstrong [Sun, 10 Feb 2019 10:16:21 +0000 (10:16 +0000)]
x86: dts: switch spi-flash to jedec, spi-nor compatible

The x86 code and DT uses "spi-flash" to detect a flash node, switch to
"jedec,spi-nor" in the DTS files and in fdtdec by switching the
GENERIC_SPI_FLASH value to to jedec,spi-nor.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agodts: switch spi-flash to jedec, spi-nor compatible
Neil Armstrong [Sun, 10 Feb 2019 10:16:20 +0000 (10:16 +0000)]
dts: switch spi-flash to jedec, spi-nor compatible

There is no reason not to use the Linux "jedec,spi-nor" binding in U-Boot
dts files. This compatible has been added in sf_probe, let use it.

This patch switches to jedec,spi-nor when spi-flash is used in the DTS
and DTSI files, and removed spi-flash when jedec,spi-nor is already
present.

The x86 dts are switched in a separate commit since it depends on a change
in fdtdec.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Evgeniy Paltsev <paltsev@synopsys.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Patrick Delaunay <Patrick.delaunay@st.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agomtd: add spi flash id s25fl064l
Heiko Schocher [Fri, 8 Feb 2019 10:03:39 +0000 (11:03 +0100)]
mtd: add spi flash id s25fl064l

Add support for SPANSION s25fl064l

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Vignesh R <vigneshr@ti.com>
5 years agomtd: spinand: Sync GigaDevice GD5F1GQ4UExxG with latest Linux version
Stefan Roese [Thu, 24 Jan 2019 16:18:19 +0000 (17:18 +0100)]
mtd: spinand: Sync GigaDevice GD5F1GQ4UExxG with latest Linux version

This patch sync's the U-Boot SPI NAND GigaDevice GD5F1GQ4UExxG support
with the latest Linux version (v5.0-rc3) plus the chip supported posted
on the MTD list. Only the currently in U-Boot available chip is
supported with this sync.

The changes for the GD5F1GQ4UExxG are:
- Name of NAND device changed to better reflect the real part
- OOB layout changed to only reserve 1 byte for BBT
- Use ECC caps 8bits/512bytes instead of 8bits/2048bytes
- Enhanced ecc_get_status() function to determine and report
  a more fine grained bit error status

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
5 years agospi: cadence_qspi: Add quad write support
Ley Foon Tan [Wed, 27 Feb 2019 05:36:14 +0000 (13:36 +0800)]
spi: cadence_qspi: Add quad write support

Use quad write if SPI_TX_QUAD flag is set.

Tested quad write on Stratix 10 SoC board (Micron
serial NOR flash, mt25qu02g)

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agoARM: mvebu: sync db-88f6820-amc.dts with Linux v5.0
Chris Packham [Thu, 11 Apr 2019 20:47:05 +0000 (08:47 +1200)]
ARM: mvebu: sync db-88f6820-amc.dts with Linux v5.0

Sync armada-385-db-88f6820-amc.dts with Linux. Retain the
u-boot,dm-pre-reloc and nand differences.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: mvebu: rename armada-385-amc.dts to armada-385-db-88f6820-amc.dts
Chris Packham [Thu, 11 Apr 2019 20:47:04 +0000 (08:47 +1200)]
ARM: mvebu: rename armada-385-amc.dts to armada-385-db-88f6820-amc.dts

This board was added to u-boot first but the Linux maintainers requested
a more descriptive name. Rename the file to match the Linux usage and
update the board defconfig.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: remove obsolete call to icache_enable
Leigh Brown [Tue, 19 Mar 2019 14:50:09 +0000 (14:50 +0000)]
ARM: kirkwood: remove obsolete call to icache_enable

Commit 93b283d49f93 ("ARM: CPU: arm926ejs: Consolidate cache routines to
common file") changed cache setup for Kirkwood such that icache_enable()
is now called from enable_caches() which is called from initr_caches()
which is in the list of functions in init_sequence_r[] prior to
arch_misc_init().  This means the call to icache_enable() in
arch_misc_init() is no longer required, so remove it.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: Add DB-XC3-24G4XG board
Chris Packham [Thu, 11 Apr 2019 10:22:53 +0000 (22:22 +1200)]
arm: mvebu: Add DB-XC3-24G4XG board

The DB-XC3-24G4XG is a switch development board from Marvell. It can
either use and external CPU card such as the db-88f6820-amc or the
internal CPU that is integrated into the switch.

Add support for running U-Boot on the internal CPU and enable the USB,
SPI and NAND peripherals. For now this needs the bin_hdr from the
Marvell U-Boot for this board.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: NAND clock support for MSYS devices
Chris Packham [Thu, 11 Apr 2019 10:22:51 +0000 (22:22 +1200)]
arm: mvebu: NAND clock support for MSYS devices

One difference with the integrated CPUs is that they use a different
clock control block to the Armada devices. Update mvebu_get_nand_clock()
accordingly.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: Add Marvell's integrated CPUs
Chris Packham [Thu, 11 Apr 2019 10:22:50 +0000 (22:22 +1200)]
arm: mvebu: Add Marvell's integrated CPUs

Marvell's switch chips with integrated CPUs (collectively referred to as
MSYS) share common ancestry with the Armada SoCs. Some of the IP blocks
(e.g. xor) are located at different addresses and DFX server exists as a
separate target on the MBUS (on Armada-38x it's just part of the core
complex registers).

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: Fix Kconfig dependency warnings
Stefan Roese [Thu, 11 Apr 2019 06:58:32 +0000 (08:58 +0200)]
arm: mvebu: Fix Kconfig dependency warnings

We now have MEVBU boards without SPL support (e.g. db-xc3-24g4xg).
Because of this, a new compile time warning from Kconfig is show:

WARNING: unmet direct dependencies detected for SPL_OF_CONTROL
  Depends on [n]: SUPPORT_OF_CONTROL [=y] && SPL [=n] && OF_CONTROL [=y]
  Selected by [y]:
  - ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y]

WARNING: unmet direct dependencies detected for SPL_DM
  Depends on [n]: DM [=y] && SPL [=n]
  Selected by [y]:
  - ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y]
...

This patch fixes this issue and removes these warnings.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
5 years agoarm: mvebu: AXP: Enhance PCIe port capability configuration
Stefan Roese [Mon, 8 Apr 2019 12:51:49 +0000 (14:51 +0200)]
arm: mvebu: AXP: Enhance PCIe port capability configuration

This patch enables the PCIe port specific link capabilities configuration
for Armada XP. The weak function board_sat_r_get() was used to return
a common flag for PCIe Gen1 vs Gen2 capability for all PCIe ports. This
is now changed with this patch to return a bit per PCIe port (4 bits
in this case, bit 0 for PCIe port 0, etc).

The theadorable board uses this new feature to configure PCIe port 0
as Gen1 and all other PCIe ports as Gen2 capable. All other AXP boards
using this function are not changed in the configuration and still
configure all ports as PCIe Gen2.

This patch also removes the parameter "pex_mode" from
board_serdes_cfg_get() as this parameter was not used in any of the
implementations.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Phil Sutter <phil@nwl.cc>
5 years agocmd: add wdt command
Michael Walle [Sat, 6 Apr 2019 00:24:02 +0000 (02:24 +0200)]
cmd: add wdt command

Add a command to control the watchdog devices. This is useful if the
watchdog is rather long running (eg. seconds) and it should be
controlled by scripts. It is also handy during debugging.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: kirkwood: lsxl: enable DM for SATA
Michael Walle [Wed, 3 Apr 2019 21:28:31 +0000 (23:28 +0200)]
arm: kirkwood: lsxl: enable DM for SATA

Switch from legacy IDE driver to sata_mv driver.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agosata: sata_mv: add orion-sata compatible string
Michael Walle [Wed, 3 Apr 2019 21:28:30 +0000 (23:28 +0200)]
sata: sata_mv: add orion-sata compatible string

The kirkwood devices are compatible with this driver.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agosata: sata_mv: support kirkwood architecture
Michael Walle [Wed, 3 Apr 2019 21:28:29 +0000 (23:28 +0200)]
sata: sata_mv: support kirkwood architecture

Fix the worng include and offset macros.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agosata: sata_mv: use correct format specifier in debug()
Michael Walle [Wed, 3 Apr 2019 21:28:28 +0000 (23:28 +0200)]
sata: sata_mv: use correct format specifier in debug()

This fixes a compile error on kirkwood.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: ds412: Enable CONFIG_BLK
Stefan Roese [Wed, 27 Mar 2019 13:31:36 +0000 (14:31 +0100)]
arm: mvebu: ds412: Enable CONFIG_BLK

This patch enables CONFIG_BLK for the ds414 Armada XP based platform.
This removes this build warning:

===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================

Please note that I don't have this board and can't test this change.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Phil Sutter <phil@nwl.cc>
5 years agoarm: mvebu: turris_omnia: select Kconfig SPI_FLASH_SPANSION
Baruch Siach [Wed, 27 Mar 2019 07:27:08 +0000 (09:27 +0200)]
arm: mvebu: turris_omnia: select Kconfig SPI_FLASH_SPANSION

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agomvebu: drop dangling SPI flash comments and #ifdefs
Baruch Siach [Wed, 27 Mar 2019 06:01:26 +0000 (08:01 +0200)]
mvebu: drop dangling SPI flash comments and #ifdefs

Following commits abe66b1b5dec ("Convert CONFIG_ENV_SPI_* to Kconfig")
and 14453fbfadc2f ("Convert CONFIG_SF_DEFAULT_* to Kconfig") remove
dandling comment lines and empty #ifdef sections.

Cc: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: clearfog: document eMMC installation
Baruch Siach [Mon, 25 Mar 2019 07:09:00 +0000 (09:09 +0200)]
arm: mvebu: clearfog: document eMMC installation

Document build and install of U-Boot image on Clearfog with eMMC.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agogit-mailrc: update the kirkwood entry
Baruch Siach [Sun, 24 Mar 2019 11:33:09 +0000 (13:33 +0200)]
git-mailrc: update the kirkwood entry

Update the kirkwood entry to match MAINTAINERS following commit
1579faf52b9f4 ("MAINTAINERS: Update u-boot-marvell entry").

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoata: ahci_mvebu: add support for Armada 38x
Baruch Siach [Sun, 24 Mar 2019 11:27:44 +0000 (13:27 +0200)]
ata: ahci_mvebu: add support for Armada 38x

With board_ahci_enable() implementation for Armada 38x in place we can
now enable 38x support in the ahci_mvebu driver.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: mvebu: define board_ahci_enable() for A38x
Baruch Siach [Sun, 24 Mar 2019 11:27:43 +0000 (13:27 +0200)]
ARM: mvebu: define board_ahci_enable() for A38x

This allows the ahci_mvebu driver to do A38x platform specific
configuration at initialization.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for nas220
Chris Packham [Wed, 13 Mar 2019 07:47:11 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for nas220

Enable CONFIG_DM_USB and CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for lschlv2 and lsxhl
Chris Packham [Wed, 13 Mar 2019 07:47:10 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for lschlv2 and lsxhl

Enable CONFIG_DM_USB and CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for goflexhome
Chris Packham [Wed, 13 Mar 2019 07:47:09 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for goflexhome

Enable CONFIG_DM_USB and CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for ds109
Chris Packham [Wed, 13 Mar 2019 07:47:08 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for ds109

Enable CONFIG_DM_USB and CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for dns325
Chris Packham [Wed, 13 Mar 2019 07:47:07 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for dns325

Enable CONFIG_DM_USB and CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: enable CONFIG_DM_USB for {dream, guru, sheeva}plug
Chris Packham [Wed, 13 Mar 2019 07:47:06 +0000 (20:47 +1300)]
ARM: kirkwood: enable CONFIG_DM_USB for {dream, guru, sheeva}plug

Enable CONFIG_DM_USB and where possible CONFIG_BLK.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Leigh Brown <leigh@solinno.co.uk>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: remove kw_config_adr_windows
Chris Packham [Wed, 13 Mar 2019 07:47:04 +0000 (20:47 +1300)]
ARM: kirkwood: remove kw_config_adr_windows

Now that kirkwood is using the mvebu mbus this function is no longer
needed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: switch to using mvebu mbus
Chris Packham [Wed, 13 Mar 2019 07:47:03 +0000 (20:47 +1300)]
ARM: kirkwood: switch to using mvebu mbus

The mvebu mbus code already had most of the support required for
kirkwood. The only difference is that unlike the other mvebu targets
kirkwood doesn't have a bridge control block so the code related to
managing that needs to be compiled out.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: remove KW_DEFADR_PCI_IO_REMAP
Chris Packham [Wed, 13 Mar 2019 07:47:02 +0000 (20:47 +1300)]
ARM: kirkwood: remove KW_DEFADR_PCI_IO_REMAP

KW_DEFADR_PCI_IO_REMAP has the same value as KW_DEFADR_PCI_IO and is
only used to set up a 1:1 mapping. Remove it and update the mapping to
use KW_DEFADR_PCI_IO.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: kirkwood: rename KW_CPU_WIN_BASE to MVEBU_CPU_WIN_BASE
Chris Packham [Wed, 13 Mar 2019 07:47:01 +0000 (20:47 +1300)]
ARM: kirkwood: rename KW_CPU_WIN_BASE to MVEBU_CPU_WIN_BASE

This will allow the kirkwood platforms to use more common code with the
other mvebu SoCs.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMakefile: Correct logic for DM_SCSI + unconverted drivers check
Stefan Roese [Tue, 12 Mar 2019 06:46:35 +0000 (07:46 +0100)]
Makefile: Correct logic for DM_SCSI + unconverted drivers check

When checking for boards that are enabling a SATA driver that isn't
converted to DM yet we need to be sure to not also trip over boards that
do set CONFIG_AHCI & CONFIG_BLK by itself, as that is not a bug.

This was detected when converting the Armada XP SATA driver sata_mv.c
to DM with AHCI & BLK support. This warning is still printed without
this patch applied here.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoarm: mvebu: theadorable: Add test for ctrl-c in PCIe PEX switch test
Stefan Roese [Mon, 11 Mar 2019 12:56:14 +0000 (13:56 +0100)]
arm: mvebu: theadorable: Add test for ctrl-c in PCIe PEX switch test

The check for the missing PEX switch can lead to an infinite loop, when
the PCIe device is not found. It is helpful to enable the user to break
out of this boot-loop, to enable booting to the prompt for test cases.
This patch adds a 3 second delay in the error case before rebooting.
The user can press Ctrl-C in this time to abort the boot-loop.

This patch also calls bootcount_inc() before rebooting in the error
case. This is needed to increment the bootcounter, since this function
is called earlier than the main bootcounter increment. Otherwise the
bootcounter will not be incremented in the error case at all.

Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: db-mv784mp-gp_defconfig: Enable CONFIG_BLK
Stefan Roese [Mon, 11 Mar 2019 12:29:22 +0000 (13:29 +0100)]
arm: mvebu: db-mv784mp-gp_defconfig: Enable CONFIG_BLK

This patch enables CONFIG_BLK as this is now possible with the recent
DM conversion of the Armada XP SATA driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
5 years agoarm: mvebu: theadorable_debug_defconfig: Enable CONFIG_BLK
Stefan Roese [Mon, 11 Mar 2019 12:29:21 +0000 (13:29 +0100)]
arm: mvebu: theadorable_debug_defconfig: Enable CONFIG_BLK

This patch enables CONFIG_BLK as this is now possible with the recent
DM conversion of the Armada XP SATA driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
5 years agosata: sata_mv: Add DM support to enable CONFIG_BLK usage
Stefan Roese [Mon, 11 Mar 2019 12:29:20 +0000 (13:29 +0100)]
sata: sata_mv: Add DM support to enable CONFIG_BLK usage

This patch adds DM support to the Armada XP SATA driver. This is needed
to enable CONFIG_BLK on this platform. It adds the SATA controller as
AHCI device, which is strictly speaking not correct, as the controller
is not AHCI compatible. But the U-Boot AHCI uclass interface enables
the usage of this DM driver and the creation of the corresponding BLK
devices.

This conversion is done to get rid of the compile warning:
Reviewed-by: Chris Packham <judge.packham@gmail.com>
===================== WARNING ======================
This board does not use CONFIG_DM_SCSI. Please update
the storage controller to use CONFIG_DM_SCSI before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
5 years agotools: kwbimage: don't adjust for image_header for Armada MSYS
Chris Packham [Tue, 19 Feb 2019 07:28:44 +0000 (20:28 +1300)]
tools: kwbimage: don't adjust for image_header for Armada MSYS

For the time being the Armada MSYS SoCs need to use the bin_hdr from the
Marvell U-Boot. Because of this the binary.0 does not contain the image
header that a proper u-boot SPL would so the adjustment introduced by
commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: x530: Enable watchdog in SPL and U-Boot
Chris Packham [Sun, 17 Feb 2019 21:30:54 +0000 (10:30 +1300)]
arm: mvebu: x530: Enable watchdog in SPL and U-Boot

Enable the hardware watchdog to guard against system lock ups when
running in the SPL or U-Boot. Stop the watchdog just before booting so
that the OS can re-enable it if needed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agowatchdog: orion_wdt: take timeout value in ms
Chris Packham [Sun, 17 Feb 2019 21:30:53 +0000 (10:30 +1300)]
watchdog: orion_wdt: take timeout value in ms

The generic wdt_start API expects to be called with the timeout in
milliseconds. Update the orion_wdt driver to accept a timeout in
milliseconds and use the clock rate specified in the dts to convert the
timeout to an appropriate value for the timer reload register.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agowatchdog: orion_wdt: support SPL usage
Chris Packham [Sun, 17 Feb 2019 21:30:52 +0000 (10:30 +1300)]
watchdog: orion_wdt: support SPL usage

When run from the SPL the mvebu targets are using the hardware default
offset for the SoC peripherals. devfdt_get_addr_size_index() understands
how to deal with this via dm_get_translation_offset() so use this
instead of fdtdec_get_addr_size_auto_noparent().

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: sync armada-xp dts files from Linux 5.0
Chris Packham [Fri, 15 Feb 2019 22:48:58 +0000 (11:48 +1300)]
arm: sync armada-xp dts files from Linux 5.0

Bring in the Armada 370/XP dts/dtsi files from Linux. As U-Boot hasn't
got the new NAND driver the updating binding has not been included.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agofdt: Fix mkimage list to try every header type
Jordan Hand [Tue, 9 Apr 2019 17:36:09 +0000 (10:36 -0700)]
fdt: Fix mkimage list to try every header type

Signed-off-by: Jordan Hand <jorhand@microsoft.com>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
Tested-by: Alex Kiernan <alex.kiernan@gmail.com>
5 years agodm: sound: make all functions static inline
Christian Gmeiner [Tue, 9 Apr 2019 09:27:00 +0000 (11:27 +0200)]
dm: sound: make all functions static inline

Fixes following compile problem:
➜  u-boot-mainline git:(master) ✗ make sandbox_defconfig all NO_SDL=1
scripts/kconfig/conf  --syncconfig Kconfig
  CHK     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CHK     include/generated/generic-asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/dumpimage.o
  HOSTLD  tools/dumpimage
  HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkimage
  HOSTLD  tools/fit_info
  HOSTLD  tools/fit_check_sign
  CC      cmd/version.o
  GZIP    cmd/config_data.gz
  CHK     cmd/config_data_gz.h
  CHK     cmd/config_data_size.h
  CHK     cmd/license_data_gz.h
  CHK     cmd/license_data_size.h
  LD      cmd/built-in.o
  CC      common/main.o
  LD      common/built-in.o
  CC      drivers/fastboot/fb_getvar.o
  LD      drivers/fastboot/built-in.o
  LD      drivers/video/built-in.o
ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_play':
/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: multiple definition of `sandbox_sdl_sound_play'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: first defined here
ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_init':
/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: multiple definition of `sandbox_sdl_sound_init'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: first defined here
make[3]: *** [scripts/Makefile.build:355: drivers/video/built-in.o] Fehler 1
make[2]: *** [scripts/Makefile.build:432: drivers/video] Fehler 2
make[1]: *** [Makefile:1531: drivers] Fehler 2
make: *** [Makefile:485: __build_one_by_one] Fehler 2

Fixes: f2b25c9bf82 ("dm: sound: Complete migration to driver model")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agosandbox: Enable fdtdec tests
Thierry Reding [Thu, 21 Mar 2019 18:10:08 +0000 (19:10 +0100)]
sandbox: Enable fdtdec tests

Enable fdtdec tests on sandbox configurations so that they can be run to
validate the fdtdec implementation.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: test: Add carveout tests
Thierry Reding [Thu, 21 Mar 2019 18:10:07 +0000 (19:10 +0100)]
fdtdec: test: Add carveout tests

Implement carveout tests for 32-bit and 64-bit builds.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: test: Use compound statement macros
Thierry Reding [Thu, 21 Mar 2019 18:10:06 +0000 (19:10 +0100)]
fdtdec: test: Use compound statement macros

This eliminates the need for intermediate helper functions and allow the
macros to return a value so that it can be used subsequently.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: test: Fix build warning
Thierry Reding [Thu, 21 Mar 2019 18:10:05 +0000 (19:10 +0100)]
fdtdec: test: Fix build warning

Hide the declaration of the "fd" variable When not building a DEBUG
configuration, to avoid the variable being unused.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: Add Kconfig symbol for tests
Thierry Reding [Thu, 21 Mar 2019 18:10:04 +0000 (19:10 +0100)]
fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: Implement carveout support functions
Thierry Reding [Thu, 21 Mar 2019 18:10:03 +0000 (19:10 +0100)]
fdtdec: Implement carveout support functions

The fdtdec_get_carveout() and fdtdec_set_carveout() function can be used
to read a carveout from a given node or add a carveout to a given node
using the standard device tree bindings (involving reserved-memory nodes
and the memory-region property).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agofdtdec: Implement fdtdec_add_reserved_memory()
Thierry Reding [Thu, 21 Mar 2019 18:10:02 +0000 (19:10 +0100)]
fdtdec: Implement fdtdec_add_reserved_memory()

This function can be used to add subnodes in the /reserved-memory node.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agofdtdec: Implement fdtdec_set_phandle()
Thierry Reding [Thu, 21 Mar 2019 18:10:01 +0000 (19:10 +0100)]
fdtdec: Implement fdtdec_set_phandle()

This function can be used to set a phandle for a given node.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agofdtdec: Add fdt_{addr, size}_unpack() helpers
Thierry Reding [Thu, 21 Mar 2019 18:10:00 +0000 (19:10 +0100)]
fdtdec: Add fdt_{addr, size}_unpack() helpers

These helpers can be used to unpack variables of type fdt_addr_t and
fdt_size_t into a pair of 32-bit variables. This is useful in cases
where such variables need to be written to properties (such as "reg")
of a device tree node where they need to be split into cells.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agofdtdec: Add cpu_to_fdt_{addr, size}() macros
Thierry Reding [Thu, 21 Mar 2019 18:09:59 +0000 (19:09 +0100)]
fdtdec: Add cpu_to_fdt_{addr, size}() macros

These macros are useful for converting the endianness of variables of
type fdt_addr_t and fdt_size_t.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agolibfdt: Add phandle generation helper
Thierry Reding [Thu, 21 Mar 2019 18:09:58 +0000 (19:09 +0100)]
libfdt: Add phandle generation helper

The new fdt_generate_phandle() function can be used to generate a new,
unused phandle given a specific device tree blob. The implementation is
somewhat naive in that it simply walks the entire device tree to find
the highest phandle value and then returns a phandle value one higher
than that. A more clever implementation might try to find holes in the
current set of phandle values and fill them. But this implementation is
relatively simple and works reliably.

Also add a test that validates that phandles generated by this new API
are indeed unique.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: remove unused function dm_fdt_pre_reloc
Patrick Delaunay [Wed, 20 Mar 2019 17:21:26 +0000 (18:21 +0100)]
dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoclk: socfpga: replace dm_fdt_pre_reloc by dm_ofnode_pre_reloc
Patrick Delaunay [Wed, 20 Mar 2019 17:21:25 +0000 (18:21 +0100)]
clk: socfpga: replace dm_fdt_pre_reloc by dm_ofnode_pre_reloc

Prepare to remove dm_fdt_pre_reloc function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoclk: at91: replace dm_fdt_pre_reloc by dm_ofnode_pre_reloc
Patrick Delaunay [Wed, 20 Mar 2019 17:21:24 +0000 (18:21 +0100)]
clk: at91: replace dm_fdt_pre_reloc by dm_ofnode_pre_reloc

Prepare to remove dm_fdt_pre_reloc

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Properly print physical addresses
Thierry Reding [Tue, 12 Mar 2019 10:38:02 +0000 (11:38 +0100)]
sandbox: Properly print physical addresses

Use the %pap printf specifier to print physical addresses. The physical
address is passed by reference and hence avoids the need to play tricks
with the preprocessor to use the correct specifier.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agosandbox: Use correct phys_{addr, size}_t for PHYS_64BIT=y
Thierry Reding [Tue, 12 Mar 2019 10:38:01 +0000 (11:38 +0100)]
sandbox: Use correct phys_{addr, size}_t for PHYS_64BIT=y

If 64-bit physical addresses support is enabled, make sure the sandox
defines the correct types for phys_addr_t and phys_size_t.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agovsprintf: Support phys_addr_t specifier unconditionally
Thierry Reding [Tue, 12 Mar 2019 10:38:00 +0000 (11:38 +0100)]
vsprintf: Support phys_addr_t specifier unconditionally

When phys_addr_t printf specifier support was first introduced in commit
1eebd14b7902 ("vsprintf: Add modifier for phys_addr_t"), it was enabled
only if CONFIG_CMD_NET was selected. Since physical addresses are not
unique to networking support it doesn't make sense to conditionally add
it in those cases only. Move support for it outside of the CMD_NET guard
so that the specifier is always supported.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocore: ofnode: Fix ASAN-reported stack-buffer-overflow in of_get_address
Eugeniu Rosca [Sat, 9 Mar 2019 16:27:07 +0000 (17:27 +0100)]
core: ofnode: Fix ASAN-reported stack-buffer-overflow in of_get_address

v2019.04-rc3 sandbox U-Boot fails to boot when compiled with
 -fsanitize=address and linked against -lasan, reporting [1].

Git bisecting shows that the issue is contributed by v2019.01 commit
1678754f5e2c ("core: ofnode: Fix ofnode_get_addr_index function").

The root cause seems to be the mismatch between sizeof(u64) and
sizeof(fdt_size_t) on sandbox. Luckily, thanks to the fact that the
size argument of both of_get_address() and fdtdec_get_addr_size_fixed()
is optional, we can pass NULL in its place, avoiding the problem.

[1] Backtrace reported by ASAN (gcc 8.1.0):

$> ./u-boot -d arch/sandbox/dts/sandbox.dtb
[..]
Reviewed-by: Simon Glass <sjg@chromium.org>
=================================================================
==10998==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffcc2331140 at pc 0x0000004eeeb0 bp 0x7ffcc2330f80 sp 0x7ffcc2330f70
WRITE of size 8 at 0x7ffcc2331140 thread T0
    #0 0x4eeeaf in of_get_address drivers/core/of_addr.c:154
    #1 0x4f7441 in ofnode_get_addr_index drivers/core/ofnode.c:263
    #2 0x5b2a78 in sb_eth_ofdata_to_platdata drivers/net/sandbox.c:422
    #3 0x4dccd8 in device_probe drivers/core/device.c:407
    #4 0x753170 in eth_initialize net/eth-uclass.c:428
    #5 0x47d9bf in initr_net common/board_r.c:557
    #6 0x6bcfa7 in initcall_run_list lib/initcall.c:30
    #7 0x47e1fe in board_init_r common/board_r.c:859
    #8 0x4060e5 in main arch/sandbox/cpu/start.c:356
    #9 0x7fb8d135482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #10 0x40a3a8 in _start (/path/to/u-boot/u-boot+0x40a3a8)

Address 0x7ffcc2331140 is located in stack of thread T0 at offset 32 in frame
    #0 0x4f72b8 in ofnode_get_addr_index drivers/core/ofnode.c:255

  This frame has 3 object(s):
    [32, 36) 'size' <== Memory access at offset 32 partially overflows this variable
    [96, 100) 'flags'
    [160, 168) 'node'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow drivers/core/of_addr.c:154 in of_get_address
Shadow bytes around the buggy address:
  0x10001845e1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10001845e1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10001845e1f0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x10001845e200: 04 f2 f2 f2 f2 f2 f2 f2 04 f2 f2 f2 f2 f2 f2 f2
  0x10001845e210: 04 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00
=>0x10001845e220: 00 00 00 00 f1 f1 f1 f1[04]f2 f2 f2 f2 f2 f2 f2
  0x10001845e230: 04 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 f3 f3 f3 f3
  0x10001845e240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10001845e250: 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2 f3 f3 f3 f3
  0x10001845e260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
  0x10001845e270: f1 f1 00 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==10998==ABORTING

'To' list:
 git log --since=1year drivers/core/ofnode.c | grep "\-by: .*@" | \
     sed 's/.*-by: //' | sort | uniq -c | sort -rn
     10 Simon Glass <sjg@chromium.org>
      3 Mario Six <mario.six@gdsys.cc>
      2 Martin Fuzzey <mfuzzey@parkeon.com>
      2 Marek Vasut <marek.vasut+renesas@gmail.com>
      1 Tom Rini <trini@konsulko.com>
      1 Masahiro Yamada <yamada.masahiro@socionext.com>
      1 Keerthy <j-keerthy@ti.com>
      1 Jens Wiklander <jens.wiklander@linaro.org>
      1 Bin Meng <bmeng.cn@gmail.com>

Fixes: 1678754f5e2c ("core: ofnode: Fix ofnode_get_addr_index function")
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
5 years agosysreset: use syscon_regmap_lookup_by_phandle
Patrick Delaunay [Thu, 7 Mar 2019 08:57:14 +0000 (09:57 +0100)]
sysreset: use syscon_regmap_lookup_by_phandle

Use the new function syscon_regmap_lookup_by_phandle()
to simplify the code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>