Lines Matching refs:axi_clkgen

56 struct axi_clkgen {  struct
231 static void axi_clkgen_write(struct axi_clkgen *axi_clkgen, in axi_clkgen_write() argument
234 writel(val, axi_clkgen->base + reg); in axi_clkgen_write()
237 static void axi_clkgen_read(struct axi_clkgen *axi_clkgen, in axi_clkgen_read() argument
240 *val = readl(axi_clkgen->base + reg); in axi_clkgen_read()
243 static int axi_clkgen_wait_non_busy(struct axi_clkgen *axi_clkgen) in axi_clkgen_wait_non_busy() argument
249 axi_clkgen_read(axi_clkgen, AXI_CLKGEN_V2_REG_DRP_STATUS, &val); in axi_clkgen_wait_non_busy()
258 static int axi_clkgen_mmcm_read(struct axi_clkgen *axi_clkgen, in axi_clkgen_mmcm_read() argument
264 ret = axi_clkgen_wait_non_busy(axi_clkgen); in axi_clkgen_mmcm_read()
271 axi_clkgen_write(axi_clkgen, AXI_CLKGEN_V2_REG_DRP_CNTRL, reg_val); in axi_clkgen_mmcm_read()
273 ret = axi_clkgen_wait_non_busy(axi_clkgen); in axi_clkgen_mmcm_read()
282 static int axi_clkgen_mmcm_write(struct axi_clkgen *axi_clkgen, in axi_clkgen_mmcm_write() argument
288 ret = axi_clkgen_wait_non_busy(axi_clkgen); in axi_clkgen_mmcm_write()
293 axi_clkgen_mmcm_read(axi_clkgen, reg, &reg_val); in axi_clkgen_mmcm_write()
299 axi_clkgen_write(axi_clkgen, AXI_CLKGEN_V2_REG_DRP_CNTRL, reg_val); in axi_clkgen_mmcm_write()
304 static void axi_clkgen_mmcm_enable(struct axi_clkgen *axi_clkgen, in axi_clkgen_mmcm_enable() argument
312 axi_clkgen_write(axi_clkgen, AXI_CLKGEN_V2_REG_RESET, val); in axi_clkgen_mmcm_enable()
315 static struct axi_clkgen *clk_hw_to_axi_clkgen(struct clk_hw *clk_hw) in clk_hw_to_axi_clkgen()
317 return container_of(clk_hw, struct axi_clkgen, clk_hw); in clk_hw_to_axi_clkgen()
320 static void axi_clkgen_set_div(struct axi_clkgen *axi_clkgen, in axi_clkgen_set_div() argument
324 axi_clkgen_mmcm_write(axi_clkgen, reg1, in axi_clkgen_set_div()
326 axi_clkgen_mmcm_write(axi_clkgen, reg2, in axi_clkgen_set_div()
331 axi_clkgen_mmcm_write(axi_clkgen, reg3, in axi_clkgen_set_div()
339 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_set_rate() local
340 const struct axi_clkgen_limits *limits = &axi_clkgen->limits; in axi_clkgen_set_rate()
358 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_POWER, power, 0x9800); in axi_clkgen_set_rate()
364 axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLKOUT0_1, MMCM_REG_CLKOUT0_2, in axi_clkgen_set_rate()
368 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLK_DIV, in axi_clkgen_set_rate()
373 axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLK_FB1, MMCM_REG_CLK_FB2, in axi_clkgen_set_rate()
376 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK1, lock & 0x3ff, 0x3ff); in axi_clkgen_set_rate()
377 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK2, in axi_clkgen_set_rate()
379 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK3, in axi_clkgen_set_rate()
381 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_FILTER1, filter >> 16, 0x9900); in axi_clkgen_set_rate()
382 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_FILTER2, filter, 0x9900); in axi_clkgen_set_rate()
390 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw); in axi_clkgen_determine_rate() local
391 const struct axi_clkgen_limits *limits = &axi_clkgen->limits; in axi_clkgen_determine_rate()
408 static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen, in axi_clkgen_get_div() argument
414 axi_clkgen_mmcm_read(axi_clkgen, reg2, &val2); in axi_clkgen_get_div()
418 axi_clkgen_mmcm_read(axi_clkgen, reg1, &val1); in axi_clkgen_get_div()
438 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_recalc_rate() local
443 dout = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLKOUT0_1, in axi_clkgen_recalc_rate()
445 m = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLK_FB1, in axi_clkgen_recalc_rate()
448 axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, &val); in axi_clkgen_recalc_rate()
465 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_enable() local
467 axi_clkgen_mmcm_enable(axi_clkgen, true); in axi_clkgen_enable()
474 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_disable() local
476 axi_clkgen_mmcm_enable(axi_clkgen, false); in axi_clkgen_disable()
481 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_set_parent() local
483 axi_clkgen_write(axi_clkgen, AXI_CLKGEN_V2_REG_CLKSEL, index); in axi_clkgen_set_parent()
490 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); in axi_clkgen_get_parent() local
493 axi_clkgen_read(axi_clkgen, AXI_CLKGEN_V2_REG_CLKSEL, &parent); in axi_clkgen_get_parent()
511 struct axi_clkgen *axi_clkgen; in axi_clkgen_probe() local
522 axi_clkgen = devm_kzalloc(&pdev->dev, sizeof(*axi_clkgen), GFP_KERNEL); in axi_clkgen_probe()
523 if (!axi_clkgen) in axi_clkgen_probe()
526 axi_clkgen->base = devm_platform_ioremap_resource(pdev, 0); in axi_clkgen_probe()
527 if (IS_ERR(axi_clkgen->base)) in axi_clkgen_probe()
528 return PTR_ERR(axi_clkgen->base); in axi_clkgen_probe()
540 memcpy(&axi_clkgen->limits, dflt_limits, sizeof(axi_clkgen->limits)); in axi_clkgen_probe()
551 axi_clkgen_mmcm_enable(axi_clkgen, false); in axi_clkgen_probe()
553 axi_clkgen->clk_hw.init = &init; in axi_clkgen_probe()
554 ret = devm_clk_hw_register(&pdev->dev, &axi_clkgen->clk_hw); in axi_clkgen_probe()
559 &axi_clkgen->clk_hw); in axi_clkgen_probe()