power: pmic: enable sysreset function with device tree property
Add a condition to enable the PMIC sysreset function via the
system-power-controller device tree property in addition to the existing
Kconfig dependency, provided the PMIC supports it.
Svyatoslav Ryhel [Tue, 13 Jan 2026 09:00:31 +0000 (11:00 +0200)]
board: lg: star: make panel fix optional
Currently, U-Boot fails with an FDT patching error if the LG Optimus 2X
device tree lacks a panel node. Since the panel is optional hardware,
patching should be optional as well. Fix this by allowing bootflow to
continue if the panel node is missing.
Svyatoslav Ryhel [Tue, 13 Jan 2026 09:27:14 +0000 (11:27 +0200)]
ARM: tegra: remove unsupported properties from the max8907 node
Remove interrupt and GPIO controller properties from MAX8907 node since
the PMIC does not have any GPIO cells and does not expose any interrupt
features.
power: cpcap: make regulator node names case independent
The Linux kernel CPCAP driver uses uppercase regulator node names, while
this driver uses lowercase. Since regulator names can be case-insensitive,
update the driver to support both uppercase and lowercase node names.
The bit_offset_from_cpcap_lowest_voltage value was inherited from the
downstream kernel as a quirk. With the correct voltage table, it is no
longer needed. An additional benefit is that SW1, SW2, and SW4 now share
the same voltage table.
Ion Agorria [Tue, 3 Feb 2026 11:29:59 +0000 (13:29 +0200)]
pwm: tegra: properly calculate pulse and frequency divider fields
The pulse width field requires better precision during calculation. Add a
proper frequency divider calculation based on the PWM clock instead of
hardcoding it to 1.
Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Jonas Schwöbel [Tue, 11 Mar 2025 22:01:20 +0000 (23:01 +0100)]
pwm: tegra: add probe function
When PWM config was updated the clock was restarted which caused loss of
previous configuration of other channels. Further this fixes a bug/hang
that can happen when set_enable was called before set_config.
Signed-off-by: Jonas Schwöbel <jonasschwoebel@yahoo.de> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Ion Agorria [Tue, 27 Jan 2026 09:32:20 +0000 (11:32 +0200)]
ARM: tegra: ap: add default fallback for Tegra20 SKU
Until now all Tegra chips except Tegra20 had a fallback if SKU is not
known. This caused issues previously when certain SKU wasn't known. Add a
fallback for Tegra20 aligning it with other Tegra SoC generations.
Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Tom Rini [Thu, 19 Mar 2026 00:36:50 +0000 (18:36 -0600)]
Merge patch series "bootm: Clean up arch-specific, pre-OS clean-up"
Simon Glass <sjg@chromium.org> says:
Each arch does something slightly different before booting the OS. Some
archs even do different things depending on the CPU type.
It is quite hard to know what actually happens in the final milliseconds
before the OS boot.
This series attempts to start cleaning up U-Boot in this area.
The basic intent is to create a new bootm_final() function which can be
called by all archs. It provides some flags for a couple of necessary
variations but otherwise it is generic.
All architectures are converted over to use this new function.
board_quiesce_devices() is moved into bootm_final() so that all archs
benefit from it.
This series fixes a bug in device_remove() is fixed where removing a
parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave
children activated, since they do not match the flags. This fixes is
needed to avoid bootm_final() causing test failures on sandbox.
Future work could take this a little further:
- Convert EFI loader to use the same function
- Improve comments for cleanup_before_linux() across architectures
- Support fake-run tracing on all archs
Simon Glass [Fri, 6 Mar 2026 02:36:26 +0000 (19:36 -0700)]
sandbox: Call bootm_final()
Add a call to bootm_final() before the simulated kernel jump. This
adds the "Starting kernel" message, bootstage tracking,
board_quiesce_devices() and dm_remove_devices_active() which were not
previously called on sandbox.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:25 +0000 (19:36 -0700)]
xtensa: Call bootm_final()
Add a call to bootm_final() before jumping to the kernel. This adds
the "Starting kernel" message, bootstage tracking,
board_quiesce_devices() and dm_remove_devices_active() which were not
previously called on Xtensa.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:24 +0000 (19:36 -0700)]
sh: Call bootm_final()
Add a call to bootm_final() before jumping to the kernel. This adds
the "Starting kernel" message, bootstage tracking,
board_quiesce_devices() and dm_remove_devices_active() which were not
previously called on SH.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:23 +0000 (19:36 -0700)]
nios2: Call bootm_final()
Add a call to bootm_final() before jumping to the kernel. This adds
the "Starting kernel" message, bootstage tracking,
board_quiesce_devices() and dm_remove_devices_active() which were not
previously called on Nios2.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:22 +0000 (19:36 -0700)]
m68k: Call bootm_final()
Add a call to bootm_final() before jumping to the kernel. This adds
the "Starting kernel" message, bootstage tracking,
board_quiesce_devices() and dm_remove_devices_active() which were not
previously called on m68k.
Simon Glass [Fri, 6 Mar 2026 02:36:21 +0000 (19:36 -0700)]
powerpc: Call bootm_final()
Replace the open-coded bootstage_fdt_add_report() and
bootstage_report() with a call to bootm_final(). This also adds the
"Starting kernel" message, board_quiesce_devices() and
dm_remove_devices_active() which were not previously called on
PowerPC.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:20 +0000 (19:36 -0700)]
mips: Call bootm_final()
Replace the open-coded bootstage_fdt_add_report() and
bootstage_report() with a call to bootm_final(). This also adds the
"Starting kernel" message, board_quiesce_devices() and
dm_remove_devices_active() which were not previously called on MIPS.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Simon Glass [Fri, 6 Mar 2026 02:36:19 +0000 (19:36 -0700)]
microblaze: Call bootm_final()
Replace the open-coded printf and bootstage_mark_name with a call to
bootm_final(). This also adds board_quiesce_devices() and
dm_remove_devices_active() which were not previously called on
MicroBlaze.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:18 +0000 (19:36 -0700)]
arc: Call bootm_final()
Replace the open-coded printf and bootstage_mark_name with a call to
bootm_final(). This also adds board_quiesce_devices() and
dm_remove_devices_active() which were not previously called on ARC.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:17 +0000 (19:36 -0700)]
arm: Call bootm_final()
The ARM announce_and_cleanup() duplicates the common pre-boot steps.
Replace it with a call to bootm_final().
Drop the ARM weak board_quiesce_devices() definition since it is now
called from bootm_final() and the generic weak definition in bootm.h
is used instead.
Note that the printf() ordering changes slightly: it now prints before
bootstage processing rather than after, matching x86 and RISC-V.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass [Fri, 6 Mar 2026 02:36:16 +0000 (19:36 -0700)]
bootm: Stash bootstage data in bootm_final()
ARM stashes bootstage data to a known memory location before booting,
so the kernel can pick it up. Add this to bootm_final() so all
architectures benefit from it.
The bootstage_stash_default() function is a no-op when bootstage or
stashing is disabled.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass [Fri, 6 Mar 2026 02:36:15 +0000 (19:36 -0700)]
riscv: Call bootm_final()
The RISC-V announce_and_cleanup() duplicates the common pre-boot
steps. Replace it with a call to bootm_final().
Move board_quiesce_devices() into bootm_final() so it is available to
all architectures. Drop the RISC-V weak definition and header
declaration since the generic one in bootm.h is used instead.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass [Fri, 6 Mar 2026 02:36:13 +0000 (19:36 -0700)]
bootm: Create bootm_final() for pre-boot cleanup
There are various functions which announce that booting is imminent and
do related preparation. Most of these are arch-specific.
In practice, most archs do a similar thing. It would be better to
have a common function, with perhaps some events for things that are
really arch- and board-specific.
Create a new bootm_final() function with the common pre-boot steps:
printing the "Starting kernel" message, recording bootstage data,
optionally writing bootstage to the FDT and printing a report, and
removing active devices.
Be careful to avoid using BIT() macros which are not available with host
tools.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass [Fri, 6 Mar 2026 02:36:11 +0000 (19:36 -0700)]
dm: Remove children when parent is removed by flags
When dm_remove_devices_active() removes devices using specialised flags
like DM_REMOVE_ACTIVE_ALL, a parent device may match (e.g. MMC has
DM_FLAG_OS_PREPARE) while its children do not. This deactivates the
parent but leaves children activated, an inconsistent state.
Later, when uclass_destroy() calls device_remove() with DM_REMOVE_NORMAL
on the already-deactivated parent, it returns early without touching the
children. The subsequent device_unbind() then fails because the children
are still activated.
Fix this by dropping only the DM_REMOVE_ACTIVE_ALL requirement for child
removal when the parent is being removed. This ensures children are
removed along with their parent, while still preserving other flags like
DM_REMOVE_NON_VITAL so that vital devices remain protected.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 02:36:10 +0000 (19:36 -0700)]
dm: Move flags_remove() check before child removal
Move the flags_remove() call before device_chld_remove() and save the
result in a separate variable. This is just a refactoring with no
behaviour change, preparing for the next commit which needs to know
whether the parent will be removed before deciding how to remove its
children.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Tom Rini [Wed, 18 Mar 2026 19:13:57 +0000 (13:13 -0600)]
Merge patch series "led: remove legacy API"
Quentin Schulz <quentin.schulz@cherry.de> says:
This migrates the last user of the legacy LED API, IMX233-OLinuXino and
net/bootp.c, to the modern LED framework.
I do have concern about being able to use BOOTP in SPL? In which case, I
should probably add an additional check on CONFIG_IS_ENABLED(LED) in
addition to IS_ENABLED(CONFIG_LED_BOOT)?
I haven't tested this as I do not own an IMX233-OLinuXino, so please
give this a try if you own this device.
Then, since there's no user left of this legacy API, it is entirely
removed.
Quentin Schulz [Thu, 20 Nov 2025 12:48:06 +0000 (13:48 +0100)]
led: remove legacy API
No user of the legacy LED API anymore (except Sunxi with the PinePhone
but that is now a Sunxi-specific implementation), so let's remove
anything related.
Quentin Schulz [Thu, 20 Nov 2025 12:48:05 +0000 (13:48 +0100)]
led: migrate last legacy LED user (olinuxino+net) to modern LED framework
This migrates the last user of the legacy LED API, IMX233-OLinuXino, to
the modern LED framework.
The current implementation does the following:
- lit the LED when booting,
- turn off the LED the moment a BOOTP packet is received,
The first step is easily reproduced by using the
/options/u-boot/boot-led property to point at the LED. Unfortunately,
the boot-led is only lit by U-Boot proper at the very end of the boot
process, much later than currently. We can however force the LED on
whenever the GPIO LED driver is bound by marking the LED as
default-state = "on", and this happens slightly before board_init() is
called. We then do not need /options/u-boot/boot-led property for that
anymore.
However, the second step relies on /options/u-boot/boot-led and
CONFIG_LED_BOOT being set to reproduce the same behavior and requires us
to migrate net/bootp.c to the modern LED framework at the same time to
keep bisectability.
I couldn't figure out how to map CONFIG_LED_STATUS_BIT=778 to an actual
GPIO on the SoC but according to the schematics[1] only one LED is
present. I couldn't also map the SoC pin number to an actual GPIO from
the IMX23 manual, but there's already one GPIO LED specified in the
Device Tree so my guess is all of those are one and the same.
This was only build tested as I do not own this device.
Tom Rini [Wed, 18 Mar 2026 14:39:15 +0000 (08:39 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi into next
For once, replacing the legacy LED API with a more lean alternative,
just for sunxi's SPL. IIUC, this would be one step closer to dropping
this deprecated subsystem altogether.
Also adding two DRAM cleanups for the A133 SoC. There is a third patch
which requires some changes, will care about that later.
Gitlab CI passed, and I booted that briefly on an A133 board and some
board with a GPIO controlled power LED.
Tom Rini [Wed, 18 Mar 2026 14:37:41 +0000 (08:37 -0600)]
Merge tag 'mediatek-for-next-2026-03-17' of https://source.denx.de/u-boot/custodians/u-boot-mediatek into next
- A fix for mt8188 clock oscillator rates.
- New driver for mt8189 clocks.
- The rest is a first wave of a larger effort to refactor and clean up the
mediatek clocks to replace various hacks that built up over time with
something that is easier to understand and maintain.
Wojciech Dubowik [Fri, 20 Feb 2026 09:15:16 +0000 (10:15 +0100)]
test: binman: Add test for pkcs11 signed capsule
Test pkcs11 URI support for UEFI capsule generation. Both
public certificate and private key are used over pkcs11
protocol.
Pkcs11-tool has been introduced as softhsm tool doesn't have
functionality to import certificates in commonly distributed
version (only in the latest).
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> Reviewed-by: Simon Glass <simon.glass@canonical.com>
Wojciech Dubowik [Fri, 20 Feb 2026 09:15:15 +0000 (10:15 +0100)]
binman: DTS: Add dump-signature option for capsules
Mkeficapsule can dump signature for signed capsules. It can
be used in test to validate signature i.e. with openssl.
Add an entry for device tree node.
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> Reviewed-by: Simon Glass <simon.glass@canonical.com>
Wojciech Dubowik [Fri, 20 Feb 2026 09:15:11 +0000 (10:15 +0100)]
tools: mkeficapsule: Add support for pkcs11
With pkcs11 support it's now possible to specify keys
with URI format. To use this feature the filename must
begin "pkcs11:.." and have valid URI pointing to certificate
and private key in HSM.
The environment variable PKCS11_MODULE_PATH must point to the
right pkcs11 provider i.e. with softhsm:
export PKCS11_MODULE_PATH=<path>/libsofthsm2.so
Simon Glass [Fri, 6 Mar 2026 18:12:47 +0000 (11:12 -0700)]
binman: test: Move shared key files to test/security/
Move key.key and key.pem into the security/ subdirectory. These are
used by security, vendor, and capsule tests but security is the most
natural home for key material. Update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:46 +0000 (11:12 -0700)]
binman: test: Move FIT signing test data to test/fit/
Move the signing-related test data (keys, certificates, OpenSSL and
SoftHSM2 configuration, dummy engine source) into the fit/ subdirectory
alongside the FIT DTS test files. Drop the 340_ prefix from files that
had it. Update the Makefile and all ftest.py references.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:44 +0000 (11:12 -0700)]
binman: test: Move remaining test files to test/entry/
Move the remaining 60 or so test files into an entry/ subdirectory.
These cover general entry types and features: entry args, fill, text,
env, compress, replace, template, collection, ELF, overlap, listing,
sections, symlink, TEE OS, and other miscellaneous entries. Drop the
numeric prefixes and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:43 +0000 (11:12 -0700)]
binman: test: Move symbol test files to test/symbols/
Move about 10 test files for binman symbol patching into a symbols/
subdirectory. Drop the numeric prefixes and the redundant symbols_
filename prefix, and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:42 +0000 (11:12 -0700)]
binman: test: Move vendor-specific test files to test/vendor/
Move about 20 test files for vendor-specific platform support (TI, NXP
i.MX, Renesas R-Car, Rockchip, PowerPC MPC85xx) into a vendor/
subdirectory. Drop the numeric prefixes and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:41 +0000 (11:12 -0700)]
binman: test: Move UEFI capsule test files to test/capsule/
Move about a dozen test files for UEFI capsule creation (signed,
versioned, accept, revert) into a capsule/ subdirectory. Drop the
numeric prefixes and the redundant capsule_ filename prefix, and
update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:40 +0000 (11:12 -0700)]
binman: test: Move FIP/TF-A test files to test/fip/
Move about 15 test files for ARM Trusted Firmware FIP, ATF BL31, SCP,
OpenSBI, and BL1 entries into a fip/ subdirectory. Drop the numeric
prefixes and the redundant fip_ filename prefix, and update all
references.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:39 +0000 (11:12 -0700)]
binman: test: Move mkimage test files to test/mkimage/
Move about a dozen test files for mkimage entries into a mkimage/
subdirectory. Drop the numeric prefixes and the redundant mkimage_
filename prefix, and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:37 +0000 (11:12 -0700)]
binman: test: Move CBFS test files to test/cbfs/
Move about a dozen test files for Coreboot File System entries into a
cbfs/ subdirectory. Drop the numeric prefixes and the redundant cbfs_
filename prefix, and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:36 +0000 (11:12 -0700)]
binman: test: Move security test files to test/security/
Move about 20 test files for signing, encryption, hash, pre-load,
x509, and Xilinx bootgen entries into a security/ subdirectory. Drop
the numeric prefixes and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:35 +0000 (11:12 -0700)]
binman: test: Move blob test files to test/blob/
Move about a dozen test files for blob, blob-ext, blob-ext-list,
fake-blob, and blob-symbol entries into a blob/ subdirectory. Drop
the numeric prefixes and the redundant blob_ filename prefix, and
update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:34 +0000 (11:12 -0700)]
binman: test: Move FDT/fdtmap test files to test/fdt/
Move about 30 test files for FDT update, fdtmap, DTB compression,
alternates, and bootph into an fdt/ subdirectory. Drop the numeric
prefixes and the redundant fdt_ filename prefix, and update all
references.
Remove the unused no_alt_format.dts which has no references in any
test.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:33 +0000 (11:12 -0700)]
binman: test: Move FIT image test files to test/fit/
Move about 40 test files for FIT images (signing, external data,
split-elf, encryption, alignment, firmware loadables, templates) into
a fit/ subdirectory. Drop the numeric prefixes and the redundant fit_
filename prefix, and update all references.
Rename the three signature.dts variants to have unique names:
signature.dts, signature_multi_key.dts and signature_no_nodes.dts.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Simon Glass [Fri, 6 Mar 2026 18:12:32 +0000 (11:12 -0700)]
binman: test: Move x86 and Intel test files to test/x86/
Move about 40 test files for x86 and Intel platform support (ROM,
microcode, ME, IFWI, FSP, descriptor, reset16, start16, FIT) into an
x86/ subdirectory. Drop the numeric prefixes and the redundant x86_
filename prefix, and update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:31 +0000 (11:12 -0700)]
binman: test: Move U-Boot variant test files to test/xpl/
Move about a dozen test files for U-Boot image variants (SPL, TPL,
VPL, DTB, nodtb, bss-pad) into an xpl/ subdirectory. Drop the
numeric prefixes and the redundant u_boot_ filename prefix, and
update all references.
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Simon Glass [Fri, 6 Mar 2026 18:12:30 +0000 (11:12 -0700)]
binman: test: Move pack/layout test files to test/pack/
Move about 50 test files related to basic layout, packing, alignment,
sections, and image structure into a pack/ subdirectory. Drop the
numeric prefixes from the filenames and update all references in
ftest.py, entry_test.py, and binman_tests.rst
Signed-off-by: Simon Glass <simon.glass@canonical.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
David Lechner [Fri, 6 Mar 2026 22:05:55 +0000 (16:05 -0600)]
clk: mediatek: set CLK_PARENT_XTAL on fixed factor clocks
Explicitly set the CLK_PARENT_XTAL flag for fixed factor clocks.
Prior to this, it was assumed that clock ID 0 was CLK_XTAL and other
IDs used a different clock tree when no parent was explicitly set.
Making the parent explicit will allow us to remove this confusing
behavior in the future.
David Lechner [Fri, 6 Mar 2026 22:05:50 +0000 (16:05 -0600)]
clk: mediatek: add MUX_GATE_MIXED macros
Add new MUX_GATE_MIXED and MUX_GATE_MIXED_FLAGS macros for mixed parent
muxes that have a gate. These will be used in a few drivers where we
already have this type of mux clocks.
David Lechner [Fri, 6 Mar 2026 22:05:48 +0000 (16:05 -0600)]
clk: mediatek: rename HAVE_RST_BAR
Rename HAVE_RST_BAR to CLK_PLL_HAVE_RST_BAR. This makes it more clear
that this flag only applies to PLL clocks. Also add a blank line between
CLK_PLL_HAVE_RST_BAR and the CLK_MUX_ macros to keep the grouping of the
flags consistent.
sunxi: a133: dram: Align parameters terminology with Allwinner
There is a mistmatch between Allwinner's dram_para BSP definitions and the
parameters names in mainline u-boot for TPR1-3. What we call TPR1 is actually
MR22 while TPR2 is TPR0 and TPR3 is TPR1. MR22 does get written to the
corresponding register. This only concerns LPDDR4 support.
Introduce a new Kconfig entry for MR22 and proceed with the rename.
Update the only config currently using it.
See the list of parameters from the Allwinner BSP at the end of:
https://linux-sunxi.org/A133/DRAMC
Note that the H616/H6 code is coherent with this new TPR0 definition
(and does not use TPR1 and MR22).
Some of the offsets for the DRAM PHY dx delays are wrong (as compared
to the H616 code and the reference binary) since the
mctl_phy_dx_delay0_inner function does not perform the correct
calculation for some of them.
Introduce a mctl_phy_dx_delay0_inner0 to fix the incorrect offsets and
rename the existing function to mctl_phy_dx_delay0_inner1 for the
offsets it correctly handles.
Also add memory barriers that are also present in the H616 code while
at it.
This fixes detection of 4 GiB DRAM on some boards using LPDDR4.
Chris Chen [Tue, 3 Mar 2026 19:54:55 +0000 (13:54 -0600)]
clk: mediatek: add clock driver for MT8189
Add new clock driver for MedaiTek MT8189 and compatible SoCs.
Signed-off-by: Chris Chen <chris-qj.chen@mediatek.com> Co-developed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com> Link: https://patch.msgid.link/20260303-mtk-mt8189-clocks-v4-7-ee85f8dd2f0d@baylibre.com Signed-off-by: David Lechner <dlechner@baylibre.com>
Add a new MUX_MIXED_CLR_SET_UPD_FLAGS() macro. This is the same as
MUX_CLR_SET_UPD_FLAGS() except that it uses the parent_flags member
of the union instead of parent.
This will be needed by the incoming mt8189 clock driver.
David Lechner [Tue, 3 Mar 2026 19:54:52 +0000 (13:54 -0600)]
clk: mediatek: add CLK_PARENT_EXT
Add support for external clock parent type in MediaTek clock driver to
allow multiple external clock sources.
This is intended to eventually replace CLK_PARENT_XTAL which only allows
a single external clock source. Replacing CLK_PARENT_XTAL is not trivial
since it would required touching all chip-specific drivers. So that is
saved for another day.
Before this change, the only way to add additional external clocks was
to use a clock ID mapping and add the external clock in the fixed clocks
portion of the CLK_PARENT_TOPCKGEN clocks. After this change, such hacks
are no longer necessary and external clocks can be added in a cleaner
way.
Add helper functions to check if a clock ID corresponds to a particular
clock type (mux, gate, fdiv). This simplifies the code and makes it more
readable.
Additionally, it removes the restriction that fdivs_offs < muxes_offs <
gates_offs by making the checking more strict in some places. This will
allow future drivers to not have to define a mapping to meet this
requirement.
Refactor duplicate parent rate lookup code into a common function.
Instead of relying on rules like X is always the parent of Y, we use
the driver ops pointer to make sure we are actually getting the correct
parent clock device. This allows the same function to be called from
different clock types and will allow future chip-specific clock drivers
to not have to follow the rules as strictly.
David Lechner [Tue, 3 Mar 2026 19:54:49 +0000 (13:54 -0600)]
clk: mediatek: use correct struct type for infrasys clocks
Fix the private data type struct type in a couple of infrasys clock
functions.
struct mtk_cg_priv is a superset of struct mtk_clk_priv and has the same
layout at the beginning so there was no compile errors or runtime bugs.
This could only be found by inspecting the code.
Change CLK_TOP_CLK13M rate from 130_000_000 to 13_000_000 and
CLK_TOP_CLK26M rate from 260_000_000 to 26_000_000. As the names
suggest, these clocks are 13/26 MHz, not 130/260 MHz.
Daniel Golle [Wed, 4 Mar 2026 03:53:38 +0000 (03:53 +0000)]
clk: mediatek: mt7622: fix infracfg and pericfg clock operations
The MT7622 infracfg and pericfg drivers both use
mtk_common_clk_infrasys_init() for probe, which populates struct
mtk_clk_priv and stores gate definitions in the clk_tree. However,
both drivers were incorrectly wired to mtk_clk_gate_ops which expects
struct mtk_cg_priv with separately populated gates/num_gates/gates_offs
fields from mtk_common_clk_gate_init().
Since those fields were never set, any attempt to enable an infracfg or
pericfg gate clock (e.g. CLK_INFRA_TRNG) would fail with -EINVAL.
Switch both to mtk_clk_infrasys_ops and struct mtk_clk_priv to match
the init function.
Fixes: 72ab603b201 ("clk: mediatek: add driver for MT7622") Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: David Lechner <dlechner@baylibre.com>