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 <linux/stddef.h> 17 18 #include "clk-uniphier.h" 19 20 #define UNIPHIER_MIO_CLK_SD_FIXED \ 21 UNIPHIER_CLK_FACTOR("sd-44m", -1, "sd-133m", 1, 3), \ 22 UNIPHIER_CLK_FACTOR("sd-33m", -1, "sd-200m", 1, 6), \ 23 UNIPHIER_CLK_FACTOR("sd-50m", -1, "sd-200m", 1, 4), \ 24 UNIPHIER_CLK_FACTOR("sd-67m", -1, "sd-200m", 1, 3), \ 25 UNIPHIER_CLK_FACTOR("sd-100m", -1, "sd-200m", 1, 2), \ 26 UNIPHIER_CLK_FACTOR("sd-40m", -1, "sd-200m", 1, 5), \ 27 UNIPHIER_CLK_FACTOR("sd-25m", -1, "sd-200m", 1, 8), \ 28 UNIPHIER_CLK_FACTOR("sd-22m", -1, "sd-133m", 1, 6) 29 30 #define UNIPHIER_MIO_CLK_SD(_idx, ch) \ 31 { \ 32 .name = "sd" #ch "-sel", \ 33 .type = UNIPHIER_CLK_TYPE_MUX, \ 34 .idx = -1, \ 35 .data.mux = { \ 36 .parent_names = { \ 37 "sd-44m", \ 38 "sd-33m", \ 39 "sd-50m", \ 40 "sd-67m", \ 41 "sd-100m", \ 42 "sd-40m", \ 43 "sd-25m", \ 44 "sd-22m", \ 45 }, \ 46 .num_parents = 8, \ 47 .reg = 0x30 + 0x200 * (ch), \ 48 .masks = { \ 49 0x00031000, \ 50 0x00031000, \ 51 0x00031000, \ 52 0x00031000, \ 53 0x00001300, \ 54 0x00001300, \ 55 0x00001300, \ 56 0x00001300, \ 57 }, \ 58 .vals = { \ 59 0x00000000, \ 60 0x00010000, \ 61 0x00020000, \ 62 0x00030000, \ 63 0x00001000, \ 64 0x00001100, \ 65 0x00001200, \ 66 0x00001300, \ 67 }, \ 68 }, \ 69 }, \ 70 UNIPHIER_CLK_GATE("sd" #ch, (_idx), "sd" #ch "-sel", 0x20 + 0x200 * (ch), 8) 71 72 #define UNIPHIER_MIO_CLK_USB2(idx, ch) \ 73 UNIPHIER_CLK_GATE("usb2" #ch, (idx), "usb2", 0x20 + 0x200 * (ch), 28) 74 75 #define UNIPHIER_MIO_CLK_USB2_PHY(idx, ch) \ 76 UNIPHIER_CLK_GATE("usb2" #ch "-phy", (idx), "usb2", 0x20 + 0x200 * (ch), 29) 77 78 const struct uniphier_clk_data uniphier_ld4_mio_clk_data[] = { 79 UNIPHIER_MIO_CLK_SD_FIXED, 80 UNIPHIER_MIO_CLK_SD(0, 0), 81 UNIPHIER_MIO_CLK_SD(1, 1), 82 UNIPHIER_MIO_CLK_SD(2, 2), 83 UNIPHIER_CLK_GATE("miodmac", 7, NULL, 0x20, 25), 84 UNIPHIER_MIO_CLK_USB2(8, 0), 85 UNIPHIER_MIO_CLK_USB2(9, 1), 86 UNIPHIER_MIO_CLK_USB2(10, 2), 87 UNIPHIER_MIO_CLK_USB2_PHY(12, 0), 88 UNIPHIER_MIO_CLK_USB2_PHY(13, 1), 89 UNIPHIER_MIO_CLK_USB2_PHY(14, 2), 90 { /* sentinel */ } 91 }; 92 93 const struct uniphier_clk_data uniphier_pro5_sd_clk_data[] = { 94 UNIPHIER_MIO_CLK_SD_FIXED, 95 UNIPHIER_MIO_CLK_SD(0, 0), 96 UNIPHIER_MIO_CLK_SD(1, 1), 97 { /* sentinel */ } 98 }; 99