mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
- Add additional constraints to A64 PLL MIPI clock
- fix autoloading sunxi-ng clocks when build as a module -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSPRixG1tysKC2PKM10Ba7+DO8kkwUCZivVwgAKCRB0Ba7+DO8k k1niAP4+uMNL09uAdVmRP8KEcD8GFMTABjMhlCXKyX1XEwiYRAD/fFx+9RjefSSu Hcvo/V3sD5jB2hpcUQsvVsWCNU3tDA8= =J3gq -----END PGP SIGNATURE----- Merge tag 'sunxi-clk-for-6.10-1' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into clk-allwinner Pull Allwinner clk driver updates from Jernej Skrabec: - Add additional constraints to A64 PLL MIPI clock - Fix autoloading sunxi-ng clocks when build as a module * tag 'sunxi-clk-for-6.10-1' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux: clk: sunxi-ng: fix module autoloading clk: sunxi-ng: a64: Add constraints on PLL-MIPI's n/m ratio and parent rate clk: sunxi-ng: nkm: Support constraints on m/n ratio and parent rate
This commit is contained in:
commit
19149b3113
|
|
@ -125,6 +125,7 @@ static const struct of_device_id sun20i_d1_r_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun20i-d1-r-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun20i_d1_r_ccu_ids);
|
||||
|
||||
static struct platform_driver sun20i_d1_r_ccu_driver = {
|
||||
.probe = sun20i_d1_r_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1394,6 +1394,7 @@ static const struct of_device_id sun20i_d1_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun20i-d1-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun20i_d1_ccu_ids);
|
||||
|
||||
static struct platform_driver sun20i_d1_ccu_driver = {
|
||||
.probe = sun20i_d1_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1481,6 +1481,7 @@ static const struct of_device_id sun4i_a10_ccu_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun4i_a10_ccu_ids);
|
||||
|
||||
static struct platform_driver sun4i_a10_ccu_driver = {
|
||||
.probe = sun4i_a10_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ static const struct of_device_id sun50i_a100_r_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun50i-a100-r-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_a100_r_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_a100_r_ccu_driver = {
|
||||
.probe = sun50i_a100_r_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1264,6 +1264,7 @@ static const struct of_device_id sun50i_a100_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun50i-a100-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_a100_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_a100_ccu_driver = {
|
||||
.probe = sun50i_a100_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -171,11 +171,13 @@ static struct ccu_nkm pll_mipi_clk = {
|
|||
* user manual, and by experiments the PLL doesn't work without
|
||||
* these bits toggled.
|
||||
*/
|
||||
.enable = BIT(31) | BIT(23) | BIT(22),
|
||||
.lock = BIT(28),
|
||||
.n = _SUNXI_CCU_MULT(8, 4),
|
||||
.k = _SUNXI_CCU_MULT_MIN(4, 2, 2),
|
||||
.m = _SUNXI_CCU_DIV(0, 4),
|
||||
.enable = BIT(31) | BIT(23) | BIT(22),
|
||||
.lock = BIT(28),
|
||||
.n = _SUNXI_CCU_MULT(8, 4),
|
||||
.k = _SUNXI_CCU_MULT_MIN(4, 2, 2),
|
||||
.m = _SUNXI_CCU_DIV(0, 4),
|
||||
.max_m_n_ratio = 3,
|
||||
.min_parent_m_ratio = 24000000,
|
||||
.common = {
|
||||
.reg = 0x040,
|
||||
.hw.init = CLK_HW_INIT("pll-mipi", "pll-video0",
|
||||
|
|
@ -978,6 +980,7 @@ static const struct of_device_id sun50i_a64_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun50i-a64-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_a64_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_a64_ccu_driver = {
|
||||
.probe = sun50i_a64_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ static const struct of_device_id sun50i_h6_r_ccu_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_h6_r_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_h6_r_ccu_driver = {
|
||||
.probe = sun50i_h6_r_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1259,6 +1259,7 @@ static const struct of_device_id sun50i_h6_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun50i-h6-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_h6_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_h6_ccu_driver = {
|
||||
.probe = sun50i_h6_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1154,6 +1154,7 @@ static const struct of_device_id sun50i_h616_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun50i-h616-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun50i_h616_ccu_ids);
|
||||
|
||||
static struct platform_driver sun50i_h616_ccu_driver = {
|
||||
.probe = sun50i_h616_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1271,6 +1271,7 @@ static const struct of_device_id sun6i_a31_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun6i-a31-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun6i_a31_ccu_ids);
|
||||
|
||||
static struct platform_driver sun6i_a31_ccu_driver = {
|
||||
.probe = sun6i_a31_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ static const struct of_device_id sun6i_rtc_ccu_match[] = {
|
|||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun6i_rtc_ccu_match);
|
||||
|
||||
int sun6i_rtc_ccu_probe(struct device *dev, void __iomem *reg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -751,6 +751,7 @@ static const struct of_device_id sun8i_a23_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun8i-a23-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_a23_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_a23_ccu_driver = {
|
||||
.probe = sun8i_a23_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -823,6 +823,7 @@ static const struct of_device_id sun8i_a33_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun8i-a33-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_a33_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_a33_ccu_driver = {
|
||||
.probe = sun8i_a33_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -911,6 +911,7 @@ static const struct of_device_id sun8i_a83t_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun8i-a83t-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_a83t_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_a83t_ccu_driver = {
|
||||
.probe = sun8i_a83t_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -337,6 +337,7 @@ static const struct of_device_id sunxi_de2_clk_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sunxi_de2_clk_ids);
|
||||
|
||||
static struct platform_driver sunxi_de2_clk_driver = {
|
||||
.probe = sunxi_de2_clk_probe,
|
||||
|
|
|
|||
|
|
@ -1082,6 +1082,7 @@ static const struct of_device_id sun8i_h3_ccu_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_h3_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_h3_ccu_driver = {
|
||||
.probe = sun8i_h3_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -262,6 +262,7 @@ static const struct of_device_id sun8i_r_ccu_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_r_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_r_ccu_driver = {
|
||||
.probe = sun8i_r_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -1363,6 +1363,7 @@ static const struct of_device_id sun8i_r40_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun8i-r40-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_r40_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_r40_ccu_driver = {
|
||||
.probe = sun8i_r40_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -768,6 +768,7 @@ static const struct of_device_id sun8i_v3s_ccu_ids[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun8i_v3s_ccu_ids);
|
||||
|
||||
static struct platform_driver sun8i_v3s_ccu_driver = {
|
||||
.probe = sun8i_v3s_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ static const struct of_device_id sun9i_a80_de_clk_ids[] = {
|
|||
{ .compatible = "allwinner,sun9i-a80-de-clks" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun9i_a80_de_clk_ids);
|
||||
|
||||
static struct platform_driver sun9i_a80_de_clk_driver = {
|
||||
.probe = sun9i_a80_de_clk_probe,
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ static const struct of_device_id sun9i_a80_usb_clk_ids[] = {
|
|||
{ .compatible = "allwinner,sun9i-a80-usb-clks" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun9i_a80_usb_clk_ids);
|
||||
|
||||
static struct platform_driver sun9i_a80_usb_clk_driver = {
|
||||
.probe = sun9i_a80_usb_clk_probe,
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,7 @@ static const struct of_device_id sun9i_a80_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,sun9i-a80-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sun9i_a80_ccu_ids);
|
||||
|
||||
static struct platform_driver sun9i_a80_ccu_driver = {
|
||||
.probe = sun9i_a80_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -565,6 +565,7 @@ static const struct of_device_id suniv_f1c100s_ccu_ids[] = {
|
|||
{ .compatible = "allwinner,suniv-f1c100s-ccu" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, suniv_f1c100s_ccu_ids);
|
||||
|
||||
static struct platform_driver suniv_f1c100s_ccu_driver = {
|
||||
.probe = suniv_f1c100s_ccu_probe,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,20 @@ struct _ccu_nkm {
|
|||
unsigned long m, min_m, max_m;
|
||||
};
|
||||
|
||||
static bool ccu_nkm_is_valid_rate(struct ccu_common *common, unsigned long parent,
|
||||
unsigned long n, unsigned long m)
|
||||
{
|
||||
struct ccu_nkm *nkm = container_of(common, struct ccu_nkm, common);
|
||||
|
||||
if (nkm->max_m_n_ratio && (m > nkm->max_m_n_ratio * n))
|
||||
return false;
|
||||
|
||||
if (nkm->min_parent_m_ratio && (parent < nkm->min_parent_m_ratio * m))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned long ccu_nkm_find_best_with_parent_adj(struct ccu_common *common,
|
||||
struct clk_hw *parent_hw,
|
||||
unsigned long *parent, unsigned long rate,
|
||||
|
|
@ -31,6 +45,10 @@ static unsigned long ccu_nkm_find_best_with_parent_adj(struct ccu_common *common
|
|||
unsigned long tmp_rate, tmp_parent;
|
||||
|
||||
tmp_parent = clk_hw_round_rate(parent_hw, rate * _m / (_n * _k));
|
||||
|
||||
if (!ccu_nkm_is_valid_rate(common, tmp_parent, _n, _m))
|
||||
continue;
|
||||
|
||||
tmp_rate = tmp_parent * _n * _k / _m;
|
||||
|
||||
if (ccu_is_better_rate(common, rate, tmp_rate, best_rate) ||
|
||||
|
|
@ -64,6 +82,9 @@ static unsigned long ccu_nkm_find_best(unsigned long parent, unsigned long rate,
|
|||
for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
|
||||
for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
|
||||
for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
|
||||
if (!ccu_nkm_is_valid_rate(common, parent, _n, _m))
|
||||
continue;
|
||||
|
||||
unsigned long tmp_rate;
|
||||
|
||||
tmp_rate = parent * _n * _k / _m;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ struct ccu_nkm {
|
|||
struct ccu_mux_internal mux;
|
||||
|
||||
unsigned int fixed_post_div;
|
||||
unsigned long max_m_n_ratio;
|
||||
unsigned long min_parent_m_ratio;
|
||||
|
||||
struct ccu_common common;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user