summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2025-06-11Merge patch series "dm: core: use {s,u}32 instead of int for ↵Tom Rini
dev_read_{s,u}32_default" Quentin Schulz <foss+uboot@0leil.net> says: Out of all the dev_read_*_default functions, only two do not properly use the type as argument and return type: dev_read_u32_default and dev_read_s32_default. They both use int instead of u32/s32. Considering that it's generally not guaranteed that an int is 4 bytes but also for consistency sake, let's have them use the expected type. Note that I have not tested this, just stumbled upon that inconsistency by chance. Link: https://lore.kernel.org/r/20250528-dev_read_x32_default-v1-0-6ab1734dd7a2@cherry.de
2025-06-11dm: core: use s32 instead of int for dev_read_s32_defaultQuentin Schulz
dev_read_s32_default is for getting an s32 from a Device Tree property and allows to take a default value if that property is missing. Considering it calls ofnode_read_u32_default which takes a u32 and returns a u32, it should do the same instead of using an int, especially considering that int size is typically architecture-specific, as opposed to s32/u32. s32 and u32 being the same size, dev_read_s32* functions calling ofnode_read_u32_default shouldn't be an issue (at the type level at least) as the information will be stored appropriately in 4B regardless of the sign. This incidentally matches all other dev_read_*_default functions. Fixes: a1b17e4f4c82 ("dm: core: Add a function to read into a unsigned int") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-06-11dm: core: use u32 instead of int for dev_read_u32_defaultQuentin Schulz
dev_read_u32_default is for getting a u32 from a Device Tree property and allows to take a default value if that property is missing. Considering it calls ofnode_read_u32_default which takes a u32 and returns a u32, it should do the same instead of using an int, especially considering that int size is typically architecture-specific, as opposed to u32. This incidentally matches all other dev_read_*_default functions (except dev_read_s32_default which will be tackled in the next commit). Fixes: 47a0fd3bad38 ("dm: core: Implement live tree 'read' functions") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-06-11Merge tag 'u-boot-stm32-20250611' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-stm into next CI: https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/26607 - Add clock and reset drivers support for STM32MP25 - Add STM32H747-Discovery board support - Add tamp_nvram driver - Add SPL support and clock tree init to STM32MP13 RCC driver - Add STM32MP13xx ram support - Add support for STM32 Image V2.0 for STM32MP13xx - Fix SYSRAM size on STM32MP13xx - Fix DBGMCU macro on STM32MP13xx - Auto-detect ROM API table on STM32MP15xx
2025-06-11board: stm32: add stm32h747-discovery board supportDario Binacchi
The board includes an STM32H747XI SoC with the following resources: - 2 Mbytes Flash - 1 Mbyte SRAM - LCD-TFT controller - MIPI-DSI interface - FD-CAN - USB 2.0 high-speed/full-speed - Ethernet MAC - camera interface Detailed information can be found at: https://www.st.com/en/evaluation-tools/stm32h747i-disco.html Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11ram: stm32mp1: Add STM32MP13xx supportMarek Vasut
Add support for configuring DRAM controller on STM32MP13xx SoC. The DRAM controller is basically identical to the DWC controller on STM32MP15xx SoC, except the bus width is reduced from 32bit to 16bit and a few registers and bits are therefore not present. Handle the difference by factoring these parts out. Use IS_ENABLE() as much as possible to assure code which is not enabled on builds for a single SoC gets compiled out. Handle the different offset of RCC_DDRITFCR register and missing DDRC2 clock the same way. Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2025-06-11clk: stm32mp13: Add SPL support and clock tree init to STM32MP13 RCC driverMarek Vasut
Add SPL support and clock tree init to STM32MP13 RCC driver. This consists of two parts, make SCMI into an optional dependency and add clock tree initialization. The SCMI dependency is made optional first by registering the few core clock provided by SCMI clock as fixed clock, and second by letting the clock core parse out the clock configuration from SoC registers. The clock initialization code is derived from STM32MP15xx clock tree initialization code, which is almost identical, except for the use of new PLL2000 for PLL1 on STM32MP13xx . Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2025-06-11clk: stm32mp13: Fix typo in STM32MP13 RCC driverMarek Vasut
Fix basic typo, missing t in security . No functional change . Signed-off-by: Marek Vasut <marek.vasut@mailbox.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11reset: stm32mp25: add stm32mp25 reset driverGabriel Fernandez
Implement STM32MP25 reset drivers using stm32-core-reset API. This reset stm32-reset-core API and will be able to use DT binding index started from 0. This patch also moves legacy reset into stm32 directory reset. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: stm32: fix clock counterGabriel Fernandez
In RCC the ops of the CCF registered CLK device can be called directly, this patch avoid recursive call of clk_ function done by CCF clock framework which update the clock information, for example clk_enable is called 2 times, clkp->enable_count is increased 2 times. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11phy: stm32-usbphyc: manage properly the clk identifier with CCFPatrick Delaunay
Add private uclass data for "stm32-usbphyc-clk" as it is not done by the driver model. This clk struct is needed by CCF to save the unique id used to identify each clock. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: scmi: manage properly the clk identifier with CCFPatrick Delaunay
Each clock identifier needs to be unique when CCF is activated, and it is not respected today by SCMI clock driver. This patch supports a unique clk id by using the uclass API clk_get_id() / dev_clk_dm() and by activating by default CONFIG_CLK_AUTO_ID with CCF which adds an offset to the SCMI clock identifiers. After this patch, the SCMI clock driver can coexist with other clock provider without conflict, they can share internal identifier [0..N] defined in their binding and the clock ID = 0 (reserved for dummy clock) is no more used. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: fixed_rate: configure clock ID with CONFIG_CLK_AUTO_IDPatrick Delaunay
Update CLK ID to avoid 0 id, used for dummy clock with CCF and to allow selection by clk_get_by_id, used to get private data associated to the UCLASS_CLK device Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: sandbox: update driver for CONFIG_CLK_AUTO_ID supportPatrick Delaunay
Update the sandbox driver to allow support of the CONFIG_CLK_AUTO_ID by using the new API clk_get_id() to get the internal SANDBOX identifier. With CONFIG_CLK_AUTO_ID, clk->id have the also seq identifier. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: add CONFIG_CLK_AUTO_IDPatrick Delaunay
Add a new config CONFIG_CLK_AUTO_ID to support a unique clk id for all the clock providers, managed by clk uclass, when the clock reference arg[0] is the same. When the CONFIG is activated, the clock id is limited to the lower CLK_ID_SZ = 24 bits in default clock xlate function and the sequence number + 1 of the clk provider device is added for the 8 higher bits. We use sequence number + 1 to avoid the "dummy" clock id = 0, used for invalid clock when CCF is activated. When this config is activated, the new function clk_get_id() should be used to get back the internal reference to clock for the each clock provider. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: stm32mp25: implement clock check security functionGabriel Fernandez
Check clock security to avoid access at boot time. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: stm32mp25: Add clock driver supportGabriel Fernandez
Add clock driver support for STM32MP25 SoCs. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-11clk: scmi: add compatibility with clock protocol 2.0Valentin Caron
Since clock protocol 2.0, SCMI specification add an option field "clock_enable_delay" to CLOCK_ATTRIBUTES command. scmi_read_resp_from_smt() will return an error ("Buffer too small") as the message length coming from the SCMI server is not the same as expected. So implement a condition to SCMI clock protocol version to change the length of the expected message. Signed-off-by: Valentin Caron <valentin.caron@foss.st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Sean Anderson <seanga2@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2025-06-10tpm: sandbox: Support self-test continue in emulatorSimon Glass
Add support for the self-test continue command in the TPM v1.2 emulator, to match the functionality in the TPM v2 emulator. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-06-09Merge tag 'v2025.07-rc4' into nextTom Rini
Prepare v2025.07-rc4
2025-06-09Revert "caam: Fix CAAM error on startup"Fabio Estevam
This reverts commit 159b6f0e119962ce5da645f548cefe9196c8778e. Since commit 159b6f0e1199 ("caam: Fix CAAM error on startup") the following regression was reported by Tim Harvey: "I've found that this patch causes a regression on an imx8mm board (imx8mm_venice_defconfig) where the first call to caam_rng_read fails here in jr_dequeue but if you call it again it works. With some debugging added: SEC0: RNG instantiated ... Hit any key to stop autoboot: 0 u-boot=> rng list RNG #0 - caam-rng u-boot=> rng 0 10 caam_rng_read caam-rng len=16 run_descriptor_jr_idx idx=0 Error in SEC deq: -1 caam_rng_read_one run_descriptor_jr failed: -1 caam_rng_read caam-rng caam_rng_read_one failed: -5 Reading RNG failed u-boot=> rng 0 10 caam_rng_read caam-rng len=16 run_descriptor_jr_idx idx=0 00000000: ad 2e ad c0 2a 12 27 c4 65 82 66 19 be ef f6 07 ....*.'.e.f..... If I revert your patch caam_rng_read works initially and on subsequent calls." " I ran into this when I was testing lwIP HTTPS as it causes anything that uses dm_rng to fail the first time (such as HTTPS)." Revert it for now to avoid the regression. Reported-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Peng Fan <peng.fan@nxp.com>
2025-06-06power: rk8xx: fix swapped mask and value in init registers for RK806Quentin Schulz
The val (the bits to set) is the second member of the reg_data structure and mask the third one. We obviously want to clear bits 6 and 7 in order to only set bit 7 in there instead of only clearing bit 7 in order to write bits 6 and 7 (which makes no sense). Fortunately, according to the datasheet, bit 6 value doesn't matter when bit 7 is set so this is essentially just a cosmetic change, no intended change in behavior. Fixes: f172575d92cd ("power: rk8xx: add support for RK806") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-06-06regulator: rk8xx: Add CONFIG_SPL_REGULATOR_RK8XXJustin Klaassen
Allows use of the regulator functions of the RK8XX PMIC in SPL, which is necessary to support the functionality of the Rockchip IO-domain driver on relevant platforms. Signed-off-by: Justin Klaassen <justin@tidylabs.net> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-06-06rockchip: io-domain: Add CONFIG_SPL_ROCKCHIP_IODOMAINJustin Klaassen
Allows use of the Rockchip IO-domain driver in SPL to configure the GPIO to match the voltage supplied by specific regulators (e.g. "vcc_sdio"). Signed-off-by: Justin Klaassen <justin@tidylabs.net> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-06-06rockchip: io-domain: Add debug logging for regulators during probeJustin Klaassen
Log the value of the regulators during initialization of the IO-domain driver to aid in debugging GPIO voltage configuration problems. Signed-off-by: Justin Klaassen <justin@tidylabs.net> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-06-06ram: rockchip: Fix dependency of RAM_ROCKCHIP_DEBUGLukasz Czechowski
The RAM_ROCKCHIP_DEBUG can be used only if DEBUG_UART is available. The next commit introduces changes in definition of debug uart functions, so that DEBUG_UART is required to be defined in order to initialize uart and use print functions. Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-06-05Merge patch series "Add baudrate accuracy compensation for MediaTek UART driver"Tom Rini
Weijie Gao <weijie.gao@mediatek.com> says: This patch series adds baudrate accuracy compensation for MediaTek UART driver in high-speed mode 3. Link: https://lore.kernel.org/r/cover.1747991898.git.weijie.gao@mediatek.com
2025-06-05serial: mediatek: enable baudrate accuracy compensationWeijie Gao
The high-speed UART from MediaTek supports baudrate accuracy compensation when using high-speed mode 3. This is done by calculating the first digit of the fraction part of sample count value. The fraction value will be then used as the reference to insert 0 to 10 sample cycle(s) to one frame (assume that frame format is 8n1, i.e. 10 bits per frame). The fracdiv_[l/m] registers are used to determine whether a bit in one frame should be inserted with one sample cycle. With typical 40MHz source clock, the actual baudrates with/without accuracy compensation are: Ideal w/o compensation w/ compensation ======== ================ =============== 9600 9603 9600 115200 114942 115207 921600 930232 921659 3000000 3076923 3007519 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2025-06-05serial: mediatek: fix register names and offsetsWeijie Gao
Fix UART register names and offsets according to the programming guide to allow implementing some enhanced features. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2025-06-05Merge tag 'xilinx-for-v2025.07-rc4' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-microblaze AMD/Xilinx/FPGA changes for v2025.07-rc4 usb: - Fix regulator handling net: - Fix MII clock handling phy: - Fix GTR line logic for sgmii pci: - Fix pcireg_base logic fpga: - Fix change handling in intel_sdm_mb driver
2025-06-04mmc: am654_sdhci: Clear UHS_MODE_SELECT when <= MMC_HS_52Judith Mendez
This clears UHS_MODE_SELECT for timing modes <= MMC_HS_52. When initializing to HS400 mode, the host controller downgrades to non-uhs modes so clear UHS_MODE_SELECT at modes <= MMC_HS_52. This fixes eMMC writes on j7200 EVM. Fixes: 6067aa66b3bb ("mmc: am654_sdhci: Add am654_sdhci_set_control_reg") Signed-off-by: Judith Mendez <jm@ti.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2025-06-03pinctrl: gpio: sx150x: add Semtech SX150x I2C GPIO expander and pinctrl driverAnis Chali
implement a driver to use semtech pinctrl and gpio expander, this driver is adapted from a existent linux driver that is written by Gregory Bean <gbean@codeaurora.org>. Signed-off-by: Anis Chali <chalianis1@gmail.com>
2025-06-03Merge tag 'qcom-more-for-2025.07' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-snapdragon More Qualcomm fixes for 2025.07 * Adjust fdtfile logic to support more boards * Support linux,code variable in qcom-pmic button driver * Minor CLK API adjustments and apq8096/msm8916 fixes * vbus regulator register fixes * dragonboard410c KASLR support and other fixes
2025-06-02Merge patch series "Audit include list for include/[a-m]*.h"Tom Rini
Tom Rini <trini@konsulko.com> says: Hey all, Related to my other series I've posted recently on cleaning up some headers, this series here is the result of at least lightly auditing the #includes used in include/[a-m]*.h. This ignores subdirectories, as at least in part I think the top-level includes we've constructed are the most likely places to have some extra transitive include paths. I'm sure there's exceptions and I'll likely audit deeper once this first pass is done. This only gets as far as "include/m*.h" because I didn't want this to get too big. This also sets aside <miiphy.h> and <phy.h>. While miiphy.h does not directly need <phy.h> there are *so* many users and I think I had half of the tree just about not building when I first tried. It might be worth further investigation, but it might just be OK as-is. Link: https://lore.kernel.org/r/20250521230119.2084088-1-trini@konsulko.com
2025-06-02global: Cleanup usage of "ETH_ALEN"Tom Rini
The value of "ETH_ALEN" is defined to 6 in <linux/if_ether.h>. This file is included in <net.h>. In the places where we had ETH_ALEN but no direct include of <net.h>, add <linux/if_ether.h>. In the places where we had a custom name used, make use of ETH_ALEN instead. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-06-02include/mtd.h: Cleanup usageTom Rini
There are only a few things found in <mtd.h> today. Go through and audit the C files which include <mtd.h> and remove it when not required. Then, add it to the files which had either missed it or had an indirect inclusion of it. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-06-02include/mmc.h: Audit include listTom Rini
This file does not need <linux/sizes.h> nor <linux/compiler.h> so remove them. This exposes however that a number of other files had been relying on this implicit include for <linux/sizes.h> so add that where needed. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-06-02button: qcom-pmic: allow to specify code in devicetreeAlexey Minnekhanov
Most device vendors put "Volume Down" button onto PMIC RESIN. But Sony is special: see dts/upstream/src/arm64/qcom/sdm630-sony-xperia-nile.dtsi or [1]. They put "Volume Down" on PMIC GPIO 7 where others usually put "Volume Up", and KEY_VOLUMEUP is inside &pon_resin. Currently if you boot U-Boot on such Sony device, you end up with 2 "Volume Down" buttons, and no "Volume Up", which makes navigating menu problematic. Support reading devicetree "linux,code" property and override statically defined button code & label based on that. [1] https://elixir.bootlin.com/linux/v6.15-rc3/source/arch/ arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi#L263 Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org> Signed-off-by: Alexey Minnekhanov <alexeymin@minlexx.ru> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424014811.3809818-1-alexeymin@minlexx.ru Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: apq8016: Fix SDCC clock warningsStephan Gerhold
As of commit dc8754e8e408 ("clk/qcom: apq8016: improve clk_enable logging") there are now warnings in the U-Boot console on DragonBoard 410c: apq8016_clk_enable: unknown clk id 122 apq8016_clk_enable: unknown clk id 123 apq8016_clk_enable: unknown clk id 124 apq8016_clk_enable: unknown clk id 125 This is because we don't implement enable() properly for the SDCC clocks. Currently they are being enabled as part of set_rate(). Fix this by moving the enable calls out of the apq8016_clk_init_sdc() function and convert them to the equivalent GATE_CLK_POLLED() definitions. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-6-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: apq8016: Convert GATE_CLK() to GATE_CLK_POLLED()Stephan Gerhold
Convert the usages of GATE_CLK() in clock-apq8016 to GATE_CLK_POLLED() to make sure that we poll the status when enabling clocks: - PRNG_AHB_CLK is a vote clock, so we poll a different register address. - The USB clocks are simple branches, so enable/poll is the same register. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-5-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: Allow polling for clock status in qcom_gate_clk_en()Stephan Gerhold
GATE_CLK() in its current state is unsafe: A simple write to the clock enable register does not guarantee that the clock is immediately running. Without polling the clock status, we may issue writes to registers before the necessary clocks start running. This doesn't seem to cause issues in U-Boot at the moment, but for example removing the CLK_OFF polling in TF-A for the SMMU clocks on DB410c reliably triggers an exception during boot. Make it possible to poll the branch clock status register, by adding a new GATE_CLK_POLLED() macro that takes the extra register address. Existing usages work just as before, without polling the clock status. Ideally all usages should be updated to specify the correct poll address in the future. The Qualcomm naming for these clocks is "branch" and not "gate", but let's keep the existing naming for now to avoid confusion until all others drivers have been converted. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-4-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: Use setbits_le32() for qcom_gate_clk_en()Stephan Gerhold
The other clock enable functions in clock-qcom.c use setbits_le32() to read/modify/write the enable registers. Use the same for qcom_gate_clk_en() to simplify the code a bit. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-3-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: Move qcom_gate_clk_en() to C fileStephan Gerhold
This avoids having to inline it separately into every single clock driver, when U-Boot is built with support for multiple SoCs. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-2-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02clk: qcom: apq8016: Fix SDCC clock addressesStephan Gerhold
The SDCC_...(n) macros in clock-apq8016.c result in the wrong addresses: - SDCC1: SDCC_APPS_CBCR(0) = ((0 * 0x1000) + 0x41018) = 0x41018 Should be 0x42018, this is an invalid register close to the USB clocks. - SDCC2: SDCC_APPS_CBCR(1) = ((1 * 0x1000) + 0x41018) = 0x42018 Should be 0x43018, this is the SDCC1 clock. When we try to enable SDCC2, we actually end up enabling SDCC1. When we try to enable SDCC1, we just issue some broken register writes. This hasn't caused any trouble so far, because the boot firmware is keeping both SDCC clocks running. However, if these clocks are disabled when entering U-Boot, MMC initialization is failing. Fix this by using the proper offset for the macros. The SDCC_CMD_RCGR() was already correct, but change it the same way for consistency. Fixes: 085921368b7d ("arm: Add support for Qualcomm Snapdragon family") Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-1-fcc371c9e45f@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02power: qcom_vbus_regulator: add and fix support for pmic variantsRui Miguel Silva
Fix and add support for different pmic variants pm8x50b to handle the vbus regulator. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Link: https://lore.kernel.org/r/20250412174157.104419-1-rui.silva@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
2025-06-02Merge tag 'u-boot-dfu-next-20250602' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dfu into next u-boot-dfu-20250602 CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/26466 Usb gadget: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting dwc2: Fix HBstLen setting for external DMA mode dwc2: Various refactors to get the code closer to Linux dwc2: Support reset logic for v4.20a
2025-06-02i2c: designware_i2c Return -ETIMEDOUT for timeout errorsWojciech Szamocki
Change the return value for timeout errors in i2c-designware from 1 to -ETIMEDOUT. Returning errors as negative values is standard practice in the u-boot, which enhances error handling consistency across the codebase. The current behavior can lead to silent errors when functions check for negative return values to identify errors. For example, in `dm_i2c_reg_read` from i2c-uclass.c, a timeout results in an uninitialized value being returned, potentially causing unexpected behavior. Cc: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Wojciech Szamocki <wojciech.szamocki@nokia.com> Signed-off-by: Wojciech Szamocki <wojciech.szamocki@nokia.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-06-02usb: dwc2: Refactor register operations with clrsetbits macrosJunhui Liu
Refactor DWC2 USB gadget driver to replace manual read-modify-write operations with `clrsetbits_le32`, `setbits_le32`, and `clrbits_le32` macros, which simplify the code and improve readability. Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20250126-dwc2-clrsetbits-refactor-v1-1-68c27e1b6f84@pigmoral.tech Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-06-02usb: dwc2: Replace uint<x>_t types with u<x>Kongyang Liu
Updates all instances of uint8_t, uint16_t, and uint32_t to u8, u16, and u32 respectively, ensuring consistent use of kernel-preferred types and resolving checkpatch.pl warnings. Signed-off-by: Kongyang Liu <seashell11234455@gmail.com> Reviewed-by: Marek Vasut <marex@denx.de> Tested-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-8-987f4fd6f8b2@pigmoral.tech Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-06-02usb: dwc2: Unify flush and reset logic with v4.20a supportKongyang Liu
This patch merges flush and reset logic for both host and gadget code into a common set of functions, reducing duplication. It also adds support for the updated reset logic to compatible with core version since v4.20a. This patch mainly refers to the patch in the kernel. link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c Signed-off-by: Kongyang Liu <seashell11234455@gmail.com> Tested-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-7-987f4fd6f8b2@pigmoral.tech Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>