oweals/u-boot.git
7 years agoenv: fix memory leak in fw_env routines
Stefano Babic [Wed, 5 Apr 2017 16:08:03 +0000 (18:08 +0200)]
env: fix memory leak in fw_env routines

fw_env_open allocates buffers to store the environment, but these
buffers are never freed. This becomes quite nasty using the fw_ tools as
library, because each access to the environment (even just reading a
variable) generates a memory leak equal to the size of the environment.

Fix this renaming fw_env_close() as fw_env_flush(), because the function
really flushes the environment from RAM to storage, and add a
fw_env_close function to free the allocated resources.

Signed-off-by: Stefano Babic <sbabic@denx.de>
7 years agoenv: add a version number to check API
Stefano Babic [Wed, 5 Apr 2017 16:08:02 +0000 (18:08 +0200)]
env: add a version number to check API

Changes in the environment library are difficult to tracked by programs
using the library. Add simply an API version number that must be
increased each time when the API is changed.

This can be detected and a program can work with different versions of
the library.

Signed-off-by: Stefano Babic <sbabic@denx.de>
7 years agoenv: split fw_env.h in public and private parts
Stefano Babic [Wed, 5 Apr 2017 16:08:01 +0000 (18:08 +0200)]
env: split fw_env.h in public and private parts

Move U-Boot private data into a separate file. This
lets export fw_env.h to be used by external programs
that want to change the environment using the library
built in tools/env.

Signed-off-by: Stefano Babic <sbabic@denx.de>
7 years agoRename aes.h to uboot_aes.h
Stefano Babic [Wed, 5 Apr 2017 16:08:00 +0000 (18:08 +0200)]
Rename aes.h to uboot_aes.h

aes.h is a too generic name if this file can
be exported and used by a program.
Rename it to avoid any conflicts with
other files (for example, from openSSL).

Signed-off-by: Stefano Babic <sbabic@denx.de>
7 years agoARCv2: SLC: Make sure busy bit is set properly on SLC flushing
Alexey Brodkin [Wed, 5 Apr 2017 14:50:09 +0000 (17:50 +0300)]
ARCv2: SLC: Make sure busy bit is set properly on SLC flushing

As reported in STAR 9001165532, an SLC control reg read (for checking
busy state) right after SLC invalidate command may incorrectly return
NOT busy causing software to NOT spin-wait while operation is underway.
(and for some reason this only happens if L1 cache is also disabled - as
required by IOC programming model)

Suggested workaround is to do an additional Control Reg read, which
ensures the 2nd read gets the right status.

Same fix made in Linux kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c70c473396cbdec1168a6eff60e13029c0916854

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
7 years agolibfdt: fix build with Python 3
Stefan Agner [Wed, 29 Mar 2017 19:41:23 +0000 (12:41 -0700)]
libfdt: fix build with Python 3

For some reason Python 3 seems to think it does not need to build
the library. Using the --force parameter makes sure that the library
gets built always. This is especially important since we move the
library in the next step of the Makefile, hence forcing a rebuild
every time the higher level Makefile triggers a rebuild is required
to make sure the library is always there.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Bring in changes from v1.4.4
Simon Glass [Tue, 28 Mar 2017 16:23:31 +0000 (10:23 -0600)]
fdt: Bring in changes from v1.4.4

This a few minor changes down from upstream since the last sync.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Mon, 10 Apr 2017 12:07:29 +0000 (08:07 -0400)]
Merge git://git.denx.de/u-boot-x86

7 years agoMakefile: Fix linking with modern binutils
Joel Stanley [Sun, 9 Apr 2017 18:33:58 +0000 (20:33 +0200)]
Makefile: Fix linking with modern binutils

Since Binutils 1a9ccd70f9a7[1] u-boot will not link targets that set
CONFIG_SYS_TEXT_BASE=0 with the following error:

  LD      u-boot
arm-linux-gnueabi-ld.bfd: u-boot: Not enough room for program headers, try
 linking with -N
arm-linux-gnueabi-ld.bfd: final link failed: Bad value

The issue can be reproduced with the bad binutils and the rock2_defconfig
target.

This issue was also encountered by the powerpc kernel[2], with the fix
being to pass --no-dynamic-linker for linkers newer than 2.26 when this
flag was introduced. The option tells ld that the PIE or shared lib does
not need loaded program headers.

Ubuntu Zesty's Binutils 2.27.51.20161202 hits this error.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=1a9ccd70f9a7
[2] https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=ff45000fcb56b5b0f1a14a865d3541746d838a0a

Signed-off-by: Joel Stanley <joel@jms.id.au>
[AF: Apply to LDFLAGS_$(SPL_BIN) as well, suggested by Tom Rini]
Signed-off-by: Andreas Färber <afaerber@suse.de>
7 years agotravis-ci: OrangePi PC2 only links with gcc-5.x or later
Tom Rini [Sun, 9 Apr 2017 22:18:03 +0000 (18:18 -0400)]
travis-ci: OrangePi PC2 only links with gcc-5.x or later

We disable this specific board as it does not link with the gcc-4.9.x
that we use today in travis-ci.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agox86: Introduce minimal PMU driver for Intel MID platforms
Andy Shevchenko [Sat, 1 Apr 2017 13:21:34 +0000 (16:21 +0300)]
x86: Introduce minimal PMU driver for Intel MID platforms

This simple PMU driver allows to tyrn power on and off for selected
devices. In particularly Intel Tangier needs to power on SDHCI
controllers in order to access to them during board initialization.

In the future it might be expanded to cover other Intel MID platforms,
that's why it's located under arch/x86/lib and called pmu.c.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Add SCU IPC driver for Intel MID platforms
Felipe Balbi [Sat, 1 Apr 2017 13:21:33 +0000 (16:21 +0300)]
x86: Add SCU IPC driver for Intel MID platforms

Intel MID platforms have few microcontrollers inside SoC, one of them
is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoserial: Add serial driver for Intel MID
Andy Shevchenko [Tue, 28 Feb 2017 12:04:10 +0000 (14:04 +0200)]
serial: Add serial driver for Intel MID

Add a specific serial driver for Intel MID platforms.

It has special fractional divider which can be programmed via UART_PS,
UART_MUL, and UART_DIV registers.

The UART clock is calculated as

UART clock = XTAL * UART_MUL / UART_DIV

The baudrate is calculated as

baud rate = UART clock / UART_PS / DLAB

Initialize fractional divider correctly for Intel Edison platform.

For backward compatibility we have to set initial DLAB value to 16
and speed to 115200 baud, where initial frequency is 29491200Hz, and
XTAL frequency is 38.4MHz.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
7 years agotools: binman: Add missing filenames for various x86 rom tests
Bin Meng [Wed, 5 Apr 2017 04:17:14 +0000 (21:17 -0700)]
tools: binman: Add missing filenames for various x86 rom tests

With recent changes, some x86-specific rom tests of binman fail to
run. Fix it by adding missing filenames in corresponding entries.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: bootm: Fix FIT image booting on x86
Stefan Roese [Fri, 31 Mar 2017 06:09:39 +0000 (08:09 +0200)]
x86: bootm: Fix FIT image booting on x86

Checking 'is_zimage' at this time will always fail and therefore booting
a FIT style image will always lead to this error message:

"## Kernel loading failed (missing x86 kernel setup) ..."

This change now removes this check and booting of FIT images works just
fine.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agobinman: Remove hard-coded file name for x86 flash-descriptor & intel-me
Stefan Roese [Thu, 30 Mar 2017 10:58:12 +0000 (12:58 +0200)]
binman: Remove hard-coded file name for x86 flash-descriptor & intel-me

Now that we have added file names from Kconfig in x86 u-boot.dtsi,
update binman to avoid using hard-coded names.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Add file names from Kconfig in descriptor/intel-me nodes in u-boot.dtsi
Stefan Roese [Thu, 30 Mar 2017 10:58:11 +0000 (12:58 +0200)]
x86: Add file names from Kconfig in descriptor/intel-me nodes in u-boot.dtsi

Since we now have the file names configurable via Kconfig for the flash
descriptor and intel-me files, add these from Kconfig in the corresponding
dts nodes.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Kconfig: Add options to configure the descriptor.bin / me.bin filenames
Stefan Roese [Thu, 30 Mar 2017 10:58:10 +0000 (12:58 +0200)]
x86: Kconfig: Add options to configure the descriptor.bin / me.bin filenames

This introduces two Kconfig options to enable board specific filenames
for the Intel binary blobs to be used to generate the SPI flash image.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: rtc: Add 16-bit read/write support
Bin Meng [Thu, 16 Mar 2017 14:26:27 +0000 (07:26 -0700)]
dm: rtc: Add 16-bit read/write support

At present there are only 8-bit and 32-bit read/write routines in
the rtc uclass driver. This adds the 16-bit support.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Remove unused option
Andy Shevchenko [Mon, 6 Mar 2017 11:51:53 +0000 (13:51 +0200)]
x86: Remove unused option

There is option which is not used:
CONFIG_ZBOOT_32

Remove it from default x86 config and from whitelist.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodefconfigs: am57xx_hs_evm: Move OPTEE load address to avoid overlaps
Andrew F. Davis [Fri, 7 Apr 2017 15:19:35 +0000 (10:19 -0500)]
defconfigs: am57xx_hs_evm: Move OPTEE load address to avoid overlaps

Move the OPTEE load address to 0xbdb00000 in order to avoid
overlap with the memory regions used in radio and RVC usecases.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: dra7xx_hs_evm: Move OPTEE load address to avoid overlaps
Misael Lopez Cruz [Fri, 7 Apr 2017 15:19:34 +0000 (10:19 -0500)]
defconfigs: dra7xx_hs_evm: Move OPTEE load address to avoid overlaps

Move the OPTEE load address to 0xbdb00000 in order to avoid
overlap with the memory regions used in radio and RVC usecases.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am43xx_hs_evm: Add USB Host boot mode support
Andrew F. Davis [Fri, 7 Apr 2017 15:11:25 +0000 (10:11 -0500)]
defconfigs: am43xx_hs_evm: Add USB Host boot mode support

Enable SPL_USB_HOST_SUPPORT in the default defconfig to allow
booting from USB peripherals. Unlike the non-HS boards, we
already load SPL to a 0x4030_0000+ address, so no other changes
are needed.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am43xx_hs_evm: Add USB client boot mode support
Andrew F. Davis [Fri, 7 Apr 2017 15:11:24 +0000 (10:11 -0500)]
defconfigs: am43xx_hs_evm: Add USB client boot mode support

Enable CONFIG_SPL_USBETH_SUPPORT in the default defconfig to allow
booting as a USB RNDIS peripheral.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am43xx_hs_evm: Add Net boot mode support
Andrew F. Davis [Fri, 7 Apr 2017 15:11:23 +0000 (10:11 -0500)]
defconfigs: am43xx_hs_evm: Add Net boot mode support

Enable Eth/Net boot support in the default defconfig to allow
network booting.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: dra7xx_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Fri, 7 Apr 2017 15:11:22 +0000 (10:11 -0500)]
defconfigs: dra7xx_hs_evm: Sync HS and non-HS defconfigs

Additions have been made to the non-HS defconfig without the same
being made to the HS defconfig, sync them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am57xx_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Fri, 7 Apr 2017 15:11:21 +0000 (10:11 -0500)]
defconfigs: am57xx_hs_evm: Sync HS and non-HS defconfigs

Additions have been made to the non-HS defconfig without the same
being made to the HS defconfig, sync them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am43xx_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Fri, 7 Apr 2017 15:11:20 +0000 (10:11 -0500)]
defconfigs: am43xx_hs_evm: Sync HS and non-HS defconfigs

Additions have been made to the non-HS defconfig without the same
being made to the HS defconfig, sync them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfigs: am335x_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Fri, 7 Apr 2017 15:11:19 +0000 (10:11 -0500)]
defconfigs: am335x_hs_evm: Sync HS and non-HS defconfigs

Sync new additions to non-HS defconfig with HS defconfig. Also add SPL
NAND support, this was disabled before due to size constraints, enable
this now at the expense of the less used GPT partition support.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agospl: net: Add FIT image support over network boot
Andrew F. Davis [Fri, 7 Apr 2017 19:29:36 +0000 (14:29 -0500)]
spl: net: Add FIT image support over network boot

FIT support in the net boot case is much like the RAM boot case in that
we load our image to "load_addr" and pass a dummy read function into
"spl_load_simple_fit()". As the load address is no longer hard-coded to
the final execution address, legacy image loading will require load_addr
to be set correctly in the image header.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfig: k2g_hs_evm: Add k2g_hs_evm_defconfig
Andrew F. Davis [Fri, 7 Apr 2017 15:00:11 +0000 (10:00 -0500)]
defconfig: k2g_hs_evm: Add k2g_hs_evm_defconfig

TI K2G secure devices have to be built with TI_SECURE_DEVICE, FIT, and
FIT_IMAGE_POST_PROCESS enabled. Add a dedicated defconfig for this.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfig: k2hk_hs_evm: Add k2hk_hs_evm_defconfig
Andrew F. Davis [Fri, 7 Apr 2017 15:00:10 +0000 (10:00 -0500)]
defconfig: k2hk_hs_evm: Add k2hk_hs_evm_defconfig

TI K2HK secure devices have to be built with TI_SECURE_DEVICE, FIT, and
FIT_IMAGE_POST_PROCESS enabled. Add a dedicated defconfig for this.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agodefconfig: k2e_hs_evm: Add k2e_hs_evm_defconfig
Vitaly Andrianov [Fri, 7 Apr 2017 15:00:09 +0000 (10:00 -0500)]
defconfig: k2e_hs_evm: Add k2e_hs_evm_defconfig

TI K2E secure devices have to be built with TI_SECURE_DEVICE, FIT, and
FIT_IMAGE_POST_PROCESS enabled. Add a dedicated defconfig for this.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoKconfig: Adds SYS_TEXT_BASE config option for Keystone2
Madan Srinivas [Fri, 7 Apr 2017 15:00:08 +0000 (10:00 -0500)]
Kconfig: Adds SYS_TEXT_BASE config option for Keystone2

This patch makes SYS_TEXT_BASE a config option for Keystone2
so that it can be used to load u-boot at different addresses
on secure and non-secure Keystone2 devices.

Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agodoc: Updates info on using Keystone2 secure devices
Madan Srinivas [Fri, 7 Apr 2017 15:00:07 +0000 (10:00 -0500)]
doc: Updates info on using Keystone2 secure devices

Add a section describing the secure boot image used on
Keystone2 secure devices.

Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoARM: Keystone2: Build secure images for K2
Madan Srinivas [Fri, 7 Apr 2017 15:00:06 +0000 (10:00 -0500)]
ARM: Keystone2: Build secure images for K2

Adds an additional image type needed for supporting secure keystone
devices. The build generates u-boot_HS_MLO which can be used to boot
from all media on secure keystone devices.

Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoarm: mach-omap2: Add secure image name common to OMAP and keystone
Madan Srinivas [Fri, 7 Apr 2017 15:00:05 +0000 (10:00 -0500)]
arm: mach-omap2: Add secure image name common to OMAP and keystone

As K2 can directly boot U-Boot, add u-boot_HS_MLO as the secure image
name for secure K2 devices, for all boot modes other than SPI flash.

Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoarm: mach-omap2: Enable Kconfig support for K2 HS devices
Vitaly Andrianov [Fri, 7 Apr 2017 15:00:04 +0000 (10:00 -0500)]
arm: mach-omap2: Enable Kconfig support for K2 HS devices

Like the OMAP54xx, AM43xx, & AM33xx family SoCs, the keystone family
of SoCs also have high security enabled models. Allow K2E devices to
be built with HS Device Type Support.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoarm: mach-keystone: Implements FIT post-processing call for keystone SoCs
Vitaly Andrianov [Fri, 7 Apr 2017 15:00:03 +0000 (10:00 -0500)]
arm: mach-keystone: Implements FIT post-processing call for keystone SoCs

This commit implements the board_fit_image_post_process() function for
the keystone architecture. This function calls into the secure boot
monitor for secure authentication/decryption of the image. All needed
work is handled by the boot monitor and, depending on the keystone
platform, the security functions may be offloaded to other secure
processing elements in the SoC.

The boot monitor acts as the gateway to these secure functions and the
boot monitor for secure devices is available as part of the SECDEV
package for KS2. For more details refer doc/README.ti-secure

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoimage: Fixes build warning with CONFIG_FIT_IMAGE_POST_PROCESS
Madan Srinivas [Fri, 7 Apr 2017 15:00:02 +0000 (10:00 -0500)]
image: Fixes build warning with CONFIG_FIT_IMAGE_POST_PROCESS

The function 'board_fit_image_post_process' is defined only when the
config option CONFIG_FIT_IMAGE_POST_PROCESS is enabled. For secure
systems that do not use SPL but do use FIT kernel images, only
CONFIG_FIT_IMAGE_POST_PROCESS will be defined, which will result in an
implicit declaration of function 'board_fit_image_post_process' warning
while building u-boot. Fix this warning.

Signed-off-by: Madan Srinivas <madans@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoti_armv7_common: env: Change FIT image name to match build name
Andrew F. Davis [Fri, 7 Apr 2017 14:55:20 +0000 (09:55 -0500)]
ti_armv7_common: env: Change FIT image name to match build name

The most common name for a FIT image containing a bootable kernel is
"fitImage", as our builds now use this name also, change this to the
default in our U-Boot environment.

Signed-off-by: Andrew F. Davis <afd@ti.com>
7 years agomtd: nand: am335x_spl_bch: Incorporate tWB delay in nand_command function
Cooper Jr., Franklin [Thu, 6 Apr 2017 20:54:14 +0000 (15:54 -0500)]
mtd: nand: am335x_spl_bch: Incorporate tWB delay in nand_command function

Various commands to NAND flash results in the NAND flash becoming busy.
For those commands the SoC should wait until the NAND indicates it is
no longer busy before sending further commands. However, there is a delay
between the time the SoC sends its last command and when the NAND flash
sets its Ready/Busy Pin. This delay (tWB) must be respected or the SoC may
falsely assume the flash is ready when in reality it just hasn't had enough
time to indicate that it is busy.

Properly delaying by tWB is already done for nand_command/nand_command_lp
in nand_base.c including the version of it in the Linux kernel. Therefore,
this patch brings the handling of tWB delay inline to nand_base.c

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
[trini: Reformat comments slightly]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agodavinci: omapl138_lcdk: switch to using common mmc args
Sekhar Nori [Thu, 6 Apr 2017 09:22:57 +0000 (14:52 +0530)]
davinci: omapl138_lcdk: switch to using common mmc args

Now that we have common MMC/SD boot environment
variables that can be used across TI platforms,
switch OMAP-L138 LCDK to use them.

As a nice side-effect, we get support for using
uEnv.txt on this platform.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoARM: ti: consolidate mmc environment variables
Sekhar Nori [Thu, 6 Apr 2017 09:22:56 +0000 (14:52 +0530)]
ARM: ti: consolidate mmc environment variables

Introduce include/environment/ti/mmc.h that
consolidates environment variable definitions
for various TI boards that support MMC/SD.

This allows reuse of same environment variables
on non-ARMv7 TI platforms like OMAP-L138 for
example.

While at it, move DFU-related environment variable
includes to only non-SPL builds for AM335x and
AM437x since they are not really used for SPL
today.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agodavinci: omapl138_lcdk: use environment variables for memory addresses
Sekhar Nori [Thu, 6 Apr 2017 09:22:55 +0000 (14:52 +0530)]
davinci: omapl138_lcdk: use environment variables for memory addresses

Use environment variables for various memory addresses
used on OMAP-L138 LCDK board. This makes it easy to
customize the boot process.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agodavinci: omapl138_lcdk: enable some filesystem related commands
Sekhar Nori [Thu, 6 Apr 2017 09:22:54 +0000 (14:52 +0530)]
davinci: omapl138_lcdk: enable some filesystem related commands

Enable some generic filesystem commands as
well as disk partition related commands for
OMAP-L138 LCDK board.

These help in booting Linux from MMC/SD, for
example.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agodavinci: omapl138_lcdk: remove spiboot
Sekhar Nori [Thu, 6 Apr 2017 09:22:53 +0000 (14:52 +0530)]
davinci: omapl138_lcdk: remove spiboot

OMAP-L138 LCDK board does not have a SPI flash.
Remove spiboot related environment variable
definitions.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoti: clocks: Fix do_enable_clocks() to accept NULL pointers as input parameters
Lukasz Majewski [Mon, 27 Mar 2017 08:15:27 +0000 (10:15 +0200)]
ti: clocks: Fix do_enable_clocks() to accept NULL pointers as input parameters

Up till this commit passing NULL as input parameter was allowed, but not
handled properly.

When one passed NULL to one of this function parameters, the code was
executed causing data abort.

However, what is more interesting, the abort was not caught because of code
execution in HYP mode with masked CPSR A bit ("Imprecise Data Abort mask bit).
The TI's AM57xx SoC switch to HYP mode with A bit masked in lowlevel_init.S
due to SMC call. Such operation (by default) is performed in SoC ROM code.

The problem would pop up when one:
- Switch back to SVC mode after disabling LPAE support
- Somebody enables A bit (by executing cpsie a asm instruction)

and then the previously described exception would be caught.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoti: wdt: omap: Disable watchdog timer before performing initialization
Lukasz Majewski [Sun, 19 Feb 2017 22:24:38 +0000 (23:24 +0100)]
ti: wdt: omap: Disable watchdog timer before performing initialization

The OMAP WDT IP block requires to be stopped before any write to its
registers is performed.

This problem has been thoroughly described in Linux kernel:

"watchdog: omap: assert the counter being stopped before reprogramming:
SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoti: wdt: omap5: Define WDT_BASE for omap5+ SoC
Lukasz Majewski [Sun, 19 Feb 2017 22:24:37 +0000 (23:24 +0100)]
ti: wdt: omap5: Define WDT_BASE for omap5+ SoC

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoti: wdt: common: Make the wdt IP defines common for the TI platform
Lukasz Majewski [Sun, 19 Feb 2017 22:24:36 +0000 (23:24 +0100)]
ti: wdt: common: Make the wdt IP defines common for the TI platform

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoMerge branch 'master' of git://git.denx.de/u-boot-samsung
Tom Rini [Sat, 8 Apr 2017 14:20:26 +0000 (10:20 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-samsung

7 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Sat, 8 Apr 2017 13:28:02 +0000 (09:28 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

7 years agocommon/xyzModem.c: Do not use hard-coded address for debug buffer
Alexandru Gagniuc [Tue, 4 Apr 2017 17:42:31 +0000 (10:42 -0700)]
common/xyzModem.c: Do not use hard-coded address for debug buffer

Under the plethora of #ifdefs, the xyzModem code hid this pearl:
static char *zm_out = (char *) 0x00380000;
This was only enabled when DEBUG is defined, so it's probably why it
went unnoticed for so long. No idea what platform had memory at that
exact location, but the this approach is extremely hacky.
Use a static buffer instead.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
7 years agocommon/xyzModem.c: unifdef (Remove useless #ifdefs)
Alexandru Gagniuc [Tue, 4 Apr 2017 17:42:30 +0000 (10:42 -0700)]
common/xyzModem.c: unifdef (Remove useless #ifdefs)

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
7 years agospl: Kconfig: SPL_MMC_SUPPORT depends on GENERIC_MMC
Alexandru Gagniuc [Tue, 4 Apr 2017 17:02:58 +0000 (10:02 -0700)]
spl: Kconfig: SPL_MMC_SUPPORT depends on GENERIC_MMC

spl_mmc.c calls mmc_initialize(). This symbol is provided in
drivers/mmc/mmc.c when CONFIG_GENERIC_MMC is enabled.
The sunxi Kconfig case is an oddball because it redefines
SPL_MMC_SUPPORT.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>
[trini: Update arch/arm/cpu/armv8/zynqmp/Kconfig]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoarm: rmobile: Remove default value of Kconfig from defconfig
Nobuhiro Iwamatsu [Sat, 1 Apr 2017 23:17:30 +0000 (08:17 +0900)]
arm: rmobile: Remove default value of Kconfig from defconfig

This removes CONFIG_BOOTSTAGE_USER_COUNT, CONFIG_BOOTSTAGE_STASH_ADDR
and CONFIG_BOOTSTAGE_STASH_SIZE from defconfig following boards:

  - Alt
  - Gose
  - Koelsh
  - Lager
  - Porter
  - Silk
  - Stout
  - Blanche
  - Salvator-x

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agocommon, kconfig: Fix defaut value of BOOTSTAGE_STASH_SIZE
Nobuhiro Iwamatsu [Sat, 1 Apr 2017 22:48:12 +0000 (07:48 +0900)]
common, kconfig: Fix defaut value of BOOTSTAGE_STASH_SIZE

The default value of BOOTSTAGE_STASH_SIZE should be set to hexadecimal,
but an integer value is set. This fixes the BOOTSTAGE_STASH_SIZE number
from hexadecimal to integer.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agospl: armv7m: keep ARM v7M in thumb mode while jumping to entry point
Vikas Manocha [Fri, 31 Mar 2017 23:34:39 +0000 (16:34 -0700)]
spl: armv7m: keep ARM v7M in thumb mode while jumping to entry point

On ARM v7M, the processor will return to ARM mode when executing blx
instruction with bit 0 of the address == 0. Always set it to 1 to stay
in thumb mode.

Similar commit:
f99993c10882f7dc8ec35993d5febe59aac01e6a
Author: Matt Porter <mporter@konsulko.com>
Date:   Tue May 5 15:00:23 2015 -0400
common/cmd_boot: keep ARM v7M in thumb mode during do_go_exec()

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
7 years agoconfig: am335x_evm: detect BeagleBone Blue using BLA
robertcnelson@gmail.com [Thu, 30 Mar 2017 19:29:54 +0000 (14:29 -0500)]
config: am335x_evm: detect BeagleBone Blue using BLA

BeagleBone Blue is next grenation of boards from BeagleBoard.org, focusing
on robotics with a TI wl1835 wireless module for connectivity.

This board can be indentified by the BLAx value after A335BNLT (BBB)
in the at24 eeprom:
BLAx: [aa 55 33 ee 41 33 33 35  42 4e 4c 54 42 4c 41 30 |.U3.A335BNLTBLA2|]

http://beagleboard.org/blue
https://github.com/beagleboard/beaglebone-blue

firmware: https://github.com/beagleboard/beaglebone-black-wireless/tree/master/firmware
wl18xx mac address: /proc/device-tree/ocp/ethernet@4a100000/slave@4a100200/mac-address

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
CC: Tom Rini <trini@konsulko.com>
CC: Jason Kridner <jkridner@beagleboard.org>
CC: Will Newton <willn@resin.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoconfig: am335x_evm: detect Green Wireless using GW1
robertcnelson@gmail.com [Thu, 30 Mar 2017 19:29:53 +0000 (14:29 -0500)]
config: am335x_evm: detect Green Wireless using GW1

SeeedStudio BeagleBone Green Wireless (BBGW) is an expansion of the
SeeedStudio Green (BBG) with the Ethernet replaced by a TI wl1835
wireless module.

This board can be indentified by the GW1x value after A335BNLT (BBB)
in the at24 eeprom:
GW1x [aa 55 33 ee 41 33 33 35  42 4e 4c 54 47 57 31 41  |.U3.A335BNLTGW1A|]

http://beagleboard.org/green-wireless
http://wiki.seeed.cc/BeagleBone_Green_Wireless/

firmware: https://github.com/beagleboard/beaglebone-black-wireless/tree/master/firmware
wl18xx mac address: Stored in at24 eeprom at address 5-16:
hexdump -e '8/1 "%c"' /sys/bus/i2c/devices/0-0050/eeprom | cut -b 5-16

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
CC: Tom Rini <trini@konsulko.com>
CC: Jason Kridner <jkridner@beagleboard.org>
CC: Will Newton <willn@resin.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoconfig: am335x_evm: detect Black Wireless using BWA
robertcnelson@gmail.com [Thu, 30 Mar 2017 19:29:52 +0000 (14:29 -0500)]
config: am335x_evm: detect Black Wireless using BWA

BeagleBone Black Wireless is clone of the BeagleBone Black (BBB) with
the Ethernet replaced by a TI wl1835 wireless module.

This board can be indentified by the BWAx value after A335BNLT (BBB)
in the at24 eeprom:
BWAx [aa 55 33 ee 41 33 33 35  42 4e 4c 54 42 57 41 35  |.U3.A335BNLTBWA5|]

http://beagleboard.org/black-wireless
https://github.com/beagleboard/beaglebone-black-wireless

firmware: https://github.com/beagleboard/beaglebone-black-wireless/tree/master/firmware
wl18xx mac address: /proc/device-tree/ocp/ethernet@4a100000/slave@4a100200/mac-address

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
CC: Tom Rini <trini@konsulko.com>
CC: Jason Kridner <jkridner@beagleboard.org>
CC: Will Newton <willn@resin.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agostm32f7: enable instruction & data cache
Vikas Manocha [Mon, 27 Mar 2017 20:02:45 +0000 (13:02 -0700)]
stm32f7: enable instruction & data cache

It also enables commands for cache enable/disable/status.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
cc: Christophe KERELLO <christophe.kerello@st.com>

7 years agoarmv7m: add instruction & data cache support
Vikas Manocha [Mon, 27 Mar 2017 20:02:44 +0000 (13:02 -0700)]
armv7m: add instruction & data cache support

This patch adds armv7m instruction & data cache support.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
cc: Christophe KERELLO <christophe.kerello@st.com>

7 years agoRemove extra fdt_fixup_ethernet() call
Joakim Tjernlund [Thu, 23 Mar 2017 17:02:41 +0000 (18:02 +0100)]
Remove extra fdt_fixup_ethernet() call

ft_cpu_setup() already calls fdt_fixup_ethernet(), calling it
in image_setup_libfdt() is both redundant and breaks any modifications
done by ft_board_setup(). Restore the old behavior by removing
the call in image_setup_libfdt()

Fixes: 13d06981a982 ("image: Add device tree setup to image library")
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
7 years agoboard: STiH410-B2260: enable caches
Patrice Chotard [Mon, 20 Mar 2017 14:21:36 +0000 (15:21 +0100)]
board: STiH410-B2260: enable caches

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoti_armv7_common: env: Use args_mmc in FIT loading path
Andrew F. Davis [Fri, 10 Mar 2017 21:53:54 +0000 (15:53 -0600)]
ti_armv7_common: env: Use args_mmc in FIT loading path

The env command 'args_fit' does not define a root path, this forces us to
embed the rootfs into the FIT image. FIT images do not need to contain a
rootfs, when they do not the kernel will fall-back to the kernel argument
'root', if this is not defined the kernel will not boot. It is safe to
add this as when we do have the rootfs in FIT this argument is ignored.
As 'loadfit' is only called from the MMC boot path, use 'args_mmc' to
correctly populate 'bootargs'.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoApparent conflict between CONFIG_BLK and CONFIG_API
fuz@fuz.su [Tue, 7 Mar 2017 21:53:17 +0000 (22:53 +0100)]
Apparent conflict between CONFIG_BLK and CONFIG_API

Good evening,

I am trying to port FreeBSD to the ASUS Tinker Board, a computer based
on the Rockchip 3288 SoC. FreeBSD's boot loader (named loader(8)) needs
CONFIG_API to be enabled, but trying to build an U-Boot from trunk with
both CONFIG_API and CONFIG_BLK (as required for Rockchip SoC's?) leads
to the following build failure:

$ CROSS_COMPILE=arm-none-eabi- gmake tinker-rk3288_defconfig all
...
  CC      api/api_storage.o
api/api_storage.c: In function 'dev_read_stor':
api/api_storage.c:334:9: error: 'struct blk_desc' has no member named 'block_read'
  if ((dd->block_read) == NULL) {
         ^~
api/api_storage.c:339:11: error: 'struct blk_desc' has no member named 'block_read'
  return dd->block_read(dd, start, len, buf);
           ^~
api/api_storage.c:340:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
gmake[2]: *** [scripts/Makefile.build:281: api/api_storage.o] Fehler 1
gmake[1]: *** [Makefile:1229: api] Fehler 2
gmake: *** [Makefile:460: __build_one_by_one] Error 2

I applied the following fix, but the product doesn't boot. Perhaps
that's not a property of the fix though:

Yours,
Robert Clausecker

7 years agoboard: ti: am57xx: enable input on mmc clock
Sekhar Nori [Wed, 8 Feb 2017 13:13:59 +0000 (18:43 +0530)]
board: ti: am57xx: enable input on mmc clock

As per the latest pinmux data available for AM572x EVM,
rev A3, input should be enabled on MMC clock lines for
MMC2/2/3 for stable operation.

Further, AM572x TRM, SPRUHZ6, Revised June 2016, in
section 18.4.6.1.1 "Pad Configuration Registers" states
that input should be enabled for MMC 2/3/4 clock lines.

Enable input on MMC1 and MMC3 clock to match the latest
pinmux data. Input is already enabled on MMC2 clock for
BeagleBoard x15. Further, input is already enabled on all
MMCx clocks for other AM57xx boards (AM572x and AM571x
IDK).

Tested with HS and UHS SD card on AM572x EVM Rev A3.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoARM: keystone: Pass SPI MTD partition table via kernel command line
Vignesh R [Wed, 8 Mar 2017 08:28:17 +0000 (13:58 +0530)]
ARM: keystone: Pass SPI MTD partition table via kernel command line

SPI U-Boot image for K2 boards have now exceeded 512K partition
allocated to it and no longer fit the partitions defined in kernel DTS
file. Therefore, pass an updated MTD partition table from U-Boot as
kernel command line arguments to avoid kernel from accidentally
modifying boot loader image that has overflowed to next user partition.

To do is, introduce a common environment file for declaring SPI
partition so that each individual boards need not repeat the same.
Choose appropriate SPI bus from board config file and pass it as command
line argument to kernel.

Signed-off-by: Vignesh R <vigneshr@ti.com>
7 years agoARMv8: add GOT sections to the list of sections copied
Philipp Tomsich [Fri, 24 Mar 2017 18:08:55 +0000 (19:08 +0100)]
ARMv8: add GOT sections to the list of sections copied

Recent Linux distributions (e.g. Debian 9) include cross-compilers for
AArch64, but only for the aarch64-linux-gnu triplet only. It can thus
be expected that users will attempt to use the system cross-compiler
(instead of an aarch64-elf variant) to compile U-Boot for their ARMv8
target systems.

One key differences between an aarch64-linux-gnu and an aarch64-elf
compiler are the default settings regarding position-independent: with
the aarch64-linux-gnu compiler, the default will create and use the
global offset table.

This change-set adjusts the list of sections copied on ARMv8 to include
the GOT sections. With this added, the list matches the previous setup
for AArch32 closely.

Note that this is not an 'academic' issue, but was in fact encountered
by our QA during testing of the RK3399-Q7 BSP and resulted in an
early failure of the SPL stage during FDT setup.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agoenv_mmc: Allow SPL to use any MMC device to load/save the environment
Jean-Jacques Hiblot [Wed, 1 Feb 2017 10:26:53 +0000 (11:26 +0100)]
env_mmc: Allow SPL to use any MMC device to load/save the environment

SPL has been restricted to use only dev 0 based on the assumption that only
one MMC device is registered. This is not always the case and many
platforms now register several devices as expected by the spl mmc boot code
For those platform SPL_ENV_SUPPORT is broken if dev is forced to 0.

A word of warning: this commit may break SPL_ENV_SUPPORT on platforms that
do not register the same MMC controllers in SPL and in u-boot (mostly iMX6
based platforms). Fortunately none of those activate SPL_ENV_SUPPORT in
their default configuration.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agosunxi: Add defconfig for Allwinner A23 EVB
Florent Jacquet [Thu, 16 Feb 2017 10:46:42 +0000 (11:46 +0100)]
sunxi: Add defconfig for Allwinner A23 EVB

This enables the support for the Allwinner A23 Evaluation Board (EVB),
that already had a device tree (from Linux) but no defconfig.

This board has an AXP223 PMIC, some NAND, Audio out and in plugs, an
accelerometer and light sensor, as well as a USB HSIC hub and a USB
OTG mini-USB connector. It also has a Wifi/BT chip.

Access to the other buses (LCD, MIPI DSI, LVDS, etc) can be done
through dedicated pin headers.

Signed-off-by: Florent Jacquet <florent.jacquet@free-electrons.com>
Cc: Jagan Teki <jagan@openedev.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agosunxi: Add default environment size
Maxime Ripard [Mon, 20 Mar 2017 14:57:22 +0000 (15:57 +0100)]
sunxi: Add default environment size

On boards that defines ENV_IS_NOWHERE, such as the NES classic, commit
19dbe7d1a3f7 ("common: Move environment choice to Kconfig") broke the build
because of a missing environment size.

Reintroduce a default environment size consistent with what we had before.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agocmd: nand: Make the NAND options default to NAND_SUNXI
Maxime Ripard [Fri, 3 Mar 2017 14:13:30 +0000 (15:13 +0100)]
cmd: nand: Make the NAND options default to NAND_SUNXI

If we depend on the ARCH_SUNXI configuration option, the boards that do not
have NAND support enabled (with the associated options) will not compile
anymore.

Depend on the NAND driver configuration option to make sure that is not the
case.

Reported-by: Chen-Yu Tsai <wens@csie.org>
Tested-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agocmd: ubifs: Add a dependency on CMD_UBI
Maxime Ripard [Fri, 3 Mar 2017 13:53:22 +0000 (14:53 +0100)]
cmd: ubifs: Add a dependency on CMD_UBI

CMD_UBIFS can't compile without CMD_UBI enabled. Make sure we can't end up
in that case.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Heiko Schocher <hs@denx.de>
7 years agosunxi: Add boards/sunxi and arch/arm/mach-sunxi to sunxi MAINTAINERS entry
Chen-Yu Tsai [Wed, 1 Mar 2017 06:03:34 +0000 (14:03 +0800)]
sunxi: Add boards/sunxi and arch/arm/mach-sunxi to sunxi MAINTAINERS entry

Recently some sunxi related code was moved to arch/arm/mach-sunxi, but
the MAINTAINERS entry was not updated to reflect this. Add this, and
the board level boards/sunxi directory to our entry.

While at it, also update its status, to reflect the current active
maintainership.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agoarm: sunxi: Add Sunchip CX-A99 initial support
Rask Ingemann Lambertsen [Sat, 25 Feb 2017 13:21:54 +0000 (14:21 +0100)]
arm: sunxi: Add Sunchip CX-A99 initial support

The Sunchip CX-A99 is a board used in some media players. It features:

An Allwinner A80 ARM SoC (4 * Cortex-A7 + 4 * Cortex-A15 cores)
2 GiB or 4 GiB DDR3 DRAM
AXP808 PMIC
16 GB or 32 GB eMMC
SDIO Wifi/Bluetooth/FM module
SD card slot
1 USB 3.0 connector
2 USB 2.0 connectors
SATA connector
UART connector (internally) for serial console
Ethernet connector (10/100/1000 Mbit/s)
HDMI connector
Composite video and analog audio connector
S/PDIF connector
IR remote control receiver

This patch adds a defconfig for the board. The DRAM settings are as found
in the vendor sys_config.fex file.

It has a preliminary device tree for use until a device tree is accepted
upstream, after which it can be replaced by the upstream version.

Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
[squash commits, and edited new meanful commit message]
Signed-off-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agoARM: dts: sun9i: Add mmc1 pinmux setting
Chen-Yu Tsai [Sat, 25 Feb 2017 13:19:54 +0000 (14:19 +0100)]
ARM: dts: sun9i: Add mmc1 pinmux setting

commit 56b0730157f70dc23d6caff9e7ceb8b377b96b9f upstream.

On the A80, mmc1 is available on pingroup G. Designs mostly use this
to connect to an SDIO WiFi chip.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Rask Ingemann Lambertsen <rask@formelder.dk>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: Add support for the CHIP Pro
Maxime Ripard [Mon, 27 Feb 2017 17:22:15 +0000 (18:22 +0100)]
sunxi: Add support for the CHIP Pro

The CHIP Pro is a SoM that features the GR8 SIP, an AXP209, a BT/WiFi chip
and a 512MiB SLC NAND.

This it's an SLC NAND, it doesn't suffer the same drawbacks than found on
the MLC NANDs, and we can enable it right away.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: Sync GR8 DTS and AXP209 with the kernel
Maxime Ripard [Mon, 27 Feb 2017 17:22:14 +0000 (18:22 +0100)]
sunxi: Sync GR8 DTS and AXP209 with the kernel

Those DT will be part of 4.10, sync them so we can have our own config.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jagan Teki <jagan@openedev.com>
7 years agoscripts: sunxi: Build an raw SPL image
Maxime Ripard [Mon, 27 Feb 2017 17:22:13 +0000 (18:22 +0100)]
scripts: sunxi: Build an raw SPL image

Introduce a new sunxi-spl-with-ecc.bin image with already the right header,
ECC, randomizer and padding for the BROM to be able to read it.

It needs to be flashed using a raw access to the NAND so that the
controller doesn't change a thing to it, since we already have all the
right parameters.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 years agonand: sunxi: Add options for the SPL NAND configuration
Maxime Ripard [Mon, 27 Feb 2017 17:22:12 +0000 (18:22 +0100)]
nand: sunxi: Add options for the SPL NAND configuration

The SPL image needs to be built with a different ECC configuration than the
U-Boot binary.

Add Kconfig options with defaults to provide a value that should work for
anyone, but is still configurable if needs be.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Scott Wood <oss@buserror.net>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: Add the default mtdids and mtdparts to our env
Maxime Ripard [Mon, 27 Feb 2017 17:22:11 +0000 (18:22 +0100)]
sunxi: Add the default mtdids and mtdparts to our env

In order for the user to be able to see and modify them, add those
variables to the default environment.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: Enable UBI and NAND support
Hans de Goede [Mon, 27 Feb 2017 17:22:10 +0000 (18:22 +0100)]
sunxi: Enable UBI and NAND support

Enable the NAND and UBI support in the configuration header so that we can
(finally) use it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
7 years agomtd: sunxi: Change U-Boot offset
Maxime Ripard [Mon, 27 Feb 2017 17:22:09 +0000 (18:22 +0100)]
mtd: sunxi: Change U-Boot offset

The default U-Boot offset for the Allwinner SoCs was set to 32kB.

This was probably to try to maintain some compatibility with the current
image that we build for the MMC where the U-Boot binary is also located at
a 32kB offset.

However, this causes a number of issues. The first one is that it prevents
us from using a backup SPL entirely, which is troublesome in case where the
first would be corrupt (especially on MLC which have a higher number of
bitflips).

We also cannot use the original MMC image on the NAND, because we need to
prepare the SPL image to include the ECCs and randomizer settings, which
reduces the interest of setting it at that particular offset.

It also prevents us from upgrading and flashing the U-Boot and SPLs
independantly, since it's very likely that it will fall in the same erase
block.

Since that default wasn't used by any board, change it for 8MB, which will
be in an erase block of its own, all the erase blocks being multiple of
two. The highest erase block size we encountered is 4MB, which means that
in this particular setup, the first and second erase blocks will be for the
SPL and its backup, and the third for U-Boot.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agomtd: sunxi: Select the U-Boot location config option
Maxime Ripard [Mon, 27 Feb 2017 17:22:08 +0000 (18:22 +0100)]
mtd: sunxi: Select the U-Boot location config option

We'll need that symbol so that the default offset are defined

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agocmd: nand: Expose optional suboptions in Kconfig
Boris Brezillon [Mon, 27 Feb 2017 17:22:07 +0000 (18:22 +0100)]
cmd: nand: Expose optional suboptions in Kconfig

Sometime we need to enable advanced suboptions of the nand command set.
Expose these suboptions in Kconfig.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agocmd: Expose a Kconfig option to enable UBIFS commands
Boris Brezillon [Mon, 27 Feb 2017 17:22:06 +0000 (18:22 +0100)]
cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
7 years agomtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry
Boris Brezillon [Mon, 27 Feb 2017 17:22:05 +0000 (18:22 +0100)]
mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>
7 years agocmd: Add Kconfig option for CMD_MTDPARTS and related options
Maxime Ripard [Mon, 27 Feb 2017 17:22:04 +0000 (18:22 +0100)]
cmd: Add Kconfig option for CMD_MTDPARTS and related options

CMD_MTDPARTS is something the user might or might not want to select, and
might depends on (or be selected by) other options too.

This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT options that
might change from one board to another, or from one user to the other,
depending on what it expects and what storage devices are available.

In order to ease that configuration, add those options to Kconfig.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agocommon: Move environment choice to Kconfig
Maxime Ripard [Mon, 27 Feb 2017 17:22:03 +0000 (18:22 +0100)]
common: Move environment choice to Kconfig

The environment location is something that might change per board
(depending on what storage options are availaible there) or depending on
the user choice (when we have several options).

Instead of hardcoding it in our configuration header, create a Kconfig
choice with the options we use for now, and the symbols that depend on it.

Once done, also remove the irrelevant sunxi defines.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agotools: sunxi: Add spl image builder
Maxime Ripard [Mon, 27 Feb 2017 17:22:02 +0000 (18:22 +0100)]
tools: sunxi: Add spl image builder

This program generates raw SPL images that can be flashed on the NAND with
the ECC and randomizer properly set up.

This has been copied (and tweaked to find the right headers) from the
sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream
repository, commit 1c3a6ca5.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agobch: Allow to build for the host
Maxime Ripard [Mon, 27 Feb 2017 17:22:01 +0000 (18:22 +0100)]
bch: Allow to build for the host

We will need the bch functions in the tool to generate the SPL images for
the Allwinner SoCs.

Do the needed adjustments so that we can use it on the host.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agonand: sunxi: Fix modulo by zero error
Maxime Ripard [Mon, 27 Feb 2017 17:22:00 +0000 (18:22 +0100)]
nand: sunxi: Fix modulo by zero error

When trying to autodetect the ECC and randomization configurations, the
driver starts with a randomization disabled and no seeds.

In this case, the number of seeds is obviously 0, and the randomize boolean
is set to false.

However, the logic that retrieves the seed for a given page offset will
blindly use the number of seeds, without testing if the randomization is
enabled, basically doing a modulo by 0.

As it turns out, the libgcc in the common toolchain returns 0 here, which
was our expected value in such a case, and why we would not detect it.
However, U-Boot's libgcc will for some reason return from the function
instead, resulting in an error to load the U-Boot binary in the SPL.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Scott Wood <oss@buserror.net>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosunxi: add NanoPi NEO Air defconfig
Jelle van der Waa [Sun, 12 Feb 2017 15:21:40 +0000 (16:21 +0100)]
sunxi: add NanoPi NEO Air defconfig

Add support for the NanoPi NEO Air H3 board from friendlyarm.com . This
board contains WiFi, Bluetooth, 8GB eMMC storage and 512 MB DDR3 ram.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
[Rebase on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agosun8i_emac: configure PHY reset GPIO via DM
Philipp Tomsich [Wed, 22 Feb 2017 18:46:41 +0000 (19:46 +0100)]
sun8i_emac: configure PHY reset GPIO via DM

This ports the support for configuring a GPIO for resetting the
Ethernet PHY (incl. such details as the reset polarity and
pulse-length) from the Designware driver.

X-AffectedPlatforms: A64-uQ7
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
7 years agoboard: samsung: trats2: remove the board_power_init() function
Jaehoon Chung [Mon, 3 Apr 2017 10:02:58 +0000 (19:02 +0900)]
board: samsung: trats2: remove the board_power_init() function

Remove the board_power_init() function.
It will be initialized with device-tree.
In future, it will be controlled with regulator API.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
7 years agoconfigs: trats2: enable the configuration relevant to PMIC
Jaehoon Chung [Mon, 3 Apr 2017 10:02:57 +0000 (19:02 +0900)]
configs: trats2: enable the configuration relevant to PMIC

Enable CONFIG_DM_I2C, CONFIG_DM_PMIC_MAX77686 and
CONFIG_SYS_I2C_S3C24X0.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
7 years agoboard: samsung: trats2: remove the unused functions
Jaehoon Chung [Mon, 3 Apr 2017 10:02:56 +0000 (19:02 +0900)]
board: samsung: trats2: remove the unused functions

Remove the unused functions.
Never call the get_soft_i2c_scl/sda_pin() aynwhere.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>