mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-08 22:03:22 +09:00
![Masahiro Yamada](/assets/img/avatar_default.png)
The initial design of the UniPhier clk driver for U-Boot was not very nice. Here is a re-work to sync it with Linux's clk and reset drivers, maximizing the code reuse from Linux's clk data. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2016 Socionext Inc.
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#ifndef __CLK_UNIPHIER_H__
|
|
#define __CLK_UNIPHIER_H__
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#define UNIPHIER_CLK_MAX_NR_MUXS 8
|
|
|
|
struct uniphier_clk_gate_data {
|
|
unsigned int id;
|
|
unsigned int reg;
|
|
unsigned int bit;
|
|
};
|
|
|
|
struct uniphier_clk_mux_data {
|
|
unsigned int id;
|
|
unsigned int nr_muxs;
|
|
unsigned int reg;
|
|
unsigned int masks[UNIPHIER_CLK_MAX_NR_MUXS];
|
|
unsigned int vals[UNIPHIER_CLK_MAX_NR_MUXS];
|
|
unsigned long rates[UNIPHIER_CLK_MAX_NR_MUXS];
|
|
};
|
|
|
|
struct uniphier_clk_data {
|
|
const struct uniphier_clk_gate_data *gate;
|
|
const struct uniphier_clk_mux_data *mux;
|
|
};
|
|
|
|
#define UNIPHIER_CLK_ID_END (unsigned int)(-1)
|
|
|
|
#define UNIPHIER_CLK_END \
|
|
{ .id = UNIPHIER_CLK_ID_END }
|
|
|
|
#define UNIPHIER_CLK_GATE(_id, _reg, _bit) \
|
|
{ \
|
|
.id = (_id), \
|
|
.reg = (_reg), \
|
|
.bit = (_bit), \
|
|
}
|
|
|
|
#define UNIPHIER_CLK_FIXED_RATE(_id, _rate) \
|
|
{ \
|
|
.id = (_id), \
|
|
.rates = {(_reg),}, \
|
|
}
|
|
|
|
extern const struct uniphier_clk_data uniphier_mio_clk_data;
|
|
|
|
#endif /* __CLK_UNIPHIER_H__ */
|