oweals/u-boot.git
4 years agoriscv: ax25-ae350: Use generic memory size setup
Rick Chen [Thu, 14 Nov 2019 05:52:23 +0000 (13:52 +0800)]
riscv: ax25-ae350: Use generic memory size setup

To get memory size from device tree instead of
get_ram_size(). This can avoid memory access fault
in U-Boot proper after PMP configurations in OpenSBI.

Signed-off-by: Rick Chen <rick@andestech.com>
Cc: KC Lin <kclin@andestech.com>
Cc: Alan Kao <alankao@andestech.com>
4 years agoriscv: ax25-ae350: add SPL configuration
Rick Chen [Thu, 14 Nov 2019 05:52:22 +0000 (13:52 +0800)]
riscv: ax25-ae350: add SPL configuration

This patch provides four configurations which can support U-Boot SPL
to boot from RAM or FLASH and then boot FIT image including OpenSBI
FW_DYNAMIC firmware and U-Boot proper images from RAM or MMC boot devices.

With ae350_rv[32|64]_spl_defconfigs:

U-Boot SPL will be loaded by gdb or FSBL and runs in RAM in machine mode
and then load FIT image from RAM device on AE350.

With ae350_rv[32|64]_spl_xip_defconfigs:

U-Boot SPL can be burned into SPI flash and run in flash in machine mode
and then load FIT image from SPI flash or MMC device on AE350.

Signed-off-by: Rick Chen <rick@andestech.com>
Cc: KC Lin <kclin@andestech.com>
Cc: Alan Kao <alankao@andestech.com>
4 years agoriscv: ax25: add SPL support
Rick Chen [Thu, 14 Nov 2019 05:52:21 +0000 (13:52 +0800)]
riscv: ax25: add SPL support

The U-Boot SPL will boot in M mode and load the FIT image which
include OpenSBI and U-Boot proper images. After loading progress,
it will jump to OpenSBI first and then U-Boot proper which will
run in S mode.

Also remove V5L2_CACHE due to U-Boot SPL code size consideration.
Without this concern, it can be enable manually for performance.

Signed-off-by: Rick Chen <rick@andestech.com>
Cc: KC Lin <kclin@andestech.com>
Cc: Alan Kao <alankao@andestech.com>
4 years agoUse dts support from U-Boot via OF_SEPARATE instead of depending from opensbi.
Rick Chen [Wed, 4 Dec 2019 06:52:46 +0000 (14:52 +0800)]
Use dts support from U-Boot via OF_SEPARATE instead of depending from opensbi.

This would help to make the necessary changes in drivers and device trees
in U-Boot tree itself. This feature would also be helpful to not pass
dtb during opensbi builds.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Rick Chen <rick@andestech.com>
4 years agoriscv: dts: Add hifive-unleashed-a00 dts from Linux
Jagan Teki [Mon, 18 Nov 2019 11:29:40 +0000 (16:59 +0530)]
riscv: dts: Add hifive-unleashed-a00 dts from Linux

Sync the hifive-unleashed-a00 dts from Linux with
below commit details:

commit <2993c9b04e616df0848b655d7202a707a70fc876> ("riscv: dts: HiFive
Unleashed: add default chosen/stdout-path")

Idea is to periodically sync the dts from Linux instead of
tweaking internal changes one after another, so better not
add any intermediate changes in between. This would help to
maintain the dts files easy and meaningful since we are
reusing device tree files from Linux.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
4 years agoriscv: increase stack size to avoid a stack overflow during distro boot
Lukas Auer [Sun, 20 Oct 2019 18:53:47 +0000 (20:53 +0200)]
riscv: increase stack size to avoid a stack overflow during distro boot

This fixes a problem, where booting Linux using distro boot will
sometimes lead to an invalid instruction exception on the main hart. The
secondary harts are not affected and boot Linux successfully. The root
cause of this problem is a stack overflow on the main hart.

With distro boot, the current default stack size of 8KiB on RISC-V is
not sufficient and will cause a stack overflow. The stacks are allocated
sequentially. In the case of a stack overflow the stack of the main hart
can reach into that of another hart and be corrupted.

The stack overflow previously did not cause any problems, because only
stack frames, which are not used anymore since the hart enters Linux,
were corrupted. Starting with GCC 9, the stack usage has decreased. Now,
only the most recent stack frame overflows into the stack of a secondary
hart and is corrupted. The illegal instruction exception is caused by
the secondary hart overwriting the return address in the stack frame of
the main hart with an address that does not include valid code.

Increase the default stack size of each hart to 16KiB to avoid this
problem.

Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoarm: -march=armv5t for ARM11
Heinrich Schuchardt [Sat, 7 Dec 2019 08:14:50 +0000 (09:14 +0100)]
arm: -march=armv5t for ARM11

In GCC 9 support for the Armv5 and Armv5E architectures (which have no
known implementations) has been removed, cf.
https://gcc.gnu.org/gcc-9/changes.html

Commit 16540d07fd62 ("arm: fix -march for ARM11") changed the value of the
compiler flag from -march=armv5 and -march=armv5t into -march=armv6 for
ARM11.

The values prior to this patch were:

    arch-$(CONFIG_CPU_ARM1136)     =-march=armv5
    arch-$(CONFIG_CPU_ARM1176)     =-march=armv5t

The change lead to a regression with the Raspberry Pi Zero W not booting
anymore.

Use -march=armv5t both for ARM1136 and ARM1176.

Fixes: 16540d07fd62 ("arm: fix -march for ARM11")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Joris Offouga <offougajoris@gmail.com>
4 years agolinux/types.h: fix typo unchar
Heinrich Schuchardt [Sat, 7 Dec 2019 23:22:01 +0000 (00:22 +0100)]
linux/types.h: fix typo unchar

unsigned char should be called uchar and not unchar.

This fixes a build error in lib/crypto/x509_cert_parser.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge tag 'u-boot-imx-20191209' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 9 Dec 2019 15:32:08 +0000 (10:32 -0500)]
Merge tag 'u-boot-imx-20191209' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

Fixes for 2020.01
-----------------

- imx8qxp_mek: increase buffer sizes and args number
- Fixes for imx7ulp
- imx8mm: Fix the first root clock in imx8mm_ahb_sels[]
- colibri_imx7: reserve DDR memory for Cortex-M4
- vining2000: fixes and convert to ethernet DM
- imx8m: fix rom version check to unbreak some B0 chips
- tbs2910: Disable VxWorks image booting support

4 years agoimx8m: fix rom version check to unbreak some B0 chips
Patrick Wildt [Tue, 19 Nov 2019 08:42:06 +0000 (09:42 +0100)]
imx8m: fix rom version check to unbreak some B0 chips

Recently the version check was improved to be able to determine that
we're running on SoC revision 2.1.  A check for B0 was tightened so
that it now must equal 0x20 instead of being bigger than 0x20.  On
some B0 chips the value returned is 0x1020 instead of 0x20.  This
means even though it's B0, the check will fail and code relying on
the correct chip revision will make wrong decisions.  There is no
documentation of those bits, but it seems that NXP always uses a
byte to encode the revision.  Thus remove the upper bits to fix the
regression.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Sun, 8 Dec 2019 15:51:00 +0000 (10:51 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- 16-bit start up codes clean up

4 years agox86: simplify ljmp to 32-bit code
Masahiro Yamada [Tue, 3 Dec 2019 05:28:58 +0000 (14:28 +0900)]
x86: simplify ljmp to 32-bit code

You can directly specify the label as the operand for ljmp.

This commit saves 4-byte code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fixed the gas warning]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: use data32 directive instead of macro for operand-size prefix
Masahiro Yamada [Tue, 3 Dec 2019 05:20:49 +0000 (14:20 +0900)]
x86: use data32 directive instead of macro for operand-size prefix

This file defines 'a32' and 'o32' macros to avoid magic numbers
of operand/address-size prefixing.

GAS supports 'data32' and 'addr32' for that purpose.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge branch '2019-12-06-master-imports'
Tom Rini [Fri, 6 Dec 2019 21:45:46 +0000 (16:45 -0500)]
Merge branch '2019-12-06-master-imports'

- Allow for the sysboot command, which is used to parse extlinux.conf
  files to be used without PXE support.  There is no functional change
  here aside from fixing distro boot in a few cases where we actually
  lacked the ability to parse the extlinux.conf file
- Add the x509/pkcs7 parsers from Linux, a pre-requisite to EFI Secure
  Boot support.

4 years agoMakefile: Ensure tools directory exists in output prior to use
Tom Rini [Wed, 4 Dec 2019 23:54:30 +0000 (18:54 -0500)]
Makefile: Ensure tools directory exists in output prior to use

With the change to make tools/version.h a file we need to make sure that
the output directory exists first otherwise we will get a build failure.

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Fixes: 4d90f6cd9813 ("tools: Avoid creating symbolic links for tools/version.h")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: add asn1 unit test
AKASHI Takahiro [Wed, 13 Nov 2019 00:45:02 +0000 (09:45 +0900)]
test: add asn1 unit test

This test will exercise asn1 compiler as well as asn1 decoder functions
via various parsers.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: crypto: add pkcs7 message parser
AKASHI Takahiro [Wed, 13 Nov 2019 00:45:01 +0000 (09:45 +0900)]
lib: crypto: add pkcs7 message parser

Imported from linux kernel v5.3:
 pkcs7.asn1 without changes
 pkcs7.h with changes marked as __UBOOT__
 pkcs7_parser.h without changes
 pkcs7_parser.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: crypto: add x509 parser
AKASHI Takahiro [Wed, 13 Nov 2019 00:45:00 +0000 (09:45 +0900)]
lib: crypto: add x509 parser

Imported from linux kernel v5.3:
 x509.asn1 without changes
 x509_akid.asn1 without changes
 x509_parser.h without changes
 x509_cert_parser.c with changes marked as __UBOOT__
 x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: crypto: add rsa public key parser
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:59 +0000 (09:44 +0900)]
lib: crypto: add rsa public key parser

Imported from linux kernel v5.3:
rsapubkey.asn1 without changes
rsa.h without changes
rsa_helper.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: crypto: add public key utility
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:58 +0000 (09:44 +0900)]
lib: crypto: add public key utility

Imported from linux kernel v5.3:
 asymmetric-type.h with changes marked as __UBOOT__
 asymmetric_type.c with changes marked as __UBOOT__
 public_key.h with changes marked as __UBOOT__
 public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: add oid registry utility
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:57 +0000 (09:44 +0900)]
lib: add oid registry utility

Imported from linux kernel v5.3:
 build_OID_registry without changes
 oid_registry.h without changes
 oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agodoc: add README for asn1 compiler and decoder
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:56 +0000 (09:44 +0900)]
doc: add README for asn1 compiler and decoder

This document gives a brief description about ASN1 compiler as well as
ASN1 decoder.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: add asn1 decoder
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:55 +0000 (09:44 +0900)]
lib: add asn1 decoder

Imported from linux kernel v5.3:
 lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoMakefile: add build script for asn1 parsers
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:54 +0000 (09:44 +0900)]
Makefile: add build script for asn1 parsers

This rule will be used to build x509 and pkcs7 parsers.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agocmd: add asn1_compiler
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:53 +0000 (09:44 +0900)]
cmd: add asn1_compiler

Imported from linux kernel v5.3:
 asn1.h without changes
 asn1_ber_bytecode.h without changes
 asn1_decoder.h without changes
 asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolinux/time.h: include vsprintf.h
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:52 +0000 (09:44 +0900)]
linux/time.h: include vsprintf.h

Without this commit, time.h possibly causes a build error as
asctime_r() uses sprintf().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoinclude: kernel.h: include printk.h
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:51 +0000 (09:44 +0900)]
include: kernel.h: include printk.h

Adding "printk.h" will help improve portability from linux kernel
code (in my case, lib/asn1_decoder.c and others) where printf and
pr_* variant functions are used.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: add mktime64() for linux compatibility
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:50 +0000 (09:44 +0900)]
lib: add mktime64() for linux compatibility

This function will be used  in lib/crypto/x509_cert_parser.c, which
will also be imported from linux code in a later commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agortc: move date.c from drivers/rtc/ to lib/
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:49 +0000 (09:44 +0900)]
rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agortc.h: add struct udevice declaration
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:48 +0000 (09:44 +0900)]
rtc.h: add struct udevice declaration

Without this change, including rtc.h solely will cause a build error.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolinux_compat: move kmemdup() from ubifs.c to linux_compat.c
AKASHI Takahiro [Wed, 13 Nov 2019 00:44:47 +0000 (09:44 +0900)]
linux_compat: move kmemdup() from ubifs.c to linux_compat.c

linux_compat.c is the best place for kmemdup(), which is currenly used
only in ubifs.c, but will also be used when other kernel files
(in my case, lib/crypto/x509_cert_parser.c and pkcs7_parser.c) will be
imported. So just move it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: pxe: Fix checkpatch WARNING/CHECK
Patrice Chotard [Mon, 25 Nov 2019 08:07:41 +0000 (09:07 +0100)]
cmd: pxe: Fix checkpatch WARNING/CHECK

Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agocmd: sysboot: Fix checkpatch WARNING/CHECK
Patrice Chotard [Mon, 25 Nov 2019 08:07:40 +0000 (09:07 +0100)]
cmd: sysboot: Fix checkpatch WARNING/CHECK

Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agocmd: pxe_utils: Fix checkpatch WARNING/CHECK
Patrice Chotard [Mon, 25 Nov 2019 08:07:39 +0000 (09:07 +0100)]
cmd: pxe_utils: Fix checkpatch WARNING/CHECK

Fix checkpatch WARNING and CHECK issues

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agocmd: sysboot: Create a sysboot command dedicated file
Patrice Chotard [Mon, 25 Nov 2019 08:07:38 +0000 (09:07 +0100)]
cmd: sysboot: Create a sysboot command dedicated file

Extract all sysboot command related code from pxe.c to new sysboot.c
Update Kconfig to insure that DISTRO_DEFAULT select new CMD_SYSBOOT
command.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agocmd: Prepare sysboot command independence
Patrice Chotard [Mon, 25 Nov 2019 08:07:37 +0000 (09:07 +0100)]
cmd: Prepare sysboot command independence

As sysboot and pxe commands are sharing piece of code, migrate this
common code into a new file pxe_utils.c to prepare sysboot command
code extraction from pxe.c

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agocmd: Migrate from_env() from pxe.c to nvedit.c
Patrice Chotard [Mon, 25 Nov 2019 08:07:36 +0000 (09:07 +0100)]
cmd: Migrate from_env() from pxe.c to nvedit.c

Migrate from_env() from pxe.c to nvedit.c as it's not pxe specific.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoMerge tag 'u-boot-rockchip-20191206' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 6 Dec 2019 15:35:18 +0000 (10:35 -0500)]
Merge tag 'u-boot-rockchip-20191206' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- rockchip pwm driver update to support all the SoCs
- RK3308 GMAC and pinctrl support
- More UART interface support on PX30 and pmugrf reg fix
- Fixup on misc for eth_addr/serial#
- Other updates on variant SoCs

4 years agoRevert "spl: fix entry_point equal to load_addr"
Tom Rini [Fri, 6 Dec 2019 14:56:03 +0000 (09:56 -0500)]
Revert "spl: fix entry_point equal to load_addr"

Due to the (seemingly bogus) assumption of a default
CONFIG_SYS_UBOOT_START value we will revert this change for now and
evaluate it again for the next release along with changes to
CONFIG_SYS_UBOOT_START.

This reverts commit d3e97b53c1f2464f4898226de7d89abf242e4aa8.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimx: imx8qxp_mek: increase buffer sizes and args number
Anatolij Gustschin [Mon, 21 Oct 2019 15:31:53 +0000 (17:31 +0200)]
imx: imx8qxp_mek: increase buffer sizes and args number

The default value of CONFIG_SYS_CBSIZE is too small when we need
to input long commands or when using long kernel command line.

The default value of CONFIG_SYS_MAXARGS is too small to add a long
command line, and the kernel might not boot as intended without the
complete bootargs. Increase argument buffer sizes and the number of
arguments.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx: imx8mm: Fix the first root clock in imx8mm_ahb_sels[]
Frieder Schrempf [Wed, 23 Oct 2019 16:36:44 +0000 (16:36 +0000)]
clk: imx: imx8mm: Fix the first root clock in imx8mm_ahb_sels[]

The 24MHz oscillator clock is referenced by "clock-osc-24m" and not
"osc_24m".

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agoARM: imx: vining2000: Align SOC and ARM LDO voltages
Marek Vasut [Tue, 26 Nov 2019 08:39:13 +0000 (09:39 +0100)]
ARM: imx: vining2000: Align SOC and ARM LDO voltages

The board has both VDD_SOC_IN and VDD_ARM_IN rails connected to the same
PMIC rail, align the LDO voltages to avoid leaking inside the MX6SX SoC.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: vining2000: Repair PCIe support
Marek Vasut [Tue, 26 Nov 2019 08:39:12 +0000 (09:39 +0100)]
ARM: imx: vining2000: Repair PCIe support

Ever since the conversion to DM PCI, the board was missing the PCIe DT
nodes, hence the PCI did not really work. Fill in the DT nodes and add
missing PCIe device reset.

Moreover, bring the PCIe power domain up before booting Linux. This is
mandatory to keep old broken vendor kernels working, as they do not do
so and depend on the bootloader to bring the power domain up.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: vining2000: Enable fitImage support
Marek Vasut [Tue, 26 Nov 2019 08:39:11 +0000 (09:39 +0100)]
ARM: imx: vining2000: Enable fitImage support

The fitImage support was enabled in the downstream U-Boot port and the
kernel images on the device are fitImage, yet this functionality is not
enabled in mainline U-Boot. Enable it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: vining2000: Convert to ethernet DM
Marek Vasut [Tue, 26 Nov 2019 08:39:10 +0000 (09:39 +0100)]
ARM: imx: vining2000: Convert to ethernet DM

Convert the board to ethernet DM support. Adjust board file accordingly,
as the board_eth_init() contains custom clock configuration required for
this board to work. Furthermore, enable FEC1 clock to make FEC1 work as
well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: vining2000: Enable DDR DRAM calibration
Marek Vasut [Tue, 26 Nov 2019 08:39:09 +0000 (09:39 +0100)]
ARM: imx: vining2000: Enable DDR DRAM calibration

Enable DRAM calibration in SPL to improve behavior of the board
in edge conditions of the thermal envelope of the board and make
it even more stable.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: imx: vining2000: Convert to SPL framework
Marek Vasut [Tue, 26 Nov 2019 08:39:08 +0000 (09:39 +0100)]
ARM: imx: vining2000: Convert to SPL framework

In preparation for use of DDR DRAM fine-tuning upon boot,
convert the board to SPL framework instead of using DCD
tables to bring up DRAM and pinmux.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Silvio Fricke <silvio.fricke@softing.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agoARM: mx6: pmu: Expose PMU LDO configuration interface
Marek Vasut [Tue, 26 Nov 2019 08:35:32 +0000 (09:35 +0100)]
ARM: mx6: pmu: Expose PMU LDO configuration interface

Make the PMU LDO configuration interface available to board code,
so that board code can reconfigure the internal LDOs of the SoC.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eric Nelson <eric@nelint.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Eric Nelson <eric@nelint.com>
4 years agoboard: colibri_imx7: reserve DDR memory for Cortex-M4
Igor Opaniuk [Tue, 3 Dec 2019 12:04:47 +0000 (14:04 +0200)]
board: colibri_imx7: reserve DDR memory for Cortex-M4

i.MX 7's Cortex-M4 core can run from DDR and uses DDR memory for
the rpmsg communication. Both use cases need a fixed location of
memory reserved. For the rpmsg use case the reserved area needs
to be in sync with the kernel's hardcoded vring descriptor location.

Use the linux,usable-memory property to carve out 1MB of memory
in case the M4 core is running. Also make sure that the i.MX 7
specific rpmsg driver does not get loaded in case we do not carve
out memory.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agocommon: fdt_support: add support for setting usable memory
Igor Opaniuk [Tue, 3 Dec 2019 12:04:46 +0000 (14:04 +0200)]
common: fdt_support: add support for setting usable memory

Add support for setting linux,usable-memory property in the memory
node of device tree for the kernel [1].

This property holds a base address and size, describing a
limited region in which memory may be considered available for use by
the kernel. Memory outside of this range is not available for use.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agowarp7: Fix U-Boot corruption after saving the environment
Fabio Estevam [Mon, 2 Dec 2019 23:40:28 +0000 (20:40 -0300)]
warp7: Fix U-Boot corruption after saving the environment

U-Boot binary has grown in such a way that it goes beyond the reserved
area for the environment variables.

Running "saveenv" followed by a "reset" causes U-Boot to hang because
of this overlap.

Fix this problem by increasing the CONFIG_ENV_OFFSET size.

Also, in order to prevent this same problem in the future, use
CONFIG_BOARD_SIZE_LIMIT, which will detect the overlap in build-time.

CONFIG_BOARD_SIZE_LIMIT does not accept math expressions, so declare
CONFIG_ENV_OFFSET with its direct value instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Acked-by: Joris Offouga <offougajoris@gmail.com>
Tested-by: Joris Offouga <offougajoris@gmail.com>
4 years agomx6: Allow configuring the NoC registers on i.MX6QP
Fabio Estevam [Mon, 4 Nov 2019 12:44:34 +0000 (09:44 -0300)]
mx6: Allow configuring the NoC registers on i.MX6QP

The NoC registers on i.MX6QP needs to be configured, otherwise some
usecases in the kernel behave incorrectly, such as rotation and resize.

Currently the NoC registers are not configured in the kernel, so
configure them in U-Boot like it is done in the NXP U-Boot tree.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
4 years agomx6cuboxi: Add Baruch as maintainer
Fabio Estevam [Thu, 7 Nov 2019 20:06:21 +0000 (17:06 -0300)]
mx6cuboxi: Add Baruch as maintainer

Add Baruch Siach as a mx6cuboxi maintainer.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
4 years agomx7ulp: Sync the device tree related files
Fabio Estevam [Tue, 5 Nov 2019 12:47:54 +0000 (09:47 -0300)]
mx7ulp: Sync the device tree related files

Sync the mx7ulp device tree related files with the one from
NXP U-Boot vendor tree (imx_v2019.04_4.19.35_1.0.0).

The mainline support for i.MX7ULP is very premature at this stage.

We should probably re-sync with mainline Linux dts when it gets
in better shape, but for now sync with the U-Boot vendor code.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7ulp: scg: Remove unnused scg_a7_apll_init()
Fabio Estevam [Tue, 5 Nov 2019 12:47:53 +0000 (09:47 -0300)]
mx7ulp: scg: Remove unnused scg_a7_apll_init()

scg_a7_apll_init() is not called anywhere, so remove such dead code

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7ulp: Remove the _RUN notation from the PMC1 LDOVL definitions
Fabio Estevam [Tue, 5 Nov 2019 12:47:52 +0000 (09:47 -0300)]
mx7ulp: Remove the _RUN notation from the PMC1 LDOVL definitions

The LDOVL definitions is common to all the modes, not only RUN mode,
so in order to avoid confusion, remove the _RUN notation from the PMC1
LDOVL definitions.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7ulp: Introduce the CONFIG_LDO_ENABLED_MODE option
Fabio Estevam [Tue, 5 Nov 2019 12:47:51 +0000 (09:47 -0300)]
mx7ulp: Introduce the CONFIG_LDO_ENABLED_MODE option

Introduce the CONFIG_LDO_ENABLED_MODE option so that i.MX7ULP boards
designed to operate with LDO enabled mode can work with 0.95V at LDO
output in RUN mode as per the datasheet.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7ulp: Print the LDO mode status
Fabio Estevam [Tue, 5 Nov 2019 12:47:50 +0000 (09:47 -0300)]
mx7ulp: Print the LDO mode status

As per the i.MX7ULP datasheet, it can boot in LDO enabled mode
or LDO bypass mode.

Print the LDO mode status in the U-Boot log for convenience.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoMerge branch '2019-12-05-master-imports'
Tom Rini [Thu, 5 Dec 2019 21:37:36 +0000 (16:37 -0500)]
Merge branch '2019-12-05-master-imports'

- Assorted omapl138_lcdk / da850-evm fixes
- FAT fix, add another pytest as well for FAT.
- Assorted general fixes

4 years agorockchip: allow loading larger kernels
Ben Wolsieffer [Tue, 3 Dec 2019 05:40:05 +0000 (00:40 -0500)]
rockchip: allow loading larger kernels

Recent versions of the Linux kernel with many options enabled have
grown large enough to overwrite the beginning of the initrd. For
example, the kernel I use on my Rock64 and RockPro64 is 34.1 MiB,
while only 31.5 MiB are available between kernel_addr_r and
ramdisk_addr_r.

This patch moves ramdisk_addr_r up by 32 MiB on the RK3328 and RK3399,
allowing for much larger kernels.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3328: rock64: enable CONFIG_MISC_INIT_R
Ben Wolsieffer [Tue, 3 Dec 2019 05:24:31 +0000 (00:24 -0500)]
rockchip: rk3328: rock64: enable CONFIG_MISC_INIT_R

This enables reading of the cpuid and a static MAC address.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agopinctrl: rockchip: Add pinctrl support for rk3308
David Wu [Tue, 3 Dec 2019 11:26:50 +0000 (19:26 +0800)]
pinctrl: rockchip: Add pinctrl support for rk3308

An iomux register contains 8 pins, each of which is represented
by 2 bits, but the register offset is 0x8.

For example, GRF_GPIO0A_IOMUX offset is 0x0, but GRF_GPIO0B_IOMUX
offset is 0x8, the offset 0x4 is reserved.

So add a type IOMUX_8WIDTH_2BIT to calculate offset.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: rockchip: rk3308: Initialize the iomux configuration
David Wu [Tue, 3 Dec 2019 11:02:50 +0000 (19:02 +0800)]
arm: rockchip: rk3308: Initialize the iomux configuration

When we want to use plus pinctrl feature, we need to enable
them at spl.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agopwm: rk_pwm: Make PWM driver to support all Rockchip Socs
David Wu [Tue, 3 Dec 2019 09:49:53 +0000 (17:49 +0800)]
pwm: rk_pwm: Make PWM driver to support all Rockchip Socs

This PWM driver can be used to support pwm functions
for on all Rockchip Socs.

The previous chips than RK3288 did not support polarity,
and register layout was different from the RK3288 PWM.

The RK3288 keep the current functions.

RK3328 and the chips after it, which can support hardware lock,
configure duty, period and polarity at next same period, to
prevent the intermediate temporary state.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodts: rk3308: Enable ethernet function supported for Firefly ROC_RK3308_CC
David Wu [Tue, 26 Nov 2019 01:39:51 +0000 (09:39 +0800)]
dts: rk3308: Enable ethernet function supported for Firefly ROC_RK3308_CC

The Firefly ROC_RK3308_CC use ref_clock of input mode,
and rmii pins of m1 group.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoarm: dts: Add mac node for rk3308 at dtsi level
David Wu [Tue, 26 Nov 2019 01:39:50 +0000 (09:39 +0800)]
arm: dts: Add mac node for rk3308 at dtsi level

The rk3308 only support RMII mode, and if it is output clock
mode, better to use ref_clk pin with drive strength 12ma.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agonet: gmac_rockchip: Add support for rk3308
David Wu [Tue, 26 Nov 2019 01:39:49 +0000 (09:39 +0800)]
net: gmac_rockchip: Add support for rk3308

Add the glue code to allow the rk3308 variant of the Rockchip gmac
to provide network functionality.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: config: add support for firefly-px30 board
Kever Yang [Mon, 2 Dec 2019 07:58:17 +0000 (15:58 +0800)]
rockchip: config: add support for firefly-px30 board

This is a core board named Core-PX30-JD4 with a mainboard from Firefly,
name it as firefly-px30 for now.
This board can re-use the dts of PX30, the only difference is the UART IO,
the firefly use UART2 M1 while evb use UART2 M0.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: misc: protect serial# from getting overwritten
Heiko Stuebner [Fri, 29 Nov 2019 15:40:43 +0000 (16:40 +0100)]
rockchip: misc: protect serial# from getting overwritten

serial# is one of the vendor properties and thus protected from being
overwritten if already set. If env_set is called anyway this result in
some nasty warnings, so check for presence before trying that.

In the same direction check for the presence of cpuid# and compare it
to the actual hardware and emit a warning if they don't match.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: misc: don't fail if eth_addr already set
Heiko Stuebner [Fri, 29 Nov 2019 15:40:42 +0000 (16:40 +0100)]
rockchip: misc: don't fail if eth_addr already set

rockchip_setup_macaddr() runs from an initcall, so returning an error
code will make that initcall fail thus breaking the boot process.

And if an ethernet address is already set this is definitly not a
cause for that, so just return success in that case.

Fixes: 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid");
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px30: Add support for using UART3 as debug UART
Paul Kocialkowski [Thu, 28 Nov 2019 14:27:52 +0000 (15:27 +0100)]
rockchip: px30: Add support for using UART3 as debug UART

Some generic PX30 SoMs found in the wild use UART3 as their debug output
instead of UART2 (used for MMC) and UART5.

Make it possible to use UART3 as early debug output, with the associated
clock and pinmux configuration. Two sets of output pins are supported (M0/M1).

Future users should also note that the pinmux default in the dts is to use
the M1 pins while the Kconfig option takes M0 as a default.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
4 years agorockchip: px30: Rename CONFIG_DEBUG_UART2_CHANNEL to CONFIG_DEBUG_UART_CHANNEL
Paul Kocialkowski [Thu, 28 Nov 2019 14:27:51 +0000 (15:27 +0100)]
rockchip: px30: Rename CONFIG_DEBUG_UART2_CHANNEL to CONFIG_DEBUG_UART_CHANNEL

UART3 also has two sets of pins that can be selected.

Rename the config option to a common name, to allow it to be used for both
UART2 and UART3.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px30: Fixup PMUGRF registers layout order
Paul Kocialkowski [Thu, 28 Nov 2019 14:27:50 +0000 (15:27 +0100)]
rockchip: px30: Fixup PMUGRF registers layout order

According to the PX30 TRM, the iomux registers come first, before the pull
and strength control registers.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
4 years agorockchip: evb-px5: disable NET
Andy Yan [Tue, 26 Nov 2019 13:15:40 +0000 (21:15 +0800)]
rockchip: evb-px5: disable NET

PX5 evb has no ETH port, so disable it.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: px5: enable spl-fifo-mode for emmc for px5-evb
Andy Yan [Tue, 26 Nov 2019 13:15:39 +0000 (21:15 +0800)]
rockchip: px5: enable spl-fifo-mode for emmc for px5-evb

We need load some parts of ATF to sram, but rockchip
dwmmc controllers can't do dma to non-ddr addresses
space, so set the mmc controller into fifo mode in spl.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: rk3308: enable spl-fifo-mode for emmc
Andy Yan [Tue, 26 Nov 2019 13:15:38 +0000 (21:15 +0800)]
rockchip: rk3308: enable spl-fifo-mode for emmc

We need load some parts of ATF to sram, but rockchip
dwmmc controllers can't do dma to non-ddr addresses
space, so set the mmc controller into fifo mode in spl.

And show my best respect to Heiko's work for this solution.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agodoc: rockchip: Update build instruction for rk3308
Andy Yan [Tue, 26 Nov 2019 13:15:37 +0000 (21:15 +0800)]
doc: rockchip: Update build instruction for rk3308

After commit d8765e2422cd ("Enable building of u-boot.itb
on Rockchip platform"), u-boot.itb will automatically
generated by "make all" command, manually command
"make u-boot.itb" is no longer needed.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoARM: omapl138_lcdk: Shrink code size by building with Thumb
Adam Ford [Sun, 10 Nov 2019 12:33:40 +0000 (06:33 -0600)]
ARM: omapl138_lcdk: Shrink code size by building with Thumb

SPL has limited available resources, and the performance between
ARM and Thumb isn't that significant.

This patch builds using Thumb instruction set to reduce the code
size by nearly 6K.

Original:
   text    data     bss     dec     hex filename
  26526    4004    1376   31906    7ca2 spl/u-boot-spl

Thumb:

   text    data     bss     dec     hex filename
  20232    4004    1376   25612    640c spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
4 years agoFix typo in macros, "FIRMEWARE" -> "FIRMWARE"
Thomas Hebb [Sun, 10 Nov 2019 16:23:15 +0000 (08:23 -0800)]
Fix typo in macros, "FIRMEWARE" -> "FIRMWARE"

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
4 years agoARM: da850-evm: Disable SYS_MMCSD_RAW_MODE_USE_SECTOR
Adam Ford [Wed, 13 Nov 2019 13:42:00 +0000 (07:42 -0600)]
ARM: da850-evm: Disable SYS_MMCSD_RAW_MODE_USE_SECTOR

The da850-evm doesn't have the boot pins configured in a way
to make MMC/SD booting an option, and MMC/SD support is not
enabled in SPL.  Therefore, there is no need to support raw mode
mmc/sd support in SPL.

This patch disables CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR

Signed-off-by: Adam Ford <aford173@gmail.com>
4 years agospl: fix entry_point equal to load_addr
Giulio Benetti [Mon, 25 Nov 2019 16:18:20 +0000 (17:18 +0100)]
spl: fix entry_point equal to load_addr

At the moment entry_point is set to image_get_load(header) that sets it
to "load address" instead of "entry point", assuming entry_point is
equal to load_addr, but it's not true. Then load_addr is set to
"entry_point - header_size", but this is wrong too since load_addr is
not an entry point.

So use image_get_ep() for entry_point assignment and image_get_load()
for load_addr assignment.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
4 years agotest/py: test_fs: add tests for creating/deleting many files
AKASHI Takahiro [Tue, 26 Nov 2019 08:28:49 +0000 (17:28 +0900)]
test/py: test_fs: add tests for creating/deleting many files

# This is actually a resent patch of
# [1] https://lists.denx.de/pipermail/u-boot/2019-May/369170.html

Two test cases are added under test_fs_ext:
    test case 10: for root directory
    test case 11: for non-root directory

Those will verify a behavior fixed by the commits related to
root directory
("fs: fat: allocate a new cluster for root directory of fat32" and
"fs: fat: flush a directory cluster properly"), and focus on
handling long-file-name directory entries under a directory.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agofs: fat: handle deleted directory entries correctly
AKASHI Takahiro [Tue, 26 Nov 2019 08:29:31 +0000 (17:29 +0900)]
fs: fat: handle deleted directory entries correctly

Unlink test for FAT file system seems to fail at test_unlink2.
(When I added this test, I haven't seen any errors though.)
for example,
===8<===
fs_obj_unlink = ['fat', '/home/akashi/tmp/uboot_sandbox_test/128MB.fat32.img']

    def test_unlink2(self, u_boot_console, fs_obj_unlink):
        """
        Test Case 2 - delete many files
        """
        fs_type,fs_img = fs_obj_unlink
        with u_boot_console.log.section('Test Case 2 - unlink (many)'):
            output = u_boot_console.run_command('host bind 0 %s' % fs_img)

            for i in range(0, 20):
                output = u_boot_console.run_command_list([
                    '%srm host 0:0 dir2/0123456789abcdef%02x' % (fs_type, i),
                    '%sls host 0:0 dir2/0123456789abcdef%02x' % (fs_type, i)])
                assert('' == ''.join(output))

            output = u_boot_console.run_command(
                '%sls host 0:0 dir2' % fs_type)
>           assert('0 file(s), 2 dir(s)' in output)
E           AssertionError: assert '0 file(s), 2 dir(s)' in '            ./\r\r\n            ../\r\r\n        0   0123456789abcdef11\r\r\n\r\r\n1 file(s), 2 dir(s)'

test/py/tests/test_fs/test_unlink.py:52: AssertionError
===>8===

This can happen when fat_itr_next() wrongly detects an already-
deleted directory entry.

File deletion, which was added in the commit f8240ce95d64 ("fs: fat:
support unlink"), is implemented by marking its entry for a short name
with DELETED_FLAG, but related entry slots for a long file name are kept
unmodified. (So entries will never be actually deleted from media.)

To handle this case correctly, an additional check for a directory slot
will be needed in fat_itr_next().

In addition, I added extra comments about long file name and short file
name format in FAT file system. Although they are not directly related
to the issue, I hope it will be helpful for better understandings
in general.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agodrivers: optee: rpmb: fix returning CID to TEE
Jorge Ramirez-Ortiz [Tue, 26 Nov 2019 16:19:34 +0000 (17:19 +0100)]
drivers: optee: rpmb: fix returning CID to TEE

The mmc CID value is one of the input parameters used to provision the
RPMB key. The trusted execution environment expects this value to be
specified in big endian format.

Before this fix, on little endian systems, the value returned by the
linux kernel mmc driver differed from the one returned by u-boot.
This meant that if linux provisioned the RPMB key, u-boot would not
have access to the partition (and the other way around).

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
4 years agocmd: cp: add missing map_sysmem
Philippe Reynes [Mon, 2 Dec 2019 16:33:22 +0000 (17:33 +0100)]
cmd: cp: add missing map_sysmem

The command cp fails on sandbox because the address is used
directly. To fix this issue, we call the function map_sysmem
to translate the address.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agoiminfo: add missing map_sysmem
Philippe Reynes [Mon, 2 Dec 2019 14:45:50 +0000 (15:45 +0100)]
iminfo: add missing map_sysmem

The command iminfo fails on sandbox because the address
is used directly. To fix this issue, we call the function
map_sysmem to translate the address.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agospl: Introduce SPL_DM_GPIO Kconfig define
Lukasz Majewski [Mon, 2 Dec 2019 09:24:16 +0000 (10:24 +0100)]
spl: Introduce SPL_DM_GPIO Kconfig define

This define indicates if DM_GPIO shall be supported in SPL. This allows
proper operation of DM converted GPIO drivers in SPL, which use
boards.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 years agodrivers: pci: ignore disabled devices
Michael Walle [Sun, 1 Dec 2019 16:45:18 +0000 (17:45 +0100)]
drivers: pci: ignore disabled devices

PCI devices may be disabled in the device tree. Devices which are probed
by the device tree handle the "status" property and are skipped if
disabled. Devices which are probed by the PCI enumeration don't check
that property. Fix it.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Alex Marginean <alexandru.marginean@nxp.com>
Tested-by: Alex Marginean <alexandru.marginean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge git://git.denx.de/u-boot-sh
Tom Rini [Wed, 4 Dec 2019 23:10:04 +0000 (18:10 -0500)]
Merge git://git.denx.de/u-boot-sh

- Convert some R-Car Gen3 platforms to DM_SPI{,_FLASH}

4 years agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 4 Dec 2019 22:18:38 +0000 (17:18 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2019-10-27-mtd-cleanup'
Tom Rini [Wed, 4 Dec 2019 22:13:35 +0000 (17:13 -0500)]
Merge branch '2019-10-27-mtd-cleanup'

- Merge the series to clean up our MTD Kconfig and Makefile logic

4 years agomtd: Makefile: deep cleanup
Miquel Raynal [Fri, 25 Oct 2019 17:39:31 +0000 (19:39 +0200)]
mtd: Makefile: deep cleanup

Move MTD-related lines out of the root Makefile. Put them in their
respective directories. Enclose some of these new lines to skip them
when building the SPL. MTD core files and some MTD device drivers are
compiled in a mtd.o object and included in the final object only if
MTD support is required (there are two different symbols for that, one
for U-Boot and one for the SPL).

Now that all defconfigs have been fixed, we can stop the logic where
enabling a command selects the core files to compile. This logic is
broken since selecting a symbol with a 'depends on' will not enforce
this secondary dependency.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agocmd: make MTD commands depend on MTD
Miquel Raynal [Fri, 25 Oct 2019 17:39:30 +0000 (19:39 +0200)]
cmd: make MTD commands depend on MTD

Defconfigs have been fixed, now we can add proper dependencies in
Kconfig. SPI FLASH is still not dependent on MTD (deeper rework needed).

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agocmd: nand/sf: isolate legacy code
Miquel Raynal [Fri, 25 Oct 2019 17:39:29 +0000 (19:39 +0200)]
cmd: nand/sf: isolate legacy code

The 'sf' command is not supposed to rely on the MTD stack, but both
'sf' and 'nand' commands use helpers located in mtd_uboot.c. Despite
their location, these functions do not depend at all on the MTD
stack.

This file (drivers/mtd/mtd_uboot.c) is only compiled if CONFIG_MTD is
selected, which is inconsistent with the current situation. Solve this
by moving these three functions (which are only used by the above two
commands) out of mtd_uboot.c and put them in a C file only compiled
with cmd/sf.c and cmd/nand.c.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[trini: Don't export get_part function now]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocmd: mtdparts: Kconfig: join mtdparts command entry with its options
Miquel Raynal [Thu, 3 Oct 2019 17:50:25 +0000 (19:50 +0200)]
cmd: mtdparts: Kconfig: join mtdparts command entry with its options

Move the Kconfig entry of the option right after the entry of the
mtdparts command.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agomtd: spi: SPI_FLASH_MTD depends on MTD
Miquel Raynal [Thu, 3 Oct 2019 17:50:24 +0000 (19:50 +0200)]
mtd: spi: SPI_FLASH_MTD depends on MTD

It is already the case that all defconfigs with SPI_FLASH_MTD also
declare using MTD, but let's make this consistent and enforce it in
Kconfig. Most of the time SPI_FLASH_MTD is used in conjunction with
UBI, which already depends on MTD.

Suggested-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agodfu: add dependency on the raw NAND core
Miquel Raynal [Thu, 3 Oct 2019 17:50:22 +0000 (19:50 +0200)]
dfu: add dependency on the raw NAND core

CONFIG_DFU_NAND needs the raw NAND core being compiled.

Also fix the colibri_vf defconfig to reflect this dependency.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
4 years agomtd: nand: add includes in NAND core to avoid warnings
Miquel Raynal [Thu, 3 Oct 2019 17:50:21 +0000 (19:50 +0200)]
mtd: nand: add includes in NAND core to avoid warnings

Because of the include's game, when some files are compiled for a SPI
NAND device, no warning appears. But when it is for a raw NAND device,
GCC complains. Fix these warning by including <common.h>.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
4 years agoconfigs: ls104x/ls108x/ls208x: Build the raw NAND core with TFABOOT
Miquel Raynal [Thu, 3 Oct 2019 17:50:20 +0000 (19:50 +0200)]
configs: ls104x/ls108x/ls208x: Build the raw NAND core with TFABOOT

Enabling TFABOOT configuration will compile-in a call to nand_read in
the boot sequence. Handle the situation by also selecting officially
the raw NAND core in this case.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agoconfigs: socfpga: mcvevk: Remove useless UBI infos
Miquel Raynal [Thu, 3 Oct 2019 17:50:19 +0000 (19:50 +0200)]
configs: socfpga: mcvevk: Remove useless UBI infos

There is no flash on this board, there is no reason to define MTD
environment variables nor UBI. Drop them from the configuration file.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Wolfgang Grandegger <wg@aries-embedded.de>