// API call u32 SBUS_get_reg(int reg_no) { return(_get_reg((u32 *) R_LOCAL_SBUS(reg_no))); }
struct clk *ti_clk_register_dpll(struct ti_clk *setup) { struct clk_hw_omap *clk_hw; struct clk_init_data init = { NULL }; struct dpll_data *dd; struct clk *clk; struct ti_clk_dpll *dpll; const struct clk_ops *ops = &omap3_dpll_ck_ops; struct clk *clk_ref; struct clk *clk_bypass; dpll = setup->data; if (dpll->num_parents < 2) return ERR_PTR(-EINVAL); clk_ref = clk_get_sys(NULL, dpll->parents[0]); clk_bypass = clk_get_sys(NULL, dpll->parents[1]); if (IS_ERR_OR_NULL(clk_ref) || IS_ERR_OR_NULL(clk_bypass)) return ERR_PTR(-EAGAIN); dd = kzalloc(sizeof(*dd), GFP_KERNEL); clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); if (!dd || !clk_hw) { clk = ERR_PTR(-ENOMEM); goto cleanup; } clk_hw->dpll_data = dd; clk_hw->ops = &clkhwops_omap3_dpll; clk_hw->hw.init = &init; clk_hw->flags = MEMMAP_ADDRESSING; init.name = setup->name; init.ops = ops; init.num_parents = dpll->num_parents; init.parent_names = dpll->parents; dd->control_reg = _get_reg(dpll->module, dpll->control_reg); dd->idlest_reg = _get_reg(dpll->module, dpll->idlest_reg); dd->mult_div1_reg = _get_reg(dpll->module, dpll->mult_div1_reg); dd->autoidle_reg = _get_reg(dpll->module, dpll->autoidle_reg); dd->modes = dpll->modes; dd->div1_mask = dpll->div1_mask; dd->idlest_mask = dpll->idlest_mask; dd->mult_mask = dpll->mult_mask; dd->autoidle_mask = dpll->autoidle_mask; dd->enable_mask = dpll->enable_mask; dd->sddiv_mask = dpll->sddiv_mask; dd->dco_mask = dpll->dco_mask; dd->max_divider = dpll->max_divider; dd->min_divider = dpll->min_divider; dd->max_multiplier = dpll->max_multiplier; dd->auto_recal_bit = dpll->auto_recal_bit; dd->recal_en_bit = dpll->recal_en_bit; dd->recal_st_bit = dpll->recal_st_bit; dd->clk_ref = clk_ref; dd->clk_bypass = clk_bypass; if (dpll->flags & CLKF_CORE) ops = &omap3_dpll_core_ck_ops; if (dpll->flags & CLKF_PER) ops = &omap3_dpll_per_ck_ops; if (dpll->flags & CLKF_J_TYPE) dd->flags |= DPLL_J_TYPE; clk = clk_register(NULL, &clk_hw->hw); if (!IS_ERR(clk)) return clk; cleanup: kfree(dd); kfree(clk_hw); return clk; }
static void _set_reg(u32 *reg, u32 val) { *(vu32 *) (reg) = val; _get_reg(reg); }