platform/kernel/u-boot.git
3 years agox86: acpi: Store the ACPI context in global_data
Simon Glass [Wed, 4 Nov 2020 16:57:19 +0000 (09:57 -0700)]
x86: acpi: Store the ACPI context in global_data

At present we create the ACPI context but then drop it after generation of
tables is complete. This is annoying because we have to then search for
tables later.

To fix this, allocate the context and store it in global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Allow writing tables to fail
Simon Glass [Wed, 4 Nov 2020 16:57:18 +0000 (09:57 -0700)]
x86: Allow writing tables to fail

At present write_tables() can fail but does not report this problem to its
caller. Fix this by changing the return type.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Add support for private files
Simon Glass [Wed, 4 Nov 2020 16:57:17 +0000 (09:57 -0700)]
x86: Add support for private files

Some boards need to include binary data into the image for use during the
boot process. Add a node for these.

An example is the audio-codec configuration used by some audio drivers on
Intel platforms. If no private files are provided, they will be omitted.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Add a layout for Chrome OS verified boot
Simon Glass [Wed, 4 Nov 2020 16:57:16 +0000 (09:57 -0700)]
x86: Add a layout for Chrome OS verified boot

Add definitions for part of the vboot context used with verified boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: apl: Add core init for the SoC
Simon Glass [Wed, 4 Nov 2020 16:57:15 +0000 (09:57 -0700)]
x86: apl: Add core init for the SoC

Set up MSRs required for Apollo Lake. This enables Linux to use the
timers correctly. Also write the fixed MSRs for this platform.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoAdd an assembly guard around linux/bitops.h
Simon Glass [Wed, 4 Nov 2020 16:57:14 +0000 (09:57 -0700)]
Add an assembly guard around linux/bitops.h

This file can be included by any header but it includes C code. Guard it
to avoid errors when compiling ASL, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocoreboot: make use of smbios parser
Christian Gmeiner [Tue, 3 Nov 2020 14:34:52 +0000 (15:34 +0100)]
coreboot: make use of smbios parser

If u-boot gets used as coreboot payload it might be nice to get
vendor, model and bios version from smbios. I am not sure about
the output of all the read information.

With qemu target for coreboot this could look this:

CBFS: Found @ offset 14f40 size 3b188
Checking segment from ROM address 0xffc15178
Checking segment from ROM address 0xffc15194
Loading segment from ROM address 0xffc15178
  code (compression=1)
  New segment dstaddr 0x01110000 memsize 0x889ef srcaddr 0xffc151b0 filesize 0x3b150
Loading Segment: addr: 0x01110000 memsz: 0x00000000000889ef filesz: 0x000000000003b150
using LZMA
Loading segment from ROM address 0xffc15194
  Entry Point 0x01110000
BS: BS_PAYLOAD_LOAD run times (exec / console): 77 / 1 ms
Jumping to boot code at 0x01110000(0x07fa7000)

U-Boot 2020.10-00536-g5dcf7cc590-dirty (Oct 07 2020 - 14:21:51 +0200)

CPU: x86_64, vendor AMD, device 663h
DRAM:  127.1 MiB
MMC:
Video: No video mode configured in coreboot!
Video: No video mode configured in coreboot!
Vendor: QEMU
Model: Standard PC (i440FX + PIIX, 1996)
Bios Version: 4.12-3152-g326a499f6f-dirty
Net:   e1000: 52:54:00:12:34:56
       eth0: e1000#0
No working controllers found
Finalizing coreboot
Hit any key to stop autoboot:  0

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agosmbios: add parsing API
Christian Gmeiner [Tue, 3 Nov 2020 14:34:51 +0000 (15:34 +0100)]
smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Fix up driver names to avoid dtoc warnings
Simon Glass [Mon, 5 Oct 2020 11:27:01 +0000 (05:27 -0600)]
x86: Fix up driver names to avoid dtoc warnings

At present there are a lot of dtoc warnings reported when building
chromebook_coral, of the form:

   WARNING: the driver intel_apl_lpc was not found in the driver list

Correct these by using driver names that matches their compatible string.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocros_ec: Fix up driver names to avoid dtoc warnings
Simon Glass [Mon, 5 Oct 2020 11:27:00 +0000 (05:27 -0600)]
cros_ec: Fix up driver names to avoid dtoc warnings

Fix the dtoc warning in these file by using a driver name that matches the
compatible string.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoarch: Move NEEDS_MANUAL_RELOC symbol to Kconfig
Michal Simek [Wed, 4 Nov 2020 14:33:20 +0000 (15:33 +0100)]
arch: Move NEEDS_MANUAL_RELOC symbol to Kconfig

CONFIG_NEEDS_MANUAL_RELOC macro was out of Kconfig. Move it there to be
able to use compile-time checks to reduce the number of build paths.

Fixes: f9a882438966 ("dm: core: Convert #ifdef to if() in root.c") for Microblaze
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoenv: sf: fix init function behaviour
Heiko Schocher [Tue, 3 Nov 2020 14:22:36 +0000 (15:22 +0100)]
env: sf: fix init function behaviour

Michael wrote:
commit 92765f45bb95 ("env: Access Environment in SPI flashes before
relocation") at least breaks the Kontron sl28 board. I guess it also
breaks others which use a (late) SPI environment.

reason is, that env_init() sets the init bit, if there
is no init function defined in an environment driver,
and use default return value -ENOENT in this case
later for setting the default environment.

Change:
Environment driver can now implement an init
function and return, if this function does nothing,
simply -ENOENT.

env_init() now handles -ENOENT correct by setting the
inited bit for the environment driver. And if there
is no other environment driver whose init function
returns 0, load than the default environment.

This prevents that each environment driver needs to set the
default environment.

Fixes: 92765f45bb95 ("env: Access Environment in SPI flashes before relocation")
Reported-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc> [For the SF environment]
Signed-off-by: Heiko Schocher <hs@denx.de>
3 years agoMerge tag 'u-boot-atmel-fixes-2021.01-a' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 2 Nov 2020 14:01:28 +0000 (09:01 -0500)]
Merge tag 'u-boot-atmel-fixes-2021.01-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

First set of u-boot-atmel fixes for 2021.01 cycle:

This specific feature set includes the patches for DT required to fix
the warnings for newer DTC version (1.6.0+), i2c and spi bus unit
address.

3 years agoARM: dts: at91: sama5d3xmb_cmp: fix SPI bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:54 +0000 (10:39 +0200)]
ARM: dts: at91: sama5d3xmb_cmp: fix SPI bus unit address

w+arch/arm/dts/.at91sam9260ek.dtb.pre.tmp:119.21-123.7: Warning (spi_bus_reg): /ahb/apb/spi@fffc8000/mtd_dataflash@0: SPI bus unit address format error, expected "1"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: sam9260ek: fix SPI bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:53 +0000 (10:39 +0200)]
ARM: dts: at91: sam9260ek: fix SPI bus unit address

w+arch/arm/dts/.at91sam9260ek.dtb.pre.tmp:119.21-123.7: Warning (spi_bus_reg): /ahb/apb/spi@fffc8000/mtd_dataflash@0: SPI bus unit address format error, expected "1"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: sama5d3xmb: fix I2C bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:52 +0000 (10:39 +0200)]
ARM: dts: at91: sama5d3xmb: fix I2C bus unit address

w+arch/arm/dts/sama5d3xmb.dtsi:64.25-83.7: Warning (i2c_bus_reg): /ahb/apb/i2c@f0018000/camera@0x30: I2C bus unit address format error, expected "30"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: gurnard: fix SPI bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:51 +0000 (10:39 +0200)]
ARM: dts: at91: gurnard: fix SPI bus unit address

w+arch/arm/dts/.at91sam9g45-gurnard.dtb.pre.tmp:118.21-122.7: Warning (spi_bus_reg): /ahb/apb/spi@fffa4000/mtd_dataflash@0: SPI bus unit address format error, expected "1"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: at91sam9g25ek: fix I2C bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:50 +0000 (10:39 +0200)]
ARM: dts: at91: at91sam9g25ek: fix I2C bus unit address

w+arch/arm/dts/.at91sam9g25ek.dtb.pre.tmp:28.25-47.7: Warning (i2c_bus_reg): /ahb/apb/i2c@f8010000/camera@0x30: I2C bus unit address format error, expected "30"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: at91sam9g20ek_common: fix SPI bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:49 +0000 (10:39 +0200)]
ARM: dts: at91: at91sam9g20ek_common: fix SPI bus unit address

w+arch/arm/dts/at91sam9g20ek_common.dtsi:100.21-104.7: Warning (spi_bus_reg): /ahb/apb/spi@fffc8000/mtd_dataflash@0: SPI bus unit address format error, expected "1"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: at91sam9g20-taurus: fix SPI bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:48 +0000 (10:39 +0200)]
ARM: dts: at91: at91sam9g20-taurus: fix SPI bus unit address

w+arch/arm/dts/.at91sam9g20-taurus.dtb.pre.tmp:79.18-83.4: Warning (spi_bus_reg): /ahb/apb/spi@fffc8000/mtd_dataflash@0: SPI bus unit address format error, expected "1"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: at91sam9261ek: fix SPI unit address warning
Eugen Hristev [Mon, 26 Oct 2020 08:39:47 +0000 (10:39 +0200)]
ARM: dts: at91: at91sam9261ek: fix SPI unit address warning

w+arch/arm/dts/.at91sam9261ek.dtb.pre.tmp:124.15-144.7: Warning (spi_bus_reg): /ahb/apb/spi@fffc8000/tsc2046@0: SPI bus unit address format error, expected "2"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoARM: dts: at91: vinco: fix I2C warning bus unit address
Eugen Hristev [Mon, 26 Oct 2020 08:39:46 +0000 (10:39 +0200)]
ARM: dts: at91: vinco: fix I2C warning bus unit address

w+arch/arm/dts/.at91-vinco.dtb.pre.tmp:131.18-134.7: Warning (i2c_bus_reg): /ahb/apb/i2c@f8024000/rtc@64: I2C bus unit address format error, expected "32"

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agoMerge tag 'efi-2020-01-rc2-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 1 Nov 2020 15:56:37 +0000 (10:56 -0500)]
Merge tag 'efi-2020-01-rc2-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc2 (2)

The series contains the following enhancements

* preparatory patches for UEFI capsule updates
* initialization of the emulated RTC using an environment variable

and a bug fix

* If DisconnectController() is called for a child controller that is the
  only child of the driver, the driver must be disconnected.

3 years agoMerge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Sat, 31 Oct 2020 02:55:16 +0000 (22:55 -0400)]
Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- New PX30 board: Engicam PX30.Core;
- Fix USB HID support for rock960;
- Remove host endianness dependency for rockchip mkimage;
- dts update for rk3288-tinker;
- Enable console MUX for some ROCKPi boards;
- Add config-based ddr selection for px30;

3 years agoMerge tag 'dm-pull-30oct20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 30 Oct 2020 19:24:30 +0000 (15:24 -0400)]
Merge tag 'dm-pull-30oct20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

of-platdata and dtoc improvements
sandbox SPL tests
binman support for compressed sections

3 years agolog: typo logl_pref in documentation
Heinrich Schuchardt [Fri, 30 Oct 2020 17:50:31 +0000 (18:50 +0100)]
log: typo logl_pref in documentation

The name of structure element logl_prev is not matched by the
documentation.

%s/logl_pref/logl_prev/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge branch '2020-10-30-misc-changes'
Tom Rini [Fri, 30 Oct 2020 18:17:23 +0000 (14:17 -0400)]
Merge branch '2020-10-30-misc-changes'

- Additional log improvements
- SPI flash environment improvements

3 years agodoc: rockchip: Document Rockchip miniloader flashing
Jagan Teki [Wed, 28 Oct 2020 13:33:48 +0000 (19:03 +0530)]
doc: rockchip: Document Rockchip miniloader flashing

This would be useful and recommended boot flow for new boards
which has doesn't have the DDR support yet in mainline.

Sometimes it is very useful for debugging mainline DDR support.

Documen it for px30 boot flow.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: Add Engicam PX30.Core C.TOUCH 2.0
Jagan Teki [Wed, 28 Oct 2020 13:33:47 +0000 (19:03 +0530)]
rockchip: Add Engicam PX30.Core C.TOUCH 2.0

PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.

C.TOUCH 2.0 is a general purpose carrier board with capacitive
touch interface support.

PX30.Core needs to mount on top of this Carrier board for creating
complete PX30.Core C.TOUCH 2.0 board.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: px30: Add Engicam C.TOUCH 2.0
Jagan Teki [Wed, 28 Oct 2020 13:33:46 +0000 (19:03 +0530)]
arm64: dts: rockchip: px30: Add Engicam C.TOUCH 2.0

Engicam C.TOUCH 2.0 is an EDIMM compliant general purpose
carrier board with capacitive touch interface.

Genaral features:
- TFT 10.1" industrial, 1280x800 LVDS display
- Ethernet 10/100
- Wifi/BT
- USB Type A/OTG
- Audio Out
- CAN
- LVDS panel connector

SOM's like PX30.Core needs to mount on top of this Carrier board
for creating complete PX30.Core C.TOUCH 2.0 board.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: Add Engicam PX30.Core EDIMM2.2 Starter Kit
Jagan Teki [Wed, 28 Oct 2020 13:33:45 +0000 (19:03 +0530)]
rockchip: Add Engicam PX30.Core EDIMM2.2 Starter Kit

PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.

EDIMM2.2 Starter Kit is an EDIMM 2.2 Form Factor Capacitive
Evaluation Board from Engicam.

PX30.Core needs to mount on top of this Evaluation board for
creating complete PX30.Core EDIMM2.2 Starter Kit.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoboard: engicam: Attach i.MX6 common code
Jagan Teki [Wed, 28 Oct 2020 13:33:44 +0000 (19:03 +0530)]
board: engicam: Attach i.MX6 common code

The existing common code for Engicam boards uses i.MX6,
so attach that into i.MX6 Engicam boards so-that adding
new SoC variants of Engicam boards become meaningful.

Add support for it.

Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: px30: Add EVB_PX30 Kconfig help
Jagan Teki [Wed, 28 Oct 2020 13:33:43 +0000 (19:03 +0530)]
rockchip: px30: Add EVB_PX30 Kconfig help

TARGET_EVB_PX30 can be possible to use other px30 boards.

Add the help text for existing EVB, so-that the new boards
which are resuing this config option can mention their board
help text.

This would help to track which boards are using EVB_PX30 config.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add Engicam PX30.Core SOM
Michael Trimarchi [Wed, 28 Oct 2020 13:33:42 +0000 (19:03 +0530)]
arm64: dts: rockchip: Add Engicam PX30.Core SOM

PX30.Core is an EDIMM SOM based on Rockchip PX30 from Engicam.

General features:
- Rockchip PX30
- Up to 2GB DDR4
- eMMC 4 GB expandible
- rest of PX30 features

PX30.Core needs to mount on top of Engicam baseboards for creating
complete platform boards.

Possible baseboards are,
- EDIMM2.2
- C.TOUCH 2.0

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: px30: Add Engicam EDIMM2.2 Starter Kit
Jagan Teki [Wed, 28 Oct 2020 13:33:41 +0000 (19:03 +0530)]
arm64: dts: rockchip: px30: Add Engicam EDIMM2.2 Starter Kit

Engicam EDIMM2.2 Starter Kit is an EDIMM 2.2 Form Factor Capacitive
Evaluation Board.

Genaral features:
- LCD 7" C.Touch
- microSD slot
- Ethernet 1Gb
- Wifi/BT
- 2x LVDS Full HD interfaces
- 3x USB 2.0
- 1x USB 3.0
- HDMI Out
- Mini PCIe
- MIPI CSI
- 2x CAN
- Audio Out

SOM's like PX30.Core needs to mount on top of this Evaluation board
for creating complete PX30.Core EDIMM2.2 Starter Kit.

Add support for it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: mkimage: Remove host endianness dependency
Samuel Holland [Sat, 24 Oct 2020 16:43:17 +0000 (11:43 -0500)]
rockchip: mkimage: Remove host endianness dependency

The Rockchip boot ROM expects little-endian values in the image header.
When running mkimage on a big-endian machine, these values need to be
byteswapped before writing or verifying the header.

This change fixes cross-compiling U-Boot SPL for the RK3399 SoC from a
big-endian ppc64 host machine.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: Enable Console MUX in ROCKPi N8
Jagan Teki [Fri, 23 Oct 2020 19:57:25 +0000 (01:27 +0530)]
rockchip: Enable Console MUX in ROCKPi N8

Enable Console multiplexing in ROCKPi N8 which would is
required to video out the console buffer.

Enable it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agovideo: rockchip: Support 4K resolution for rk3288, HDMI
Jagan Teki [Fri, 23 Oct 2020 19:57:24 +0000 (01:27 +0530)]
video: rockchip: Support 4K resolution for rk3288, HDMI

Like, rk3399 the rk3288 also supports 4K resolution.

So, enable it for rk3288 with HDMI platforms.

Right now, rockchip video drivers are supporting for rk3288,
rk3399 SoC families, so mark the 4K resolution by default
if it's an HDMI video out.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Cc: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoarm64: dts: rockchip: Add chosen node for ROCK-Pi N8
Jagan Teki [Fri, 23 Oct 2020 19:57:23 +0000 (01:27 +0530)]
arm64: dts: rockchip: Add chosen node for ROCK-Pi N8

Add chosen node in -u-boot.dtsi for ROCK-Pi N8 board.

This will help to get serial out messages.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: Enable Console MUX in ROCKPi N10
Jagan Teki [Fri, 23 Oct 2020 19:57:22 +0000 (01:27 +0530)]
rockchip: Enable Console MUX in ROCKPi N10

Enable Console multiplexing in ROCKPi N10 which would is
required to video out the console buffer.

Enable it.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agodoc: Update logging documentation
Sean Anderson [Tue, 27 Oct 2020 23:55:41 +0000 (19:55 -0400)]
doc: Update logging documentation

This updates logging documentation with some examples of the new commands
added in the previous commits. It also removes some items from the to-do
list which have been implemented.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Add log kerneldocs to documentation
Sean Anderson [Tue, 27 Oct 2020 23:55:40 +0000 (19:55 -0400)]
doc: Add log kerneldocs to documentation

The functions in log.h are already mostly documented, so add them to the
generated documentation.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add a test for log filter-*
Sean Anderson [Tue, 27 Oct 2020 23:55:39 +0000 (19:55 -0400)]
test: Add a test for log filter-*

This exercises a few success and failure modes of the log filter-*
commands. log filter-list is not tested because it's purely informational.
I don't think there's a good way to test it except by testing if the output
of the command exactly matches a sample run.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: log: Add commands to manipulate filters
Sean Anderson [Tue, 27 Oct 2020 23:55:38 +0000 (19:55 -0400)]
cmd: log: Add commands to manipulate filters

This adds several commands to add, list, and remove log filters. Due to the
complexity of adding a filter, `log filter-list` uses options instead of
positional arguments.

These commands have been added as subcommands to log by using a dash to
join the subcommand and subsubcommand. This is stylistic, and they could be
converted to proper subsubcommands if it is wished.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add a test for getopt
Sean Anderson [Tue, 27 Oct 2020 23:55:37 +0000 (19:55 -0400)]
test: Add a test for getopt

A few of these tests were inspired by those in glibc. The syntax for
invoking test_getopt is a bit funky, but it's necessary so that the CPP can
parse the arguments correctly.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agolib: Add getopt
Sean Anderson [Tue, 27 Oct 2020 23:55:36 +0000 (19:55 -0400)]
lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agocmd: log: Make "log level" print all log levels
Sean Anderson [Tue, 27 Oct 2020 23:55:35 +0000 (19:55 -0400)]
cmd: log: Make "log level" print all log levels

This makes the log level command print all valid log levels. The default
log level is annotated. This provides an easy way to see which log levels
are compiled-in.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: log: Add commands to list categories and drivers
Sean Anderson [Tue, 27 Oct 2020 23:55:34 +0000 (19:55 -0400)]
cmd: log: Add commands to list categories and drivers

This allows users to query which categories and drivers are available on
their system. This allows them to construct filter-add commands without
(e.g.) adjusting the log format to show categories and drivers.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: log: Split off log level parsing
Sean Anderson [Tue, 27 Oct 2020 23:55:33 +0000 (19:55 -0400)]
cmd: log: Split off log level parsing

Move parsing of log level into its own function so it can be re-used. This
also adds support for using log level names instead of just the integer
equivalent.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: log: Use sub-commands for log
Sean Anderson [Tue, 27 Oct 2020 23:55:32 +0000 (19:55 -0400)]
cmd: log: Use sub-commands for log

This reduces duplicate code, and makes adding new sub-commands easier.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add test for LOGFF_MIN
Sean Anderson [Tue, 27 Oct 2020 23:55:31 +0000 (19:55 -0400)]
test: Add test for LOGFF_MIN

This tests log filters matching on a minimum level.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Add filter flag to match greater than a log level
Sean Anderson [Tue, 27 Oct 2020 23:55:30 +0000 (19:55 -0400)]
log: Add filter flag to match greater than a log level

This is the complement of the existing behavior to match only messages with
a log level less than a threshold. This is primarily useful in conjunction
with LOGFF_DENY.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add tests for LOGFF_DENY
Sean Anderson [Tue, 27 Oct 2020 23:55:29 +0000 (19:55 -0400)]
test: Add tests for LOGFF_DENY

This adds some tests for log filters which deny if they match.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: log: Give tests names instead of numbers
Sean Anderson [Tue, 27 Oct 2020 23:55:28 +0000 (19:55 -0400)]
test: log: Give tests names instead of numbers

Now that the log test command is no more, we can give the log tests proper
names.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agotest: log: Convert log_test from python to C
Sean Anderson [Tue, 27 Oct 2020 23:55:27 +0000 (19:55 -0400)]
test: log: Convert log_test from python to C

When rebasing this series I had to renumber all my log tests because
someone made another log test in the meantime. This involved updaing a
number in several places (C and python), and it wasn't checked by the
compiler. So I though "how hard could it be to just rewrite in C?" And
though it wasn't hard, it *was* tedious. Tests are numbered the same as
before to allow for easier review.

A note that if a test fails, everything after it will probably also fail.
This is because that test won't clean up its filters.  There's no easy way
to do the cleanup, except perhaps removing all filters in a wrapper
function.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agolog: Add filter flag to deny on match
Sean Anderson [Tue, 27 Oct 2020 23:55:26 +0000 (19:55 -0400)]
log: Add filter flag to deny on match

Without this flag, log filters can only explicitly accept messages.
Allowing denial makes it easier to filter certain subsystems. Unlike
allow-ing filters, deny-ing filters are added to the beginning of the
filter list. This should do the Right Thing most of the time, but it's
less-universal than allowing filters to be inserted anywhere. If this
becomes a problem, then perhaps log_filter_add* should take a filter number
to insert before/after.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Add function to create a filter with flags
Sean Anderson [Tue, 27 Oct 2020 23:55:25 +0000 (19:55 -0400)]
log: Add function to create a filter with flags

This function exposes a way to specify flags when creating a filter.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Expose some helper functions
Sean Anderson [Tue, 27 Oct 2020 23:55:24 +0000 (19:55 -0400)]
log: Expose some helper functions

These functions are required by "cmd: log: Add commands to manipulate
filters" and "test: Add a test for log filter-*".

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Use CONFIG_IS_ENABLED() for LOG_TEST
Sean Anderson [Tue, 27 Oct 2020 23:55:23 +0000 (19:55 -0400)]
log: Use CONFIG_IS_ENABLED() for LOG_TEST

Checkpatch complains about using #ifdef for CONFIG variables.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Add additional const qualifier to arrays
Sean Anderson [Tue, 27 Oct 2020 23:55:22 +0000 (19:55 -0400)]
log: Add additional const qualifier to arrays

Both these arrays and their members are const. Fixes checkpatch complaint.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: Fix incorrect documentation of log_filter.cat_list
Sean Anderson [Tue, 27 Oct 2020 23:55:21 +0000 (19:55 -0400)]
log: Fix incorrect documentation of log_filter.cat_list

Logging category lists are terminated by LOGC_END, not LOGC_NONE.

Fixes: e9c8d49d54 ("log: Add an implementation of logging")

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolog: Fix missing negation of ENOMEM
Sean Anderson [Tue, 27 Oct 2020 23:55:20 +0000 (19:55 -0400)]
log: Fix missing negation of ENOMEM

Errors returned should be negative.

Fixes: 45fac9fc18 ("log: Correct missing free() on error in log_add_filter()")

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoimx6: enable early spi environment access on aristainetos boards
Heiko Schocher [Sat, 10 Oct 2020 08:28:06 +0000 (10:28 +0200)]
imx6: enable early spi environment access on aristainetos boards

On aristianetos boards the display type is detected
through "panel" environment variable. Dependend on the
display type we detect the board type and this decides which
DTB we have to use for the board.

So we need early spi environment access.

Signed-off-by: Heiko Schocher <hs@denx.de>
3 years agoenv: Access Environment in SPI flashes before relocation
Heiko Schocher [Sat, 10 Oct 2020 08:28:05 +0000 (10:28 +0200)]
env: Access Environment in SPI flashes before relocation

Enable the new Kconfig option ENV_SPI_EARLY if you want
to use Environment in SPI flash before relocation.
Call env_init() and than you can use env_get_f() for
accessing Environment variables.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: split env_import_redund() into 2 functions
Heiko Schocher [Sat, 10 Oct 2020 08:28:04 +0000 (10:28 +0200)]
env: split env_import_redund() into 2 functions

split from env_import_redund() the part which checks
which Environment is valid into a separate function
called env_check_redund() and call it from env_import_redund().

So env_check_redund() can be used from places which also
need to do this checks.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: unit test for efi_create_indexed_name()
Heinrich Schuchardt [Fri, 30 Oct 2020 11:23:59 +0000 (12:23 +0100)]
test: unit test for efi_create_indexed_name()

Provide a unit test for function efi_create_indexed_name().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: add efi_create_indexed_name()
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:46 +0000 (13:47 +0900)]
efi_loader: add efi_create_indexed_name()

This function will be used from several places in UEFI subsystem
to generate some specific form of utf-16 variable name.
For example, L"Capsule0001"

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Move function to separate module.
Use char * as argument instead of u16 *.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: add option to initialise EFI subsystem early
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:45 +0000 (13:47 +0900)]
efi_loader: add option to initialise EFI subsystem early

If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation
of UEFI subsystem will be done as part of U-Boot initialisation.

Please note that this option won't be enabled explicitly by users,
instead, should be enabled implicitly by other configuration options.

Specifically, this feature will be utilised in implementing capsule-on-disk
feature.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodfu: add dfu_write_by_alt()
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:52 +0000 (13:47 +0900)]
dfu: add dfu_write_by_alt()

This function is a variant of dfu_write_by_name() and takes a DFU alt
setting number for dfu configuration.

It will be utilised to implement UEFI capsule management protocol for
raw image in a later commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agodfu: export dfu_list
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:44 +0000 (13:47 +0900)]
dfu: export dfu_list

This variable will be utilized to enumerate all dfu entities
for UEFI capsule firmware update in a later commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agocommon: update: add a generic interface for FIT image
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:43 +0000 (13:47 +0900)]
common: update: add a generic interface for FIT image

The main purpose of this patch is to separate a generic interface for
updating firmware using DFU drivers from "auto-update" via tftp.

This function will also be used in implementing UEFI capsule update
in a later commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agodfu: modify an argument type for an address
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:42 +0000 (13:47 +0900)]
dfu: modify an argument type for an address

The range of an addressable pointer can go beyond 'integer'.
So change the argument type to a void pointer.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agodfu: rename dfu_tftp_write() to dfu_write_by_name()
AKASHI Takahiro [Thu, 29 Oct 2020 04:47:41 +0000 (13:47 +0900)]
dfu: rename dfu_tftp_write() to dfu_write_by_name()

This function is essentially independent from tftp, and will also be
utilised in implementing UEFI capsule update in a later commit.
So just give it a more generic name.
In addition, a new configuration option, CONFIG_DFU_WRITE_ALT, was
introduced so that the file will be compiled with different options,
particularly one added in a later commit.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoefi_loader: typo in function description of u16_strnlen
Heinrich Schuchardt [Fri, 30 Oct 2020 11:14:16 +0000 (12:14 +0100)]
efi_loader: typo in function description of u16_strnlen

%/u16_strlen/u16_strnlen()/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agortc: initialize emulated RTC from environment variable
Heinrich Schuchardt [Fri, 30 Oct 2020 02:27:22 +0000 (03:27 +0100)]
rtc: initialize emulated RTC from environment variable

Up to now the emulated RTC is initialized using the U-Boot build time.

With this patch the environment variable 'rtc_emul_epoch' can be used to
provide a better initial time. The variable is a decimal string with
the number of seconds since 1970-01-01. Here is an example where the RTC
had not been probed yet:

    => setenv rtc_emul_epoch 1610109000
    => date
    Date: 2021-01-08 (Friday)    Time: 12:30:00

If the variable does not exist, the U-Boot build time is used as fallback.

The environment variable may be set when shutting down the operating system
if the U-Boot environment is exposed to the OS (cf. ENV_IS_IN_FAT and
ENV_IS_IN_EXT4).

Suggested-by: Pablo Sebastián Greco <pgreco@centosproject.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agortc: use probe() to initialize emulated RTC
Heinrich Schuchardt [Fri, 30 Oct 2020 02:05:47 +0000 (03:05 +0100)]
rtc: use probe() to initialize emulated RTC

Currently the emulated RTC is initialized in the emul_rtc_get() get
function. This does not match the design of the driver model.

Move the initialization of the emulated RTC to the probe() function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fix DisconnectController() for sole child
Heinrich Schuchardt [Wed, 28 Oct 2020 17:45:47 +0000 (18:45 +0100)]
efi_loader: fix DisconnectController() for sole child

If ChildHandle indicates the sole child of the driver, disconnect the
driver.

This fixes the test results for UEFI SCT 2.6 A
sub-tests 5.1.3.12.43, 5.1.3.12.44, 5.1.3.12.45.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agovideo: rockchip: Add missing dpcd_write() call to link_train_ce()
Alper Nebi Yasak [Tue, 6 Oct 2020 20:39:51 +0000 (23:39 +0300)]
video: rockchip: Add missing dpcd_write() call to link_train_ce()

Found this by comparing it to the coreboot driver, a form of this call
was introduced there in their commit b9a7877568cf ("rockchip/*: refactor
edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly
above it.

Without this on a gru-kevin chromebook, I have:

    clock recovery at voltage 0 pre-emphasis 0
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    channel eq failed, ret=-5
    link train failed!
    rk_vop_probe() Device failed: ret=-5

With this, it looks like training succeeds:

    clock recovery at voltage 0 pre-emphasis 0
    requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB
    using signal parameters: voltage 0.4V pre_emph 3.5dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 6dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 6dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 6dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 6dB
    using signal parameters: voltage 0.4V pre_emph 6dB
    requested signal parameters: lane 0 voltage 0.4V pre_emph 0dB
    requested signal parameters: lane 1 voltage 0.4V pre_emph 0dB
    requested signal parameters: lane 2 voltage 0.4V pre_emph 0dB
    requested signal parameters: lane 3 voltage 0.4V pre_emph 0dB
    using signal parameters: voltage 0.4V pre_emph 0dB
    channel eq at voltage 0 pre-emphasis 0
    config video failed
    rk_vop_probe() Device failed: ret=-110

The "config video failed" error also goes away when I disable higher
log levels, and it claims to have successfully probed the device.

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 agoram: rockchip: px30: add a config-based ddr selection
Heiko Stuebner [Thu, 1 Oct 2020 18:40:03 +0000 (20:40 +0200)]
ram: rockchip: px30: add a config-based ddr selection

The SRAM on the PX30 is not big enough to hold multiple DDR configs
so it needs to be selected during build.

So far simply the DDR3 config was always selected and getting DDR4
or LPDDR2/3 initialized would require a code modification.

So add Kconfig options similar to RK3399 to allow selecting the DDR4
and LPDDR2/3 options instead, while DDR3 stays the default as before.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: Rock960: fix up USB support
Peter Robinson [Tue, 29 Sep 2020 13:06:18 +0000 (14:06 +0100)]
rockchip: Rock960: fix up USB support

Fix up USB config options so keyboards and other USB devices work.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
Change-Id: I34b0696e0ac7303186f20c83278dde340399b690

3 years agorockchip: dts: tinker: remove unnecessary node
Stefan Agner [Fri, 4 Sep 2020 14:11:09 +0000 (16:11 +0200)]
rockchip: dts: tinker: remove unnecessary node

The property reg-shift with the same value is present in the base
device tree already. Remove unnecessary node from rk3288-tinker.dts.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: dts: tinker: move i2c node to shared device tree
Stefan Agner [Fri, 4 Sep 2020 14:11:08 +0000 (16:11 +0200)]
rockchip: dts: tinker: move i2c node to shared device tree

The I2C EEPROM is present on Tinker Board S as well. Move the i2c node
to the shared, U-Boot specific rk3288-tinker-u-boot.dtsi device tree.

Cc: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoclk: rockchip: rk3399: implement getting wdt/alive clocks
Jack Mitchell [Thu, 17 Sep 2020 09:42:06 +0000 (10:42 +0100)]
clk: rockchip: rk3399: implement getting wdt/alive clocks

In order to correctly calculate the designware watchdog
timeouts, the watchdog clock is required. Implement required
clocks to facilitate this.

Signed-off-by: Jack Mitchell <ml@embed.me.uk>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agobinman: Avoid calculated section data repeatedly
Simon Glass [Mon, 26 Oct 2020 23:40:26 +0000 (17:40 -0600)]
binman: Avoid calculated section data repeatedly

Refactor the implementation slightly so that section data is not
rebuilt when it is already available.

We still have GetData() set up to rebuild the section, since we don't
currently track when things change that might affect a section. For
example, if a blob is updated within a section, we must rebuild it.
Tracking that would be possible but is more complex, so it left for
another time.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support compression of sections
Simon Glass [Mon, 26 Oct 2020 23:40:25 +0000 (17:40 -0600)]
binman: Support compression of sections

With the previous changes, it is now possible to compress entire
sections. Add some tests to check that compression works correctly,
including updating the metadata.

Also update the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Use the actual contents in CheckSize()
Simon Glass [Mon, 26 Oct 2020 23:40:24 +0000 (17:40 -0600)]
binman: Use the actual contents in CheckSize()

At present this function adds up the total size of entries to work out the
size of a section's contents. With compression this is no-longer enough.

We may as well bite the bullet and build the section contents instead.
Call _BuildSectionData() to get the (possibly compressed) contents and
GetPaddedData() to get the same but with padding added.

Note that this is inefficient since the section contents is calculated
twice. Future work will improve this.

This affects testPackOverlapMap() since the error is reported with a
different section size now (enough to hold the contents). Update that at
the same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Update CheckEntries() for compressed sections
Simon Glass [Mon, 26 Oct 2020 23:40:23 +0000 (17:40 -0600)]
binman: Update CheckEntries() for compressed sections

At present this function assumes that the size of a section is at least as
large as its contents. With compression this is often not the case. Relax
this constraint by using the uncompressed size, if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Drop CheckEntries()
Simon Glass [Mon, 26 Oct 2020 23:40:22 +0000 (17:40 -0600)]
binman: Drop CheckEntries()

This method introduces a separation between packing and checking that is
different for sections. In order to handle compression properly, we need
to be able to deal with a section's size being smaller than the
uncompressed size of its contents. It is easier to make this work if
everything happens in the Pack() method.

The only real user of CheckEntries() is entry_Section and it can call it
directly. Drop the call from 'control' and handle it locally.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Call CheckSize() from the section's Pack() method
Simon Glass [Mon, 26 Oct 2020 23:40:21 +0000 (17:40 -0600)]
binman: Call CheckSize() from the section's Pack() method

At present CheckSize() is called from the function that packs the entries.
Move it up to the main Pack() function so that _PackEntries() can just
do the packing.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Drop the Entry.CheckSize() method
Simon Glass [Mon, 26 Oct 2020 23:40:20 +0000 (17:40 -0600)]
binman: Drop the Entry.CheckSize() method

This is only used by entry_Section and that class already calls it. Avoid
calling it twice. Also drop it from the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Move sort and expand to the main Pack() function
Simon Glass [Mon, 26 Oct 2020 23:40:19 +0000 (17:40 -0600)]
binman: Move sort and expand to the main Pack() function

At present sorting and expanding entries are side-effects of the
CheckEntries() function. This is a bit confusing, as 'checking' would
not normally involve making changes.

Move these steps into the Pack() function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Drop Entry.CheckOffset()
Simon Glass [Mon, 26 Oct 2020 23:40:18 +0000 (17:40 -0600)]
binman: Drop Entry.CheckOffset()

This function just calls CheckEntries() in the only non-trivial
implementation. Drop it and use CheckEntries() directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Avoid reporting image-pos with compression
Simon Glass [Mon, 26 Oct 2020 23:40:17 +0000 (17:40 -0600)]
binman: Avoid reporting image-pos with compression

When a section is compressed, all entries within it are grouped together
into a compressed block of data. This obscures the start of each
individual child entry.

Avoid reporting bogus 'image-pos' properties in this case, since it is
not possible to access the entry at the location provided. The entire
section must be decompressed first.

CBFS does not support compressing whole sections, only individual files,
so needs no special handling here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Set section contents in GetData()
Simon Glass [Mon, 26 Oct 2020 23:40:16 +0000 (17:40 -0600)]
binman: Set section contents in GetData()

Section contents is not set up when ObtainContents() is called, since
packing often changes the layout of the contents. Ensure that the contents
are correctly recorded by making this function regenerate the section. It
is normally only called by the parent section (when packing) or by the
top-level image code, when writing out the image. So the performance
impact is fairly small.

Now that sections have their contents in their 'data' property, update
testSkipAtStartSectionPad() to check it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Store the original data before compression
Simon Glass [Mon, 26 Oct 2020 23:40:15 +0000 (17:40 -0600)]
binman: Store the original data before compression

When compressing an entry, the original uncompressed data is overwritten.
Store it so it is available if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Make section padding consistent with other entries
Simon Glass [Mon, 26 Oct 2020 23:40:14 +0000 (17:40 -0600)]
binman: Make section padding consistent with other entries

At present padding of sections is inconsistent with other entry types, in
that different pad bytes are used.

When a normal entry is padded by its parent, the parent's pad byte is
used. But for sections, the section's pad byte is used.

Adjust logic to always do this the same way.

Note there is still a special case in entry_Section.GetPaddedData() where
an image is padded with the pad byte of the top-level section. This is
necessary since otherwise there would be no way to set the pad byte of
the image, without adding a top-level section to every image.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Move section padding to the parent
Simon Glass [Mon, 26 Oct 2020 23:40:13 +0000 (17:40 -0600)]
binman: Move section padding to the parent

Each section is padded up to its size, if the contents are not large
enough. Move this logic from _BuildSectionData() to
GetPaddedDataForEntry() so that all the padding is in one place.

With this, the testDual test is working again, so enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Refactor _BuildSectionData()
Simon Glass [Mon, 26 Oct 2020 23:40:12 +0000 (17:40 -0600)]
binman: Refactor _BuildSectionData()

At present this function does the padding needed around an entry. It is
easier to understand what is going on if we have a function that returns
the contents of an entry, with padding included.

Refactor the code accordingly, adding a new GetPaddedData() method.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Move section-building code into a function
Simon Glass [Mon, 26 Oct 2020 23:40:11 +0000 (17:40 -0600)]
binman: Move section-building code into a function

Create a new _BuildSectionData() to hold the code that is now in
GetData(), so that it is clearly separated from entry.GetData() base
function.

Separate out the 'pad-before' processing to make this easier to
understand.

Unfortunately this breaks the testDual test. Rather than squash several
patches into an un-reviewable glob, disable the test for now.

This also affects testSkipAtStartSectionPad(), although it still not
quite what it should be. Update that temporarily for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Expand docs and test for alignment
Simon Glass [Mon, 26 Oct 2020 23:40:10 +0000 (17:40 -0600)]
binman: Expand docs and test for alignment

Alignment does form part of the entry once the image is written out, but
within binman the entry contents does not include the padding. Add
documentation to make this clear, as well as a test.

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