platform/kernel/u-boot.git
3 years agosunxi: add support for H616 uart0
Jernej Skrabec [Mon, 11 Jan 2021 20:11:41 +0000 (21:11 +0100)]
sunxi: add support for H616 uart0

This port is used for debug terminal on all known H616 boards.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: introduce support for H616 clocks
Jernej Skrabec [Mon, 11 Jan 2021 20:11:40 +0000 (21:11 +0100)]
sunxi: introduce support for H616 clocks

H616 has mostly the same clocks as H6 with some small differences. Just
reuse H6 clocks for H616 and handle differences with macros.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: support loading with SPL > 32KB
Andre Przywara [Mon, 11 Jan 2021 20:11:39 +0000 (21:11 +0100)]
sunxi: support loading with SPL > 32KB

H616 supports and needs bigger SPL than 32 KiB, mostly due to big DRAM
driver and need for PMIC configuration, which pulls several drivers which
are not needed otherwise.

spl_mmc_get_uboot_raw_sector() will now compare pre-configured size with
that, reported in SPL header. If size in header is bigger, it will use
that value instead.

In the process of function rework, also add missing function argument.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Samuel Holland <samuel@sholland.org>
3 years agosunxi: Add support for I2C on H6 like SoCs
Jernej Skrabec [Mon, 11 Jan 2021 20:11:38 +0000 (21:11 +0100)]
sunxi: Add support for I2C on H6 like SoCs

I2C support, especially R_I2C port, will be needed in future. Upcoming
support for H616 will need R_I2C to adjust DRAM voltage.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: prcm: Add memory map for H6 like SoCs
Jernej Skrabec [Mon, 11 Jan 2021 20:11:37 +0000 (21:11 +0100)]
sunxi: prcm: Add memory map for H6 like SoCs

There was no need to have prcm definitions for H6 and similar SoCs till
now. However, support R_I2C will be needed soon in SPL.

Move old definitions to prcm_sun6i.h and add new ones in prcm_sun50i.h.
One of those files will be selected in common prcm.h based on defined
macros.

This commit doesn't do any functional change.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoi2c: mvtwsi: sunxi: update macro
Jernej Skrabec [Mon, 11 Jan 2021 20:11:36 +0000 (21:11 +0100)]
i2c: mvtwsi: sunxi: update macro

While currently none of the newer Allwinner SoCs currently has I2C
support implemented in U-Boot, this will change soon. mvtwsi driver is
good as it is for them except one macro. Update it to be ready once I2C
support lands for those SoCs.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agommc: sunxi: Replace H6 ifdefs with H6 gen macro
Jernej Skrabec [Mon, 11 Jan 2021 20:11:35 +0000 (21:11 +0100)]
mmc: sunxi: Replace H6 ifdefs with H6 gen macro

It turns out that several SoCs share same mmc configuration as H6. In
order to lower ifdef clutter replace H6 specific macro with common one.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Introduce common symbol for H6 like SoCs
Jernej Skrabec [Mon, 11 Jan 2021 20:11:34 +0000 (21:11 +0100)]
sunxi: Introduce common symbol for H6 like SoCs

It turns out that there are at least 2 other SoCs which have basically
the same memory map, similar clocks and other features as H6. It's very
likely that we'll see more such SoCs in the future. In order to ease
porting to new SoCs and lower ifdef clutter, introduce common symbol for
them.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Add support for AXP305 PMIC
Jernej Skrabec [Mon, 11 Jan 2021 20:11:33 +0000 (21:11 +0100)]
sunxi: Add support for AXP305 PMIC

This PMIC can be found on H616 boards and it's very similar to AXP805
and AXP806.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Properly check for SATAPWR and MACPWR
Andre Przywara [Mon, 18 Jan 2021 23:23:59 +0000 (23:23 +0000)]
sunxi: Properly check for SATAPWR and MACPWR

The #ifdef CONFIG_xxxPWR conditionals were not working as expected, as
string Kconfig symbols are always "defined" from the preprocessor's
perspective. This lead to unnecessary calls to the GPIO routines, but
also always added a half a second delay to wait for a SATA disk to power
up. Many thanks to Peter for pointing this out!

Fix this by properly comparing the Kconfig symbols against the empty
string. strcmp() would be nicer for this, but GCC does not optimise this
away, probably due to our standalone compiler switches.

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Samuel Holland <samuel@sholland.org> # Orange Pi WinPlus
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agosunxi: Add support for Orange Pi 3
Andre Heider [Fri, 1 Oct 2021 18:29:00 +0000 (19:29 +0100)]
sunxi: Add support for Orange Pi 3

dts file is taken from Linux 5.11-rc1 tag.

The Bluetooth controller of this device ships with a default address,
use the new CONFIG_FIXUP_BDADDR option to fix it up.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
[Updated OrangePi 3 DT, rebase and config update]
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Add support for Tanix TX6
Jernej Skrabec [Wed, 6 Jan 2021 17:02:57 +0000 (18:02 +0100)]
sunxi: Add support for Tanix TX6

This commit adds support for Tanix TX6 TV box, based on H6. It's low end
H6 board, with 3 GiB of RAM, eMMC, fast ethernet, USB, IR and other
peripherals.

DT file is taken from Linux 5.11-rc1 release.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoARM: dts: sunxi: h6: Update DT files
Jernej Skrabec [Wed, 6 Jan 2021 17:02:56 +0000 (18:02 +0100)]
ARM: dts: sunxi: h6: Update DT files

Updated H6 DT files are based on Linux 5.11-rc1 release.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agonet: sun8i-emac: Allow all RGMII PHY modes
Andre Przywara [Sat, 14 Nov 2020 17:37:46 +0000 (17:37 +0000)]
net: sun8i-emac: Allow all RGMII PHY modes

So far all GBit users of the sun8i-emac driver were using the "rgmii"
PHY mode, even though this turns out to be wrong. It just worked because
the PHY driver doesn't do the proper setup (yet).
In fact for most boards the "rgmii-id" or "rgmii-txid" PHY modes are the
correct ones.

To allow the DTs to describe the phy-mode correctly, and to stay
compatible with Linux, at least allow those other RGMII modes in the
driver.

This avoids breakage if mainline DTs will be synced with U-Boot.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge tag 'u-boot-imx-20210125' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 25 Jan 2021 14:02:35 +0000 (09:02 -0500)]
Merge tag 'u-boot-imx-20210125' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

Changes for 2020.04
-------------------

- new board:
Phytec phyCORE-i.MX8MP
i.MX8MN Beacon EmbeddedWorks devkit

- Fixes:
several nanbcb fixes
fix for imx8mm_beacon
- further switch to distro boot commands
- DM:
DM Ether for MX6UL

CI:

https://gitlab.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/6013

3 years agoMerge tag 'doc-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 25 Jan 2021 14:02:06 +0000 (09:02 -0500)]
Merge tag 'doc-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for documentation tag doc-2021-04-rc1 (2)

* Man-pages for sbi, exit, for, echo, loady, true, false, conitrace
* Adjust suppression of newline in echo command.
* Provide unit test for echo command.

3 years agoMerge tag 'u-boot-atmel-2021.04-b' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 25 Jan 2021 14:01:28 +0000 (09:01 -0500)]
Merge tag 'u-boot-atmel-2021.04-b' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

Second set of u-boot-atmel features for 2021.04 cycle

This feature set includes macb updates for all interfaces and new
sama7g5 variant support; micrel ksz9031 DLL support; a new board from
Giant based on Adafruit feather form factor which contains a SAMA5D27
SoC; several fixes regarding the NAND flash PMECC block; and pincontrol
drive strength support for pio4 controller.

3 years agodoc: describe command conitrace
Heinrich Schuchardt [Mon, 25 Jan 2021 00:11:47 +0000 (01:11 +0100)]
doc: describe command conitrace

Provide a man-page for the conitrace command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: describe the false command
Heinrich Schuchardt [Sun, 24 Jan 2021 21:11:55 +0000 (22:11 +0100)]
doc: describe the false command

Provide a man-page for the false command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: core: describe uclass_root_s
Heinrich Schuchardt [Sun, 24 Jan 2021 20:48:00 +0000 (21:48 +0100)]
dm: core: describe uclass_root_s

'make htmldocs' creates a warning:

./include/asm-generic/global_data.h:443:
warning: Function parameter or member 'uclass_root_s'
not described in 'global_data'

Correct the member descriptions.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: document true command
Heinrich Schuchardt [Fri, 22 Jan 2021 18:25:53 +0000 (19:25 +0100)]
doc: document true command

Create a man-page for the true command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: describe loady command
Heinrich Schuchardt [Fri, 22 Jan 2021 18:18:01 +0000 (19:18 +0100)]
doc: describe loady command

Create a man-page for the loady command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: correct long text loadb, loadx, loady
Heinrich Schuchardt [Fri, 22 Jan 2021 12:16:04 +0000 (13:16 +0100)]
cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: document echo command
Heinrich Schuchardt [Thu, 21 Jan 2021 16:33:44 +0000 (17:33 +0100)]
doc: document echo command

Provide a man-page for the echo command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: unit test for echo command
Heinrich Schuchardt [Thu, 21 Jan 2021 17:41:28 +0000 (18:41 +0100)]
test: unit test for echo command

Provide a unit test for the unit command

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: change suppress newline in echo command
Heinrich Schuchardt [Wed, 20 Jan 2021 11:13:30 +0000 (12:13 +0100)]
cmd: change suppress newline in echo command

By default the echo command emits its arguments followed by a line feed.

If any of the arguments contains the sub-string "\c", the line feed is
suppressed.

This does not match shells used in Linux and BSD where the first argument
has to be -n to suppress the line feed.

The hush shell interferes with the parsing of backslashes. E.g. in the
following command line quadruple backslashes are required for suppressing
the line feed:

for i in 1 2 3; do for j in 4 5; do echo \\\\c ${i}${j}; done; echo; done;

To avoid unexpected behavior the patch changes echo to use -n as first
argument to suppress the line feed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: document for statement
Heinrich Schuchardt [Wed, 20 Jan 2021 17:09:30 +0000 (18:09 +0100)]
doc: document for statement

Create a man-page for the for statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: describe exit command
Heinrich Schuchardt [Wed, 20 Jan 2021 11:14:01 +0000 (12:14 +0100)]
doc: describe exit command

Man-page for exit shell command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: document sbi command
Heinrich Schuchardt [Tue, 19 Jan 2021 18:30:04 +0000 (19:30 +0100)]
doc: document sbi command

Add a man-page for the sbi command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge tag 'efi-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 24 Jan 2021 00:07:00 +0000 (19:07 -0500)]
Merge tag 'efi-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-3

Bug fixes for UEFI sub-system:

* correct value of  EFI_BLOCK_IO_PROTOCOL.Media.LastBlock
* correct GUID when closing of EFI_LOAD_FILE_PROTOCOL
* error handling in mkeficapsule tool

Bug fixes for FAT file system:

* consistent error handling for flush dir()

3 years agoRevert "doc: update Kernel documentation build system"
Tom Rini [Sat, 23 Jan 2021 17:51:37 +0000 (12:51 -0500)]
Revert "doc: update Kernel documentation build system"

Unfortunately we now see a number of now-fatal warnings about duplicate
labels.  It is often unclear how best to re-write the document in
question to not duplicate these otherwise logical headings.

This reverts commit 10a1df3cd43ba2fe893d5dd1aeb2e7109ef0007f.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-22-tool-updates'
Tom Rini [Sat, 23 Jan 2021 14:55:35 +0000 (09:55 -0500)]
Merge branch '2021-01-22-tool-updates'

- Assorted updates to the tools/ code

3 years agoMerge branch '2021-01-22-doc-updates'
Tom Rini [Sat, 23 Jan 2021 14:54:02 +0000 (09:54 -0500)]
Merge branch '2021-01-22-doc-updates'

- Assorted documentation updates

3 years agodoc: move README.menu to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 20:06:03 +0000 (21:06 +0100)]
doc: move README.menu to HTML documentation

Convert README.menu to reStructured text and add it to the HTML
documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: move test/py/README.md to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:03 +0000 (20:24 +0100)]
doc: move test/py/README.md to HTML documentation

Convert test/py/README.md to restructured text and add it to the generated
HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: move test/README to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:02 +0000 (20:24 +0100)]
doc: move test/README to HTML documentation

Move test/README to the 'Develop U-Boot' chapter of the HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: structure doc/develop/index.rst
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:01 +0000 (20:24 +0100)]
doc: structure doc/develop/index.rst

Provide sub-chapters for 'Develop U-Boot'

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: update help message
Patrick Delaunay [Thu, 14 Jan 2021 11:04:04 +0000 (12:04 +0100)]
doc: update help message

Update the help message used for 'make help':

  Documentation targets:
    Linux kernel internal documentation in different formats from ReST:
=>
    U-Boot documentation in different formats from ReST:

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodoc: update Kernel documentation build system
Heinrich Schuchardt [Fri, 1 Jan 2021 00:21:11 +0000 (01:21 +0100)]
doc: update Kernel documentation build system

Update the docomentation build system according to Linux v5.11-rc1.

With this patch we can build the HTML documentation using either of
Sphinx 2 and Sphinx 3.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Fix warning in b4860qds.rst about "Switch Settings"]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoARM: imx: add i.MX8MN lpddr4 image cfg file
Marek Vasut [Sat, 16 Jan 2021 23:17:21 +0000 (00:17 +0100)]
ARM: imx: add i.MX8MN lpddr4 image cfg file

Add cfg file for i.MX8MN LPDDR4

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoimx: Add support for i.MX8MN Beacon EmbeddedWorks devkit.
Adam Ford [Fri, 11 Dec 2020 12:01:46 +0000 (06:01 -0600)]
imx: Add support for i.MX8MN Beacon EmbeddedWorks devkit.

Beacon EmbeddedWorks is releasing a devkit based on the i.MX8M
Nano SoC consisting of baseboard + SOM.

The kit is based on the same design as the Beacon dev kit with
the i.MX8M Mini.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dart6ul: fix ddr size macro
Marc Ferland [Mon, 4 Jan 2021 19:07:53 +0000 (14:07 -0500)]
arm: dart6ul: fix ddr size macro

The previous macro was off by one bit and so we were getting a ddr
size which was twice the real size. This commit refactors the macro so
it returns the right size in _bytes_ and modifies the printf call so the
size is still printed in MiB.

Signed-off-by: Marc Ferland <ferlandm@amotus.ca>
3 years agospi: imx: Use clock framework if enabled
Marek Vasut [Mon, 18 Jan 2021 23:58:33 +0000 (00:58 +0100)]
spi: imx: Use clock framework if enabled

In case the clock framework is enabled, enable the SPI controller clock
and obtain max frequency from the clock framework.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agospi: imx: Define register bits in the driver
Marek Vasut [Mon, 18 Jan 2021 23:58:32 +0000 (00:58 +0100)]
spi: imx: Define register bits in the driver

The CSPI/ECSPI register bits do not differ between newer SoCs, instead
of having multiple copies of the same thing for each iMX SoC, define
the bits in the driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoclk: imx: Add ECSPI to iMX8MN
Marek Vasut [Mon, 18 Jan 2021 23:58:31 +0000 (00:58 +0100)]
clk: imx: Add ECSPI to iMX8MN

Add ECSPI clock entries to iMX8MN clock driver. Only make those entries
available in case SPI support in U-Boot is enabled at all to conserve
space, esp. in SPL.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm64: dts: imx8mm-beacon: Resync imx8mm-beacon-som with 5.11-rc4
Adam Ford [Mon, 18 Jan 2021 21:43:09 +0000 (15:43 -0600)]
arm64: dts: imx8mm-beacon: Resync imx8mm-beacon-som with 5.11-rc4

In order to support the QSPI chip on the SOM, the Flexspi bus
needs to be configured to talk with the SPI chip.
Resync the som device tree with 5.11-rc4

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8mm_beacon: Enable QSPI Support
Adam Ford [Mon, 18 Jan 2021 21:43:08 +0000 (15:43 -0600)]
imx8mm_beacon: Enable QSPI Support

There is a QSPI chip connected to the FSPI.  Enable the defconfig
to support it.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agospi: nxp_fspi: Enable support for nxp,imx8mm-fspi
Adam Ford [Mon, 18 Jan 2021 21:32:50 +0000 (15:32 -0600)]
spi: nxp_fspi: Enable support for nxp,imx8mm-fspi

The i.MX8M Mini can use the FlexSPI driver.  Add support
for it to the driver.

Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agommc: fsl_esdhc_imx.c: fix compiler warning
Heiko Schocher [Fri, 15 Jan 2021 09:37:09 +0000 (10:37 +0100)]
mmc: fsl_esdhc_imx.c: fix compiler warning

prevent unsued variable compiler warning if
DM_REGULATOR is not set.

Signed-off-by: Heiko Schocher <hs@denx.de>
3 years agoimx8mq: configs: add support for distro boot commands
Alice Guo [Thu, 14 Jan 2021 08:23:23 +0000 (16:23 +0800)]
imx8mq: configs: add support for distro boot commands

Supported boot device types in iMX8MQ: MMC, DHCP.

CONFIG_DISTRO_DEFAULTS is added for enabling the DISTRO_DEFAULTS option.

CONFIG_BOOTCOMMAND which is defined in include/configs/imx8mq_evk.h is
deleted because "run distro_bootcmd" is required to be the default boot
mode.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution.

kernel_addr_r is the location in RAM where the kernel will be loaded to.

Delete unnecessary environment variables because "run distro_bootcmd" is
set to be the default boot mode.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoARM: imx6: dh-imx6: Move bootcounter to SNVS_LPGDR
Marek Vasut [Wed, 13 Jan 2021 23:21:22 +0000 (00:21 +0100)]
ARM: imx6: dh-imx6: Move bootcounter to SNVS_LPGDR

Move the bootcounter to SVNS_LPGDR to free up OCRAM for usage by the VPU.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoboard: phytec: imx8mp: Add PHYTEC phyCORE-i.MX8MP support
Teresa Remmet [Wed, 13 Jan 2021 15:28:09 +0000 (16:28 +0100)]
board: phytec: imx8mp: Add PHYTEC phyCORE-i.MX8MP support

Add initial support PHYTEC phyCORE-i.MX8MP SOM.

    Supported features:
     - 2GB LPDDR4 RAM
     - eMMC
     - external SD
     - debug UART2
     - watchdog

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agow1: mxc: fix build
Martin Fuzzey [Wed, 13 Jan 2021 10:21:03 +0000 (11:21 +0100)]
w1: mxc: fix build

Now that header files no longer include common.h it must be included
first.

Otherwise the build fails with errors like
include/asm/arch/clock.h:43:1: error: unknown type name 'u32'
 u32 imx_get_uartclk(void);

Fixes: c3dc39a2f85b ("arm: Don't include common.h in header files")

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: dart6ul: enable DM_ETH for the dart6ul
Marc Ferland [Mon, 4 Jan 2021 15:41:57 +0000 (10:41 -0500)]
arm: dart6ul: enable DM_ETH for the dart6ul

This patch converts the dart6ul ethernet support to DM_ETH and cleans
up the legacy ethernet code. The clean up, more specifically:

* moves the fec2 node and pin definition to the carrier board DTS
  since the phy associated with it is on the carrier board and not on
  the SoM;
* add the reset pin associated to each phy;
* separate the ethernet, mdio and reset pins of each fec so that they
  are easier to reference;
* add clock properties to the phy nodes since they are connected to the
  50Mhz ENET[12]_TX_CLK clock of the SoC;
* remove CONFIG_BOARD_EARLY_INIT_F since the function is now empty.

Signed-off-by: Marc Ferland <ferlandm@amotus.ca>
3 years agoimx: imx8mm-beacon: Remove relocation restrictions
Adam Ford [Wed, 30 Dec 2020 15:15:43 +0000 (09:15 -0600)]
imx: imx8mm-beacon: Remove relocation restrictions

The system is capable of relocating RAM disks and the kernel.
Remove these restrictions to prevent it.

Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agoimx8mm_beacon: Enable fixed regulator in SPL
Adam Ford [Wed, 30 Dec 2020 14:14:19 +0000 (08:14 -0600)]
imx8mm_beacon: Enable fixed regulator in SPL

Because SPL can support SD UHS, the fixed regulator needs to be
enabled in SPL to reset the SD card.

Fixes: 1a5d9c84b472 ("imx8mm_beacon: Enable HS400 on MMC controller")
Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agomx6ul(l)evk: Enable DM_ETH_PHY
Sean Anderson [Mon, 28 Dec 2020 19:58:30 +0000 (14:58 -0500)]
mx6ul(l)evk: Enable DM_ETH_PHY

This fixes eth0 not initializing properly. Both eth0 and eth1 use the
MDIO interface on eth1 to access their PHYs. However, without
DM_ETH_PHY, eth0 still tries to use its own MDIO interface to access its
phy. Before this patch, a boot log might contain lines like

Net:
Warning: ethernet@20b4000 using MAC address from ROM
eth1: ethernet@20b4000 [PRIME]Could not get PHY for FEC0: addr 2

After this patch they now look like

Net:
Warning: ethernet@20b4000 using MAC address from ROM
eth1: ethernet@20b4000 [PRIME]Get shared mii bus on ethernet@2188000

Warning: ethernet@2188000 using MAC address from ROM
, eth0: ethernet@2188000

As an alternative to DM_ETH_PHY, FEC_MXC_SHARE_MDIO could also have been
used to achieve the same effect.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoboard: imx8mp: add boot.cmd for distro boot on iMX8MP
Alice Guo [Fri, 18 Dec 2020 07:19:27 +0000 (15:19 +0800)]
board: imx8mp: add boot.cmd for distro boot on iMX8MP

Distro Boot requires a U-Boot-specific script named boot.scr or
boot.scr.uimg which contains boot commands to boot the system. The
boot.cmd is such a file. Use mkimage to generate boot.scr or
boot.scr.uimg from boot.cmd, and the command is:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr.uimg

The boot.cmd file is an example script and can be modified based on
needs. bootargs is set in this script and root uses the default value
"/dev/mmcblk1p2 rootwait rw" which can be changed by overriding mmcroot.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx8mp: configs: add support for distro boot commands
Alice Guo [Fri, 18 Dec 2020 07:19:26 +0000 (15:19 +0800)]
imx8mp: configs: add support for distro boot commands

Supported boot device types in iMX8MP: MMC.

CONFIG_CMD_PART is added for command part and CONFIG_CMD_FS_GENERIC is
for command fstype.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution. kernel_addr_r is the location in RAM where
the kernel will be loaded to. Delete unnecessary environment variables
because "run distro_bootcmd" is set to be the default boot mode.

On the iMX8MP platform I used, "mmc1" represents SD card and "mmc2"
represents eMMC.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoboard: imx8mm: add boot.cmd for distro boot on iMX8MM
Alice Guo [Fri, 18 Dec 2020 06:50:08 +0000 (14:50 +0800)]
board: imx8mm: add boot.cmd for distro boot on iMX8MM

Distro Boot requires a U-Boot-specific script named boot.scr or
boot.scr.uimg which contains boot commands to boot the system. The
boot.cmd is such a file. Use mkimage to generate boot.scr or
boot.scr.uimg from boot.cmd, and the command is:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr.uimg

The boot.cmd file is an example script and can be modified based on
needs. bootargs is set in this script and root uses the default value "
/dev/mmcblk1p2 rootwait rw" which can be changed by overriding mmcroot.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx8mm: configs: add support for distro boot commands
Alice Guo [Fri, 18 Dec 2020 06:50:07 +0000 (14:50 +0800)]
imx8mm: configs: add support for distro boot commands

Supported boot device types in iMX8MM: MMC, DHCP.

CONFIG_CMD_PART is added for command part and CONFIG_CMD_FS_GENERIC is
for command fstype.

CONFIG_BOOTCOMMAND which is defined in include/configs/imx8mm_evk.h is
deleted because "run distro_bootcmd" is required to be the default boot
mode.

scriptaddr is the location in RAM where boot.scr.uimg/boot.scr will be
loaded to prior to execution.

kernel_addr_r is the location in RAM where the kernel will be loaded to.

Delete unnecessary environment variables.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
3 years agoimx: timer: Modify GPT timer driver for mx7
Ye Li [Fri, 23 Mar 2018 06:45:26 +0000 (23:45 -0700)]
imx: timer: Modify GPT timer driver for mx7

Modify the GPT common platform driver for mx7 which only use 24Mhz
OSC as clock source.

Note: at default, the mx7d will use system counter as timer. The GPT
is disabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: add QSPI boot dev
Peng Fan [Thu, 17 May 2018 07:15:59 +0000 (15:15 +0800)]
imx8m: add QSPI boot dev

When boot type could not be detected from rom sw info,
read sbmr1 to detect, here we only use it to detect FLEXSPI
boot, because ROM not update it in rom sw info.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx6: Remove AHCI device before boot OS
Ye Li [Tue, 23 Jul 2019 03:51:25 +0000 (20:51 -0700)]
imx6: Remove AHCI device before boot OS

Since we remove SATA device before boot OS, when AHCI is enabled, update
the codes to remove AHCI device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: Fix market segment fuse offset on iMX8MP
Ye Li [Tue, 10 Mar 2020 06:11:54 +0000 (23:11 -0700)]
imx: Fix market segment fuse offset on iMX8MP

iMX8MP has shifted market segment fuse one bit from 0x440 [7:6] to [6:5],
correct it in imx common codes.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agonandbcb: nand support for i.MX8MP
Han Xu [Sat, 10 Oct 2020 13:48:49 +0000 (08:48 -0500)]
nandbcb: nand support for i.MX8MP

Add NAND boot support for i.MX8MP by adding i.MX8MP in nandbcb support
list, reading boot_search_count from fuse.

i.MX8MN NAND boot is same as i.MX8MP, fix some issues as well.

Signed-off-by: Han Xu <han.xu@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix potential overflow in nandbcb_set_boot_config
Ye Li [Mon, 3 Aug 2020 06:07:55 +0000 (23:07 -0700)]
imx: nandbcb: Fix potential overflow in nandbcb_set_boot_config

Fix Coverity Issue 9006656. In nandbcb_set_boot_config, an integer overflow
occurs, with the result converted to a wider integer type.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix potential overflow in fill_dbbt_data
Ye Li [Mon, 3 Aug 2020 05:59:43 +0000 (22:59 -0700)]
imx: nandbcb: Fix potential overflow in fill_dbbt_data

Fix Coverity Issue 9006658. In fill_dbbt_data, an integer overflow occurs,
with the result converted to a wider integer type

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix resource leak in read_fcb
Ye Li [Mon, 3 Aug 2020 05:43:45 +0000 (22:43 -0700)]
imx: nandbcb: Fix resource leak in read_fcb

Fix Coverity Issue 9006657. In read_fcb, leak of memory to system
resource "fcb_raw_page". Adjust the sequence to check the mtd bad
block prior than allocation of "fcb_raw_page", also check the NULL
return of allocation.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: nandbcb: Fix resource leak
Ye Li [Mon, 3 Aug 2020 04:11:06 +0000 (21:11 -0700)]
imx: nandbcb: Fix resource leak

Fix Coverity Issue 9006655. In write_fcb, leak of memory to resource
"fcb_raw_page". Since we have initialized the "ret" to 0, should return
the value of ret.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agonandbcb: Fix uninitialized variable
Ye Li [Mon, 3 Aug 2020 03:55:17 +0000 (20:55 -0700)]
nandbcb: Fix uninitialized variable

Fix Coverity Issue 9006654. In write_fcb, use of an uninitialized
variable "ret".

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn/p: drop CONFIG_SYS_[I,D]CACHE_OFF
Peng Fan [Wed, 13 Jan 2021 02:56:36 +0000 (10:56 +0800)]
imx: imx8mn/p: drop CONFIG_SYS_[I,D]CACHE_OFF

Drop CONFIG_SYS_[I,D]CACHE_OFF, it is safe to run with caches enabled on
these platforms.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: lowlevel_init: tune alignment
Peng Fan [Sun, 27 Dec 2020 13:07:08 +0000 (21:07 +0800)]
imx8m: lowlevel_init: tune alignment

The minimum alignment is 16 bytes, so use align 4 is enough.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mq: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 08:11:56 +0000 (16:11 +0800)]
arm: dts: imx8mq: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mm: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 06:18:13 +0000 (14:18 +0800)]
arm: dts: imx8mm: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mp: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 03:22:52 +0000 (11:22 +0800)]
arm: dts: imx8mp: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx8m: clock: add type of set_clk_eqos
Peng Fan [Sun, 27 Dec 2020 03:18:59 +0000 (11:18 +0800)]
imx8m: clock: add type of set_clk_eqos

Add type of set_clk_eqos to make it could be used by other files.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoarm: dts: imx8mn: sync dts from Linux Kernel
Peng Fan [Sun, 27 Dec 2020 01:37:06 +0000 (09:37 +0800)]
arm: dts: imx8mn: sync dts from Linux Kernel

Sync dts from Linux Kernel
commit f838f8d2b694cf9d524dc("mfd: ab8500-debugfs: Remove extraneous seq_putc")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn_evk: correct stack/malloc adress
Peng Fan [Sat, 26 Dec 2020 11:35:42 +0000 (19:35 +0800)]
imx: imx8mn_evk: correct stack/malloc adress

Move SP to end of OCRAM space. Drop MALLOC_F to make it alloc from
stack space.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: ddr: imx8m: Move selfref_en after DDR scrub
Ye Li [Wed, 30 Sep 2020 04:55:32 +0000 (21:55 -0700)]
imx: ddr: imx8m: Move selfref_en after DDR scrub

When doing DDR scrub, the DDR may enter into self refresh if the
selfref_en is enabled before DDR scrub. This will cause scrub
can't complete that SBRSTAT.scrub_done won't be set.

Since the selfref_en can be programmed during the course of
normal operation, move it after DDR scrub

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mn_ddr4_evk: Use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board
Peng Fan [Fri, 25 Dec 2020 08:23:12 +0000 (16:23 +0800)]
imx: imx8mn_ddr4_evk: Use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board

use CONFIG_TARGET_IMX8MN_DDR4_EVK for DDR4 EVK board, we will use
CONFIG_TARGET_IMX8MN_EVK for LPDDR4 EVK board.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mp_evk: enable eth support
Peng Fan [Fri, 25 Dec 2020 08:16:34 +0000 (16:16 +0800)]
imx: imx8mp_evk: enable eth support

Add board code to configure the network interface
Add net defconfig

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoefi_loader: correct EFI_BLOCK_IO_PROTOCOL.Media.LastBlock
Heinrich Schuchardt [Sat, 23 Jan 2021 05:52:21 +0000 (06:52 +0100)]
efi_loader: correct EFI_BLOCK_IO_PROTOCOL.Media.LastBlock

The field Media.LastBlock of the EFI_BLOCK_IO_PROTOCOL.Media was filled
incorrectly both for block devices as well as for partitions.

The field must be filled with the index of the last logical block (LBA):

* block devices: device size minus 1
* partitions: partition size minus 1

Reported-by: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: notification with TPL_APPLICATION not allowed
Heinrich Schuchardt [Wed, 6 Jan 2021 11:55:22 +0000 (12:55 +0100)]
efi_loader: notification with TPL_APPLICATION not allowed

The UEFI specification requires event notification levels to be
> TPL_APPLICATION and <= TPL_HIGH_LEVEL.

With the patch the CreateEvent() and CreatedEventEx() services are changed
to check that the notification level is not TPL_APPLICATION.

Reference:
UEFI Specification 2.8 Errata B, table 27 "TPL Restrictions",
"Event Notification Levels"

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agomkeficapsule: Miscellaneous fixes in the utility
Sughosh Ganu [Fri, 22 Jan 2021 15:04:56 +0000 (20:34 +0530)]
mkeficapsule: Miscellaneous fixes in the utility

Miscellaneous fixes in the mkeficapsule utility -- these include a few
resource leak issues flagged by Coverity along with some additional
code improvements suggested by Heinrich during code review.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agotools: mkeficapsule: fill reserved members of structure
AKASHI Takahiro [Fri, 22 Jan 2021 01:43:49 +0000 (10:43 +0900)]
tools: mkeficapsule: fill reserved members of structure

Fill reserved members of efi_firmware_management_capsule_image_header
structure with zero's for safety.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: CID 316354
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: capsule: fix SIZEOF_MISMATCH warning
AKASHI Takahiro [Fri, 22 Jan 2021 01:43:27 +0000 (10:43 +0900)]
efi_loader: capsule: fix SIZEOF_MISMATCH warning

CID 316361 says:
> Passing argument "count * 8UL /* sizeof (*files) */" to
> function "dlmalloc" and then casting the return value to "u16 **" is
> suspicious. In this particular case "sizeof (u16 **)" happens to be equal
> to "sizeof (u16 *)", but this is not a portable assumption.
> > 767         tmp_files = malloc(count * sizeof(*files));

The change in this patch fixes the ambiguity.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: CID 316361
For readability use *tmp_files instead of tmp_files[0]
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: efidebug: always check return code from get_variable()
AKASHI Takahiro [Fri, 22 Jan 2021 01:42:48 +0000 (10:42 +0900)]
cmd: efidebug: always check return code from get_variable()

CID 316364 says:
> Null pointer dereferences  (FORWARD_NULL)
> printf("Result total size: 0x%x\n", result->variable_total_size);
at do_efi_capsule_res().

The code is basically safe because a buffer for "result" is allocated
by malloc() and filled up by the second get_variable(), which fails any way
if the allocation has failed.

But the first (and second) get_variable() possibly returns an error other
than EFI_SUCCESS. We always need to check the return code from
get_variable() before accessing the data in "result".

While this change won't suppress CID 316364, the resulting code is much
safer.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fix efi_load_image_from_path()
Heinrich Schuchardt [Wed, 20 Jan 2021 21:57:46 +0000 (22:57 +0100)]
efi_loader: fix efi_load_image_from_path()

Use the correct GUID when closing the file load protocol.
Remove an unnecessary check (Coverity CID 316363).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: structure for name and extension
Heinrich Schuchardt [Wed, 20 Jan 2021 23:23:33 +0000 (00:23 +0100)]
fs: fat: structure for name and extension

The short name and extension of FAT files are stored in adjacent fields of
the directory entry. For some operations like calculating a checksum or
copying both fields it is preferable to treat both as one structure.

Change the definition of the directory entry structure to include a
structure comprising the name and the extension field.

This resolves Coverity CID 316357, CID 316350, CID 316348.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: consistent error handling for flush_dir()
Heinrich Schuchardt [Wed, 20 Jan 2021 21:21:53 +0000 (22:21 +0100)]
fs: fat: consistent error handling for flush_dir()

Provide function description for flush_dir().
Move all error messages for flush_dir() from the callers to the function.
Move mapping of errors to -EIO to the function.
Always check return value of flush_dir() (Coverity CID 316362).

In fat_unlink() return -EIO if flush_dirty_fat_buffer() fails.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools: env: return error if ubi_update_start() fails
Martin Hundebøll [Mon, 30 Nov 2020 11:11:32 +0000 (12:11 +0100)]
tools: env: return error if ubi_update_start() fails

The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't
obtained. If this happens, the flush operation doesn't return error,
leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes: 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")
Signed-off-by: Martin Hundebøll <martin@geanix.com>
3 years agomkimage: Move padding commands outside of FIT_SIGNATURE
Joel Stanley [Tue, 8 Dec 2020 04:12:15 +0000 (14:42 +1030)]
mkimage: Move padding commands outside of FIT_SIGNATURE

These commands were disabled when CONFIG_FIT_SIGNATURE is disabled, but
they do not depend on crypto support so they can be unconditionally
enabled.

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agoimage-fit: Fix FIT_CIPHER linking
Joel Stanley [Tue, 8 Dec 2020 04:12:14 +0000 (14:42 +1030)]
image-fit: Fix FIT_CIPHER linking

When CONFIG_FIT_CIPHER=y and CONFIG_FIT_SIGNATURE=n is there is no
implementation of image_get_host_blob for mkimage/dumpimage:

 /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data':
 image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob'

Move the implementation to a common file so it can be shaed between
image-cipher.c and image-fit-sig.c.

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agotools/Makefile: FIT_CIPHER requires libssl
Joel Stanley [Tue, 8 Dec 2020 04:12:13 +0000 (14:42 +1030)]
tools/Makefile: FIT_CIPHER requires libssl

If CONFIG_FIT_CIPHER is enabled without CONFIG_FIT_SIGNATURE then
mkimage/dumpimage will fail to link:

 /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data':
 image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x10): undefined reference to `EVP_aes_128_cbc'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x40): undefined reference to `EVP_aes_192_cbc'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x70): undefined reference to `EVP_aes_256_cbc'
 /usr/bin/ld: tools/lib/aes/aes-encrypt.o: in function `image_aes_encrypt':
 aes-encrypt.c:(.text+0x22): undefined reference to `EVP_CIPHER_CTX_new'
 /usr/bin/ld: aes-encrypt.c:(.text+0x6f): undefined reference to `EVP_EncryptInit_ex'
 /usr/bin/ld: aes-encrypt.c:(.text+0x8d): undefined reference to `EVP_EncryptUpdate'
 /usr/bin/ld: aes-encrypt.c:(.text+0xac): undefined reference to `EVP_CIPHER_CTX_free'
 /usr/bin/ld: aes-encrypt.c:(.text+0xf2): undefined reference to `EVP_EncryptFinal_ex'
 collect2: error: ld returned 1 exit status

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agotools: image-host: add support for several sub-images
Philippe Reynes [Tue, 24 Nov 2020 13:39:48 +0000 (14:39 +0100)]
tools: image-host: add support for several sub-images

The propoerty sign-images points to images in the configuration
node. But thoses images may references severals "sub-images" (for
example for images loadable). This commit adds the support of
severals sub-images.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
3 years agotools: image-host: clean function fit_config_get_hash_list
Philippe Reynes [Tue, 24 Nov 2020 13:39:47 +0000 (14:39 +0100)]
tools: image-host: clean function fit_config_get_hash_list

This commit creates a function fit_config_add_hash that will be
used in the next commit to support several 'sub-images'.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: FIT image: Clarify format and simplify syntax
Alexandru Gagniuc [Tue, 15 Dec 2020 19:15:43 +0000 (13:15 -0600)]
doc: FIT image: Clarify format and simplify syntax

** Introduction

There are currently four ways to load an OS image with u-boot
  1. SPL -> u-boot -> bootm
  2. SPL blue falcon mode
  3. "Basic" FIT image (CONFIG_LOAD_FIT)
  4. "Full-featured" FIT image (CONFIG_LOAD_FIT_FULL)

These four code paths were developed independently, and share very
little code. (3) and (4), behave very differently, are littered with
special cases. They even have different DTS syntax and properties.

The cause of this divergence is that the FIT format specification
leaves a number of things open to interpretation. The purpose of this
change is to enable the reduction of code size, duplication, and
complexity by updating and streamlining the FIT format.

We are only marginally concerned with backwards compatibility, because
we don't have inter-compatibility. For example, CONFIG_LOAD_FIT is
able to load images that CONFIG_LOAD_FIT_FULL won't. This is a direct
result of the incompatible syntax between the two implementations.

Ideally, these changes would enable "simple" FIT to be a subset of the
"full" fit implementation, and share most code. These changes should
also eliminate the need for falcon mode (although we are not
advocating for the removal of falcon mode at this time).

** Description of changes

 * The "configurations" node is now mandatory

Guessing how to load components based on their "os" and "type" invites
confusion and superfluous heuristics. Instead, require each FIT image
to be explicit on how components should be loaded.

 * Eliminate "ramdisk", "setup", "standalone", and "fpga" properties

Having too many special purpose properties requires special-casing
FIT loading code. When a special property can be handled by another
property, it is redundant.
 - A "ramdisk" is identical to a loadable. Thus ramdisk images should
   be placed under "loadables".
 - A "setup" node can be achieved by using a "kernel" or "firmware"
   property instead.
 - "standalone" is used for u-boot nodes. The correct property to use
   in this case is "firmware".
 - "fpga" is a loadable

 * Prioritize control between "firmware" and "kernel"

"firmware" and "kernel" are special nodes in that control is passed
to the "entry-point" of the image. Both can be present, for example,
an OP-TEE firmware with a linux kernel. When both are present,
control is passed to the "firmware" image.

** Further generalizations (not included herein)

The "firmware" and "kernel" properties could be generalized as a
"next-boot-stage", or similar name. This "next" stage would be special
in that it is both executable, and is the stage that is passed
control. For example, "next-stage" could be an op-tee image, with
linux as a loadable, or a u-boot image.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung.git
Tom Rini [Fri, 22 Jan 2021 21:01:27 +0000 (16:01 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung.git

3 years agoARM: at91: spl: add spl_early_init for sama5d2 platforms
Greg Gallagher [Thu, 21 Jan 2021 16:55:36 +0000 (11:55 -0500)]
ARM: at91: spl: add spl_early_init for sama5d2 platforms

The dm root node is needed early in the spl to allow the timer to be
used.  This change calls spl_early_init to initialize the dm root node.

Signed-off-by: Greg Gallagher <greg@embeddedgreg.com>