platform/kernel/u-boot.git
6 years agostm32mp: cleanup cpu.c
Patrick Delaunay [Mon, 19 Mar 2018 18:09:20 +0000 (19:09 +0100)]
stm32mp: cleanup cpu.c

Move all defines at the beginning of the file

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agotools/mxsimage: Support building with LibreSSL
Hauke Mehrtens [Sun, 18 Mar 2018 15:03:47 +0000 (16:03 +0100)]
tools/mxsimage: Support building with LibreSSL

The mxsimage utility fails to compile against LibreSSL version < 2.7.0
because LibreSSL says it is OpenSSL 2.0, but it does not support the
complete OpenSSL 1.1 interface.

LibreSSL defines OPENSSL_VERSION_NUMBER with 0x20000000L and therefor
claims to have an API compatible with OpenSSL 2.0, but it implements
EVP_MD_CTX_new(), EVP_MD_CTX_free() and EVP_CIPHER_CTX_reset() only
starting with version 2.7.0, which is not yet released. OpenSSL
implements this function since version 1.1.0.

This commit will activate the compatibility code meant for
OpenSSL < 1.1.0 also for LibreSSL version < 2.7.0.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Jonathan Gray <jsg@jsg.id.au>
6 years agoregulator: pbias: don't evaluate variable before assignment
Heinrich Schuchardt [Sun, 18 Mar 2018 11:01:06 +0000 (12:01 +0100)]
regulator: pbias: don't evaluate variable before assignment

We should not evaluate the value of reg before its value is set.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoomap3_logic: Fix FDT ADDR for ramdisk booting
Adam Ford [Mon, 26 Mar 2018 15:24:12 +0000 (10:24 -0500)]
omap3_logic: Fix FDT ADDR for ramdisk booting

The boot scripts for booting from ramdisk are using
${fdtimage} when they really should be using ${fdtaddr}

This patch will fix it so the RAMdisk bootscripts operate
correctly.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoinput: Drop PS/2 keyboard support
Simon Glass [Mon, 19 Mar 2018 21:20:25 +0000 (15:20 -0600)]
input: Drop PS/2 keyboard support

This is not used by any current board and has not been converted to driver
model. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofs: btrfs: Remove unused debug code left from development
Marek BehĂșn [Mon, 19 Mar 2018 11:02:11 +0000 (12:02 +0100)]
fs: btrfs: Remove unused debug code left from development

Signed-off-by: Marek Behun <marek.behun@nic.cz>
6 years agoARM: am33xx: Inhibit re-initialization of DDR during RTC-only
Russ Dill [Tue, 20 Mar 2018 06:53:00 +0000 (12:23 +0530)]
ARM: am33xx: Inhibit re-initialization of DDR during RTC-only

This inhibits the re-inititialization of DDR during an RTC-only resume. If
this is not done, an L3 NOC error is produced as the DDR gets accessed
before the re-init has time to complete. Tested on AM437x GP EVM.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
[j-keerthy@ti.com Ported to Latest Master branch]
Signed-off-by: Keerthy <j-keerthy@ti.com>
6 years agoam43xx: Do not allow EMIF to control DDR_RESET in rtconly config
Dave Gerlach [Sat, 17 Mar 2018 07:54:30 +0000 (13:24 +0530)]
am43xx: Do not allow EMIF to control DDR_RESET in rtconly config

Prevent EMIF control of DDR_RESET line on DDR3 am43xx platforms for
am43xx_evm_rtconly_config. Without this DDR is unstable and can become
corrupted after multiple iterations of RTC+DDR mode.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
[j-keerthy@ti.com Ported to latest master branch]
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoARM: AM43xx: Add support for RTC only + DDR in self-refresh mode
Tero Kristo [Sat, 17 Mar 2018 08:02:52 +0000 (13:32 +0530)]
ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers
for wakeup from RTC-only mode with DDR in self-refresh. Parse these
registers during SPL boot and jump to the kernel resume vector if the
device is waking up from RTC-only modewith DDR in Self-refresh.

The RTC scratch register layout used is:

SCRATCH0 : bits00-31 : kernel resume address
SCRATCH1 : bits00-15 : RTC magic value used to detect valid config
SCRATCH1 : bits16-31 : board type information populated by bootloader

During the normal boot path the SCRATCH1 : bits16-31 are updated with
the eeprom read board type data. In the rtc_only boot path the rtc
scratchpad register is read and the board type is determined and
correspondingly ddr dpll parameters are set. This is done so as to avoid
costly i2c read to eeprom.

RTC-only +DRR in self-refresh mode support is currently only enabled for
am43xx_evm_rtconly_config.
This is not to be used with epos evm builds.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
[j-keerthy@ti.com Rebased to latest u-boot master branch]
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agodrivers: serial: remove nonexisting initialisation functions
Christophe Leroy [Fri, 16 Mar 2018 15:55:02 +0000 (16:55 +0100)]
drivers: serial: remove nonexisting initialisation functions

This patch removes call of serial initialisation functions that
are not implemented anymore.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agoam335x: am335x_evm_usbspl_defconfig: NETCONSOLE
Jason Kridner [Wed, 7 Mar 2018 10:40:44 +0000 (05:40 -0500)]
am335x: am335x_evm_usbspl_defconfig: NETCONSOLE

Enable NETCONSOLE by default. Still requires changes to the boot
environment to enable on the platform.

Signed-of-by: Jason Kridner <jdk@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoHandle NETCONSOLE and SPL enabled
Jason Kridner [Wed, 7 Mar 2018 10:40:43 +0000 (05:40 -0500)]
Handle NETCONSOLE and SPL enabled

NETCONSOLE isn't compiled in with SPL, so the include file needs to recognize that.

Signed-off-by: Jason Kridner <jdk@ti.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoAdd support for BeagleBoard.org PocketBeagle
Jason Kridner [Wed, 7 Mar 2018 10:40:41 +0000 (05:40 -0500)]
Add support for BeagleBoard.org PocketBeagle

Texas Instruments AM3358 based low-cost board using Octavo Systems OSD3358 SIP
with built-in TPS65217 PMIC and 512MB DDR3. Board features small 35mm x
55mm size, high-speed USB OTG, microSD and 72 0.1" expansion header
pins with 2xSPI, 2xI2C, 2xUART, USB, 8xADC, up-to-44 GPIO, PRU pins and much more.

https://beagleboard.org/pocket

This was tested using the am335x_evm_usbspl_defconfig.

Note that MII pins are enabled despite not having Ethernet on this
board. This avoids an issue where otherwise many timeout errors would be
generated. See https://e2e.ti.com/support/arm/sitara_arm/f/791/t/298976
for some related discussion.

Signed-off-by: Jason Kridner <jdk@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoMigrate CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
Alex Kiernan [Thu, 15 Mar 2018 22:11:46 +0000 (22:11 +0000)]
Migrate CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC

This converts CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC to Kconfig

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agopowerpc: mpc8xx: move watchdog into drivers/watchdog
Christophe Leroy [Fri, 16 Mar 2018 16:21:01 +0000 (17:21 +0100)]
powerpc: mpc8xx: move watchdog into drivers/watchdog

In preparation of DM watchdog, move basic actions into drivers/watchdog

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: cleaning up watchdog
Christophe Leroy [Fri, 16 Mar 2018 16:20:59 +0000 (17:20 +0100)]
powerpc: mpc8xx: cleaning up watchdog

In preparation of migration to DM watchdog, clean up a bit.

The 8xx watchdog really is a HW watchdog, so declare it as is
then it goes through Kconfig

And the watchdog reset doesn't mind getting interrupted, so
no need to disable interrupts

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: refactorise reginfo
Christophe Leroy [Fri, 16 Mar 2018 16:20:57 +0000 (17:20 +0100)]
powerpc: mpc8xx: refactorise reginfo

reginfo is redundant with some of the commands in immap.c, so
move reginfo into that file and remove duplicated info.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agoboard: MCR3000: Use smaller flash sector for environment
Christophe Leroy [Fri, 16 Mar 2018 16:20:55 +0000 (17:20 +0100)]
board: MCR3000: Use smaller flash sector for environment

Latest versions of u-boot have increased in size and require more
than the 256kb allocated to it.

The MCR3000 board is equipped with an AM29LV160DB boot flash which
is organised as follows:
- One 16kb block
- Two 8kb block
- One 32kb block
- Thirty one 64kb blocks

At the time being, u-boot is a single piece occupying the 256 first
kbytes, then the environment is stored in the following 64kb block

The environment being quite tiny, we save one 64kb block by embedding
the environment in the first 8kb block, hence allowing to increase
the monitor size to 320kb.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agocommon: env_embedded: allow fine placement of environment object
Christophe Leroy [Fri, 16 Mar 2018 16:20:53 +0000 (17:20 +0100)]
common: env_embedded: allow fine placement of environment object

Commit 7653942b10e9e ("common/env_embedded.c: drop support for
CONFIG_SYS_USE_PPCENV") dropped the .ppcenv section which was
used in linking scripts to allow fine placement of embedded
environment sections.

This implies that GCC randomly places objects from env/embedded.o
and environment is not guaranteed to be located at the correct address:

04003df8 g     F .text  00000038 mii_init
04004000 g     O .text  00000004 env_size
04004004 g     O .text  00002000 environment
04006004 g     F .text  00000040 .hidden __lshrdi3

This patch restores this capability by allocating each object marked
with __UBOOT_ENV_SECTION__ into a different section. Hence
'environment' will be alone in .text.environment, allowing a
fine placement in u-boot.lds with:

. = DEFINED(env_offset) ? env_offset : .;
env/embedded.o (.text.environment)

Fixes: 7653942b10e9e ("common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV")
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agoboard: MCR3000: cleanup config
Christophe Leroy [Fri, 16 Mar 2018 16:20:51 +0000 (17:20 +0100)]
board: MCR3000: cleanup config

Some config is redundant with Kconfig. Fix it.
Also remove unused configs
Move SDRAM_MAX_SIZE in the only place it is used

include/environment.h already defines CONFIG_ENV_SIZE
from CONFIG_ENV_SECT_SIZE and defines CONFIG_ENV_ADDR as
(CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)

remove BOOTARGS as bootargs is set by the different boot commands

Fix CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE to be in
line with CPM DPRAM organisation

Remove CONFIG_SYS_GBL_DATA_SIZE, CONFIG_SYS_GBL_DATA_OFFSET and
CONFIG_SYS_INIT_SP_OFFSET which are unused

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agoboard: MCR3000: replace mtd->priv by mtd_to_nand()
Christophe Leroy [Fri, 16 Mar 2018 16:20:49 +0000 (17:20 +0100)]
board: MCR3000: replace mtd->priv by mtd_to_nand()

Since commit 17cb4b8f327eb ("mtd: nand: Add+use mtd_to/from_nand and
nand_get/set_controller_data"), mtd_to_nand() has to be used instead
of mtd->priv

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: initialisation of initial RAM
Christophe Leroy [Fri, 16 Mar 2018 16:20:47 +0000 (17:20 +0100)]
powerpc: mpc8xx: initialisation of initial RAM

u-boot requires some RAM at startup, to store global data structure.
RAM is also needed when we migrate to DM for some initial malloc

This patch implements the proper init of that RAM by calling
board_init_f_alloc_reserve() and board_init_f_init_reserve()

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: redistribute data in CPM dpram
Christophe Leroy [Fri, 16 Mar 2018 16:20:45 +0000 (17:20 +0100)]
powerpc: mpc8xx: redistribute data in CPM dpram

Some malloc memory is needed at startup for DM model.
Lets reorganise the use of the CPM dpram.

The MPC866/885 dpram, we have 8kbytes dual port RAM, which is usable as:
IMMR + 0x2000..0x2800: BD/Data/Microcode
IMMR + 0x2800..0x2e00: BD/Data
IMMR + 0x2e00..0x3800: BD/Data/Microcode
IMMR + 0x3800..0x3a00: BD/Data
IMMR + 0x3a00..0x3c00: BD/Data/Microcode
IMMR + 0x3c00..0x4000: Parameters for the Peripheral Controllers

Lets reallocate all BDs in the 3800..3a00 area and give the full
2800..2e00 for dynamic RAM allocation including global data

That way, the microcode areas remain available if needed one day.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowercp: mpc8xx: move commproc.h
Christophe Leroy [Fri, 16 Mar 2018 16:20:43 +0000 (17:20 +0100)]
powercp: mpc8xx: move commproc.h

include/commproc.h is dedicated to the 8xx, rename it cpm_8xx.h and
move it into arch/powerpc/include/asm

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx
Christophe Leroy [Fri, 16 Mar 2018 16:20:41 +0000 (17:20 +0100)]
powerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx

CONFIG_8xx doesn't mean much outside of arch/powerpc/
This patch renames it CONFIG_MPC8xx just like CONFIG_MPC85xx etc ...
It also renames 8xx_immap.h to immap_8xx.h to be consistent with
other file names.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: remove get_immr() argument
Christophe Leroy [Fri, 16 Mar 2018 16:20:39 +0000 (17:20 +0100)]
powerpc: mpc8xx: remove get_immr() argument

get_immr() is always called with 0 as an argument, so it is useless.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: make get_immr() independent of CONFIG_8xx
Christophe Leroy [Fri, 16 Mar 2018 16:20:37 +0000 (17:20 +0100)]
powerpc: mpc8xx: make get_immr() independent of CONFIG_8xx

SPRN_IMMR is defined regardless of the CPU. Therefore, there
is no point in enclosing get_immr() inside a #ifdef CONFIG_8xx

As it a static inline function, it will in any case only be
compiled in functons using it.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: get rid of the multiple PVR_ values
Christophe Leroy [Fri, 16 Mar 2018 16:20:35 +0000 (17:20 +0100)]
powerpc: mpc8xx: get rid of the multiple PVR_ values

Avoid hardcoding the PVR values in C since they are defined
in processor.h

At the same time, remove those multiple PVR values for 8xx and
keep only one that we call PVR_8xx

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agopowerpc: mpc8xx: harmonise initialisation of the immap local pointer
Christophe Leroy [Fri, 16 Mar 2018 16:20:33 +0000 (17:20 +0100)]
powerpc: mpc8xx: harmonise initialisation of the immap local pointer

In most places, immap local pointer is defined as
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
In a few places, it is defined as
immap_t __iomem *immap = (immap_t __iomem *)(immr & 0xFFFF0000);

This patch replaces the few of the latest form by the other one.

The two are fully equivalent since SPRN_IMMR is set with CONFIG_SYS_IMMR
very early in start.S

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agosoft_i2c: cleanup - no mpc8xx support
Christophe Leroy [Fri, 16 Mar 2018 16:20:31 +0000 (17:20 +0100)]
soft_i2c: cleanup - no mpc8xx support

commit 907208c452999 ("powerpc: Partialy restore core of mpc8xx")
didn't bring back support for I2C on the mpc8xx

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
6 years agospi: atmel: default y if DM_SPI && ARCH_AT91
Jagan Teki [Wed, 14 Mar 2018 13:16:44 +0000 (18:46 +0530)]
spi: atmel: default y if DM_SPI && ARCH_AT91

ATMEL_SPI is now fully converted to driver-model and
respective boards switch to DM_SPI as well,
so make default y for ARCH_AT91

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Wenyou Yang <wenyouya@gmail.com>
6 years agospi: atmel: Drop atmel_spi.h
Jagan Teki [Wed, 14 Mar 2018 13:16:43 +0000 (18:46 +0530)]
spi: atmel: Drop atmel_spi.h

atmel_spi.h has register offsets, and atmel_spi_slave
structure, move it into .c file for better readability
and drop atmel_spi.h

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Wenyou Yang <wenyouya@gmail.com>
6 years agospi: atmel: Drop non-dm code
Jagan Teki [Wed, 14 Mar 2018 13:16:42 +0000 (18:46 +0530)]
spi: atmel: Drop non-dm code

All board configs are now enabled DM_SPI for SPL and
U-Boot proper, so now its time to drop non-dm code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Wenyou Yang <wenyouya@gmail.com>
6 years agoat91: ma5d4evk: Enable SPL_DM and SPL_OF_CONTROL
Jagan Teki [Wed, 14 Mar 2018 13:16:41 +0000 (18:46 +0530)]
at91: ma5d4evk: Enable SPL_DM and SPL_OF_CONTROL

Enable SPL Driver model and FDT support for AT91 ma5d4evk boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: ma5d4evk: Enable DM_SPI
Jagan Teki [Wed, 14 Mar 2018 13:16:40 +0000 (18:46 +0530)]
at91: ma5d4evk: Enable DM_SPI

AT91 ma5d4evk board uses atmel spi driver, enable DM_SPI to
use dm functionality.

Kept few functions related to non-dm and gpio on board
files for reference and will be remove once code moved
to relevant drivers.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: ma5d4evk: Add FDT support
Jagan Teki [Wed, 14 Mar 2018 13:16:39 +0000 (18:46 +0530)]
at91: ma5d4evk: Add FDT support

Sync DTS from Linux and add FDT support for AT91 ma5d4evk board.

usb0, usb1, usb2 and hlcdc_pwm nodes removed, since there is no support it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: ma5d4evk: Enable DM
Jagan Teki [Wed, 14 Mar 2018 13:16:38 +0000 (18:46 +0530)]
at91: ma5d4evk: Enable DM

Enable Driver model for AT91 ma5d4evk boards.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: vinco: Enable DM_SPI
Jagan Teki [Wed, 14 Mar 2018 13:16:37 +0000 (18:46 +0530)]
at91: vinco: Enable DM_SPI

AT91 Vinco board uses atmel spi driver, enable DM_SPI to
use dm functionality.

Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: vinco: Add FDT support
Jagan Teki [Wed, 14 Mar 2018 13:16:36 +0000 (18:46 +0530)]
at91: vinco: Add FDT support

Sync DTS from Linux and add FDT support for AT91 vinco board.

usb0, usb1, and usb2 nodes removed, since there is no support it.

Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: vinco: Enable DM
Jagan Teki [Wed, 14 Mar 2018 13:16:35 +0000 (18:46 +0530)]
at91: vinco: Enable DM

Enable Driver model for AT91 Vinco boards.

Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoat91: taurus: Enable DM_SPI
Jagan Teki [Wed, 14 Mar 2018 13:16:34 +0000 (18:46 +0530)]
at91: taurus: Enable DM_SPI

Enable DM_SPI for atmel SPI driver on taurus board.

Kept few functions related to non-dm and gpio on board
files for reference and will be remove once code moved
to relevant drivers.

Cc: Heiko Schocher <hs@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoconfigs: gurnard: Move CONFIG_ATMEL_SPI to defconfigs
Jagan Teki [Wed, 14 Mar 2018 13:16:33 +0000 (18:46 +0530)]
configs: gurnard: Move CONFIG_ATMEL_SPI to defconfigs

Now CONFIG_ATMEL_SPI is defined in Kconfig, so move the
same into defconfig file.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Wenyou Yang <wenyouya@gmail.com>
6 years agoat91: gurnard: Enable DM_SPI
Jagan Teki [Wed, 14 Mar 2018 13:16:32 +0000 (18:46 +0530)]
at91: gurnard: Enable DM_SPI

Enable DM_SPI for atmel SPI driver on gurnard board.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agospi: atmel: Add ifdef for DM_GPIO code
Jagan Teki [Wed, 14 Mar 2018 13:16:31 +0000 (18:46 +0530)]
spi: atmel: Add ifdef for DM_GPIO code

Few boards are configuring gpio directly from board instead
using drivers/gpio so add ifdef for DM_GPIO to compatible
for both the cases.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Wenyou Yang <wenyouya@gmail.com>
6 years agoMerge tag 'signed-rpi-next' of git://github.com/agraf/u-boot
Tom Rini [Fri, 6 Apr 2018 12:30:10 +0000 (08:30 -0400)]
Merge tag 'signed-rpi-next' of git://github.com/agraf/u-boot

Patch queue for rpi - 2018-04-06

Highlights this time around:

  - Support for new RPi3 B+ model
  - Fix for some SD cards on newer RPi firmware

6 years agorpi: Complete table of models with new revision code scheme
Jonathan Gray [Fri, 6 Apr 2018 08:45:49 +0000 (18:45 +1000)]
rpi: Complete table of models with new revision code scheme

In the model table for the new revision code encoding documented in
https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
add the entries for old models with the new scheme and add CM3 which
only appears in the new scheme.

A device tree for CM3 is not currently upstreamed in linux.  When that
happens the name will likely have to be adjusted in the table.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agommc: use core clock frequency in bcm2835 sdhost
Jonathan Gray [Sat, 17 Mar 2018 05:15:48 +0000 (16:15 +1100)]
mmc: use core clock frequency in bcm2835 sdhost

In raspberrypi-firmware 7fdcd00e00a42a1c91e8bd6f5eb8352fe9358557 and
later start.elf now sets the EMMC clock to 200 MHz.

According to Phil Elwell in
https://github.com/raspberrypi/firmware/issues/953
the SDHost controller shares the core/VPU clock and doesn't use
the EMMC clock.

Use the core clock id when determining the frequency to allow
U-Boot to work with recent versions of raspberrypi-firmware.
Otherwise U-Boot hangs at:

U-Boot 2018.03 (Mar 14 2018 - 20:36:00 +1100)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT...

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agorpi3_32b: Enable lan78xx driver
Peter Robinson [Fri, 16 Mar 2018 06:26:29 +0000 (06:26 +0000)]
rpi3_32b: Enable lan78xx driver

The new Raspberry Pi B 3+ has a lan78xx device attached to it. Let's add
driver support in U-Boot for it.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agorpi: Add identifier for the new RPi3 B+
Alexander Graf [Thu, 15 Mar 2018 14:05:37 +0000 (15:05 +0100)]
rpi: Add identifier for the new RPi3 B+

The Raspberr Pi Foundation released a new RPi3 version which we want
to detect as well, so we can enable ethernet on it and know the correct
device tree file name.

Add an identifier for it.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agorpi3: Enable lan78xx driver
Alexander Graf [Thu, 15 Mar 2018 14:05:36 +0000 (15:05 +0100)]
rpi3: Enable lan78xx driver

The new Raspberry Pi B 3+ has a lan78xx device attached to it. Let's add
driver support in U-Boot for it.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agorpi: Allow to boot without serial
Alexander Graf [Thu, 5 Apr 2018 09:36:22 +0000 (11:36 +0200)]
rpi: Allow to boot without serial

When we enable CONFIG_OF_BOARD on Raspberry Pis, we may end up without
serial console support in early boot. Hence we need to make the serial
port optional, otherwise we will never get to the point where serial
would be probed.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Wed, 4 Apr 2018 13:18:38 +0000 (09:18 -0400)]
Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoRevert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"
Andre Przywara [Wed, 4 Apr 2018 00:31:23 +0000 (01:31 +0100)]
Revert "sunxi: Pine64: temporarily remove extra Pine64 non-plus DT"

Now with the MMC environment gone, we have enough space to accommodate
the Pine64 "non-plus" .dtb again.

This reverts commit 47952b8e42c2790150e16d3d4235b3a1ee0ba9bb.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: revert disabling of features
Andre Przywara [Wed, 4 Apr 2018 00:31:22 +0000 (01:31 +0100)]
sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: disable direct MMC environment
Andre Przywara [Wed, 4 Apr 2018 00:31:21 +0000 (01:31 +0100)]
sunxi: disable direct MMC environment

Since the dawn of time for the Allwinner support in mainline U-Boot
we store the environment to the SD card and write directly at
544KB from the beginning of the device. This leads to problems when
the U-Boot proper image grows beyond 504KB and eventually overlaps.
With one release of having the environment preferably in a FAT
partition, let's now turn off the MMC variant fallback, so we get back
all the space we need to implement features.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agonet: sun8i-emac: remove support for old binding
Andre Przywara [Wed, 4 Apr 2018 00:31:20 +0000 (01:31 +0100)]
net: sun8i-emac: remove support for old binding

The original DT binding used by U-Boot's sun8i-emac driver was not really
agreed upon, and deviated from the "official" binding now used by the
kernel. Since now all U-Boot users have been converted to the new
binding, we can remove support for the old DT nodes from the driver.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoarm: dts: sunxi: update H5 to new EMAC binding
Andre Przywara [Wed, 4 Apr 2018 00:31:19 +0000 (01:31 +0100)]
arm: dts: sunxi: update H5 to new EMAC binding

The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used by the
OrangePi PC2 over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoarm: dts: sunxi: update H3 to new EMAC binding
Andre Przywara [Wed, 4 Apr 2018 00:31:18 +0000 (01:31 +0100)]
arm: dts: sunxi: update H3 to new EMAC binding

The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used by the
various H3 boards over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoarm: dts: sunxi: update A64 to new EMAC binding
Andre Przywara [Wed, 4 Apr 2018 00:31:17 +0000 (01:31 +0100)]
arm: dts: sunxi: update A64 to new EMAC binding

The U-Boot driver for the sun8i-emac was using some preliminary DT
binding. Now since Linux got its own driver in v4.15 and our driver
can now cope with both bindings, let's convert the DT nodes used for the
Pine64+ board over to the new bindings used by the kernel.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agonet: sun8i-emac: add support for new EMAC DT binding
Andre Przywara [Wed, 4 Apr 2018 00:31:16 +0000 (01:31 +0100)]
net: sun8i-emac: add support for new EMAC DT binding

The Ethernet MAC used in newer Allwinner SoCs (H3, A64, H5) got an
upstream Linux driver in v4.15.
This one uses a slightly different binding from the original one used
by the U-Boot driver.
The differences to the old binding are:
- The "syscon" address is held in a separate node, referenced via a
  phandle in the "syscon" property.
- The reference to the PHY is held in a property called "phy-handle",
  not "phy".
- The PHY register is at offset 0x30 in the syscon device, not at 0.
- The internal PHY is activated when the node, which phy-handle points
  to, is a child node of an "allwinner,sun8i-h3-mdio-internal" node.

Teach the U-Boot driver how to find its resources in a "new-style" DT,
so that we can use a Linux kernel compatible DT for U-Boot as well.
This keeps support for the old binding for now, to allow a smooth
transition.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agonet: sun8i-emac: support new pinctrl DT bindings
Andre Przywara [Wed, 4 Apr 2018 00:31:15 +0000 (01:31 +0100)]
net: sun8i-emac: support new pinctrl DT bindings

The Linux kernel driver for the Allwinner pin controller gained support
for generic properties, which are now also used in the DTs.
The sun8i-emac Ethernet driver for new Allwinner MACs reads the pins from
the DT, but so far only supported the old binding.
Update the parsing routine to cope with both the old and new bindings,
so that the newer DTs can be used with U-Boot and its Ethernet driver.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: gpio: add missing compatible strings
Andre Przywara [Wed, 4 Apr 2018 00:31:14 +0000 (01:31 +0100)]
sunxi: gpio: add missing compatible strings

The sunxi GPIO driver is missing some compatible strings for recent
SoCs. While most of the sunxi GPIO code seems to not rely on this (and
so works anyway), the sunxi_name_to_gpio() function does and fails at
the moment (for instance when resolving the MMC CD pin name).
Add the compatible strings for the A64 and V3s, which were missing
from the list. This now covers all pinctrl nodes in our own DTs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: README.sunxi64: Add hint about non-debug of ARM Trusted Firmware
Andre Przywara [Wed, 4 Apr 2018 00:31:13 +0000 (01:31 +0100)]
sunxi: README.sunxi64: Add hint about non-debug of ARM Trusted Firmware

As we are running into issues where the final U-Boot FIT image file is
exceeding our size limit, add a hint to the README.sunxi64 file
to point out the possibility of building non-debug versions of the ATF
binary. These are about 12KB smaller than the standard debug build, and
so allow successful U-Boot builds for many boards with the Allwinner H5
SoC.
Please note that under normal circumstances the debug build is still
recommended, as it gives valuable clues in case something goes wrong in
the ATF.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoMakefile: Disable stack-usage check for ARC
Alexey Brodkin [Mon, 2 Apr 2018 09:18:02 +0000 (12:18 +0300)]
Makefile: Disable stack-usage check for ARC

With the most recent tools for ARC (arc-2017.09) in case of
"naked" function compiler throws a warning:
---------------------------------->8-----------------------------
board/synopsys/hsdk/hsdk.c: In function 'hsdk_core_init_f':
board/synopsys/hsdk/hsdk.c:345:1: warning: stack usage computation not supported for this target
 }
 ^
---------------------------------->8-----------------------------

That happens because the compiler doesn't handle "naked" functions
as a special case where stack calculation shouldn't be done.

But for now until this is fixed in GCC to get clean buildman output
we're disabling stack-usage check for ARC.

See https://lists.denx.de/pipermail/u-boot/2018-April/324455.html
for more background.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Tom Rini <trini@konsulko.com>
6 years agoMerge tag 'arc-for-2018.05' of git://git.denx.de/u-boot-arc
Tom Rini [Tue, 3 Apr 2018 12:33:15 +0000 (08:33 -0400)]
Merge tag 'arc-for-2018.05' of git://git.denx.de/u-boot-arc

More ARC changes and fixes for v2018.05

 * Update of ARC tools to the most recent arc-2017.09
 * Fix for compile-time warning for AXS10x
 * Add support of platform-specific commands for HSDK
 * Add support for on-board SPI flash on HSDK
   Note though that for write support another series [1]
   is required. I hope that Jagan will be able to review and
   act on SPI flash improvement series before we get beyond RC1.

   Also note that to get clean build for HSDK we need to disable
   stack-usage check [2] as our current GCC erroneously tries to calculate
   stack-usage on a naked function which leads to warning.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=35796
[2] https://patchwork.ozlabs.org/patch/894139/

6 years agoconfigs: add NAND support for NES Classic
Miquel Raynal [Wed, 28 Feb 2018 19:52:02 +0000 (20:52 +0100)]
configs: add NAND support for NES Classic

Add NAND parameters to the Nintendo NES Classic configuration file which
features a Macronix NAND flash chip with 128kiB blocks of 2kiB pages
plus 64 OOB bytes.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: move the NAND parameters to Kconfig
Miquel Raynal [Wed, 28 Feb 2018 19:52:01 +0000 (20:52 +0100)]
sunxi: move the NAND parameters to Kconfig

Move the NAND parameters from defconfig files to Kconfig for SUNXI
architecture only. Fort now only the CHIP pro is migrated.

It would have been better to convert this defconfig entry to Kconfig for
all supported machines/architectures but it has been abandoned due to a
fairly high amount of errors reported by the moveconfig.py tool. This is
due to defines quite often being multiplications of values/other defines
not correctly handled.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig
Miquel Raynal [Wed, 28 Feb 2018 19:52:00 +0000 (20:52 +0100)]
sunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig

Remove NAND_SUNXI from the CHIP pro defconfig to be automatically
selected depending on the state of ARCH_SUNXI.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: automatically select SPL_NAND_SUPPORT in Kconfig
Miquel Raynal [Wed, 28 Feb 2018 19:51:59 +0000 (20:51 +0100)]
sunxi: automatically select SPL_NAND_SUPPORT in Kconfig

Make SUNXI_NAND select SPL_NAND_SUPPORT in Kconfig, this limit the
number of entries to add in defconfig files when adding NAND support.

For now, the only board using it is the CHIP pro.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: dts: enable NAND on NES classic
Miquel Raynal [Wed, 28 Feb 2018 19:51:58 +0000 (20:51 +0100)]
sunxi: dts: enable NAND on NES classic

Let the Nintendo NES Classic use the Macronix NAND chip on it.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: allow NAND support to be compiled for sun8i platforms
Miquel Raynal [Wed, 28 Feb 2018 19:51:57 +0000 (20:51 +0100)]
sunxi: allow NAND support to be compiled for sun8i platforms

Add some clocks/PLL definitions as well as the dependency on MACH_SUN8I
in Kconfig.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: spl: remove DMA related settings of the NAND controller
Miquel Raynal [Wed, 28 Feb 2018 19:51:56 +0000 (20:51 +0100)]
sunxi: spl: remove DMA related settings of the NAND controller

Code has been changed to do not use DMA anymore with the NAND
controller, instead PIO is used. Then, DMA-specific initialization may
be dropped.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: use PIO instead of DMA
Miquel Raynal [Wed, 28 Feb 2018 19:51:55 +0000 (20:51 +0100)]
spl: nand: sunxi: use PIO instead of DMA

SPL support was first written to support only the earlier generations of
Allwinner SoCs, and was only really enabled on the A13 / GR8. However,
those old SoCs had a DMA engine that has been replaced since the A31 by
another DMA controller that is no longer compatible.

Since the code directly uses that DMA controller, it cannot operate
properly on the later SoCs, while the NAND controller has not changed.

There's two paths forward, the first one would have been to add support
for that DMA controller too, the second to just remove the DMA usage
entirely and rely on PIO.

The later has been chosen because CPU overload at this stage is not an
issue and it makes the driver more generic, and easier to understand.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: declare the ecc_bytes array globally
Miquel Raynal [Wed, 28 Feb 2018 19:51:54 +0000 (20:51 +0100)]
spl: nand: sunxi: declare the ecc_bytes array globally

Move the ecc_bytes array out of nand_max_ecc_strength() for future use
by nand_read_page().

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agosunxi: spl: deassert the NAND controller reset line
Miquel Raynal [Wed, 28 Feb 2018 19:51:53 +0000 (20:51 +0100)]
sunxi: spl: deassert the NAND controller reset line

Ensure the NAND controller reset line is deasserted before use.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: make the reset column helper more generic
Miquel Raynal [Wed, 28 Feb 2018 19:51:52 +0000 (20:51 +0100)]
spl: nand: sunxi: make the reset column helper more generic

Prepare the future use of an helper to move the data pointer (the
column) of the NAND chip by renaming nand_reset_column() to
nand_change_column(). Resetting the column is just a matter of giving 0
as argument.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: ensure enough time has passed after changing the column
Miquel Raynal [Wed, 28 Feb 2018 19:51:51 +0000 (20:51 +0100)]
spl: nand: sunxi: ensure enough time has passed after changing the column

When changing the column, the ONFI specification states that a minimum
time of tCCS (Change Column Setup time) must elapse between the last
address cycle is asserted on the bus and the first data cycle is
clocked. An usual value for average NANDs is 500 nanoseconds. Round it
up to 1 microsecond to be safe.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: create an helper to handle command execution
Miquel Raynal [Wed, 28 Feb 2018 19:51:50 +0000 (20:51 +0100)]
spl: nand: sunxi: create an helper to handle command execution

Executing a command is matter of always doing the following sequence:
  * Waiting for the FIFO to be empty so we can fill it with the new
    command.
  * Clearing the status register.
  * Writing the command in the FIFO.
  * Waiting for the command to finish.

Add a nand_exec_cmd() helper to handle this instead of repeating the
logic through the various functions.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: add missing status clear
Miquel Raynal [Wed, 28 Feb 2018 19:51:49 +0000 (20:51 +0100)]
spl: nand: sunxi: add missing status clear

It is best practice to always clear the status register before executing
a command to be sure that the status read afterwards is relevant.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper
Miquel Raynal [Wed, 28 Feb 2018 19:51:48 +0000 (20:51 +0100)]
spl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper

One bit in the control registers indicates if the NAND controller is
ready to receive a new command. Otherwise, the command FIFO is full and
we should wait for this bit to flip. It then states that the last
command has been processed and the FIFO is now free to welcome another
command.

Add this sanity check before starting any new command.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: introduce the nand_wait_int() helper
Miquel Raynal [Wed, 28 Feb 2018 19:51:47 +0000 (20:51 +0100)]
spl: nand: sunxi: introduce the nand_wait_int() helper

The pattern of polling on a status register until a bit is set or a
timeout occurs is repeated multiple times in the driver. Mutualize the
code by introducing the nand_wait_int() helper that does wait for the
bit to flip or returns an error in case of timeout.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: fix typo on register name
Miquel Raynal [Wed, 28 Feb 2018 19:51:46 +0000 (20:51 +0100)]
spl: nand: sunxi: fix typo on register name

Change NFC_SEND_ADR to NFC_SEND_ADDR.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: nand: sunxi: fix second case of modulo by zero error
Miquel Raynal [Wed, 28 Feb 2018 19:51:45 +0000 (20:51 +0100)]
spl: nand: sunxi: fix second case of modulo by zero error

In the nand_read_buffer() step, the seed is calculated by doing a modulo
by conf->nseeds which is always zero when not using the randomizer (most
of SLC NANDs).

This situation turns out to lead to a run time freeze with certain
toolchains.

Derive this seed only when the randomizer is enabled (and conf->nseeds
logically not zero), exactly like what has been done before with an
identical situation, see commit ea3f750c73e3 ("nand: sunxi: Fix modulo
by zero error").

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agomtd: nand: sunxi: fix ECC strength choice
Miquel Raynal [Wed, 28 Feb 2018 19:51:44 +0000 (20:51 +0100)]
mtd: nand: sunxi: fix ECC strength choice

When the requested ECC strength does not exactly match the strengths
supported by the ECC engine, the driver is selecting the closest
strength meeting the 'selected_strength > requested_strength'
constraint. Fix the fact that, in this particular case, ecc->strength
value was not updated to match the 'selected_strength'.

For instance, one can encounter this issue when no ECC requirement is
filled in the device tree while the NAND chip minimum requirement is not
a strength/step_size combo natively supported by the ECC engine.

Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agospl: fix binman_sym output check
Miquel Raynal [Wed, 28 Feb 2018 19:51:43 +0000 (20:51 +0100)]
spl: fix binman_sym output check

A previous commit introduced the use of binman in the SPL.

After the binman_sym call over the 'pos' symbol, the output value is
checked against BINMAN_SYM_MISSING (-1UL). According to the
documentation (tools/binman/README), when it comes to the 'pos'
attribute:

pos:
This sets the position of an entry within the image. The first
byte of the image is normally at position 0. If 'pos' is not
provided, binman sets it to the end of the previous region, or
the start of the image's entry area (normally 0) if there is no
previous region.

So instead of checking if the return value is BINMAN_SYM_MISSING, we
should also check if the value is not null.

The failure happens when using both the SPL file and the U-Boot file
independently instead of the concatenated file (SPL + padding + U-Boot).
This is because the U-Boot binary file alone does not have the U-Boot
header while it is present in the concatenation file. Not having the
header forces the SPL to discover where it should load U-Boot. The
binman_sym call is supposed to do that but fails. Because of the wrong
check, the destination address was set to 0 while it should have been
somewhere in RAM. This, obviously, stalls the board.

Fixes: 8bee2d251afb ("binman: Add binman symbol support to SPL")
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
6 years agoPrepare v2018.05-rc1 v2018.05-rc1
Tom Rini [Tue, 3 Apr 2018 00:31:36 +0000 (20:31 -0400)]
Prepare v2018.05-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoARC: HSDK: Enable SPI flash support
Eugeniy Paltsev [Mon, 26 Mar 2018 12:57:38 +0000 (15:57 +0300)]
ARC: HSDK: Enable SPI flash support

HSDK board has sst26wf016 SPI flash IC which we want to support.

Add SPI controller, CS-gpio and SPI flash nodes to hsdk device tree.
Enable corresponding options in hsdk defconfig.

For SPI write functionality to work we need [1] which
adds support of sst26xxx ICs.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=35796

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: HSDK: Add platform-specific commands
Eugeniy Paltsev [Mon, 26 Mar 2018 12:57:37 +0000 (15:57 +0300)]
ARC: HSDK: Add platform-specific commands

This patch add support of hsdk platform-specific commands:

hsdk_clock set - set clock from axi_freq, cpu_freq and tun_freq
environment variables/command line arguments

hsdk_clock get - save clock frequencies to axi_freq, cpu_freq
and tun_freq environment variables

hsdk_clock print - show CPU, AXI, DDR and TUNNEL current
clock frequencies.

hsdk_clock print_all - show all currently used clock frequencies.

hsdk_init - setup board HW in one of pre-defined configuration
(hsdk_hs34 / hsdk_hs36 / hsdk_hs36_ccm / hsdk_hs38 /
hsdk_hs38_ccm / hsdk_hs38x2 / hsdk_hs38x3 / hsdk_hs38x4)

hsdk_go - run baremetal application on hsdk configured
by hsdk_init command.

This patch changes default behaviour of 'bootm' command:
now we are able to set number of CPUs to be kicked by setting
'core_mask' environment variable before 'bootm' command run.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: Bump ARC tools used in TravisCI to the most recent release arc-2017.09
Alexey Brodkin [Fri, 30 Mar 2018 13:34:55 +0000 (16:34 +0300)]
ARC: Bump ARC tools used in TravisCI to the most recent release arc-2017.09

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: AXS10x: DTS: Remove unused interrupt properties
Eugeniy Paltsev [Tue, 23 Jan 2018 14:03:15 +0000 (17:03 +0300)]
ARC: AXS10x: DTS: Remove unused interrupt properties

Some device tree nodes (like ethernet, ohci, ehci) in axs10x_mb.dtsi
were copied from linux device tree, so they have interrupts properties.
As we don't use interrupts in uboot we don't have interrupt controller
node in AXS10x device tree. In result we get warnings when we compile
such device tree.

So remove unused interrupts properties to get rid of this warnings.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Mon, 2 Apr 2018 00:36:39 +0000 (20:36 -0400)]
Merge git://git.denx.de/u-boot-dm

6 years agoimage.h: add forward declaration of struct fdt_region
Masahiro Yamada [Wed, 21 Mar 2018 09:03:35 +0000 (18:03 +0900)]
image.h: add forward declaration of struct fdt_region

This header needs to know 'fdt_region' is a struct for the
fit_region_make_list() prototype.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofdt_region: remove unneeded fdt_internal.h inclusion
Masahiro Yamada [Wed, 21 Mar 2018 09:03:34 +0000 (18:03 +0900)]
fdt_region: remove unneeded fdt_internal.h inclusion

fdt_region.c does not depend on anything in libfdt_internal.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agolibfdt: move FDT_RAMDISK_OVERHEAD to image-fdt.c
Masahiro Yamada [Wed, 21 Mar 2018 09:03:33 +0000 (18:03 +0900)]
libfdt: move FDT_RAMDISK_OVERHEAD to image-fdt.c

This macro is locally referenced in common/image-fdt.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocore: ofnode: Fix translation for #size-cells == 0
Mario Six [Mon, 12 Mar 2018 13:53:33 +0000 (14:53 +0100)]
core: ofnode: Fix translation for #size-cells == 0

Commit 286ede6 ("drivers: core: Add translation in live tree case") made
dev_get_addr always use proper bus translations for addresses read from
the device tree. But this leads to problems with certain busses, e.g.
I2C busses, which run into an error during translation, and hence stop
working.

It turns out that of_translate_address() and fdt_translate_address()
stop the address translation with an error when they're asked to
translate addresses for busses where #size-cells == 0 (comment from
drivers/core/of_addr.c):

 * Note: We consider that crossing any level with #size-cells == 0 to mean
 * that translation is impossible (that is we are not dealing with a value
 * that can be mapped to a cpu physical address). This is not really specified
 * that way, but this is traditionally the way IBM at least do things

To fix this case, we check in both the live-tree and non-live tree-case,
whether the bus of the device whose address is about to be translated
has size-cell size zero. If this is the case, we just read the address
as a plain integer and return it, and only apply bus translations if the
size-cell size if greater than zero.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Reported-by: Martin Fuzzey <mfuzzey@parkeon.com>
Fixes: 286ede6 ("drivers: core: Add translation in live tree case")
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: make fixed-clock dt scan live dt compatible
Andy Yan [Thu, 1 Mar 2018 06:08:15 +0000 (14:08 +0800)]
dm: core: make fixed-clock dt scan live dt compatible

dm_scan_fdt_node can't work when live dt is active,
we should use dm_scan_fdt_live instead.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofs: cbfs: fix locating the cbfs header
Andre Heider [Thu, 15 Feb 2018 06:40:11 +0000 (07:40 +0100)]
fs: cbfs: fix locating the cbfs header

The value at the end of the rom is not a pointer, it is an offset
relative to the end of rom.

Signed-off-by: Andre Heider <a.heider@gmail.com>
6 years agocmd: cbfs: fix reading the end_of_rom pointer for 64bit archs
Andre Heider [Thu, 15 Feb 2018 06:40:10 +0000 (07:40 +0100)]
cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs

The cast breaks the pointer on 64bit archs, so lets get rid of it.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
6 years agopinctrl-uclass: convert to use live dt
Kever Yang [Fri, 9 Feb 2018 02:56:24 +0000 (10:56 +0800)]
pinctrl-uclass: convert to use live dt

Use live dt interface for pinctrl_select_state_full()

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agocore: add uclass_get_device_by_phandle_id() api
Kever Yang [Fri, 9 Feb 2018 02:56:23 +0000 (10:56 +0800)]
core: add uclass_get_device_by_phandle_id() api

Add api for who can not get phandle from a device property.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>