platform/kernel/u-boot.git
3 years agoMerge tag 'mips-pull-2021-01-24' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 25 Jan 2021 19:38:40 +0000 (14:38 -0500)]
Merge tag 'mips-pull-2021-01-24' of https://gitlab.denx.de/u-boot/custodians/u-boot-mips

- MIPS: add support for Mediatek MT7620 SoCs

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 agoMAINTAINERS: add maintainer for MediaTek MIPS platform
Weijie Gao [Thu, 12 Nov 2020 08:37:19 +0000 (16:37 +0800)]
MAINTAINERS: add maintainer for MediaTek MIPS platform

Update maintainer for MediaTek MIPS platform

Acked-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoreset: reset-mtmips: add DM_FLAG_PRE_RELOC flag
Weijie Gao [Thu, 12 Nov 2020 08:37:14 +0000 (16:37 +0800)]
reset: reset-mtmips: add DM_FLAG_PRE_RELOC flag

Add DM_FLAG_PRE_RELOC flag for reset-mtmips to make sure this driver can
be probed before relocation even if u-boot,dm-pre-reloc is not present
in the dts.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agommc: mtk-sd: assign plat->cfg.f_max with a correct value
Weijie Gao [Thu, 12 Nov 2020 08:37:07 +0000 (16:37 +0800)]
mmc: mtk-sd: assign plat->cfg.f_max with a correct value

Currently this driver does not set the value of plat->cfg.f_max, which
results in that MMC framework will always run at the lowest frequency.

This patch sets plat->cfg.f_max to the maximum allowed frequency, which
equals to the source clock frequency.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agommc: mtk-sd: add pad control settings for MediaTek MT7620/MT76x8 SoCs
Weijie Gao [Thu, 12 Nov 2020 08:37:02 +0000 (16:37 +0800)]
mmc: mtk-sd: add pad control settings for MediaTek MT7620/MT76x8 SoCs

The driver is missing pad control settings (pad delay and pad conf) for
the mt7620 and mt76x8. Although mt76x8 still works well, mt7620 will
encounter CRC error on data transfers.

This patch adds default pad control settings for mt7620_compat.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agommc: mtk-sd: fix sclk cycles shift value
Weijie Gao [Thu, 12 Nov 2020 08:36:57 +0000 (16:36 +0800)]
mmc: mtk-sd: fix sclk cycles shift value

It turns out that the sclk cycles used by mt7620/mt7628 is the same as
other chips (20 bits, 1048576), not 65536.

This patch removes sclk_cycle_shift from dev_comp, and uses a macro with
a value 20 instead.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agonet: add ethernet driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:53 +0000 (16:36 +0800)]
net: add ethernet driver for MediaTek MT7620 SoC

This patch adds  ethernet driver for MediaTek MT7620 SoC.

The MT7620 SoC has a built-in ethernet (Frame Engine) and a built-in
7-port switch and two xMII interfaces (can be MII/RMII/RGMII).

The port 0-3 of the switch connects to intergrited FE PHYs. Port 4 can be
configured to connect to either the intergrited FE PHY, or the xMII.
Port 5 always connects to the xMII. Port 6 is the CPU port.

This driver supports MT7530 giga switch connects to port 5.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agophy: add USB PHY driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:48 +0000 (16:36 +0800)]
phy: add USB PHY driver for MediaTek MT7620 SoC

This patch adds USB PHY driver for MediaTek MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agospi: add spi controller support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:42 +0000 (16:36 +0800)]
spi: add spi controller support for MediaTek MT7620 SoC

This patch adds spi controller support for MediaTek MT7620 SoC.

The SPI controller supports two chip selects. These two chip selects are
implemented as two separate register groups, but they share the same bus
(DI/DO/CLK), only CS pins are dedicated for each register group.
Appearently these two register groups cannot operates simulataneously so
they are implemented as one controller.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agogpio: add GPIO controller driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:33 +0000 (16:36 +0800)]
gpio: add GPIO controller driver for MediaTek MT7620 SoC

This patch adds GPIO controller driver for MediaTek MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agowatchdog: add watchdog driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:28 +0000 (16:36 +0800)]
watchdog: add watchdog driver for MediaTek MT7620 SoC

This patch adds watchdog support for the Mediatek MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agopinctrl: mtmips: add support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:24 +0000 (16:36 +0800)]
pinctrl: mtmips: add support for MediaTek MT7620 SoC

This patch adds pinctrl support for MediaTek MT7620 SoC.
The MT7620 SoC supports only pinmux.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoreset: mtmips: add reset controller support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:19 +0000 (16:36 +0800)]
reset: mtmips: add reset controller support for MediaTek MT7620 SoC

This patch adds reset controller bits definition header file for MediaTek
MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoclk: add clock driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:10 +0000 (16:36 +0800)]
clk: add clock driver for MediaTek MT7620 SoC

This patch adds a clock driver for MediaTek MT7620 SoC.
This driver provides clock gate control as well as getting clock frequency
for CPU/SYS/XTAL and some peripherals.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoserial: add uart driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:05 +0000 (16:36 +0800)]
serial: add uart driver for MediaTek MT7620 SoC

This patch adds uart support for MediaTek MT7620 and earlier SoCs.

The UART used by MT7620 is incompatible with the ns16550a driver.
All registers of this UART have different addresses. A special 16-bit
register for Divisor Latch is used to set the baudrate instead of the
original two 8-bit registers (DLL and DLM).

The driver supports of-platdata which is useful for tiny SPL.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoconfigs: mtmips: refresh for mt7628 based boards
Weijie Gao [Thu, 12 Nov 2020 08:36:00 +0000 (16:36 +0800)]
configs: mtmips: refresh for mt7628 based boards

Since mt7620 is added into Kconfig, the CONFIG_SOC_MT7628=y which is
omitted by default must be added back, otherwise make xxx_defconfig for
these boards will be configured for mt7620 platform.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add two reference boards for mt7620
Weijie Gao [Thu, 12 Nov 2020 08:35:56 +0000 (16:35 +0800)]
mips: mtmips: add two reference boards for mt7620

The mt7620_rfb board supports integrated 10/100M PHYs plus two external
giga PHYs. It also has 8MB SPI-NOR, mini PCI-e x1 slot, SDHC and USB.

The mt7620_mt7530_rfb boards supports an external MT7530 giga switch and a
16MB SPI-NOR flash.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:35:52 +0000 (16:35 +0800)]
mips: mtmips: add support for MediaTek MT7620 SoC

This patch adds support for MediaTek MT7620 SoC.
All files are dedicated for u-boot.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add support to initialize SDRAM
Weijie Gao [Thu, 12 Nov 2020 08:35:43 +0000 (16:35 +0800)]
mips: mtmips: add support to initialize SDRAM

This patch adds support for mtmips SoCs to initialize the SDRAM.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: enable _machine_restart for spl
Weijie Gao [Thu, 12 Nov 2020 08:35:38 +0000 (16:35 +0800)]
mips: enable _machine_restart for spl

The sysreset driver has a config CONFIG_SPL_SYSRESET for the spl stage.
Change CONFIG_SYSRESET to CONFIG_IS_ENABLED(SYSRESET) will give spl a
chance to use _machine_restart instead of the sysreset driver.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: fix dram size detection in dram_init
Weijie Gao [Thu, 12 Nov 2020 08:35:33 +0000 (16:35 +0800)]
mips: mtmips: fix dram size detection in dram_init

CONFIG_SYS_SDRAM_BASE points to cached memory, i.e. KSEG0, which is not
suitable for detecting memory size.

Replace CONFIG_SYS_SDRAM_BASE with KSEG1, and make dram_init() always do
memory size detection in any stage.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: select SYSRESET for mt7628 only
Weijie Gao [Thu, 12 Nov 2020 08:35:28 +0000 (16:35 +0800)]
mips: mtmips: select SYSRESET for mt7628 only

Currently only mt7628 needs the sysreset driver, do not select it for
mt7620.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: move mt7628 related Kconfig into mt7628 subdirectory
Weijie Gao [Thu, 12 Nov 2020 08:35:23 +0000 (16:35 +0800)]
mips: mtmips: move mt7628 related Kconfig into mt7628 subdirectory

This patch is a preparation for add a new soc fot mtmips.

Move all mt7628 related Kconfig (boards and UART selection) into mt7628
subdirectory and make sure the top directory of mtmips contains only
selection for SoCs.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: dts: switch to board defines for dtb for mtmips
Weijie Gao [Thu, 12 Nov 2020 08:35:17 +0000 (16:35 +0800)]
mips: dts: switch to board defines for dtb for mtmips

Previous the dts files for gardena-smart-gateway-mt7688 and
linkit-smart-7688 are set to be built when mtmips is selected.

This can lead to a compilation error if another soc is added to this arch
with different dtsi files.

So it's better to build the dtb only if their board is selected.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
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>