aboutsummaryrefslogtreecommitdiff
path: root/drivers/clk
AgeCommit message (Collapse)AuthorFilesLines
2024-08-05clk: zynqmp: Add set_rate support for display clocksVenkatesh Yadav Abbarapu1-0/+1
If "assigned-clock-rates" property is included in the device tree, display driver probe is getting failed, as dp_video_ref till dp_stc_ref clocks are missing from set rate function, adding them to fix the probe failure. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20240711082939.29260-1-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-08-02clk: imx8m: register ARM A53 core clockHou Zhiqiang3-0/+24
Register ARM A53 core clock for i.MX 8M Mini, Nano and Plus, preparing for enabling the 'cpu' command, which depends on this to print CPU core frequency. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2024-08-01clk: clk-uclass: Print clk name in clk_enable/clk_disableMichael Trimarchi1-2/+2
Print clk name in clk_enable and clk_disable. Make sense to know what clock get disabled/enabled before a system crash or system hang. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-08-01clk: Fix error message in clk_get_bulkJan Kiszka1-1/+1
Fix a logical inversion of the printed text. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2024-08-01Merge patch series "clk: mediatek: add OPs to support OF_UPSTREAM"Tom Rini2-115/+392
Christian Marangi <ansuelsmth@gmail.com> says: This series doesn't currently change anything and it does add all the additional OPs to make support of OF_UPSTREAM. While converting the mt7681/7686/7688/7623/7622 it was notice lots of discrepancy between the downstream dtsi and the upstream one and the clock ID between downstream clock ID and upstream clock ID. Upstream reference clock by names and clock are handled by the CCF (Common Clock Framework). The same can't be used here as we would quickly reach the max space allocated before relocation. The current mediatek clock driver reference all the parents and clocks with offset from the clk ID related to the different tables. Discrepancy between clock ID and the order in the clocks table cause one clock referenced for another or even crash for trying to access a clock at an offset that doesn't exist. To handle this and permit use of OF_UPSTREAM, various measure and changes are done to the mediatek clock driver to support it. This series have all the generic clock changes. Once this is merged, series for each SoC will came that will just change files in their dedicated clock driver. This is to prevent massive patch and to permit to split series, one for each SoC. As said at the start, these changes doesn't cause regression and are just expansion to the current API. Current behaviour is saved in every possible way (aside from the first 2 patch that fixes latent bugs)
2024-08-01clk: mediatek: add support for APMIXED parent in infra MUXChristian Marangi1-0/+4
Add support for APMIXED parent in infra MUX. This is the case for mt7622 that reference APMIXED parents for the MUX1_SEL clock. We assume the second level parent is always APMIXED. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for GATEs for APMIXED OPsChristian Marangi1-60/+84
Add support for GATEs for APMIXED OPs. It's possible that some APMIXED have also gates on top of PLL. This is the case for mt7622. Add support for this. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: implement MUX_FLAGS and MUX_MIXED_FLAGS macroChristian Marangi1-2/+17
Some simple MUX might require flags to specify the parent source. Implement MUX_FLAGS as a variant of the MUX macro that takes custom flags as last arg. Also implement MUX_MIXED_FLAGS for PARENT_MIXED implementation and MUX_MIXED with no additional flags. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for remapping clock IDChristian Marangi2-35/+80
Upstream kernel linux might have a different clock ID order in their <soc>-clk.h header. This is the case of some clock ID for mt7623 that upstream use the shared header clk-mt7601.h This header doesn't have a well distincted order and have factor or mux in the middle of the CLK ID list. This is problematic with the mtk clock driver that expect everything well organized in block and apply offset to reference the clk in the different array. To solve this problem, implement in the mtk_clk_tree an additional option .id_offs_map, an array where each CLK ID can be remapped to what the driver expect permitting to reorganize the clock following the expected logic of fixed, factor, mux and gates. Each clock function is updated to tranparently handle this by first converting the clk ID to the remapped one. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: provide common clk init function for infrasysChristian Marangi2-4/+20
Provide common clk init function for infrasys that defaults to topckgen driver if clock-parent is not defined. This is the case for upstream DTSI that doesn't provide this entry. This is needed for infracfg driver that will make use of the unified gates + muxes implementation. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for gate clock to reference topckgen clockChristian Marangi1-2/+15
Add support for gate clock get_rate to reference topckgen clock for infracfg-ao implementation. In infracfg-ao implementation topckgen is on second level of parent with infracfg in the middle. To correctly detect this, check the driver of the dev parent and use the second level parent if it's not mtk_clk_topckgen. Due to all the dependency, parent tree must be filled before a gate is used, hence is safe to assume it will be there. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for parent mux from different source for topckgenChristian Marangi1-14/+28
As done for infracfg, also add support for parent mux from different source for topckgen. This is needed as upstream linux doesn't use 1/1 factor and use directly the APMIXED clocks. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for parent mux from different sourceChristian Marangi2-21/+91
There is a current limitation where parents for a mux can be all declared as they are from a common source. This is not true as there are some MUX that can have parent from both infracfg or from topckgen. To handle this, implement a new flag for the mux, CLK_PARENT_MIXED, and a new entry for the mux parent_flags. To use this, CLK_PARENT_MIXED must be used and parent_flags will be used instead of the parent variable. Entry in parent_flags are just a struct of ID and flags where it will be defined where that parent comes from with the usage of CLK_PARENT_INFRASYS or CLK_PARENT_TOPCKGEN. This permits to have MUX with parents from infracfg or topckgen. Notice that with CLK_PARENT_MIXED applied the CLK_BYPASS_XTAL is ignored. With CLK_PARENT_MIXED declare CLK_PARENT_XTAL for the relevant parent instead. Also alias for the CLK_PARENT macro are provided to better clear their usage. CLK_PARENT_MIXED require these alias that describe the clk type to be defined in the clk_tree flags to prevent clk ID clash from different subsystem that may have equal clk ID. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for gate ID at offsetChristian Marangi1-3/+15
Add support to clk_gate ops to reference the clk ID at an offset by using the just introduced gates_offs value from the unified muxes + gates implementation. Gate clock that doesn't have gates_offs set won't be affected as the offset will simply be 0 and won't be offset of any value. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: add support for gates in clk_tree for infrasysChristian Marangi2-15/+72
Add support for gates in clk_tree for infrasys ops. Infracfg clks can have a sum of gates and muxes, and current solution handle this by duplicating the driver and split clks for mux and clks for gates. Upstream linux kernel handle this differently and doesn't have this distinction. To be closer to the upstream kernel clock definition, implement additional logic to have gates defined in the clk_tree and implement variant for the infrasys ops to handle gates defined in the tree. Similar to how it's done with factor and mux, we introduce gates_offs. Upstream kernel follow the similar logic with all the ID defined as FDIVS, MUXES and finally GATES. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: return XTAL rate for infrasys get_mux_rateChristian Marangi1-1/+1
We currently return 0 if XTAL rate is requested in get_mux_rate. This deviates from what is done in get_factor_rate and is totally wrong as it can cause unwanted results (division by 0 crash) For infrasys that makes use of CLK_XTAL, assume xtal_rate to be defined in clk_tree and return the rate when BYPASS_XTAL is not enabled with clk ID 0 index parents. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-01clk: mediatek: return XTAL rate directly for gates with XTAL parentChristian Marangi1-0/+7
There is currently a massive bug that makes any gate clk that have CLK_XTAL as parent to return the wrong clock. Following the code, with CLK_XTAL defined as TOPCKGEN parent, the topckgen get_rate is called. The clk ID (0) is parsed and only in some corner case (scenario where fixed clock are not defined) the correct XTAL rate will be returned as get_factor or get_mux is called (that have correct handling for CLK_XTAL). With fixed clock defined, the rate that will be returned will always be the FIRST ELEMENT of the fixed clock table instead of the hardcoded XTAL rate. To handle this, add additional logic and if the flag is set to PARENT_XTAL for the gate, return the XTAL rate directly. We assume the clk_tree to have xtal_rate defined with clk gates that have XTAL as parents. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-07-26Merge branch 'qcom-main' of ↵Tom Rini1-0/+9
https://gitlab.denx.de/u-boot/custodians/u-boot-snapdragon * Qualcomm platforms >~2016 gain support for the RPMh (Resource Power Manager) peripheral which is used to control most regulators. The RB5 is now able to power up its USB VBUS regulator via the rpmh regulator driver. Git history from the original Linux driver is preserved for ease of maintenance. * IPQ40xx SoCs gain ethernet networking support via the new ESS EDMA driver.
2024-07-26clock: qcom: ipq4019: add missing networking resetsRobert Marko1-0/+6
IPQ4019 has more networking related resets that will be required for future wired networking support, so lets add them. This syncs the driver with Linux. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-07-26clock: qcom: ipq4019: add ESS clockRobert Marko1-0/+3
ESS clock is the Ethernet Subsystem clock, so lets add it as its already configured by SBL1. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
2024-07-25Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-samsungTom Rini1-0/+10
2024-07-24clk: exynos: Add SSS clocks for Exynos850Sam Protsenko1-0/+10
Add ACLK (operating clock) and PCLK (bus clock) for Security Sub System (SSS) in Exynos850. Those clocks are needed for RNG enablement. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2024-07-22Merge tag 'u-boot-imx-master-20240722' of ↵Tom Rini4-247/+307
https://gitlab.denx.de/u-boot/custodians/u-boot-imx CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/21728 - Conversions to DM_I2C and DM_SERIAL. - Support for I2C3 and PWM1 for the imx6q clock driver. - Improvements for udoo-neo - Describe the i.MX93 CPU clocks in the devicetree to fix CPU clock printing - Fix for SPI and NANC clk-imx8mn clock driver
2024-07-22clk: imx6q: Add definition for IMX6QDL_CLK_PWM1Emil Kronborg1-0/+2
Enabling CONFIG_CMD_PWM, and consequently CONFIG_DM_PWM, causes the pwm command to fail due to a missing clock. => pwm enable 0 0 Enable clock-controller@20c4000 failed Failed to enable per_clk pwm: '0' not found Command 'pwm' failed: Error -2 Note that it is trivial to also add the clocks for PWM2, PWM3, and PWM4. However, I only tested PWM1 and thus only added the clock for that signal. Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
2024-07-22clk: imx6q: Add definition for IMX6QDL_CLK_I2C3Emil Kronborg1-0/+2
Commit 727fa4539ca2 ("clk: Add support for I2C clocks on NXP's imx6q SoC which use CCF") added I2C clocks for I2C1 and I2C2, but not I2C3. Consequently, devices using I2C3 fail after enabling CONFIG_CLK_IMX6Q and thus CONFIG_CLK. Therefore, this commit adds the last I2C clock. Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
2024-07-22clk: imx8mp: Make parent names arrays const pointersMichael Trimarchi1-121/+121
The arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-22clk: imx8mm: Make parent names arrays const pointersMichael Trimarchi1-64/+93
The arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-22clk: imx8mn: Make parent names arrays const pointersMichael Trimarchi1-61/+81
The arrays containing the mux selectors need to be of const pointer to const char. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-22clk: imx: clk-imx8mn Fix nand and spi clock parentMichael Trimarchi1-4/+11
The osc_24m is the clock-output-name and not the one that is used as internal name reference from the strcmp. The clock that use osc_24m, will not be able to reparent it as they should. We need anyway register the osc_24m clock fixed factor in the clock tree. Fixes: 710c4ffb890 ("clk: imx: clk-imx8mn add gpmi nand clocks") Fixes: 85b1c11989c ("clk: imx: Add ECSPI to iMX8MN") Cc: Marek Vasut <marex@denx.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-22drivers: clk: Remove duplicate newlinesMarek Vasut7-9/+0
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-15clk: sunxi: add EMAC and EPHY clocks and resets for the V3s SoCMichael Walle1-0/+6
Add the clock gate registers as well as the reset register bits for the EMAC and EPHY for the V3s. These are needed by the sun8i network driver. Signed-off-by: Michael Walle <mwalle@kernel.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
2024-07-08Merge patch series "mediatek: cumulative trivial fix for OF_UPSTREAM support"Tom Rini3-0/+3
Christian Marangi <ansuelsmth@gmail.com> says: This is an initial series that have all the initial trivial fixes required for usage of OF_UPSTREAM for the mediatek SoC This also contains the pcie-gen3 driver and the required tphy support driver to make it work. Subsequent series will follow with conversion of the mtk-clk to permit usage of OF_UPSTREAM and upstream clk ID. MT7981, MT7986 and MT7988 migration to upstream clock ID is complete and working on MT7623. Series CI tested with PR: https://github.com/u-boot/u-boot/pull/590
2024-07-08clk: mediatek: mt7986: support alternative compatible for fixed-pllsChristian Marangi1-0/+1
Support alternative compatible for fixed-plls clocks used upstream with the compatible mediatek,mt7986-apmixedsys. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-07-08clk: mediatek: mt7988: support alternative compatible for fixed-pllsChristian Marangi1-0/+1
Support alternative compatible for fixed-plls clocks used upstream with the compatible mediatek,mt7988-apmixedsys. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-07-08clk: mediatek: mt7981: support alternative compatible for fixed-pllsChristian Marangi1-0/+1
Support alternative compatible for fixed-plls clocks used upstream with the compatible mediatek,mt7981-apmixedsys. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-07-08Merge tag 'u-boot-imx-master-20240706' of ↵Tom Rini3-9/+39
https://gitlab.denx.de/u-boot/custodians/u-boot-imx CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/21504 - Fixes for i.MX8M and i.MX93 clk-composite. - Set CAN oscillator frequency based on model on verdin-imx8mm. - Enable CAAM for phycore-imx8mp_defconfig. - Miscellaneous improvements for Gateworks i.MX8M boards. - Fix initramfs boot on msc_sm2s_imx8mp. - Fixe EQoS on imx8mp-beacon-kit. - Fix error message in fsl_esdhc_imx.
2024-07-08Merge branch 'next-clk-sync' of ↵Tom Rini5-13/+23
https://source.denx.de/u-boot/custodians/u-boot-sh
2024-07-06clk: imx: add mux ops for i.MX8M composite clkMichael Trimarchi1-1/+36
Upstream Linux commit f90b68d6c8b0. The CORE/BUS root slice has following design, simplied graph: The difference is core not have pre_div block. A composite core/bus clk has 8 inputs for mux to select, saying clk[0-7]. It support target(smart) interface and normal interface. Target interface is exported for programmer easy to configure ccm root. Normal interface is also exported, but we not use it in our driver, because it will introduce more complexity compared with target interface. The normal interface simplified as below: SEL_A GA +--+ +-+ | +->+ +------+ CLK[0-7]--->+ | +-+ | | | | +----v---+ +----+ | +--+ |pre_diva+----> | +---------+ | +--------+ |mux +--+post_div | | +--+ |pre_divb+--->+ | +---------+ | | | +----^---+ +----+ +--->+ | +-+ | | +->+ +------+ +--+ +-+ SEL_B GB The mux in the upper pic is not the target interface MUX, target interface MUX is hiding SEL_A and SEL_B. When you choose clk[0-7], you are actually writing SEL_A or SEL_B depends on the internal counter which will also control the internal "mux". The target interface simplified as below which is used by Linux Kernel: CLK[0-7]--->MUX-->Gate-->pre_div-->post_div A requirement of the Target Interface's software is that the target clock source is active, it means when setting SEL_A, the current input clk to SEL_A must be active, same to SEL_B. We touch target interface, but hardware logic actually also need configure normal interface. There will be system hang, when doing the following steps: The initial state: SEL_A/SEL_B are both sourcing from clk0, the internal counter choose SEL_A. 1. switch mux from clk0 to clk1 The hardware logic will choose SEL_B and configure SEL_B to clk1. SEL_A no changed. 2. gate off clk0 Disable clk0, then the input to SEL_A is off. 3. switch from clk1 to clk2 The hardware logic will choose SEL_A and configure SEL_A to clk2, however the current SEL_A input clk0 is off, the system hang. The solution to fix the issue is in step 1, write twice to target interface MUX, it will make SEL_A/SEL_B both sources from clk1, then no need to care about the state of clk0. And finally system performs well. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-06clk: clk-mux: Make public the clk_fetch_parent_indexMichael Trimarchi1-3/+2
Make public the clk_fetch_parent_index and rename it. This allow us to be reused in driver specialization Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-06clk: renesas: Synchronize R-Car R8A779H0 V4M clock tables with Linux 6.9.3Marek Vasut1-6/+9
Synchronize R-Car R8A779H0 V4M clock tables with Linux 6.9.3, commit 1b4861e32e461b6fae14dc49ed0f1c7f20af5146 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-06clk: renesas: Synchronize R-Car R8A779G0 V4H clock tables with Linux 6.9.3Marek Vasut1-5/+9
Synchronize R-Car R8A779G0 V4H clock tables with Linux 6.9.3, commit 1b4861e32e461b6fae14dc49ed0f1c7f20af5146 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-06clk: renesas: Synchronize R-Car R8A779F0 S4 clock tables with Linux 6.9.3Marek Vasut1-1/+1
Synchronize R-Car R8A779F0 S4 clock tables with Linux 6.9.3, commit 1b4861e32e461b6fae14dc49ed0f1c7f20af5146 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-06clk: renesas: Synchronize R-Car R8A779A0 V3U clock tables with Linux 6.9.3Marek Vasut1-1/+1
Synchronize R-Car R8A779A0 V3U clock tables with Linux 6.9.3, commit 1b4861e32e461b6fae14dc49ed0f1c7f20af5146 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-06clk: renesas: Synchronize R-Car R8A77951 H3 clock tables with Linux 6.9.3Marek Vasut1-0/+3
Synchronize R-Car R8A77951 H3 clock tables with Linux 6.9.3, commit 1b4861e32e461b6fae14dc49ed0f1c7f20af5146 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-07-06clk: imx: Fix wrong flags assignment clk-composite-93Michael Trimarchi1-2/+0
The mux flags (u8), div flags (u8), and gate flags (u8) are not the clk flags (unsigned long). They have different meanings Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-06clk: imx: Fix wrong flags assignment clk-composite-8mMichael Trimarchi1-3/+1
The mux flags (u8), div flags (u8), and gate flags (u8) are not the clk flags (unsigned long). They have different meanings Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-07-05Merge branch 'qcom-main' of ↵Tom Rini2-0/+53
https://source.denx.de/u-boot/custodians/u-boot-snapdragon Various minor fixes and improvements: * Fix Qualcomm SPMI v5 support * Move default environment to a file * Add support for special pins (e.g ufs/mmc reset/data pins) * IPQ moves to OF_UPSTREAM and receives some cleanup and MAINTAINERS changes * Add a reset driver for devices without PSCI * msm8916 USB clock improvements for mobile devices
2024-07-05clock: qcom: ipq4019: add I2C clocksRobert Marko1-0/+21
I2C clocks are not initialized by the SBL, so lets add support for clocks required by both of the QUP I2C controllers. BLSP1 AHB clock is already initialized by SBL, but QUP I2C driver is requesting it so we have to add it to the enable list. Based off QCS404 clock driver. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2024-07-05clk/qcom: apq8016: add support for USB_HS clocksSam Day1-0/+32
The newer "register map for simple gate clocks" support added for qcom clocks is used. As a result gcc_apq8016 now has a mixture of the old and new styles. I didn't (and still don't!) feel comfortable enough in this area to update the existing code. Signed-off-by: Sam Day <me@samcday.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-06-19arm: mach-k3: j722s: introduce clock and device files for wkup splJayesh Choudhary1-0/+6
Include the clock and lpsc tree files needed for the wkup spl to initialize the proper PLLs and power domains to boot the SoC. Reviewed-by: Bryan Brattlof <bb@ti.com> Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>