]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agonet: eth-uclass: avoid running start() twice without stop()
Matthias Schiffer [Wed, 4 Nov 2020 13:45:14 +0000 (14:45 +0100)]
net: eth-uclass: avoid running start() twice without stop()

Running the start() handler twice without a stop() inbetween completely
breaks communication for some ethernet drivers like fec_mxc.

eth_halt() is called before each eth_init(). Due to the switch to
eth_is_active() in commit 68acb51f442f ("net: Only call halt on a driver
that has been init'ed"), this is not sufficient anymore when netconsole
is active: eth_init_state_only()/eth_halt_state_only() manipulate the
state check that is performed by eth_is_active() without actually
calling into the driver.

The issue can be triggered by starting a network operation (e.g. ping or
tftp) while netconsole is active.

Add an additional "running" flag that reflects the actual state of the
driver and use it to ensure that eth_halt() actually stops the device as
it is supposed to.

Fixes: 68acb51f442f ("net: Only call halt on a driver that has been init'ed")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agoMerge branch '2021-01-18-assorted-platform-updates'
Tom Rini [Tue, 19 Jan 2021 12:56:59 +0000 (07:56 -0500)]
Merge branch '2021-01-18-assorted-platform-updates'

- Assorted MediaTek, AST2x00 updates
- Assorted driver fixes for various platforms
- Keymile platform updates
- Add pwm command, mp5416 pmic driver

3 years agodts: mt7622: use accurate clock source fot mtk_timer
Weijie Gao [Tue, 12 Jan 2021 05:44:11 +0000 (13:44 +0800)]
dts: mt7622: use accurate clock source fot mtk_timer

The input system clock for mt7622 timer is 10MHz and can be retrieved
through the clk driver.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agotimer: mtk_timer: initialize the timer before use
Weijie Gao [Tue, 12 Jan 2021 05:44:02 +0000 (13:44 +0800)]
timer: mtk_timer: initialize the timer before use

The timer being used by this driver may have already been used by first
stage bootloader (e.g. ATF/preloader), and it's settings may differ from
what this driver is going to use.

This may cause issues, such as inaccurate timer frequency due to
incorrect clock divider.

This patch adds the initialization code to avoid them.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agopinctrl: mediatek: correct error handling
Heinrich Schuchardt [Sun, 27 Dec 2020 20:18:26 +0000 (21:18 +0100)]
pinctrl: mediatek: correct error handling

If no GPIO controller is found, the return value should not depend on a
random value on the stack. Initialize variable ret.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agomtd: remove drivers/mtd/mw_eeprom.c
Heinrich Schuchardt [Sun, 27 Dec 2020 10:54:23 +0000 (11:54 +0100)]
mtd: remove drivers/mtd/mw_eeprom.c

drivers/mtd/mw_eeprom.c contains code that never worked. mw_eeprom_write()
and mw_eeprom_read() have incorrect loop conditions:

while (len <= 2) {

CONFIG_MW_EEPROM is not set anywhere. So let's simply drop the module.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodrivers: qe: avoid double free()
Heinrich Schuchardt [Sun, 27 Dec 2020 10:48:49 +0000 (11:48 +0100)]
drivers: qe: avoid double free()

Avoid calling free(addr) twice if the device for ucode is not found.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agommc: fsl_esdhc_spl: remove superfluous free()
Heinrich Schuchardt [Sun, 27 Dec 2020 09:50:26 +0000 (10:50 +0100)]
mmc: fsl_esdhc_spl: remove superfluous free()

Freeing a buffer before calling hang() is superfluous. Removing the call
reduces the SPL size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodoc: board: freescale: advise to use newer atf and firmware
Andrey Zhizhikin [Sun, 13 Dec 2020 20:36:06 +0000 (20:36 +0000)]
doc: board: freescale: advise to use newer atf and firmware

Update branch and version information of ATF and DDR firmware files to
point to latest releases provided by NXP.

This is especially critical for imx8mp evk, as the ATF support for that
SoC is only available in latest releases.

Align all SoCs from imx8m family to use identical revisions of ATF and
DDR firmware.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agodma: bcm6348: incorrect buffer allocation
Heinrich Schuchardt [Sun, 27 Dec 2020 09:26:00 +0000 (10:26 +0100)]
dma: bcm6348: incorrect buffer allocation

Calling calloc() for 0 members does not make any sense.
Setting ch_priv->busy_desc = NULL for ch_priv->desc_cnt > 0 is equally
unreasonable.

The current code will lead to a NULL dereference in bcm6348_iudma_enable().

The assignments for ch_priv->busy_desc are obviously swapped.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: Add a pwm command
Pragnesh Patel [Tue, 22 Dec 2020 06:00:05 +0000 (11:30 +0530)]
cmd: Add a pwm command

Add the command "pwm" for controlling the pwm channels. This
command provides pwm invert/config/enable/disable functionalities
via PWM uclass drivers

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopower: pmic: add driver for Monolithic Power mp5416
Tim Harvey [Mon, 21 Dec 2020 16:19:39 +0000 (08:19 -0800)]
power: pmic: add driver for Monolithic Power mp5416

This adds basic register access and child regulator binding
for the Monolithic MP5416 Power Management IC which integrates
four DC/DC switching converters and five LDO regulators.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoconfigs: aspeed: Add defconfig for AST2600 EVB
Chia-Wei, Wang [Mon, 14 Dec 2020 05:54:29 +0000 (13:54 +0800)]
configs: aspeed: Add defconfig for AST2600 EVB

Add the default configuration for the AST2600 EVB.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agoaspeed: Add AST2600 platform support
Chia-Wei, Wang [Mon, 14 Dec 2020 05:54:28 +0000 (13:54 +0800)]
aspeed: Add AST2600 platform support

Add low level platform initialization for the AST2600 SoC.
The 2-stage booting with U-Boot SPL are leveraged to support
different booting mode.

However, currently the patch supports only the booting from
memory-mapped SPI flash.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agoARM: dts: aspeed: Add AST2600 SoC support
Chia-Wei, Wang [Mon, 14 Dec 2020 05:54:27 +0000 (13:54 +0800)]
ARM: dts: aspeed: Add AST2600 SoC support

AST2600 is the 7th generation of Aspeed SoC designated for
Interated Remote Management Processor.

AST2600 has significant performance improvement by integrating
1.2GHz dual-core ARM Cortex A7 (r0p5) CPU with FPU. Most of the
controllers are also improved with more features and better
performance than preceding AST24xx/AST25xx.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agoreset: aspeed: Add AST2600 reset support
Chia-Wei, Wang [Mon, 14 Dec 2020 05:54:26 +0000 (13:54 +0800)]
reset: aspeed: Add AST2600 reset support

Add controller reset support through the
System Control Unit (SCU) of AST2600 SoC.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agowdt: aspeed: Add AST2600 watchdog support
Chia-Wei, Wang [Mon, 14 Dec 2020 05:54:25 +0000 (13:54 +0800)]
wdt: aspeed: Add AST2600 watchdog support

AST2600 has 8 watchdog timers including 8 sets of
32-bit decrement counters, based on 1MHz clock.

A 64-bit reset mask is also supported to specify
which controllers should be reset by the WDT reset.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agoram: aspeed: Add AST2600 DRAM control support
Dylan Hung [Mon, 14 Dec 2020 05:54:24 +0000 (13:54 +0800)]
ram: aspeed: Add AST2600 DRAM control support

AST2600 supports DDR4 SDRAM with maximum speed DDR4-1600.
The DDR4 DRAM types including 128MbX16 (2Gb), 256MbX16 (4Gb),
512MbX16 (8Gb), 1GbX16 (16Gb), and 1GbX8 TwinDie (16Gb) are supported.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agoclk: aspeed: Add AST2600 clock support
Ryan Chen [Mon, 14 Dec 2020 05:54:23 +0000 (13:54 +0800)]
clk: aspeed: Add AST2600 clock support

This patch adds the clock control driver
for the AST2600 SoC.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agoboard: presidio: Add Parallel NAND support
Kate Liu [Fri, 11 Dec 2020 21:46:13 +0000 (13:46 -0800)]
board: presidio: Add Parallel NAND support

Set environment for Nand flash (U-boot 2020.04):
- add nand flash in the device tree
- add new default configuration file for G3 using parallel Nand
- set nand parameters in presidio_asic.h

Signed-off-by: Kate Liu <kate.liu@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
CC: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agomtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support
Kate Liu [Fri, 11 Dec 2020 21:46:12 +0000 (13:46 -0800)]
mtd: rawnand: cortina_nand: Add Cortina CAxxxx SoC support

Add Cortina Access parallel Nand support for CAxxxx SOCs

Signed-off-by: Kate Liu <kate.liu@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
CC: Tom Rini <trini@konsulko.com>
CC: Scott Wood <oss@buserror.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agokm/arm: cleanup defconfig files
Holger Brunck [Fri, 6 Nov 2020 09:42:08 +0000 (10:42 +0100)]
km/arm: cleanup defconfig files

Disable some unneeded config options and adapt the ident string.

CC: Stefan Roese <sr@denx.de>
Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agokm/kirkwood: enable USB support and the host controller driver
Holger Brunck [Tue, 3 Nov 2020 14:41:25 +0000 (15:41 +0100)]
km/kirkwood: enable USB support and the host controller driver

Our kirkwood device embeds a USB host controller that is now used
on some boards. This enables the support of USB and the corresponding
driver.

Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
CC: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agommc: Only retrieve cd pin when GPIO is enabled
Harm Berntsen [Fri, 6 Nov 2020 12:20:44 +0000 (12:20 +0000)]
mmc: Only retrieve cd pin when GPIO is enabled

The driver only needs to retrieve the pin for the ACPI info. The driver
itself works without depending on GPIO.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoacpi: Add missing ARM acpi_table header
Harm Berntsen [Fri, 6 Nov 2020 12:24:17 +0000 (12:24 +0000)]
acpi: Add missing ARM acpi_table header

The pci_mmc.c driver can generate ACPI info and therefore includes
asm/acpi_table.h by proxy. This file does not exist for the ARM
architecture and thus code compilation failed when using this
driver on ARM.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: do not include <asm/arch/gpio.h> on ARCH_QEMU
Harm Berntsen [Fri, 30 Oct 2020 08:45:15 +0000 (08:45 +0000)]
gpio: do not include <asm/arch/gpio.h> on ARCH_QEMU

As no gpio.h is defined for this architecture, to avoid
compilation failure, do not include <asm/arch/gpio.h> for
QEMU.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
3 years agoclk: mediatek: Add MT8183 clock driver
Fabien Parent [Sat, 17 Oct 2020 10:52:15 +0000 (12:52 +0200)]
clk: mediatek: Add MT8183 clock driver

Add the topckgen, apmixedsys and infracfg clock driver for the MT8183
SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agotools: mtk_image: add support for booting ARM64 images
Fabien Parent [Fri, 16 Oct 2020 17:52:37 +0000 (19:52 +0200)]
tools: mtk_image: add support for booting ARM64 images

mkimage is only able to package aarch32 binaries. Add support for
AArch64 images.

One can create a ARM64 image using the following command line:
mkimage -T mtk_image -a 0x201000 -e 0x201000 -n "media=emmc;arm64=1"
-d bl2.bin bl2.img

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoconfigs: pumpkin: enable fastboot
Fabien Parent [Fri, 16 Oct 2020 15:40:09 +0000 (17:40 +0200)]
configs: pumpkin: enable fastboot

Enable fastboot commands for mt8516 pumpkin board.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoconfigs: pumpkin: enable USB gadget
Fabien Parent [Fri, 16 Oct 2020 15:40:08 +0000 (17:40 +0200)]
configs: pumpkin: enable USB gadget

Enable USB gadget on pumpkin. This requires to also enable
BOARD_LATE_INIT since the init is done in board_late_init function.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoboard: mediatek: pumpkin: initialize usb device
Fabien Parent [Fri, 16 Oct 2020 15:40:07 +0000 (17:40 +0200)]
board: mediatek: pumpkin: initialize usb device

Initialize USB device on pumpkin if it is enabled in the config.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoarm: dts: mt8516-pumpkin: enable usb port
Fabien Parent [Fri, 16 Oct 2020 15:40:06 +0000 (17:40 +0200)]
arm: dts: mt8516-pumpkin: enable usb port

Enable the USB port for MT8516 Pumpkin Board.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoarm: dts: mt8516: add support for USB
Fabien Parent [Fri, 16 Oct 2020 15:40:05 +0000 (17:40 +0200)]
arm: dts: mt8516: add support for USB

Add support for USB on mt8516 based SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Mon, 18 Jan 2021 17:37:55 +0000 (12:37 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- R-Car pinctrl updates

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Mon, 18 Jan 2021 13:04:28 +0000 (08:04 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
  - Select TIMER_EARLY to avoid infinite recursion for Trace.

3 years agoMerge tag 'doc-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 18 Jan 2021 13:04:05 +0000 (08:04 -0500)]
Merge tag 'doc-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for documentation tag doc-2021-04-rc1

* document man-page base command
* move README.fdt-overlays to HTML documentation
* add synopsis for pstore command

3 years agoMerge branch '2021-01-16-assorted-improvements'
Tom Rini [Mon, 18 Jan 2021 12:55:54 +0000 (07:55 -0500)]
Merge branch '2021-01-16-assorted-improvements'

- Assorted testing improvements and fixes
- Assorted code cleanups

3 years agoARM: dts: renesas: Remove leading 0x from rpc node
Lad Prabhakar [Sun, 29 Nov 2020 13:21:53 +0000 (13:21 +0000)]
ARM: dts: renesas: Remove leading 0x from rpc node

Remove the leading "0x" from rpc node to fix the below dtc warning:

Warning (simple_bus_reg): Node /soc/rpc@0xee200000 simple-bus unit
address format error, expected "ee200000"

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
3 years agopinctrl: renesas: Implement get_pin_muxing() callback
Lad Prabhakar [Sat, 28 Nov 2020 13:13:09 +0000 (13:13 +0000)]
pinctrl: renesas: Implement get_pin_muxing() callback

Implement get_pin_muxing() callback so that pinmux status
command can be used on Renesas platforms.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agopinctrl: renesas: Make sure the pin type is updated after setting the MUX
Lad Prabhakar [Sat, 28 Nov 2020 13:13:08 +0000 (13:13 +0000)]
pinctrl: renesas: Make sure the pin type is updated after setting the MUX

By default on startup all the pin types are configured to
PINMUX_TYPE_NONE (in sh_pfc_map_pins()), when pin is set as GPIO the
pin type is updated to PINMUX_TYPE_GPIO. But the type is not updated
when the pin is set as a function in sh_pfc_pinctrl_pin_set() or
sh_pfc_pinctrl_group_set() calls (these calls only set the MUX if
the pin type is PINMUX_TYPE_NONE ie unused).

So with the current implementation pin functionality could be overwritten
silently, for example if the same pin is added for SPI and serial.

This patch makes sure of updating pin type after every successful call to
sh_pfc_config_mux() and thus fixing from pin functionality to be
overwritten. Also a warning message is printed if the current pin is being
overwritten before abort.

This also avoids pin re-muxing to same type that is for example from
command line device is asked to re-probe/select (mmc dev x) we return
early with success in this case as the pin is already muxed.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agodoc: board: Add Microchip MPFS Icicle Kit doc
Padmarao Begari [Fri, 15 Jan 2021 02:50:41 +0000 (08:20 +0530)]
doc: board: Add Microchip MPFS Icicle Kit doc

This doc describes the procedure to build, flash and
boot Linux using U-boot on Microchip MPFS Icicle Kit.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Add Microchip MPFS Icicle Kit support
Padmarao Begari [Fri, 15 Jan 2021 02:50:40 +0000 (08:20 +0530)]
riscv: Add Microchip MPFS Icicle Kit support

This patch adds Microchip MPFS Icicle Kit support. For now, only
NS16550 Serial, Microchip clock, Cadence eMMC and MACB drivers are
enabled. The Microchip MPFS Icicle defconfig by default builds
U-Boot for S-Mode because U-Boot on Microchip PolarFire SoC will run
in S-Mode as payload of HSS + OpenSBI.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: dts: Add device tree for Microchip Icicle Kit
Padmarao Begari [Fri, 15 Jan 2021 02:50:39 +0000 (08:20 +0530)]
riscv: dts: Add device tree for Microchip Icicle Kit

Add device tree for Microchip PolarFire SoC Icicle Kit.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoclk: Add Microchip PolarFire SoC clock driver
Padmarao Begari [Fri, 15 Jan 2021 02:50:38 +0000 (08:20 +0530)]
clk: Add Microchip PolarFire SoC clock driver

Add clock driver code for the Microchip PolarFire SoC. This driver
handles reset and clock control of the Microchip PolarFire SoC device.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agonet: macb: Add phy address to read it from device tree
Padmarao Begari [Fri, 15 Jan 2021 02:50:37 +0000 (08:20 +0530)]
net: macb: Add phy address to read it from device tree

Read phy address from device tree and use it to find the phy device
if not found then search in the range of 0 to 31.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agonet: macb: Add DMA 64-bit address support for macb
Padmarao Begari [Fri, 15 Jan 2021 02:50:36 +0000 (08:20 +0530)]
net: macb: Add DMA 64-bit address support for macb

Enable 32-bit or 64-bit DMA in the macb driver based on the macb
hardware compatibility and it is configured with structure macb_config
in the driver.

The Microchip PolarFire SoC Memory Protection Unit(MPU) gives the 64-bit
DMA access with the GEM, the MPU transactions on the AXI bus is 64-bit
not 32-bit So 64-bit DMA is enabled for the Microchip PolarFire SoC GEM.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Add DMA 64-bit address support
Padmarao Begari [Fri, 15 Jan 2021 02:50:35 +0000 (08:20 +0530)]
riscv: Add DMA 64-bit address support

dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
addresses, dma_addr_t need only be 32/64 bits wide.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: timer: Add support for an early timer
Pragnesh Patel [Sun, 17 Jan 2021 12:41:25 +0000 (18:11 +0530)]
riscv: timer: Add support for an early timer

Added support for timer_early_get_count() and timer_early_get_rate()
This is mostly useful in tracing.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agotrace: select TIMER_EARLY to avoid infinite recursion
Pragnesh Patel [Sun, 17 Jan 2021 12:41:24 +0000 (18:11 +0530)]
trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: Add support for SPI on Kendryte K210
Sean Anderson [Tue, 22 Dec 2020 23:57:18 +0000 (18:57 -0500)]
riscv: Add support for SPI on Kendryte K210

This enables configs necessary for using SPI. The environment is saved to
the very end of SPI flash. This is unlikely to be overwritten unless the
entire flash is reprogrammed.

This also supplies a default bootcommand. It loads an image and device tree
from the first partition of the MMC. This is a minimal/least effort
bootcmd, so suggestions (especially in the form of patches) are welcome. I
didn't set up distro boot because I think it is unlikely that any
general-purpose linux distros will ever be ported to this board.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Chrstopher Obbard <obbardc@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agodoc: qemu-riscv: Fix opensbi build instructions
Atish Patra [Tue, 22 Dec 2020 19:50:01 +0000 (11:50 -0800)]
doc: qemu-riscv: Fix opensbi build instructions

Latest opensbi uses generic platform for Qemu. Update the build
instructions.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agocmd: disk: Remove fit_print_contents API
Ravik Hasija [Fri, 8 Jan 2021 17:55:58 +0000 (09:55 -0800)]
cmd: disk: Remove fit_print_contents API

fit_print_contents prints similar fit information as printed in bootm stages.
Removing this API reduces redundancy & provides improvement in boottime.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: cosmetic update of CONFIG_LIB_ELF description
Patrick Delaunay [Mon, 4 Jan 2021 14:33:28 +0000 (15:33 +0100)]
lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: unit test for pr_err(), pr_cont()
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:56 +0000 (08:02 +0100)]
test: unit test for pr_err(), pr_cont()

Provide a unit test for printing via pr_err() and pr_cont().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: provide missing macros
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:54 +0000 (08:02 +0100)]
log: provide missing macros

With commit d094a0734cee ("log: allow for message continuation") we have
defined a special log level and category for message continuation. Let's
have a macro for using these.

If logging is enabled log_cont() will create a continuation log output with
the same logging level and category as the previous message.

If logging is not enabled, log_cont() will print like printf().

Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: make debug_cond() function like
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:53 +0000 (08:02 +0100)]
log: make debug_cond() function like

Change debug_cond() such that it can be used instead of a function like
debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoram: k3-j721e: rename BIT_MASK()
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:52 +0000 (08:02 +0100)]
ram: k3-j721e: rename BIT_MASK()

The macro BIT_MASK is already defined in include/linux/bitops.h. To avoid
name collisions rename BIT_MASK() in drivers/ram/k3-j721e/lpddr4_private.h
to LPDDR4_BIT_MASK().

Remove superfluous parantheses.
Remove superfluous comparison to 0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agomtd: misplaced log.h and dm/devres.h
Heinrich Schuchardt [Sun, 3 Jan 2021 15:10:45 +0000 (16:10 +0100)]
mtd: misplaced log.h and dm/devres.h

log.h and dm/devres.h are U-Boot includes. So placing them
behind #ifndef __UBOOT__ does not make any sense.

Fixes: f7ae49fc4f36 ("common: Drop log.h from common header")
Fixes: 61b29b826838 ("dm: core: Require users of devres to include the header")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: zlib: our putc() takes only one argument
Heinrich Schuchardt [Mon, 28 Dec 2020 20:41:40 +0000 (21:41 +0100)]
lib: zlib: our putc() takes only one argument

In contrast to the C99 standard [1] our putc() takes only one argument.

[1] ISO/IEC 9899:1999

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolib: zlib: include ctype.h
Heinrich Schuchardt [Mon, 28 Dec 2020 20:31:43 +0000 (21:31 +0100)]
lib: zlib: include ctype.h

Our ctype.h is in include/linux/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolib: aes: build failure with DEBUG=1
Heinrich Schuchardt [Mon, 28 Dec 2020 16:56:27 +0000 (17:56 +0100)]
lib: aes: build failure with DEBUG=1

Building fails with DEBUG=1:

lib/aes.c: In function â€˜debug_print_vector’:
lib/aes.c:622:45: error:
cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  622 |  printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);

Pointers can only be cast to (uintptr_t). But anyway we have
%p for printing pointers.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarmv8: Makefile: build cache files when needed
Peng Fan [Mon, 28 Dec 2020 12:13:13 +0000 (20:13 +0800)]
armv8: Makefile: build cache files when needed

If no need cache support, not build the cache files, such as in SPL.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agocommon: Makefile: drop duplicated line
Peng Fan [Mon, 28 Dec 2020 12:13:11 +0000 (20:13 +0800)]
common: Makefile: drop duplicated line

obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o is there,
no need obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodts: Log name of expected .dtb file
Florian Klink [Sun, 27 Dec 2020 20:34:43 +0000 (21:34 +0100)]
dts: Log name of expected .dtb file

Make it more obvious what .dts file was expected by the build system.

When adding support for a new board, I kept getting this error message,
assuming I passed a wrong DEVICE_TREE parameter.

However, what was really the mistake was that the entry in
`arch/arm/dts/Makefile` was missing, and u-boot didn't like not being
able to find the .dtb file that should have been produced.

Simply logging the expected .dtb file name should make it easier to spot
such mistakes.

Signed-off-by: Florian Klink <flokli@flokli.de>
3 years agobootmenu: Allow to quit it via ESC/CTRL+C
Pali Rohár [Sun, 27 Dec 2020 00:04:38 +0000 (01:04 +0100)]
bootmenu: Allow to quit it via ESC/CTRL+C

When ESC/CTRL+C is pressed interrupt bootmenu and jump into U-Boot console.
As the last entry in bootmenu is always U-Boot console just choose the last
entry when ESC or CTRL+C is pressed.

ESC key is detected when either no other character appears after '\e'
within 10ms or when non-'[' appears after '\e'.

It is useful when bootmenu is part of boot process and you want to
interrupt boot process by scripts which control U-Boot (serial) console.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agostring: Use memcpy() within memmove() when we can
Patrick Delaunay [Fri, 11 Dec 2020 13:59:23 +0000 (14:59 +0100)]
string: Use memcpy() within memmove() when we can

A common use of memmove() can be handled by memcpy(). Also memcpy()
includes an optimization for large sizes: it copies a word at a time. So
we can get a speed-up by calling memcpy() to handle our move in this case.

Update memmove() to call also memcpy() if the source don't overlap
the destination (src + count <= dest).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodrivers: serial: probe all uart devices
Vabhav Sharma [Wed, 9 Dec 2020 05:12:04 +0000 (10:42 +0530)]
drivers: serial: probe all uart devices

U-Boot DM model probe only single device at a time
which is enabled and configured using device tree
or platform data method.

PL011 UART IP is SBSA compliant and firmware does the
serial port set-up, initialization and let the kernel use
UART port for sending and receiving characters.

Normally software talk to one serial port time but some
LayerScape platform require all the UART devices enabled
in Linux for various use case.

Adding support to probe all enabled serial devices like SBSA
compliant PL011 UART ports probe and initialization by firmware.

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agodm: core: add function uclass_probe_all() to probe all devices
Vabhav Sharma [Wed, 9 Dec 2020 05:12:03 +0000 (10:42 +0530)]
dm: core: add function uclass_probe_all() to probe all devices

Support a common method to probe all devices associated with uclass.

This includes data structures and code for finding the first device and
looping for remaining devices associated with uclasses (groups of devices
with the same purpose, e.g. all SERIAL ports will be in the same uclass).

An example is SBSA compliant PL011 UART IP, where firmware does the serial
port initialization and prepare uart device to let the kernel use it for
sending and reveiving the characters.SERIAL uclass will use this function
to initialize PL011 UART ports.

The feature is enabled with CONFIG_DM.

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agoconsole: cosmetics: remove #if 0
Patrick Delaunay [Wed, 2 Dec 2020 14:16:13 +0000 (15:16 +0100)]
console: cosmetics: remove #if 0

Remove the #if 0 present since the first version of console.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: always compile fixup_cmdtable()
Heinrich Schuchardt [Thu, 26 Nov 2020 19:46:37 +0000 (20:46 +0100)]
common: always compile fixup_cmdtable()

With our optimization settings the linker eliminates unused functions.

But for debugging it is better to compile with -Og or -O0. With -O0
compiling the sandbox fails due to the missing function fixup_cmdtable()
called by dm_reloc() and others.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: spl: spl_fit.c: report an error on hash check fail
Philippe Reynes [Tue, 24 Nov 2020 15:15:05 +0000 (16:15 +0100)]
common: spl: spl_fit.c: report an error on hash check fail

When the hash check fails on a loadable image, the SPL/TPL simply
jump to the next one. This commit changes this behaviour, when the
hash check fails on a loadable image, the function spl_load_simple_fit
stops and report an error.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocli_readline: Only insert printable chars
Steve Bennett [Sun, 22 Nov 2020 04:58:45 +0000 (14:58 +1000)]
cli_readline: Only insert printable chars

There should be no need to insert non-printable characters
and this prevents line editing getting confused.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
3 years agoAdd optional salt to AUTOBOOT_STOP_STR_SHA256
Joel Peshkin [Sun, 22 Nov 2020 01:18:59 +0000 (17:18 -0800)]
Add optional salt to AUTOBOOT_STOP_STR_SHA256

Adds an optional SALT value to AUTOBOOT_STOP_STR_SHA256.   If a string
followed by a ":" is prepended to the sha256, the portion to the left
of the colon will be used as a salt and the password will be appended
to the salt before the sha256 is computed and compared.

Signed-off-by: Joel Peshkin <joel.peshkin@broadcom.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Joel Peshkin <joel.peshkin@broadcom.com>
To: u-boot@lists.denx.de
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agodoc/README.gpt: reflow partition type GUID table
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:37 +0000 (11:45 +0100)]
doc/README.gpt: reflow partition type GUID table

The previous patch made the table look bad. Fix it, and leave some
space for a future element being a bit longer than the current
maximum.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agodoc/README.gpt: define partition type GUID for U-Boot environment
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:36 +0000 (11:45 +0100)]
doc/README.gpt: define partition type GUID for U-Boot environment

When setting aside a GPT partition for holding the U-Boot environment,
having a partition type GUID [1] indicating "Linux filesystem" (as
most tools default to) is somewhat misleading - and there's no other
well-known type GUID that is better suited. So to have a canonical
value to put into the type field, define

    3de21764-95bd-54bd-a5c3-4abe786f38a8

to mean a partition holding a U-Boot environment.

This is a v5 namespace-name GUID [2], generated [3] from a namespace
of "25cbcde0-8642-47c6-a298-1a3a57cd256b" and name "U-Boot
environment".

Should future type GUIDs be defined in the context of U-Boot, it's
sensible to use that same namespace GUID.

[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
[2] https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
[3] https://www.uuidtools.com/v5

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agolib/uuid.c: change prototype of uuid_guid_get_str()
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:35 +0000 (11:45 +0100)]
lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agopower: regulator: Kconfig: add a dependency for POWER_SUPPORT for SPL
Nishanth Menon [Fri, 20 Nov 2020 04:10:54 +0000 (22:10 -0600)]
power: regulator: Kconfig: add a dependency for POWER_SUPPORT for SPL

power/regulator will not be built if just CONFIG_SPL_DM_REGULATOR is
enabled. It needs CONFIG_SPL_POWER_SUPPORT to be enabled as well.

For example, if we just need a GPIO regulator in SPL:
CONFIG_DM_REGULATOR=y
CONFIG_SPL_DM_REGULATOR=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_SPL_DM_REGULATOR_GPIO=y

Will not suffice, since the entire regulator build for SPL depends on
CONFIG_SPL_POWER_SUPPORT. Elaborate that information in the Kconfig
dependency.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotest: correct the test prefix in ut str
Patrick Delaunay [Thu, 19 Nov 2020 09:08:43 +0000 (10:08 +0100)]
test: correct the test prefix in ut str

Align the prefix used in cmd_ut_category function and name of tests
for ut str.
This patch solves the issues detected by "make qcheck" after previous
patch.

Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: correct the test prefix in ut cmd_mem
Patrick Delaunay [Thu, 19 Nov 2020 09:08:42 +0000 (10:08 +0100)]
test: correct the test prefix in ut cmd_mem

Align the prefix used in cmd_ut_category function and name of tests
for ut mem.
This patch solves the issues detected by "make qcheck" after previous
patch.

Fixes: 550a9e7902ce ("cmd: Update the memory-search command")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Only enable bloblist test when supported
Simon Glass [Mon, 9 Nov 2020 04:08:44 +0000 (21:08 -0700)]
test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Avoid assuming sandbox board for bloblist test
Simon Glass [Mon, 9 Nov 2020 04:08:43 +0000 (21:08 -0700)]
test: Avoid assuming sandbox board for bloblist test

This tests assumes it is running on sandbox. Add a few functions to handle
silencing the console on any board and use those instead.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocmd: gpt: add eMMC and GPT support
Corneliu Doban [Mon, 9 Nov 2020 06:19:16 +0000 (11:49 +0530)]
cmd: gpt: add eMMC and GPT support

Add eMMC and GPT support.
- GPT partition list and command to create the GPT added to u-boot
  environment
- eMMC boot commands added to u-boot environment
- new gpt commands (enumarate and setenv) that are used by broadcom
  update scripts and boot commands
- eMMC specific u-boot configurations with environment saved in eMMC
  and GPT support

Signed-off-by: Corneliu Doban <cdoban@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
[trini: Make gpt_setenv initialize ret to -1, given relevant return
        error values]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoKconfig: simple panel requires backlight
Marcin Juszkiewicz [Thu, 5 Nov 2020 16:30:26 +0000 (17:30 +0100)]
Kconfig: simple panel requires backlight

During build of simple panel driver backlight is needed so let's enable
it:

aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_set_backlight':
u-boot/drivers/video/simple_panel.c:43: undefined reference to `backlight_set_brightness'
aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_enable_backlight':
u-boot/drivers/video/simple_panel.c:28: undefined reference to `backlight_enable'

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
3 years agocmd: CMD_CPU depends on CPU
Heinrich Schuchardt [Wed, 4 Nov 2020 23:29:11 +0000 (00:29 +0100)]
cmd: CMD_CPU depends on CPU

Compiling with CONFIG_CMD_CPU=y and CONFIG_CPU=n fails with:

aarch64-linux-gnu-ld.bfd: cmd/built-in.o: in function `print_cpu_list':
/home/user/u-boot/cmd/cpu.c:34: undefined reference to `cpu_get_desc'
aarch64-linux-gnu-ld.bfd:
/home/user/u-boot/cmd/cpu.c:39: undefined reference to `cpu_get_info'
Segmentation fault (core dumped)
make: *** [Makefile:1757: u-boot] Error 139
make: *** Deleting file 'u-boot'

See error report in https://stackoverflow.com/questions/64678347.

Add the missing build dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: test/lib/test_print.c depends on CONSOLE_RECORD
Heinrich Schuchardt [Thu, 5 Nov 2020 00:29:06 +0000 (01:29 +0100)]
test: test/lib/test_print.c depends on CONSOLE_RECORD

The tests in test/lib/test_print.c fail without CONFIG_CONSOLE_RECORD=y.

Add a build dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-01-15-assorted-improvements'
Tom Rini [Sat, 16 Jan 2021 16:14:21 +0000 (11:14 -0500)]
Merge branch '2021-01-15-assorted-improvements'

- Add MBR partition layout writing supporting, clean up code.
- A large number of assorted console/iomux cleanups
- A large number of board_r related cleanups.
- Log enhancements

3 years agodoc: sifive: fu540: fix heading levels
Heinrich Schuchardt [Thu, 31 Dec 2020 23:37:05 +0000 (00:37 +0100)]
doc: sifive: fu540: fix heading levels

Two sibling headings cannot have the same name.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: move README.fdt-overlays to HTML documentation
Heinrich Schuchardt [Thu, 31 Dec 2020 15:43:37 +0000 (16:43 +0100)]
doc: move README.fdt-overlays to HTML documentation

Convert doc/README.fdt-overlays to doc/usage/fdt_overlays.rst.

Edit the text for readability.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: board: fix README.b4860qds
Heinrich Schuchardt [Thu, 31 Dec 2020 23:31:37 +0000 (00:31 +0100)]
doc: board: fix README.b4860qds

Two sibling headings can never be the same.

Fix the heading levels.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodoc: add synopsis for pstore command
Heinrich Schuchardt [Thu, 31 Dec 2020 14:58:20 +0000 (15:58 +0100)]
doc: add synopsis for pstore command

Add a synopsis section.

Use lower case for command name.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: man-page base command
Heinrich Schuchardt [Thu, 31 Dec 2020 14:42:05 +0000 (15:42 +0100)]
doc: man-page base command

Provide a description of the base command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: Add MBR partition layout control utility
Marek Szyprowski [Wed, 23 Dec 2020 12:55:15 +0000 (13:55 +0100)]
cmd: Add MBR partition layout control utility

Add a 'mbr' command to let users create or verify MBR partition layout
based on the provided text description. The partition layout is
alternatively read from the 'mbr_parts' environment variable. This can be
used in scripts to help system image flashing tools to ensure proper
partition layout.

The syntax of the text description of the partition list is similar to
the one used by the 'gpt' command. Supported parameters are: name
(currently ignored), start (partition start offset in bytes), size (in
bytes or '-' to expand it to the whole free area), bootable (boolean
flag) and id (MBR partition type). If one wants to create more than 4
partitions, an 'Extended' primary partition (with 0x05 ID) has to be
explicitely provided as a one of the first 4 entries.

Here is an example how to create a 6 partitions (3 on the 'extended
volume'), some of the predefined sizes:

> setenv mbr_parts 'name=boot,start=4M,size=128M,bootable,id=0x0e;
  name=rootfs,size=3072M,id=0x83;
  name=system-data,size=512M,id=0x83;
  name=[ext],size=-,id=0x05;
  name=user,size=-,id=0x83;
  name=modules,size=100M,id=0x83;
  name=ramdisk,size=8M,id=0x83'
> mbr write mmc 0

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: add code for creating MBR partition layout
Marek Szyprowski [Wed, 23 Dec 2020 12:55:14 +0000 (13:55 +0100)]
disk: dos: add code for creating MBR partition layout

Add a code for creating and writing MBR partition layout. The code generates
similar layout of EBRs (Exteneded Block Records) and logical volumes as
Linux's fdisk utility.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: make some functions static
Marek Szyprowski [Wed, 23 Dec 2020 12:55:13 +0000 (13:55 +0100)]
disk: dos: make some functions static

Make functions not used outside this file static.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[trini: Use __maybe_unused as there are cases they may not be used]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agodisk: dos: use generic macro for unaligned le32 access
Marek Szyprowski [Wed, 23 Dec 2020 12:55:12 +0000 (13:55 +0100)]
disk: dos: use generic macro for unaligned le32 access

Use a generic helper for reading LE32 integers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: add some defines for the hardcoded numbers
Marek Szyprowski [Wed, 23 Dec 2020 12:55:11 +0000 (13:55 +0100)]
disk: dos: add some defines for the hardcoded numbers

Add some handy defines for some hardcoded magic numbers related to
extended partition handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: rename write_mbr_partition to write_mbr_sector
Marek Szyprowski [Wed, 23 Dec 2020 12:55:10 +0000 (13:55 +0100)]
disk: dos: rename write_mbr_partition to write_mbr_sector

write_mbr_partition() function name is a bit misleading, so rename it to
write_mbr_sector(). This is a preparation for adding code for writing a
complete MBR partition layout.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agoIOMUX: Stop dropped consoles
Andy Shevchenko [Mon, 21 Dec 2020 12:30:08 +0000 (14:30 +0200)]
IOMUX: Stop dropped consoles

When at some point environment shrinks we need to stop dropped devices.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoIOMUX: Drop indentation level by removing redundant 'else'
Andy Shevchenko [Mon, 21 Dec 2020 12:30:07 +0000 (14:30 +0200)]
IOMUX: Drop indentation level by removing redundant 'else'

Obviously the following has unnecessary indentation level in 'else' branch.

if (foo) {
...
return;
} else {
...
}

Drop indentation level by removing redundant 'else'.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoIOMUX: Refactor iomux_doenv() in order to increase readability
Andy Shevchenko [Mon, 21 Dec 2020 12:30:06 +0000 (14:30 +0200)]
IOMUX: Refactor iomux_doenv() in order to increase readability

Refactor iomux_doenv() a bit in order to increase readability.
There is no change in code generation on x86.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>