summaryrefslogtreecommitdiff
path: root/drivers/clk/uniphier/clk-uniphier-mio.c
blob: 5c7384840280efa9954c466e5d532cb36436c30e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright (C) 2016 Socionext Inc.
 *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include "clk-uniphier.h"

#define UNIPHIER_MIO_CLK_SD_FIXED					\
	UNIPHIER_CLK_RATE(128, 44444444),				\
	UNIPHIER_CLK_RATE(129, 33333333),				\
	UNIPHIER_CLK_RATE(130, 50000000),				\
	UNIPHIER_CLK_RATE(131, 66666667),				\
	UNIPHIER_CLK_RATE(132, 100000000),				\
	UNIPHIER_CLK_RATE(133, 40000000),				\
	UNIPHIER_CLK_RATE(134, 25000000),				\
	UNIPHIER_CLK_RATE(135, 22222222)

#define UNIPHIER_MIO_CLK_SD(_id, ch)					\
	{								\
		.type = UNIPHIER_CLK_TYPE_MUX,				\
		.id = (_id) + 32,					\
		.data.mux = {						\
			.parent_ids = {					\
				128,					\
				129,					\
				130,					\
				131,					\
				132,					\
				133,					\
				134,					\
				135,					\
			},						\
			.num_parents = 8,				\
			.reg = 0x30 + 0x200 * (ch),			\
			.masks = {					\
				0x00031000,				\
				0x00031000,				\
				0x00031000,				\
				0x00031000,				\
				0x00001300,				\
				0x00001300,				\
				0x00001300,				\
				0x00001300,				\
			},						\
			.vals = {					\
				0x00000000,				\
				0x00010000,				\
				0x00020000,				\
				0x00030000,				\
				0x00001000,				\
				0x00001100,				\
				0x00001200,				\
				0x00001300,				\
			},						\
		},							\
	},								\
	UNIPHIER_CLK_GATE((_id), (_id) + 32, 0x20 + 0x200 * (ch), 8)

#define UNIPHIER_MIO_CLK_USB2(id, ch)					\
	UNIPHIER_CLK_GATE_SIMPLE((id), 0x20 + 0x200 * (ch), 28)

#define UNIPHIER_MIO_CLK_USB2_PHY(id, ch)				\
	UNIPHIER_CLK_GATE_SIMPLE((id), 0x20 + 0x200 * (ch), 29)

#define UNIPHIER_MIO_CLK_DMAC(id)					\
	UNIPHIER_CLK_GATE_SIMPLE((id), 0x20, 25)

const struct uniphier_clk_data uniphier_mio_clk_data[] = {
	UNIPHIER_MIO_CLK_SD_FIXED,
	UNIPHIER_MIO_CLK_SD(0, 0),
	UNIPHIER_MIO_CLK_SD(1, 1),
	UNIPHIER_MIO_CLK_SD(2, 2),
	UNIPHIER_MIO_CLK_DMAC(7),
	UNIPHIER_MIO_CLK_USB2(8, 0),
	UNIPHIER_MIO_CLK_USB2(9, 1),
	UNIPHIER_MIO_CLK_USB2(10, 2),
	UNIPHIER_MIO_CLK_USB2_PHY(12, 0),
	UNIPHIER_MIO_CLK_USB2_PHY(13, 1),
	UNIPHIER_MIO_CLK_USB2_PHY(14, 2),
	{ /* sentinel */ }
};