Searched refs:clk_wzrd (Results 1 - 1 of 1) sorted by relevance
/linux-4.1.27/drivers/staging/clocking-wizard/ |
H A D | clk-xlnx-clock-wizard.c | 51 * struct clk_wzrd: 62 struct clk_wzrd { struct 73 #define to_clk_wzrd(_nb) container_of(_nb, struct clk_wzrd, nb) 87 struct clk_wzrd *clk_wzrd = to_clk_wzrd(nb); clk_wzrd_clk_notifier() local 89 if (clk_wzrd->suspended) clk_wzrd_clk_notifier() 92 if (ndata->clk == clk_wzrd->clk_in1) clk_wzrd_clk_notifier() 93 max = clk_wzrd_max_freq[clk_wzrd->speed_grade - 1]; clk_wzrd_clk_notifier() 94 else if (ndata->clk == clk_wzrd->axi_clk) clk_wzrd_clk_notifier() 113 struct clk_wzrd *clk_wzrd = dev_get_drvdata(dev); clk_wzrd_suspend() local 115 clk_disable_unprepare(clk_wzrd->axi_clk); clk_wzrd_suspend() 116 clk_wzrd->suspended = true; clk_wzrd_suspend() 124 struct clk_wzrd *clk_wzrd = dev_get_drvdata(dev); clk_wzrd_resume() local 126 ret = clk_prepare_enable(clk_wzrd->axi_clk); clk_wzrd_resume() 132 clk_wzrd->suspended = false; clk_wzrd_resume() 146 struct clk_wzrd *clk_wzrd; clk_wzrd_probe() local 150 clk_wzrd = devm_kzalloc(&pdev->dev, sizeof(*clk_wzrd), GFP_KERNEL); clk_wzrd_probe() 151 if (!clk_wzrd) clk_wzrd_probe() 153 platform_set_drvdata(pdev, clk_wzrd); clk_wzrd_probe() 156 clk_wzrd->base = devm_ioremap_resource(&pdev->dev, mem); clk_wzrd_probe() 157 if (IS_ERR(clk_wzrd->base)) clk_wzrd_probe() 158 return PTR_ERR(clk_wzrd->base); clk_wzrd_probe() 160 ret = of_property_read_u32(np, "speed-grade", &clk_wzrd->speed_grade); clk_wzrd_probe() 162 if (clk_wzrd->speed_grade < 1 || clk_wzrd->speed_grade > 3) { clk_wzrd_probe() 164 clk_wzrd->speed_grade); clk_wzrd_probe() 165 clk_wzrd->speed_grade = 0; clk_wzrd_probe() 169 clk_wzrd->clk_in1 = devm_clk_get(&pdev->dev, "clk_in1"); clk_wzrd_probe() 170 if (IS_ERR(clk_wzrd->clk_in1)) { clk_wzrd_probe() 171 if (clk_wzrd->clk_in1 != ERR_PTR(-EPROBE_DEFER)) clk_wzrd_probe() 173 return PTR_ERR(clk_wzrd->clk_in1); clk_wzrd_probe() 176 clk_wzrd->axi_clk = devm_clk_get(&pdev->dev, "s_axi_aclk"); clk_wzrd_probe() 177 if (IS_ERR(clk_wzrd->axi_clk)) { clk_wzrd_probe() 178 if (clk_wzrd->axi_clk != ERR_PTR(-EPROBE_DEFER)) clk_wzrd_probe() 180 return PTR_ERR(clk_wzrd->axi_clk); clk_wzrd_probe() 182 ret = clk_prepare_enable(clk_wzrd->axi_clk); clk_wzrd_probe() 187 rate = clk_get_rate(clk_wzrd->axi_clk); clk_wzrd_probe() 196 reg = readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & clk_wzrd_probe() 198 reg |= readl(clk_wzrd->base + WZRD_CLK_CFG_REG(2)) & clk_wzrd_probe() 204 reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & clk_wzrd_probe() 211 clk_wzrd->clks_internal[wzrd_clk_mul] = clk_register_fixed_factor( clk_wzrd_probe() 213 __clk_get_name(clk_wzrd->clk_in1), clk_wzrd_probe() 216 if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul])) { clk_wzrd_probe() 218 ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul]); clk_wzrd_probe() 223 reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & clk_wzrd_probe() 231 clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_fixed_factor( clk_wzrd_probe() 233 __clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]), clk_wzrd_probe() 235 if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div])) { clk_wzrd_probe() 237 ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div]); clk_wzrd_probe() 252 reg = readl(clk_wzrd->base + WZRD_CLK_CFG_REG(2) + i * 12); clk_wzrd_probe() 255 clk_wzrd->clkout[i] = clk_register_fixed_factor(&pdev->dev, clk_wzrd_probe() 257 if (IS_ERR(clk_wzrd->clkout[i])) { clk_wzrd_probe() 261 clk_unregister(clk_wzrd->clkout[j]); clk_wzrd_probe() 264 ret = PTR_ERR(clk_wzrd->clkout[i]); clk_wzrd_probe() 271 clk_wzrd->clk_data.clks = clk_wzrd->clkout; clk_wzrd_probe() 272 clk_wzrd->clk_data.clk_num = ARRAY_SIZE(clk_wzrd->clkout); clk_wzrd_probe() 273 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_wzrd->clk_data); clk_wzrd_probe() 275 if (clk_wzrd->speed_grade) { clk_wzrd_probe() 276 clk_wzrd->nb.notifier_call = clk_wzrd_clk_notifier; clk_wzrd_probe() 278 ret = clk_notifier_register(clk_wzrd->clk_in1, clk_wzrd_probe() 279 &clk_wzrd->nb); clk_wzrd_probe() 284 ret = clk_notifier_register(clk_wzrd->axi_clk, &clk_wzrd->nb); clk_wzrd_probe() 293 clk_unregister(clk_wzrd->clks_internal[1]); clk_wzrd_probe() 296 clk_unregister(clk_wzrd->clks_internal[0]); clk_wzrd_probe() 298 clk_disable_unprepare(clk_wzrd->axi_clk); clk_wzrd_probe() 306 struct clk_wzrd *clk_wzrd = platform_get_drvdata(pdev); clk_wzrd_remove() local 311 clk_unregister(clk_wzrd->clkout[i]); clk_wzrd_remove() 313 clk_unregister(clk_wzrd->clks_internal[i]); clk_wzrd_remove() 315 if (clk_wzrd->speed_grade) { clk_wzrd_remove() 316 clk_notifier_unregister(clk_wzrd->axi_clk, &clk_wzrd->nb); clk_wzrd_remove() 317 clk_notifier_unregister(clk_wzrd->clk_in1, &clk_wzrd->nb); clk_wzrd_remove() 320 clk_disable_unprepare(clk_wzrd->axi_clk); clk_wzrd_remove()
|
Completed in 57 milliseconds