blob: 18e6856709255b297eebf4016187935083c5a396 [file] [log] [blame]
Masahiro Yamada48264d92016-02-02 21:11:32 +09001/*
Masahiro Yamada4e3d8402016-07-19 21:56:13 +09002 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada48264d92016-02-02 21:11:32 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamada48264d92016-02-02 21:11:32 +09008#include "clk-uniphier.h"
9
Masahiro Yamada805dc442016-10-17 22:18:01 +090010#define UNIPHIER_MIO_CLK_SD_GATE(id, ch) \
11 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 8)
Masahiro Yamada48264d92016-02-02 21:11:32 +090012
Masahiro Yamada805dc442016-10-17 22:18:01 +090013#define UNIPHIER_MIO_CLK_USB2(id, ch) \
14 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 28)
Masahiro Yamada48264d92016-02-02 21:11:32 +090015
Masahiro Yamada805dc442016-10-17 22:18:01 +090016#define UNIPHIER_MIO_CLK_USB2_PHY(id, ch) \
17 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 29)
Masahiro Yamada48264d92016-02-02 21:11:32 +090018
Masahiro Yamada805dc442016-10-17 22:18:01 +090019#define UNIPHIER_MIO_CLK_DMAC(id) \
20 UNIPHIER_CLK_GATE((id), 0x20, 25)
21
22#define UNIPHIER_MIO_CLK_SD_MUX(_id, ch) \
23 { \
24 .id = (_id), \
25 .nr_muxs = 8, \
26 .reg = 0x30 + 0x200 * (ch), \
27 .masks = { \
28 0x00031000, \
29 0x00031000, \
30 0x00031000, \
31 0x00031000, \
32 0x00001300, \
33 0x00001300, \
34 0x00001300, \
35 0x00001300, \
36 }, \
37 .vals = { \
38 0x00000000, \
39 0x00010000, \
40 0x00020000, \
41 0x00030000, \
42 0x00001000, \
43 0x00001100, \
44 0x00001200, \
45 0x00001300, \
46 }, \
47 .rates = { \
48 44444444, \
49 33333333, \
50 50000000, \
51 66666666, \
52 100000000, \
53 40000000, \
54 25000000, \
55 22222222, \
56 }, \
Masahiro Yamada48264d92016-02-02 21:11:32 +090057 }
58
Masahiro Yamada3524d472016-09-22 07:42:20 +090059static const struct uniphier_clk_gate_data uniphier_mio_clk_gate[] = {
Masahiro Yamada805dc442016-10-17 22:18:01 +090060 UNIPHIER_MIO_CLK_SD_GATE(0, 0),
61 UNIPHIER_MIO_CLK_SD_GATE(1, 1),
62 UNIPHIER_MIO_CLK_SD_GATE(2, 2), /* for PH1-Pro4 only */
63 UNIPHIER_MIO_CLK_DMAC(7),
64 UNIPHIER_MIO_CLK_USB2(8, 0),
65 UNIPHIER_MIO_CLK_USB2(9, 1),
66 UNIPHIER_MIO_CLK_USB2(10, 2),
67 UNIPHIER_MIO_CLK_USB2(11, 3), /* for PH1-sLD3 only */
68 UNIPHIER_MIO_CLK_USB2_PHY(12, 0),
69 UNIPHIER_MIO_CLK_USB2_PHY(13, 1),
70 UNIPHIER_MIO_CLK_USB2_PHY(14, 2),
71 UNIPHIER_MIO_CLK_USB2_PHY(15, 3), /* for PH1-sLD3 only */
72 UNIPHIER_CLK_END
Masahiro Yamada48264d92016-02-02 21:11:32 +090073};
74
Masahiro Yamada805dc442016-10-17 22:18:01 +090075static const struct uniphier_clk_mux_data uniphier_mio_clk_mux[] = {
76 UNIPHIER_MIO_CLK_SD_MUX(0, 0),
77 UNIPHIER_MIO_CLK_SD_MUX(1, 1),
78 UNIPHIER_MIO_CLK_SD_MUX(2, 2), /* for PH1-Pro4 only */
79 UNIPHIER_CLK_END
Masahiro Yamada48264d92016-02-02 21:11:32 +090080};
81
Masahiro Yamada805dc442016-10-17 22:18:01 +090082const struct uniphier_clk_data uniphier_mio_clk_data = {
Masahiro Yamada48264d92016-02-02 21:11:32 +090083 .gate = uniphier_mio_clk_gate,
Masahiro Yamada805dc442016-10-17 22:18:01 +090084 .mux = uniphier_mio_clk_mux,
Masahiro Yamada48264d92016-02-02 21:11:32 +090085};