rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include "clk-uniphier.h" |
| 17 | |
| 18 | #define UNIPHIER_MIO_CLK_SD_FIXED \ |
| 19 | UNIPHIER_CLK_FACTOR("sd-44m", -1, "sd-133m", 1, 3), \ |
| 20 | UNIPHIER_CLK_FACTOR("sd-33m", -1, "sd-200m", 1, 6), \ |
| 21 | UNIPHIER_CLK_FACTOR("sd-50m", -1, "sd-200m", 1, 4), \ |
| 22 | UNIPHIER_CLK_FACTOR("sd-67m", -1, "sd-200m", 1, 3), \ |
| 23 | UNIPHIER_CLK_FACTOR("sd-100m", -1, "sd-200m", 1, 2), \ |
| 24 | UNIPHIER_CLK_FACTOR("sd-40m", -1, "sd-200m", 1, 5), \ |
| 25 | UNIPHIER_CLK_FACTOR("sd-25m", -1, "sd-200m", 1, 8), \ |
| 26 | UNIPHIER_CLK_FACTOR("sd-22m", -1, "sd-133m", 1, 6) |
| 27 | |
| 28 | #define UNIPHIER_MIO_CLK_SD(_idx, ch) \ |
| 29 | { \ |
| 30 | .name = "sd" #ch "-sel", \ |
| 31 | .type = UNIPHIER_CLK_TYPE_MUX, \ |
| 32 | .idx = -1, \ |
| 33 | .data.mux = { \ |
| 34 | .parent_names = { \ |
| 35 | "sd-44m", \ |
| 36 | "sd-33m", \ |
| 37 | "sd-50m", \ |
| 38 | "sd-67m", \ |
| 39 | "sd-100m", \ |
| 40 | "sd-40m", \ |
| 41 | "sd-25m", \ |
| 42 | "sd-22m", \ |
| 43 | }, \ |
| 44 | .num_parents = 8, \ |
| 45 | .reg = 0x30 + 0x200 * (ch), \ |
| 46 | .masks = { \ |
| 47 | 0x00031000, \ |
| 48 | 0x00031000, \ |
| 49 | 0x00031000, \ |
| 50 | 0x00031000, \ |
| 51 | 0x00001300, \ |
| 52 | 0x00001300, \ |
| 53 | 0x00001300, \ |
| 54 | 0x00001300, \ |
| 55 | }, \ |
| 56 | .vals = { \ |
| 57 | 0x00000000, \ |
| 58 | 0x00010000, \ |
| 59 | 0x00020000, \ |
| 60 | 0x00030000, \ |
| 61 | 0x00001000, \ |
| 62 | 0x00001100, \ |
| 63 | 0x00001200, \ |
| 64 | 0x00001300, \ |
| 65 | }, \ |
| 66 | }, \ |
| 67 | }, \ |
| 68 | UNIPHIER_CLK_GATE("sd" #ch, (_idx), "sd" #ch "-sel", 0x20 + 0x200 * (ch), 8) |
| 69 | |
| 70 | #define UNIPHIER_MIO_CLK_USB2(idx, ch) \ |
| 71 | UNIPHIER_CLK_GATE("usb2" #ch, (idx), "usb2", 0x20 + 0x200 * (ch), 28) |
| 72 | |
| 73 | #define UNIPHIER_MIO_CLK_USB2_PHY(idx, ch) \ |
| 74 | UNIPHIER_CLK_GATE("usb2" #ch "-phy", (idx), "usb2", 0x20 + 0x200 * (ch), 29) |
| 75 | |
| 76 | #define UNIPHIER_MIO_CLK_DMAC(idx) \ |
| 77 | UNIPHIER_CLK_GATE("miodmac", (idx), "stdmac", 0x20, 25) |
| 78 | |
| 79 | const struct uniphier_clk_data uniphier_ld4_mio_clk_data[] = { |
| 80 | UNIPHIER_MIO_CLK_SD_FIXED, |
| 81 | UNIPHIER_MIO_CLK_SD(0, 0), |
| 82 | UNIPHIER_MIO_CLK_SD(1, 1), |
| 83 | UNIPHIER_MIO_CLK_SD(2, 2), |
| 84 | UNIPHIER_MIO_CLK_DMAC(7), |
| 85 | UNIPHIER_MIO_CLK_USB2(8, 0), |
| 86 | UNIPHIER_MIO_CLK_USB2(9, 1), |
| 87 | UNIPHIER_MIO_CLK_USB2(10, 2), |
| 88 | UNIPHIER_MIO_CLK_USB2_PHY(12, 0), |
| 89 | UNIPHIER_MIO_CLK_USB2_PHY(13, 1), |
| 90 | UNIPHIER_MIO_CLK_USB2_PHY(14, 2), |
| 91 | { /* sentinel */ } |
| 92 | }; |
| 93 | |
| 94 | const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = { |
| 95 | UNIPHIER_MIO_CLK_SD_FIXED, |
| 96 | UNIPHIER_MIO_CLK_SD(0, 0), |
| 97 | UNIPHIER_MIO_CLK_SD(1, 1), |
| 98 | { /* sentinel */ } |
| 99 | }; |