platform/kernel/u-boot.git
11 months agocommon: Kconfig: Fix CMD_BMP/BMP dependency
Samuel Dionne-Riel [Tue, 18 Jul 2023 08:57:36 +0000 (14:27 +0530)]
common: Kconfig: Fix CMD_BMP/BMP dependency

Using `default y` will not select BMP when CMD_BMP has been enabled, if
it was already configured.

By using `select`, if `CMD_BMP` is turned on, it will force the presence
of `BMP`.

Fixes: 072b0e16c4 ("common: Kconfig: Add BMP configs")
Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
11 months agodoc: board: ti: am62x_sk: Add A53 SPL DDR layout
Nikhil M Jain [Tue, 18 Jul 2023 08:57:35 +0000 (14:27 +0530)]
doc: board: ti: am62x_sk: Add A53 SPL DDR layout

To understand usage of DDR in A53 SPL stage, add a table showing region
and space used by major components of SPL.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
11 months agoconfigs: am62x_evm_a53: Add bloblist address
Nikhil M Jain [Tue, 18 Jul 2023 08:57:34 +0000 (14:27 +0530)]
configs: am62x_evm_a53: Add bloblist address

Set bloblist address to 0x80D00000.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
11 months agocommon: spl: spl: Remove video driver
Nikhil M Jain [Tue, 18 Jul 2023 08:57:33 +0000 (14:27 +0530)]
common: spl: spl: Remove video driver

Use config SPL_VIDEO_REMOVE to remove video driver at SPL stage before
jumping to next stage, in place of CONFIG_SPL_VIDEO, to allow user to
remove video if required.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agodrivers: video: Kconfig: Add config remove video
Nikhil M Jain [Tue, 18 Jul 2023 08:57:32 +0000 (14:27 +0530)]
drivers: video: Kconfig: Add config remove video

This is required since user may want to either call the remove method
of video driver and reset the display or not call the remove method
to continue displaying until next stage.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
11 months agocommon: board_f: Pass frame buffer info from SPL to u-boot
Nikhil M Jain [Tue, 18 Jul 2023 08:57:31 +0000 (14:27 +0530)]
common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoinclude: video: Reserve video using blob
Nikhil M Jain [Tue, 18 Jul 2023 08:57:30 +0000 (14:27 +0530)]
include: video: Reserve video using blob

Add method to reserve video framebuffer information using blob,
received from previous stage.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoboard: ti: am62x: evm: Update function calls for splash screen
Nikhil M Jain [Tue, 18 Jul 2023 08:57:29 +0000 (14:27 +0530)]
board: ti: am62x: evm: Update function calls for splash screen

Use spl_dcache_enable, in place of setup_dram, arch_reserve_mmu to set
up pagetable, initialise DRAM and enable Dcache to avoid multiple
function calls.

Check for CONFIG_SPL_VIDEO in place of CONFIG_SPL_VIDEO_TIDSS to prevent
any build failure in case video config is not defined and video related
functions are called.

Check for CONFIG_SPL_SPLASH_SCREEN and CONFIG_SPL_BMP before calling
splash_display to avoid compilation failure.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
11 months agoarch: arm: mach-k3: common: Return a pointer after setting page table
Nikhil M Jain [Tue, 18 Jul 2023 08:57:28 +0000 (14:27 +0530)]
arch: arm: mach-k3: common: Return a pointer after setting page table

In spl_dcache_enable after setting up page table, set gd->relocaddr
pointer to tlb_addr, to get next location to reserve memory. Align
tlb_addr with 64KB address.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
11 months agocommon: spl: spl: Update stack pointer address
Nikhil M Jain [Tue, 18 Jul 2023 08:57:27 +0000 (14:27 +0530)]
common: spl: spl: Update stack pointer address

At SPL stage when stack is relocated, the stack pointer needs to be
updated, the stack pointer may point to stack in on chip memory even
though stack is relocated.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
11 months agoarm: mach-k3: am62a7: change some prints to debug prints
Bryan Brattlof [Mon, 17 Jul 2023 23:01:33 +0000 (18:01 -0500)]
arm: mach-k3: am62a7: change some prints to debug prints

There is little need to print the devstat information or when we exit a
function during a typical boot. Remove them to reduce the noise during
typical operation

Signed-off-by: Bryan Brattlof <bb@ti.com>
11 months agoram: k3-ddrss: do not touch ctrl regs during training
Bryan Brattlof [Mon, 17 Jul 2023 22:15:26 +0000 (17:15 -0500)]
ram: k3-ddrss: do not touch ctrl regs during training

During LPDDR initialization we will loop through a series of frequency
changes in order to train at the various operating frequencies. During
this training, accessing the DRAM_CLASS bitfield could happen during a
frequency change and cause the read to hang.

Store the DRAM type into the main structure to avoid multiple readings
while the independent phy is training.

Signed-off-by: Bryan Brattlof <bb@ti.com>
11 months agoarm: omap2: Fix warning in force_emif_self_refresh
Tom Rini [Mon, 17 Jul 2023 19:26:43 +0000 (15:26 -0400)]
arm: omap2: Fix warning in force_emif_self_refresh

The function declaration for force_emif_self_refresh takes no parameters
but does not specify this, only the prototype in the headers do.  As
clang will warn about this, correct it.

Signed-off-by: Tom Rini <trini@konsulko.com>
11 months agoconfigs: k2x_evm: Always include FIT loading support
Andrew Davis [Fri, 14 Jul 2023 19:00:58 +0000 (14:00 -0500)]
configs: k2x_evm: Always include FIT loading support

Non-HS boards can use FIT images so include the env var commands
for these unconditionally.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: mach-k3: am62: Fixup CPU core, gpu and pru nodes in fdt
Emanuele Ghidoli [Fri, 14 Jul 2023 15:23:10 +0000 (17:23 +0200)]
arm: mach-k3: am62: Fixup CPU core, gpu and pru nodes in fdt

AM62x SoC is available in multiple variant:
- CPU cores (Cortex-A) AM62x1 (1 core), AM62x2 (2 cores), AM62x4 (4 cores)
- GPU AM625x with GPU, AM623x without GPU
- PRU (Programmable RT unit) can be present or not on AM62x2/AM62x4

Remove the relevant FDT nodes by reading the actual configuration
from the SoC registers, with that change is possible to have a single
dts/dtb file handling the different variant at runtime.
While removing GPU node and CPU nodes also the watchdog node
in the same Module Domain is removed.

A similar approach is implemented for example on i.MX8 and STM32MP1 SoC.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
11 months agoarm: mach-k3: am62: Add CTRLMMR_WKUP_JTAG_DEVICE_ID register definition
Emanuele Ghidoli [Fri, 14 Jul 2023 15:23:09 +0000 (17:23 +0200)]
arm: mach-k3: am62: Add CTRLMMR_WKUP_JTAG_DEVICE_ID register definition

Add register address and relevant bitmasks and shifts.
Allow reading these information:
- device identification
- number of cores (part of device identification)
- features (currently: PRU / no PRU)
- security
- functional safety
- speed grade
- temperature grade
- package

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Andrew Davis <afd@ti.com>
11 months agoarm: k3: Fix ft_system_setup so it can be enabled on any SoC
Emanuele Ghidoli [Fri, 14 Jul 2023 15:23:08 +0000 (17:23 +0200)]
arm: k3: Fix ft_system_setup so it can be enabled on any SoC

ft_system_setup cannot be enabled on SoC without msmc sram otherwise
fdt_fixup_msmc_ram function fails causing system reset.

Fix by moving fdt_fixup_msmc_ram to common_fdt.c file and creating
SoC (AM654, J721E and J721S2) specific files for fdt fixups.

This change was verified to not change anything on any existing board
(all the J721S2, AM654 and J721E boards requires it,
none of the remaining k3 boards require it).

Fixes: 30e96a240156 ("arm: mach-k3: Move MSMC fixup to SoC level")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
11 months agoarm: dts: Fix build of am62a7 dtbs
Nishanth Menon [Thu, 13 Jul 2023 19:40:51 +0000 (14:40 -0500)]
arm: dts: Fix build of am62a7 dtbs

am62a7 should be built with CONFIG_SOC_K3_AM62A7 not CONFIG_SOC_K3_AM625

Fixes: 6bdfa69155d8 ("arm: dts: introduce am62a7 u-boot dtbs")
Cc: Bryan Brattlof <bb@ti.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: Francesco Dolcini <francesco@dolcini.it>
Cc: Sjoerd Simons <sjoerd@collabora.com>
Cc: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
11 months agoarm: mach-k3: *: dev-data: Update to use ARRAY_SIZE
Nishanth Menon [Thu, 13 Jul 2023 19:36:34 +0000 (14:36 -0500)]
arm: mach-k3: *: dev-data: Update to use ARRAY_SIZE

Instead of hard-coding the count of entries manually, use ARRAY_SIZE
to keep the count updates appropriately.

Cc: Bryan Brattlof <bb@ti.com>
Suggested-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
11 months agoarm: mach-k3: am62a7_init: Open up FSS_DAT_REG3 firewall
Vignesh Raghavendra [Sun, 2 Jul 2023 09:16:54 +0000 (14:46 +0530)]
arm: mach-k3: am62a7_init: Open up FSS_DAT_REG3 firewall

On security enforced (HS-SE) devices ROM firewalls OSPI data region3 that
is present in above 64bit region. Open this up in bootloader to allow
Linux to access OSPI flashes in mmap mode.

Without this kernel will crash when accessing this region due to
firewall violations on HS-SE devices.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
11 months agocommon: splash_source: Fix type casting errors
Nikhil M Jain [Wed, 21 Jun 2023 10:59:53 +0000 (16:29 +0530)]
common: splash_source: Fix type casting errors

During compilation splash_source puts out below warning for type
conversion in splash_load_fit for bmp_load_addr and fit_header.
Change their type to uintptr_t to fix the warnings.

common/splash_source.c: In function ‘splash_load_fit’:
common/splash_source.c:366:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  366 |         img_header = (struct legacy_img_hdr *)bmp_load_addr;
      |                      ^
common/splash_source.c:376:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  376 |         res = splash_storage_read_raw(location, (u32)fit_header, fit_size);
      |                                                 ^
common/splash_source.c:401:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  401 |                 memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size);

The above warnings are generated if CONFIG_FIT is enabled.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
11 months agoboard: ti: am62x: evm: Include necessary header files
Nikhil M Jain [Wed, 21 Jun 2023 10:59:52 +0000 (16:29 +0530)]
board: ti: am62x: evm: Include necessary header files

At the time of compilation evm.c gives below warning for implicit
declaration of enable_caches, to mitigate this include cpu_func.h.

board/ti/am62x/evm.c: In function ‘spl_board_init’:
board/ti/am62x/evm.c:90:9: warning: implicit declaration of function ‘enable_caches’ [-Wimplicit-function-declaration]
90 |         enable_caches();

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
11 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Fri, 21 Jul 2023 14:01:11 +0000 (10:01 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

For once this adds USB support for two SoCs: the H616 and the F1C100s
series. The rest is support for LPDDR3 DRAM chips on H616 boards.

Gitlab CI passed, and I booted that briefly on an H616 and an F1C200s
board. I don't have an H616 board with LPDDR3 DRAM, but reportedly that
works for Mikhail, and doesn't regress on my DDR3 boards.

11 months agoMerge tag 'xilinx-for-v2023.10-rc1-v2' of https://source.denx.de/u-boot/custodians...
Tom Rini [Fri, 21 Jul 2023 13:57:59 +0000 (09:57 -0400)]
Merge tag 'xilinx-for-v2023.10-rc1-v2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2023.10-rc1 v2

axi_emac:
- Change return value if RX packet is not ready

cadence_qspi:
- Enable flash reset for Versal NET

dt:
- Various DT syncups with Linux kernel
- SOM - reserved pmufw memory location

fpga:
- Add load event

mtd:
- Add missing dependency for FLASH_CFI_MTD

spi/nand:
- Minor cleanup in Xilinx drivers

versal-net:
- Prioritize boot device in boot_targets
- Wire mini ospi/qspi/emmc configurations

watchdog:
- Use new versal-wwdt property

xilinx:
- fix sparse warnings in various places ps7_init*
- add missing headers
- consolidate code around zynqmp_mmio_read/write
- switch to amd.com email

zynqmp_clk:
- Add handling for gem rx/tsu clocks

zynq_gem:
- Configure mdio clock at run time

zynq:
- Enable fdt overlay support

zynq_sdhci:
- Call dll reset only for ZynqMP SOCs

11 months agoevent: Add fpga load event
Christian Taedcke [Thu, 20 Jul 2023 07:27:24 +0000 (09:27 +0200)]
event: Add fpga load event

This enables implementing custom logic after a bitstream was loaded
into the fpga.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/r/20230720072724.11516-1-christian.taedcke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoclk: zynqmp: Add gem rx and tsu clocks to return register
Ashok Reddy Soma [Thu, 20 Jul 2023 07:28:59 +0000 (01:28 -0600)]
clk: zynqmp: Add gem rx and tsu clocks to return register

Add gem_tsu and gem0_rx till gem3_rx to return proper register from
zynqmp_clk_get_register. Otherwise firmware won't be able to set clock
for these due to incorrect register address.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230720072859.3724-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoclk: zynqmp: Add set_rate support for gem rx and tsu clks
Ashok Reddy Soma [Wed, 19 Jul 2023 08:49:12 +0000 (02:49 -0600)]
clk: zynqmp: Add set_rate support for gem rx and tsu clks

gem0_rx till gem3_rx  and gem_tsu are missing from set rate function.
Add them, so that they can be set from pmu firmware via clock framework.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230719084912.30209-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agonet: axi_emac: Change return value to -EAGAIN if RX is not ready
Maksim Kiselev [Wed, 19 Jul 2023 06:53:37 +0000 (09:53 +0300)]
net: axi_emac: Change return value to -EAGAIN if RX is not ready

If there is no incoming package than axiemac_recv will return -1 which
in turn leads to printing `eth_rx: recv() returned error -1` error
message in eth_rx function. But missing a package is not an fatal error,
so return -EAGAIN in that case would be more suitable.

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
Link: https://lore.kernel.org/r/20230719065337.69280-1-bigunclemax@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoarm64: zynqmp: Remove clock-names from pcap node
Michal Simek [Mon, 10 Jul 2023 12:37:43 +0000 (14:37 +0200)]
arm64: zynqmp: Remove clock-names from pcap node

Clock is not used in driver and also not described in binding.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/0a0fa0ba197fa4051a2c8a24e1451cefadce7517.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Rename ams_ps/pl node names
Michal Simek [Mon, 10 Jul 2023 12:37:42 +0000 (14:37 +0200)]
arm64: zynqmp: Rename ams_ps/pl node names

Fix child node names to be aligned with dt-binding available in the Linux
kernel which requires names as ams-ps@ and ams-pl@.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/8f1451d614f654cb0d0da1e799e876c078fbf2c9.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Remove interrupt/reg-names for AMS
Michal Simek [Mon, 10 Jul 2023 12:37:41 +0000 (14:37 +0200)]
arm64: zynqmp: Remove interrupt/reg-names for AMS

These two properties are not described in DT binding and also not used by
driver that's why remove them.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/b123c7e537dcf70802e828bbcd484a761a264186.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: remove snps, enable_guctl1_resume_quirk quirk for usb
Piyush Mehta [Mon, 10 Jul 2023 12:37:40 +0000 (14:37 +0200)]
arm64: zynqmp: remove snps, enable_guctl1_resume_quirk quirk for usb

To sync with the upstream code, removed 'snps,enable_guctl1_resume_quirk'
quirk for usb. This quirk is no more available in linux after the xilinx
release 2022.2.

This functionality is taken care of by the 'snps,resume-hs-terminations'
quirk.

Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/4b7a132116bf0248cdb558e04de3b06b412c4a0f.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: add pmu interrupt-affinity
Radhey Shyam Pandey [Mon, 10 Jul 2023 12:37:39 +0000 (14:37 +0200)]
arm64: zynqmp: add pmu interrupt-affinity

Explicitly specify interrupt affinity to avoid HW perfevents
need to guess. This avoids the following error upon linux boot:
armv8-pmu pmu: hw perfevents: no interrupt-affinity property,
guessing.

Reported-by: John Toomey <john.toomey@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c2f55a10cf54c6004f5dfe2ea18bcb4cf04f5723.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Sync node name address with reg (mailbox)
Michal Simek [Mon, 10 Jul 2023 12:37:38 +0000 (14:37 +0200)]
arm64: zynqmp: Sync node name address with reg (mailbox)

Address in node name should match with the first reg property in DT.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/47bea10bbc3c88727c1fe839ff20e15a0c79c339.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Add L2 cache nodes
Radhey Shyam Pandey [Mon, 10 Jul 2023 12:37:37 +0000 (14:37 +0200)]
arm64: zynqmp: Add L2 cache nodes

Linux kernel throws "cacheinfo: Unable to detect cache hierarchy for
CPU 0" warning when booting on zu+ Soc. To fix it add the L2 cache
node and let each CPU point to it.

Reported-by: John Toomey <john.toomey@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c8dfabab12c97922aaad7fa91be0cbc7e4021528.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Fix usb reset over bootmode pins on zcu100
Michal Simek [Mon, 10 Jul 2023 12:37:36 +0000 (14:37 +0200)]
arm64: zynqmp: Fix usb reset over bootmode pins on zcu100

The commit a4180c369607 ("arm64: zynqmp: Add mode-pin GPIO controller DT
node") added usb phy reset over bootmode pins by default on usb0 only.
zcu100 is using usb0 as peripheral and usb1 as host. Unfortunately reset
line is shared for both usb ulpi phys but usb_rst_b is connected to usb5744
hub which is used only in host mode. Especially this chip requires reset to
operate properly that's why better assign gpio reset to usb1 instead of
usb0.
Without this change usb start crashed when runs.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/1ca80ec5bf7a595c03822f3e4e3683298205067a.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Cover K24 revB/1 SOM
Michal Simek [Mon, 10 Jul 2023 12:37:35 +0000 (14:37 +0200)]
arm64: zynqmp: Cover K24 revB/1 SOM

Extend compatible versions for K24 SOM.
Changes are not affecting SW behavior that's why all versions are
compatible to each other.
Describing all revisions is done by purpose because user space SW is
reading compatible string for logic around DT overlays and bitstreams.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/92eba01ac316e58bd2d3508b0e63bbfafbedbb73.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Record compatible string for kv260 rev2
Michal Simek [Mon, 10 Jul 2023 12:37:34 +0000 (14:37 +0200)]
arm64: zynqmp: Record compatible string for kv260 rev2

PCB rev2 compare to rev1 has some changes in PL side (IAS sensor AR1335
autofocus feature). PS side is completely unchanged.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/42f78dee8429eeac016d73de5c73af46fdaf4a98.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Assign TSU clock frequency for KV and KD boards
Harini Katakam [Mon, 10 Jul 2023 12:37:33 +0000 (14:37 +0200)]
arm64: zynqmp: Assign TSU clock frequency for KV and KD boards

Set TSU clock frequency as 250MHz (minimum when running at 1G) on
KV and KD carrier cards to allow PTP functionality.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/4b758d503ef545e4d25d3930b0eb0793f1c415d2.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Increase reset assert time for TI SGMII PHY
Harini Katakam [Mon, 10 Jul 2023 12:37:32 +0000 (14:37 +0200)]
arm64: zynqmp: Increase reset assert time for TI SGMII PHY

Increase reset assert time for TI SGMII PHY on KR260 CC starting
6.1 kernel. This PHY does not come out of reset with the existing
100us pulse width as per testing on multiple carrier cards. The reset
is driven via a PCA9570 I2C expander. The expander driver was updated
to an upstream version in 6.1 where gpio_chip _set was optimized.
Delays in earlier kernels may have masked this issue. This is a safe
workaround value for assert pulse width before the discussions are
resolved with TI.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/8fb9f17d43a43ef504c9f29006cd686cce8ac98b.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Fix gpio comment about No of gpios
Michal Simek [Mon, 10 Jul 2023 12:37:31 +0000 (14:37 +0200)]
arm64: zynqmp: Fix gpio comment about No of gpios

There are total 174 gpios but from 0 - 173 that's why fix comment to
reflect it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c7e94b334e7dd6297e0d3a36a6a3d04bd7e9e967.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Assign TSU clock frequency for KR260
Harini Katakam [Mon, 10 Jul 2023 12:37:30 +0000 (14:37 +0200)]
arm64: zynqmp: Assign TSU clock frequency for KR260

Set TSU clock frequency as 250MHz (minimum when running at 1G) on
KR260 CC to allow PTP functionality.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d065b5c2c6450910bf57d104d65946111493caaa.1688992653.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Update MALI 400 interrupt and clock names
Parth Gajjar [Mon, 10 Jul 2023 12:37:29 +0000 (14:37 +0200)]
arm64: zynqmp: Update MALI 400 interrupt and clock names

Motivation for the commit is to utilize the upstream community
device tree so that the either modified ARM Mali 400 driver
or upstream lima driver can be used.

Signed-off-by: Parth Gajjar <parth.gajjar@amd.com>
Signed-off-by: Vishal Sagar <vishal.sagar@amd.com>
Link: https://lore.kernel.org/r/1678181001-2327-2-git-send-email-parth.gajjar@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/89d046a9da5638e8b4918f80f3245d73ea46f99f.1688992653.git.michal.simek@amd.com
11 months agoxilinx: dts: Fix open drain warning on Zynq, ZynqMP and Versal
Manikanta Guntupalli [Mon, 10 Jul 2023 12:37:28 +0000 (14:37 +0200)]
xilinx: dts: Fix open drain warning on Zynq, ZynqMP and Versal

Fix for below open drain warning on Zynq, ZynqMP and Versal reported by
Linux.
"enforced open drain please flag it properly in DT/ACPI DSDT/board
file."

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/056b6f60f89fa2addb762669b80640cd5b31b001.1688992653.git.michal.simek@amd.com
11 months agoarm: xilinx: Setting default i2c clock frequency to 400kHz
Varalaxmi Bingi [Mon, 10 Jul 2023 12:37:27 +0000 (14:37 +0200)]
arm: xilinx: Setting default i2c clock frequency to 400kHz

Setting default i2c clock frequency for Zynq and ZynqMP to maximum rate of
400kHz. Current default value is 100kHz.

Signed-off-by: Varalaxmi Bingi <varalaxmi.bingi@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/fb46fe911a68b79c8e4d150ca90c4e94eb5fb9e1.1688992653.git.michal.simek@amd.com
11 months agomtd: Add missing MTD dependency for cfi_mtd
Michal Simek [Tue, 4 Jul 2023 12:04:04 +0000 (14:04 +0200)]
mtd: Add missing MTD dependency for cfi_mtd

cfi_mtd requires add_mtd_device() which is available only when MTD is
enabled that's why record this dependency.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/76ae01ce2b2c988758b69e0f0cdcc21bf301c01e.1688472227.git.michal.simek@amd.com
11 months agommc: zynq_sdhci: Dll reset only for ZynqMP platform
Ashok Reddy Soma [Mon, 10 Jul 2023 12:11:59 +0000 (14:11 +0200)]
mmc: zynq_sdhci: Dll reset only for ZynqMP platform

Dll reset is needed only for ZynqMP platforms, add condition in tuning
to call arasan_zynqmp_dll_reset() just for ZynqMP platforms.

On other platforms like Versal NET, If this condition is not added, we
see PLM error messages when dll reset smc is called.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d673ff3bdc5c236a7f0403c920e719684abd6059.1688991117.git.michal.simek@amd.com
11 months agoarm64: zynqmp: Switch to amd.com emails
Michal Simek [Mon, 10 Jul 2023 12:35:49 +0000 (14:35 +0200)]
arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/aba5b19b9c5a95608829e86ad5cc4671c940f1bb.1688992543.git.michal.simek@amd.com
11 months agoxilinx: zynq: Enable fdt apply utility for zynq
Raju Kumar Pothuraju [Mon, 10 Jul 2023 11:56:21 +0000 (13:56 +0200)]
xilinx: zynq: Enable fdt apply utility for zynq

Enables the FDT library (libfdt) overlay support for zynq platforms
to be able to use fdt apply command.

Signed-off-by: Raju Kumar Pothuraju <rajukumar.pothuraju@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ab26dd186fb752b3d607e6160ae5baf6661d5de7.1688990179.git.michal.simek@amd.com
11 months agoxilinx: Consolidate zynqmp_mmio_read/write in zynqmp_firmware.h
Michal Simek [Fri, 23 Jun 2023 12:51:57 +0000 (14:51 +0200)]
xilinx: Consolidate zynqmp_mmio_read/write in zynqmp_firmware.h

zynqmp_mmio_read/write() are firmware provided hooks that's why use only
zynqmp_firmware.h for function declaration.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/e7489556f9e447c737a578c169d7e1e43586a273.1687524706.git.michal.simek@amd.com
11 months agoxilinx: versal-net: Add mini eMMC 5.1 configuration
Ashok Reddy Soma [Wed, 14 Jun 2023 12:13:51 +0000 (06:13 -0600)]
xilinx: versal-net: Add mini eMMC 5.1 configuration

Add support for Versal NET mini eMMC 5.1 configuration. Add device tree
and defconfig.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614121351.21521-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoxilinx: versal-net: Add mini ospi configuration
Ashok Reddy Soma [Wed, 14 Jun 2023 12:13:50 +0000 (06:13 -0600)]
xilinx: versal-net: Add mini ospi configuration

Add support for Versal NET mini Octal SPI flash configuration. This runs
from onchip memory, so it has to be compact. Hence only Octal SPI
related settings are enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614121351.21521-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoxilinx: versal-net: Add mini qspi configuration
Ashok Reddy Soma [Wed, 14 Jun 2023 12:13:49 +0000 (06:13 -0600)]
xilinx: versal-net: Add mini qspi configuration

Add support for Versal NET mini Quad SPI flash configuration. This runs
from onchip memory, so it has to be compact. Hence only Quad SPI
related settings are enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614121351.21521-2-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agocadence_qspi: Enable flash reset for Versal NET platform
Ashok Reddy Soma [Wed, 14 Jun 2023 12:04:52 +0000 (06:04 -0600)]
cadence_qspi: Enable flash reset for Versal NET platform

Enable flash reset functionality for Versal NET platform.
In cadence_qspi.c there is weak function defined for reset, hence remove
the check for config, so that it will work for Versal and Versal NET
platforms.

Add register defines in Versal NET hardware.h for mini U-Boot flash
reset.

Add read_delay initialization for Versal NET also.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614120452.21019-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agonet: zynq_gem: Don't hardcode the MDC clock divisor
Venkatesh Yadav Abbarapu [Mon, 19 Jun 2023 03:49:22 +0000 (09:19 +0530)]
net: zynq_gem: Don't hardcode the MDC clock divisor

As per spec MDC must not exceed 2.5MHz, read the pclk clock
from the device tree and update the MDC clock divisor.
GEM devices support larger clock divisors and have a different
range of divisors.  Program the MDIO clock divisors based on
the clock rate of the pclk clock.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230619034922.24019-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoarm64: versal-net: spi: Update boot sequence dynamically
Ashok Reddy Soma [Wed, 14 Jun 2023 09:30:58 +0000 (03:30 -0600)]
arm64: versal-net: spi: Update boot sequence dynamically

Currently xspi0 is used for all spi boot modes, it means it will use "sf
probe 0 0 0" for all spi's irrespective of which node it is wired.

Get boot sequence from dev_seq() and update boot command for xspi
dynamically.

As a result bootcmd for spi is updated as below when two instances of spi
are present in DT node.
bootcmd_xspi0=devnum_xspi=0; run xspi_boot
bootcmd_xspi1=devnum_xspi=1; run xspi_boot

xspi_boot=sf probe $devnum_xspi:0 0 0 && sf read $scriptaddr
$script_offset_f $script_size_f && echo XSPI: Trying to boot script at
${scriptaddr} && source ${scriptaddr}; echo XSPI: SCRIPT FAILED:
continuing...;

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614093058.30438-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoxilinx: zynq: Add the missing function prototypes
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:59 +0000 (03:03 -0600)]
xilinx: zynq: Add the missing function prototypes

Add the missing prototypes for the functions pointed by the below
sparse warnings
warning: no previous prototype for 'set_dfu_alt_info'
[-Wmissing-prototypes]
warning: no previous prototype for 'board_debug_uart_init'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-7-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoarm: zynq: Pass the missing argument type in function definition
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:58 +0000 (03:03 -0600)]
arm: zynq: Pass the missing argument type in function definition

Pass missing argument type in the function definition to fix the
sparse warning, warning: old-style function definition
[-Wold-style-definition]

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-6-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agomtd: nand: zynq_nand: Change datatype of status and ecc_status to int
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:57 +0000 (03:03 -0600)]
mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

status and ecc_status are of unsigned type where they are compared for
negative value. This is pointed by below sparse warning. Change datatype
to int to fix this.
warning: comparison of unsigned expression in '< 0' is always false
[-Wtype-limits]

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-5-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agospi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:56 +0000 (03:03 -0600)]
spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoxilinx: zynq: Add missing prototype for zynqmp_mmio_write
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:55 +0000 (03:03 -0600)]
xilinx: zynq: Add missing prototype for zynqmp_mmio_write

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agospi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op
Algapally Santosh Sagar [Wed, 14 Jun 2023 09:03:54 +0000 (03:03 -0600)]
spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op

Add missing prototype to fix the below sparse warning
warning: no previous prototype for 'xilinx_qspi_mem_exec_op'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614090359.10809-2-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
11 months agoarm64: zynqmp: Fix the memory node for k26/k24 kria som boards
Sharath Kumar Dasari [Mon, 5 Jun 2023 11:59:51 +0000 (13:59 +0200)]
arm64: zynqmp: Fix the memory node for k26/k24 kria som boards

PMUFW requires top 1MB of the lower DDR memory reserved for its operation,
this is missing in k26/k24 sm static dts files because of which U-Boot
throws warning messages "efi_free_pool: illegal free" as EFI puts
some code to that space which shouldn't happen.

Signed-off-by: Sharath Kumar Dasari <sharath.kumar.dasari@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/57452d16df2d48593de206bebf877d2c2cfe7bf1.1685966389.git.michal.simek@amd.com
11 months agowatchdog: versal: Use new compatible xlnx,versal-wwdt
Michal Simek [Tue, 13 Jun 2023 11:22:26 +0000 (13:22 +0200)]
watchdog: versal: Use new compatible xlnx,versal-wwdt

DT binding has been approved that's why use new compatible string.
The old one is mark as deprecated and should be removed after some
releases.

Link: https://lore.kernel.org/r/20230420104231.2243079-3-srinivas.neeli@amd.com/
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6e78d0d2e21f2f9e7f8f448bb8e0d27ced4de7d3.1686655339.git.michal.simek@amd.com
11 months agoMerge tag 'dm-pull-20jul23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 21 Jul 2023 01:31:31 +0000 (21:31 -0400)]
Merge tag 'dm-pull-20jul23' of https://source.denx.de/u-boot/custodians/u-boot-dm

binman mkimage and template enhancements
misc fixes

11 months agoMerge branch '2023-07-20-assorted-CI-updates'
Tom Rini [Fri, 21 Jul 2023 01:28:59 +0000 (21:28 -0400)]
Merge branch '2023-07-20-assorted-CI-updates'

- Move to gcc-13.1 and QEMU 8.0.3 in CI.  This also lets us move to a
  kernel.org toolchain for arc as well.

11 months agosunxi: H616: add LPDDR3 DRAM support
Mikhail Kalashnikov [Wed, 7 Jun 2023 00:07:45 +0000 (01:07 +0100)]
sunxi: H616: add LPDDR3 DRAM support

The H616 SoC has support for several types of DRAM: DDR3, LPDDR3,
DDR4 and LPDDR4.
At the moment, the driver only supports DDR3 memory.
Let's extend the driver to support the LPDDR3 memory. All "magic"
values obtained from the boot0.

Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
11 months agosunxi: H616: add DRAM type selection
Mikhail Kalashnikov [Wed, 7 Jun 2023 00:07:44 +0000 (01:07 +0100)]
sunxi: H616: add DRAM type selection

Allwinner H616 SoC supports several types of DRAM memory. To further
integrate other types of memory, we need to add this delimitation.

Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
11 months agosunxi: H616: dram: split struct dram_para
Andre Przywara [Wed, 7 Jun 2023 00:07:43 +0000 (01:07 +0100)]
sunxi: H616: dram: split struct dram_para

Currently there is one DRAM parameter struct for the Allwinner H616 DRAM
"driver". It contains many fields that are compile time constants
(set by Kconfig variables), though there are also some fields that are
probed and changed over the runtime of the DRAM initialisation.

Because of this mixture, the compiler cannot properly optimise the code
for size, as it does not consider constant propagation in its full
potential.

Help the compiler out by splitting that structure into two: one that only
contains values known at compile time, and another one where the values
will actually change. The former can then be declared "const", which will
let the compiler fold its values directly into the code using it.

We also add "const" tags for some new "struct dram_config" pointers, to
further increase code optimisation.
To help the compiler optimise the code further, the definition of the
now "const struct dram_para" has to happen at a file-global level, so
move that part out of sunxi_dram_init().

That results in quite some code savings (almost 2KB), and helps to keep
the code small with the LPDDR3 support added later.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agosunxi: H616: dram: const-ify DRAM function parameters
Andre Przywara [Wed, 7 Jun 2023 00:07:42 +0000 (01:07 +0100)]
sunxi: H616: dram: const-ify DRAM function parameters

There are quite some functions in the Allwinner H616 DRAM "driver", some
of them actually change the parameters in the structure passed to them,
but many are actually not.
To increase the optimisation potential for the code, mark those functions
that just read members of the passed dram_para struct as "const".
This in itself does not decrease the code size, but lays the groundwork
for future changes doing so.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agosunxi: dram: make MBUS configuration functions static
Andre Przywara [Wed, 7 Jun 2023 00:07:41 +0000 (01:07 +0100)]
sunxi: dram: make MBUS configuration functions static

The usage of the C keyword "inline" seems to be a common
misunderstanding: it's a *hint* only, and modern compilers will inline
(or not) functions based on their own judgement and provided compiler
options.
So while marking functions as "inline" does not do much, missing the
"static" keyword will force to compiler to spell out a version of the
function for potential external callers, which actually increases the
code size (though hopefully the linker will drop the function).

Change the "inline" attribute for the mbus_configure_port() functions in
some Allwinner DRAM drivers to "static", so that the explicit version
can actually be dropped from the object file, reducing the code size.

"static inline" has a use case in header files, where it avoids a warning
if a .c file including this header does not use the particular function.
In a .c file itself "static inline" is not useful otherwise, so just use
static here as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agosunxi: H616: enable USB support for H616 boards
Andre Przywara [Sun, 11 Jun 2023 23:32:41 +0000 (00:32 +0100)]
sunxi: H616: enable USB support for H616 boards

Now that the PHY driver supports the H616 USB PHY, we can enable USB
support for the two H616 boards.
As the OrangePi Zero2 has a USB-C port hard-wired to peripheral mode,
let's enable USB gadget mode for port 0, so people can use fastboot,
ethernet or mass storage functionality.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agophy: sun4i: Add H616 USB PHY support
Andre Przywara [Sun, 11 Jun 2023 23:32:40 +0000 (00:32 +0100)]
phy: sun4i: Add H616 USB PHY support

Now that the Allwinner USB PHY driver supports the H616 quirk, let's
enable support for USB ports on that SoC.

We connect the compatible string to a new struct describing the SoCs USB
PHY properties, and unblock the PHY driver selection in Kconfig.

A later patch will enable USB support in the H616 boards' defconfigs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agophy: sun4i-usb: Add H616 USB PHY quirk support
Andre Przywara [Sun, 11 Jun 2023 23:32:39 +0000 (00:32 +0100)]
phy: sun4i-usb: Add H616 USB PHY quirk support

The H616 USB PHY is some kind of special snowflake: Only port2 works out
of the box, but all other ports need some help from this port2 to work
correctly: The CLK_BUS_PHY2 and RST_USB_PHY2 clock and reset need to be
enabled, and the SIDDQ bit in the PMU PHY control register needs to be
cleared. For this register to be accessible, CLK_BUS_ECHI2 needs to be
ungated. Don't ask ....

Follow the respective Linux patch (b45c6d80325b) and add a quirk bit,
triggering the special sequence as outlined above, for PHYs other than
PHY2: ungate this one special clock, and clear the SIDDQ bit. We also
pick the clock and reset from PHY2 and enable them as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agophy: sun4i-usb: Replace types with explicit quirk flags
Andre Przywara [Sun, 11 Jun 2023 23:32:38 +0000 (00:32 +0100)]
phy: sun4i-usb: Replace types with explicit quirk flags

So far we were assigning some crude "type" (SoC name, really) to each
Allwinner USB PHY model, then guarding certain quirks based on this.
This does not only look weird, but gets more or more cumbersome to
maintain.

Remove the bogus type names altogether, instead introduce flags for each
quirk, and explicitly check for them.
This improves readability, and simplifies future extensions.

Port of Linux patch 8dd256bae653.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agosunxi: Kconfig: rework PHY_USB_SUN4I selection
Andre Przywara [Sun, 11 Jun 2023 23:32:37 +0000 (00:32 +0100)]
sunxi: Kconfig: rework PHY_USB_SUN4I selection

At the moment we use "select" in each Allwinner SoC's Kconfig section to
include the USB PHY driver in the build. This means it cannot be disabled
via Kconfig, although USB is not really a strictly required core
functionality, and a particular board might not even include USB ports.

Rework the Kconfig part by removing the "select" lines for each SoC's
section, and instead letting it default to "y" in the PHY driver section
itself. We use "depends on !" to exclude the few SoCs we don't support
(yet). The Allwinner V3s does not enable USB (PHY) support at the moment,
even though it should work: let the PHY default to "n" to keep the
current behaviour.

Also the MUSB USB driver directly calls some functions from the PHY
driver, so let the former depend on the PHY driver.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Tested-by: Sam Edwards <CFSworks@gmail.com>
11 months agophy: sun4i-usb: add Allwinner F1C100s support
Andre Przywara [Sun, 11 Jun 2023 23:32:36 +0000 (00:32 +0100)]
phy: sun4i-usb: add Allwinner F1C100s support

The Allwinner F1C100s implements a single USB PHY, connected to its MUSB
OTG controller. The USB PHY is of the simpler, older type (like the A10),
the only real difference is that it's indeed only one PHY.

Add a struct describing those F1C100s USB PHY properties, and connect it
to the new compatible string.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agophy: sun4i-usb: Fix of_xlate() argument check
Andre Przywara [Sun, 11 Jun 2023 23:32:35 +0000 (00:32 +0100)]
phy: sun4i-usb: Fix of_xlate() argument check

In its of_xlate() function, the Allwinner USB PHY driver compares the
args_count variable against the number of implemented USB PHYs, although
this is the *number of arguments* to the DT phandle property. Per the DT
binding for this PHY device, this number is always one, so this check
will always fail if the particular SoC implements exactly one USB PHY.
So far this affected only the V3s (which has USB support disabled), but
the F1C100s also sports one PHY only.

Fix that check to compare args_count against exactly 1, and the args[0]
content (requested PHY number) against the number of implemented PHYs.

This fixes USB operation on the Allwinner V3s and allows to enable USB
on the Allwinner F1C100s SoC.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
11 months agobinman: Reduce state.SetInt and bintool cmd to debug level
Simon Glass [Tue, 18 Jul 2023 13:24:09 +0000 (07:24 -0600)]
binman: Reduce state.SetInt and bintool cmd to debug level

These are not very important message. Change them to use the 'debug' level
instead of 'detail'.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Support writing symbols inside a mkimage image
Simon Glass [Tue, 18 Jul 2023 13:24:08 +0000 (07:24 -0600)]
binman: Support writing symbols inside a mkimage image

Add support for writing symbols and determining the assumed position of
binaries inside a mkimage image. This is useful as an example for other
entry types which might want to do the same thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Support templates at any level
Simon Glass [Tue, 18 Jul 2023 13:24:07 +0000 (07:24 -0600)]
binman: Support templates at any level

Allow templates to be used inside a section, not just in the top-level
/binman node.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Add a test for templating in a FIT
Simon Glass [Tue, 18 Jul 2023 13:24:06 +0000 (07:24 -0600)]
binman: Add a test for templating in a FIT

Add this as a separate test case.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Support templating with multiple images
Simon Glass [Tue, 18 Jul 2023 13:24:05 +0000 (07:24 -0600)]
binman: Support templating with multiple images

Allow a template to appear in the top level description when using
multiple images.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Support simple templates
Simon Glass [Tue, 18 Jul 2023 13:24:04 +0000 (07:24 -0600)]
binman: Support simple templates

Collections can used to collect the contents of other entries into a
single entry, but they result in a single entry, with the original entries
'left behind' in their old place.

It is useful to be able to specific a set of entries ones and have it used
in multiple images, or parts of an image.

Implement this mechanism.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agodtoc: Allow inserting a list of nodes into another
Simon Glass [Tue, 18 Jul 2023 13:24:03 +0000 (07:24 -0600)]
dtoc: Allow inserting a list of nodes into another

Provide a way to specify a phandle list of nodes which are to be inserted
into an existing node.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agodtoc: Support copying the contents of a node into another
Simon Glass [Tue, 18 Jul 2023 13:24:02 +0000 (07:24 -0600)]
dtoc: Support copying the contents of a node into another

This permits implementation of a simple templating system, where a node
can be reused as a base for others.

For now this adds new subnodes after any existing ones.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Correct handling of zero bss size
Simon Glass [Tue, 18 Jul 2023 13:24:01 +0000 (07:24 -0600)]
binman: Correct handling of zero bss size

Fix the check for the __bss_size symbol, since it may be 0. Unfortunately
there was no test coverage for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Drop __bss_size variable in bss_data.c
Simon Glass [Tue, 18 Jul 2023 13:24:00 +0000 (07:24 -0600)]
binman: Drop __bss_size variable in bss_data.c

This is not needed since the linker script sets it up. Drop the variable
to avoid confusion.

Fix the prototype for main() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Provide a way to specify the fdt-list directly
Simon Glass [Tue, 18 Jul 2023 13:23:59 +0000 (07:23 -0600)]
binman: Provide a way to specify the fdt-list directly

Sometimes multiple boards are built with binman and it is useful to
specify a different FDT list for each. At present this is not possible
without providing multiple values of the of-list entryarg (which is not
supported in the U-Boot build system).

Allow a fit,fdt-list-val string-list property to be used instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Convert mkimage to Entry_section
Marek Vasut [Tue, 18 Jul 2023 13:23:58 +0000 (07:23 -0600)]
binman: Convert mkimage to Entry_section

This is needed to handle mkimage with inner section located itself in a
section.

Signed-off-by: Marek Vasut <marex@denx.de>
Use BuildSectionData() instead of ObtainContents(), add tests and a few
other minor fixes:
Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Add more detail on how ObtainContents() works
Simon Glass [Tue, 18 Jul 2023 13:23:57 +0000 (07:23 -0600)]
binman: Add more detail on how ObtainContents() works

This area of binman can be a bit confusing. Add some more comments to
help.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Update elf to return number of written symbols
Simon Glass [Tue, 18 Jul 2023 13:23:56 +0000 (07:23 -0600)]
binman: Update elf to return number of written symbols

Update the LookupAndWriteSymbols() function to return the number of
symbols written. Also add some logging for when debugging is not
enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agostm32mp15: Avoid writing symbols in SPL
Simon Glass [Tue, 18 Jul 2023 13:23:55 +0000 (07:23 -0600)]
stm32mp15: Avoid writing symbols in SPL

These boards use SPL in a mkimage entry and apparently access the symbol
containing the image position of U-Boot, but put U-Boot in another
image. This means that binman is unable to fill in the symbol correctly
in the SPL binary.

This doesn't matter at present since mkimage doesn't support symbol
writing. But with the upcoming conversion to a section, it will. So add
a property to disable symbol writing.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Allow disabling symbol writing
Simon Glass [Tue, 18 Jul 2023 13:23:54 +0000 (07:23 -0600)]
binman: Allow disabling symbol writing

Some boards don't use symbol writing but do access the symbols in SPL.
Provide an option to work around this.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Read _multiple_data_files in the correct place
Simon Glass [Tue, 18 Jul 2023 13:23:53 +0000 (07:23 -0600)]
binman: Read _multiple_data_files in the correct place

Move this to the ReadEntries() function where it belongs.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Use GetEntries() to obtain section contents
Simon Glass [Tue, 18 Jul 2023 13:23:52 +0000 (07:23 -0600)]
binman: Use GetEntries() to obtain section contents

Some section types don't have a simple _entries list. Use the GetEntries()
method in GetEntryContents() and other places to handle this.

This makes the behaviour more consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: Init align_default in entry_Section
Simon Glass [Tue, 18 Jul 2023 13:23:51 +0000 (07:23 -0600)]
binman: Init align_default in entry_Section

This should be set up in the init function, to avoid a warning about a
property not set up there. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agotools: Fix package discovery in pyproject.toml of u_boot_pylib.
Maxim Cournoyer [Fri, 7 Jul 2023 21:15:32 +0000 (17:15 -0400)]
tools: Fix package discovery in pyproject.toml of u_boot_pylib.

When building from source, setuptools would complain about not finding
package via its auto-discovery mechanism.  Manually specify how to
locate the files, relative to the package's directory.

* tools/u_boot_pylib/pyproject.toml: New tool.setuptools.packages.find
section.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotools: Fix README file in pyproject.toml of u_boot_pylib.
Maxim Cournoyer [Fri, 7 Jul 2023 21:15:31 +0000 (17:15 -0400)]
tools: Fix README file in pyproject.toml of u_boot_pylib.

* tools/u_boot_pylib/pyproject.toml (readme): Replace README.md with
README.rst.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobootstd: USB devtype detection for script boot
John Clark [Fri, 30 Jun 2023 17:12:14 +0000 (13:12 -0400)]
bootstd: USB devtype detection for script boot

Change the device type from "usb_mass_storage" to "usb" when
booting a script.

Before this change:
   => printenv devtype
   devtype=usb_mass_storage

After this change:
   => printenv devtype
   devtype=usb

Signed-off-by: John Clark <inindev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>