platform/kernel/u-boot.git
4 years agogpio: Let DM_74X164 be built without CONFIG_SPL_GPIO
Fabio Estevam [Wed, 29 Jan 2020 16:58:02 +0000 (13:58 -0300)]
gpio: Let DM_74X164 be built without CONFIG_SPL_GPIO

Since commit bcee8d6764f9 ("dm: gpio: Allow control of GPIO uclass in SPL")
CONFIG_DM_74X164 is no longer built for mx7dsabresd_defconfig, as
this target does not use CONFIG_SPL_GPIO.

Remove such dependency and let the the 74X164 GPIO driver be built
again.

This restores Ethernet functionality on the imx7-sdb board as the
Ethernet reset PHY comes from a GPIO driven by a 74LV595PW I/O
expander.

Fixes: bcee8d6764f9 ("dm: gpio: Allow control of GPIO uclass in SPL")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Alifer Moraes <alifer.wsdm@gmail.com>
4 years agoimx: imx8mm_evk: spelling in readme file
Marcel Ziswiler [Tue, 28 Jan 2020 13:42:28 +0000 (14:42 +0100)]
imx: imx8mm_evk: spelling in readme file

Minor spelling fix in README file.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoboard: toradex: verdin-imx8mm: add MAINTAINERS
Igor Opaniuk [Tue, 28 Jan 2020 13:42:27 +0000 (14:42 +0100)]
board: toradex: verdin-imx8mm: add MAINTAINERS

Assign Igor Opaniuk as a board maintainer.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoboard: toradex: verdin-imx8mm: add README
Igor Opaniuk [Tue, 28 Jan 2020 13:42:26 +0000 (14:42 +0100)]
board: toradex: verdin-imx8mm: add README

Add README with build steps for U-boot and TF-A for Verdin iMX8M Mini SoM.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoboard: toradex: Add Verdin iMX8M Mini support
Igor Opaniuk [Tue, 28 Jan 2020 13:42:25 +0000 (14:42 +0100)]
board: toradex: Add Verdin iMX8M Mini support

This adds initial minimal support for the Toradex Verdin iMX8M Mini Quad
2GB WB IT V1.0A module. They are now strapped to boot from eFuses which
are factory fused to properly boot from their on-module eMMC. U-Boot
supports booting from the on-module eMMC only, SDP support is disabled
for now due to missing i.MX 8M Mini USB support.

Functionality wise the following is known to be working:
- eMMC, 8-bit and 4-bit MMC/SD card slots
- Ethernet
- GPIOs
- I2C

Boot sequence is:
SPL ---> ATF (TF-A) ---> U-boot proper

ATF, U-boot proper and u-boot.dtb images are packed into a FIT image,
loaded by SPL.

Boot:
U-Boot SPL 2020.01-00187-gd411d164e5 (Jan 26 2020 - 04:47:26 +0100)
Normal Boot
Trying to boot from MMC1
NOTICE:  Configuring TZASC380
NOTICE:  RDC off
NOTICE:  BL31: v2.0(release):rel_imx_4.14.98_2.3.0-0-g09c5cc994-dirty
NOTICE:  BL31: Built : 01:11:41, Jan 25 2020
NOTICE:  sip svc init

U-Boot 2020.01-00187-gd411d164e5 (Jan 26 2020 - 04:47:26 +0100)

CPU:   Freescale i.MX8MMQ rev1.0 at 0 MHz
Reset cause: POR
DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.0A, Serial#
 06535149
Net:   eth0: ethernet@30be0000
Hit any key to stop autoboot:  0
Verdin iMX8MM #

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agotoradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support
Marcel Ziswiler [Tue, 28 Jan 2020 13:42:24 +0000 (14:42 +0100)]
toradex: tdx-cfg-block: add Verdin iMX8M Mini/Nano support

Add support for storing configuration for Verdin iMX8M Mini and
Nano SoMs in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agotoradex: tdx-cfg-block: add Apalis iMX8X support
Marcel Ziswiler [Tue, 28 Jan 2020 13:42:23 +0000 (14:42 +0100)]
toradex: tdx-cfg-block: add Apalis iMX8X support

Add support for storing configuration for Apalis iMX8X SoM
in Toradex config block.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoarm: dts: imx8mm-pinfunc: sync latest linux-next pin func header
Marcel Ziswiler [Tue, 28 Jan 2020 13:42:22 +0000 (14:42 +0100)]
arm: dts: imx8mm-pinfunc: sync latest linux-next pin func header

Synchronise with latest linux-next kernel pin func header file.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoMerge branch '2020-02-07-master-imports'
Tom Rini [Sat, 8 Feb 2020 00:04:23 +0000 (19:04 -0500)]
Merge branch '2020-02-07-master-imports'

- 2 FAT fixes.
- MediaTek ethernet support improvement.
- Initial Cortina Access CAxxxx family support.
- Correct return value of do_gpio() and so gpio shell command.

4 years agoboard: presidio-asic: Add basic G3 engr. development board support
Alex Nemirovsky [Thu, 30 Jan 2020 20:34:59 +0000 (12:34 -0800)]
board: presidio-asic: Add basic G3 engr. development board support

Add basic Presidio G3 engineering board support

Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agoserial: serial_cortina: add UART DM driver for CAxxxx SoCs
Jason Li [Thu, 30 Jan 2020 20:34:58 +0000 (12:34 -0800)]
serial: serial_cortina: add UART DM driver for CAxxxx SoCs

Add serial UART driver support for all Cortina Access
CAxxxx family of SoCs.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Jason Li <jason.li@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agowatchdog: cortina_wdt: add support for HW WDT on CAxxxx SoCs
Jason Li [Thu, 30 Jan 2020 20:34:57 +0000 (12:34 -0800)]
watchdog: cortina_wdt: add support for HW WDT on CAxxxx SoCs

Add support for hardware watchdog timer on all Cortina Access
CAxxxx family of SoCs.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Jason Li <jason.li@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agogpio: cortina_gpio: add DM_GPIO driver for CAxxxx SoCs
Jason Li [Thu, 30 Jan 2020 20:34:56 +0000 (12:34 -0800)]
gpio: cortina_gpio: add DM_GPIO driver for CAxxxx SoCs

DM_GPIO based GPIO controller driver for CAxxxx SoCs.
This driver support multiple CPU architectures and
Cortina Access SoC platforms.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Jason Li <jason.li@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agogpio: do not include <asm/arch/gpio.h> for Cortina CAxxxx SoCs
Jason Li [Thu, 30 Jan 2020 20:34:55 +0000 (12:34 -0800)]
gpio: do not include <asm/arch/gpio.h> for Cortina CAxxxx SoCs

The Cortina CAxxxx GPIO driver maintains DM_GPIO support
across different CPU ISA in the CAxxxx Soc Family; Not just ARM.
Therefore, it is not desirable to split out and maintain separete
gpio header file for each CPU architecture.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Jason Li <jason.li@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agoMAINTAINERS, git-mailrc: cortina: add Custodian for Cortina Access Inc.
Alex Nemirovsky [Thu, 30 Jan 2020 20:34:54 +0000 (12:34 -0800)]
MAINTAINERS, git-mailrc: cortina: add Custodian for Cortina Access Inc.

Assign Alex Nemirovsky as custodian for all
Cortina Access (CA) for ARM and MIPS based SoCs.

Currently Cortina Access CAxxxx family of SoCs support both
ARM and MIPS ISA.  Drivers have cross platform support for
both architectures.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
4 years agompc8xx: Expose show_regs()
Tom Rini [Wed, 29 Jan 2020 16:07:19 +0000 (11:07 -0500)]
mpc8xx: Expose show_regs()

To match the other PowerPC platforms the function show_regs() must not
be marked static but instead be an exposed global function.

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Christophe Leroy <christophe.leroy@c-s.fr>
4 years agocmd/elf.c: Add SPDX tag
Tom Rini [Wed, 29 Jan 2020 16:03:34 +0000 (11:03 -0500)]
cmd/elf.c: Add SPDX tag

Based on reading the text of the license comment this appears to be
the BSD-2-Clause license but with an imperfect word match as
BSD-2-Clause was not (as far as I recall) a common license choice at the
time the code was written.

Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoconfigs: mediatek: enable mt7622 ethernet support
MarkLee [Tue, 21 Jan 2020 11:32:00 +0000 (19:32 +0800)]
configs: mediatek: enable mt7622 ethernet support

This patch enable mt7622 ethernet support in its defconfig

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
4 years agoeth: mtk-eth: aarch64: fix build warnings on ethernet-driver
Frank Wunderlich [Fri, 31 Jan 2020 09:23:29 +0000 (10:23 +0100)]
eth: mtk-eth: aarch64: fix build warnings on ethernet-driver

building mtk ethernet driver for aarch64 (mt7622) results
in warnings/errors

  "error: cast from pointer to integer of different size"

Fixes: 23f17164d9 ("ethernet: MediaTek: add ethernet driver for MediaTek ARM-based SoCs")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agoarm: dts: mediatek: add ethernet and sgmii dts node for mt7622
MarkLee [Tue, 21 Jan 2020 11:31:59 +0000 (19:31 +0800)]
arm: dts: mediatek: add ethernet and sgmii dts node for mt7622

This patch add eth and sgmii dts node for mt7622 to support ethernet

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
4 years agoeth: mtk-eth: add mt7622 support in mediatek eth driver
MarkLee [Tue, 21 Jan 2020 11:31:58 +0000 (19:31 +0800)]
eth: mtk-eth: add mt7622 support in mediatek eth driver

This patch add mt7622 support in mediatek eth driver

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
4 years agoeth: mtk-eth: add sgmii mode support in mediatek eth driver
MarkLee [Tue, 21 Jan 2020 11:31:57 +0000 (19:31 +0800)]
eth: mtk-eth: add sgmii mode support in mediatek eth driver

This patch add sgmii init part for the mediatek SoC that
support sgmii mode. It is a must for mt7622.

Signed-off-by: MarkLee <Mark-MC.Lee@mediatek.com>
4 years agofat: write: adjust data written in each partial write
Marek Szyprowski [Mon, 2 Dec 2019 11:11:14 +0000 (12:11 +0100)]
fat: write: adjust data written in each partial write

The code for handing file overwrite incorrectly calculated the amount of
data to write when writing to the last non-cluster aligned chunk. Fix
this by ensuring that no more data than the 'filesize' is written to disk.
While touching min()-based calculations, change it to type-safe min_t()
function.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This patch finally fixes the issue revealed by the test script from the
previous patch. The correctness of the change has been also verified by
the following additional test scripts:

--->8-fat_test2.sh---
#!/bin/bash
make sandbox_defconfig
make
dd if=/dev/zero of=/tmp/10M.img bs=1024 count=10k
mkfs.vfat -v /tmp/10M.img
cat >/tmp/cmds <<EOF
x
host bind 0 /tmp/10M.img
fatls host 0
mw 0x1000000 0x0a434241 0x1000 # "ABC\n"
mw 0x1100000 0x0a464544 0x8000 # "DEF\n"
fatwrite host 0 0x1000000 file0001.raw 0x1000
fatwrite host 0 0x1000000 file0002.raw 0x1000
fatwrite host 0 0x1000000 file0003.raw 0x1000
fatwrite host 0 0x1000000 file0004.raw 0x1000
fatwrite host 0 0x1000000 file0005.raw 0x1000
fatrm host 0 file0002.raw
fatrm host 0 file0004.raw
fatls host 0
fatwrite host 0 0x1100000 file0007.raw 0x2000
fatwrite host 0 0x1100000 file0007.raw 0x1f00
reset
EOF
./u-boot </tmp/cmds
#verify
rm -r /tmp/result /tmp/model
mkdir /tmp/result
mkdir /tmp/model
yes ABC | head -c 4096 >/tmp/model/file0001.raw
yes ABC | head -c 4096 >/tmp/model/file0003.raw
yes ABC | head -c 4096 >/tmp/model/file0005.raw
yes DEF | head -c 7936 >/tmp/model/file0007.raw
mcopy -n -i /tmp/10M.img ::file0001.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0003.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0005.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0007.raw /tmp/result
hd /tmp/10M.img
if diff -urq /tmp/model /tmp/result
then
echo Test okay
else
echo Test fail
fi
--->8-fat_test3.sh---
#!/bin/bash
make sandbox_defconfig
make
dd if=/dev/zero of=/tmp/10M.img bs=1024 count=10k
mkfs.vfat -v /tmp/10M.img
cat >/tmp/cmds <<EOF
x
host bind 0 /tmp/10M.img
fatls host 0
mw 0x1000000 0x0a434241 0x1000 # "ABC\n"
mw 0x1100000 0x0a464544 0x8000 # "DEF\n"
fatwrite host 0 0x1000000 file0001.raw 0x1000
fatwrite host 0 0x1000000 file0002.raw 0x1000
fatwrite host 0 0x1000000 file0003.raw 0x1000
fatwrite host 0 0x1000000 file0004.raw 0x1000
fatwrite host 0 0x1000000 file0005.raw 0x1000
fatrm host 0 file0002.raw
fatrm host 0 file0004.raw
fatls host 0
fatwrite host 0 0x1100000 file0007.raw 0x2000
fatwrite host 0 0x1100000 file0007.raw 0x2100
reset
EOF
./u-boot </tmp/cmds
#verify
rm -r /tmp/result /tmp/model
mkdir /tmp/result
mkdir /tmp/model
yes ABC | head -c 4096 >/tmp/model/file0001.raw
yes ABC | head -c 4096 >/tmp/model/file0003.raw
yes ABC | head -c 4096 >/tmp/model/file0005.raw
yes DEF | head -c 8448 >/tmp/model/file0007.raw
mcopy -n -i /tmp/10M.img ::file0001.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0003.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0005.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0007.raw /tmp/result
hd /tmp/10M.img
if diff -urq /tmp/model /tmp/result
then
echo Test okay
else
echo Test fail
fi
--->8-fat_test4.sh---
#!/bin/bash
make sandbox_defconfig
make
dd if=/dev/zero of=/tmp/10M.img bs=1024 count=10k
mkfs.vfat -v /tmp/10M.img
cat >/tmp/cmds <<EOF
x
host bind 0 /tmp/10M.img
fatls host 0
mw 0x1000000 0x0a434241 0x1000 # "ABC\n"
mw 0x1100000 0x0a464544 0x8000 # "DEF\n"
mw 0x1200000 0x0a494847 0x8000 # "GHI\n"
fatwrite host 0 0x1000000 file0001.raw 0x1000
fatwrite host 0 0x1000000 file0002.raw 0x1000
fatwrite host 0 0x1000000 file0003.raw 0x1000
fatwrite host 0 0x1000000 file0004.raw 0x1000
fatwrite host 0 0x1000000 file0005.raw 0x1000
fatrm host 0 file0002.raw
fatrm host 0 file0004.raw
fatls host 0
fatwrite host 0 0x1100000 file0007.raw 0x900
fatwrite host 0 0x1200000 file0007.raw 0x900 0x900
fatwrite host 0 0x1100000 file0007.raw 0x900 0x1200
fatwrite host 0 0x1200000 file0007.raw 0x900 0x1b00
reset
EOF
./u-boot </tmp/cmds
#verify
rm -r /tmp/result /tmp/model
mkdir /tmp/result
mkdir /tmp/model
yes ABC | head -c 4096 >/tmp/model/file0001.raw
yes ABC | head -c 4096 >/tmp/model/file0003.raw
yes ABC | head -c 4096 >/tmp/model/file0005.raw
yes DEF | head -c 2304 >/tmp/model/file0007.raw
yes GHI | head -c 2304 >>/tmp/model/file0007.raw
yes DEF | head -c 2304 >>/tmp/model/file0007.raw
yes GHI | head -c 2304 >>/tmp/model/file0007.raw
mcopy -n -i /tmp/10M.img ::file0001.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0003.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0005.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0007.raw /tmp/result
hd /tmp/10M.img
if diff -urq /tmp/model /tmp/result
then
echo Test okay
else
echo Test fail
fi
--->8---
Feel free to prepare a proper sandbox/py_test based tests based on
the provided test scripts.

4 years agofat: write: fix broken write to fragmented files
Marek Szyprowski [Mon, 2 Dec 2019 11:11:13 +0000 (12:11 +0100)]
fat: write: fix broken write to fragmented files

The code for handing file overwrite incorrectly assumed that the file on
disk is always contiguous. This resulted in corrupting disk structure
every time when write to existing fragmented file happened. Fix this
by adding proper check for cluster discontinuity and adjust chunk size
on each partial write.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This patch partially fixes the issue revealed by the following test
script:

--->8-fat_test1.sh---
#!/bin/bash
make sandbox_defconfig
make
dd if=/dev/zero of=/tmp/10M.img bs=1024 count=10k
mkfs.vfat -v /tmp/10M.img
cat >/tmp/cmds <<EOF
x
host bind 0 /tmp/10M.img
fatls host 0
mw 0x1000000 0x0a434241 0x1000 # "ABC\n"
mw 0x1100000 0x0a464544 0x8000 # "DEF\n"
fatwrite host 0 0x1000000 file0001.raw 0x1000
fatwrite host 0 0x1000000 file0002.raw 0x1000
fatwrite host 0 0x1000000 file0003.raw 0x1000
fatwrite host 0 0x1000000 file0004.raw 0x1000
fatwrite host 0 0x1000000 file0005.raw 0x1000
fatrm host 0 file0002.raw
fatrm host 0 file0004.raw
fatls host 0
fatwrite host 0 0x1100000 file0007.raw 0x4000
fatwrite host 0 0x1100000 file0007.raw 0x4000
reset
EOF
./u-boot </tmp/cmds
#verify
rm -r /tmp/result /tmp/model
mkdir /tmp/result
mkdir /tmp/model
yes ABC | head -c 4096 >/tmp/model/file0001.raw
yes ABC | head -c 4096 >/tmp/model/file0003.raw
yes ABC | head -c 4096 >/tmp/model/file0005.raw
yes DEF | head -c 16384 >/tmp/model/file0007.raw
mcopy -n -i /tmp/10M.img ::file0001.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0003.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0005.raw /tmp/result
mcopy -n -i /tmp/10M.img ::file0007.raw /tmp/result
hd /tmp/10M.img
if diff -urq /tmp/model /tmp/result
then
echo Test okay
else
echo Test fail
fi
--->8---

Overwritting a discontiguous test file (file0007.raw) no longer causes
corruption to file0003.raw, which's data lies between the chunks of the
test file. The amount of data written to disk is still incorrect, what
causes damage to the file (file0005.raw), which's data lies next to the
test file. This will be fixed by the next patch.

Feel free to prepare a proper sandbox/py_test based tests based on the
provided test scripts.

4 years agocmd: gpio: Correct do_gpio() return value
Luka Kovacic [Sun, 5 Jan 2020 19:10:56 +0000 (20:10 +0100)]
cmd: gpio: Correct do_gpio() return value

Use the correct return value in function do_gpio() and update
commands documentation with the return values from command_ret_t enum.

CMD_RET_SUCCESS is returned on command success and CMD_RET_FAILURE is
returned on command failure.

The command was returning the pin value, which caused confusion when
debugging (#define DEBUG).

Signed-off-by: Luka Kovacic <luka.kovacic@sartura.hr>
Tested-by: Robert Marko <robert.marko@sartura.hr>
4 years agoazure/gitlab: Update to Docker to have SDL2 available
Tom Rini [Fri, 7 Feb 2020 16:47:28 +0000 (11:47 -0500)]
azure/gitlab: Update to Docker to have SDL2 available

Update to a newer Docker image that contains SDL2 libraries as required
by recent Sandbox changes.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoazure: Use our own GRUB binaries
Tom Rini [Fri, 7 Feb 2020 16:45:55 +0000 (11:45 -0500)]
azure: Use our own GRUB binaries

Use the same logic from 24df1b14f3ab to use our own GRUB binaries in
Azure pipelines as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogitlab: use our own GRUB
Heinrich Schuchardt [Thu, 19 Dec 2019 12:30:32 +0000 (13:30 +0100)]
gitlab: use our own GRUB

Up to now we have been relying on openSUSE repositories for GRUB on arm and
arm64 though we have included GRUB in our Docker image.

Use the GRUB included in our Docker image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agox86: coral: Enable TPM
Simon Glass [Thu, 6 Feb 2020 16:55:05 +0000 (09:55 -0700)]
x86: coral: Enable TPM

Enable TPM2 so that we can use cr50.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotpm: Add a driver for H1/Cr50
Simon Glass [Thu, 6 Feb 2020 16:55:04 +0000 (09:55 -0700)]
tpm: Add a driver for H1/Cr50

H1 is a Google security chip present in recent Chromebooks, Pixel phones
and other devices. Cr50 is the name of the software that runs on H1 in
Chromebooks.

This chip is used to handle TPM-like functionality and also has quite a
few additional features.

Add a driver for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotpm: Add more TPM2 definitions
Simon Glass [Thu, 6 Feb 2020 16:55:03 +0000 (09:55 -0700)]
tpm: Add more TPM2 definitions

Add definitions for access and status.

Need to drop the mixed case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: coral: Add I2C and TPM device-tree definitions
Simon Glass [Thu, 6 Feb 2020 16:55:02 +0000 (09:55 -0700)]
x86: coral: Add I2C and TPM device-tree definitions

Add nodes to the device tree for Cr50 and other available I2C ports. Also
enable the ACPI interrupt driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Add support for ACPI general-purpose events
Simon Glass [Thu, 6 Feb 2020 16:55:01 +0000 (09:55 -0700)]
x86: Add support for ACPI general-purpose events

ACPI GPEs are used to signal interrupts from peripherals that are accessed
via ACPI. In U-Boot these are modelled as interrupts using a separate
interrupt controller. Configuration is via the device tree.

Add a simple driver for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: irq: Add support for requesting interrupts
Simon Glass [Thu, 6 Feb 2020 16:55:00 +0000 (09:55 -0700)]
dm: irq: Add support for requesting interrupts

At present driver model supports the IRQ uclass but there is no way to
request a particular interrupt for a driver.

Add a mechanism, similar to clock and reset, to read the interrupts
required by a device from the device tree and to request those interrupts.

U-Boot itself does not have interrupt-driven handlers, so just provide a
means to read and clear an interrupt. This can be useful to handle
peripherals which must use an interrupt to determine when data is
available, for example.

Bring over the basic binding file as well, from Linux v5.4. Note that the
older binding is not supported in U-Boot; the newer 'special form' must be
used.

Add a simple test of the new functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: itss: Add of-platdata support
Simon Glass [Thu, 6 Feb 2020 16:54:59 +0000 (09:54 -0700)]
x86: itss: Add of-platdata support

Allow this driver to be used in TPL by setting up the interrupt type
correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Give each driver an IRQ type
Simon Glass [Thu, 6 Feb 2020 16:54:58 +0000 (09:54 -0700)]
x86: Give each driver an IRQ type

Add an IRQ type to each driver and use irq_first_device_type() to find
and probe the correct one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: irq: Add support for interrupt controller types
Simon Glass [Thu, 6 Feb 2020 16:54:57 +0000 (09:54 -0700)]
dm: irq: Add support for interrupt controller types

There can be different types of interrupt controllers in a system and some
drivers may need to distinguish between these. In general this can be
handled using the device tree by adding the interrupt information to
device nodes.

However on x86 devices we have interrupt controllers which are not tied
to any particular device and not really used in U-Boot. These still need
to be inited, so a convenient method is to give each controller a type
and allow a particular controller type to be probed.

Add support for this in sandbox along with a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: remove the new bland line at EOF of test/dm/irq.c]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: coral: Update i2c and rtc status
Simon Glass [Thu, 6 Feb 2020 16:54:56 +0000 (09:54 -0700)]
x86: coral: Update i2c and rtc status

These are actually working correctly, so update the status.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: apl: Drop the I2C config in FSP-S
Simon Glass [Thu, 6 Feb 2020 16:54:55 +0000 (09:54 -0700)]
x86: apl: Drop the I2C config in FSP-S

This config is not actually used here and in U-Boot it seems better to set
this using the device tree for each individual controller. The monolithic
config of the FSP-S is only necessary if the FSP is actually configuring
something, but here it is not.

The FSP-S does enable/disable the various I2C ports. It might be nice to
handle this using the okay/disabled property of each port, but that can be
considered later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: apl: Use the clock driver
Simon Glass [Thu, 6 Feb 2020 16:54:54 +0000 (09:54 -0700)]
x86: apl: Use the clock driver

Enable the Intel clock driver and modify coral's device tree to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Add a clock driver for Intel devices
Simon Glass [Thu, 6 Feb 2020 16:54:53 +0000 (09:54 -0700)]
x86: Add a clock driver for Intel devices

So far we have avoided adding a clock driver for Intel devices. But the
Designware I2C driver needs a different clock (133MHz) on Intel devices
than on others (166MHz). Add a simple driver that provides this
information.

This driver can be expanded later as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotegra: i2c: Change driver to use helper function
Simon Glass [Thu, 6 Feb 2020 16:54:52 +0000 (09:54 -0700)]
tegra: i2c: Change driver to use helper function

Now that we have uclass_first_device_drvdata(), use it from the I2C driver
to reduce code duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Change syscon to use helper function
Simon Glass [Thu, 6 Feb 2020 16:54:51 +0000 (09:54 -0700)]
dm: core: Change syscon to use helper function

Now that we have uclass_first_device_drvdata(), use it from syscon to
reduce code duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Add a function to find a device by drvdata
Simon Glass [Thu, 6 Feb 2020 16:54:50 +0000 (09:54 -0700)]
dm: core: Add a function to find a device by drvdata

It is sometimes useful to find a device in a uclass using only its driver
data. The driver data often indicates the 'subtype' of the device, e,g,
via its compatible string.

Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Allow iterating devices without uclass_get()
Simon Glass [Thu, 6 Feb 2020 16:54:49 +0000 (09:54 -0700)]
dm: core: Allow iterating devices without uclass_get()

At present we have uclass_foreach_dev() which requires that uclass_get()
be called beforehand to find the uclass. This is good if we suspect that
that function might fail, but often we know that the uclass is available.

Add a new helper which does this uclass_get() automatically, so that only
the uclass ID is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Move P2SB from Apollo Lake to a more generic location
Wolfgang Wallner [Tue, 4 Feb 2020 08:04:56 +0000 (09:04 +0100)]
x86: Move P2SB from Apollo Lake to a more generic location

The Primary to Sideband Bridge (P2SB) is not specific to Apollo Lake, so
move its driver to a common location within arch/x86.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge tag 'efi-2020-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 7 Feb 2020 04:19:27 +0000 (23:19 -0500)]
Merge tag 'efi-2020-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc2

Fix pylint issues in Python based tests.

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Fri, 7 Feb 2020 04:18:42 +0000 (23:18 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

- Gen 5 and Watchdog fixes

4 years agovideo: enable VIDEO_ANSI and all VIDEO_BBP options
Anatolij Gustschin [Tue, 4 Feb 2020 21:43:06 +0000 (22:43 +0100)]
video: enable VIDEO_ANSI and all VIDEO_BBP options

This partially reverts changes by commit 2cc393f32fd9
("video: make BPP and ANSI configs optional") since it
caused issues with other boards (missing LCD console
output on pinebook, x86 platform or sandbox). Enable
all disabled options again and opt out of not supported
color depth in board defconfigs.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Vagrant Cascadian <vagrant@debian.org>
4 years agoconfigs: Resync with savedefconfig
Tom Rini [Thu, 6 Feb 2020 18:42:52 +0000 (13:42 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosandbox: Complete migration away from os_malloc()
Simon Glass [Mon, 3 Feb 2020 14:36:18 +0000 (07:36 -0700)]
sandbox: Complete migration away from os_malloc()

Now that we can use direct access to the system malloc() in sandbox, drop
the remaining uses of os_malloc().

The only one remaining now is for the RAM buffer, which we do want to be
at a known address, so this is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop the inclusion of linux/compat.h in dm.h
Simon Glass [Mon, 3 Feb 2020 14:36:17 +0000 (07:36 -0700)]
dm: core: Drop the inclusion of linux/compat.h in dm.h

Most files don't need this header and it pulls in quite of lots of stuff,
malloc() in particular. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Create a new header file for 'compat' features
Simon Glass [Mon, 3 Feb 2020 14:36:16 +0000 (07:36 -0700)]
dm: core: Create a new header file for 'compat' features

At present dm/device.h includes the linux-compatible features. This
requires including linux/compat.h which in turn includes a lot of headers.
One of these is malloc.h which we thus end up including in every file in
U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
which needs to use the system malloc() in some files.

Move the compatibility features into a separate header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Require users of devres to include the header
Simon Glass [Mon, 3 Feb 2020 14:36:15 +0000 (07:36 -0700)]
dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: Support changing the LCD colour depth
Simon Glass [Mon, 3 Feb 2020 14:36:14 +0000 (07:36 -0700)]
sandbox: Support changing the LCD colour depth

Add a new device-tree property to control the colour depth. At present we
support 16bpp and 32bpp.

While we are here, update the code to use livetree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: sdl: Add an option to double the screen size
Simon Glass [Mon, 3 Feb 2020 14:36:13 +0000 (07:36 -0700)]
sandbox: sdl: Add an option to double the screen size

On high-DPI displays U-Boot's LCD window can look very small. Add a
-K flag to expand it to make things easier to read, while still using
the existing resolution internally.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: sdl: Move to use SDL2
Simon Glass [Mon, 3 Feb 2020 14:36:12 +0000 (07:36 -0700)]
sandbox: sdl: Move to use SDL2

Sandbox currently uses SDL1.2. SDL2 has been around for quite a while and
is widely supported. It has a number of useful features. It seems
appropriate to move sandbox over.

Update the code to use SDL2 instead of SDL1.2.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agogitlab: Disable SDL when building sandbox
Simon Glass [Mon, 3 Feb 2020 14:36:11 +0000 (07:36 -0700)]
gitlab: Disable SDL when building sandbox

I am not sure how to add libsdl2-dev to the gitlab image, so disable
building sandbox with SDL for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sdl: Support waiting for audio to complete
Simon Glass [Mon, 3 Feb 2020 14:36:10 +0000 (07:36 -0700)]
sandbox: sdl: Support waiting for audio to complete

At present when audio stops, any in-progress output is cut off. Fix this
by waiting for output to finish.

Also use booleans for the boolean variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sdl: Improve error handling
Simon Glass [Mon, 3 Feb 2020 14:36:09 +0000 (07:36 -0700)]
sandbox: sdl: Improve error handling

A few errors are not checked. Fix these and use my preferred spelling for
init.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Add comments to the sdl struct
Simon Glass [Mon, 3 Feb 2020 14:36:08 +0000 (07:36 -0700)]
sandbox: Add comments to the sdl struct

Add comments for each struct member. Drop frequency since it is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sound: Handle errors better in sound_beep()
Simon Glass [Mon, 3 Feb 2020 14:36:07 +0000 (07:36 -0700)]
sandbox: sound: Handle errors better in sound_beep()

At present an error does not stop the sound-output loop. This is incorrect
since nothing can be gained by trying to continue. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosound: Add a new stop_play() method
Simon Glass [Mon, 3 Feb 2020 14:36:06 +0000 (07:36 -0700)]
sound: Add a new stop_play() method

At present there is no positive indication that U-Boot has finished
sending sound data. This means that it is not possible to power down an
audio codec, for example. Add a new method that is called once all sound
data has been sent.

Add a new method for this, called when the sound_play() call is done.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Add a new header for the system malloc()
Simon Glass [Mon, 3 Feb 2020 14:36:05 +0000 (07:36 -0700)]
sandbox: Add a new header for the system malloc()

Some files use U-Boot headers but still need to access the system
malloc(). Allow this by creating a new asm/malloc.h which can be used so
long as U-Boot's malloc.h has not been included.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Ensure that long-options array is terminated
Simon Glass [Mon, 3 Feb 2020 14:36:04 +0000 (07:36 -0700)]
sandbox: Ensure that long-options array is terminated

The last member of this array is supposed to be all zeroes according to
the getopt_long() man page. Fix the function to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Drop os_realloc()
Simon Glass [Mon, 3 Feb 2020 14:36:03 +0000 (07:36 -0700)]
sandbox: Drop os_realloc()

Due to recent changes this function is no-longer used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Drop use of special os_malloc() where possible
Simon Glass [Mon, 3 Feb 2020 14:36:02 +0000 (07:36 -0700)]
sandbox: Drop use of special os_malloc() where possible

Some sandbox files are not built with U-Boot headers, so with the renamed
malloc functions there is now no need to use the special os_... allocation
functions to access the system routines. Instead we can just call them
directly.

Update the affected files accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Rename strdup() functions
Simon Glass [Mon, 3 Feb 2020 14:36:01 +0000 (07:36 -0700)]
sandbox: Rename strdup() functions

These functions include calls to a memory-allocation routine and so need
to use the system routine when called from a library.

To preserve access to these functions for libraries that need it, such as
SDL, rename these functions within U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agostring: Allow arch override of strndup() also
Simon Glass [Mon, 3 Feb 2020 14:36:00 +0000 (07:36 -0700)]
string: Allow arch override of strndup() also

At present architectures can override strdup() but not strndup(). Use
the same option for both.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoexports: Add the malloc.h header
Simon Glass [Mon, 3 Feb 2020 14:35:59 +0000 (07:35 -0700)]
exports: Add the malloc.h header

This file should include the malloc.h header since it references malloc().
Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Use a prefix for all allocation functions
Simon Glass [Mon, 3 Feb 2020 14:35:58 +0000 (07:35 -0700)]
sandbox: Use a prefix for all allocation functions

In order to allow use of both U-Boot's malloc() and the C library's
version, set a prefix for the allocation functions so that they can
co-exist.

This is only done for sandbox. For other archs everything remains the
same.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Rename 'free' variable
Simon Glass [Mon, 3 Feb 2020 14:35:57 +0000 (07:35 -0700)]
sandbox: Rename 'free' variable

This name conflicts with our desire to #define free() to something else on
sandbox. Rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agomtd: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:56 +0000 (07:35 -0700)]
mtd: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodma: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:55 +0000 (07:35 -0700)]
dma: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoclk: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:54 +0000 (07:35 -0700)]
clk: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agogpio: Rename free() to rfree()
Simon Glass [Wed, 5 Feb 2020 03:15:17 +0000 (20:15 -0700)]
gpio: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoreset: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:52 +0000 (07:35 -0700)]
reset: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopower-domain: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:51 +0000 (07:35 -0700)]
power-domain: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agomailbox: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:50 +0000 (07:35 -0700)]
mailbox: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agovideo: sandbox: Enable all colour depths
Simon Glass [Mon, 3 Feb 2020 14:35:49 +0000 (07:35 -0700)]
video: sandbox: Enable all colour depths

For sandbox we want to have the maximum possible build coverage, so enable
all colour depths for video.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agovideo: Support truetype fonts on a 32-bit display
Simon Glass [Mon, 3 Feb 2020 14:35:48 +0000 (07:35 -0700)]
video: Support truetype fonts on a 32-bit display

At present only a 16bpp display is supported for Truetype fonts. Add
support for 32bpp also since this is quite common.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: Sort the help options
Simon Glass [Mon, 3 Feb 2020 14:35:47 +0000 (07:35 -0700)]
sandbox: Sort the help options

At present options are presented in essentially random order. It is easier
to browse them if they are sorted into alphabetical order. Adjust the
help function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodoc: dm: debugging: Fix the steps for activating debug
Fabio Estevam [Wed, 29 Jan 2020 17:45:33 +0000 (14:45 -0300)]
doc: dm: debugging: Fix the steps for activating debug

Following the recommendation of adding '#define DEBUG' at the top
of drivers/core/lists.c does not cause the debug messages to be
shown. Change it to '#define LOG_DEBUG' instead, which actually
makes it work as per doc/README.log.

While at it, provide the full path to lists.c to in order to make
the instructions clearer.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodtc: add ability to make nodes conditional on them being referenced
Maxime Ripard [Tue, 21 Jan 2020 10:23:17 +0000 (10:23 +0000)]
dtc: add ability to make nodes conditional on them being referenced

This is needed when importing mainline DTs into U-Boot, as some started
using this /omit-if-no-ref/ tag, so won't compile with U-Boot's current
dtc copy. This is just a cherry-pick of the patch introducing this
feature.
Original commit message from Maxime:
------------------
A number of platforms have a need to reduce the number of DT nodes,
mostly because of two similar constraints: the size of the DT blob, and
the time it takes to parse it.

As the DT is used in more and more SoCs, and by more projects, some
constraints start to appear in bootloaders running from SRAM with an
order of magnitude of 10kB. A typical DT is in the same order of
magnitude, so any effort to reduce the blob size is welcome in such an
environment.

Some platforms also want to reach very fast boot time, and the time it
takes to parse a typical DT starts to be noticeable.

Both of these issues can be mitigated by reducing the number of nodes in
the DT. The biggest provider of nodes is usually the pin controller and
its subnodes, usually one for each valid pin configuration in a given
SoC.

Obviously, a single, fixed, set of these nodes will be used by a given
board, so we can introduce a node property that will tell the DT
compiler to drop the nodes when they are not referenced in the tree, and
as such wouldn't be useful in the targetted system.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: Add command to dump drivers and compatible strings
Sean Anderson [Fri, 17 Jan 2020 19:48:09 +0000 (14:48 -0500)]
cmd: Add command to dump drivers and compatible strings

This adds a subcommand to dm to dump out what drivers are installed, and their
compatible strings. I have found this useful in ensuring that I have the correct
drivers compiled, and that I have put in the correct compatible strings.

Signed-off-by Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agobuildman: Enable buildman on aarch64 hosts
Matthias Brugger [Fri, 17 Jan 2020 09:53:37 +0000 (10:53 +0100)]
buildman: Enable buildman on aarch64 hosts

At kernel.org aarch64 toolchains are published in folder
arm64. Fix the URL for that case, so that we can fetch
toolchains on aarch64 machines.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotpm2: ftpm: A driver for firmware TPM running inside TEE
Thirupathaiah Annapureddy [Mon, 13 Jan 2020 07:34:22 +0000 (23:34 -0800)]
tpm2: ftpm: A driver for firmware TPM running inside TEE

Add a driver for a firmware TPM running inside TEE.

Documentation of the firmware TPM:
https://www.microsoft.com/en-us/research/publication/ftpm-software-implementation-tpm-chip/

Implementation of the firmware TPM:
https://github.com/Microsoft/ms-tpm-20-ref/tree/master/Samples/ARM32-FirmwareTPM

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
4 years agocli: Make the sandbox board_run_command the default
Sean Anderson [Fri, 10 Jan 2020 17:32:19 +0000 (12:32 -0500)]
cli: Make the sandbox board_run_command the default

If CONFIG_CMDLINE=n, common/cli.c calls board_run_command. This fails to
link on most architectures. However, the sandbox architecture has an
implementation which we can use.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agocmd: tpm: add a subcommand device
Philippe Reynes [Thu, 9 Jan 2020 17:45:46 +0000 (18:45 +0100)]
cmd: tpm: add a subcommand device

The command tpm (and tpm2) search the tpm and use it.
On sandbox, there are two tpm (tpm 1.x and tpm 2.0).
So the command tpm and tpm2 are always executed with
the first tpm (tpm 1.x), and the command tpm2 always
fails.

This add a subcommand device to command tpm and
command tpm2. Then the command tpm and tpm2 use
the device selected with the subcommand device.

To be compatible with previous behaviour, if the
subcommand device is not used before a tpm (or tpm2)
command, the device 0 is selected.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agotpm: add a helper to iterate on all tpm devices
Philippe Reynes [Thu, 9 Jan 2020 17:45:45 +0000 (18:45 +0100)]
tpm: add a helper to iterate on all tpm devices

This add a helper for_each_tpm_device that run
through all the tpm (1.x and 2.0) devices.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agoimage: fdt: check "status" of "/reserved-memory" subnodes
Thirupathaiah Annapureddy [Tue, 7 Jan 2020 06:21:42 +0000 (22:21 -0800)]
image: fdt: check "status" of "/reserved-memory" subnodes

boot_fdt_add_mem_rsv_regions() scans the subnodes of
"/reserved-memory" and adds them to reserved lmb regions.
Currently this scanning does not take into "status" property.
Even if the subnode is disabled, it gets added to the
reserved lmb regions.

This patch checks the "status" property before adding it
to reserved lmb regions.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
4 years agotest: Add a way to check each line of console output
Simon Glass [Mon, 27 Jan 2020 15:49:56 +0000 (08:49 -0700)]
test: Add a way to check each line of console output

When writing tests to check the output from commands it is useful to be
able to check the output line by line using an assertion. Add helper
macros to support this and to check that there is no unexpected trailing
data.

Also some commands produce a dump using print_buffer(). Add a way to check
that the correct number of bytes are dumped (ignoring the actual
contents).

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotest: Enable console recording in tests
Simon Glass [Mon, 27 Jan 2020 15:49:55 +0000 (08:49 -0700)]
test: Enable console recording in tests

At present we reset the console buffer before each test but do not
actually set the recording flag. Without this, the output is not
recorded.

Update the code to set the flag before the test and clear it afterwards.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoconsole: Add a function to read a line of the output / eof
Simon Glass [Mon, 27 Jan 2020 15:49:54 +0000 (08:49 -0700)]
console: Add a function to read a line of the output / eof

When recording the console output for testing it is useful to be able to
read the output a line at a time to check that the output is correct. Also
we need to check that we get to the end of the output.

Add a console function to return the next line and another to see how must
data is left.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: pmic: Correct i2c pmic emulator platdata method
Simon Glass [Mon, 27 Jan 2020 15:49:53 +0000 (08:49 -0700)]
sandbox: pmic: Correct i2c pmic emulator platdata method

This currently reads the uclass's private data in the ofdata_to_platdata
method which is not allowed, since the uclass has not read it from the
device tree. This happens in the probe method.

Fix it by adding a probe() method and moving the code there.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Zero records when adding
Simon Glass [Mon, 27 Jan 2020 15:49:52 +0000 (08:49 -0700)]
bloblist: Zero records when adding

It is convenient for bloblist to zero out the contents of a records when
it is added. This saves the callers having to do it.

Update the API accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Tidy up a few comments and code-style nits
Simon Glass [Mon, 27 Jan 2020 15:49:51 +0000 (08:49 -0700)]
bloblist: Tidy up a few comments and code-style nits

Add a messing error code to bloblist_new() and tidy up the line length in
bloblist_addrec().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Add a new function to add or check size
Simon Glass [Mon, 27 Jan 2020 15:49:50 +0000 (08:49 -0700)]
bloblist: Add a new function to add or check size

A common check is to see if a blob is present, create it if not and make
sure that the size is large enough. Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop uclass_find_next_free_req_seq() conditions
Simon Glass [Mon, 27 Jan 2020 15:49:49 +0000 (08:49 -0700)]
dm: core: Drop uclass_find_next_free_req_seq() conditions

These conditions are not needed and just reduce build coverage. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a way to iterate through children, probing each
Simon Glass [Mon, 27 Jan 2020 15:49:48 +0000 (08:49 -0700)]
dm: core: Add a way to iterate through children, probing each

It is sometimes useful to process all children, making sure they are
probed first. Add functions to help with this and a macro to make it more
convenient.

Signed-off-by: Simon Glass <sjg@chromium.org>