| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2011-2012 Calxeda, Inc. |
|---|
| 3 | 4 | * Copyright (C) 2012-2013 Altera Corporation <www.altera.com> |
|---|
| 4 | 5 | * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | | - * (at your option) any later version. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | 6 | * Based from clk-highbank.c |
|---|
| 16 | | - * |
|---|
| 17 | 7 | */ |
|---|
| 18 | 8 | #include <linux/slab.h> |
|---|
| 19 | 9 | #include <linux/clk-provider.h> |
|---|
| .. | .. |
|---|
| 75 | 65 | CLK_MGR_PLL_CLK_SRC_MASK; |
|---|
| 76 | 66 | } |
|---|
| 77 | 67 | |
|---|
| 78 | | -static struct clk_ops clk_pll_ops = { |
|---|
| 68 | +static const struct clk_ops clk_pll_ops = { |
|---|
| 79 | 69 | .recalc_rate = clk_pll_recalc_rate, |
|---|
| 80 | 70 | .get_parent = clk_pll_get_parent, |
|---|
| 81 | 71 | }; |
|---|
| 82 | 72 | |
|---|
| 83 | | -static __init struct clk *__socfpga_pll_init(struct device_node *node, |
|---|
| 73 | +static __init struct clk_hw *__socfpga_pll_init(struct device_node *node, |
|---|
| 84 | 74 | const struct clk_ops *ops) |
|---|
| 85 | 75 | { |
|---|
| 86 | 76 | u32 reg; |
|---|
| 87 | | - struct clk *clk; |
|---|
| 77 | + struct clk_hw *hw_clk; |
|---|
| 88 | 78 | struct socfpga_pll *pll_clk; |
|---|
| 89 | 79 | const char *clk_name = node->name; |
|---|
| 90 | 80 | const char *parent_name[SOCFPGA_MAX_PARENTS]; |
|---|
| 91 | | - struct clk_init_data init = {}; |
|---|
| 81 | + struct clk_init_data init; |
|---|
| 92 | 82 | struct device_node *clkmgr_np; |
|---|
| 93 | 83 | int rc; |
|---|
| 84 | + int err; |
|---|
| 94 | 85 | |
|---|
| 95 | 86 | of_property_read_u32(node, "reg", ®); |
|---|
| 96 | 87 | |
|---|
| .. | .. |
|---|
| 115 | 106 | pll_clk->hw.hw.init = &init; |
|---|
| 116 | 107 | |
|---|
| 117 | 108 | pll_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA; |
|---|
| 118 | | - clk_pll_ops.enable = clk_gate_ops.enable; |
|---|
| 119 | | - clk_pll_ops.disable = clk_gate_ops.disable; |
|---|
| 120 | 109 | |
|---|
| 121 | | - clk = clk_register(NULL, &pll_clk->hw.hw); |
|---|
| 122 | | - if (WARN_ON(IS_ERR(clk))) { |
|---|
| 110 | + hw_clk = &pll_clk->hw.hw; |
|---|
| 111 | + |
|---|
| 112 | + err = clk_hw_register(NULL, hw_clk); |
|---|
| 113 | + if (err) { |
|---|
| 123 | 114 | kfree(pll_clk); |
|---|
| 124 | | - return NULL; |
|---|
| 115 | + return ERR_PTR(err); |
|---|
| 125 | 116 | } |
|---|
| 126 | | - rc = of_clk_add_provider(node, of_clk_src_simple_get, clk); |
|---|
| 127 | | - return clk; |
|---|
| 117 | + rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); |
|---|
| 118 | + return hw_clk; |
|---|
| 128 | 119 | } |
|---|
| 129 | 120 | |
|---|
| 130 | 121 | void __init socfpga_pll_init(struct device_node *node) |
|---|