| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2014 Lucas Stach <l.stach@pengutronix.de>, Pengutronix |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * http://www.opensource.org/licenses/gpl-license.html |
|---|
| 9 | | - * http://www.gnu.org/copyleft/gpl.html |
|---|
| 10 | 4 | */ |
|---|
| 11 | 5 | |
|---|
| 12 | 6 | #include <linux/clk.h> |
|---|
| 13 | 7 | #include <linux/clk-provider.h> |
|---|
| 8 | +#include <linux/export.h> |
|---|
| 14 | 9 | #include <linux/slab.h> |
|---|
| 15 | 10 | #include "clk.h" |
|---|
| 16 | 11 | |
|---|
| .. | .. |
|---|
| 75 | 70 | .set_rate = clk_cpu_set_rate, |
|---|
| 76 | 71 | }; |
|---|
| 77 | 72 | |
|---|
| 78 | | -struct clk *imx_clk_cpu(const char *name, const char *parent_name, |
|---|
| 73 | +struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name, |
|---|
| 79 | 74 | struct clk *div, struct clk *mux, struct clk *pll, |
|---|
| 80 | 75 | struct clk *step) |
|---|
| 81 | 76 | { |
|---|
| 82 | 77 | struct clk_cpu *cpu; |
|---|
| 83 | | - struct clk *clk; |
|---|
| 84 | | - struct clk_init_data init = {}; |
|---|
| 78 | + struct clk_hw *hw; |
|---|
| 79 | + struct clk_init_data init; |
|---|
| 80 | + int ret; |
|---|
| 85 | 81 | |
|---|
| 86 | 82 | cpu = kzalloc(sizeof(*cpu), GFP_KERNEL); |
|---|
| 87 | 83 | if (!cpu) |
|---|
| .. | .. |
|---|
| 94 | 90 | |
|---|
| 95 | 91 | init.name = name; |
|---|
| 96 | 92 | init.ops = &clk_cpu_ops; |
|---|
| 97 | | - init.flags = 0; |
|---|
| 93 | + init.flags = CLK_IS_CRITICAL; |
|---|
| 98 | 94 | init.parent_names = &parent_name; |
|---|
| 99 | 95 | init.num_parents = 1; |
|---|
| 100 | 96 | |
|---|
| 101 | 97 | cpu->hw.init = &init; |
|---|
| 98 | + hw = &cpu->hw; |
|---|
| 102 | 99 | |
|---|
| 103 | | - clk = clk_register(NULL, &cpu->hw); |
|---|
| 104 | | - if (IS_ERR(clk)) |
|---|
| 100 | + ret = clk_hw_register(NULL, hw); |
|---|
| 101 | + if (ret) { |
|---|
| 105 | 102 | kfree(cpu); |
|---|
| 103 | + return ERR_PTR(ret); |
|---|
| 104 | + } |
|---|
| 106 | 105 | |
|---|
| 107 | | - return clk; |
|---|
| 106 | + return hw; |
|---|
| 108 | 107 | } |
|---|
| 108 | +EXPORT_SYMBOL_GPL(imx_clk_hw_cpu); |
|---|