]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 years agoboard: ge: b1x5v2: Add GE B1x5v2 and B1x5Pv2
Sebastian Reichel [Wed, 2 Sep 2020 17:31:46 +0000 (19:31 +0200)]
board: ge: b1x5v2: Add GE B1x5v2 and B1x5Pv2

GE B1x5v2 patient monitor series is similar to the CARESCAPE Monitor
series (GE Bx50). It consists of a carrier PCB used in combination
with a Congatec QMX6 SoM. This adds U-Boot support using device model
everywhere and SPL for memory initialization.

Proper configuration is provided as 'ge_b1x5v2_defconfig' and the
combined image u-boot-with-spi.imx can be flashed directly to 1024
byte offset to /dev/mtdblock0. Alternatively SPL and u-boot.imx can
be loaded separately via USB-OTG using e.g. imx_usb.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoboard: ge: common: vpd: separate I2C specific code
Sebastian Reichel [Wed, 2 Sep 2020 17:31:45 +0000 (19:31 +0200)]
board: ge: common: vpd: separate I2C specific code

This separates the I2C specific code from the generic
GE vital product data code, so that the generic parts
can be used on hardware with VPD stored in SPI flash
memory.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agoboard: ge: common: add config option for RTC and VPD feature
Sebastian Reichel [Wed, 2 Sep 2020 17:31:44 +0000 (19:31 +0200)]
board: ge: common: add config option for RTC and VPD feature

While this code is being used by all GE platforms its useful
to have it behind a config option for hardware bringup of
new platforms.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agoboard: ge: common: rename ge_common.c to ge_rtc.c
Sebastian Reichel [Wed, 2 Sep 2020 17:31:43 +0000 (19:31 +0200)]
board: ge: common: rename ge_common.c to ge_rtc.c

The file only contains RTC related code, so let's name
it accordingly.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agosysreset: Add poweroff-gpio driver
Sebastian Reichel [Wed, 2 Sep 2020 17:31:42 +0000 (19:31 +0200)]
sysreset: Add poweroff-gpio driver

Add GPIO poweroff driver, which is based on the Linux
driver and uses the same DT binding.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agoimx6: allow usage of disable_ldb_di_clock_sources for CONFIG_MX6QDL
Sebastian Reichel [Wed, 2 Sep 2020 17:31:41 +0000 (19:31 +0200)]
imx6: allow usage of disable_ldb_di_clock_sources for CONFIG_MX6QDL

Allow using disable_ldb_di_clock_sources with just the combined
CONFIG_MX6QDL being enabled.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agortc: m41t62: add oscillator fail bit reset support
Sebastian Reichel [Wed, 2 Sep 2020 17:31:40 +0000 (19:31 +0200)]
rtc: m41t62: add oscillator fail bit reset support

In case of empty battery or glitches the oscillator fail
bit might be set. This will reset the bit in the reset
routine.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agortc: m41t62: reset SQW in m41t62_rtc_reset
Sebastian Reichel [Wed, 2 Sep 2020 17:31:39 +0000 (19:31 +0200)]
rtc: m41t62: reset SQW in m41t62_rtc_reset

This takes care of resetting the 32kHz square wave, which is
used by some boards as clock source for the SoC.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agobootcount: add a DM SPI flash backing store for bootcount
Sebastian Reichel [Wed, 2 Sep 2020 17:31:38 +0000 (19:31 +0200)]
bootcount: add a DM SPI flash backing store for bootcount

This driver allows to use SPI flash as backing store for
boot counter values with DM enabled.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
4 years agoboard: phytec: imx8mm: Add PHYTEC phyCORE-i.MX8MM support
Teresa Remmet [Fri, 21 Aug 2020 07:55:53 +0000 (09:55 +0200)]
board: phytec: imx8mm: Add PHYTEC phyCORE-i.MX8MM support

Add support PHYTEC phyCORE-i.MX8MM SOM.

Supported features:
 - 2GB LPDDR4 RAM
 - 1x 1Gbit Ethernet
 - eMMC
 - external SD
 - debug UART3
 - watchdog
 - i2c eeprom

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
4 years agoARM: imx: Add support for the primary/secondary bmode to MX53
Marek Vasut [Fri, 4 Sep 2020 22:53:01 +0000 (00:53 +0200)]
ARM: imx: Add support for the primary/secondary bmode to MX53

Implement the 'getprisec' subcommand of 'bmode' command for i.MX53 and
also the primary/secondary bootmode switching.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
4 years agowatchdog: Hide WATCHDOG_RESET_DISABLE
Michael Walle [Thu, 24 Sep 2020 08:09:15 +0000 (10:09 +0200)]
watchdog: Hide WATCHDOG_RESET_DISABLE

This option is only supported by the IMX watchdog and seems to be
similar to CONFIG_WATCHDOG.

Move it below the IMX watchdog and make it dependent on IMX_WATCHDOG.

Signed-off-by: Michael Walle <michael@walle.cc>
4 years agodefconfig: Enable CONFIG_SHOW_BOOT_PROGRESS for imx53's HSC and DDC devices
Lukasz Majewski [Fri, 25 Sep 2020 15:13:11 +0000 (17:13 +0200)]
defconfig: Enable CONFIG_SHOW_BOOT_PROGRESS for imx53's HSC and DDC devices

This option allows using show_boot_progress to visualize the state of
boot process.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 years agodts: Provide LED DTS description for HSC and DDC imx53 devices
Lukasz Majewski [Fri, 25 Sep 2020 15:13:10 +0000 (17:13 +0200)]
dts: Provide LED DTS description for HSC and DDC imx53 devices

Those two LEDs are used to indicate U-Boot's boot stage.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 years agoarm: Implement show_boot_progress() for imx53's HSC and DDC devices
Lukasz Majewski [Fri, 25 Sep 2020 15:13:09 +0000 (17:13 +0200)]
arm: Implement show_boot_progress() for imx53's HSC and DDC devices

This patch provides information regarding the boot stage with using LEDs.
On the very beginning of U-Boot execution the GREEN LED is turned on.
When the execution is passed to Linux kernel the GREEN LED is off and
RED one is ON.

Afterwards, when Linux takes over the execution, the "heartbeat" driver
provides indication if the board is still alive.

Please also note that this patch uses {set|clr}bits_le32 macros as turning
ON GREEN LED is performed in a _very_ early stage of U-Boot execution
before DM_GPIOs are initialized.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 years agomx7ulp: clock: Align the PLL_USB frequency
Fabio Estevam [Wed, 7 Oct 2020 11:09:32 +0000 (08:09 -0300)]
mx7ulp: clock: Align the PLL_USB frequency

The command 'clocks' shows the following output:

=> clocks
PLL_A7_SPLL         528 MHz
PLL_A7_APLL         529 MHz
PLL_USB           0 MHz

Add some extra spaces so that the PLL_USB information gets aligned with
the previous reported frequencies.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7ulp: clock: Remove unuseful information
Fabio Estevam [Wed, 7 Oct 2020 11:09:31 +0000 (08:09 -0300)]
mx7ulp: clock: Remove unuseful information

The command 'clocks' shows the following output:

=> clocks
PLL_A7_SPLL         528 MHz
PLL_A7_APLL         529 MHz
PLL_USB           0 MHz

....

[do_mx7_showclocks] addr = 0x9FFB61F1

The last line is not useful at all, so just remove it.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agothermal: imx_tmu: fix missing include
Tim Harvey [Mon, 12 Oct 2020 19:21:54 +0000 (12:21 -0700)]
thermal: imx_tmu: fix missing include

commit c05ed00afb dropped linux/delay.h from common header

add linux/delay.h to avoid compile warning here

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoimx: cpu: terminate line with CR if invalid temp sensor
Tim Harvey [Mon, 12 Oct 2020 19:26:41 +0000 (12:26 -0700)]
imx: cpu: terminate line with CR if invalid temp sensor

Ensure we terminate the line with a CR if we get an invalid sensor device
or reading.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agomx6: peripheral clock from oscillator
Jorge Ramirez-Ortiz [Fri, 23 Oct 2020 19:18:41 +0000 (21:18 +0200)]
mx6: peripheral clock from oscillator

In order to be able to run the I2C bus at 400Khz, the chip errata[1]
recommends that the peripheral clock runs out of the 24MHz oscillator.

Systems running I2C from OP-TEE before Linux executes - for example to
access a Secure Element [2] providing the cryptographic support - expect
this clock to be configured by the bootloader [3].

[1] IMX6SLCE Rev. 5, 02/2019, ERR007805.
[2] OP-TEE: support for NXP SE05X Plug and Trust (patch on the list).
[3] OP-TEE: check the imx_i2c.c driver (imx6 patch on the list).

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agoverdin-imx8mm: enable fdt overlays and env importing
Igor Opaniuk [Fri, 30 Oct 2020 14:55:02 +0000 (16:55 +0200)]
verdin-imx8mm: enable fdt overlays and env importing

Enable CONFIG_CMD_IMPORTENV and CONFIG_OF_LIBFDT_OVERLAY needed
for booting regular Toradex BSP images.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agodoc: board: Convert i.MX6ULL EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:10 +0000 (17:12 +0800)]
doc: board: Convert i.MX6ULL EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX6UL 14x14 EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:09 +0000 (17:12 +0800)]
doc: board: Convert i.MX6UL 14x14 EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX6 Sabresd README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:08 +0000 (17:12 +0800)]
doc: board: Convert i.MX6 Sabresd README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX6 Sabreauto README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:07 +0000 (17:12 +0800)]
doc: board: Convert i.MX6 Sabreauto README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MXRT1050 EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:06 +0000 (17:12 +0800)]
doc: board: Convert i.MXRT1050 EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MXRT1020 EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:05 +0000 (17:12 +0800)]
doc: board: Convert i.MXRT1020 EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX8QXP MEK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:04 +0000 (17:12 +0800)]
doc: board: Convert i.MX8QXP MEK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX8MQ EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:03 +0000 (17:12 +0800)]
doc: board: Convert i.MX8MQ EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX8MM EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:02 +0000 (17:12 +0800)]
doc: board: Convert i.MX8MM EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX8MN EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:01 +0000 (17:12 +0800)]
doc: board: Convert i.MX8MN EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodoc: board: Convert i.MX8MP EVK README to reST
Peng Fan [Wed, 14 Oct 2020 09:12:00 +0000 (17:12 +0800)]
doc: board: Convert i.MX8MP EVK README to reST

Convert plain text documentation to reStructuredText format and add
it to Sphinx TOC tree. No essential content change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoboard: imx: address dd usage in README
Peng Fan [Wed, 14 Oct 2020 09:11:59 +0000 (17:11 +0800)]
board: imx: address dd usage in README

When using cygwin64 "dd (coreutils) 8.26 Packaged by Cygwin (8.26-2)",
the last not 512bytes aligned data wat cut off and not burned into SD
card.

Saying the flash.bin size is 1085608 bytes, not 512bytes aligned. It only
burned 1085440 bytes, the leaving 168 bytes were not burnned and cause
boot issue.

So update README dd command to add "conv=notrunc"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 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;

4 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

4 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>
4 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

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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

4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agobinman: Expand docs and test for padding
Simon Glass [Mon, 26 Oct 2020 23:40:09 +0000 (17:40 -0600)]
binman: Expand docs and test for padding

Padding becomes 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>
4 years agobinman: Update testPackExtra with more checks
Simon Glass [Mon, 26 Oct 2020 23:40:08 +0000 (17:40 -0600)]
binman: Update testPackExtra with more checks

Check the contents of each section to make sure it is actually in the
right place.

Also fix a whitespace error in the .dts file.

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