platform/kernel/u-boot.git
3 years agoConvert CONFIG_SPLASH_SCREEN et al to Kconfig
Simon Glass [Tue, 11 Aug 2020 17:23:35 +0000 (11:23 -0600)]
Convert CONFIG_SPLASH_SCREEN et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SPLASH_SCREEN
   CONFIG_SPLASH_SCREEN_ALIGN
   CONFIG_SPLASHIMAGE_GUARD
   CONFIG_SPLASH_SOURCE

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agomoveconfig: Skip binary and ELF files
Simon Glass [Tue, 11 Aug 2020 17:23:34 +0000 (11:23 -0600)]
moveconfig: Skip binary and ELF files

Add a few more file extensions to the list of files that should not be
processed. This avoids unicode errors, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoConvert CONFIG_NETCONSOLE to Kconfig
Tom Rini [Sun, 23 Aug 2020 17:06:36 +0000 (13:06 -0400)]
Convert CONFIG_NETCONSOLE to Kconfig

This converts the following to Kconfig:
   CONFIG_NETCONSOLE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'xilinx-for-v2020.10-rc3' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 20 Aug 2020 18:46:43 +0000 (14:46 -0400)]
Merge tag 'xilinx-for-v2020.10-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2020.10-rc3

- Fix fdtfile variable setup
- Fix bootm_*/fdt_high/initrd_high variables handling
- Fix Kconfig dependencies for Xilinx drivers
- Fix booting u-boot from lowest memory
- Fix firmware payload argument count for Versal
- Fix dfu configurations
- Fix mio_bank property handling
- Fix and align code around ID detection
- Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG
- Simplify logic around reading MAC from eeprom
- Decrease malloc length for zynqmp mini qspi
- Enable preboot for ZynqMP and Versal

i2c:
- Fix i2c eeprom partitions handling

mmc:
- Fix logic around HS mode enabling and use proper functions

3 years agoMerge branch '2020-08-19-mediatek-updates'
Tom Rini [Thu, 20 Aug 2020 12:38:10 +0000 (08:38 -0400)]
Merge branch '2020-08-19-mediatek-updates'

- Assorted updates for MediaTek platforms

3 years agoclk: versal: Move pm_query_id out of clock driver
Michal Simek [Thu, 23 Jul 2020 07:24:06 +0000 (09:24 +0200)]
clk: versal: Move pm_query_id out of clock driver

There is no reason to have firmware specific structure in clock driver.
Move it to generic location and also initialize enum values which is based
on https://lore.kernel.org/linux-arm-kernel/20200318125003.GA2727094@kroah.com/
recommended way to go to make sure that values guaranteed by compiler.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agommc: sdhci: Use upper/lower_32_bits macros
Michal Simek [Wed, 29 Jul 2020 13:42:26 +0000 (15:42 +0200)]
mmc: sdhci: Use upper/lower_32_bits macros

Instead of recasting and shifting use macros which are designed for taking
upper/lower 32bit value from 64bit variable.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agommc: sdhci: Enable high speed conditional on the corresponding bit
Faiz Abbas [Thu, 23 Jul 2020 04:12:19 +0000 (09:42 +0530)]
mmc: sdhci: Enable high speed conditional on the corresponding bit

The capabilities register has a field to indicate whether the host
supports high speed mode or not. Add high speed host_caps based on
this bit instead of enabling it by default.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Michal Simek <michal.simek@xilnx.com>
Tested-by: Michal Simek <michal.simek@xilnx.com>
(zcu104 with sdhci-caps-mask = <0 0x200000>;)

3 years agoxilinx: common: Change bootm_size variable setting
Michal Simek [Wed, 12 Aug 2020 10:17:53 +0000 (12:17 +0200)]
xilinx: common: Change bootm_size variable setting

Linux kernel for arm32 requires dtb and initrd to be placed in low memory
to work properly. This requirement is described in chapter 4b) and 5) in
Linux documentation (Documentation/arm/booting.rst).

There is an issue on arm32 with 2GB of memory that bootm_size is bigger
than Linux lowmem (for example with VMSPLIT_3G). That's why limit bootm
size on these systems not to be above 768MB.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: common: Check return value from variable setup
Michal Simek [Wed, 12 Aug 2020 10:16:49 +0000 (12:16 +0200)]
xilinx: common: Check return value from variable setup

env_set..() can failed that's why check return status and report it back to
make sure that user is aware that's something went wrong.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: common: Get rid of initrd_high variable setup
Michal Simek [Wed, 12 Aug 2020 10:11:06 +0000 (12:11 +0200)]
xilinx: common: Get rid of initrd_high variable setup

When bootm_low/bootm_size are setup properly there is no need to setup any
initrd_high address. Location for initrd is determined through LMB.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: common: Get rid of fdt_high variable
Michal Simek [Wed, 12 Aug 2020 10:04:50 +0000 (12:04 +0200)]
xilinx: common: Get rid of fdt_high variable

There is no need to setup this variable if bootm_low and bootm_size
variable are properly setup. If fdt_high variable is missing U-Boot is
asking LMB to return free memory which is not used.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: Change logic around zynq_board_read_rom_ethaddr()
Michal Simek [Mon, 3 Aug 2020 10:59:28 +0000 (12:59 +0200)]
xilinx: Change logic around zynq_board_read_rom_ethaddr()

There is no reason to build private function when
CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET is not defined. There is already weak
function which handles default case properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG
Michal Simek [Tue, 28 Jul 2020 10:45:47 +0000 (12:45 +0200)]
xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: versal: Enable i2c misc eeprom driver
Michal Simek [Mon, 3 Aug 2020 13:14:24 +0000 (15:14 +0200)]
xilinx: versal: Enable i2c misc eeprom driver

Enable this driver to be able to work with i2c based eeproms on Versal.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: fix incorrect map not align with IPI HW
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:32 +0000 (23:17 +0100)]
xilinx: zynqmp: fix incorrect map not align with IPI HW

Current IPI module register description is not align with IPI HW. The
registers with the wrong offset are not used so it does not cause real
issues. This patch aligns the register description.

Additionally comments added to explain why recv function does not check
any flag prior copying rx data.

Fixes: 660b0c77d816 ("mailbox: zynqmp: ipi mailbox driver")
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: remove chip_id function
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:30 +0000 (23:17 +0100)]
xilinx: zynqmp: remove chip_id function

Remove chip_id function and integrate the firmware call in the
zynqmp_get_silicon_idcode_name function. The change avoids querying the
firmware twice and makes the code bit more clear.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: get chip ID at EL3
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:29 +0000 (23:17 +0100)]
xilinx: zynqmp: get chip ID at EL3

Modify the board init function to allow getting the chip ID when U-Boot
proper is executed at EL3.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: get chip ID using firmware driver
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:28 +0000 (23:17 +0100)]
xilinx: zynqmp: get chip ID using firmware driver

Current implementation for getting chip ID uses either raw access on EL3
or a SMC call to get the silicon information. Following change
simplifies the code using always the firmware driver.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: merge firmware calls for EL2 and EL3
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:27 +0000 (23:17 +0100)]
xilinx: zynqmp: merge firmware calls for EL2 and EL3

This patch merges ZynqMP firmware calls under xilinx_pm_request in order
to make trainsparent the EL. Calls at EL3 are send through IPI messages
and EL2 through SMC calls.

The EL2 call uses fixed payload and arg size as the EL3 call. The
firmware is capable to handle PMUFW_PAYLOAD_ARG_CNT bytes but the
firmware API is limited by the SMC call size.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: synchronize firmware call return payload
Ibai Erkiaga [Tue, 4 Aug 2020 22:17:26 +0000 (23:17 +0100)]
xilinx: zynqmp: synchronize firmware call return payload

Removes duplicated definition of PAYLOAD_ARG_CNT and define it in the
firmware driver. Additionally fixes payload buffer declarations without
macro usage

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agommc: zynq: Fix default value for xlnx,mio-bank
Michal Simek [Wed, 22 Jul 2020 15:46:31 +0000 (17:46 +0200)]
mmc: zynq: Fix default value for xlnx,mio-bank

DT binding is saying that default value is 0 not -1 that's why fix it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agoxilinx: Fix xlnx,mio_bank property
Michal Simek [Wed, 22 Jul 2020 15:42:43 +0000 (17:42 +0200)]
xilinx: Fix xlnx,mio_bank property

s/xlnx,mio_bank/xlnx,mio-bank/g

DT binding is describing mio-bank not mio_bank that's why fix all DTSes and
also driver itself.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agoi2c: eeprom: Use reg property instead of offset and size
Michal Simek [Thu, 28 May 2020 09:48:55 +0000 (11:48 +0200)]
i2c: eeprom: Use reg property instead of offset and size

Remove adhoc dt binding for fixed-partition definition for i2c eeprom.
fixed-partition are using reg property instead of offset/size pair.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxilinx: zynqmp: Enable DFU tftp support
Michal Simek [Wed, 15 Jul 2020 12:20:34 +0000 (14:20 +0200)]
xilinx: zynqmp: Enable DFU tftp support

Enable DFU tftp support for firmware update. Fill dfu_ram_tftp variable to
have command present for showing how to use it.

boot FIT image has been created from below fragment. Key part is that type
of image has to be firmware. Also based on experiment load property is
completely ignored and base addresses are taken from dfu_alt_info variable.

$ cat update_uboot.its
/dts-v1/;

/ {
description = "Automatic U-Boot update";
#address-cells = <1>;

images {
Image {
description = "Kernel";
data = /incbin/("/tftpboot/Image");
compression = "none";
arch = "arm64";
type = "firmware";
os = "linux";
load = <0x80000>;
entry = <0x80000>;
hash-1 {
algo = "sha1";
};
};
system.dtb {
description = "DTB";
data = /incbin/("/tftpboot/system.dtb");
compression = "none";
arch = "arm64";
type = "firmware";
load = <0>;
hash-1 {
algo = "sha1";
};
};
};
};

$ mkimage -f update_uboot.its /tftpboot/boot

When U-Boot starts get IP address and server IP.
dhcp
setenv serverip 192.168.0.105

And then run prepared command.
run dfu_ram_tftp

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: Align dfu ram with booti command
Michal Simek [Wed, 15 Jul 2020 13:43:52 +0000 (15:43 +0200)]
xilinx: Align dfu ram with booti command

Image should be loaded to 0x80000 address and not to $kernel_addr_r.
Also kernel_addr, fdt_addr and fdt_size in zynqmp case are not defined
that's why define it to be aligned with Versal.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoarm64: zynqmp: Reduce malloc memory for mini QSPI configuration
Ashok Reddy Soma [Mon, 6 Apr 2020 13:58:32 +0000 (07:58 -0600)]
arm64: zynqmp: Reduce malloc memory for mini QSPI configuration

Mini U-boot runs on lower foot print of 256KB OCM. Hence 8K memory
for malloc may not be required. Reduce it by 1.5K.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: versal: Use lowest memory for U-Boot
Michal Simek [Fri, 10 Jul 2020 10:42:09 +0000 (12:42 +0200)]
xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agolib: fdt: Convert fdtdes_setup_mem..() to livetree API
Michal Simek [Fri, 10 Jul 2020 11:34:44 +0000 (13:34 +0200)]
lib: fdt: Convert fdtdes_setup_mem..() to livetree API

Convert fdtdec_setup_mem_size_base(), get_next_memory_node(),
fdtdec_setup_memory_banksize() and fdtdec_setup_mem_size_base_lowest() to
livetree API.

Tested on ZynqMP zcu104 board.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: fdt: Introduce fdtdec_setup_mem_size_base_lowest()
Michal Simek [Thu, 9 Jul 2020 12:09:52 +0000 (14:09 +0200)]
lib: fdt: Introduce fdtdec_setup_mem_size_base_lowest()

New function should be called from board dram_init() because it initialized
gd->ram_base/ram_size. It finds the lowest available memory.

On systems with multiple memory nodes finding out the first memory node by
fdtdec_setup_mem_size_base() is not enough because this memory can be above
actual U-Boot VA mapping. Currently only mapping till 39bit is supported
(Full 44bit mapping was removed by commit 7985cdf74b28 ("arm64: Remove
non-full-va map code")).
If DT starts with the first memory node above 39bit address then system can
be unpredictable.

The function is available only when multiple memory bank support is
enabled.

Calling fdtdec_setup_memory_banksize() from dram_init() is not possible
because fdtdec_setup_memory_banksize() is saving dram information to bd
structure which is placed on stack but not initialized at this time. Also
stack is placed at location setup in dram_init().

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoversal: fix versal PM ret payload size
Ibai Erkiaga [Wed, 1 Jul 2020 23:10:58 +0000 (00:10 +0100)]
versal: fix versal PM ret payload size

The PM return payload size is defined as 4 bytes for Versal arquitecture
while the PM calls implemented both in the Versal clock driver and
ZynqMP firmware driver expects 5 bytes length.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: versal: Add new versal loadpdi command
T Karthik Reddy [Wed, 24 Jun 2020 09:23:57 +0000 (03:23 -0600)]
xilinx: versal: Add new versal loadpdi command

Versal loadpdi command is used for loading secure & non-secure
pdi images.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoarm64: zynqmp: Fix set_fdtfile() not to break u-boots DTB
Igor Lantsman [Wed, 24 Jun 2020 12:33:46 +0000 (14:33 +0200)]
arm64: zynqmp: Fix set_fdtfile() not to break u-boots DTB

Origin function was calling strsep which replaced delimiter ',' by a null
byte ('\0'). Operation was done directly on FDT which ends up with the
following behavior:

ZynqMP>  printenv fdtfile
fdtfile=xilinx/zynqmp.dtb
ZynqMP> fdt addr $fdtcontroladdr
ZynqMP> fdt print / compatible
compatible = "xlnx", "zynqmp"

As is visible fdtfile was correctly composed but a null byte caused that
xlnx was separated from zynqmp.
This hasn't been spotted because in all Xilinx DTs there are at least 3
compatible string and only the first one was affected by this issue.
But for systems which only had one compatible string "xlnx,zynqmp" it was
causing an issue when U-Boot's DT was used by Linux kernel.

The patch removes strsep calling and strchr is called instead which just
locate the first char after deliminator ',' (variable called "name").
And using this pointer in fdtfile composing.

Fixes: 91d7e0c47f51 ("arm64: zynqmp: Create fdtfile from compatible string")
Reported-by: Igor Lantsman <igor.lantsman@opsys-tech.com>
Signed-off-by: Igor Lantsman <igor.lantsman@opsys-tech.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: Enable preboot feature for ZynqMP and Versal
Michal Simek [Tue, 18 Aug 2020 12:15:01 +0000 (14:15 +0200)]
xilinx: Enable preboot feature for ZynqMP and Versal

Enable preboot functionality for ZynqMP and Versal platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: kconfig: Change Kconfig dependencies for Xilinx drivers
Michal Simek [Thu, 6 Aug 2020 13:18:36 +0000 (15:18 +0200)]
xilinx: kconfig: Change Kconfig dependencies for Xilinx drivers

Zynq/ZynqMP/Versal IPs should be possible to called also from Microblaze in
PL and vice versa. That's why change dependencies and do not limit enabling
just for some platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoxilinx: Setup bootm variables
Michal Simek [Thu, 9 Jul 2020 13:57:56 +0000 (15:57 +0200)]
xilinx: Setup bootm variables

On system with PL DDR which is placed before PS DDR in DT
env_get_bootm_size() and env_get_bootm_low() without specifying bootm_low
and bootm_size variables are taking by default gd->bd->bi_dram[0].start and
gd->bd->bi_dram[0].size. As you see 0 means bank 0 which doesn't need to be
PS ddr and even can be memory above 39bit VA which is what U-Boot supports
now.
That's why setup bootm variables based on ram_base/ram_size setting to make
sure that boot images are placed to the same location as U-Boot is placed.
This location should be by default location where OS can boot from.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agodts: r64: add sata- and asm_sel nodes
Frank Wunderlich [Thu, 13 Aug 2020 08:20:48 +0000 (10:20 +0200)]
dts: r64: add sata- and asm_sel nodes

asm_sel is for switching between sata and pcie mode
on r64 there is GPIO90 connected to ASM1480 which
switches RX/TX pairs to PCIe/SATA connector
output-low means sata-controller is active

with 2020-10 now reg is also needed for the phy itself

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agoahci: mediatek: add ahci driver
Frank Wunderlich [Thu, 13 Aug 2020 08:20:47 +0000 (10:20 +0200)]
ahci: mediatek: add ahci driver

add AHCI driver ported from linux

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/ata/ahci_mtk.c

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agoreset: add basic reset controller for pciesys
Frank Wunderlich [Thu, 13 Aug 2020 08:20:46 +0000 (10:20 +0200)]
reset: add basic reset controller for pciesys

bind reset controller to pciesys

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agophy: mtk-tphy: add PHY_TYPE_SATA
Frank Wunderlich [Thu, 13 Aug 2020 08:20:45 +0000 (10:20 +0200)]
phy: mtk-tphy: add PHY_TYPE_SATA

add support for PHY_TYPE_SATA to Mediateks TPHY driver

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agoarm: dts: mt7622: add SATA reset constants
Frank Wunderlich [Thu, 13 Aug 2020 08:20:44 +0000 (10:20 +0200)]
arm: dts: mt7622: add SATA reset constants

add reset constants used for SATA to header file

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agoarm: dts: mt7622: add PCIe nodes for BananaPi-R64
Frank Wunderlich [Fri, 14 Aug 2020 07:10:17 +0000 (09:10 +0200)]
arm: dts: mt7622: add PCIe nodes for BananaPi-R64

this patch adds PCIe-Nodes for BananaPi R64

original nodes from Chuanjia Liu for mt7622-rfb

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agodts: r64: add r64 dts
Frank Wunderlich [Mon, 10 Aug 2020 14:45:46 +0000 (16:45 +0200)]
dts: r64: add r64 dts

add a separate DTS for BananaPi R64 because it has 1GB RAM and SATA-Support

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agoarm: dts: add watchdog-node for mt7622
Frank Wunderlich [Mon, 10 Aug 2020 14:45:45 +0000 (16:45 +0200)]
arm: dts: add watchdog-node for mt7622

adding a watchdog-node to mt7622 dtsi

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
3 years agoconfigs: mt7622: add PCIe controller related configs
Chuanjia Liu [Mon, 10 Aug 2020 08:17:12 +0000 (16:17 +0800)]
configs: mt7622: add PCIe controller related configs

Add PCIe command and related configs

Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
Signed-off-by: Henry Yen <henry.yen@mediatek.com>
3 years agoarm: dts: mediatek: add PCIe node for MT7622
Chuanjia Liu [Mon, 10 Aug 2020 08:17:11 +0000 (16:17 +0800)]
arm: dts: mediatek: add PCIe node for MT7622

This patch adds PCIe node in dts for Mediatek MT7622 Soc.

Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
Signed-off-by: Henry Yen <henry.yen@mediatek.com>
3 years agoPCI: mediatek: Add PCIe support for MT7622
Chuanjia Liu [Mon, 10 Aug 2020 08:17:10 +0000 (16:17 +0800)]
PCI: mediatek: Add PCIe support for MT7622

This patch adds PCIe support for the Mediatek MT7622 SOC.

Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
Signed-off-by: Henry Yen <henry.yen@mediatek.com>
3 years agoarm: dts: mediatek: add pciesys support for MT7622 SoC
Chuanjia Liu [Mon, 10 Aug 2020 08:17:09 +0000 (16:17 +0800)]
arm: dts: mediatek: add pciesys support for MT7622 SoC

This patch adds pciesys support in dts for MediaTek MT7622 SoC.

Signed-off-by: Henry Yen <henry.yen@mediatek.com>
Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
3 years agoclk: mediatek: add pciesys support for MT7622 SoC
Chuanjia Liu [Mon, 10 Aug 2020 08:17:08 +0000 (16:17 +0800)]
clk: mediatek: add pciesys support for MT7622 SoC

This patch adds pciesys support in clock driver for
MediaTek MT7622 SoC.

Signed-off-by: Henry Yen <henry.yen@mediatek.com>
Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
3 years agopinctrl: mediatek: mt8512: fix the wrong start address of ranges
Chunfeng Yun [Fri, 7 Aug 2020 09:32:03 +0000 (17:32 +0800)]
pinctrl: mediatek: mt8512: fix the wrong start address of ranges

The start address of dout, pullen and pullsel ragnes are wrong,
so fix up them.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agoMerge tag 'uniphier-v2020.10-2' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 19 Aug 2020 01:28:49 +0000 (21:28 -0400)]
Merge tag 'uniphier-v2020.10-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier

UniPhier SoC updates for v2020.10 (2nd)

 - minor code cleanups

 - sync DT with Linux

3 years agoARM: dts: uniphier: resync DT with Linux 5.9-rc1
Masahiro Yamada [Tue, 4 Aug 2020 05:41:09 +0000 (14:41 +0900)]
ARM: dts: uniphier: resync DT with Linux 5.9-rc1

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoARM: uniphier: use FIELD_GET() to get access to revision register fields
Masahiro Yamada [Thu, 30 Jul 2020 09:28:08 +0000 (18:28 +0900)]
ARM: uniphier: use FIELD_GET() to get access to revision register fields

Define register fields as macros, and use FIELD_GET().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoserial: uniphier: fix typo in comment
Masahiro Yamada [Thu, 30 Jul 2020 09:28:07 +0000 (18:28 +0900)]
serial: uniphier: fix typo in comment

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoARM: uniphier: remove unneeded header inclusion from board_late_init.c
Masahiro Yamada [Thu, 30 Jul 2020 09:28:06 +0000 (18:28 +0900)]
ARM: uniphier: remove unneeded header inclusion from board_late_init.c

<nand.h> is unneeded since commit 9248a78f40d6 ("ARM: UniPhier: remove
Denali NAND controller fixup code").

<linux/io.h> is uneeded since commit 1320fa2e55d2 ("ARM: uniphier:
remove workaround for the NAND write protect").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoARM: uniphier: remove unused uniphier_pin_init()
Masahiro Yamada [Thu, 30 Jul 2020 09:28:05 +0000 (18:28 +0900)]
ARM: uniphier: remove unused uniphier_pin_init()

This function is unused since commit 862274913f8f ("bus:
uniphier-system-bus: move hardware init from board files").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoARM: uniphier: rename include guard of include/configs/uniphier.h
Masahiro Yamada [Thu, 30 Jul 2020 09:28:04 +0000 (18:28 +0900)]
ARM: uniphier: rename include guard of include/configs/uniphier.h

Make the include guard match to the file name.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
3 years agoMerge tag 'efi-2020-10-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 15 Aug 2020 13:01:01 +0000 (09:01 -0400)]
Merge tag 'efi-2020-10-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-10-rc3 (2)

This series includes bug fixes for:

* UEFI secure boot - images with multiple signatures
* UEFI secure boot - support for intermediate certificates
* corrections for UEFI unit tests
* missing loadaddr on MAIX board

3 years agoMerge branch '2020-08-14-assorted-updates'
Tom Rini [Fri, 14 Aug 2020 19:48:56 +0000 (15:48 -0400)]
Merge branch '2020-08-14-assorted-updates'

- Xen guest and some paravirt driver support.
- Aspeed SoC updates
- Broadcom IPROC PCIe RC driver

3 years agocmd: demo: Remove duplicated help message for list subcommand
Michal Simek [Thu, 13 Aug 2020 08:12:21 +0000 (10:12 +0200)]
cmd: demo: Remove duplicated help message for list subcommand

There is no need to show demo list description twice when help demo is
performed. The patch removes duplicated entry.

Current state:
=> help demo
demo - Driver model (dm) demo operations

Usage:
demo list                     List available demo devices
demo hello <num> [<char>]     Say hello
demo light [<num>]            Set or get the lights
demo status <num>             Get demo device status
demo list                     List available demo devices

Fixes: a02af4aeece4 ("dm: demo: Add a simple GPIO demonstration")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: xen: Add Xen guest ARM64 board documentation
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:43:01 +0000 (12:43 +0300)]
doc: xen: Add Xen guest ARM64 board documentation

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoboard: xen: De-initialize before jumping to Linux
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:43:00 +0000 (12:43 +0300)]
board: xen: De-initialize before jumping to Linux

Free resources used by Xen board before jumping to Linux kernel.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxen: pvblock: Print found devices indices
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:59 +0000 (12:42 +0300)]
xen: pvblock: Print found devices indices

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxen: pvblock: Implement front-back protocol and do IO
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:58 +0000 (12:42 +0300)]
xen: pvblock: Implement front-back protocol and do IO

Implement Xen para-virtual frontend to backend communication
and actually read/write disk data.

This is based on mini-os implementation of the para-virtual block
frontend driver.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoxen: pvblock: Read XenStore configuration and initialize
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:57 +0000 (12:42 +0300)]
xen: pvblock: Read XenStore configuration and initialize

Read essential virtual block device configuration data from XenStore,
initialize front ring and event channel.
Update block device description with actual block size.

Use code for XenStore from mini-os.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoxen: pvblock: Enumerate virtual block devices
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:56 +0000 (12:42 +0300)]
xen: pvblock: Enumerate virtual block devices

Enumerate Xen virtual block devices found in XenStore and
instantiate pvblock devices.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxen: pvblock: Add initial support for para-virtualized block driver
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:55 +0000 (12:42 +0300)]
xen: pvblock: Add initial support for para-virtualized block driver

Add initial infrastructure for Xen para-virtualized block device.
This includes compile-time configuration and the skeleton for
the future driver implementation.
Add new class UCLASS_PVBLOCK which is going to be a parent for
virtual block devices.
Add new interface type IF_TYPE_PVBLOCK.

Implement basic driver setup by reading XenStore configuration.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
3 years agoxen: Port Xen grant table driver from mini-os
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:54 +0000 (12:42 +0300)]
xen: Port Xen grant table driver from mini-os

Make required updates to run on u-boot.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoxen: Port Xen bus driver from mini-os
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:53 +0000 (12:42 +0300)]
xen: Port Xen bus driver from mini-os

Make required updates to run on u-boot and strip test code.

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
3 years agolib: sscanf: add sscanf implementation
Andrii Anisov [Thu, 6 Aug 2020 09:42:52 +0000 (12:42 +0300)]
lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
3 years agolinux/compat.h: Add wait_event_timeout macro
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:51 +0000 (12:42 +0300)]
linux/compat.h: Add wait_event_timeout macro

Add  wait_event_timeout - sleep until a condition gets true or a
timeout elapses.

This is a stripped version of the same from Linux kernel with the
following u-boot specific modifications:
- no wait queues supported
- use u-boot timer to detect timeouts
- check for Ctrl-C pressed during wait

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
[trini: Drop atomic_read from gadget/ether.c as this has existed for a
        while and now causes problems]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoserial: serial_xen: Add Xen PV serial driver
Peng Fan [Thu, 6 Aug 2020 09:42:50 +0000 (12:42 +0300)]
serial: serial_xen: Add Xen PV serial driver

Add support for Xen para-virtualized serial driver. This
driver fully supports serial console for the virtual machine.

Please note that as the driver is initialized late, so no banner
nor memory size is visible.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxen: Port Xen event channel driver from mini-os
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:49 +0000 (12:42 +0300)]
xen: Port Xen event channel driver from mini-os

Make required updates to run on u-boot. Strip functionality
not needed by U-boot.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoxen: Port Xen hypervisor related code from mini-os
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:48 +0000 (12:42 +0300)]
xen: Port Xen hypervisor related code from mini-os

Port hypervisor related code from Mini-OS. This is referencing the code
of Mini-OS from [1] by Huang Shijie and Volodymyr Babchuk which is for
ARM64.
Update essential arch code to support required bit operations, memory
barriers etc.

Copyright for the bits ported belong to at least the following authors,
please see related files for details:

Copyright (c) 2002-2003, K A Fraser
Copyright (c) 2005, Grzegorz Milos, gm281@cam.ac.uk,Intel Research Cambridge
Copyright (c) 2014, Karim Allah Ahmed <karim.allah.ahmed@gmail.com>

[1] - https://github.com/zyzii/mini-os.git

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
[trini: Drop wmb() from musb-net/linux-compat.h now]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoboard: Introduce xenguest_arm64 board
Andrii Anisov [Thu, 6 Aug 2020 09:42:47 +0000 (12:42 +0300)]
board: Introduce xenguest_arm64 board

Introduce a minimal Xen guest board running as a virtual
machine under Xen Project's hypervisor [1], [2].

Part of the code is ported from Xen mini-os and also uses
work initially done by different authors from NXP: please see
relevant files for their copyrights.

[1] https://xenbits.xen.org
[2] https://wiki.xenproject.org/

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoriscv: load addresses for Sipeed MAIX
Heinrich Schuchardt [Wed, 29 Jul 2020 10:49:24 +0000 (12:49 +0200)]
riscv: load addresses for Sipeed MAIX

Define default load addresses and the device tree name for the Sipeed MAIX.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoxen: Add essential and required interface headers
Oleksandr Andrushchenko [Thu, 6 Aug 2020 09:42:46 +0000 (12:42 +0300)]
xen: Add essential and required interface headers

Add essential and required Xen interface headers only taken from
the stable Linux kernel stable/linux-5.7.y at commit
66dfe4522160 Linux 5.7.5.

These are better suited for U-boot than the original headers
from Xen as they are the stripped versions of the same.

At the same time use public protocols from Xen RELEASE-4.13.1, at
commit 6278553325a9 update Xen version to 4.13.1
as those have more comments in them.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agoKconfig: Introduce CONFIG_XEN
Peng Fan [Thu, 6 Aug 2020 09:42:45 +0000 (12:42 +0300)]
Kconfig: Introduce CONFIG_XEN

Introduce CONFIG_XEN to make U-Boot could be used as bootloader
for a virtual machine.

Without bootloader, we could successfully boot up android on XEN, but
we need need bootloader to support A/B, dm verify and etc.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoAdd MIT License
Anastasiia Lukianenko [Thu, 6 Aug 2020 09:42:44 +0000 (12:42 +0300)]
Add MIT License

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
3 years agoconfigs: evb-ast2500: Convert to OF_SEPARATE
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:10 +0000 (17:36 +0800)]
configs: evb-ast2500: Convert to OF_SEPARATE

Switch DTB provider form OF_EMBED to OF_SEPARATE
to avoid the compile warning message:

  ==================== WARNING ======================
  CONFIG_OF_EMBED is enabled. This option should only
  be used for debugging purposes. Please use
  CONFIG_OF_SEPARATE for boards in mainline.
  See doc/README.fdt-control for more info.
  ====================================================

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agoconfigs: evb-ast2500: Move BOOTCOMMAND from header to defconfig
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:09 +0000 (17:36 +0800)]
configs: evb-ast2500: Move BOOTCOMMAND from header to defconfig

Move the BOOTCOMMAND definition from the board inclusion
header to the default configuration file.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agoinclude/configs: aspeed: Remove hardcoded variables
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:08 +0000 (17:36 +0800)]
include/configs: aspeed: Remove hardcoded variables

The hardcoded platform variables such as DRAM base address are not
common to Aspeed SoCs AST24xx/AST25xx/AST26xx. This patch replaces
those hardcoded with macros defined in a newly added header, where
the basic SoC HW information are assigned accordingly.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agocosmetic: aspeed: ast2500: Rename board file
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:07 +0000 (17:36 +0800)]
cosmetic: aspeed: ast2500: Rename board file

Rename the ast2500-board.c to board_common.c and
place the renamed file under the ast2500 folder.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agoaspeed: ast2500: Add lowlevel_init assembly
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:06 +0000 (17:36 +0800)]
aspeed: ast2500: Add lowlevel_init assembly

The original lowlevel_init function of AST2500 is written
in C. However, the C runtime environment is not ready until
_main execution.

This patch adds the assembly version of the lowlevel_init
function. Additional initialization to DRAM configuration
and LPC reset source are also added.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agoMAINTAINERS: Add maintainers for Aspeed SoCs
Chia-Wei, Wang [Mon, 3 Aug 2020 09:36:05 +0000 (17:36 +0800)]
MAINTAINERS: Add maintainers for Aspeed SoCs

Update maintainers for Aspeed SoC platforms.

Signed-off-by: Chia-Wei, Wang <chiawei_wang@aspeedtech.com>
3 years agodrivers: pcie: add Broadcom IPROC PCIe RC driver
Srinath Mannam [Tue, 12 May 2020 07:59:50 +0000 (13:29 +0530)]
drivers: pcie: add Broadcom IPROC PCIe RC driver

Add support for IPROC PAXC PCIe RC driver.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodrivers: pci: add api to get dma regions
Rayagonda Kokatanur [Tue, 12 May 2020 07:59:49 +0000 (13:29 +0530)]
drivers: pci: add api to get dma regions

Add api to get dma regions.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 14 Aug 2020 12:38:01 +0000 (08:38 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Fix HiFive Unleashed the broken problem by call fix_fdt() before
  reserve_fdt().  Please refer to
  https://www.mail-archive.com/u-boot@lists.denx.de/msg379444.html for
  master u-boot broken for HiFive Unleashed.
- Add unaligned exception cmd.
- Refine sifive/fu540 spl flow.
- Add  additional crash information for efi.
- Update sipeed/maix doc.
- Two minor refine.

3 years agotest/py: efi_secboot: modify 'multiple signatures' test case
AKASHI Takahiro [Fri, 14 Aug 2020 05:39:24 +0000 (14:39 +0900)]
test/py: efi_secboot: modify 'multiple signatures' test case

The test case 5 in test_signed (multiple signatures) must be modified
and aligned with the change introduced in the previous commit
("efi_loader: signature: correct a behavior against multiple signatures").

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agoefi_loader: signature: correct a behavior against multiple signatures
AKASHI Takahiro [Fri, 14 Aug 2020 05:39:23 +0000 (14:39 +0900)]
efi_loader: signature: correct a behavior against multiple signatures

Under the current implementation, all the signatures, if any, in
a signed image must be verified before loading it.

Meanwhile, UEFI specification v2.8b section 32.5.3.3 says,
    Multiple signatures are allowed to exist in the binary’s certificate
    table (as per PE/COFF Section “Attribute Certificate Table”). Only
    one hash or signature is required to be present in db in order to pass
    validation, so long as neither the SHA-256 hash of the binary nor any
    present signature is reflected in dbx.

This patch makes the semantics of signature verification compliant with
the specification mentioned above.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocommon/board_f: make sure to call fix_fdt() before reserve_fdt()
Pragnesh Patel [Thu, 13 Aug 2020 04:42:26 +0000 (10:12 +0530)]
common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
3 years agoriscv: additional crash information
Heinrich Schuchardt [Sat, 1 Aug 2020 15:15:39 +0000 (15:15 +0000)]
riscv: additional crash information

If an exception occurs, the relocated program counter and return address
are required for an analysis.

With this patch you get:

    => exception undefined

    Unhandled exception: Illegal instruction
    EPC: 0000000080595908 RA: 000000008059c0c6 TVAL: 000000008030c01e
    EPC: 0000000080007908 RA: 000000008000e0c6 reloc adjusted

We can use the relocated addresses to find the involved functions in
u.boot.map:

    .text.do_undefined
                0x0000000080007908        0x8 cmd/built-in.o
    .text.cmd_process
                0x000000008000dfcc      0x11a common/built-in.o
                0x000000008000dfcc                cmd_process

If an exception occurs in an UEFI binary additionally the load addresses of
the UEFI binaries are needed. With this patch:

    => setenv efi_selftest exception
    => bootefi selftest

    Unhandled exception: Illegal instruction
    EPC: 000000008042e18a RA: 000000008042e18a TVAL: 000000008030c01e
    EPC: 000000007fea018a RA: 000000007fea018a reloc adjusted

    UEFI image [0x0000000000000000:0xffffffffffffffff] '/\selftest'
    UEFI image [0x000000008042e000:0x000000008042e43f] pc=0x18a '/bug.efi'

The value pc=0x18a matches the position of the illegal instruction in
efi_selftest_miniapp_exception.efi (loaded as /bug.efi);

    asm volatile (".word 0xffffffff\n");

    00000180   93 85 C5 11  1C 64 22 85  82 97 FF FF  FF FF 1C 64

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agocmd: exception: unaligned data access on RISC-V
Heinrich Schuchardt [Thu, 6 Aug 2020 10:34:59 +0000 (12:34 +0200)]
cmd: exception: unaligned data access on RISC-V

The command 'exception' can be used to test the handling of exceptions.

Currently the exception command only allows to create an illegal
instruction exception on RISC-V.

Provide a sub-command 'exception unaligned' to cause a misaligned load
address exception.

Adjust the online help for 'exception undefined'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agodoc: riscv: debug UART for MAIX
Heinrich Schuchardt [Wed, 29 Jul 2020 17:23:38 +0000 (19:23 +0200)]
doc: riscv: debug UART for MAIX

Provide the required settings for the debug UART.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agodoc: riscv: Update documentation for Sipeed MAIX boards
Heinrich Schuchardt [Tue, 28 Jul 2020 18:05:30 +0000 (20:05 +0200)]
doc: riscv: Update documentation for Sipeed MAIX boards

The MAIXDUINO runs fine with the sipeed_maix_bitm_defconfig but a different
board id parameter should be passed to kflash.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agoriscv: sifive: fu540: redundant initialization
Heinrich Schuchardt [Mon, 3 Aug 2020 21:09:49 +0000 (23:09 +0200)]
riscv: sifive: fu540: redundant initialization

We should not initialize a variable if the value is overwritten before
being read.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: remove redundant logical constraint.
Heinrich Schuchardt [Mon, 3 Aug 2020 21:33:42 +0000 (23:33 +0200)]
riscv: remove redundant logical constraint.

After

    if (ret) return ret;

we know that ret is zero. Don't check it again.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: sifive/fu540: Move SPL related functions to spl.c
Bin Meng [Mon, 3 Aug 2020 06:09:06 +0000 (23:09 -0700)]
riscv: sifive/fu540: Move SPL related functions to spl.c

It's better to keep all SPL related functions in the same spl.c.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agoriscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
Bin Meng [Mon, 3 Aug 2020 06:09:05 +0000 (23:09 -0700)]
riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR

This option was enabled during the earlier U-Boot porting time. Now
we already have the OTP driver in place and the unique MAC address
is read from the OTP, there is no need to turn on this option.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
3 years agoriscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level
Bin Meng [Mon, 3 Aug 2020 06:09:04 +0000 (23:09 -0700)]
riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level

All FU540 driver related options should be in the SoC level Kconfig.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>