blob: 770a3225e1a3bdddbad1a0319ef0e50e10f43047 [file] [log] [blame]
Masahiro Yamadae4dfb052016-02-02 21:11:32 +09001/*
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +09002 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadae4dfb052016-02-02 21:11:32 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#ifndef __CLK_UNIPHIER_H__
9#define __CLK_UNIPHIER_H__
10
11#include <linux/kernel.h>
12
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090013#define UNIPHIER_CLK_MAX_NR_MUXS 8
14
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090015struct uniphier_clk_gate_data {
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090016 unsigned int id;
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090017 unsigned int reg;
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090018 unsigned int bit;
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090019};
20
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090021struct uniphier_clk_mux_data {
22 unsigned int id;
23 unsigned int nr_muxs;
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090024 unsigned int reg;
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090025 unsigned int masks[UNIPHIER_CLK_MAX_NR_MUXS];
26 unsigned int vals[UNIPHIER_CLK_MAX_NR_MUXS];
27 unsigned long rates[UNIPHIER_CLK_MAX_NR_MUXS];
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090028};
29
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090030struct uniphier_clk_data {
Masahiro Yamada630c99f2016-09-22 07:42:20 +090031 const struct uniphier_clk_gate_data *gate;
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090032 const struct uniphier_clk_mux_data *mux;
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090033};
34
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090035#define UNIPHIER_CLK_ID_END (unsigned int)(-1)
36
37#define UNIPHIER_CLK_END \
38 { .id = UNIPHIER_CLK_ID_END }
39
40#define UNIPHIER_CLK_GATE(_id, _reg, _bit) \
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090041 { \
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090042 .id = (_id), \
43 .reg = (_reg), \
44 .bit = (_bit), \
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090045 }
46
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090047#define UNIPHIER_CLK_FIXED_RATE(_id, _rate) \
48 { \
49 .id = (_id), \
50 .rates = {(_reg),}, \
51 }
52
Masahiro Yamada644f5bf2017-08-29 01:06:15 +090053extern const struct uniphier_clk_data uniphier_pxs2_sys_clk_data;
54extern const struct uniphier_clk_data uniphier_ld20_sys_clk_data;
Masahiro Yamada8bdfe0a2016-10-17 22:18:01 +090055extern const struct uniphier_clk_data uniphier_mio_clk_data;
Masahiro Yamadae4dfb052016-02-02 21:11:32 +090056
57#endif /* __CLK_UNIPHIER_H__ */