/* These clocks can only divide, so we will never be able to achieve
* frequencies higher than the parent frequency */ if (req->rate > req->parent_rate)
req->rate = req->parent_rate;
reg = of_iomap(node, 0); if (!reg) { /* * This happens with mod0 clk nodes instantiated through * mfd, as those do not have their resources assigned at * CLK_OF_DECLARE time yet, so do not print an error.
*/ return;
}
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) {
pr_err("Could not get registers for mod0-clk: %pOFn\n",
node); return;
}
/* * We can only outphase the clocks by multiple of the * PLL's period. * * Since the MMC clock in only a divider, and the * formula to get the outphasing in degrees is deg = * 360 * delta / period * * If we simplify this formula, we can see that the * only thing that we're concerned about is the number * of period we want to outphase our clock from, and * the divider set by the MMC clock.
*/
step = DIV_ROUND_CLOSEST(360, mmc_div);
delay = DIV_ROUND_CLOSEST(degrees, step);
} else {
delay = 0;
}
spin_lock_irqsave(phase->lock, flags);
value = readl(phase->reg);
value &= ~GENMASK(phase->offset + 3, phase->offset);
value |= delay << phase->offset;
writel(value, phase->reg);
spin_unlock_irqrestore(phase->lock, flags);
/* * sunxi_mmc_setup - Common setup function for mmc module clocks * * The only difference between module clocks on different platforms is the * width of the mux register bits and the valid values, which are passed in * through struct factors_data. The phase clocks parts are identical.
*/ staticvoid __init sunxi_mmc_setup(struct device_node *node, conststruct factors_data *data,
spinlock_t *lock)
{ struct clk_onecell_data *clk_data; constchar *parent; void __iomem *reg; int i;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) {
pr_err("Couldn't map the %pOFn clock registers\n", node); return;
}
clk_data = kmalloc(sizeof(*clk_data), GFP_KERNEL); if (!clk_data) return;
clk_data->clks = kcalloc(3, sizeof(*clk_data->clks), GFP_KERNEL); if (!clk_data->clks) goto err_free_data;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.