pandora-u-boot.git
3 years agofs/squashfs: sqfs_read: don't write beyond buffer size
Richard Genoud [Tue, 3 Nov 2020 11:11:23 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: don't write beyond buffer size

The length of the buffer wasn't taken into account when writing to the
given buffer.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value
Richard Genoud [Tue, 3 Nov 2020 11:11:22 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value

sqfs_decompressor_init() returns a value, so it's better to use it than
to force the return value to EINVAL (it could be ENOMEM)

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error
Richard Genoud [Tue, 3 Nov 2020 11:11:21 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error

Resetting the context on error will prevent some checks like:
if (!ctx.cur_dev)
To pass when the probe method has failed

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:19 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: fix possible memory leak on error

If SquashFS magic number is invalid, there's a memory leak.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes
Richard Genoud [Tue, 3 Nov 2020 11:11:18 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes

finfo.blk_sizes may not be freed in case of error in the for loop
Setting it to null and freeing it at the end makes prevents that from
happening.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_get_abs_path: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:17 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix possible memory leak on error

if  sqfs_tokenize(rel_tokens, rc, rel); fails, the function exits
without freeing the array base_tokens.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_get_abs_path: fix error check
Richard Genoud [Tue, 3 Nov 2020 11:11:16 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix error check

the return value of sqfs_tokenize(rel_tokens, rc, rel); wasn't checked.
(but "ret" value was !)
This is obviouly a typo.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_frag_lookup: simplify error handling
Richard Genoud [Tue, 3 Nov 2020 11:11:15 +0000 (12:11 +0100)]
fs/squashfs: sqfs_frag_lookup: simplify error handling

For consistency with other functions.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix another memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:14 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix another memory leak

data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:13 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak

sqfs_closedir() should be called to free memory allocated by
sqfs_opendir()

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: remove useless sqfs_closedir()
Richard Genoud [Tue, 3 Nov 2020 11:11:12 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix dangling pointer dirs->entry
Richard Genoud [Tue, 3 Nov 2020 11:11:11 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_size: remove useless sqfs_closedir()
Richard Genoud [Tue, 3 Nov 2020 11:11:10 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_size: fix dangling pointer dirs->entry
Richard Genoud [Tue, 3 Nov 2020 11:11:09 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_concat_tokens: check if malloc succeeds
Richard Genoud [Tue, 3 Nov 2020 11:11:08 +0000 (12:11 +0100)]
fs/squashfs: sqfs_concat_tokens: check if malloc succeeds

memory allocation should always be checked

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read_inode_table: fix dangling pointer
Richard Genoud [Tue, 3 Nov 2020 11:11:07 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_inode_table: fix dangling pointer

inode_table should not be left dangling as it may be freed in sqfs_opendir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_search_dir: fix memory leaks
Richard Genoud [Tue, 3 Nov 2020 11:11:06 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix memory leaks

path, target, res, rem and sym_tokens were not free on error nor success.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_search_dir: fix dangling pointer
Richard Genoud [Tue, 3 Nov 2020 11:11:05 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix dangling pointer

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read_directory_table: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:04 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_directory_table: fix memory leak

pos_list wasn't freed on every error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_split_path: fix memory leak and dangling pointers
Richard Genoud [Tue, 3 Nov 2020 11:11:03 +0000 (12:11 +0100)]
fs/squashfs: sqfs_split_path: fix memory leak and dangling pointers

*file and *dir were not freed on error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_closedir: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:02 +0000 (12:11 +0100)]
fs/squashfs: sqfs_closedir: fix memory leak

sqfs_dirs wasn't freed anywhere.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_opendir: simplify error handling
Richard Genoud [Tue, 3 Nov 2020 11:11:01 +0000 (12:11 +0100)]
fs/squashfs: sqfs_opendir: simplify error handling

Using only one label permits to prevents bugs when moving code around.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers
Richard Genoud [Tue, 3 Nov 2020 11:11:00 +0000 (12:11 +0100)]
fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers

When trying to load an non-existing file, the cpu hangs!

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: fix board hang-up when calling .exists()
Richard Genoud [Tue, 3 Nov 2020 11:10:59 +0000 (12:10 +0100)]
fs/squashfs: fix board hang-up when calling .exists()

add missing squashfs function to prevent dangling or null pointers.
For exemple, when calling test [ -e somefile ], squashfs.exists may be
called.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
3 years agofs: btrfs: initialize @ret to 0 to prevent uninitialized return value
Qu Wenruo [Sat, 31 Oct 2020 01:07:51 +0000 (09:07 +0800)]
fs: btrfs: initialize @ret to 0 to prevent uninitialized return value

In show_dir() if we hit a ROOT_ITEM, we can exit with uninitialized
@ret.

Fix it by initializing it to 0.

Reported-by: Coverity CID 312955
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agofs: btrfs: inode: handle uninitialized type before returning it
Qu Wenruo [Sat, 31 Oct 2020 01:07:49 +0000 (09:07 +0800)]
fs: btrfs: inode: handle uninitialized type before returning it

In btrfs_lookup_path() the local variable @type should always be updated
after we hit any file/dir.

But if @filename is NULL from the very beginning, then we don't
initialize it and return it directly.

To prevent such problem from happening, we initialize @type to
BTRFS_FT_UNKNOWN.
For normal execution route, it will get updated for each filename we
resolved.
Buf if we didn't find any path, we check if the type is still FT_UNKNOWN
and ret == 0. If true we know there is something wrong, just return
-EUCLEAN to inform the caller.

Reported-by: Coverity CID 312958
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agofs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE
Gerard Koskamp [Fri, 30 Oct 2020 13:41:58 +0000 (13:41 +0000)]
fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE

I've created a squashfs file system with Yocto (it use squashfs-tools)
and u-boot command sqfsls give the error:'Error while searching inode:
unknown type.'
After some digging in the code I found that the index is off by 1.
This patch fix this issue and I can successful use the sqfsls command.
After search for the squashfs format I found a link talk about a
similar issue but this time in the documentation. The link is:
https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529

Signed-off-by: Gerard Koskamp <gerard.koskamp@nedap.com>
Tested-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
3 years agodrivers: led: bcm6858: set the correct led polarity register
Steven Lawrance [Thu, 29 Oct 2020 17:27:34 +0000 (18:27 +0100)]
drivers: led: bcm6858: set the correct led polarity register

This change sets the output (hardware) polarity register instead of the
input (software) polarity register for the bcm6858 LED controller.  The
logic was inverted (a LED configued active high behaved as active low).

Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
3 years agokm/ppc: use Kconfig for MEMTEST configuration
Holger Brunck [Thu, 29 Oct 2020 12:54:54 +0000 (13:54 +0100)]
km/ppc: use Kconfig for MEMTEST configuration

Also change back SYS_MEMTEST_END to 0x00f00000. 0xe00000 was wrong and
introduced due to the global Kconfig migration of this option in u-boot.

CC: Heiko Schocher <hs@denx.de>
CC: Tom Rini <trini@konsulko.com>
Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
3 years agokm: replace hardcoded address for imported environment
Matteo Ghidoni [Thu, 29 Oct 2020 12:48:01 +0000 (13:48 +0100)]
km: replace hardcoded address for imported environment

Instead of using an hard coded address, make use of an
already defined address for importing the environment
for ramfs and nfs boot. This allows boards having different
mapping to use the same code.

CC: Heiko Schocher <hs@denx.de>
CC: Tom Rini <trini@konsulko.com>
Signed-off-by: Matteo Ghidoni <matteo.ghidoni@hitachi-powergrids.com>
Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
3 years agoenv: typo enougth
Heinrich Schuchardt [Fri, 30 Oct 2020 05:11:12 +0000 (06:11 +0100)]
env: typo enougth

%s/enougth/enough/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
3 years agotools: dumpimage: Remove remaining mentions of the -i option
Tyler Hicks [Mon, 26 Oct 2020 15:40:24 +0000 (10:40 -0500)]
tools: dumpimage: Remove remaining mentions of the -i option

The -i option of the dumpimage tool has been removed so it should no
longer be documented in the README file. Refer readers to the tool's
help output rather than maintain a copy of the usage in the README.

Finally, adjust the example dumpfile invocation in imagetool.h to use
the -o option instead of the removed -i option.

Fixes: 12b831879a76 ("tools: dumpimage: Simplify arguments")
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Cc: Martyn Welch <martyn.welch@collabora.com>
Acked-by: Martyn Welch <martyn.welch@collabora.com>
3 years agocommon: fit: add missing newline
Michael Walle [Mon, 16 Nov 2020 21:01:31 +0000 (22:01 +0100)]
common: fit: add missing newline

The debug statement doesn't end with a newline. Add it.

Signed-off-by: Michael Walle <michael@walle.cc>
3 years agotools: image-host.c: use correct variable for strerrno
Philippe Reynes [Fri, 13 Nov 2020 14:15:18 +0000 (15:15 +0100)]
tools: image-host.c: use correct variable for strerrno

In the function get_random_data, strerrno is called with
the variable ret (which is the return of the function
clock_gettime). It should be called with errnor. This
commit fixes this mistake.

Reported-by: Coverity (CID: 312956)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotools: image-host.c: use random instead of rand
Philippe Reynes [Fri, 13 Nov 2020 15:37:46 +0000 (16:37 +0100)]
tools: image-host.c: use random instead of rand

According to the manpage of rand, it is recommended
to use random instead of rand. This commit updates
the function get_random_data to use random.

Reported-by: Coverity (CID: 312953)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: vexpress: don't reset flags in board_init to avoid losing previous ones
Arnaud Aujon Chevallier [Sun, 15 Nov 2020 11:54:10 +0000 (12:54 +0100)]
arm: vexpress: don't reset flags in board_init to avoid losing previous ones

Re-submitted because of missing description and signed-off.

flags reset in board_init caused bugs when executing command like editenv
because the reallocated flag was lost.

Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Arnaud Aujon Chevallier <arnaud@intelibre.fr>
3 years agoenv: mmc: Correct partition comparison in mmc_offset_try_partition
Hoyeonjiki Kim [Tue, 17 Nov 2020 03:32:08 +0000 (12:32 +0900)]
env: mmc: Correct partition comparison in mmc_offset_try_partition

The function mmc_offset_try_partition searches the MMC partition for
locating environment data, by comparing the partition names with config
"u-boot,mmc-env-parition". However, it only compares the first word-size
bytes (size of 'const char *'), which may make the function to find
unintended partition.

Correct the function not to partially compare the partition name with
config "u-boot,mmc-env-partition".

Fixes: c9e87ba66540 ("env: Save environment at the end of an MMC partition")
Signed-off-by: Hoyeonjiki Kim <jigi.kim@gmail.com>
Reviewed-by: Wolfgang Denk <wd@denx.de>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 17 Nov 2020 14:52:34 +0000 (09:52 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Enable SATA disk on QEMU RISC-V and update doc.
- k210 pinctrl updates:
  - Fix inverted IE and OE for I2C.
  - Rename power domains to match datasheet.

3 years agopinctrl: k210: Rename power domains to match datasheet
Sean Anderson [Fri, 13 Nov 2020 13:43:40 +0000 (08:43 -0500)]
pinctrl: k210: Rename power domains to match datasheet

This renames power domains to match the names on the k210 datasheet.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reported-by: Damien Le Moal <Damien.LeMoal@wdc.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agopinctrl: k210: Fix inverted IE and OE for I2C
Sean Anderson [Fri, 13 Nov 2020 13:43:39 +0000 (08:43 -0500)]
pinctrl: k210: Fix inverted IE and OE for I2C

I2C and SCCB previously shared defaults. However, SCCB needs OE_INV and
IE_INV set, but I2C cannot have those bits set. This adds a separate
default for SCCB.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reported-by: Damien Le Moal <Damien.LeMoal@wdc.com>
3 years agodoc: qemu-riscv: describe attaching a disk image
Heinrich Schuchardt [Wed, 4 Nov 2020 11:59:13 +0000 (12:59 +0100)]
doc: qemu-riscv: describe attaching a disk image

How to add an emulated disk to QEMU may not be known to the user.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: enable SATA disk on QEMU RISC-V
Heinrich Schuchardt [Wed, 4 Nov 2020 11:49:01 +0000 (12:49 +0100)]
riscv: enable SATA disk on QEMU RISC-V

Allow attaching a virtual SATA disk to QEMU RISC-V by implying
AHCI, AHCI_PCI, CMD_SCSI, DM_SCSI, PCI_INIT_R, SCSI, SCSI_AHCI.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: sort SPECIFIC_OPTIONS
Heinrich Schuchardt [Wed, 4 Nov 2020 11:49:00 +0000 (12:49 +0100)]
riscv: sort SPECIFIC_OPTIONS

Sort implied options in BOARD_SPECIFIC_OPTIONS in the same sequence as in
.config.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoMerge branch 'pr-2020-11-17' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 17 Nov 2020 03:53:29 +0000 (22:53 -0500)]
Merge branch 'pr-2020-11-17' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- PinePhone support (Samuel)
- V3/S3 support (Icenowy)

3 years agosunxi: dts: sync Allwinner V3s-related DTs from Linux 5.10-rc1
Icenowy Zheng [Mon, 26 Oct 2020 14:19:35 +0000 (22:19 +0800)]
sunxi: dts: sync Allwinner V3s-related DTs from Linux 5.10-rc1

This commit imports device tree files that are related to Allwinner V3
series from Linux commit 3650b228f83a ("Linux 5.10-rc1").

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: allow to use AXP20[39] attached to I2C0 on V3 series
Icenowy Zheng [Mon, 26 Oct 2020 14:19:34 +0000 (22:19 +0800)]
sunxi: allow to use AXP20[39] attached to I2C0 on V3 series

The reference design of Allwinner V3 series uses an
AXP203 or AXP209 PMIC attached to the I2C0 bus of the SoC, although the
first community-available V3s board, Lichee Pi Zero, omitted it.

Allow to introduce support for the PMIC on boards with it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agoclk: sunxi: add compatible string for V3
Icenowy Zheng [Mon, 26 Oct 2020 14:18:02 +0000 (22:18 +0800)]
clk: sunxi: add compatible string for V3

A new compatible string is introduced for V3 CCU, because it has a few
extra features available.

Add the compatible string to the clock driver. As the extra features are
not touched, just share the description struct now.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: gpio: introduce compatible string for V3 GPIO
Icenowy Zheng [Mon, 26 Oct 2020 14:18:01 +0000 (22:18 +0800)]
sunxi: gpio: introduce compatible string for V3 GPIO

A new compatible string is introduced for V3 GPIO, because it has more
pins available than V3s.

Add the compatible string to the GPIO driver.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: add V3/S3 support
Icenowy Zheng [Mon, 26 Oct 2020 14:15:59 +0000 (22:15 +0800)]
sunxi: add V3/S3 support

Allwinner V3/Sochip S3 uses the same die with Allwinner V3s/S3L, but V3 comes
with no co-packaged DDR (DDR3 is usually used externally), and S3L comes
with co-packaged DDR3.

Add support for Allwinner V3/S3 chips by add SoC names to original V3s
choice, and allow to select DDR3.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: a64: Add a defconfig for the PinePhone
Samuel Holland [Tue, 3 Nov 2020 03:32:50 +0000 (21:32 -0600)]
sunxi: a64: Add a defconfig for the PinePhone

The PinePhone is a smartphone produced by Pine64, with an A64 SoC,
2 or 3 GiB LPDDR3 RAM, 16 or 32 GiB eMMC, 720x1440 MIPI-DSI panel,
and Quectel EG25-G modem.

There are two main board revisions: 1.1 for early adopters, and 1.2
for mass production. Since there is code to detect the board revision
at boot, one config/image can support both boards.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: DT: A64: update device tree files
Samuel Holland [Sat, 24 Oct 2020 15:21:55 +0000 (10:21 -0500)]
sunxi: DT: A64: update device tree files

Import updated device trees from Linux tag v5.9. This picks up new
hardware (PinePhone, PineTab); and it drops the U-Boot specific DTSI
files for the Pinebook and the Teres-I, since the ANX6345 bridge is
now supported upstream.

A couple of headers needed updates for recently-added hardware support.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: board: Set fdtfile to match the DT chosen by SPL
Samuel Holland [Sat, 24 Oct 2020 15:21:54 +0000 (10:21 -0500)]
sunxi: board: Set fdtfile to match the DT chosen by SPL

Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE.
This meant that, regardless of the DT chosen by SPL (either by changing
the header in the image or by the selection code at runtime), Linux
always used the default DT.

By using the name from the SPL header (which, because of the previous
commit, always matches the DT used by U-Boot proper), Linux also sees
the same board as U-Boot/SPL, even if the boot script later loads a DT
from disk.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: remove no longer needed CONFIG_SPL_LOAD_FIT guards]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: board: Save the chosen DT name in the SPL header
Samuel Holland [Sat, 24 Oct 2020 15:21:53 +0000 (10:21 -0500)]
sunxi: board: Save the chosen DT name in the SPL header

This overwrites the name loaded from the SPL image. It will be different
if there was previously no name provided, or if a more accurate name was
determined by the board variant selection logic. This means that the DT
name in the SPL header now always matches the DT appended to U-Boot.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: move function under CONFIG_SPL_LOAD_FIT guard]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: board: Add PinePhone DT selection logic
Samuel Holland [Sat, 24 Oct 2020 15:21:52 +0000 (10:21 -0500)]
sunxi: board: Add PinePhone DT selection logic

There are two different publicly-released revisions of the PinePhone
hardware, versions 1.1 and 1.2; and they need different device trees.
Since some GPIO pins were rerouted, we can use that to distinguish
between them.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: board: Simplify Pine A64 DT selection logic
Samuel Holland [Sat, 24 Oct 2020 15:21:51 +0000 (10:21 -0500)]
sunxi: board: Simplify Pine A64 DT selection logic

Instead of using an entirely separate matching algorithm, simply update
the name of the DT we want to match. Enabling this logic does not depend
on the FIT config name, only on the initial guess of the board name.

Importantly, the initial guess must be "sun50i-a64-pine64-plus", because
otherwise the logic would trigger when "sun50i-a64-pine64-lts" was
written to the SPL header.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosunxi: board: Add a helper to get the SPL DT name
Samuel Holland [Sat, 24 Oct 2020 15:21:50 +0000 (10:21 -0500)]
sunxi: board: Add a helper to get the SPL DT name

This moves the validity checking and typecasts all to one place away
from the string comparison logic, and it detangles the compile-time
and runtime control flow.

The new helper will also be used by U-Boot proper in a future commit.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: protect new function with CONFIG_SPL_LOAD_FIT]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: board: Use a more descriptive variable name
Samuel Holland [Sat, 24 Oct 2020 15:21:49 +0000 (10:21 -0500)]
sunxi: board: Use a more descriptive variable name

The variable "cmp_str" always leaves me wondering if it is the DT name
of the current board (yes) or DT name in the FIT config entry (no).

In preparation for expanding the functionality here, rename it to
something that obviously means "this is the DT name we are looking for".

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agoMerge tag 'ti-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Mon, 16 Nov 2020 18:42:29 +0000 (13:42 -0500)]
Merge tag 'ti-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- Fix Nokia RX-51 boot issues
- Fix CONFIG_LOGLEVEL on K3 devices
- Add phyBOARD REGOR support

3 years agoMerge tag 'u-boot-amlogic-20201116' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 16 Nov 2020 15:50:32 +0000 (10:50 -0500)]
Merge tag 'u-boot-amlogic-20201116' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- Clock fix MMC driver for SM1 based platforms
- sync SOC Ids from Linux 5.10-rc1
- fix potential build warning on meson_dw_hdmi and meson-g12a-usb2 phy

3 years agoMerge tag 'u-boot-rockchip-20201113' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 16 Nov 2020 14:50:21 +0000 (09:50 -0500)]
Merge tag 'u-boot-rockchip-20201113' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- Fix USB support for rk3399 Pinebook Pro;
- Fix SPI boot for rk3399 boards other than Bob;
- Fix 32bit boards firmware build without SPL_OPTEE support;
- Fix rockchip display driver license;

3 years agoMerge tag 'dm-pull-15nov20' of git://git.denx.de/u-boot-dm
Tom Rini [Sun, 15 Nov 2020 15:13:22 +0000 (10:13 -0500)]
Merge tag 'dm-pull-15nov20' of git://git.denx.de/u-boot-dm

Minor fixes/improvements to 'patman status'

3 years agomtd: OneNAND: Set MTD type
Pali Rohár [Sat, 31 Oct 2020 16:32:50 +0000 (17:32 +0100)]
mtd: OneNAND: Set MTD type

onenand_probe() function is missing to set mtd->type. So set same type as
which sets onenand Linux kernel driver.

After this change 'mtd list' prints correct type instead of 'Unknown'.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoNokia RX-51: Make onenand working
Ivaylo Dimitrov [Sat, 31 Oct 2020 16:32:49 +0000 (17:32 +0100)]
Nokia RX-51: Make onenand working

set_gpmc_cs0() sets wrong timings and size for Nokia N900 onenand flash.
Fix that by setting the correct timings and size from the board code

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Tested-by: Pali Rohár <pali@kernel.org>
3 years agoNokia RX-51: Update test script
Pali Rohár [Sat, 31 Oct 2020 16:32:48 +0000 (17:32 +0100)]
Nokia RX-51: Update test script

Include emmc/nand suffix into bootmenu script names and fix leaking sleep
processes when asynchronously waiting for them. 'wait -n' is not provided
by /bin/sh, so run script under bash.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoNokia RX-51: During init disable lp5523 led instead of resetting it
Pali Rohár [Sat, 31 Oct 2020 16:32:47 +0000 (17:32 +0100)]
Nokia RX-51: During init disable lp5523 led instead of resetting it

After commit d5243359e1af ("OMAP24xx I2C: Add support for set-speed")
U-Boot is unstable to reset lp5523 led. That commit added pooling for i2c
poll ARDY bit which apparently is never set. It is not known what is
happening here.

Purpose of resetting lp5523 led in Nokia RX-51 code is just to turn off
very bright led which is powered on by NOLO and expects next boot image
(kernel or U-Boot) to turn it off.

After testing we observed that just disabling lp5523 led is working fine.

So as a workaround to this ARDY bit i2c issue we disable lp5523 led instead
of resetting it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
3 years agoNokia RX-51: Fix crashing in U-Boot mmc function omap_hsmmc_stop_clock()
Pali Rohár [Sat, 31 Oct 2020 16:32:46 +0000 (17:32 +0100)]
Nokia RX-51: Fix crashing in U-Boot mmc function omap_hsmmc_stop_clock()

After commit 04a2ea248f58 ("mmc: disable UHS modes if Vcc cannot be
switched on and off") U-Boot started crashing on Nokia RX-51 while
initializing mmc and caused reboot loop.

It looks like that some clocks were not enabled and this patch fixes U-Boot
mmc crash.

Signed-off-by: Pali Rohár <pali@kernel.org>
Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
3 years agoNokia RX-51: Remove old comments from configs/nokia_rx51.h file
Pali Rohár [Sat, 31 Oct 2020 16:32:45 +0000 (17:32 +0100)]
Nokia RX-51: Remove old comments from configs/nokia_rx51.h file

These comments are relict for old, now removed config options.
So remove these obsoleted comments too.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoconfigs: am65/j72x: Set CONFIG_LOGLEVEL to 7
Roger Quadros [Fri, 30 Oct 2020 13:00:24 +0000 (15:00 +0200)]
configs: am65/j72x: Set CONFIG_LOGLEVEL to 7

By default CONFIG_LOGLEVEL seems to be set to 4 which is
too low and doesn't show dev_info/dev_notice/dev_warn
messages on console. This has been deliberately set low
globally to be conservative setting across the board due to
primary bootloader size limitations. It is best to tune
per board config as per user needs.

On K3 we have separate SPL and u-boot configs so we
can afford to set u-boot CONFIG_LOGLEVEL to 7.

On AM65 this patch causes u-boot.img size to change from
932KB to 940KB with 1 line additional print during
MMC boot. i.e. details of Net subsystem

"Net: K3 CPSW: nuss_ver: 0x6BA00102 cpsw_ver: 0x6BA80102 ale_ver: 0x00293904 Ports:1 mdio_freq:1000000"

Similar 8KB difference was seen on J721E.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
3 years agoNokia RX-51: Convert to CONFIG_DM_I2C
Pali Rohár [Mon, 26 Oct 2020 22:45:11 +0000 (23:45 +0100)]
Nokia RX-51: Convert to CONFIG_DM_I2C

Use twl4030_i2c_read(), i2c_get_chip_for_busnum() and remove
CONFIG_SYS_I2C.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agopower: twl4030: Add twl4030_i2c_read() function
Pali Rohár [Mon, 26 Oct 2020 21:36:15 +0000 (22:36 +0100)]
power: twl4030: Add twl4030_i2c_read() function

Function twl4030_i2c_read() is like twl4030_i2c_read_u8() but instead of
single value it rather returns array of values.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoARM: am335x: Add phyBOARD REGOR support
Parthiban Nallathambi [Fri, 23 Oct 2020 14:23:49 +0000 (16:23 +0200)]
ARM: am335x: Add phyBOARD REGOR support

phyBOARD-REGOR is based on phyCORE AM335x R2 SoM (PCL060).

CPU  : AM335X-GP rev 2.1
Model: Phytec AM335x phyBOARD-REGOR
DRAM:  512 MiB
NAND:  512 MiB
MMC:   OMAP SD/MMC: 0
eth0: ethernet@4a100000

Working:
 - Eth0
 - i2C
 - MMC/SD
 - NAND
 - UART
 - USB (host)

Device trees were taken from Linux mainline:
commit c4d6fe731176 ("Linux 5.9.0")

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agocros_ec: Handling EC_CMD_GET_NEXT_EVENT
Heinrich Schuchardt [Mon, 9 Nov 2020 20:34:25 +0000 (21:34 +0100)]
cros_ec: Handling EC_CMD_GET_NEXT_EVENT

With commit 690079767803 ("cros_ec: Support keyboard scanning with
EC_CMD_GET_NEXT_EVENT") check_for_keys() tries to read keyboard
strokes using EC_CMD_GET_NEXT_EVENT. But the sandbox driver does
not understand this command. We need to reply with
-EC_RES_INVALID_COMMAND to force check_for_keys() to fall back to
use EC_CMD_MKBP_STATE. Currently the driver prints

    ** Unknown EC command 0x67

in this case. With the patch the message is suppressed.

In a future patch we should upgrade the sandbox driver to provide
EC_CMD_GET_NEXT_EVENT support.

Fixes: 690079767803 ("cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocros_ec: Increase command timeout for flash erase
Simon Glass [Mon, 9 Nov 2020 14:14:44 +0000 (07:14 -0700)]
cros_ec: Increase command timeout for flash erase

Erasing the flash can take over a second on some devices and the EC is
not responsive during this time. Update the timeout to 5 seconds to cope
with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Correct collection of EC hash
Simon Glass [Mon, 9 Nov 2020 14:14:43 +0000 (07:14 -0700)]
cros_ec: Correct collection of EC hash

The EC now requires that the offset field be set correctly when checking
on hash status. Update the code to handle this. Use the same message
struct in both functions to reduce stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Add a Series-patchwork-url option
Simon Glass [Tue, 3 Nov 2020 20:54:16 +0000 (13:54 -0700)]
patman: Add a Series-patchwork-url option

Add a commit tag to allow the Patchwork URL to be specified in a commit.
This can be handy for when you submit code to multiple projects but don't
want to use the -p option.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Add a setting for the Patchwork URL
Simon Glass [Tue, 3 Nov 2020 20:54:15 +0000 (13:54 -0700)]
patman: Add a setting for the Patchwork URL

Add an argument to allow specifying the the patchwork URL. This also adds
this feature to the settings file, either globally, or on a per-project
basis.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Allow specifying the patchwork URL
Simon Glass [Tue, 3 Nov 2020 20:54:14 +0000 (13:54 -0700)]
patman: Allow specifying the patchwork URL

Add a new argument to allow the URL of the patchwork server to be
speciified. For now this is hard-coded in the main file, but future
patches will move it to the settings file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Update defaults in subparsers
Simon Glass [Tue, 3 Nov 2020 20:54:13 +0000 (13:54 -0700)]
patman: Update defaults in subparsers

At present values from the settings file are only applied to the main
parser. With the new parser structure this means that some settings are
ignored.

Update the implementation to set defaults across the main parser and all
subparsers. Also fix up the comments, since ArgumentParser is being used
now.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Correct Change-Ids error message args
Simon Glass [Tue, 3 Nov 2020 20:54:11 +0000 (13:54 -0700)]
patman: Correct Change-Ids error message args

The arguments of this error are incorrectly formatted. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Refactor how the default subcommand works
Simon Glass [Tue, 3 Nov 2020 20:54:10 +0000 (13:54 -0700)]
patman: Refactor how the default subcommand works

At present patman tries to assume a default subcommand of 'send', to
maintain backwards compatibility. However it does not cope with
arguments added to the default command, so for example 'patman -t'
does not work.

Update the logic to handle this. Also update the CC command to use 'send'
explicitly, since otherwise patman gets confused with the patch-filename
argument.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-2021-01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 14 Nov 2020 14:47:33 +0000 (09:47 -0500)]
Merge tag 'efi-2021-01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc3

A part of the EFI_TCG2_PROTOCOL is implemented.
A unit test is supplied.

The following bugs are fixed:

* incorrect buffer size in efi_file_setinfo() leading to creash in SCT
* a crash in UEFI selftest on the sandbox due to removed drivers
* missing newlines in log message for the UEFI RNG driver

3 years agoefi_selftest: provide unit test for the EFI_TCG2_PROTOCOL
Heinrich Schuchardt [Thu, 12 Nov 2020 18:53:10 +0000 (19:53 +0100)]
efi_selftest: provide unit test for the EFI_TCG2_PROTOCOL

Provide a minimal test for the EFI_TCG2_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: Add basic EFI_TCG2_PROTOCOL support
Ilias Apalodimas [Wed, 11 Nov 2020 09:18:11 +0000 (11:18 +0200)]
efi_loader: Add basic EFI_TCG2_PROTOCOL support

Since U-boot EFI implementation is getting richer it makes sense to
add support for EFI_TCG2_PROTOCOL taking advantage of any hardware TPM
available on the device.

This is the initial implementation of the protocol which only adds
support for GetCapability(). It's limited in the newer and safer
TPMv2 devices.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotpm: Add some headers from the spec
Ilias Apalodimas [Wed, 11 Nov 2020 09:18:10 +0000 (11:18 +0200)]
tpm: Add some headers from the spec

A following patch introduces EFI_TCG2_PROTOCOL.
Add the required TPMv2 headers to support it.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: incorrect buffer size in efi_file_setinfo()
Heinrich Schuchardt [Tue, 10 Nov 2020 06:24:16 +0000 (07:24 +0100)]
efi_loader: incorrect buffer size in efi_file_setinfo()

When copying a string with must allocate a byte for the terminating '\0' in
the target buffer.

Fixes: fbe4c7df0087 ("efi_loader: enable file SetInfo()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: Add missing newline to log_{err,warning}
Paulo Alcantara [Fri, 6 Nov 2020 16:52:43 +0000 (13:52 -0300)]
efi_loader: Add missing newline to log_{err,warning}

Add missing newline to log messages in efi_rng_register() otherwise
something like below would be shown

Scanning disk virtio-blk#31...
Found 2 disks
Missing RNG device for EFI_RNG_PROTOCOLNo EFI system partition

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: keep devices in ExitBootServices()
Heinrich Schuchardt [Thu, 12 Nov 2020 20:26:28 +0000 (21:26 +0100)]
efi_selftest: keep devices in ExitBootServices()

When calling ExitBootServices during out unit tests we should not detach
devices as we need console output for runtime tests.

Fixes: 529441ca89b1 ("efi_loader: Disable devices before handing over control")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agorockchip: Pinebook Pro: Fix USB
Peter Robinson [Tue, 10 Nov 2020 10:09:06 +0000 (10:09 +0000)]
rockchip: Pinebook Pro: Fix USB

Improve USB config so keyboard and USB-A ports work.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
3 years agorockchip: Enable BINMAN for boards enable SPL_OPTEE
Kever Yang [Tue, 10 Nov 2020 03:43:32 +0000 (11:43 +0800)]
rockchip: Enable BINMAN for boards enable SPL_OPTEE

Rockchip has many 32bit SoCs and some of them are support SPL_OPTEE now,
only boards with SPL_OPTEE support can fit BINMAN well, other boards
will fail at initr_binman() in U-Boot proper after below patch,
eg. rv1108 board.
    83187546ae binman: Support multiple images in the library

Fixes: 79030a4861 ("rockchip: Add Single boot image (with binman, pad_cat)")
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rockpro64: fix boot from SPI flash on spi1
Hugh Cole-Baker [Sun, 8 Nov 2020 14:00:23 +0000 (14:00 +0000)]
rockchip: rockpro64: fix boot from SPI flash on spi1

Commit c4cea2bbf995 ("rockchip: Enable building a SPI ROM image on bob")
added an alias spi1 referring to spi@ff1d0000, however there was already
an alias spi0 referring to the same node in rockpro64's u-boot.dtsi, and
having both aliases present broke booting from SPI flash for this board.

Remove the spi0 alias, set the default bus for SPI flash to 1, and
enable support for numbered aliases in SPL so that it uses the same bus
numbering as U-Boot proper. This fixes booting from U-Boot in SPI flash
on the rockpro64 board.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Fixes: c4cea2bbf995 ("rockchip: Enable building a SPI ROM image on bob")
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agovideo: rockchip: Restrict EDP, VOP, MIPI files to GPL-2.0
Alper Nebi Yasak [Thu, 22 Oct 2020 19:43:13 +0000 (22:43 +0300)]
video: rockchip: Restrict EDP, VOP, MIPI files to GPL-2.0

These files have a lot of code in common with their counterparts in
coreboot, especially in their earlier revisions:

                  U-Boot                  |                  coreboot
    --------------------------------------|--------------------------------------------
    drivers/video/rockchip/:              | src/soc/rockchip/:
    - rk_edp.c          (GPL-2.0+)        | - common/edp.c          (GPL-2.0-only)
       "                                  | - rk3288/display.c      (GPL-2.0-only)
       "                                  | - rk3399/display.c      (GPL-2.0-only)
    - rk_hdmi.h         (GPL-2.0+)        | (none)
    - rk_hdmi.c         (GPL-2.0+)        | - rk3288/hdmi.c         (GPL-2.0-or-later)
    - rk3288_hdmi.c     (GPL-2.0+)        | - rk3288/hdmi.c         (GPL-2.0-or-later)
    - rk3399_hdmi.c     (GPL-2.0+)        | (none)
    - rk_mipi.h         (GPL-2.0+)        | (none)
    - rk_mipi.c         (GPL-2.0+)        | - rk3399/mipi.c         (GPL-2.0-only)
    - rk3288_mipi.c     (GPL-2.0+)        | - rk3399/mipi.c         (GPL-2.0-only)
    - rk3399_mipi.c     (GPL-2.0+)        | - rk3399/mipi.c         (GPL-2.0-only)
    - rk_lvds.c         (GPL-2.0+)        | (none)
    - rk_vop.h          (GPL-2.0+)        | (none)
    - rk_vop.c          (GPL-2.0+)        | - common/vop.c          (GPL-2.0-only)
    - rk3288_vop.c      (GPL-2.0+)        | - common/vop.c          (GPL-2.0-only)
    - rk3399_vop.c      (GPL-2.0+)        | (none)
                                          |
    arch/arm/include/asm/arch-rockchip/:  | src/soc/rockchip/*/include/soc/*:
    - edp_rk3288.h      (GPL-2.0+)        | - common/.../edp.h      (GPL-2.0-only)
       "                                  | - rk3288/.../display.h  (GPL-2.0-only)
       "                                  | - rk3399/.../display.h  (GPL-2.0-only)
    - vop_rk3288.h      (GPL-2.0+)        | - common/.../vop.h      (GPL-2.0-only)

Restrict the licenses to match coreboot's so that changes from coreboot
can be imported to U-Boot as necessary. HDMI files are already 2.0+
there and rk_lvds.c has no counterpart, so keep them as is.

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Eric Gao <eric.gao@rock-chips.com>
Cc: Jacob Chen <jacob-chen@iotwrt.com>
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: gru: Allow setting up clocks in U-Boot proper
Alper Nebi Yasak [Tue, 27 Oct 2020 21:15:11 +0000 (00:15 +0300)]
rockchip: gru: Allow setting up clocks in U-Boot proper

Commit fe974716326c ("rockchip: rk3288: Allow setting up clocks in
U-Boot proper") fixes some clock issues when chainloading U-Boot on
rk3288 chromebooks. Part of that change is still available in veyron's
board_early_init_r() function. Since chain-loading U-Boot proper from
vendor firmware is possible on gru boards as well, do the same thing for
them too.

On rk3399, this needs to detect whether SPL was run via handoff, so
enable that and bloblist kconfigs it needs for chromebook_bob.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: rk3399: Init clocks in U-Boot proper if SPL was not run
Alper Nebi Yasak [Tue, 27 Oct 2020 21:15:10 +0000 (00:15 +0300)]
rockchip: rk3399: Init clocks in U-Boot proper if SPL was not run

It's possible to chainload U-Boot proper from the vendor firmware in
rk3399 chromebooks, but the way the vendor firmware sets up clocks is
somehow different than what U-Boot expects. This causes the display to
stay devoid of content even though vidconsole claims to work (with
patches in process of being upstreamed).

This is meant to be a rk3399 version of commit d3cb46aa8c41 ("rockchip:
Init clocks again when chain-loading") which can detect the discrepancy,
but this patch instead checks whether SPL (and therefore the clock init)
was run via the handoff functionality and runs the init if it was not.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoARM: dts: meson-sm1: add u-boot specific MMC controller compatible
Neil Armstrong [Tue, 10 Nov 2020 23:22:11 +0000 (08:22 +0900)]
ARM: dts: meson-sm1: add u-boot specific MMC controller compatible

In order to enable the Amlogic SM1 MMC controller fix, we need to add a u-boot specific
MMC controller compatible.

This adds a new meson-sm1-u-boot.dtsi and reworks the other -u-boot.dtsi
to use this for SM1 based boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agommc: meson-gx: change clock phase value on SM1 SoCs
Neil Armstrong [Tue, 10 Nov 2020 23:22:10 +0000 (08:22 +0900)]
mmc: meson-gx: change clock phase value on SM1 SoCs

Amlogic SM1 SoCs doesn't work over 50MHz. When phase sets to 270', it's
working fine over 50MHz on Amlogic SM1 SoCs.
Since Other Amlogic SoCs doens't report an issue, phase value is using
to 180' by default.

To distinguish which value is used adds an u-boot only sm1 compatible.

In future, it needs to find what value is a proper about each SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
3 years agommc: meson-gx: move arch header to local header
Neil Armstrong [Tue, 10 Nov 2020 23:22:09 +0000 (08:22 +0900)]
mmc: meson-gx: move arch header to local header

Move the asm/arch-meson/sd_emmc.h to a local meson_gx_mmc.h,
remove the useless if/then and fix the meson_gx_mmc.c include.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: mach-meson: update SoC IDs
Neil Armstrong [Mon, 9 Nov 2020 13:30:01 +0000 (14:30 +0100)]
ARM: mach-meson: update SoC IDs

Update From Linux commits
240051cb833b ("soc: amlogic: meson-gx-socinfo: Add A1 and A113L IDs")
1d7c541b8a5b ("soc: amlogic: meson-gx-socinfo: Add S905X3 ID for VIM3L")
fdfc6997bd08 ("soc: amlogic: meson-gx-socinfo: Fix S905D3 ID for VIM3L")
d16d0481e6ba ("soc: amlogic: meson-gx-socinfo: Fix S905X3 and S905D3 ID's")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agovideo: meson: meson_dw_hdmi: fix the potential build warning
Jaehoon Chung [Fri, 6 Nov 2020 05:57:48 +0000 (14:57 +0900)]
video: meson: meson_dw_hdmi: fix the potential build warning

Fix the potential build warning.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agophy: meson-g12a-usb2: fix the potential build warning
Jaehoon Chung [Fri, 6 Nov 2020 05:57:47 +0000 (14:57 +0900)]
phy: meson-g12a-usb2: fix the potential build warning

Fix the potential build warning.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agolibfdt: Fix signedness comparison warnings
Andre Przywara [Fri, 16 Oct 2020 14:42:50 +0000 (15:42 +0100)]
libfdt: Fix signedness comparison warnings

This is a combination of upstream libfdt commits to fix warnings about
comparing signed and unsigned integers:
==========
scripts/dtc/libfdt/fdt.c: In function ‘fdt_offset_ptr’:
scripts/dtc/libfdt/fdt.c:137:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if ((absoffset < offset)
...
==========

For a detailed description of the fixes, see the dtc repo:
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/log/?id=73e0f143b73d808

For this patch the commits between 73e0f143b73d8088 and ca19c3db2bf62000
have been combined and adjusted for the slight differences in U-Boot's
libfdt code base.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>