Lines Matching +full:clk +full:- +full:div

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
11 #include <linux/clk-provider.h>
17 #include "clk-factors.h"
20 * sun6i_get_ar100_factors - Calculates factors p, m for AR100
27 unsigned long div; in sun6i_get_ar100_factors() local
31 if (req->rate > req->parent_rate) in sun6i_get_ar100_factors()
32 req->rate = req->parent_rate; in sun6i_get_ar100_factors()
34 div = DIV_ROUND_UP(req->parent_rate, req->rate); in sun6i_get_ar100_factors()
36 if (div < 32) in sun6i_get_ar100_factors()
38 else if (div >> 1 < 32) in sun6i_get_ar100_factors()
40 else if (div >> 2 < 32) in sun6i_get_ar100_factors()
45 div >>= shift; in sun6i_get_ar100_factors()
47 if (div > 32) in sun6i_get_ar100_factors()
48 div = 32; in sun6i_get_ar100_factors()
50 req->rate = (req->parent_rate >> shift) / div; in sun6i_get_ar100_factors()
51 req->m = div - 1; in sun6i_get_ar100_factors()
52 req->p = shift; in sun6i_get_ar100_factors()
73 struct device_node *np = pdev->dev.of_node; in sun6i_a31_ar100_clk_probe()
76 struct clk *clk; in sun6i_a31_ar100_clk_probe() local
79 reg = devm_ioremap_resource(&pdev->dev, r); in sun6i_a31_ar100_clk_probe()
83 clk = sunxi_factors_register(np, &sun6i_ar100_data, &sun6i_ar100_lock, in sun6i_a31_ar100_clk_probe()
85 if (!clk) in sun6i_a31_ar100_clk_probe()
86 return -ENOMEM; in sun6i_a31_ar100_clk_probe()
88 platform_set_drvdata(pdev, clk); in sun6i_a31_ar100_clk_probe()
94 { .compatible = "allwinner,sun6i-a31-ar100-clk" },
100 .name = "sun6i-a31-ar100-clk",