2 * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
4 * SPDX-License-Identifier: GPL-2.0+
9 #include "clk-uniphier.h"
11 #define UNIPHIER_MIO_CLK_GATE_SD(ch, idx) \
14 .reg = 0x20 + 0x200 * (ch), \
20 .reg = 0x110 + 0x200 * (ch), \
25 #define UNIPHIER_MIO_CLK_RATE_SD(ch, idx) \
28 .reg = 0x30 + 0x200 * (ch), \
35 .reg = 0x30 + 0x200 * (ch), \
42 .reg = 0x30 + 0x200 * (ch), \
49 .reg = 0x30 + 0x200 * (ch), \
56 .reg = 0x30 + 0x200 * (ch), \
63 .reg = 0x30 + 0x200 * (ch), \
70 .reg = 0x30 + 0x200 * (ch), \
77 .reg = 0x30 + 0x200 * (ch), \
83 #define UNIPHIER_MIO_CLK_GATE_USB(ch, idx) \
86 .reg = 0x20 + 0x200 * (ch), \
92 .reg = 0x110 + 0x200 * (ch), \
98 .reg = 0x114 + 0x200 * (ch), \
100 .data = 0x00000001, \
103 #define UNIPHIER_MIO_CLK_GATE_DMAC(idx) \
107 .mask = 0x02000000, \
108 .data = 0x02000000, \
113 .mask = 0x00020000, \
114 .data = 0x00020000, \
117 static struct uniphier_clk_gate_data uniphier_mio_clk_gate[] = {
118 UNIPHIER_MIO_CLK_GATE_SD(0, 0),
119 UNIPHIER_MIO_CLK_GATE_SD(1, 1),
120 UNIPHIER_MIO_CLK_GATE_SD(2, 2), /* for PH1-Pro4 only */
121 UNIPHIER_MIO_CLK_GATE_USB(0, 3),
122 UNIPHIER_MIO_CLK_GATE_USB(1, 4),
123 UNIPHIER_MIO_CLK_GATE_USB(2, 5),
124 UNIPHIER_MIO_CLK_GATE_DMAC(6),
125 UNIPHIER_MIO_CLK_GATE_USB(3, 7), /* for PH1-sLD3 only */
128 static struct uniphier_clk_rate_data uniphier_mio_clk_rate[] = {
129 UNIPHIER_MIO_CLK_RATE_SD(0, 0),
130 UNIPHIER_MIO_CLK_RATE_SD(1, 1),
131 UNIPHIER_MIO_CLK_RATE_SD(2, 2), /* for PH1-Pro4 only */
134 static struct uniphier_clk_soc_data uniphier_mio_clk_data = {
135 .gate = uniphier_mio_clk_gate,
136 .nr_gate = ARRAY_SIZE(uniphier_mio_clk_gate),
137 .rate = uniphier_mio_clk_rate,
138 .nr_rate = ARRAY_SIZE(uniphier_mio_clk_rate),
141 static const struct udevice_id uniphier_mio_clk_match[] = {
143 .compatible = "socionext,ph1-sld3-mioctrl",
144 .data = (ulong)&uniphier_mio_clk_data,
147 .compatible = "socionext,ph1-ld4-mioctrl",
148 .data = (ulong)&uniphier_mio_clk_data,
151 .compatible = "socionext,ph1-pro4-mioctrl",
152 .data = (ulong)&uniphier_mio_clk_data,
155 .compatible = "socionext,ph1-sld8-mioctrl",
156 .data = (ulong)&uniphier_mio_clk_data,
159 .compatible = "socionext,ph1-pro5-mioctrl",
160 .data = (ulong)&uniphier_mio_clk_data,
163 .compatible = "socionext,proxstream2-mioctrl",
164 .data = (ulong)&uniphier_mio_clk_data,
167 .compatible = "socionext,ph1-ld11-mioctrl",
168 .data = (ulong)&uniphier_mio_clk_data,
171 .compatible = "socionext,ph1-ld20-mioctrl",
172 .data = (ulong)&uniphier_mio_clk_data,
177 U_BOOT_DRIVER(uniphier_mio_clk) = {
178 .name = "uniphier-mio-clk",
180 .of_match = uniphier_mio_clk_match,
181 .probe = uniphier_clk_probe,
182 .remove = uniphier_clk_remove,
183 .priv_auto_alloc_size = sizeof(struct uniphier_clk_priv),
184 .ops = &uniphier_clk_ops,