]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
4 years agommc: sdhci: Fix rebase issues in set_ios
Ashok Reddy Soma [Wed, 14 Jul 2021 10:27:23 +0000 (04:27 -0600)] 
mmc: sdhci: Fix rebase issues in set_ios

There are couple issues in set_ios function which are introduced when
xlnx code is rebased to mainline U-Boot version 2021.1 with
'commit 880b655d660e ("mmc: zynq_sdhci: Fix UHS 1.8v switching with 5ms
delay")'

Mainline 'commit f12341a95295 ("mmc: sdhci: Fix HISPD bit handling")' is
pulled partially when rebased to 2021.1. Fix it by adding back missing
HISPD bit setting code.

Remove extra line which writes back to sdhc host control register.

set_control_reg call got duplicated after rebase, remove it.

Since, voltage setting function (set_control_reg) is moved to the
beginning of the function, no need to return if the set_ios is called
with clock disable, so remove return.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agommc: zynq_sdhci: Change variable deviceid to node_id
Ashok Reddy Soma [Wed, 14 Jul 2021 10:27:22 +0000 (04:27 -0600)] 
mmc: zynq_sdhci: Change variable deviceid to node_id

Change deviceid to node_id in arasan_zynqmp_dll_reset() and also in
tapdelay related static inline functions to reflect proper name and
for consistency.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agommc: zynq_sdhci: Move setting tapdelay code to driver
Ashok Reddy Soma [Wed, 14 Jul 2021 10:27:21 +0000 (04:27 -0600)] 
mmc: zynq_sdhci: Move setting tapdelay code to driver

tap_delays.c just has calls to xilinx_pm_request() for setting tapdelays.
Simply move these calls to zynq_sdhci.c and make them static inline.
Similarly zynqmp_tap_delay.h also has call to xilinx_pm_request() for
dll reset. Do the same for this file as well.

Remove tap_delays.c and zynqmp_tap_delay.h files.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: zynqmp: Move USB3 PHY properties from DWC3 node to USB node
Manish Narani [Wed, 14 Jul 2021 12:17:19 +0000 (06:17 -0600)] 
arm64: zynqmp: Move USB3 PHY properties from DWC3 node to USB node

Move the PHY properties from DWC3 node to USB node in ZynqMP DTs as here
the USB3 PHY used is PSGTR, which is connected to Xilinx USB core. This
PHY initialization should be handled from Xilinx USB core as the
prerequisite register configurations are done here only.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
4 years agoxilinx: Define kernel_comp_addr_r,kernel_comp_size env variables
Raju Kumar Pothuraju [Mon, 12 Jul 2021 14:49:04 +0000 (20:19 +0530)] 
xilinx: Define kernel_comp_addr_r,kernel_comp_size env variables

Add kernel_comp_addr_r, kernel_comp_size env variables for zynqmp and
versal to be able to use the compressed kernel Image(.gz,.bz2,.lzma,.lzo)
using booti command.

Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
4 years agommc: zynq_sdhci: Use pm_node id instead of device sequence id
T Karthik Reddy [Mon, 12 Jul 2021 11:29:43 +0000 (05:29 -0600)] 
mmc: zynq_sdhci: Use pm_node id instead of device sequence id

When programming tapdelays & resetting dll, we are using device
sequence id, which is not programming tapelays & dll reset.
So use pm_node id instead of device sequence id to fix above issue.
Also use u8 instead of u32 for node_id variable as we have pm_node
ids less than 128.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Reviewed-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agotest/py/tests: Add a test for the time command
Love Kumar [Mon, 12 Jul 2021 04:05:41 +0000 (22:05 -0600)] 
test/py/tests: Add a test for the time command

This test executes "time <sleep cmd>", and validate that it gives the
approximately the correct amount of command execution time.

Signed-off-by: Love Kumar <love.kumar@xilinx.com>
4 years agoarm64: zynqmp: Remove gpio from aliases list
Michal Simek [Mon, 12 Jul 2021 08:56:33 +0000 (10:56 +0200)] 
arm64: zynqmp: Remove gpio from aliases list

It is not recommended to have aliases for gpio. In past it was used in
Linux for assigning numbers via sysfs which is deprecated and libgpiod
should be used instead.
In U-Boot this number is used for seq number but gpio offset are not
counted from this number. That's why having these aliases only for seq
number is not needed. As is done in Linux it is the best to use full gpio
name instead of sequence number which depends on sequence in binding.

The same changes was done by commit d458db3ce900 ("arm64: zynqmp: Remove
gpio from aliases list").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add label for more VPK120 GPIO lines
Saeed Nowshadi [Thu, 8 Jul 2021 00:40:29 +0000 (17:40 -0700)] 
arm64: zynqmp: Add label for more VPK120 GPIO lines

GPIO lines from banks 43 & 44 of ZU4 need label so they could be found
and referenced by libgpiod utilities.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
4 years agoarm64: zynqmp: Add fclk bindings for VPK120 clocks
Saeed Nowshadi [Fri, 2 Jul 2021 23:23:54 +0000 (16:23 -0700)] 
arm64: zynqmp: Add fclk bindings for VPK120 clocks

Add Xilinx fclk bindings for clocks on VPK120 board so they could be
referenced through sysfs interface.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
4 years agoarm64: dts: zynqmp: Enable USB2.0 for zc1751-xm016-dc2
Piyush Mehta [Sat, 3 Jul 2021 05:10:30 +0000 (10:40 +0530)] 
arm64: dts: zynqmp: Enable USB2.0 for zc1751-xm016-dc2

The board zynqmp-zc1751-xm016-dc2 support only USB2.0.
This patch removes USB3.0 DT configuration for DC2 board.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
4 years agoarm64: zynqmp: Use new compatible strings for DP snd pcm
Dylan Yip [Thu, 1 Jul 2021 17:51:37 +0000 (10:51 -0700)] 
arm64: zynqmp: Use new compatible strings for DP snd pcm

To remove a stack trace when removing and reprobing the DP snd pcm,
use the new DP pcm compatible strings to allow the driver to create
standardized names for each DP snd pcm.

Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
Acked-by: Varunkumar Allagadapa <varunkumar.allagadapa@xilinx.com>
Acked-by: Jianqiang Chen <jianqiang.chen@xilinx.com>
4 years agoxilinx: Add jedec compatible string for QSPI (Zynq/ZynqMP)
Raju Kumar Pothuraju [Thu, 1 Jul 2021 08:45:11 +0000 (14:15 +0530)] 
xilinx: Add jedec compatible string for QSPI (Zynq/ZynqMP)

Add missing "jedec, spi-nor" compatible string for QSPI flash node.
Spi-nor framework uses this compatiblity string to probe &
initilize flash. With missing compatibility string we are observing
below error:

Zynq> sf probe 0 0 0
 jedec_spi_nor spi_flash@0:0: unrecognized JEDEC id bytes:
00, 00, 00  Failed to initialize SPI flash at 0:0 (error -2)

Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com>
4 years agomtd: spi-nor: Fix read SFDP data in dual parallel mode
Lars-Peter Clausen [Fri, 18 Jun 2021 15:39:04 +0000 (17:39 +0200)] 
mtd: spi-nor: Fix read SFDP data in dual parallel mode

Reading the SFDP data is broken in two ways in dual parallel mode in the
current implementation.

1) It reads the data interleaved from both chips, which results in data
that can not be parsed. Since both chips have to be identical for dual
parallel mode the SFDP data will also be identical. So only read the data
from one of the chips.

2) The page, erase and chip size are not update to reflect that they should
be twice as large in dual parallel mode. Fix this by moving the update of
those parameter after running the SFDP detection rather than doing it
before.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agomtd: spi-nor: Fix dual parallel mode
Lars-Peter Clausen [Fri, 18 Jun 2021 15:39:03 +0000 (17:39 +0200)] 
mtd: spi-nor: Fix dual parallel mode

In the current implementation dual parallel mode only works for limited
corner cases, but is mostly broken.

For example
 * Erase will only erase one of the chips leaving every second byte
   non-erased
 * Lock/unlock only works if a read is done before it, otherwise it will
   timeout
 * Using bank/extended address mode (CONFIG_SPI_FLASH_BAR) fails in
   `sf probe` with a timeout

This is primarily due to incorrect setting of the striped access. Some
commands that should set it don't set it, while others that do set it
shouldn't set it.

To fix this make sure that the SPI_XFER_STRIPE flag gets set in
spi_nor_init() when operating in dual parallel mode. This means the flag is
always set before issuing any commands that need it.

And then in addition use a list of opcodes for which to disable striped
access (e.g. erase).

This is similar to what the Linux driver does to support dual parallel
mode.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y
Kunihiko Hayashi [Tue, 15 Jun 2021 06:33:02 +0000 (15:33 +0900)] 
arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y

If both POSITION_INDEPENDENT and SYS_RELOC_GD_ENV_ADDR are enabled,
wherever original env is placed anywhere, it should be relocated to
the right address.

Relocation offset gd->reloc_off is calculated with SYS_TEXT_BASE in
setup_reloc() and env address gd->env_addr is relocated by the offset in
initr_reloc_global_data().

gd->env_addr
  = (orig env) + gd->reloc_off
  = (orig env) + (gd->relocaddr - SYS_TEXT_BASE)

However, SYS_TEXT_BASE isn't always runtime base address when
POSITION_INDEPENDENT is enabled. So the relocated env_addr might point to
wrong address. For example, if SYS_TEXT_BASE is zero, gd->env_addr is
out of memory location and memory exception will occur.

There is a difference between linked address such as SYS_TEXT_BASE and
runtime base address. In _main, the difference is calculated as
"run-vs-link" offset. The env_addr should also be added to the offset
to fix the address.

gd->env_addr
  = (orig env) + ("run-vs-link" offset)   + gd->reloc_off
  = (orig env) + (SYS_TEXT_BASE - _start) + (gd->relocaddr - SYS_TEXT_BASE)
  = (orig env) + (gd->relocaddr - _start)

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Acked-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Link: https://lists.denx.de/pipermail/u-boot/2021-June/452135.html
State: upstream (534f0fbd65203871c2b054096422a5d0f3346cb1)

4 years agoxilinx: versal: Enable Xilinx AXI MRMAC
Ashok Reddy Soma [Mon, 21 Jun 2021 14:53:21 +0000 (08:53 -0600)] 
xilinx: versal: Enable Xilinx AXI MRMAC

Enable Xilinx AXI MRMAC for Versal platforms.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agonet: xilinx: axi_mrmac: Add MRMAC driver
Ashok Reddy Soma [Mon, 21 Jun 2021 14:53:20 +0000 (08:53 -0600)] 
net: xilinx: axi_mrmac: Add MRMAC driver

Add support for xilinx multirate(MRMAC) ethernet driver.
This driver uses multichannel DMA(MCDMA) for data transfers of MRMAC.
Added support for 4 ports of MRMAC for speeds 10G and 25G.
MCDMA supports upto 16 channels but in this driver we have setup only
one channel which is enough.

Tested 10G and 25G on all 4 ports.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agonet: ethtool: Add ethernet speed macros for higher speeds
Ashok Reddy Soma [Thu, 17 Jun 2021 12:20:57 +0000 (06:20 -0600)] 
net: ethtool: Add ethernet speed macros for higher speeds

Add speed macro's for higher ethernet speeds to be used in u-boot
networking drivers. Added Macros for speeds 14G, 20G, 25G, 40G, 50G,
56G, 100G and 200G inline with linux.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: dts: zynqmp: Add psgtr and phy entry for USB and SATA node
Piyush Mehta [Mon, 21 Jun 2021 04:41:27 +0000 (10:11 +0530)] 
arm64: dts: zynqmp: Add psgtr and phy entry for USB and SATA node

This patch adds psgtr clocks and phy entry for USB0, USB1 and SATA node for
zc1751-xm017-dc3 board.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Link: https://lists.denx.de/pipermail/u-boot/2021-June/452498.html
State: waiting

4 years agonet: xilinx: axi_emac: Add support for 10G/25G AXI ethernet
Ashok Reddy Soma [Wed, 16 Jun 2021 06:20:31 +0000 (00:20 -0600)] 
net: xilinx: axi_emac: Add support for 10G/25G AXI ethernet

Add support for 10G/25G (XXV) high speed ethernet. This Makes use of
the exiting AXI DMA, similar to 1G.

Signed-off-by: Alessandro Temil <atemil@waymo.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agonet: xilinx: axi_emac: Cleanup ofdata_to_platdata
Ashok Reddy Soma [Wed, 16 Jun 2021 06:20:30 +0000 (00:20 -0600)] 
net: xilinx: axi_emac: Cleanup ofdata_to_platdata

There are lot of accesses to priv data in ofdata_to_platdata, which is
incorrect. Create a platform data structure and use it in
ofdata_to_platdata, then copy all platform data to priv data in probe.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: zynqmp: Sync with upstream Linux/U-Boot
Michal Simek [Mon, 14 Jun 2021 13:14:26 +0000 (15:14 +0200)] 
arm64: zynqmp: Sync with upstream Linux/U-Boot

Trivial sync up. Line is longer but still inside current char limit.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add missing zcu670 to the OF_LIST
Michal Simek [Mon, 14 Jun 2021 13:27:12 +0000 (15:27 +0200)] 
arm64: zynqmp: Add missing zcu670 to the OF_LIST

Just list this board in OF_LIST that DT is added to u-boot.its/itb file.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove unused snps,enable-hibernation flag
Michal Simek [Mon, 14 Jun 2021 13:12:27 +0000 (15:12 +0200)] 
arm64: zynqmp: Remove unused snps,enable-hibernation flag

This property is used only in gadget mode and there were some upstreaming
commnents about disabling it. Also this property is commented in usb0 but
not in usb1. That's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Sync dpdma location with other boards on dc1
Michal Simek [Mon, 14 Jun 2021 13:02:55 +0000 (15:02 +0200)] 
arm64: zynqmp: Sync dpdma location with other boards on dc1

All DTSes should use the same order for dpdma and dpsub nodes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Update year in copyright
Michal Simek [Mon, 14 Jun 2021 12:53:52 +0000 (14:53 +0200)] 
arm64: zynqmp: Update year in copyright

The same year is used in mainline u-boot that's why sync it up.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove additional newlines from k26 and zcu100
Michal Simek [Mon, 14 Jun 2021 13:01:31 +0000 (15:01 +0200)] 
arm64: zynqmp: Remove additional newlines from k26 and zcu100

No need for these lines found while upstreaming.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove revA compatibility string from kv260 revB/1
Michal Simek [Thu, 10 Jun 2021 16:52:14 +0000 (18:52 +0200)] 
arm64: zynqmp: Remove revA compatibility string from kv260 revB/1

kv260-revB is different compare to revA (usbhub is wired via i2c) that's
why remove revA compatible string.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoRevert "arm64: zynqmp: Make SMMU a separate node outside amba"
Michal Simek [Mon, 14 Jun 2021 13:16:21 +0000 (15:16 +0200)] 
Revert "arm64: zynqmp: Make SMMU a separate node outside amba"

This reverts commit 2c3f2141f576e1c8f03d94082d44f5edff69b415.

Also disable status and change smmu to iommu based on Linux upstreaming

https://lore.kernel.org/r/20200629081744.13916-1-krzk@kernel.org
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove si5328 and si5382 nodes
Michal Simek [Thu, 3 Jun 2021 09:58:08 +0000 (11:58 +0200)] 
arm64: zynqmp: Remove si5328 and si5382 nodes

There are no drivers for these devices that's why remove that nodes
completely. This change is done based on Linux kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/20210308115437.2232847-1-quanyang.wang@windriver.com
4 years agoarm64: zynqmp: Sync dp port location on zc1751 dc4
Michal Simek [Tue, 1 Jun 2021 14:42:02 +0000 (16:42 +0200)] 
arm64: zynqmp: Sync dp port location on zc1751 dc4

Historically dpdma and dpsub are placed at the end of files. Move nodes
there for easier comparison among dts files.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Use overlay sugar syntax for Kria SOM
Michal Simek [Thu, 10 Jun 2021 15:59:46 +0000 (17:59 +0200)] 
arm64: zynqmp: Use overlay sugar syntax for Kria SOM

dtc supports new sugar syntax which is easier compare to previous one
that's why also covert overlays for SOM to it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agozynqmp: Remove u-boot,dm-pre-reloc for uart instances
Michal Simek [Mon, 31 May 2021 12:41:23 +0000 (14:41 +0200)] 
zynqmp: Remove u-boot,dm-pre-reloc for uart instances

Uarts already have u-boot,dm-pre-reloc via zynqmp.dtsi that's why there is
no need to have them in platform DT files too.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Enable USB3.0 for dc2/dc3
Michal Simek [Fri, 11 Jun 2021 06:52:25 +0000 (08:52 +0200)] 
arm64: zynqmp: Enable USB3.0 for dc2/dc3

Both boards are usb3.0 capable. dc3 was also missing enabling dwc3* nodes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Series-to: uboot
Cover-letter:
arm64: zynqmp: Update USB and Kria DTs
Hi,

this series contain updates for Kria SOM kv260 CCs. Also update usb
description.

Thanks,
Michal
END

4 years agoarm64: zynqmp: Remove can aliases from zc1751
Michal Simek [Thu, 3 Jun 2021 10:32:18 +0000 (12:32 +0200)] 
arm64: zynqmp: Remove can aliases from zc1751

Networking subsystem is not using aliases that's why remove them for CAN
devices. There is also no any other Xilinx ZynqMP DT file with them.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove additional header from zc1232 DT
Michal Simek [Mon, 31 May 2021 15:44:51 +0000 (17:44 +0200)] 
arm64: zynqmp: Remove additional header from zc1232 DT

Remove unused phy.h from zc1232 DTS.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Sync psgtr location on zcu100/zcu106
Michal Simek [Tue, 1 Jun 2021 14:42:50 +0000 (16:42 +0200)] 
arm64: zynqmp: Sync psgtr location on zcu100/zcu106

psgtr node should be below pinctrl for easier comparion among dts files.
That's why move that nodes to different location.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Sync psgtr location on zcu104/zcu111/zc1751-dc1
Michal Simek [Thu, 3 Jun 2021 13:18:04 +0000 (15:18 +0200)] 
arm64: zynqmp: Sync psgtr location on zcu104/zcu111/zc1751-dc1

psgtr node should be below pinctrl for easier comparion among dts files.
That's why move that nodes to different location.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add maximum-speed property for dwc3 nodes
Michal Simek [Mon, 31 May 2021 15:51:58 +0000 (17:51 +0200)] 
arm64: zynqmp: Add maximum-speed property for dwc3 nodes

dwc3 can be used only for higher speeds than super-speed that's why
explicitly set it up.
This is also aligned with other ZynqMP dts files.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: Convert xlnx,eeprom property to nvmem alias
Michal Simek [Thu, 3 Jun 2021 09:46:50 +0000 (11:46 +0200)] 
xilinx: Convert xlnx,eeprom property to nvmem alias

Convert all boards to use nvmem alias instead of xlnx,eeprom. The change is
done based on discussion in the link below.

Link: https://lore.kernel.org/r/CAL_JsqLMDqpkyg-Q7mUfw-XH67-v068Q6e9wTq2UOoN=0-_coQ@mail.gmail.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Remove gpio from aliases list
Michal Simek [Thu, 3 Jun 2021 08:47:04 +0000 (10:47 +0200)] 
arm64: zynqmp: Remove gpio from aliases list

It is not recommended to have aliases for gpio. In past it was used in
Linux for assigning numbers via sysfs which is deprecated and libgpiod
should be used instead.
In U-Boot this number is used for seq number but gpio offset are not
counted from this number. That's why having these aliases only for seq
number is not needed. As is done in Linux it is the best to use full gpio
name instead of sequence number which depends on sequence in binding.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agospi: zynqmp_gqspi: Fix issue of reading more than 32bits length
Ashok Reddy Soma [Thu, 20 May 2021 08:04:04 +0000 (02:04 -0600)] 
spi: zynqmp_gqspi: Fix issue of reading more than 32bits length

As the flash sizes are increasing day by day, QSPI in dual-parallel mode
can have devices of size > 512MB. In qspi driver we are trying to read
all the data at once using DMA.

The DMA descriptor destination size is only 29bits long.

QSPIDMA_DST_SIZE 0xFF0F0804

BITS:  1:0 Reserved to keep word alignment
BITS: 28:2 Number of 4-byte words the DMA will transfer
BITS: 31:29 Reserved: Returns 0 when read, writes ignored

So we can only transfer data of 0x1FFFFFF0(512MB minus 4bytes) bytes.
Anything above will overflow this register and will ignore higher bits
above 29 bits.

Change the DMA functionality if the requested size is greater than or
equal to 512MB to read 256MB chunks.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: zynqmp_gqspi: Remove xfer from zynqmp_qspi_ops
Ashok Reddy Soma [Thu, 20 May 2021 08:04:03 +0000 (02:04 -0600)] 
spi: zynqmp_gqspi: Remove xfer from zynqmp_qspi_ops

In zynqmp_qspi_ops mem_ops is added, so all the trasfers tx and rx
happen through this function. So we dont need this xfer anymore.
Remove it.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: dts: zynqmp: rtc: Update rtc calibration value
Srinivas Neeli [Mon, 8 Mar 2021 08:35:19 +0000 (14:05 +0530)] 
arm64: dts: zynqmp: rtc: Update rtc calibration value

As per the design specification
"The 16-bit Seconds Calibration Value represents the number of
 Oscillator Ticks that are required to measure the largest time
 period that is less than or equal to 1 second.
 For an oscillator that is 32.768 KHz, this value will be 0x7FFF."

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
State: pending

4 years agoarm64: zynqmp: Remove unused property from SD/USB
Michal Simek [Thu, 3 Jun 2021 11:46:27 +0000 (13:46 +0200)] 
arm64: zynqmp: Remove unused property from SD/USB

Linux kernel is not using these properties that's why they can be removed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: Enable GUID partitions and EFI variable commands
Michal Simek [Thu, 1 Apr 2021 10:35:42 +0000 (12:35 +0200)] 
xilinx: Enable GUID partitions and EFI variable commands

For work with EFI it is good to have GUID partitions enabled and also
option to work with UEFI variables. That's why enable both.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
State: upstream (84befd408c1e3ad2d7b410adaf58fe4d397cb7b6)

4 years agoarm64: versal: zynqmp: Add support for VPXA2785
Michal Simek [Tue, 26 Jan 2021 14:59:59 +0000 (15:59 +0100)] 
arm64: versal: zynqmp: Add support for VPXA2785

VPXA2785(vp-x-a2785-00) is evaluation board which contains two PCIe-Edge
fingers, one for PCIe-B(gen5x8) and one for CPM(dual gen5x8, gen5x16).
Each of the ports can operate in endpoint or root port mode. This allows
the single card to be used for both root port, endpoint, and switch modes.

The board is designed in the similar manner as others Versal boards. It
means board also have ZynqMP Zu4 System Controller which is described in a
separate file.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: zynqmp: Add support for vpk120
Michal Simek [Tue, 19 Jan 2021 14:00:45 +0000 (15:00 +0100)] 
arm64: versal: zynqmp: Add support for vpk120

Add support for Versal premium evaluation board vpk120.
Board contains two systems. The primary is Versal VP1202 ACAP device and
the secondary is ZynqMP zu4 which acts as system controller.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoARM: zynq: Fix OCM mapping to be aligned with binding on zc702
Michal Simek [Thu, 26 Nov 2020 13:25:03 +0000 (14:25 +0100)] 
ARM: zynq: Fix OCM mapping to be aligned with binding on zc702

The Linux commit f69629919942 ("dt-bindings: sram: Convert SRAM bindings to
json-schema") converted binding to yaml and some missing required
properties started to be reported. Align binding based on it.

The patch is fixing these warnings:
.../zynq-zc702.dt.yaml: sram@fffc0000: '#address-cells' is a required property
.../zynq-zc702.dt.yaml: sram@fffc0000: '#size-cells' is a required property
.../zynq-zc702.dt.yaml: sram@fffc0000: 'ranges' is a required property
>From schema: .../Documentation/devicetree/bindings/sram/sram.yaml

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/87c02786ccd8d7827827a9d95a8737bb300caeb0.1606397101.git.michal.simek@xilinx.com
Link: https://lists.denx.de/pipermail/u-boot/2021-May/450885.html
State: waiting

4 years agoARM: zynq: Convert at25 binding to new description on zc770-xm013
Michal Simek [Thu, 26 Nov 2020 13:25:04 +0000 (14:25 +0100)] 
ARM: zynq: Convert at25 binding to new description on zc770-xm013

The Linux commit f8f79fa6bb25 ("dt-bindings: at25: convert the binding
document to yaml") converted binding to yaml and 3 deprecated properties
pop up.

The patch is fixing these warnings:
.../zynq-zc770-xm013.dt.yaml: eeprom@2: 'pagesize' is a required property
.../zynq-zc770-xm013.dt.yaml: eeprom@2: 'size' is a required property
.../zynq-zc770-xm013.dt.yaml: eeprom@2: 'address-width' is a required property
>From schema: .../Documentation/devicetree/bindings/eeprom/at25.yaml

by converting them to new binding.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/be2c1125d98386033e182012eb08986924707a76.1606397101.git.michal.simek@xilinx.com
Link: https://lists.denx.de/pipermail/u-boot/2021-May/450886.html
State: waiting

4 years agoarm64: dts: zynqmp: Update psgtr clocks index for boards
Piyush Mehta [Tue, 25 May 2021 12:38:30 +0000 (18:08 +0530)] 
arm64: dts: zynqmp: Update psgtr clocks index for boards

Update the psgtr clock indexing for zynqmp boards zcu208,zcu216 and zcu111.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
4 years agommc: zynq_sdhci: wait till sd card detect state is stable
T Karthik Reddy [Tue, 18 May 2021 14:28:02 +0000 (08:28 -0600)] 
mmc: zynq_sdhci: wait till sd card detect state is stable

As per SD spec when SD host controller is reset, it takes 1000msec
to detect the card state. In case, if we enable the sd bus voltage &
card detect state is not stable, then host controller will disable
the sd bus voltage.

In case of warm/subsystem reboot, due to unstable card detect state
host controller is disabling the sd bus voltage to sd card causing
sd card timeout error. So we wait for a maximum of 1000msec to get
the card detect state stable before we enable the sd bus voltage.

This current fix is workaround for now, this needs to be analysed
further. Zynqmp platform should behave the same as Versal, but we
did not encounter this issue as of now. So we are fixing it for
Versal only.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agoarm64: dts: versal: Add interrupt parent properties to versal firmware DT node
Abhyuday Godhasara [Fri, 14 May 2021 10:07:13 +0000 (03:07 -0700)] 
arm64: dts: versal: Add interrupt parent properties to versal firmware DT node

Event Management driver in Linux require interrupt parent property from
DT node of versal firmware.

So Add interrupt parent properties into DT node of versal firmware.

Signed-off-by: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
4 years agoxilinx: zynqmp: Add support for 67dr silicon
T Karthik Reddy [Thu, 13 May 2021 13:13:25 +0000 (07:13 -0600)] 
xilinx: zynqmp: Add support for 67dr silicon

Add zynqmp 67dr silicon to zynqmp device id table.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agoarm64: zynqmp: Enable EFI secure boot
Michal Simek [Thu, 13 May 2021 11:58:58 +0000 (13:58 +0200)] 
arm64: zynqmp: Enable EFI secure boot

Enabling EFI secure boot which is required for EBBR specification.
Enabling this will fix
"RT.SetVariable - Create one Time Base Auth Variable, the expect return
status should be EFI_SUCCESS"

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoefi_loader: support EFI_LOAD_FILE_PROTOCOL
Heinrich Schuchardt [Sun, 6 Dec 2020 12:00:15 +0000 (13:00 +0100)] 
efi_loader: support EFI_LOAD_FILE_PROTOCOL

Support loading images via the EFI_LOAD_FILE_PROTOCOL and
EFI_LOAD_FILE2_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (3da0b28582004981d6ca6866130d2835c3cbf0d0)

4 years agoefi_loader: carve out efi_load_image_from_file()
Heinrich Schuchardt [Sun, 6 Dec 2020 09:47:57 +0000 (10:47 +0100)] 
efi_loader: carve out efi_load_image_from_file()

efi_load_image_from_file() should read via either of:

* EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
* EFI_LOAD_FILE_PROTOCOL
* EFI_LOAD_FILE2_PROTOCOL

To make the code readable carve out a function to load the image via the
file system protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (0e074d12393ba14536f8a103b28c75f74b7c5896)

4 years agoefi_loader: pass boot_policy to efi_load_image_from_path
Heinrich Schuchardt [Fri, 4 Dec 2020 08:27:41 +0000 (09:27 +0100)] 
efi_loader: pass boot_policy to efi_load_image_from_path

Implementing support for loading images via the EFI_LOAD_FILE_PROTOCOL
requires the boot policy as input for efi_load_image_from_path().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (6e8c28cf523257acba5d6ccb4328253595640931)

4 years agoefi_loader: move EFI_LOAD_FILE2_PROTOCOL_GUID
Heinrich Schuchardt [Fri, 4 Dec 2020 02:33:41 +0000 (03:33 +0100)] 
efi_loader: move EFI_LOAD_FILE2_PROTOCOL_GUID

The EFI_LOAD_FILE_PROTOCOL_GUID and EFI_LOAD_FILE2_PROTOCOL_GUID are needed
to complement the implementation of the LoadFile() boot service.

Remove a duplicate declaration of a variable for the
EFI_LOAD_FILE2_PROTOCOL_GUID.
Move the remaining declaration to efi_boottime.c.
Add a variable for the EFI_LOAD_FILE_PROTOCOL_GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (b6f11098c9a619f480582b26edd26c5b195c69f4)

4 years agoefi_loader: resequence functions in efi_boottime.c
Heinrich Schuchardt [Fri, 4 Dec 2020 02:02:03 +0000 (03:02 +0100)] 
efi_loader: resequence functions in efi_boottime.c

For implementing support for the EFI_LOAD_FILE_PROTOCOL in the LoadImage()
service we will have to call the LocateDevicePath() service. To avoid a
forward declaration resequence the functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (0e9d2d7bc25bd3114e8f6ff0d18cdf9ee675909c)

4 years agoxilinx: versal: Enable CONFIG_POSITION_INDEPENDENT
T Karthik Reddy [Wed, 12 May 2021 05:39:16 +0000 (23:39 -0600)] 
xilinx: versal: Enable CONFIG_POSITION_INDEPENDENT

U-Boot expects to be linked to a specific hard-coded address and to
be loaded to and run from that address. CONFIG_POSITION_INDEPENDENT
config lifts that restriction & allowing the code to be loaded to
and executed from almost any address.

As we enabled CONFIG_POSITION_INDEPENDENT, CONFIG_INIT_SP_RELATIVE
is enabled by default, where it will set the early stack pointer at
runtime by adding an offset value to &_bss_start. The offset value
is taken from SYS_INIT_SP_BSS_OFFSET.

SYS_INIT_SP_BSS_OFFSET offset should be large enough so that the
early malloc region, global data (gd), and early stack should fit.
With commit d8fabcc424bd ("arm64: versal: Increase SYS_MALLOC_F_LEN")
SYS_MALLOC_F_LEN is increased from 32KB to 1MB, so we need to
accommodate this space with SYS_INIT_SP_BSS_OFFSET. Hence increasing
SYS_INIT_SP_BSS_OFFSET to 1.5MB.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoxilinx: zynqmp: Enable DM_RTC/emul driver/cmd date/gettime and efi settime
Michal Simek [Wed, 12 May 2021 08:03:44 +0000 (10:03 +0200)] 
xilinx: zynqmp: Enable DM_RTC/emul driver/cmd date/gettime and efi settime

Right now U-Boot is not aware about date/time that's why enable it by
default also with EFI runtime service for setting time.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Enable gpio driver for zcu1275/zcu1285
Michal Simek [Tue, 11 May 2021 11:59:01 +0000 (13:59 +0200)] 
arm64: zynqmp: Enable gpio driver for zcu1275/zcu1285

Enable gpio driver on these boards. GPIOs can be used on any board.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: Disable unnecessary configs from OSPI mini config
Ashok Reddy Soma [Tue, 11 May 2021 10:37:28 +0000 (04:37 -0600)] 
arm64: versal: Disable unnecessary configs from OSPI mini config

Disable ZYNQMP_FIRMWARE and GPIO from the OSPI mini config. Also there
are no OSPI parts from couple of manufacturers like SPANSION, SST and
WINBOND. Disable them to save some size of the mini u-boot.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: cadence_qspi: Enable linear mode in mini u-boot
Ashok Reddy Soma [Tue, 11 May 2021 10:37:27 +0000 (04:37 -0600)] 
spi: cadence_qspi: Enable linear mode in mini u-boot

OSPI writes are done using direct access(DAC) mode with AHB bus. This needs
linear mode to be enabled. In case of full U-Boot linear mode is enabled
using xilinx_pm_request() calls. But in mini u-boot it will not work
since ZYNQMP_FIRMWARE will not be enabled.

Tried enabling ZYNQMP_FIRMWARE, ZYNQMP_IPI and MAILBOX to make
xilinx_pm_request() working for mini U-Boot as well but it is getting
hung somewhere before it comes to the prompt. This needs to be debugged
later.

For now add condition to call xilinx_pm_request() only if ZYNQMP_FIRMWARE
is enabled in config.

Enable linear mode using register writes. Also remove ZYNQMP_FIRMWARE from
Kconfig as a dependency.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: versal: Fix AHB base address and size in ospi node
Ashok Reddy Soma [Tue, 11 May 2021 10:37:26 +0000 (04:37 -0600)] 
arm64: versal: Fix AHB base address and size in ospi node

AHB base address is incorrect in OSPI node of mini u-boot. Add proper
base address and size.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: zynqmp: Replace 'io-standard' with 'power-source' property
Sai Krishna Potthuri [Fri, 7 May 2021 08:26:08 +0000 (13:56 +0530)] 
arm64: zynqmp: Replace 'io-standard' with 'power-source' property

Replace 'io-standard' property with 'power-source' property in all
zynqmp dts files to be in sync with ZynqMP Pinctrl driver.

Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
4 years agoarm64: zynqmp: Add missing SMID for pcie to zynqmp.dtsi
Stefano Stabellini [Wed, 5 May 2021 21:18:21 +0000 (14:18 -0700)] 
arm64: zynqmp: Add missing SMID for pcie to zynqmp.dtsi

The SMMU is disabled in device tree so this change has no impact.
The benefit is that this way it is in sync with xen.dtsi. Xen enables
the SMMU and makes use of it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
4 years agoarm64: zynqmp: Uncomment iommus for zynqmp_dpdma and zynqmp_dpsub
Stefano Stabellini [Wed, 5 May 2021 21:16:59 +0000 (14:16 -0700)] 
arm64: zynqmp: Uncomment iommus for zynqmp_dpdma and zynqmp_dpsub

The SMMU is disabled in device tree so this change has no impact.
The benefit is that this way it is in sync with xen.dtsi. Xen enables
the SMMU and makes use of it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
4 years agospi: cadence_qspi: Add support for ospi dual stacked
Ashok Reddy Soma [Tue, 4 May 2021 07:45:19 +0000 (01:45 -0600)] 
spi: cadence_qspi: Add support for ospi dual stacked

Add support for ospi dual stacked flash configuration.
Read "is-stacked" property from dt and export it to spi-nor framework
via slave->option. Based on the address/offset spi-nor framework will
populate CS through flags for read, write and erase functions.
configure chip select in cadence_qspi driver based on the flags
received from spi-nor framework.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: zynqmp: Add zynqmp firmware specific DT nodes
T Karthik Reddy [Thu, 29 Apr 2021 14:02:29 +0000 (08:02 -0600)] 
arm64: zynqmp: Add zynqmp firmware specific DT nodes

Probe zynqmp firmware driver by adding zynqmp firmware, power &
ipi mailbox device tree nodes for mini emmc.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agommc: zynq_sdhci: Use xilinx pm request instead of mmio_write call
T Karthik Reddy [Thu, 29 Apr 2021 14:02:27 +0000 (08:02 -0600)] 
mmc: zynq_sdhci: Use xilinx pm request instead of mmio_write call

Currently xilinx sdhci driver is using zynqmp_mmio_write() to set
tapdelay values. Use xilinx_pm_request() using appropriate arguments
to set input/output tapdelays for zynqmp. Where tapdelay setting is
done by firmware. Host driver should explicitly request DLL reset
before ITAP (assert DLL) and after OTAP (release DLL) to avoid issues
in some cases. Also handle error return where possible.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agozynqmp_firmware: Add zynqmp firmware related enums
T Karthik Reddy [Thu, 29 Apr 2021 14:02:28 +0000 (08:02 -0600)] 
zynqmp_firmware: Add zynqmp firmware related enums

Add enums for pm node id's, tapdelay types, dll reset types.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agoarm64: xilinx: Set CONFIG_ZYNQMP_FIRMWARE config for mini emmc
T Karthik Reddy [Thu, 29 Apr 2021 14:02:30 +0000 (08:02 -0600)] 
arm64: xilinx: Set CONFIG_ZYNQMP_FIRMWARE config for mini emmc

CONFIG_ZYNQMP_FIRMWARE enables zynqmp firmware driver.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agommc: sdhci: Return error in case of failure
T Karthik Reddy [Thu, 29 Apr 2021 14:02:26 +0000 (08:02 -0600)] 
mmc: sdhci: Return error in case of failure

set_delay() function is from sdhci host ops, which does not return
any error case due to void return type. Where
arasan_sdhci_set_tapdelay() from arasan sdhci driver returns error
when there is a failure. So set return type to set_delay().

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agomtd: spi: Add 4-byte opcode support to macronix flash parts
T Karthik Reddy [Thu, 22 Apr 2021 05:03:36 +0000 (23:03 -0600)] 
mtd: spi: Add 4-byte opcode support to macronix flash parts

Enable 4-byte opcode support for macronix mx66u2g45g, mx66l1g45g,
mx66l2g45g, mx25l25655e qspi flash parts.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agoimage: Check for unit addresses in FITs
Simon Glass [Tue, 16 Feb 2021 00:08:12 +0000 (17:08 -0700)] 
image: Check for unit addresses in FITs

Using unit addresses in a FIT is a security risk. Add a check for this
and disallow it.

CVE-2021-27138

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (3f04db891a353f4b127ed57279279f851c6b4917)

4 years agolibfdt: Check for multiple/invalid root nodes
Simon Glass [Tue, 16 Feb 2021 00:08:11 +0000 (17:08 -0700)] 
libfdt: Check for multiple/invalid root nodes

It is possible to construct a devicetree blob with multiple root nodes.
Update fdt_check_full() to check for this, along with a root node with an
invalid name.

CVE-2021-27097

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (124c255731c76a2b09587378b2bcce561bcd3f2d)

4 years agoimage: Add an option to do a full check of the FIT
Simon Glass [Tue, 16 Feb 2021 00:08:10 +0000 (17:08 -0700)] 
image: Add an option to do a full check of the FIT

Some strange modifications of the FIT can introduce security risks. Add an
option to check it thoroughly, using libfdt's fdt_check_full() function.

Enable this by default if signature verification is enabled.

CVE-2021-27097

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (6f3c2d8aa5e6cbd80b5e869bbbddecb66c329d01)

4 years agoimage: Adjust the workings of fit_check_format()
Simon Glass [Tue, 16 Feb 2021 00:08:09 +0000 (17:08 -0700)] 
image: Adjust the workings of fit_check_format()

At present this function does not accept a size for the FIT. This means
that it must be read from the FIT itself, introducing potential security
risk. Update the function to include a size parameter, which can be
invalid, in which case fit_check_format() calculates it.

For now no callers pass the size, but this can be updated later.

Also adjust the return value to an error code so that all the different
types of problems can be distinguished by the user.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (c5819701a3de61e2ba2ef7ad0b616565b32305e5)

4 years agotest: Add tests for the 'evil' vboot attacks
Simon Glass [Tue, 16 Feb 2021 00:08:08 +0000 (17:08 -0700)] 
test: Add tests for the 'evil' vboot attacks

Add tests to check that these two attacks are mitigated by recent patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (d5f3aadacbc63df3b690d6fd9f0aa3f575b43356)

4 years agotest: Add vboot_evil implementation
Simon Glass [Tue, 16 Feb 2021 00:08:07 +0000 (17:08 -0700)] 
test: Add vboot_evil implementation

Add a library which performs two different attacks on a FIT.

Signed-off-by: Julien Lenoir <julien.lenoir@intel.com>
Signed-off-by: Bruce Monroe <bruce.monroe@intel.com>
Signed-off-by: Arie Haenel <arie.haenel@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
State: upstream (fafafacb470b345f2f41b86e4633ef91a7c5ed23)

4 years agofit: Don't allow verification of images with @ nodes
Simon Glass [Tue, 16 Feb 2021 00:08:06 +0000 (17:08 -0700)] 
fit: Don't allow verification of images with @ nodes

When searching for a node called 'fred', any unit address appended to the
name is ignored by libfdt, meaning that 'fred' can match 'fred@1'. This
means that we cannot be sure that the node originally intended is the one
that is used.

Disallow use of nodes with unit addresses.

Update the forge test also, since it uses @ addresses.

CVE-2021-27138

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (79af75f7776fc20b0d7eb6afe1e27c00fdb4b9b4)

4 years agofdt_region: Check for a single root node of the correct name
Simon Glass [Tue, 16 Feb 2021 00:08:05 +0000 (17:08 -0700)] 
fdt_region: Check for a single root node of the correct name

At present fdt_find_regions() assumes that the FIT is a valid devicetree.
If the FIT has two root nodes this is currently not detected in this
function, nor does libfdt's fdt_check_full() notice. Also it is possible
for the root node to have a name even though it should not.

Add checks for these and return -FDT_ERR_BADSTRUCTURE if a problem is
detected.

CVE-2021-27097

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
State: upstream (8a7d4cf9820ea16fabd25a6379351b4dc291204b)

4 years agoefi_loader: switch to non-secure mode later
Heinrich Schuchardt [Sun, 24 Jan 2021 14:34:12 +0000 (14:34 +0000)] 
efi_loader: switch to non-secure mode later

Some ARMv7 boards using PSCI require to be in secure-mode when booted via
'bootz' or 'bootm'. During distro-boot 'bootefi bootmgr' is called to check
if booting via UEFI is possible.

With the change we change the switch from secure mode to non-secure mode is
moved from the UEFI subsystem setup to just before calling StartImage().

Cc: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (82d01f04facef1276cede067efd02d2a731ffe83)

4 years agoefi_loader: make the UEFI boot manager configurable
Heinrich Schuchardt [Fri, 15 Jan 2021 18:02:50 +0000 (19:02 +0100)] 
efi_loader: make the UEFI boot manager configurable

Some boards are very tight on the binary size. Booting via UEFI is possible
without using the boot manager.

Provide a configuration option to make the boot manager available.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (ff2f532fadd8f5238cc1ac2ae4ab075703bcc313)

4 years agoefi_loader: implement EFI_DT_FIXUP_PROTOCOL
Heinrich Schuchardt [Sun, 13 Dec 2020 09:30:24 +0000 (10:30 +0100)] 
efi_loader: implement EFI_DT_FIXUP_PROTOCOL

A boot manager like GRUB can use the protocol to

* apply U-Boot's fix-ups to the a device-tree
* let U-Boot make memory reservations according to the device-tree
* install the device-tree as a configuration table

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (94686f60a2b9fd87842f473a5cdca316668765c3)

4 years agoefi_loader: setting boot device
Heinrich Schuchardt [Tue, 12 Jan 2021 11:46:24 +0000 (12:46 +0100)] 
efi_loader: setting boot device

Up to now the bootefi command used the last file loaded to determine the
boot partition. This has led to errors when the fdt had been loaded from
another partition after the EFI binary.

Before setting the boot device from a loaded file check if it is a PE-COFF
image or a FIT image.

For a PE-COFF image remember address and size, boot device and path.

For a FIT image remember boot device and path.

If the PE-COFF image is overwritten by loading another file, forget it.

Do not allow to start an image via bootefi which is not the last loaded
PE-COFF image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (5f59518a7b1aef9ad3a91defa06cff82dd01cdc5)

4 years agoefi_loader: simplify running helloworld.efi
Heinrich Schuchardt [Tue, 12 Jan 2021 16:44:08 +0000 (17:44 +0100)] 
efi_loader: simplify running helloworld.efi

Currently when executing 'bootefi hello' we copy helloworld.efi to the
address identified by environment variable loadaddr. This is unexected
behavior for a user. There is no need to copy helloworld.efi before
executing it after relocation.

Remove the copy action.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (bb33c79e47e6ae4b538702b8f3d9a8ffc4b637ea)

4 years agoimage-fit: fit_check_format check for valid FDT
Heinrich Schuchardt [Wed, 13 Jan 2021 01:09:12 +0000 (02:09 +0100)] 
image-fit: fit_check_format check for valid FDT

fit_check_format() must check that the buffer contains a flattened device
tree before calling any device tree library functions.

Failure to do may cause segmentation faults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
State: upstream (ea1a9ec5f430359720d9a0621ed1acfbba6a142a)

4 years agoefi_loader: carve out efi_check_pe()
Heinrich Schuchardt [Tue, 12 Jan 2021 11:40:32 +0000 (12:40 +0100)] 
efi_loader: carve out efi_check_pe()

Carve out a function to check that a buffer contains a PE-COFF image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoarm64: zynqmp: Fix application loading on R5 core1
Ashok Reddy Soma [Thu, 15 Apr 2021 11:12:15 +0000 (05:12 -0600)] 
arm64: zynqmp: Fix application loading on R5 core1

From U-Boot, loading application on RPU core 0 is fine but loading on
core 1 is not handled properly. Lock-step mode needs both the R5 cores
to be initialized and it is working fine. Whereas in SPLIT mode individual
R5 cores needs to be initialized as they need to execute differenet
applications. Handle both these lock-step and split modes by propagating
mode and RPU core number(4 for RPU0 and 5 for RPU1) for various functions
and by adding conditions in those functions.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoarm64: versal: Remove gd reference
Michal Simek [Thu, 15 Apr 2021 07:14:16 +0000 (09:14 +0200)] 
arm64: versal: Remove gd reference

gd is not used in this file that's why doesn't make sense to declare it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add 'regulator-always-on' property
Raviteja Narayanam [Thu, 15 Apr 2021 05:49:14 +0000 (23:49 -0600)] 
arm64: zynqmp: Add 'regulator-always-on' property

With the updates in framework, 'regulator-boot-on' property is not enough
to keep the regulator on, when no one is registered through the regulator
framework. We need to keep the outputs on, regardless of the consumers
as these ouptuts are controlled through a separate device called
'Sequencer' on these boards.
So, add 'regulator-always-on' which makes the num_users count to '1'
and prevents disabling the output during cleanup call of framework.

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
4 years agoarm64: zynqmp: Add label to all GPIO lines for VCK190 SC
Saeed Nowshadi [Tue, 13 Apr 2021 23:01:42 +0000 (16:01 -0700)] 
arm64: zynqmp: Add label to all GPIO lines for VCK190 SC

Add label to GPIO lines so the user-level applications can find any line
without knowing its physical path on System Controller on VCK190/VMK180.

These labels are describing EMIO gpio connection which depends on PL which
we normally don't describe but that's only way to go for now. Lately this
should be done out of this source code.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Separate SMK-K26 from SM-K26
Michal Simek [Wed, 7 Apr 2021 15:08:13 +0000 (17:08 +0200)] 
arm64: zynqmp: Separate SMK-K26 from SM-K26

Starter kit has sdhci0 disabled in HW that's why create separate it from
each other. Issue is if HW disable clk for this IP but IP is enabled in DT
u-boot is trying to access that regs and fails.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add 'i2c-mux-idle-disconnect' property
Raviteja Narayanam [Thu, 1 Apr 2021 13:14:10 +0000 (07:14 -0600)] 
arm64: zynqmp: Add 'i2c-mux-idle-disconnect' property

I2C muxes that have the slave devices with same address are
falling into the below problem.

VCK190 system controller (SC) - zynqmp-e-a2197-00-revA.dts
I2C1 (0xff030000) -> Mux1 (@0x74) -> Channel 3 -> 0x50
I2C1 (0xff030000) -> Mux2 (@0x75) -> Channel 0 -> 0x50

1. SC accesses I2C1 - Mux1 (0x74) - Channel 3 and then
2. SC accesses I2C1 - Mux2 (0x75) - Channel 0.

Now it results in 2 slave devices with same address (0x50)
on the I2C bus, making the communication un-reliable.

When ' i2c-mux-idle-disconnect' is in DT, after '1', the Mux
channel output is disconnected, making none of the channels
available to the I2C1. So, there is no question of having the
same addressed slave (0x50) present on the bus when we are doing '2'.

Same pattern is seen in below two boards also.

ZCU208 - zynqmp-zcu208-revA.dts
ZCU216 - zynqmp-zcu216-revA.dts

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
4 years agoarm64: zynqmp: Update k26-revA u-boot file
Michal Simek [Tue, 6 Apr 2021 15:44:11 +0000 (17:44 +0200)] 
arm64: zynqmp: Update k26-revA u-boot file

Just minor comment changes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Squashed revB for k26 with revA
Michal Simek [Tue, 6 Apr 2021 12:52:58 +0000 (14:52 +0200)] 
arm64: zynqmp: Squashed revB for k26 with revA

K26 has two variants with and without EMMC. SM-K26 is board with EMMC on it
and SMK-K26 is board without EMMC. The same DT can be used for both. The
only difference is if you can access that memory or not.
Compatible string is extended to also cover SMK versions of this board.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>