| .. | .. |
|---|
| 91 | 91 | return 0; |
|---|
| 92 | 92 | } |
|---|
| 93 | 93 | |
|---|
| 94 | +/** |
|---|
| 95 | + * clk_mux_save_context - Save the parent selcted in the mux |
|---|
| 96 | + * @hw: pointer struct clk_hw |
|---|
| 97 | + * |
|---|
| 98 | + * Save the parent mux value. |
|---|
| 99 | + */ |
|---|
| 100 | +static int clk_mux_save_context(struct clk_hw *hw) |
|---|
| 101 | +{ |
|---|
| 102 | + struct clk_omap_mux *mux = to_clk_omap_mux(hw); |
|---|
| 103 | + |
|---|
| 104 | + mux->saved_parent = ti_clk_mux_get_parent(hw); |
|---|
| 105 | + return 0; |
|---|
| 106 | +} |
|---|
| 107 | + |
|---|
| 108 | +/** |
|---|
| 109 | + * clk_mux_restore_context - Restore the parent in the mux |
|---|
| 110 | + * @hw: pointer struct clk_hw |
|---|
| 111 | + * |
|---|
| 112 | + * Restore the saved parent mux value. |
|---|
| 113 | + */ |
|---|
| 114 | +static void clk_mux_restore_context(struct clk_hw *hw) |
|---|
| 115 | +{ |
|---|
| 116 | + struct clk_omap_mux *mux = to_clk_omap_mux(hw); |
|---|
| 117 | + |
|---|
| 118 | + ti_clk_mux_set_parent(hw, mux->saved_parent); |
|---|
| 119 | +} |
|---|
| 120 | + |
|---|
| 94 | 121 | const struct clk_ops ti_clk_mux_ops = { |
|---|
| 95 | 122 | .get_parent = ti_clk_mux_get_parent, |
|---|
| 96 | 123 | .set_parent = ti_clk_mux_set_parent, |
|---|
| 97 | 124 | .determine_rate = __clk_mux_determine_rate, |
|---|
| 125 | + .save_context = clk_mux_save_context, |
|---|
| 126 | + .restore_context = clk_mux_restore_context, |
|---|
| 98 | 127 | }; |
|---|
| 99 | 128 | |
|---|
| 100 | 129 | static struct clk *_register_mux(struct device *dev, const char *name, |
|---|
| .. | .. |
|---|
| 105 | 134 | { |
|---|
| 106 | 135 | struct clk_omap_mux *mux; |
|---|
| 107 | 136 | struct clk *clk; |
|---|
| 108 | | - struct clk_init_data init = {}; |
|---|
| 137 | + struct clk_init_data init; |
|---|
| 109 | 138 | |
|---|
| 110 | 139 | /* allocate the mux */ |
|---|
| 111 | 140 | mux = kzalloc(sizeof(*mux), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 114 | 143 | |
|---|
| 115 | 144 | init.name = name; |
|---|
| 116 | 145 | init.ops = &ti_clk_mux_ops; |
|---|
| 117 | | - init.flags = flags | CLK_IS_BASIC; |
|---|
| 146 | + init.flags = flags; |
|---|
| 118 | 147 | init.parent_names = parent_names; |
|---|
| 119 | 148 | init.num_parents = num_parents; |
|---|
| 120 | 149 | |
|---|
| .. | .. |
|---|
| 133 | 162 | kfree(mux); |
|---|
| 134 | 163 | |
|---|
| 135 | 164 | return clk; |
|---|
| 136 | | -} |
|---|
| 137 | | - |
|---|
| 138 | | -struct clk *ti_clk_register_mux(struct ti_clk *setup) |
|---|
| 139 | | -{ |
|---|
| 140 | | - struct ti_clk_mux *mux; |
|---|
| 141 | | - u32 flags; |
|---|
| 142 | | - u8 mux_flags = 0; |
|---|
| 143 | | - struct clk_omap_reg reg; |
|---|
| 144 | | - u32 mask; |
|---|
| 145 | | - |
|---|
| 146 | | - mux = setup->data; |
|---|
| 147 | | - flags = CLK_SET_RATE_NO_REPARENT; |
|---|
| 148 | | - |
|---|
| 149 | | - mask = mux->num_parents; |
|---|
| 150 | | - if (!(mux->flags & CLKF_INDEX_STARTS_AT_ONE)) |
|---|
| 151 | | - mask--; |
|---|
| 152 | | - |
|---|
| 153 | | - mask = (1 << fls(mask)) - 1; |
|---|
| 154 | | - reg.index = mux->module; |
|---|
| 155 | | - reg.offset = mux->reg; |
|---|
| 156 | | - reg.ptr = NULL; |
|---|
| 157 | | - |
|---|
| 158 | | - if (mux->flags & CLKF_INDEX_STARTS_AT_ONE) |
|---|
| 159 | | - mux_flags |= CLK_MUX_INDEX_ONE; |
|---|
| 160 | | - |
|---|
| 161 | | - if (mux->flags & CLKF_SET_RATE_PARENT) |
|---|
| 162 | | - flags |= CLK_SET_RATE_PARENT; |
|---|
| 163 | | - |
|---|
| 164 | | - return _register_mux(NULL, setup->name, mux->parents, mux->num_parents, |
|---|
| 165 | | - flags, ®, mux->bit_shift, mask, -EINVAL, |
|---|
| 166 | | - mux_flags, NULL); |
|---|
| 167 | 165 | } |
|---|
| 168 | 166 | |
|---|
| 169 | 167 | /** |
|---|
| .. | .. |
|---|
| 186 | 184 | |
|---|
| 187 | 185 | num_parents = of_clk_get_parent_count(node); |
|---|
| 188 | 186 | if (num_parents < 2) { |
|---|
| 189 | | - pr_err("mux-clock %s must have parents\n", node->name); |
|---|
| 187 | + pr_err("mux-clock %pOFn must have parents\n", node); |
|---|
| 190 | 188 | return; |
|---|
| 191 | 189 | } |
|---|
| 192 | 190 | parent_names = kzalloc((sizeof(char *) * num_parents), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 278 | 276 | num_parents = of_clk_get_parent_count(node); |
|---|
| 279 | 277 | |
|---|
| 280 | 278 | if (num_parents < 2) { |
|---|
| 281 | | - pr_err("%s must have parents\n", node->name); |
|---|
| 279 | + pr_err("%pOFn must have parents\n", node); |
|---|
| 282 | 280 | goto cleanup; |
|---|
| 283 | 281 | } |
|---|
| 284 | 282 | |
|---|