summaryrefslogtreecommitdiff
path: root/include/linux/clk-provider.h
AgeCommit message (Collapse)Author
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 <[email protected]> Signed-off-by: Patrice Chotard <[email protected]> Cc: Lukasz Majewski <[email protected]> Cc: Sean Anderson <[email protected]> Reviewed-by: Patrick Delaunay <[email protected]> Reviewed-by: Patrice Chotard <[email protected]>
2025-04-28clk: imx: Pass CCM udevice into clk_register_composite()Marek Vasut
Pass the clock controller udevice into clk_register_composite(), so it can be passed further to any registered composite clocks and used for look up of parent clock referenced in DT "clocks" and "clock-names" properties by phandle and name pair. Use the clock controller udevice in imx8m_clk_mux_set_parent() to perform accurate look up of parent clock referenced in the CCM driver by name. If the clock name that is being looked up matches one of the names listed in the clock controller DT node "clock-names" array property, then the offset of the name is looked up in the "clocks" DT property and the phandle at that offset is resolved to the parent clock udevice. The test to determine whether a particular driver instance registered with clock uclass matches the parent clock is done by comparing the OF nodes of the clock registered with clock uclass and parent clock resolved from the phandle. Example: drivers/clk/imx/clk-imx8mm.c: static const char * const imx8mm_a53_sels[] = {"osc_24m", "arm_pll_out", ... _____________| arch/arm/dts/imx8mm.dtsi: | clk: clock-controller@30380000 { v clock-names = "osc_32k", "osc_24m", ... | v clocks = <&osc_32k>, <&osc_24m>, ... }; _______________________| ... | / { v osc_24m: clock-osc-24m { compatible = "fixed-clock"; ... }; Signed-off-by: Marek Vasut <[email protected]> Reported-by: Francesco Dolcini <[email protected]> Tested-by: Fabio Estevam <[email protected]> Tested-by: Adam Ford <[email protected]> # imx8mp-beacon
2025-03-24clk: clk-fixed-factor: Use struct udevice instead of struct deviceMarek Vasut
Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-fixed-factor registration. Signed-off-by: Marek Vasut <[email protected]>
2025-03-24clk: clk-divider: Use struct udevice instead of struct deviceMarek Vasut
Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-divider clock registration. Signed-off-by: Marek Vasut <[email protected]>
2025-03-24clk: clk-composite: Use struct udevice instead of struct deviceMarek Vasut
Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-composite registration. Signed-off-by: Marek Vasut <[email protected]>
2025-03-24clk: clk-gate: Use struct udevice instead of struct deviceMarek Vasut
Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-gate registration. Signed-off-by: Marek Vasut <[email protected]>
2025-03-24clk: clk-mux: Use struct udevice instead of struct deviceMarek Vasut
Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-mux registration. Signed-off-by: Marek Vasut <[email protected]>
2024-07-06clk: clk-mux: Make public the clk_fetch_parent_indexMichael Trimarchi
Make public the clk_fetch_parent_index and rename it. This allow us to be reused in driver specialization Signed-off-by: Michael Trimarchi <[email protected]>
2023-02-10Correct SPL uses of SANDBOX_CLK_CCFSimon Glass
This converts 12 usages of this option to the non-SPL form, since there is no SPL_SANDBOX_CLK_CCF defined in Kconfig Signed-off-by: Simon Glass <[email protected]>
2022-03-30clk: ccf: Add some helper functions for clock opsSean Anderson
Most CCF drivers follow a common pattern where their clock ops defer the actual operation to the backing CCF clock. Add some generic implementations of these functions to reduce duplication of code. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-06-11clk: fixed_rate: add API for directly registering fixed rate clocksTero Kristo
Current driver only supports registering fixed rate clocks from DT. Add new API which makes it possible to register fixed rate clocks directly from e.g. platform specific clock drivers. Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Tero Kristo <[email protected]> Signed-off-by: Tero Kristo <[email protected]>
2021-03-26clk: fixed-rate: Export driver parts for OF_PLATDATA_INSTSimon Glass
We need to allow SoCs to create their own drivers for this so that they can use their own of-platdata structs. To minimise code duplication, export the driver operations and the ofdata_to_plat() setup function. Signed-off-by: Simon Glass <[email protected]> Signed-off-by: Simon Glass <[email protected]>
2021-02-22clk: remove a redundant headerDario Binacchi
The linux/err.h header file was included twice. Signed-off-by: Dario Binacchi <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2021-01-12clk: export generic routinesDario Binacchi
Export routines that can be used by other drivers avoiding duplicating code. Signed-off-by: Dario Binacchi <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass
Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <[email protected]>
2020-08-03clk: Drop dm.h header file in clk-provider.hSimon Glass
This header file should not be included in other header files. Remove it and use a forward declaration and un-inlining of dev_get_clk_ptr() instead. Fix up the kendryte header files to avoid build errors. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Sean Anderson <[email protected]>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <[email protected]>
2020-01-26clk: Include missing headers for linux/clk-provider.hSean Anderson
This header was missing a couple of include dependencies when included on its own. Signed-off-by: Sean Anderson <[email protected]>
2019-07-31clk: gate: support sandboxPeng Fan
Introduce io_gate_val for sandbox clk gate test usage Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk: add composite clk supportPeng Fan
Import clk composite clk support from Linux Kernel 5.1-rc5 Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk-provider: include clk-uclass.hPeng Fan
Because clk-provider use clk_ops, so let's include clk-uclass.h Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk: fixed_rate: export clk_fixed_ratePeng Fan
Export the structure for others to use. Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk: add clk-gate supportPeng Fan
Import clk-gate support from Linux Kernel 5.1-rc5 Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk: export mux/divider opsPeng Fan
Export mux/divider ops and divider_recalc_rate for composite usage Signed-off-by: Peng Fan <[email protected]>
2019-07-31clk: mux: add set parent supportPeng Fan
Add set parent support for clk mux Signed-off-by: Peng Fan <[email protected]>
2019-07-19clk: sandbox: Adjust clk-mux.c to emulate reading divider value from HWLukasz Majewski
The generic mux clock code for CCF requires reading the clock multiplexer value from HW registers. As sandbox by design has readl() as no-op it was necessary to provide this value in the other way. The new field in the mux structure (accessible only when sandbox is run) has been introduced for this purpose. Signed-off-by: Lukasz Majewski <[email protected]>
2019-07-19clk: sandbox: Adjust clk-divider to emulate reading its value from HWLukasz Majewski
The generic divider clock code for CCF requires reading the divider value from HW registers. As sandbox by design has readl() as no-op it was necessary to provide this value in the other way. The new field in the divider structure (accessible only when sandbox is run) has been introduced for this purpose. Signed-off-by: Lukasz Majewski <[email protected]>
2019-07-19clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: v5.1.12)Lukasz Majewski
This patch brings the files from Linux kernel (linux-stable/linux-5.1.y SHA1: 5752b50477da)to provide clocks support as it is used on the Linux kernel with Common Clock Framework [CCF] setup. The directory structure has been preserved. The ported code only supports reading information from PLL, MUX, Divider, etc and enabling/disabling the clocks USDHCx/ECSPIx depending on used bus. Moreover, it is agnostic to the alias numbering as the information about the clock is read from the device tree. One needs to pay attention to the comments indicating necessary for U-Boot's driver model changes. If needed, the code can be extended to support the "set" part of the clock management. Signed-off-by: Lukasz Majewski <[email protected]>
2019-07-19clk: Introduce clk-provider.h to store Common Clock Framework's internalsLukasz Majewski
This file now stores the dev_get_clk_ptr() wrapper on the dev_get_uclass_priv() function. Signed-off-by: Lukasz Majewski <[email protected]>