]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
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>
4 years agoarm64: versal: Update OSPI TX buswidth to 8
Sai Krishna Potthuri [Fri, 2 Apr 2021 11:46:13 +0000 (17:16 +0530)] 
arm64: versal: Update OSPI TX buswidth to 8

This patch update the spi-tx-bus-width property to 8 for OSPI flash.
SPI based Linux driver is dependent on 'spi-tx-bus-width' property
to operate in Octal SPI mode.

Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
4 years agoxilinx: common: Fix boot script address
T Karthik Reddy [Fri, 2 Apr 2021 07:49:17 +0000 (01:49 -0600)] 
xilinx: common: Fix boot script address

Currently u-boot supports addresses upto 39-bits only. If anybody
wants to use addresses of more than 39-bits in Linux they will have
a separate memory node in DT. In such cases they will have multiple
memory nodes.
Currently u-boot selects and runs on lower memory bank region.
But bootscript is being loaded on dram bank 0, where dram bank 0 will
point to 1st memory node in DT. If first memory node is mentioned as
higher ddr(>39-bits address) then u-boot cannot load the bootscript.
So fix this issue by setting bootscript address within the lower memory
bank region.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: config: Cleanup unsued SF_DUAL_FLASH config
Ashok Reddy Soma [Tue, 30 Mar 2021 07:22:05 +0000 (01:22 -0600)] 
spi: config: Cleanup unsued SF_DUAL_FLASH config

SF_DUAL_FLASH config is unused in code after moving to spi-nor
framework. Remove it from all defconfigs and Kconfig.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agoxilinx: Enable DFU_TIMEOUT config
T Karthik Reddy [Wed, 31 Mar 2021 05:24:59 +0000 (23:24 -0600)] 
xilinx: Enable DFU_TIMEOUT config

Enable CONFIG_DFU_TIMEOUT to set timeout waiting for dfu command.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: zynq: Add usb dfu/thor distro boot support
T Karthik Reddy [Wed, 31 Mar 2021 05:24:58 +0000 (23:24 -0600)] 
xilinx: zynq: Add usb dfu/thor distro boot support

Add support for usb dfu & thor to distro boot on zynq platform.
Add 60s timeout of dfu-utils to start transaction. Remove
DFU_ALT_INFO_RAM as we use bootcmd_usb_dfu instead of dfu_ram.
Remove DFU_ALT_INFO_MMC as part of distro boot cleanup.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: versal: Add usb dfu/thor distro boot support
T Karthik Reddy [Wed, 31 Mar 2021 05:24:57 +0000 (23:24 -0600)] 
xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: zynqmp: Remove dfu_ram_info setup
Michal Simek [Thu, 25 Mar 2021 08:55:30 +0000 (09:55 +0100)] 
xilinx: zynqmp: Remove dfu_ram_info setup

The dfu ram info is wired in connection to Linux kernel and certain setup.
We should change this to be more generic as others command. That's why
using boot via script is the way to go.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: zynqmp: Add usb dfu/thor distro boot support
T Karthik Reddy [Thu, 25 Mar 2021 05:37:57 +0000 (23:37 -0600)] 
xilinx: zynqmp: Add usb dfu/thor distro boot support

In usb boot mode distro boot should select usb device as primary boot
device instead of usb host. So make usb dfu as primary boot device. But do
not list it in boot_targets as fallback option because it is not classic
mode for booting. Using 60s timeout by default should be enough time for
dfu-utils to start transaction. In case none needs this please change
timeout value in the command or disable CONFIG_DFU_TIMEOUT.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agocmd: dfu: Propagate error if dfu gadget fails
Michal Simek [Wed, 31 Mar 2021 07:05:52 +0000 (09:05 +0200)] 
cmd: dfu: Propagate error if dfu gadget fails

On systems without usb gadget dfu core fails which was reported by error
but command itself returns pass which breaks any usage in a script.
That's why propagate error from run_usb_dnl_gadget().

Fixes: 16297cfb2a20 ("usb: new board-specific USB init interface")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Rename revision 1.0 to just 1
Michal Simek [Mon, 29 Mar 2021 06:41:33 +0000 (08:41 +0200)] 
arm64: zynqmp: Rename revision 1.0 to just 1

EEPROM has only rev 1 not rev 1.0 that's why change to be aligned.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Rename SOM to be aligned with names in DT
Michal Simek [Mon, 29 Mar 2021 06:35:05 +0000 (08:35 +0200)] 
arm64: zynqmp: Rename SOM to be aligned with names in DT

The reason is that fdtfile variable is generated based on compatible string
in DT.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoxilinx: Enable efi debug command
Michal Simek [Fri, 26 Mar 2021 10:16:24 +0000 (11:16 +0100)] 
xilinx: Enable efi debug command

Enable EFI debug command to be able to setup various efi variables to avoid
software like grub.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add 'silabs,skip-recall' to DDR DIMM si570 clk node
Saeed Nowshadi [Mon, 22 Mar 2021 18:58:38 +0000 (11:58 -0700)] 
arm64: zynqmp: Add 'silabs,skip-recall' to DDR DIMM si570 clk node

The 'silabs,skip-recall' property prevents interruption in operation of
the clock while the driver is being probed.  Without this property, the
DDR DIMM clk can cause a failure during Versal's boot.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
4 years agoarm64: zynqmp: Add accurate compatible string for ST m24c64 eeprom
Michal Simek [Tue, 16 Mar 2021 12:29:00 +0000 (13:29 +0100)] 
arm64: zynqmp: Add accurate compatible string for ST m24c64 eeprom

The board is using ST eeprom not Atmel. But Atmel compatible string is used
in Linux and U-Boot that's why keep it also there.

Reported-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: zynqmp-sm-k26: Correct i2c addresses
Raviteja Narayanam [Mon, 22 Mar 2021 04:48:47 +0000 (22:48 -0600)] 
arm64: zynqmp: zynqmp-sm-k26: Correct i2c addresses

The i2c slave device addresses are corrected and added necessary
description to identify the issues.

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add reset properties to USB node
Manish Narani [Tue, 16 Mar 2021 14:17:41 +0000 (08:17 -0600)] 
arm64: zynqmp: Add reset properties to USB node

Update USB controller node in ZynqMP device tree to add reset
properties. There are three resets defined for USB core, USB hibernation
and APB reset.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
4 years agoarm64: zynqmp: Fix GTR reference clocks for zcu100
Michal Simek [Mon, 15 Mar 2021 11:28:57 +0000 (12:28 +0100)] 
arm64: zynqmp: Fix GTR reference clocks for zcu100

Reference clocks have been setup to 1/2 but they are 0/1.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Update ZynqMP DP entry
Dylan Yip [Wed, 10 Mar 2021 09:47:41 +0000 (01:47 -0800)] 
arm64: zynqmp: Update ZynqMP DP entry

As per Linux commit d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx
ZynqMP DisplayPort Subsystem"), the dt entry for ZynqMP DP is slightly
different compared to the downstream driver. This patch updates the dt
entry to the new dt bindings.

Also add xlnx-zynqmp-dpdma.h header.

Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Update DPDMA entry
Dylan Yip [Wed, 10 Mar 2021 09:47:40 +0000 (01:47 -0800)] 
arm64: zynqmp: Update DPDMA entry

As per Linux commit 7cbb0c63de3f ("dmaengine: xilinx: dpdma: Add the Xilinx
DisplayPort DMA engine driver"), the dt entry for the ZynqMP DPDMA has been
modified. So update the dt entry per the new dt bindings.

Signed-off-by: Dylan Yip <dylan.yip@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agospi: zynqmp_gqspi: fix set_speed bug on multiple runs
Brandon Maier [Wed, 20 Jan 2021 20:28:30 +0000 (14:28 -0600)] 
spi: zynqmp_gqspi: fix set_speed bug on multiple runs

If zynqmp_qspi_set_speed() is called multiple times with the same speed,
then on the second call it will skip recalculating the baud_rate_val as
it assumes the speed is already configured correctly. But it will still
write the baud_rate_val to the configuration register and call
zynqmp_gqspi_set_tapdelay(). Because it skipped recalculating the
baud_rate_val, it will use the initial value of 0 . This causes the
driver to run at maximum speed which for many spi flashes is too fast and
causes data corruption.

Instead only write out a new baud_rate_val if we have calculated the
correct baud_rate_val.

This opens up another issue with the "if (speed == 0)", we don't save
off the new plat->speed_hz value when setting the baud rate on the
speed=0 path. Instead mimic what the Linux zynqmp gqspi driver does, and
have speed==0 just use the same calculation as a normal speed. That will
cause the baud_rate_val to use the slowest speed possible, which is the
safest option.

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
CC: jagan@amarulasolutions.com
CC: michal.simek@xilinx.com
CC: Ashok Reddy Soma <ashokred@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add mode-pin GPIO controller DT node
Piyush Mehta [Wed, 10 Mar 2021 16:09:40 +0000 (21:39 +0530)] 
arm64: zynqmp: Add mode-pin GPIO controller DT node

Add mode-pin GPIO controller DT node in zynqmp.dtsi

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
4 years agoxilinx: Sync DTs for GTRs with Linux kernel
Michal Simek [Thu, 11 Mar 2021 14:33:25 +0000 (15:33 +0100)] 
xilinx: Sync DTs for GTRs with Linux kernel

There are several changes which happen in mainline kernel which should get
also to U-Boot. Here is the list of patches from the kernel:

- arm64: dts: zynqmp: Fix u48 si5382 chip on zcu111
- arm64: dts: zynqmp: Enable phy driver for Sata on zcu102/zcu104/zcu106
- arm64: dts: zynqmp: Enable si5341 driver for zcu102/106/111
- arm64: dts: zynqmp: Add DT description for si5328 for zcu102/zcu106

but also some other changes have been done.
- Remove USB3.0 serdes configurations
- Remove SATA serdes configuration for zc1232
- Remove comments about sgmii from a2197* boards
- Update all files with psgtr which are not upstream yet.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Sync dpdma with mainline kernel
Michal Simek [Fri, 12 Mar 2021 09:19:19 +0000 (10:19 +0100)] 
arm64: zynqmp: Sync dpdma with mainline kernel

Just exchange possition and use the same coding style.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Rename xlnx_dpdma to zynqmp_dpdma
Michal Simek [Thu, 11 Mar 2021 12:37:15 +0000 (13:37 +0100)] 
arm64: zynqmp: Rename xlnx_dpdma to zynqmp_dpdma

This label is used in upstream linux that's why align with it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: dts: zynqmp: Add missing mio-bank properties to sdhcis
Michal Simek [Thu, 21 Jan 2021 10:26:55 +0000 (11:26 +0100)] 
arm64: dts: zynqmp: Add missing mio-bank properties to sdhcis

Add missing xlnx,mio-bank property to sdhci nodes. Also add properties with
0 value to have it listed in case that files are copied to different
projects where default case doesn't need to be handled in the same way.
That's why explicitly list them too.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/dbdfcc1b25af8b28fc658a37ce18902978cb410d.1611224800.git.michal.simek@xilinx.com
4 years agoarm64: zynqmp: Add also support for xck24
Michal Simek [Fri, 6 Nov 2020 09:06:17 +0000 (10:06 +0100)] 
arm64: zynqmp: Add also support for xck24

Not to lost information about ID code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add missing silabs,skip-recall for si570 ref clk nodes
Michal Simek [Tue, 9 Mar 2021 11:43:42 +0000 (12:43 +0100)] 
arm64: zynqmp: Add missing silabs,skip-recall for si570 ref clk nodes

All si570 which are used for ps reference clock generation should contain
silabls,skip-recall property not to cause break on ps clock.
On Versal boards this will cause hang on Versal cpu when it is booted at
the same time with SC.
On zcu670 this can cause PS hang that's why add it for sure.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add support for K26 and KV260
Michal Simek [Wed, 15 Jul 2020 09:44:43 +0000 (11:44 +0200)] 
arm64: zynqmp: Add support for K26 and KV260

Add support for K26 and KV260
The support is split to 4 files for the following reason.

-k26-revA.dts - This is base DTS file which describes only SOM with
few exceptions.
a) GPIOs
b) uart at MIO34/MIO35
c) Aliases are filled even by IPs which are not enabled to have consistent
numbering scheme

-k26-revA-u-boot.dts - DTS file which targets only U-Boot project and
 which is automatically pick up by u-boot at build time. It enables SD card
 which is available on CC and it disable all HS modes capabilities to make
 sure that u-boot is capable to read data from SD without a need to setup
 tap delays for custom CCs.

-kv260-revA.dts - it is device tree overlay automatically built as dtbo
 which describes CC and all features on it.

-kv260-revA-pl.dts - ML Vision description for hardware i2c switch which is
 connected to PL. As of today it is here just for reference that there is a
 node which needs to be described and handled by SW.

Pincntrl description is not present but it could come in future especially
in connection to SD card connection.

There is also high chance that there is going to be a need to detect CC
from u-boot that's why u-boot DTS could also contain eeprom available at CC
for detection. It doesn't need to be there but it is good to list it not to
go around driver model in u-boot.

For checking DTBo fdtoverlay command can be used to make sure that base DT
and overlays are compatible to each other:
fdtoverlay -v -i arch/arm/dts/zynqmp-sm-k26-revA.dtb \
arch/arm/dts/zynqmp-sk-kv260-revA.dtbo -o /tmp/1.dtb

For building u-boots dtb file just run make.
For building Linux dtb files don't include u-boot.dtsi in build

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add labels to DPSub vid and gfx layers
Christian Kohn [Sat, 30 Jan 2021 02:37:25 +0000 (18:37 -0800)] 
arm64: zynqmp: Add labels to DPSub vid and gfx layers

For the SOM aa2 use case where the video mixer PL IP is connected to the DP
subsystem, the video layer needs to be referenced from a dt overlay. Hence,
add labels for the video and graphics layers in the dpsub node.

Signed-off-by: Christian Kohn <christian.kohn@xilinx.com>
4 years agoarm64: zynqmp: Add support for SVD devices
Michal Simek [Mon, 5 Oct 2020 07:35:40 +0000 (09:35 +0200)] 
arm64: zynqmp: Add support for SVD devices

SVD are using different name which can't be handled via zynqmp_devices
structure. That's why introduce zynqmp_detect_svd_name() which checks ID
code for these devices and show proper name for them.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Update clock controller on zcu670
Michal Simek [Wed, 3 Mar 2021 12:43:09 +0000 (13:43 +0100)] 
arm64: zynqmp: Update clock controller on zcu670

There is no Linux driver for this chip that's why comment it out for now.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: zynqmp: Add support for zcu670-revA board
Michal Simek [Mon, 18 Jan 2021 12:58:39 +0000 (13:58 +0100)] 
arm64: zynqmp: Add support for zcu670-revA board

The board is sharing a lot of components with zcu208 but it contains
differet silicon and also several components are done differently.
The board has 4GB memory connected to PS and additional 4GB connected to
PL. Compare to zcu208 sata support has been dropped and only USB3.0 is
using GTR (lane2). Others GTRs are routed to connectors.

MIO configuration is also shared with zcu111.

The board is using si5381 chip compare to si5341 which is normally used.
And as of now there is no Linux driver for this chip. PS reference clock is
generated out of si570 chip which is also new approach compare to zcu208.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: Define zynqmp_mmio_write() for versal
Michal Simek [Tue, 16 Mar 2021 12:44:58 +0000 (13:44 +0100)] 
arm64: versal: Define zynqmp_mmio_write() for versal

GQSPI driver is using it but this function is never called for Versal
because it is removed by linker. But function should be declared to avoid
this build warning:
drivers/spi/zynqmp_gqspi.c: In function 'zynqmp_qspi_set_tapdelay':
drivers/spi/zynqmp_gqspi.c:378:3: warning: implicit declaration of function
'zynqmp_mmio_write' [-Wimplicit-function-declaration]
  378 |   zynqmp_mmio_write(IOU_TAPDLY_BYPASS_OFST,

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: Remove interrupt-parent property
Michal Simek [Tue, 16 Mar 2021 12:38:59 +0000 (13:38 +0100)] 
arm64: versal: Remove interrupt-parent property

There is interrupt-parent property for the whole bus that's why it doesn't
need to be setup for every IP.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: Rename bus busses to be align with simple-bus yaml
Michal Simek [Tue, 16 Mar 2021 07:17:15 +0000 (08:17 +0100)] 
arm64: versal: Rename bus busses to be align with simple-bus yaml

The same change has been done in Linux for Zynq and ZynqMP. Also add gic to
the same bus with other nodes to avoid issues reported on ZynqMP. For more
information please take a look at links below.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/68f20a2b2bb0feee80bc3348619c2ee98aa69963.1598263539.git.michal.simek@xilinx.com
Link: https://lore.kernel.org/r/f767fe007e446a2299fda9905e75b723c650a424.1605021644.git.michal.simek@xilinx.com
4 years agoARM: zynq: Rename bus to be align with simple-bus yaml
Michal Simek [Thu, 26 Nov 2020 13:25:01 +0000 (14:25 +0100)] 
ARM: zynq: Rename bus to be align with simple-bus yaml

Rename amba to AXI. Based on Xilinx Zynq TRM (Chapter 5) chip is "AXI
point-to-point channels for communicating addresses, data, and response
transactions between master and slave clients. This ARM AMBA 3.0..."

Issues are reported as:
.. amba: $nodename:0: 'amba' does not match
'^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
>From schema:
../github.com/devicetree-org/dt-schema/dtschema/schemas/simple-bus.yaml

Similar change has been done for Xilinx ZynqMP SoC.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/8a4bc80debfbb79c296e76fc1e4c173e62657286.1606397101.git.michal.simek@xilinx.com
4 years agoarm64: dts: zynqmp-zcu100-revC: correct interrupt flags
Krzysztof Kozlowski [Thu, 17 Sep 2020 18:50:52 +0000 (20:50 +0200)] 
arm64: dts: zynqmp-zcu100-revC: correct interrupt flags

GPIO_ACTIVE_x flags are not correct in the context of interrupt flags.
These are simple defines so they could be used in DTS but they will not
have the same meaning:
1. GPIO_ACTIVE_HIGH = 0 = IRQ_TYPE_NONE
2. GPIO_ACTIVE_LOW  = 1 = IRQ_TYPE_EDGE_RISING

Correct the interrupt flags, assuming the author of the code wanted same
logical behavior behind the name "ACTIVE_xxx", this is:
  ACTIVE_LOW => IRQ_TYPE_LEVEL_LOW

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200917185052.5084-1-krzk@kernel.org
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
State: Linux upstream (fa7a98eb47f4d0aa431994dfd5cf2d621771ebe5)

4 years agonet: gem: Fix setting PCS auto-negotiation state
Robert Hancock [Thu, 11 Mar 2021 22:55:50 +0000 (16:55 -0600)] 
net: gem: Fix setting PCS auto-negotiation state

The code was trying to disable PCS auto-negotiation when a fixed-link node
is present and enable it otherwise. However, the PCS registers were being
written before the PCSSEL bit was set in the network configuration
register, and it appears that in this state, PCS register writes are
ignored. The result is that the intended change only took effect on the
second network operation that was performed, since at that time PCSSEL is
already enabled.

Fix the order of register writes so that PCS registers are only written to
after the PCS is enabled.

Fixes: 26e62cc971 ("net: gem: Disable PCS autonegotiation in case of fixed-link")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoarm64: versal: Add missing DCC uart config
T Karthik Reddy [Wed, 17 Mar 2021 08:48:16 +0000 (02:48 -0600)] 
arm64: versal: Add missing DCC uart config

CONFIG_ARM_DCC is missing in versal mini qspi & ospi defconfig
files. Add above config to both defconfig files.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
4 years agomicroblaze: Make extended addressing support default
T Karthik Reddy [Wed, 17 Mar 2021 07:01:52 +0000 (01:01 -0600)] 
microblaze: Make extended addressing support default

Axi qspi controller supports 32-bit & 24-bit addressing modes
for micron, macronix & spansion flash parts. But for winbond
flashes it only supports 24-bit addressing mode.
Enable CONFIG_SPI_FLASH_BAR to use extended addressing mode
to make 32-bit addressing mode work on all flashes.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: xilinx_spi: Add support for spi memory operations
T Karthik Reddy [Wed, 17 Mar 2021 07:01:51 +0000 (01:01 -0600)] 
spi: xilinx_spi: Add support for spi memory operations

Add support for spi memory operations for xilinx AXI qspi driver.
This provides an high-level interface to execute SPI memory
operations by the controller.

Remove existing spi transfer based implementation and use
spi memory based exec_op() implementation for qspi IO operations.

Simplified existing startup_block implementation.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: xilinx_spi: Trivial fixes in axi qspi driver
T Karthik Reddy [Wed, 17 Mar 2021 07:01:50 +0000 (01:01 -0600)] 
spi: xilinx_spi: Trivial fixes in axi qspi driver

Use __func__ instead for function name in debug.
Use Linux style u32 instead of uint32_t.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
4 years agospi: spi-uclass: Add support to manually relocate spi memory ops
T Karthik Reddy [Wed, 17 Mar 2021 07:01:49 +0000 (01:01 -0600)] 
spi: spi-uclass: Add support to manually relocate spi memory ops

Add spi memory operations to relocate manually when
CONFIG_NEEDS_MANUAL_RELOC is enabled.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
4 years agoxilinx: Sync DTs with Linux kernel
Michal Simek [Fri, 12 Mar 2021 09:21:05 +0000 (10:21 +0100)] 
xilinx: Sync DTs with Linux kernel

- Align zynqmp_dpdma node possition
- Resort nvmem_firmware
- Update nand compatible string
- Align power-domains property for sd0/1
- And small other pieces

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