/* * sun9i_a80_get_pll4_factors() - calculates n, p, m factors for PLL4 * PLL4 rate is calculated as follows * rate = (parent_rate * n >> p) / (m + 1); * parent_rate is always 24MHz * * p and m are named div1 and div2 in Allwinner's SDK
*/
staticvoid sun9i_a80_get_pll4_factors(struct factors_request *req)
{ int n; int m = 1; int p = 1;
/* Normalize value to a 6 MHz multiple (24 MHz / 4) */
n = DIV_ROUND_UP(req->rate, 6000000);
/* If n is too large switch to steps of 12 MHz */ if (n > 255) {
m = 0;
n = (n + 1) / 2;
}
/* If n is still too large switch to steps of 24 MHz */ if (n > 255) {
p = 0;
n = (n + 1) / 2;
}
/* n must be between 12 and 255 */ if (n > 255)
n = 255; elseif (n < 12)
n = 12;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-pll4-clk: %pOFn\n",
node); 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 a80-gt-clk: %pOFn\n",
node); return;
}
/* The GT bus clock needs to be always enabled */
sunxi_factors_register_critical(node, &sun9i_a80_gt_data,
&sun9i_a80_gt_lock, reg);
}
CLK_OF_DECLARE(sun9i_a80_gt, "allwinner,sun9i-a80-gt-clk", sun9i_a80_gt_setup);
/* * sun9i_a80_get_ahb_factors() - calculates p factor for AHB0/1/2 * AHB rate is calculated as follows * rate = parent_rate >> p;
*/
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-ahb-clk: %pOFn\n",
node); 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 a80-apb0-clk: %pOFn\n",
node); 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 a80-apb1-clk: %pOFn\n",
node); return;
}
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.