Lines Matching defs:clk

12 #include <linux/clk.h>
13 #include <linux/clk-provider.h>
39 struct clk *clk;
91 struct clk *sysclk, *coreclk;
93 struct clk *cmux[NUM_CMUX];
94 struct clk *hwaccel[NUM_HWACCEL];
95 struct clk *fman[2];
476 cg->fman[0] = cg->pll[CGA_PLL2].div[PLL_DIV2].clk;
478 cg->fman[0] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
488 cg->fman[0] = cg->pll[CGA_PLL3].div[PLL_DIV2].clk;
490 cg->fman[0] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
493 cg->fman[1] = cg->pll[CGA_PLL3].div[PLL_DIV2].clk;
495 cg->fman[1] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
508 cg->fman[0] = cg->pll[CGA_PLL2].div[div].clk;
510 cg->fman[0] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
523 cg->fman[0] = cg->pll[CGA_PLL3].div[div].clk;
525 cg->fman[0] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
528 cg->fman[1] = cg->pll[CGA_PLL3].div[div].clk;
530 cg->fman[1] = cg->pll[PLATFORM_PLL].div[PLL_DIV2].clk;
540 cg->fman[0] = cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk;
909 static struct clk * __init create_mux_common(struct clockgen *cg,
918 struct clk *clk;
935 rate = clk_get_rate(div->clk);
959 clk = clk_register(NULL, &hwc->hw);
960 if (IS_ERR(clk)) {
962 PTR_ERR(clk));
967 return clk;
970 static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
1003 max_rate = clk_get_rate(div->clk);
1007 plat_rate = clk_get_rate(cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk);
1018 static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
1079 struct clk *clk;
1089 clk = clockgen.cmux[idx];
1091 rc = of_clk_add_provider(np, of_clk_src_simple_get, clk);
1093 pr_err("%s: Couldn't register clk provider for node %pOFn: %d\n",
1099 static struct clk __init
1110 static struct clk __init *input_clock(const char *name, struct clk *clk)
1115 input_name = __clk_get_name(clk);
1116 clk = clk_register_fixed_factor(NULL, name, input_name,
1118 if (IS_ERR(clk))
1120 PTR_ERR(clk));
1122 return clk;
1125 static struct clk __init *input_clock_by_name(const char *name,
1128 struct clk *clk;
1130 clk = of_clk_get_by_name(clockgen.node, dtname);
1131 if (IS_ERR(clk))
1132 return clk;
1134 return input_clock(name, clk);
1137 static struct clk __init *input_clock_by_index(const char *name, int idx)
1139 struct clk *clk;
1141 clk = of_clk_get(clockgen.node, 0);
1142 if (IS_ERR(clk))
1143 return clk;
1145 return input_clock(name, clk);
1148 static struct clk * __init create_sysclk(const char *name)
1151 struct clk *clk;
1153 clk = sysclk_from_fixed(clockgen.node, name);
1154 if (!IS_ERR(clk))
1155 return clk;
1157 clk = input_clock_by_name(name, "sysclk");
1158 if (!IS_ERR(clk))
1159 return clk;
1161 clk = input_clock_by_index(name, 0);
1162 if (!IS_ERR(clk))
1163 return clk;
1167 clk = sysclk_from_fixed(sysclk, name);
1169 if (!IS_ERR(clk))
1170 return clk;
1177 static struct clk * __init create_coreclk(const char *name)
1179 struct clk *clk;
1181 clk = input_clock_by_name(name, "coreclk");
1182 if (!IS_ERR(clk))
1183 return clk;
1191 if (WARN_ON(PTR_ERR(clk) == -EPROBE_DEFER))
1192 return clk;
1200 struct clk *clk;
1204 clk = clockgen.sysclk;
1205 if (clk)
1206 of_clk_add_provider(node, of_clk_src_simple_get, clk);
1273 struct clk *clk;
1286 clk = clk_register_fixed_factor(NULL,
1288 if (IS_ERR(clk)) {
1290 __func__, pll->div[i].name, PTR_ERR(clk));
1294 pll->div[i].clk = clk;
1295 ret = clk_register_clkdev(clk, pll->div[i].name, NULL);
1315 struct clk **subclks;
1324 subclks = kcalloc(4, sizeof(struct clk *), GFP_KERNEL);
1333 subclks[0] = pll->div[0].clk;
1334 subclks[1] = pll->div[1].clk;
1335 subclks[2] = pll->div[3].clk;
1337 subclks[0] = pll->div[0].clk;
1338 subclks[1] = pll->div[1].clk;
1339 subclks[2] = pll->div[2].clk;
1340 subclks[3] = pll->div[3].clk;
1348 pr_err("%s: Couldn't register clk provider for node %pOFn: %d\n",
1387 static struct clk *clockgen_clk_get(struct of_phandle_args *clkspec, void *data)
1390 struct clk *clk;
1406 clk = cg->sysclk;
1411 clk = cg->cmux[idx];
1416 clk = cg->hwaccel[idx];
1421 clk = cg->fman[idx];
1427 clk = pll->div[idx].clk;
1432 clk = cg->coreclk;
1433 if (IS_ERR(clk))
1434 clk = NULL;
1440 if (!clk)
1442 return clk;
1556 pr_err("%s: Couldn't register clk provider for node %pOFn: %d\n",