Lines Matching refs:cru
266 static void rk628_clk_add_lookup(struct rk628_cru *cru, struct clk *clk, in rk628_clk_add_lookup() argument
269 if (cru->clk_data.clks && id) in rk628_clk_add_lookup()
270 cru->clk_data.clks[id] = clk; in rk628_clk_add_lookup()
273 static void rk628_clk_register_muxes(struct rk628_cru *cru) in rk628_clk_register_muxes() argument
281 clk = devm_clk_regmap_register_mux(cru->dev, data->name, in rk628_clk_register_muxes()
284 cru->regmap, data->reg, in rk628_clk_register_muxes()
288 dev_err(cru->dev, "failed to register clock %s\n", in rk628_clk_register_muxes()
293 rk628_clk_add_lookup(cru, clk, data->id); in rk628_clk_register_muxes()
297 static void rk628_clk_register_gates(struct rk628_cru *cru) in rk628_clk_register_gates() argument
305 clk = devm_clk_regmap_register_gate(cru->dev, data->name, in rk628_clk_register_gates()
307 cru->regmap, in rk628_clk_register_gates()
311 dev_err(cru->dev, "failed to register clock %s\n", in rk628_clk_register_gates()
316 rk628_clk_add_lookup(cru, clk, data->id); in rk628_clk_register_gates()
320 static void rk628_clk_register_composites(struct rk628_cru *cru) in rk628_clk_register_composites() argument
329 clk = devm_clk_regmap_register_composite(cru->dev, data->name, in rk628_clk_register_composites()
332 cru->regmap, in rk628_clk_register_composites()
344 dev_err(cru->dev, "failed to register clock %s\n", in rk628_clk_register_composites()
349 rk628_clk_add_lookup(cru, clk, data->id); in rk628_clk_register_composites()
353 static void rk628_clk_register_plls(struct rk628_cru *cru) in rk628_clk_register_plls() argument
361 clk = devm_clk_regmap_register_pll(cru->dev, data->name, in rk628_clk_register_plls()
363 cru->regmap, in rk628_clk_register_plls()
370 dev_err(cru->dev, "failed to register clock %s\n", in rk628_clk_register_plls()
375 rk628_clk_add_lookup(cru, clk, data->id); in rk628_clk_register_plls()
428 static int rk628_rgu_update(struct rk628_cru *cru, unsigned long id, int assert) in rk628_rgu_update() argument
432 return regmap_write(cru->regmap, data->reg, in rk628_rgu_update()
439 struct rk628_cru *cru = reset_to_cru(rcdev); in rk628_rgu_assert() local
441 return rk628_rgu_update(cru, id, 1); in rk628_rgu_assert()
447 struct rk628_cru *cru = reset_to_cru(rcdev); in rk628_rgu_deassert() local
449 return rk628_rgu_update(cru, id, 0); in rk628_rgu_deassert()
457 static int rk628_reset_controller_register(struct rk628_cru *cru) in rk628_reset_controller_register() argument
459 struct device *dev = cru->dev; in rk628_reset_controller_register()
461 cru->rcdev.owner = THIS_MODULE; in rk628_reset_controller_register()
462 cru->rcdev.nr_resets = ARRAY_SIZE(rk628_rgu_data); in rk628_reset_controller_register()
463 cru->rcdev.of_node = dev->of_node; in rk628_reset_controller_register()
464 cru->rcdev.ops = &rk628_rgu_ops; in rk628_reset_controller_register()
466 return devm_reset_controller_register(dev, &cru->rcdev); in rk628_reset_controller_register()
494 static void rk628_cru_init(struct rk628_cru *cru) in rk628_cru_init() argument
499 regmap_read(cru->parent->grf, GRF_SYSTEM_STATUS0, &val); in rk628_cru_init()
505 regmap_write(cru->regmap, CRU_GPLL_CON0, 0xffff701d); in rk628_cru_init()
508 regmap_write(cru->regmap, CRU_MODE_CON, 0xffff0004); in rk628_cru_init()
511 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff0080); in rk628_cru_init()
512 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff0083); in rk628_cru_init()
514 regmap_write(cru->regmap, CRU_CPLL_CON0, 0xffff3063); in rk628_cru_init()
517 regmap_write(cru->regmap, CRU_MODE_CON, 0xffff0005); in rk628_cru_init()
519 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff0003); in rk628_cru_init()
521 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff000b); in rk628_cru_init()
523 regmap_write(cru->regmap, CRU_GPLL_CON0, 0xffff1028); in rk628_cru_init()
526 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff008b); in rk628_cru_init()
528 regmap_write(cru->regmap, CRU_CPLL_CON0, 0xffff1063); in rk628_cru_init()
531 regmap_write(cru->regmap, CRU_CLKSEL_CON00, 0xff000b); in rk628_cru_init()
538 struct rk628_cru *cru; in rk628_cru_probe() local
543 cru = devm_kzalloc(dev, sizeof(*cru), GFP_KERNEL); in rk628_cru_probe()
544 if (!cru) in rk628_cru_probe()
547 cru->dev = dev; in rk628_cru_probe()
548 cru->parent = rk628; in rk628_cru_probe()
549 platform_set_drvdata(pdev, cru); in rk628_cru_probe()
551 cru->regmap = devm_regmap_init_i2c(rk628->client, in rk628_cru_probe()
553 if (IS_ERR(cru->regmap)) { in rk628_cru_probe()
554 ret = PTR_ERR(cru->regmap); in rk628_cru_probe()
559 rk628_cru_init(cru); in rk628_cru_probe()
569 cru->clk_data.clks = clk_table; in rk628_cru_probe()
570 cru->clk_data.clk_num = CGU_NR_CLKS; in rk628_cru_probe()
572 rk628_clk_register_plls(cru); in rk628_cru_probe()
573 rk628_clk_register_muxes(cru); in rk628_cru_probe()
574 rk628_clk_register_gates(cru); in rk628_cru_probe()
575 rk628_clk_register_composites(cru); in rk628_cru_probe()
576 rk628_reset_controller_register(cru); in rk628_cru_probe()
581 &cru->clk_data); in rk628_cru_probe()