1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
7 #include <linux/clk-provider.h>
8 #include <linux/device.h>
10 #include "clk-uniphier.h"
12 struct clk_hw
*uniphier_clk_register_fixed_factor(struct device
*dev
,
14 const struct uniphier_clk_fixed_factor_data
*data
)
16 struct clk_fixed_factor
*fix
;
17 struct clk_init_data init
;
20 fix
= devm_kzalloc(dev
, sizeof(*fix
), GFP_KERNEL
);
22 return ERR_PTR(-ENOMEM
);
25 init
.ops
= &clk_fixed_factor_ops
;
26 init
.flags
= data
->parent_name
? CLK_SET_RATE_PARENT
: 0;
27 init
.parent_names
= data
->parent_name
? &data
->parent_name
: NULL
;
28 init
.num_parents
= data
->parent_name
? 1 : 0;
30 fix
->mult
= data
->mult
;
34 ret
= devm_clk_hw_register(dev
, &fix
->hw
);