]> git.sur5r.net Git - u-boot/log
u-boot
6 years agoarm: zynq: Enable debug uart on Zedboard
Siva Durga Prasad Paladugu [Wed, 24 Jan 2018 11:50:32 +0000 (17:20 +0530)]
arm: zynq: Enable debug uart on Zedboard

It helps with debugging.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Enable ethernet driver for zc1751-dc5
Michal Simek [Wed, 31 Jan 2018 08:18:33 +0000 (09:18 +0100)]
arm64: zynqmp: Enable ethernet driver for zc1751-dc5

Enable missing driver on this board.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agofpga: Simplify error path in fpga_add
Michal Simek [Fri, 26 Jan 2018 12:17:04 +0000 (13:17 +0100)]
fpga: Simplify error path in fpga_add

Check !desc earlier to simplify code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Reviewed-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
6 years agoxilinx: Sync defconfigs with latest Kconfig updates
Michal Simek [Fri, 23 Mar 2018 08:34:00 +0000 (09:34 +0100)]
xilinx: Sync defconfigs with latest Kconfig updates

Make defconfigs up2date with current location.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Convert board to use zynqmp-clk driver
Michal Simek [Fri, 8 Dec 2017 13:50:42 +0000 (14:50 +0100)]
arm64: zynqmp: Convert board to use zynqmp-clk driver

Use zynqmp clock driver instead of fixed clocks.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoi2c: lpi2c: remove superfluous assignments
Heinrich Schuchardt [Sun, 18 Mar 2018 10:14:56 +0000 (11:14 +0100)]
i2c: lpi2c: remove superfluous assignments

In

lpi2c_status_t result = A;
result = B;

the first assignment has no effect. Let's remove it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoMerge git://git.denx.de/u-boot-net
Tom Rini [Thu, 22 Mar 2018 20:35:43 +0000 (16:35 -0400)]
Merge git://git.denx.de/u-boot-net

6 years agoconfigs: omapl138: Enable DM and DT
Lokesh Vutla [Fri, 16 Mar 2018 13:22:21 +0000 (18:52 +0530)]
configs: omapl138: Enable DM and DT

Enable Driver Model and Device-tree support for omapl138 board
in U-Boot. Also enable DM_SERIAL and DM_I2C.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoARM: dts: da850-lcdk: Sync from Linux 4.16
Lokesh Vutla [Fri, 16 Mar 2018 13:22:20 +0000 (18:52 +0530)]
ARM: dts: da850-lcdk: Sync from Linux 4.16

Sync dts from Linux 4.16 and also add u-boot specific
dtsi for OMAPl138 board.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agodavinci: Enable DDR_INIT for DA8XX
Lokesh Vutla [Fri, 16 Mar 2018 08:52:12 +0000 (14:22 +0530)]
davinci: Enable DDR_INIT for DA8XX

Commit 6aa4ad8e3820 ("Convert CONFIG_SOC_DA8XX et al to Kconfig")
converted SOC_DA8XX to Kconfig but missed enabling DDR_INIT for
SOC_DA8XX, which broke OMAPL138 to boot.

Commit 2e87980580d0 ("davinci: Fix omapl138_lcdk builds") disabled
DDR_INIT for all DA850 SoCs. This failed all DA850 boards to boot
as ddr is not being initialized.

Enable SYS_DA850_DDR_INIT for DA8XX so that all DA850 and OMAPL138
will have ddr initialized

Fixes: 2e87980580d0 ("davinci: Fix omapl138_lcdk builds")
Fixes: 6aa4ad8e3820 ("Convert CONFIG_SOC_DA8XX et al to Kconfig")
Reported-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: David Lechner <david@lechnology.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoconfigs: am335x_evm: Increase SPL_SYS_MALLOC_F_LEN to accomodate gpio_devices
Faiz Abbas [Thu, 15 Mar 2018 15:41:35 +0000 (21:11 +0530)]
configs: am335x_evm: Increase SPL_SYS_MALLOC_F_LEN to accomodate gpio_devices

With gpio devices getting created in SPL, the size of the heap is
no longer sufficient. Therefore, increase SPL_SYS_MALLOC_F_LEN
to 0x1000.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agogpio: omap_gpio: Add DM_FLAG_PRE_RELOC flag
Faiz Abbas [Thu, 15 Mar 2018 15:41:34 +0000 (21:11 +0530)]
gpio: omap_gpio: Add DM_FLAG_PRE_RELOC flag

With DM enabled in SPL, DM_FLAG_PRE_RELOC is required for
the omap_gpio driver to be bound to the gpio devices.

Therefore, add DM_FLAG_PRE_RELOC flag to the omap_gpio driver.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoscripts/check-config.sh: fix "command not found" error handling
Luca Ceresoli [Thu, 15 Mar 2018 10:08:56 +0000 (11:08 +0100)]
scripts/check-config.sh: fix "command not found" error handling

scripts/check-config.sh exits successfully and silently without doing
any checks when the 'comm' command is not found.

The problem triggers from the command around line 39:

  comm -23 ${suspects} ${ok} >${new_adhoc}

This statement fails when 'comm' is not in $PATH, creating an empty
${new_adhoc} file. But the script continues and the following line,
which is supposed to detect an error:

  if [ -s ${new_adhoc} ]; then

will always be false since the file is empty, and the script will exit
successfully as if everything were OK.

The case where 'comm' in not in $PATH is not theoretical. It used to
happen on yocto until a recent fix [0], and still happens on the
current stable branch (rocko).

Fix by setting the errexit flag to exit with error when a statement
fails, so that at least the problem is noticed.

For additional safety also set the nounset flag to detect expansion
errors.

[0] http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=fe0b4cb5b48580d4a3f3c0eb82bfa6f1b13801e4

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodavinci: omapl138_lcdk: fix PLL0 frequency
David Lechner [Thu, 15 Mar 2018 01:36:30 +0000 (20:36 -0500)]
davinci: omapl138_lcdk: fix PLL0 frequency

commit 1601dd97edc6 ("davinci: omapl138_lcdk: increase PLL0 frequency")
changed the PLL0 frequency to 456MHz, which is needed for the LCDC IP
block. However, in doing so, it caused the PLLOUT clock to be outside
of the allowable specifications given in the OMAP-L138 data sheet. (It
says PLLOUT must be 600MHz max). It also uses a PLLM value outside of
the range given in the TRM (it says PLLM must in the range 0 to 0x1f).

So here is what we have currently:

PLLOUT = 24 / (0 + 1) * (37 + 1) = 912MHz (out of spec)
         ^     ^         ^
       CLKIN PREDIV    PLLM (out of spec)

input to PLLDIVn = 912 / (1 + 1) = 456MHz (desired result)
                    ^     ^
                 PLLOUT POSTDIV

This changes the PLLM value to 18 and the POSTDIV value to 0 so that
PLLOUT is now within specification but we still get the desired
result.

PLLOUT = 24 / (0 + 1) * (18 + 1) = 456MHz (within spec)
         ^     ^         ^
       CLKIN PREDIV     PLLM

input to PLLDIVn = 456 / (0 + 1) = 456MHz (desired result)
                    ^     ^
                 PLLOUT POSTDIV

Fixes: 1601dd97edc6 ("davinci: omapl138_lcdk: increase PLL0 frequency")
Signed-off-by: David Lechner <david@lechnology.com>
Reported-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Sekhar Nori <nsekhar@ti.com>
6 years agotest/py: add spi_flash tests
Liam Beguin [Wed, 14 Mar 2018 23:15:16 +0000 (19:15 -0400)]
test/py: add spi_flash tests

Add basic tests for the spi_flash subsystem.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agonet: Drop CONFIG_ENC28J60
Tuomas Tynkkynen [Tue, 20 Mar 2018 00:02:28 +0000 (02:02 +0200)]
net: Drop CONFIG_ENC28J60

Last user of this driver went away in October 2014 in
commit d58a9451e7339ed4 ("ppc/arm: zap EMK boards").

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: macb: remove superfluous logical constraint
Heinrich Schuchardt [Sun, 18 Mar 2018 10:32:53 +0000 (11:32 +0100)]
net: macb: remove superfluous logical constraint

In

if (a > =0) {...}
else (a < 0) {...}

the second logical constraint is superfluous.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers: net: cpsw: remove superfluous assignment.
Heinrich Schuchardt [Sun, 18 Mar 2018 10:24:38 +0000 (11:24 +0100)]
drivers: net: cpsw: remove superfluous assignment.

In

int ret = A;
ret = B;

the first assignment has not effect.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agolan7xxx: Require phylib
Alexander Graf [Thu, 15 Mar 2018 14:10:20 +0000 (15:10 +0100)]
lan7xxx: Require phylib

The lan75xx and lan78xx drivers need to drive their phy via the generic
phylib framework. Let's reflect that dependency in Kconfig, so that we
don't get build errors when phylib does not get selected.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Only access network devices after init
Alexander Graf [Thu, 15 Mar 2018 14:07:09 +0000 (15:07 +0100)]
net: Only access network devices after init

In the efi_loader main loop we call eth_rx() occasionally. This rx function
might end up calling into devices that haven't been initialized yet,
potentially resulting in a lot of transfer timeouts.

Instead, let's make sure the ethernet device is actually initialized before
reading from or writing to it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Fix netretry condition
Leonid Iziumtsev [Fri, 9 Mar 2018 14:29:06 +0000 (15:29 +0100)]
net: Fix netretry condition

The "net_try_count" counter starts from "1".
And the "retrycnt" contains requested amount of retries.

With current logic, that means that the actual retry amount
will be one time less then what we set in "netretry" env.
For example setting "netretry" to "once" will make "retrycnt"
equal "1", so no retries will be triggered at all.

Fix the logic by changing the statement of "if" condition.

Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@se.atlascopco.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet/phy/cortina: Add No firmware upload option
Priyanka Jain [Tue, 30 Jan 2018 06:41:08 +0000 (12:11 +0530)]
net/phy/cortina: Add No firmware upload option

Current Cortina phy driver assumes that firmware upload
is required during initialization and is dependent
on presence of corresponding macros like CONFIG_CORTINA_FW_ADDR
for compilation.

But Cortina phy has provision to store phy firmware in
attached dedicated EEPROM. And boards designed with such
EEPROM does not require firmware upload.

Add CORTINA_NO_FW_UPLOAD option in cortina.c to support
such boards.

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet/phy/cortina.c: Update get_phy_id implementation
Priyanka Jain [Tue, 30 Jan 2018 06:08:38 +0000 (11:38 +0530)]
net/phy/cortina.c: Update get_phy_id implementation

Update get_phy_id() implementation in cortina.c to check
for Cortina_phy by comparing device phy_id with cortina phy_id
instead of relying on presence of CORTINA macros.

This will allow get_phy_id to work with non-cortina phy devices
which might have same phy address as Cortina device but on
different  bus.

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoconfigs: ls1012a: add pfe configuration for LS1012A
Calvin Johnson [Thu, 8 Mar 2018 10:00:35 +0000 (15:30 +0530)]
configs: ls1012a: add pfe configuration for LS1012A

Add configurations for PFE.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoarmv8: layerscape: csu: enable ns access to PFE registers
Calvin Johnson [Thu, 8 Mar 2018 10:00:34 +0000 (15:30 +0530)]
armv8: layerscape: csu: enable ns access to PFE registers

Enable all types of non-secure access to PFE block registers.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoarmv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC
Calvin Johnson [Thu, 8 Mar 2018 10:00:33 +0000 (15:30 +0530)]
armv8: fsl-lsch2: configure pfe's DDR and HDBUS interfaces and ECC

1. Set AWCACHE0 attribute of PFE DDR and HDBUS master interfaces
to bufferable.
2. Set RD/WR QoS for PFE DDR and HDBUS AXI master interfaces.
3. Disable ECC detection for PFE.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoarmv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure
Calvin Johnson [Thu, 8 Mar 2018 10:00:32 +0000 (15:30 +0530)]
armv8: fsl-lsch2: add pfe macros and update ccsr_scfg structure

SoC specific PFE macros are defined and structure ccsr_scfg
is updated with members defined for PFE.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoboard: freescale: ls1012a2g5rdb: enable network support on ls1012a2g5rdb
Calvin Johnson [Thu, 8 Mar 2018 10:00:31 +0000 (15:30 +0530)]
board: freescale: ls1012a2g5rdb: enable network support on ls1012a2g5rdb

This patch enables ethernet support for ls1012a2g5rdb.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoboard: freescale: ls1012ardb: enable network support on ls1012ardb
Calvin Johnson [Thu, 8 Mar 2018 10:00:30 +0000 (15:30 +0530)]
board: freescale: ls1012ardb: enable network support on ls1012ardb

This patch enables ethernet support for ls1012ardb.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoboard: freescale: ls1012afrdm: enable network support on ls1012afrdm
Calvin Johnson [Thu, 8 Mar 2018 10:00:29 +0000 (15:30 +0530)]
board: freescale: ls1012afrdm: enable network support on ls1012afrdm

This patch enables ethernet support for ls1012afrdm.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoboard: freescale: ls1012aqds: enable network support on ls1012aqds
Calvin Johnson [Thu, 8 Mar 2018 10:00:28 +0000 (15:30 +0530)]
board: freescale: ls1012aqds: enable network support on ls1012aqds

This patch enables ethernet support for ls1012aqds.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers: net: pfe_eth: LS1012A PFE headers
Calvin Johnson [Thu, 8 Mar 2018 10:00:27 +0000 (15:30 +0530)]
drivers: net: pfe_eth: LS1012A PFE headers

Contains all the pfe header files.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers: net: pfe_eth: provide pfe commands
Calvin Johnson [Thu, 8 Mar 2018 10:00:26 +0000 (15:30 +0530)]
drivers: net: pfe_eth: provide pfe commands

pfe_command provides command line support for several features that
support pfe, like starting or stopping the pfe, checking the health
of the processor engines and checking status of different units inside
pfe.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers: net: pfe_eth: LS1012A PFE driver introduction
Calvin Johnson [Thu, 8 Mar 2018 10:00:25 +0000 (15:30 +0530)]
drivers: net: pfe_eth: LS1012A PFE driver introduction

This patch adds PFE driver to U-Boot

Following are the main driver files:-
pfe_hw.c: provides low level helper functions to initialize PFE
internal processor engines and other hardware blocks
pfe_driver.c: provides initialization functions
and packet send and receive functions
pfe_eth.c: provides high level gemac initialization functions
pfe_firmware.c: provides functions to load firmware into PFE
internal processor engines.
pfe_mdio.c: provides functions to initialize phy and mdio.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoarmv8: fsl-layerscape: Add support of GPIO structure
Prabhakar Kushwaha [Thu, 8 Mar 2018 10:00:24 +0000 (15:30 +0530)]
armv8: fsl-layerscape: Add support of GPIO structure

Layerscape Gen2 SoC supports GPIO registers to control GPIO
signals. Adding support of GPIO structure to access GPIO
registers.

Signed-off-by: Pratiyush Srivastava <pratiyush.srivastava@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agodrivers: net: phy: Fix aquantia compilation with DM
Calvin Johnson [Thu, 8 Mar 2018 10:00:23 +0000 (15:30 +0530)]
drivers: net: phy: Fix aquantia compilation with DM

With CONFIG_DM_ETH enabled, aquantia driver compilation fails with
below error. This patch fixes the issue by including dm.h.

drivers/net/phy/aquantia.c: In function ‘aquantia_startup’:
drivers/net/phy/aquantia.c:73:21: error: dereferencing pointer to
incomplete
type ‘struct udevice’
          phydev->dev->name);
     ^~

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: mvpp2x: add check after calloc
Heinrich Schuchardt [Wed, 7 Mar 2018 02:39:04 +0000 (03:39 +0100)]
net: mvpp2x: add check after calloc

After allocating plat the pointer is checked.
Afterwards name is allocated and not checked.

Add the missing check to avoid a possible NULL dereference.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoConfigs: Use the newly added PHY_RTL8211E_PINE64_GIGABIT_FIX
kevans@FreeBSD.org [Wed, 14 Feb 2018 23:02:16 +0000 (17:02 -0600)]
Configs: Use the newly added PHY_RTL8211E_PINE64_GIGABIT_FIX

The Pine64+ uses a generic PHY driver, so flip it over to using the
Realtek PHY driver to actually apply the RTL8211e fix.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: Add PHY_RTL8211E_PINE64_GIGABIT_FIX for realtek phys
kevans@FreeBSD.org [Wed, 14 Feb 2018 23:02:15 +0000 (17:02 -0600)]
net: phy: Add PHY_RTL8211E_PINE64_GIGABIT_FIX for realtek phys

Setting PHY_RTL8211E_PINE64_GIGABIT_FIX forces internal rx/tx delays off
on the PHY, as well as flipping some magical undocumented bits. The
magic number comes from the Pine64 engineering team, presumably as a
proxy from Realtek. This configuration fixes the throughput on some
Pine64 models. Packet loss of up to 60-70% has been observed without
this.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoDW SPI: use 32 bit access instead of 16 and 32 bit mix
Eugeniy Paltsev [Thu, 22 Mar 2018 10:50:47 +0000 (13:50 +0300)]
DW SPI: use 32 bit access instead of 16 and 32 bit mix

Current DW SPI driver uses 32 bit access for some registers and
16 bit access for others. So if DW SPI IP is connected via bus
which doesn't support 16 bit access we will get bus error.

Fix that by switching to 32 bit access only instead of 16 and 32 bit mix

Additional Documentation to Support this Change:
The DW_apb_ssi databook states:
"All registers in the DW_apb_ssi are addressed at 32-bit boundaries
to remain consistent with the AHB bus. Where the physical size of
any register is less than 32-bits wide, the upper unused bits of
the 32-bit boundary are reserved. Writing to these bits has no
effect; reading from these bits returns 0." [1]

[1] Section 6.1 of dw_apb_ssi.pdf (version 3.22a)

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoDW SPI: add option to use external gpio for chip select
Eugeniy Paltsev [Thu, 22 Mar 2018 10:50:46 +0000 (13:50 +0300)]
DW SPI: add option to use external gpio for chip select

DW SPI internal chip select management has limitation:
it hold CS line in active state only when the FIFO is not
empty. If the FIFO freed before we add new data the SPI transaction will
be broken.

So add option to use external gpio for chip select. Gpio can be added
via device tree using standard gpio bindings.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoDW SPI: refactor poll_transfer functions
Eugeniy Paltsev [Thu, 22 Mar 2018 10:50:45 +0000 (13:50 +0300)]
DW SPI: refactor poll_transfer functions

There is no sense in waiting for RX data in dw_reader function:
there is no chance that RX data will appear in RX FIFO if
RX FIFO is empty after previous TX write in dw_writer function.
So get rid of this waiting. After that we can get rid of dw_reader
return value and make it returning void. After that we can get rid
of dw_reader return value check in poll_transfer function.

With these changes we're getting closer to Linux DW SPI driver.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoDW SPI: fix transmit only mode
Eugeniy Paltsev [Thu, 22 Mar 2018 10:50:44 +0000 (13:50 +0300)]
DW SPI: fix transmit only mode

In current implementation we get -ETIMEDOUT error when we try to use
transmit only mode (SPI_TMOD_TO)
This happens because in transmit only mode input FIFO never gets any data
which breaks our logic in dw_reader(): we are waiting until RX data will be
ready in dw_reader, but this newer happens, so we return with error.

Fix that by using SPI_TMOD_TR instead of SPI_TMOD_TO which allows to use
RX FIFO.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoDW SPI: fix tx data loss on FIFO flush
Eugeniy Paltsev [Thu, 22 Mar 2018 10:50:43 +0000 (13:50 +0300)]
DW SPI: fix tx data loss on FIFO flush

In current implementation if some data still exists in Tx FIFO it
can be silently flushed, i.e. dropped on disabling of the controller,
which happens when writing 0 to DW_SPI_SSIENR (it happens in the
beginning of new transfer)

So add wait for current transmit operation to complete to be sure
that current transmit operation is finished before new one.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agotest/py: add generic CRC32 function
Liam Beguin [Wed, 14 Mar 2018 23:15:15 +0000 (19:15 -0400)]
test/py: add generic CRC32 function

Add a generic function which can be used to compute the CRC32 value of
a region of RAM.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agotest/py: do not import pytest multiple times
Liam Beguin [Wed, 14 Mar 2018 23:15:14 +0000 (19:15 -0400)]
test/py: do not import pytest multiple times

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agotest/py: README: add HOSTNAME to PYTHONPATH
Liam Beguin [Wed, 14 Mar 2018 23:15:13 +0000 (19:15 -0400)]
test/py: README: add HOSTNAME to PYTHONPATH

As opposed to PATH, HOSTNAME is not appended to PYTHONPATH
automatically. Lets add it to the examples to make it more
obvious to new users.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agotest/py: README: fix typo
Liam Beguin [Wed, 14 Mar 2018 23:15:12 +0000 (19:15 -0400)]
test/py: README: fix typo

Fix a minor typo causing vim (and possibly other) to get confused with
coloring.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agocmd: sf: fix map_physmem check
Liam Beguin [Wed, 14 Mar 2018 23:15:11 +0000 (19:15 -0400)]
cmd: sf: fix map_physmem check

Make sure 0x00 is a valid address to read to. If `addr` is 0x00 then
map_physmem() will return 0 which should be a valid address.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agospi: spi_flash: do not fail silently on bad user input
Liam Beguin [Wed, 14 Mar 2018 23:15:10 +0000 (19:15 -0400)]
spi: spi_flash: do not fail silently on bad user input

Make sure the user is notified instead of silently returning an error.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agotools: Make kwboot build if HOST_TOOLS_ALL=y
Tuomas Tynkkynen [Tue, 13 Mar 2018 13:23:04 +0000 (15:23 +0200)]
tools: Make kwboot build if HOST_TOOLS_ALL=y

The kwboot tool for Marvell devices isn't currently being built even if
HOST_TOOLS_ALL is set. It doesn't appear to depend on any CONFIG_
options, so it seems appropriate to enable building it here.

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
6 years agoMerge git://git.denx.de/u-boot-mips
Tom Rini [Wed, 21 Mar 2018 22:58:03 +0000 (18:58 -0400)]
Merge git://git.denx.de/u-boot-mips

6 years agomips: bmips: add ar-5315 usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:11:17 +0000 (21:11 +0100)]
mips: bmips: add ar-5315 usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6318 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:11:16 +0000 (21:11 +0100)]
mips: bmips: add support for bcm6318 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agophy: add support for bcm6318 usbh phy
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:11:15 +0000 (21:11 +0100)]
phy: add support for bcm6318 usbh phy

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: bmips: add vr-3032u usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:21 +0000 (21:10 +0100)]
mips: bmips: add vr-3032u usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm63268 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:20 +0000 (21:10 +0100)]
mips: bmips: add support for bcm63268 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add dgnd3700v2 usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:19 +0000 (21:10 +0100)]
mips: bmips: add dgnd3700v2 usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6362 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:18 +0000 (21:10 +0100)]
mips: bmips: add support for bcm6362 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add ar-5387un usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:17 +0000 (21:10 +0100)]
mips: bmips: add ar-5387un usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6328 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:16 +0000 (21:10 +0100)]
mips: bmips: add support for bcm6328 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add wap-5813n usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:15 +0000 (21:10 +0100)]
mips: bmips: add wap-5813n usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6368 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:14 +0000 (21:10 +0100)]
mips: bmips: add support for bcm6368 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agophy: add support for bcm6368 usbh phy
Álvaro Fernández Rojas [Sun, 4 Feb 2018 20:10:13 +0000 (21:10 +0100)]
phy: add support for bcm6368 usbh phy

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: bmips: add nb4-ser usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:19:14 +0000 (11:19 +0100)]
mips: bmips: add nb4-ser usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add hg556a usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:19:13 +0000 (11:19 +0100)]
mips: bmips: add hg556a usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6358 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:19:12 +0000 (11:19 +0100)]
mips: bmips: add support for bcm6358 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agophy: add support for bcm6358 usbh phy
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:19:11 +0000 (11:19 +0100)]
phy: add support for bcm6358 usbh phy

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: bmips: add ct-5361 usb support
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:18:26 +0000 (11:18 +0100)]
mips: bmips: add ct-5361 usb support

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agomips: bmips: add support for bcm6348 usb
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:18:25 +0000 (11:18 +0100)]
mips: bmips: add support for bcm6348 usb

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
6 years agophy: add support for bcm6348 usbh phy
Álvaro Fernández Rojas [Sun, 4 Feb 2018 10:18:24 +0000 (11:18 +0100)]
phy: add support for bcm6348 usbh phy

Signed-off-by: Ã\81lvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: micronas/vct: check array bounds before access
Heinrich Schuchardt [Sun, 18 Mar 2018 22:43:43 +0000 (23:43 +0100)]
mips: micronas/vct: check array bounds before access

If we check an index against array bounds, we should do so before
accessing the array and not afterwards.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agomips: bmips: select OF_EMBED for all boards
Álvaro Fernández Rojas [Sat, 3 Feb 2018 12:42:40 +0000 (13:42 +0100)]
mips: bmips: select OF_EMBED for all boards

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
6 years agoMIPS: add BMIPS Netgear DGND3700v2 board
Álvaro Fernández Rojas [Sat, 3 Feb 2018 09:30:28 +0000 (10:30 +0100)]
MIPS: add BMIPS Netgear DGND3700v2 board

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
6 years agoMIPS: add support for Broadcom MIPS BCM6362 SoC family
Álvaro Fernández Rojas [Sat, 3 Feb 2018 09:30:27 +0000 (10:30 +0100)]
MIPS: add support for Broadcom MIPS BCM6362 SoC family

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
6 years agodm: cpu: bmips: add BCM6362 support
Álvaro Fernández Rojas [Sat, 3 Feb 2018 09:30:26 +0000 (10:30 +0100)]
dm: cpu: bmips: add BCM6362 support

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
6 years agoARC: Cache: Refactor arc_ioc_setup()
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:05 +0000 (15:59 +0300)]
ARC: Cache: Refactor arc_ioc_setup()

Move all checks before cache flush and IOC setup.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Add missing cache cleanup before cache disable
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:04 +0000 (15:59 +0300)]
ARC: Cache: Add missing cache cleanup before cache disable

Add missing cache cleanup before cache disable:
 * Flush and invalidate L1 D$ before disabling. Flush and invalidate
   SLC before L1 D$ disabling (as it will be bypassed for data)
   Otherwise we can lose some data when we disable L1 D$ if this data
   isn't flushed to next level cache. Or we can get wrong data if L1 D$
   has some entries after enable which we modified when the L1 D$ was
   disabled.
 * Invalidate L1 I$ before disabling. Otherwise we can execute wrong
   instructions after L1 I$ enable if we modified any code when
   L1 I$ was disabled.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Add more HW configuration checks
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:03 +0000 (15:59 +0300)]
ARC: Cache: Add more HW configuration checks

Add additional cache configuration checks and note about
supported configurations.

It is unlikely to face some configuration in real life but
it's better to be prepared and refuse to work on those.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Implement a function to sync and cleanup caches
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:02 +0000 (15:59 +0300)]
ARC: Implement a function to sync and cleanup caches

Implement specialized function to clenup caches (and therefore
sync instruction and data caches) which can be used for cleanup before linux
launch or to sync caches during U-Boot self-relocation.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Fix SLC operations when SLC is bypassed for data
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:01 +0000 (15:59 +0300)]
ARC: Cache: Fix SLC operations when SLC is bypassed for data

If L1 D$ is disabled SLC is bypassed for data and all
load/store requests are sent directly to main memory.

If L1 I$ is disabled SLC is NOT bypassed for instructions
and all instruction requests are fetched through SLC.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Implement [i,d]cache_enabled() as separate functions
Eugeniy Paltsev [Wed, 21 Mar 2018 12:59:00 +0000 (15:59 +0300)]
ARC: Cache: Implement [i,d]cache_enabled() as separate functions

Implement icache_enabled() and dcache_enabled() as separate functions
which can be used with "inline" attribute. This is a preparation to
make them always_inline.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Move IOC enabling to compile-time options
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:59 +0000 (15:58 +0300)]
ARC: Move IOC enabling to compile-time options

Use CONFIG_ARC_DBG_IOC_ENABLE Kconfig option instead of
ioc_enable global variable.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Move PAE exists check into slc_upper_region_init()
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:58 +0000 (15:58 +0300)]
ARC: Cache: Move PAE exists check into slc_upper_region_init()

Move check for PAE existence into slc_upper_region_init()
instead of its caller as more appropriate place.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Move cache global variables to arch_global_data
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:57 +0000 (15:58 +0300)]
ARC: Move cache global variables to arch_global_data

There is a problem with current implementation if we start U-Boot
from ROM, as we use global variables before ther initialization,
so these variables get overwritten when we copy .data section
from ROM.

Instead we move these global variables into our "global data"
structure so that we may really start from ROM.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Get rid of [slc,pae,icache,dcache]_exists global variables
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:56 +0000 (15:58 +0300)]
ARC: Cache: Get rid of [slc,pae,icache,dcache]_exists global variables

There is a problem with current implementation if we start U-Boot
from ROM, as we use global variables before ther initialization,
so these variables get overwritten when we copy .data section
from ROM.

Instead we'll use icache_exists(), dcache_exists(), slc_exists(), pae_exists()
functions which directly check BCRs every time.

In U-Boot case ops are used only during self-relocation and DMA
so we shouldn't be hit by noticeable performance degradation.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Move SLC status check into slc_entire_op() and slc_rgn_op()
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:55 +0000 (15:58 +0300)]
ARC: Cache: Move SLC status check into slc_entire_op() and slc_rgn_op()

As of today we check SLC status before each call of __slc_rgn_op()
or __slc_entire_op(). So move status check into __slc_rgn_op()
and __slc_entire_op().

As we need to check status before *each* function execution and we
call slc_entire_op() and slc_rgn_op() from different places we add
this check directly into SLC entire/line functions instead of
their callers to avoid code duplication.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Use is_isa_arcv2() instead of CONFIG_ISA_ARCV2 ifdef
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:54 +0000 (15:58 +0300)]
ARC: Cache: Use is_isa_arcv2() instead of CONFIG_ISA_ARCV2 ifdef

Use is_isa_arcv2() function where it is possible instead of
CONFIG_ISA_ARCV2 define check to make code cleaner at the same time
keeping pretty much the same functionality - code in branches
under "if (is_isa_arcv2())" won't be compiled if CONFIG_ISA_ARCV2
is not defined, still we need a couple of CONFIG_ISA_ARCV2
ifdefs to make compiler happy. That's because code in
!is_isa_x() branch gets compiled and only then gets optimized
away.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Allways check D$ status before entire/line ops
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:53 +0000 (15:58 +0300)]
ARC: Cache: Allways check D$ status before entire/line ops

As we are planning to get rid of dozens of ifdef's in cache.c we
would better check D$ status before each entire/line operation
then check CONFIG_SYS_DCACHE_OFF config option.

This makes the code cleaner as well as D$ entire/line functions
remain functional even if we enable or disable D$ in run-time.

As we need to check status before *each* function execution and we
call D$ entire/line functions from different places we add
this check directly into D$ entire/line functions instead of
their callers to avoid code duplication.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Move BCR encodings to separate header file
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:52 +0000 (15:58 +0300)]
ARC: Move BCR encodings to separate header file

We're starting to use more and more BCRs and having their
definitions in-lined in sources becomes a bit annoying
so we move it all to a separate header.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Move IOC initialization to a separate function
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:51 +0000 (15:58 +0300)]
ARC: Cache: Move IOC initialization to a separate function

Move IOC initialization from cache_init() to a separate function.

This is the preparation for the next patch where we'll switch
to is_isa_arcv2() function usage instead of "CONFIG_ISA_ARCV2"
ifdef.

Also it makes cache_init function a bit cleaner.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Flush & invalidate D$ with a single command
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:50 +0000 (15:58 +0300)]
ARC: Flush & invalidate D$ with a single command

We don't implement separate flush_dcache_all() intentionally as
entire data cache invalidation is dangerous operation even if we flush
data cache right before invalidation.

There is the real example:
We may get stuck in the following code if we store any context (like
BLINK register) on stack in invalidate_dcache_all() function.

BLINK register is the register where return address is automatically saved
when we do function call with instructions like 'bl'.

void flush_dcache_all() {
__dc_entire_op(OP_FLUSH);
// Other code //
}

void invalidate_dcache_all() {
__dc_entire_op(OP_INV);
// Other code //
}

void foo(void) {
flush_dcache_all();
invalidate_dcache_all();
}

Now let's see what really happens during that code execution:

foo()
  |->> call flush_dcache_all
   [return address is saved to BLINK register]
   [push BLINK] (save to stack)              ![point 1]
   |->> call __dc_entire_op(OP_FLUSH)
   [return address is saved to BLINK register]
   [flush L1 D$]
   return [jump to BLINK]
   <<------
   [other flush_dcache_all code]
   [pop BLINK] (get from stack)
   return [jump to BLINK]
  <<------
  |->> call invalidate_dcache_all
   [return address is saved to BLINK register]
   [push BLINK] (save to stack)               ![point 2]
   |->> call __dc_entire_op(OP_FLUSH)
   [return address is saved to BLINK register]
   [invalidate L1 D$]                 ![point 3]
   // Oops!!!
   // We lose return address from invalidate_dcache_all function:
   // we save it to stack and invalidate L1 D$ after that!
   return [jump to BLINK]
   <<------
   [other invalidate_dcache_all code]
   [pop BLINK] (get from stack)
   // we don't have this data in L1 dcache as we invalidated it in [point 3]
   // so we get it from next memory level (for example DDR memory)
   // but in the memory we have value which we save in [point 1], which
   // is return address from flush_dcache_all function (instead of
   // address from current invalidate_dcache_all function which we
   // saved in [point 2] !)
   return [jump to BLINK]
  <<------
  // As BLINK points to invalidate_dcache_all, we call it again and
  // loop forever.

Fortunately we may do flush and invalidation of D$ with a single one
instruction which automatically mitigates a situation described above.

And because invalidate_dcache_all() isn't used in common U-Boot code we
implement "flush and invalidate dcache all" instead.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Introduce is_isa_X() functions
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:49 +0000 (15:58 +0300)]
ARC: Introduce is_isa_X() functions

Introduce is_isa_arcv2() and is_isa_arcompact() functions.

These functions only check configuration options and return
compile-time constant so they can be used instead of #ifdef's to
to write cleaner code.

Now we can write:
-------------->8---------------
if (is_isa_arcv2())
ioc_configure();
-------------->8---------------
instead of:
-------------->8---------------
ifdef CONFIG_ISA_ARCV2
ioc_configure();
endif
-------------->8---------------

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Add support for FLUSH_N_INV D$ operations
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:48 +0000 (15:58 +0300)]
ARC: Cache: Add support for FLUSH_N_INV D$ operations

As of today __dc_line_op() and __dc_entire_op() support
only separate flush (OP_FLUSH) and invalidate (OP_INV) operations.

Add support of combined flush and invalidate (OP_FLUSH_N_INV)
operation which we planing to use in subsequent patches.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Remove per-line I$ operations as unused
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:47 +0000 (15:58 +0300)]
ARC: Cache: Remove per-line I$ operations as unused

__cache_line_loop() function was copied from Linux kernel
where per-line instruction cache operations are really used.

In U-Boot we use only entire I$ ops, so we can drop support of
per-line I$ ops from __cache_line_loop() because __cache_line_loop()
is never called with OP_INV_IC parameter.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Cache: Move I$ entire operation to a separate function
Eugeniy Paltsev [Wed, 21 Mar 2018 12:58:46 +0000 (15:58 +0300)]
ARC: Cache: Move I$ entire operation to a separate function

Move instruction cache entire operation to a separate function
because we are planing to use it in other places like
sync_icache_dcache_all().

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoarc: Fine-tune implementation of memory barriers
Alexey Brodkin [Wed, 21 Feb 2018 09:58:00 +0000 (12:58 +0300)]
arc: Fine-tune implementation of memory barriers

We improve on 2 things:
 1. Only ARC HS family has "dmb" instructions so do compile-time
    check for automatically defined macro __ARCHS__.
    Previous check for ARCv2 ISA was not good enough because ARC EM
    family is v2 ISA as well but still "dmb" instaruction is not
    supported in EM family.

 2. Still if there's no dedicated instruction for memory barrier
    let's at least insert compile-time barrier to make sure
    compiler deosn't reorder critical memory operations.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoarc: Introduce a possibility to not relocate U-boot
Alexey Brodkin [Wed, 16 Dec 2015 16:24:10 +0000 (19:24 +0300)]
arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
 a) For advanced debugging with Synopsys proprietary MetaWare debugger
    which is capable of accessing much more specific hardware resources
    compared to gdb. For example it may show contents of L1 and L2 caches,
    internal states of some hardware blocks etc.

    But on the downside MetaWare debugger still cannot work with PIE.
    Even though that limitation could be work-arounded with change of ELF's
    header and stripping down all debug info but with it we won't have
    debug info for source-level debugging which is quite inconvenient.

 b) Some platforms which might benefit from usage of U-Boot basically
    don't have enough RAM to accommodate relocation of U-Boot so we
    keep code in flash and use as much of RAM as possible for more
    interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>
6 years agoarc: Eliminate unused code and data with GCC's garbage collector
Alexey Brodkin [Wed, 24 Jan 2018 21:25:12 +0000 (00:25 +0300)]
arc: Eliminate unused code and data with GCC's garbage collector

Finally GCC's garbage collector works on ARC so let's use it.
That's what I may see for HSDK:

Before:
   text    data     bss     dec     hex filename
 290153   10068  222616  522837   7fa55 u-boot

After:
   text    data     bss     dec     hex filename
 261999    9460  222360  493819   788fb u-boot

Overall ~5% of memory footprint saved.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoarc: Don't halt slaves
Alexey Brodkin [Wed, 24 Jan 2018 12:27:04 +0000 (15:27 +0300)]
arc: Don't halt slaves

This commit basically reverts two commits:
 1. cf628f772ef2 ("arc: arcv1: Disable master/slave check")
 2. 6cba327bd96f ("arcv2: Halt non-master cores")

With mentioned commits in-place we experience more trouble than
benefits. In case of SMP Linux kernel this is really required as
we have all the cores running from the very beginning and then we
need to allow master core to do some preparatory work while slaves
are not getting in the way.

In case of U-Boot we:
 a) Don't really run more than 1 core in parallel
 b) We may use whatever core for that

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>