zynqmp: Run board_get_usable_ram_top() only on main U-Boot
With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.
Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.
Michal Simek [Thu, 2 Dec 2021 13:39:09 +0000 (14:39 +0100)]
arm64: zynqmp: Remove all pinctrl setting
There is any unknown issue with SC that with pinctrl enabled system is not
able to boot. This issue should be investigated more to find the real
problem behind. Till that time it is better to remove pinctrl setting
completely.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Mon, 29 Nov 2021 10:29:04 +0000 (11:29 +0100)]
arm64: versal: Add support for vpk180 revA
The board is very similar to vpk120-revB based on VP1802 Versal.
Dual QSPi, SD3.0, Ethernet, USB2.0. Board should be also compatible with
generic SC design.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Mon, 29 Nov 2021 09:02:11 +0000 (10:02 +0100)]
arm64: versal: Add support for vck190 rev1.1
Difference is quite small which is just using new level shifter for SD
which requires different tap delay setting. Also to be safe remove
sdhci-caps-mask, sdhci-caps and max-frequency properties which were in the
tree for some time to have support for multiple board revisions with the
same SW.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Fri, 26 Nov 2021 09:07:55 +0000 (10:07 +0100)]
arm64: zynqmp: Add support for SC for vpk120-revB
Boards with generic SC will vary in small aspects. One thing what will
change from one board to another is i2c intrastructure which needs to be
covered by DT overlay.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
T Karthik Reddy [Tue, 7 Dec 2021 10:36:40 +0000 (03:36 -0700)]
usb: dwc3: Fix ULPI reset when resetting usb
In the current ULPI reset implementation, when a usb reset is issued
gpio_request_by_name() returns -EBUSY as the gpio is already requested
and failing to set gpio descriptor flags(active low) and failing to
bring the ULPI out of reset.
Fix this issue by freeing the gpio when a usb reset is issued and
request gpio again when usb starts.
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Michal Simek [Thu, 21 Oct 2021 14:03:47 +0000 (16:03 +0200)]
phy: zynqmp: Add serdes/psgtr driver
Add PSGTR driver for Xilinx ZynqMP.
The most of configurations are taken from Linux kernel psgtr driver.
USB3.0 and SGMII configurations are tested on SOM. In SGMII case also
IOU_SLCR reg is updated to get proper clock setup and signal detection
configuration.
Michal Simek [Thu, 18 Nov 2021 11:58:15 +0000 (12:58 +0100)]
arm64: zynqmp: Switch SOM to shared psu configuration
Previous psu init was targeting SOM + KV260 carrier card and also contain
configurations for other devices on carrier card. This config is removing
all expected configurations for CC and let U-Boot to handle all of it self.
This configuration is designed for SOM itself (and I would bet without
eMMC).
Michal Simek [Tue, 30 Nov 2021 15:09:19 +0000 (16:09 +0100)]
arm64: zynqmp: Use assigned-clock-rates for setting up clock in SOM
With limited low level configuration done via psu-init only IPs connected
on SOM are initialized and configured. All IPs connected to carrier card
are not initialized. There is a need to do proper reset, pin configuration
and also clock setting.
The patch targets the last part which is setting up proper clock for USBs
and SDs which on kr260 and kv260-revB boards.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 30 Nov 2021 14:33:30 +0000 (15:33 +0100)]
arm64: zynqmp: Remove SOM *u-boot.dtsi
Disable mmc from u-boot.dtsi file because it was there only for kv260
board. With kr260 this is not needed because we will switch to full DT per
board with SD/EMMC there too.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arm64: zynqmp: In sck-kr DTS use slg device for GEM phy reset
For GEM node switch to phy specific reset-gpios.
Include ethernet-phy-id compatible string in each phy node so that so
that phylib knows the contents of the ID registers.
Some background: In DP83867 external strap configuration is used for PHY
address and strap pin configuration is done by sw stack at a later stage.
The PHY address on power on is configured based on sampled values at
strap pins which is not PHY address mentioned in DT. It could be any PHY
address depending on strap pins default input. For PHY detect to happen
at proper PHY Address we have call PHY reset (RESET_B) after strap pins
are configured otherwise probe (of_mdiobus_phy_device_register) fails
and we see below error:
mdio_bus ff0c0000.ethernet-ffffffff: MDIO device at address 8 is missing.
Apart from reset, it also set proper phy delays.
The TI DP83867 PHY datasheet says:
T1: Post RESET stabilization time == 195us
T3: Hardware configuration pins transition to output drivers == 64us
T4: RESET pulse width == 1us
So with a little overhead set 'reset-assert-us' to 100us (T4) and
'reset-deassert-us' to 280us (T1+T3).
NOTE: The tuning of TI DP83867 phy reset delay is derived from linux
upstream commit: 5dbadc848259(arm64: dts: fsl: add support for Kontron
pitx-imx8m board).
Michal Simek [Tue, 26 Oct 2021 05:20:52 +0000 (07:20 +0200)]
arm64: zynqmp: Move usb hub from i2c to usb node
Based on upstream discussion based on link below usb hub should be placed
to usb node directly as child node. Based on this Linux driver was updated
and the same change should be also reflected in kv260 board.
Michal Simek [Tue, 30 Nov 2021 14:17:24 +0000 (15:17 +0100)]
arm64: zynqmp: Use slg device for all resets
All reset signals are active low that's why change level to proper values
and switch renaming resets over PS gpio to slg device too.
Reset over slg device has been proven by HW guys to be working properly.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 26 Oct 2021 14:16:16 +0000 (16:16 +0200)]
arm64: zynqmp: Enable DP driver for SOMs
The main reason is to send pmufw cfg overlay from U-Boot to PMUFW to enable
access to DP. Overlay is sent when cls command is called and for that IP
has to be enabled in carrier cards.
And IP needs to be also enabled in SOM dt because with DTB reselection new
DT is not parsed in pre reloc U-Boot instance. It is called from board_f
via embedded_dtb_select(). That's why bind function is not able to allocate
memory and it ends up with error:
"Video device 'display@fd4a0000' cannot allocate frame buffer memory -ensure the
device is set up before relocation"
To avoid this situation DP is placed also to SOM where bind function is
called and frame buffer memory is allocated and just reused after DTB
reselection. Result is the same. There could be a problem in Linux with
different DP configurations but that's need to be solved there because
console should be on from u-boot already.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Piyush Mehta [Fri, 8 Oct 2021 07:58:48 +0000 (13:28 +0530)]
arm64: zynqmp: Add i2c-bus property for usb5744
Added "i2c-bus" property feature in usb5744 driver for I2C slaves
devices. Based on the I2C handler driver is initialize the I2C device
and trigger GPIO reset. If the property does not present then the
usb5744 driver acts as a non-I2C platform device.
Michal Simek [Thu, 21 Oct 2021 14:54:17 +0000 (16:54 +0200)]
usb: dwc3: Add support for usb3-phy PHY configuration
When usb3-phy label is found, PHY driver is called and serdes line is
initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 26 Oct 2021 13:51:39 +0000 (15:51 +0200)]
net: zynq: Add support for mdio bus address decoding
There are flying two configurations around.
The first (already supported) has phy as subnode of gem node.
The second has mdio subnode (with mdio name) which has phy subnode.
This patch adds support for the second case where mdio subnode
is found driver will look at its parent to find out which gem is handling
MDIO bus.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 30 Nov 2021 15:32:43 +0000 (16:32 +0100)]
power: zynqmp: Add power domain driver for ZynqMP
Driver should be enabled by CONFIG_POWER_DOMAIN=y and
CONFIG_ZYNQMP_POWER_DOMAIN=y. Power domain driver doesn't have own DT node
but it uses zynqmp firmware DT node that's why there is a need to bind
driver when firmware node is found.
Driver itself is simple. It is sending pmufw config object overlay for
enabling access to device which is done in ...domain_request().
In ...domain_on() capabilities are passed and node is requested.
This should be bare minimum of required to get power domain driver working.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 16 Nov 2021 14:18:23 +0000 (15:18 +0100)]
arm64: zynqmp: Add command for disabling loading other overlays
Add command "zynqmp pmufw node close" to disable permission to load
additional pmufw config overlays. This command will make sure that any
other sw will ask for changing permission.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Thu, 4 Nov 2021 10:32:46 +0000 (11:32 +0100)]
xilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU fragments
Introduce zynqmp_pmufw_node() for loading PMU configuration fragment for
enabling IPs. Firmware driver has small overlay where NODE id is added and
config fragment is sent to PMUFW. There is a need to build PMUFW with
fragment support.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Mon, 18 Oct 2021 14:00:50 +0000 (16:00 +0200)]
arm64: zynqmp: Add u-boot,dm-pre-reloc to dpsub node
u-boot,dm-pre-reloc is necessary for DP driver to allocate enough space for
framebuffer before relocation.
Power domain driver is called when video console is used for example by
loading BMP image.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Fri, 22 Oct 2021 09:58:24 +0000 (11:58 +0200)]
arm64: zynqmp: Remove clock-names from GEM in zynqmp-clk-ccf.dtsi
Remove clock-names from GEM nodes from clk-ccf because they should be only
present in zynqmp.dtsi. And as is visible both clock-names defined didn't
really match.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Thu, 18 Nov 2021 12:00:02 +0000 (13:00 +0100)]
xilinx: firmware: Move dcache handling directly to pmufw load config
Core function should make sure that data is stored properly that's why move
cache operations directly to zynqmp_pmufw_load_config_object() to be able
to call it from other functions.
Michal Simek [Tue, 30 Nov 2021 12:35:47 +0000 (13:35 +0100)]
Merge tag 'v2022.01-rc3' into master-next-test
Prepare v2022.01-rc3
- Resolve issues in SPI framework by Ashok
- Use xilinx_spi driver
- Update GPIO_MODEPIN locations, selection
- Defconfig update
"Add CONFIG_SYS_LOAD_ADDR to mini defconfigs" by Ashok
- Fix qspi merge issues by T Karthik
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
dts: versal: Remove unused interrupt index for mmc
Remove unused interrupt index for mmc.
This change fix the below dtbs check warning
"mmc@f1050000: interrupts: [[0, 128, 4], [0, 128, 4]] is too long".
Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
The common emulation Makefile has a dependency on a non-existent
qemu_capsule.o when building with support for capsule update enabled
(CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y).
The code which was in qemu_capsule.c has been completely moved to
lib/efi_loader/efi_capsule.c by commit 7a6fb28c8e4b ("efi_loader: capsule:
add back efi_get_public_key_data()").
Remove the false dependency.
This fixes the following build error:
make[1]: *** No rule to make target 'board/emulation/common/qemu_capsule.o', needed by 'board/emulation/common/built-in.o'. Stop.
Tom Rini [Fri, 26 Nov 2021 22:10:53 +0000 (17:10 -0500)]
Merge tag 'efi-2022-01-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-01-rc3-2
Test:
* fix pylint warnings
UEFI:
* disable interrupts before removing devices in ExitBootServices()
* implement poweroff in efi_system_reset() on sandbox
* allow booting via EFI even if some block device fails
Here efi_resister_disk() failed due to an error in the BTRFS implementation.
Move the logic to clear EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
to the rest of the capsule code.
If CONFIG_EFI_IGNORE_OSINDICATIONS=y, we should still clear the flag.
If OsIndications does not exist, we should not create it as it is owned by
the operating system.
Our algorithm for creating USB device paths may lead to duplicate device
paths which result in efi_disk_register() failing. Instead we should just
skip devices that cannot be registered as EFI block devices.
Fix a memory leak in efi_disk_add_dev() caused by the duplicate device
path.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tom Rini [Fri, 19 Nov 2021 21:33:04 +0000 (16:33 -0500)]
efi: Call bootm_disable_interrupts earlier in efi_exit_boot_services
If we look at the path that bootm/booti take when preparing to boot the
OS, we see that as part of (or prior to calling do_bootm_states,
explicitly) the process, bootm_disable_interrupts() is called prior to
announce_and_cleanup() which is where udc_disconnect() /
board_quiesce_devices() / dm_remove_devices_flags() are called from. In
the EFI path, these are called afterwards. In efi_exit_boot_services()
however we have been calling bootm_disable_interrupts() after the above
functions, as part of ensuring that we disable interrupts as required
by the spec. However, bootm_disable_interrupts() is also where we go
and call usb_stop(). While this has been fine before, on the TI J721E
platform this leads us to an exception. This exception seems likely to
be the case that we're trying to stop devices that we have already
disabled clocks for. The most direct way to handle this particular
problem is to make EFI behave like the do_bootm_states() process and
ensure we call bootm_disable_interrupts() prior to ending up in
usb_stop().
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: Simon Glass <sjg@chromium.org> Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
T Karthik Reddy [Wed, 24 Nov 2021 10:18:55 +0000 (03:18 -0700)]
versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN
The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.
The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Tom Rini [Sat, 20 Nov 2021 14:36:37 +0000 (09:36 -0500)]
Merge branch 'efi-2022-01' of https://source.denx.de/u-boot/custodians/u-boot-efi
Scripts:
* Update spelling.txt
LMB:
* remove extern keyword in lmb.h
* drop unused lmb_size_bytes()
Test:
* test truncation in snprintf()
Documentation:
* add include/lmb.h to HTML documentation
UEFI:
* reduce non-debug logging output for measured boot
* fix use after free in measured boot
* startup the tpm device when installing the protocol
* implement EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES
* record capsule result only if capsule is read
Ilias Apalodimas [Thu, 18 Nov 2021 08:13:42 +0000 (10:13 +0200)]
efi_loader: startup the tpm device when installing the protocol
Due to U-Boot's lazy binding mentality the TPM is probed but not properly
initialized. The user can startup the device from the command line
e.g 'tpm2 startup TPM2_SU_CLEAR'. However we can initialize the TPM during
the TCG protocol installation, which is easier to use overall.
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Ilias Apalodimas [Thu, 18 Nov 2021 07:03:39 +0000 (09:03 +0200)]
efi_loader: fix FinalEvents table if an EFI app invoked GetEventLog
As described in the TCG spec [1] in sections 7.1.1 and 7.1.2 the FinalEvent
table should include events after GetEventLog has been called. This
currently works for us as long as the kernel is the only EFI application
calling that. Specifically we only implement what's described in 7.1.1.
So refactor the code a bit and support EFI application(s) calling
GetEventLog. Events will now be logged in both the EventLog and FinalEvent
table as long as ExitBootServices haven't been invoked.
Masami Hiramatsu [Fri, 12 Nov 2021 13:05:15 +0000 (22:05 +0900)]
efi_loader: capsule: Record capsule result only if capsule is read
Record capsule update result only if the capsule file is
successfully read, because the capsule GUID is not sure when
the file can not be read or the file is not a capsule.
Without this fix, if user puts a dummy (non-capsule) file
under (ESP)EFI/UpdateCapsule, U-Boot causes a synchronous
abort.
This also fixes use-after-free bug of the 'capsule' variable.
Masahisa Kojima [Tue, 9 Nov 2021 11:35:53 +0000 (20:35 +0900)]
efi_loader: Reduce efi_tcg2 logging statement
log_info() is used for the debug level logging statement
which should use log_debug() instead. Convert it to reduce the
log output.
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Masahisa Kojima [Fri, 12 Nov 2021 07:24:27 +0000 (16:24 +0900)]
efi: add comment for efi_system_table and efi_configuration_table
This commit adds the comment for efi_system_table and
efi_configuration_table structure.
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tom Rini [Thu, 18 Nov 2021 23:25:19 +0000 (18:25 -0500)]
Merge branch '2021-11-18-regression-fixes'
- An assortment of fixes related to GD, GD_FLG_SKIP_RELOC, and the lmb
- Environment fix on synquacer developmentbox
- Fix for get_info is not valid in partition code
Marek Vasut [Sat, 13 Nov 2021 17:34:37 +0000 (18:34 +0100)]
lmb: Reserve U-Boot separately if relocation is disabled
In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is
not relocated, however the stack and heap is at the end of DRAM
after relocation. Reserve a LMB area for the non-relocated U-Boot
code so it won't be overwritten.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
Marek Vasut [Sat, 13 Nov 2021 17:34:04 +0000 (18:34 +0100)]
board_f: Copy GD to new GD even if relocation disabled
Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Peng Fan <peng.fan@oss.nxp.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>