Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 4e3d840 | 2016-07-19 21:56:13 +0900 | [diff] [blame] | 2 | * Copyright (C) 2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 8 | #include "clk-uniphier.h" |
| 9 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 10 | #define UNIPHIER_MIO_CLK_SD_GATE(id, ch) \ |
| 11 | UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 8) |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 12 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 13 | #define UNIPHIER_MIO_CLK_USB2(id, ch) \ |
| 14 | UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 28) |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 15 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 16 | #define UNIPHIER_MIO_CLK_USB2_PHY(id, ch) \ |
| 17 | UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 29) |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 18 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 19 | #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 Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 57 | } |
| 58 | |
Masahiro Yamada | 3524d47 | 2016-09-22 07:42:20 +0900 | [diff] [blame] | 59 | static const struct uniphier_clk_gate_data uniphier_mio_clk_gate[] = { |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 60 | 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 Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 73 | }; |
| 74 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 75 | static 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 Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 80 | }; |
| 81 | |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 82 | const struct uniphier_clk_data uniphier_mio_clk_data = { |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 83 | .gate = uniphier_mio_clk_gate, |
Masahiro Yamada | 805dc44 | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 84 | .mux = uniphier_mio_clk_mux, |
Masahiro Yamada | 48264d9 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 85 | }; |