| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * clk-h32mx.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Atmel |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | 8 | */ |
|---|
| 14 | 9 | |
|---|
| 15 | 10 | #include <linux/clk-provider.h> |
|---|
| .. | .. |
|---|
| 86 | 81 | .set_rate = clk_sama5d4_h32mx_set_rate, |
|---|
| 87 | 82 | }; |
|---|
| 88 | 83 | |
|---|
| 89 | | -static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np) |
|---|
| 84 | +struct clk_hw * __init |
|---|
| 85 | +at91_clk_register_h32mx(struct regmap *regmap, const char *name, |
|---|
| 86 | + const char *parent_name) |
|---|
| 90 | 87 | { |
|---|
| 91 | 88 | struct clk_sama5d4_h32mx *h32mxclk; |
|---|
| 92 | | - struct clk_init_data init = {}; |
|---|
| 93 | | - const char *parent_name; |
|---|
| 94 | | - struct regmap *regmap; |
|---|
| 89 | + struct clk_init_data init; |
|---|
| 95 | 90 | int ret; |
|---|
| 96 | | - |
|---|
| 97 | | - regmap = syscon_node_to_regmap(of_get_parent(np)); |
|---|
| 98 | | - if (IS_ERR(regmap)) |
|---|
| 99 | | - return; |
|---|
| 100 | 91 | |
|---|
| 101 | 92 | h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL); |
|---|
| 102 | 93 | if (!h32mxclk) |
|---|
| 103 | | - return; |
|---|
| 94 | + return ERR_PTR(-ENOMEM); |
|---|
| 104 | 95 | |
|---|
| 105 | | - parent_name = of_clk_get_parent_name(np, 0); |
|---|
| 106 | | - |
|---|
| 107 | | - init.name = np->name; |
|---|
| 96 | + init.name = name; |
|---|
| 108 | 97 | init.ops = &h32mx_ops; |
|---|
| 109 | 98 | init.parent_names = parent_name ? &parent_name : NULL; |
|---|
| 110 | 99 | init.num_parents = parent_name ? 1 : 0; |
|---|
| .. | .. |
|---|
| 116 | 105 | ret = clk_hw_register(NULL, &h32mxclk->hw); |
|---|
| 117 | 106 | if (ret) { |
|---|
| 118 | 107 | kfree(h32mxclk); |
|---|
| 119 | | - return; |
|---|
| 108 | + return ERR_PTR(ret); |
|---|
| 120 | 109 | } |
|---|
| 121 | 110 | |
|---|
| 122 | | - of_clk_add_hw_provider(np, of_clk_hw_simple_get, &h32mxclk->hw); |
|---|
| 111 | + return &h32mxclk->hw; |
|---|
| 123 | 112 | } |
|---|
| 124 | | -CLK_OF_DECLARE(of_sama5d4_clk_h32mx_setup, "atmel,sama5d4-clk-h32mx", |
|---|
| 125 | | - of_sama5d4_clk_h32mx_setup); |
|---|