1 /* 2 * Copyright (C) 2016 Socionext Inc. 3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #include "clk-uniphier.h" 9 10 #define UNIPHIER_MIO_CLK_SD_GATE(id, ch) \ 11 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 8) 12 13 #define UNIPHIER_MIO_CLK_USB2(id, ch) \ 14 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 28) 15 16 #define UNIPHIER_MIO_CLK_USB2_PHY(id, ch) \ 17 UNIPHIER_CLK_GATE((id), 0x20 + 0x200 * (ch), 29) 18 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 }, \ 57 } 58 59 static const struct uniphier_clk_gate_data uniphier_mio_clk_gate[] = { 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_PHY(12, 0), 68 UNIPHIER_MIO_CLK_USB2_PHY(13, 1), 69 UNIPHIER_MIO_CLK_USB2_PHY(14, 2), 70 UNIPHIER_CLK_END 71 }; 72 73 static const struct uniphier_clk_mux_data uniphier_mio_clk_mux[] = { 74 UNIPHIER_MIO_CLK_SD_MUX(0, 0), 75 UNIPHIER_MIO_CLK_SD_MUX(1, 1), 76 UNIPHIER_MIO_CLK_SD_MUX(2, 2), /* for PH1-Pro4 only */ 77 UNIPHIER_CLK_END 78 }; 79 80 const struct uniphier_clk_data uniphier_mio_clk_data = { 81 .gate = uniphier_mio_clk_gate, 82 .mux = uniphier_mio_clk_mux, 83 }; 84