6f630784cc
function that isn't used anymore. Otherwise the main new thing for the common clk framework is that it is selectable in the Kconfig language now. Hopefully this will let clk drivers and clk consumers be testable on more than the architectures that support the clk framework. The goal is to introduce some Kunit tests for the framework. Outside of the core framework we have the usual set of various driver updates and non-critical fixes. The dirstat shows that the new Baikal-T1 driver is the largest addition this time around in terms of lines of code. After that the x86 (Intel), Qualcomm, and Mediatek drivers introduce many lines to support new or upcoming SoCs. After that the dirstat shows the usual suspects working on their SoC support by fixing minor bugs, correcting data and converting some of their DT bindings to YAML. Core: - Allow the COMMON_CLK config to be selectable New Drivers: - Clk driver for Baikal-T1 SoCs - Mediatek MT6765 clock support - Support for Intel Agilex clks - Add support for X1830 and X1000 Ingenic SoC clk controllers - Add support for the new Renesas RZ/G1H (R8A7742) SoC - Add support for Qualcomm's MSM8939 Generic Clock Controller Updates: - Support IDT VersaClock 5P49V5925 - Bunch of updates for HSDK clock generation unit (CGU) driver - Start making audio and GPU clks work on Marvell MMP2/MMP3 SoCs - Add some GPU, NPU, and UFS clks to Qualcomm SM8150 driver - Enable supply regulators for GPU gdscs on Qualcomm SoCs - Add support for Si5342, Si5344 and Si5345 chips - Support custom flags in Xilinx zynq firmware - Various small fixes to the Xilinx clk driver - A single minor rounding fix for the legacy Allwinner clock support - A few patches from Abel Vesa as preparation of adding audiomix clock support on i.MX - A couple of cleanups from Anson Huang for i.MX clk-sscg-pll and clk-pllv3 drivers - Drop dependency on ARM64 for i.MX8M clock driver, to support aarch32 mode on aarch64 hardware - A series from Peng Fan to improve i.MX8M clock drivers, using composite clock for core and bus clk slice - Set a better parent clock for flexcan on i.MX6UL to support CiA102 defined bit rates - A couple changes for EMC frequency scaling on Tegra210 - Support for CPU frequency scaling on Tegra20/Tegra30 - New clk gate for CSI test pattern generator on Tegra210 - Regression fixes for Samsung exynos542x and exynos5433 SoCs - Use of fallthrough; attribute for Samsung s3c24xx - Updates and fixup HDMI and video clocks on Meson8b - Fixup reset polarity on Meson8b - Fix GPU glitch free mux switch on Meson gx and g12 - A minor fix for the currently unused suspend/resume handling on Renesas RZ/A1 and RZ/A2 - Two more conversions of Renesas DT bindings to json-schema - Add support for the USB 2.0 clock selector on Renesas R-Car M3-W+ -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE9L57QeeUxqYDyoaDrQKIl8bklSUFAl7gEUgRHHNib3lkQGtl cm5lbC5vcmcACgkQrQKIl8bklSUemxAAlQKzx0yMS3yx5twJ4RSFUvf3hf4OqyPp O46soqADk+l69Z4SUUBsMjt8el5Sqmm4d1j1Gpfmgp3ZlumHCQK+qGYp48IXbwRP Jlo5sKNlNL6yhCd+ixPn4j7W/HbpGs4cciWOXkGQtYEGjhHm3Wllhd9MqpL2YjLx gZW60NqWtOe1XeB4ILyYQGisNwAGDi5XuBeNvxG12H/LaGC1mwtBX9yoNAehr9bF peJ2XnO02zFo73OCyzIOkw1uY4u7ZtwPdHGhymoGeVlcBWO6KwKesNkHnji/Grlv wMbsGLoRV/i3PL3q5kZIDigo8sqZ9RUG+9piRAoiLM5AgkSypw3/q9T+ujTfZp8t kgvFha6bLZz31UFmr4lBJPTT5Q/hAoe1W6RB6HZkx7XNqUpsAS04SwkQztAqkJqZ 9zlYJrXgLlP5qcNllJ6zvUWkMqtmIKW4ZkjYe4u84yk5Co7bX8DCYa+QOKCz+pV4 IbjRT62OrX2ZlXJYwkLb4m1nhZ7tBzhzIRP1umL0ukhxdomK6ofSNPzbBF9+t1eR /ai2/Ch6L6WIwDINEp+chO67/dJaj5W3WNqGMCmVt37myW1kBjH3eg0YG4cp7NYZ /jSjdWczQy/8BgY5V1009MRXI4uyazQxBw+apDcIGezamOKBmuwjBcvkf1D0mL2x Y6OclK5ljsw= =nuG5 -----END PGP SIGNATURE----- Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux Pull clk updates from Stephen Boyd: "This time around we have four lines of diff in the core framework, removing a function that isn't used anymore. Otherwise the main new thing for the common clk framework is that it is selectable in the Kconfig language now. Hopefully this will let clk drivers and clk consumers be testable on more than the architectures that support the clk framework. The goal is to introduce some Kunit tests for the framework. Outside of the core framework we have the usual set of various driver updates and non-critical fixes. The dirstat shows that the new Baikal-T1 driver is the largest addition this time around in terms of lines of code. After that the x86 (Intel), Qualcomm, and Mediatek drivers introduce many lines to support new or upcoming SoCs. After that the dirstat shows the usual suspects working on their SoC support by fixing minor bugs, correcting data and converting some of their DT bindings to YAML. Core: - Allow the COMMON_CLK config to be selectable New Drivers: - Clk driver for Baikal-T1 SoCs - Mediatek MT6765 clock support - Support for Intel Agilex clks - Add support for X1830 and X1000 Ingenic SoC clk controllers - Add support for the new Renesas RZ/G1H (R8A7742) SoC - Add support for Qualcomm's MSM8939 Generic Clock Controller Updates: - Support IDT VersaClock 5P49V5925 - Bunch of updates for HSDK clock generation unit (CGU) driver - Start making audio and GPU clks work on Marvell MMP2/MMP3 SoCs - Add some GPU, NPU, and UFS clks to Qualcomm SM8150 driver - Enable supply regulators for GPU gdscs on Qualcomm SoCs - Add support for Si5342, Si5344 and Si5345 chips - Support custom flags in Xilinx zynq firmware - Various small fixes to the Xilinx clk driver - A single minor rounding fix for the legacy Allwinner clock support - A few patches from Abel Vesa as preparation of adding audiomix clock support on i.MX - A couple of cleanups from Anson Huang for i.MX clk-sscg-pll and clk-pllv3 drivers - Drop dependency on ARM64 for i.MX8M clock driver, to support aarch32 mode on aarch64 hardware - A series from Peng Fan to improve i.MX8M clock drivers, using composite clock for core and bus clk slice - Set a better parent clock for flexcan on i.MX6UL to support CiA102 defined bit rates - A couple changes for EMC frequency scaling on Tegra210 - Support for CPU frequency scaling on Tegra20/Tegra30 - New clk gate for CSI test pattern generator on Tegra210 - Regression fixes for Samsung exynos542x and exynos5433 SoCs - Use of fallthrough; attribute for Samsung s3c24xx - Updates and fixup HDMI and video clocks on Meson8b - Fixup reset polarity on Meson8b - Fix GPU glitch free mux switch on Meson gx and g12 - A minor fix for the currently unused suspend/resume handling on Renesas RZ/A1 and RZ/A2 - Two more conversions of Renesas DT bindings to json-schema - Add support for the USB 2.0 clock selector on Renesas R-Car M3-W+" * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (155 commits) clk: mediatek: Remove ifr{0,1}_cfg_regs structures clk: baikal-t1: remove redundant assignment to variable 'divider' clk: baikal-t1: fix spelling mistake "Uncompatible" -> "Incompatible" dt-bindings: clock: Add a missing include to MMP Audio Clock binding dt: Add bindings for IDT VersaClock 5P49V5925 clk: vc5: Add support for IDT VersaClock 5P49V6965 clk: Add Baikal-T1 CCU Dividers driver clk: Add Baikal-T1 CCU PLLs driver dt-bindings: clk: Add Baikal-T1 CCU Dividers binding dt-bindings: clk: Add Baikal-T1 CCU PLLs binding clk: mediatek: assign the initial value to clk_init_data of mtk_mux clk: mediatek: Add MT6765 clock support clk: mediatek: add mt6765 clock IDs dt-bindings: clock: mediatek: document clk bindings vcodecsys for Mediatek MT6765 SoC dt-bindings: clock: mediatek: document clk bindings mipi0a for Mediatek MT6765 SoC dt-bindings: clock: mediatek: document clk bindings for Mediatek MT6765 SoC CLK: HSDK: CGU: add support for 148.5MHz clock CLK: HSDK: CGU: support PLL bypassing CLK: HSDK: CGU: check if PLL is bypassed first clk: clk-si5341: Add support for the Si5345 series ...
266 lines
6.2 KiB
C
266 lines
6.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __MACH_MMP_CLK_H
|
|
#define __MACH_MMP_CLK_H
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/pm_domain.h>
|
|
#include <linux/clkdev.h>
|
|
|
|
#define APBC_NO_BUS_CTRL BIT(0)
|
|
#define APBC_POWER_CTRL BIT(1)
|
|
|
|
|
|
/* Clock type "factor" */
|
|
struct mmp_clk_factor_masks {
|
|
unsigned int factor;
|
|
unsigned int num_mask;
|
|
unsigned int den_mask;
|
|
unsigned int num_shift;
|
|
unsigned int den_shift;
|
|
unsigned int enable_mask;
|
|
};
|
|
|
|
struct mmp_clk_factor_tbl {
|
|
unsigned int num;
|
|
unsigned int den;
|
|
};
|
|
|
|
struct mmp_clk_factor {
|
|
struct clk_hw hw;
|
|
void __iomem *base;
|
|
struct mmp_clk_factor_masks *masks;
|
|
struct mmp_clk_factor_tbl *ftbl;
|
|
unsigned int ftbl_cnt;
|
|
spinlock_t *lock;
|
|
};
|
|
|
|
extern struct clk *mmp_clk_register_factor(const char *name,
|
|
const char *parent_name, unsigned long flags,
|
|
void __iomem *base, struct mmp_clk_factor_masks *masks,
|
|
struct mmp_clk_factor_tbl *ftbl, unsigned int ftbl_cnt,
|
|
spinlock_t *lock);
|
|
|
|
/* Clock type "mix" */
|
|
#define MMP_CLK_BITS_MASK(width, shift) \
|
|
(((1 << (width)) - 1) << (shift))
|
|
#define MMP_CLK_BITS_GET_VAL(data, width, shift) \
|
|
((data & MMP_CLK_BITS_MASK(width, shift)) >> (shift))
|
|
#define MMP_CLK_BITS_SET_VAL(val, width, shift) \
|
|
(((val) << (shift)) & MMP_CLK_BITS_MASK(width, shift))
|
|
|
|
enum {
|
|
MMP_CLK_MIX_TYPE_V1,
|
|
MMP_CLK_MIX_TYPE_V2,
|
|
MMP_CLK_MIX_TYPE_V3,
|
|
};
|
|
|
|
/* The register layout */
|
|
struct mmp_clk_mix_reg_info {
|
|
void __iomem *reg_clk_ctrl;
|
|
void __iomem *reg_clk_sel;
|
|
u8 width_div;
|
|
u8 shift_div;
|
|
u8 width_mux;
|
|
u8 shift_mux;
|
|
u8 bit_fc;
|
|
};
|
|
|
|
/* The suggested clock table from user. */
|
|
struct mmp_clk_mix_clk_table {
|
|
unsigned long rate;
|
|
u8 parent_index;
|
|
unsigned int divisor;
|
|
unsigned int valid;
|
|
};
|
|
|
|
struct mmp_clk_mix_config {
|
|
struct mmp_clk_mix_reg_info reg_info;
|
|
struct mmp_clk_mix_clk_table *table;
|
|
unsigned int table_size;
|
|
u32 *mux_table;
|
|
struct clk_div_table *div_table;
|
|
u8 div_flags;
|
|
u8 mux_flags;
|
|
};
|
|
|
|
struct mmp_clk_mix {
|
|
struct clk_hw hw;
|
|
struct mmp_clk_mix_reg_info reg_info;
|
|
struct mmp_clk_mix_clk_table *table;
|
|
u32 *mux_table;
|
|
struct clk_div_table *div_table;
|
|
unsigned int table_size;
|
|
u8 div_flags;
|
|
u8 mux_flags;
|
|
unsigned int type;
|
|
spinlock_t *lock;
|
|
};
|
|
|
|
extern const struct clk_ops mmp_clk_mix_ops;
|
|
extern struct clk *mmp_clk_register_mix(struct device *dev,
|
|
const char *name,
|
|
const char * const *parent_names,
|
|
u8 num_parents,
|
|
unsigned long flags,
|
|
struct mmp_clk_mix_config *config,
|
|
spinlock_t *lock);
|
|
|
|
|
|
/* Clock type "gate". MMP private gate */
|
|
#define MMP_CLK_GATE_NEED_DELAY BIT(0)
|
|
|
|
struct mmp_clk_gate {
|
|
struct clk_hw hw;
|
|
void __iomem *reg;
|
|
u32 mask;
|
|
u32 val_enable;
|
|
u32 val_disable;
|
|
unsigned int flags;
|
|
spinlock_t *lock;
|
|
};
|
|
|
|
extern const struct clk_ops mmp_clk_gate_ops;
|
|
extern struct clk *mmp_clk_register_gate(struct device *dev, const char *name,
|
|
const char *parent_name, unsigned long flags,
|
|
void __iomem *reg, u32 mask, u32 val_enable,
|
|
u32 val_disable, unsigned int gate_flags,
|
|
spinlock_t *lock);
|
|
|
|
extern struct clk *mmp_clk_register_apbc(const char *name,
|
|
const char *parent_name, void __iomem *base,
|
|
unsigned int delay, unsigned int apbc_flags, spinlock_t *lock);
|
|
extern struct clk *mmp_clk_register_apmu(const char *name,
|
|
const char *parent_name, void __iomem *base, u32 enable_mask,
|
|
spinlock_t *lock);
|
|
|
|
struct mmp_clk_unit {
|
|
unsigned int nr_clks;
|
|
struct clk **clk_table;
|
|
struct clk_onecell_data clk_data;
|
|
};
|
|
|
|
struct mmp_param_fixed_rate_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
const char *parent_name;
|
|
unsigned long flags;
|
|
unsigned long fixed_rate;
|
|
};
|
|
void mmp_register_fixed_rate_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_fixed_rate_clk *clks,
|
|
int size);
|
|
|
|
struct mmp_param_fixed_factor_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
const char *parent_name;
|
|
unsigned long mult;
|
|
unsigned long div;
|
|
unsigned long flags;
|
|
};
|
|
void mmp_register_fixed_factor_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_fixed_factor_clk *clks,
|
|
int size);
|
|
|
|
struct mmp_param_general_gate_clk {
|
|
unsigned int id;
|
|
const char *name;
|
|
const char *parent_name;
|
|
unsigned long flags;
|
|
unsigned long offset;
|
|
u8 bit_idx;
|
|
u8 gate_flags;
|
|
spinlock_t *lock;
|
|
};
|
|
void mmp_register_general_gate_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_general_gate_clk *clks,
|
|
void __iomem *base, int size);
|
|
|
|
struct mmp_param_gate_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
const char *parent_name;
|
|
unsigned long flags;
|
|
unsigned long offset;
|
|
u32 mask;
|
|
u32 val_enable;
|
|
u32 val_disable;
|
|
unsigned int gate_flags;
|
|
spinlock_t *lock;
|
|
};
|
|
void mmp_register_gate_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_gate_clk *clks,
|
|
void __iomem *base, int size);
|
|
|
|
struct mmp_param_mux_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
const char * const *parent_name;
|
|
u8 num_parents;
|
|
unsigned long flags;
|
|
unsigned long offset;
|
|
u8 shift;
|
|
u8 width;
|
|
u8 mux_flags;
|
|
spinlock_t *lock;
|
|
};
|
|
void mmp_register_mux_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_mux_clk *clks,
|
|
void __iomem *base, int size);
|
|
|
|
struct mmp_param_div_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
const char *parent_name;
|
|
unsigned long flags;
|
|
unsigned long offset;
|
|
u8 shift;
|
|
u8 width;
|
|
u8 div_flags;
|
|
spinlock_t *lock;
|
|
};
|
|
void mmp_register_div_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_div_clk *clks,
|
|
void __iomem *base, int size);
|
|
|
|
struct mmp_param_pll_clk {
|
|
unsigned int id;
|
|
char *name;
|
|
unsigned long default_rate;
|
|
unsigned long enable_offset;
|
|
u32 enable;
|
|
unsigned long offset;
|
|
u8 shift;
|
|
/* MMP3 specific: */
|
|
unsigned long input_rate;
|
|
unsigned long postdiv_offset;
|
|
unsigned long postdiv_shift;
|
|
};
|
|
void mmp_register_pll_clks(struct mmp_clk_unit *unit,
|
|
struct mmp_param_pll_clk *clks,
|
|
void __iomem *base, int size);
|
|
|
|
#define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc) \
|
|
{ \
|
|
.width_div = (w_d), \
|
|
.shift_div = (s_d), \
|
|
.width_mux = (w_m), \
|
|
.shift_mux = (s_m), \
|
|
.bit_fc = (fc), \
|
|
}
|
|
|
|
void mmp_clk_init(struct device_node *np, struct mmp_clk_unit *unit,
|
|
int nr_clks);
|
|
void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
|
|
struct clk *clk);
|
|
|
|
/* Power islands */
|
|
#define MMP_PM_DOMAIN_NO_DISABLE BIT(0)
|
|
|
|
struct generic_pm_domain *mmp_pm_domain_register(const char *name,
|
|
void __iomem *reg,
|
|
u32 power_on, u32 reset, u32 clock_enable,
|
|
unsigned int flags, spinlock_t *lock);
|
|
|
|
#endif
|