/* Allow regmap to be preset as it was historically done */ if (clk->map) return 0;
/* * FIXME: what follows couples the controller implementation * and clk_regmap clock type. This situation is not desirable * but temporary, until the controller is able to register * a hook to initialize a clock type
*/
/* Check the usual dev enabled controller with an basic IO regmap */
dev = clk_hw_get_dev(hw); if (dev) {
clk->map = dev_get_regmap(dev, NULL); if (clk->map) return 0;
}
/* Move on to early and syscon based controllers */
np = clk_hw_get_of_node(hw); if (np) {
parent_np = of_get_parent(np);
clk->map = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (!IS_ERR_OR_NULL(clk->map)) return 0;
}
/* Bail out if regmap can't be found */ return -EINVAL;
}
EXPORT_SYMBOL_NS_GPL(clk_regmap_init, "CLK_MESON");
staticint clk_regmap_gate_endisable(struct clk_hw *hw, int enable)
{ struct clk_regmap *clk = to_clk_regmap(hw); struct clk_regmap_gate_data *gate = clk_get_regmap_gate_data(clk); int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0;
set ^= enable;
return regmap_update_bits(clk->map, gate->offset, BIT(gate->bit_idx),
set ? BIT(gate->bit_idx) : 0);
}
/* if read only, just return current value */ if (div->flags & CLK_DIVIDER_READ_ONLY) {
ret = regmap_read(clk->map, div->offset, &val); if (ret) return ret;
val >>= div->shift;
val &= clk_div_mask(div->width);
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.