1738f66d3SMichael Turquette /* 21f501d63SPaul Gortmaker * AmLogic S905 / GXBB Clock Controller Driver 31f501d63SPaul Gortmaker * 4738f66d3SMichael Turquette * Copyright (c) 2016 AmLogic, Inc. 5738f66d3SMichael Turquette * Michael Turquette <mturquette@baylibre.com> 6738f66d3SMichael Turquette * 7738f66d3SMichael Turquette * This program is free software; you can redistribute it and/or modify it 8738f66d3SMichael Turquette * under the terms and conditions of the GNU General Public License, 9738f66d3SMichael Turquette * version 2, as published by the Free Software Foundation. 10738f66d3SMichael Turquette * 11738f66d3SMichael Turquette * This program is distributed in the hope it will be useful, but WITHOUT 12738f66d3SMichael Turquette * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13738f66d3SMichael Turquette * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14738f66d3SMichael Turquette * more details. 15738f66d3SMichael Turquette * 16738f66d3SMichael Turquette * You should have received a copy of the GNU General Public License along with 17738f66d3SMichael Turquette * this program. If not, see <http://www.gnu.org/licenses/>. 18738f66d3SMichael Turquette */ 19738f66d3SMichael Turquette 20738f66d3SMichael Turquette #include <linux/clk.h> 21738f66d3SMichael Turquette #include <linux/clk-provider.h> 22738f66d3SMichael Turquette #include <linux/of_address.h> 230d48fc55SNeil Armstrong #include <linux/of_device.h> 24738f66d3SMichael Turquette #include <linux/platform_device.h> 251f501d63SPaul Gortmaker #include <linux/init.h> 26738f66d3SMichael Turquette 27738f66d3SMichael Turquette #include "clkc.h" 28738f66d3SMichael Turquette #include "gxbb.h" 29738f66d3SMichael Turquette 30738f66d3SMichael Turquette static DEFINE_SPINLOCK(clk_lock); 31738f66d3SMichael Turquette 32738f66d3SMichael Turquette static const struct pll_rate_table sys_pll_rate_table[] = { 33738f66d3SMichael Turquette PLL_RATE(24000000, 56, 1, 2), 34738f66d3SMichael Turquette PLL_RATE(48000000, 64, 1, 2), 35738f66d3SMichael Turquette PLL_RATE(72000000, 72, 1, 2), 36738f66d3SMichael Turquette PLL_RATE(96000000, 64, 1, 2), 37738f66d3SMichael Turquette PLL_RATE(120000000, 80, 1, 2), 38738f66d3SMichael Turquette PLL_RATE(144000000, 96, 1, 2), 39738f66d3SMichael Turquette PLL_RATE(168000000, 56, 1, 1), 40738f66d3SMichael Turquette PLL_RATE(192000000, 64, 1, 1), 41738f66d3SMichael Turquette PLL_RATE(216000000, 72, 1, 1), 42738f66d3SMichael Turquette PLL_RATE(240000000, 80, 1, 1), 43738f66d3SMichael Turquette PLL_RATE(264000000, 88, 1, 1), 44738f66d3SMichael Turquette PLL_RATE(288000000, 96, 1, 1), 45738f66d3SMichael Turquette PLL_RATE(312000000, 52, 1, 2), 46738f66d3SMichael Turquette PLL_RATE(336000000, 56, 1, 2), 47738f66d3SMichael Turquette PLL_RATE(360000000, 60, 1, 2), 48738f66d3SMichael Turquette PLL_RATE(384000000, 64, 1, 2), 49738f66d3SMichael Turquette PLL_RATE(408000000, 68, 1, 2), 50738f66d3SMichael Turquette PLL_RATE(432000000, 72, 1, 2), 51738f66d3SMichael Turquette PLL_RATE(456000000, 76, 1, 2), 52738f66d3SMichael Turquette PLL_RATE(480000000, 80, 1, 2), 53738f66d3SMichael Turquette PLL_RATE(504000000, 84, 1, 2), 54738f66d3SMichael Turquette PLL_RATE(528000000, 88, 1, 2), 55738f66d3SMichael Turquette PLL_RATE(552000000, 92, 1, 2), 56738f66d3SMichael Turquette PLL_RATE(576000000, 96, 1, 2), 57738f66d3SMichael Turquette PLL_RATE(600000000, 50, 1, 1), 58738f66d3SMichael Turquette PLL_RATE(624000000, 52, 1, 1), 59738f66d3SMichael Turquette PLL_RATE(648000000, 54, 1, 1), 60738f66d3SMichael Turquette PLL_RATE(672000000, 56, 1, 1), 61738f66d3SMichael Turquette PLL_RATE(696000000, 58, 1, 1), 62738f66d3SMichael Turquette PLL_RATE(720000000, 60, 1, 1), 63738f66d3SMichael Turquette PLL_RATE(744000000, 62, 1, 1), 64738f66d3SMichael Turquette PLL_RATE(768000000, 64, 1, 1), 65738f66d3SMichael Turquette PLL_RATE(792000000, 66, 1, 1), 66738f66d3SMichael Turquette PLL_RATE(816000000, 68, 1, 1), 67738f66d3SMichael Turquette PLL_RATE(840000000, 70, 1, 1), 68738f66d3SMichael Turquette PLL_RATE(864000000, 72, 1, 1), 69738f66d3SMichael Turquette PLL_RATE(888000000, 74, 1, 1), 70738f66d3SMichael Turquette PLL_RATE(912000000, 76, 1, 1), 71738f66d3SMichael Turquette PLL_RATE(936000000, 78, 1, 1), 72738f66d3SMichael Turquette PLL_RATE(960000000, 80, 1, 1), 73738f66d3SMichael Turquette PLL_RATE(984000000, 82, 1, 1), 74738f66d3SMichael Turquette PLL_RATE(1008000000, 84, 1, 1), 75738f66d3SMichael Turquette PLL_RATE(1032000000, 86, 1, 1), 76738f66d3SMichael Turquette PLL_RATE(1056000000, 88, 1, 1), 77738f66d3SMichael Turquette PLL_RATE(1080000000, 90, 1, 1), 78738f66d3SMichael Turquette PLL_RATE(1104000000, 92, 1, 1), 79738f66d3SMichael Turquette PLL_RATE(1128000000, 94, 1, 1), 80738f66d3SMichael Turquette PLL_RATE(1152000000, 96, 1, 1), 81738f66d3SMichael Turquette PLL_RATE(1176000000, 98, 1, 1), 82738f66d3SMichael Turquette PLL_RATE(1200000000, 50, 1, 0), 83738f66d3SMichael Turquette PLL_RATE(1224000000, 51, 1, 0), 84738f66d3SMichael Turquette PLL_RATE(1248000000, 52, 1, 0), 85738f66d3SMichael Turquette PLL_RATE(1272000000, 53, 1, 0), 86738f66d3SMichael Turquette PLL_RATE(1296000000, 54, 1, 0), 87738f66d3SMichael Turquette PLL_RATE(1320000000, 55, 1, 0), 88738f66d3SMichael Turquette PLL_RATE(1344000000, 56, 1, 0), 89738f66d3SMichael Turquette PLL_RATE(1368000000, 57, 1, 0), 90738f66d3SMichael Turquette PLL_RATE(1392000000, 58, 1, 0), 91738f66d3SMichael Turquette PLL_RATE(1416000000, 59, 1, 0), 92738f66d3SMichael Turquette PLL_RATE(1440000000, 60, 1, 0), 93738f66d3SMichael Turquette PLL_RATE(1464000000, 61, 1, 0), 94738f66d3SMichael Turquette PLL_RATE(1488000000, 62, 1, 0), 95738f66d3SMichael Turquette PLL_RATE(1512000000, 63, 1, 0), 96738f66d3SMichael Turquette PLL_RATE(1536000000, 64, 1, 0), 97738f66d3SMichael Turquette PLL_RATE(1560000000, 65, 1, 0), 98738f66d3SMichael Turquette PLL_RATE(1584000000, 66, 1, 0), 99738f66d3SMichael Turquette PLL_RATE(1608000000, 67, 1, 0), 100738f66d3SMichael Turquette PLL_RATE(1632000000, 68, 1, 0), 101738f66d3SMichael Turquette PLL_RATE(1656000000, 68, 1, 0), 102738f66d3SMichael Turquette PLL_RATE(1680000000, 68, 1, 0), 103738f66d3SMichael Turquette PLL_RATE(1704000000, 68, 1, 0), 104738f66d3SMichael Turquette PLL_RATE(1728000000, 69, 1, 0), 105738f66d3SMichael Turquette PLL_RATE(1752000000, 69, 1, 0), 106738f66d3SMichael Turquette PLL_RATE(1776000000, 69, 1, 0), 107738f66d3SMichael Turquette PLL_RATE(1800000000, 69, 1, 0), 108738f66d3SMichael Turquette PLL_RATE(1824000000, 70, 1, 0), 109738f66d3SMichael Turquette PLL_RATE(1848000000, 70, 1, 0), 110738f66d3SMichael Turquette PLL_RATE(1872000000, 70, 1, 0), 111738f66d3SMichael Turquette PLL_RATE(1896000000, 70, 1, 0), 112738f66d3SMichael Turquette PLL_RATE(1920000000, 71, 1, 0), 113738f66d3SMichael Turquette PLL_RATE(1944000000, 71, 1, 0), 114738f66d3SMichael Turquette PLL_RATE(1968000000, 71, 1, 0), 115738f66d3SMichael Turquette PLL_RATE(1992000000, 71, 1, 0), 116738f66d3SMichael Turquette PLL_RATE(2016000000, 72, 1, 0), 117738f66d3SMichael Turquette PLL_RATE(2040000000, 72, 1, 0), 118738f66d3SMichael Turquette PLL_RATE(2064000000, 72, 1, 0), 119738f66d3SMichael Turquette PLL_RATE(2088000000, 72, 1, 0), 120738f66d3SMichael Turquette PLL_RATE(2112000000, 73, 1, 0), 121738f66d3SMichael Turquette { /* sentinel */ }, 122738f66d3SMichael Turquette }; 123738f66d3SMichael Turquette 1240d48fc55SNeil Armstrong static const struct pll_rate_table gxbb_gp0_pll_rate_table[] = { 125738f66d3SMichael Turquette PLL_RATE(96000000, 32, 1, 3), 126738f66d3SMichael Turquette PLL_RATE(99000000, 33, 1, 3), 127738f66d3SMichael Turquette PLL_RATE(102000000, 34, 1, 3), 128738f66d3SMichael Turquette PLL_RATE(105000000, 35, 1, 3), 129738f66d3SMichael Turquette PLL_RATE(108000000, 36, 1, 3), 130738f66d3SMichael Turquette PLL_RATE(111000000, 37, 1, 3), 131738f66d3SMichael Turquette PLL_RATE(114000000, 38, 1, 3), 132738f66d3SMichael Turquette PLL_RATE(117000000, 39, 1, 3), 133738f66d3SMichael Turquette PLL_RATE(120000000, 40, 1, 3), 134738f66d3SMichael Turquette PLL_RATE(123000000, 41, 1, 3), 135738f66d3SMichael Turquette PLL_RATE(126000000, 42, 1, 3), 136738f66d3SMichael Turquette PLL_RATE(129000000, 43, 1, 3), 137738f66d3SMichael Turquette PLL_RATE(132000000, 44, 1, 3), 138738f66d3SMichael Turquette PLL_RATE(135000000, 45, 1, 3), 139738f66d3SMichael Turquette PLL_RATE(138000000, 46, 1, 3), 140738f66d3SMichael Turquette PLL_RATE(141000000, 47, 1, 3), 141738f66d3SMichael Turquette PLL_RATE(144000000, 48, 1, 3), 142738f66d3SMichael Turquette PLL_RATE(147000000, 49, 1, 3), 143738f66d3SMichael Turquette PLL_RATE(150000000, 50, 1, 3), 144738f66d3SMichael Turquette PLL_RATE(153000000, 51, 1, 3), 145738f66d3SMichael Turquette PLL_RATE(156000000, 52, 1, 3), 146738f66d3SMichael Turquette PLL_RATE(159000000, 53, 1, 3), 147738f66d3SMichael Turquette PLL_RATE(162000000, 54, 1, 3), 148738f66d3SMichael Turquette PLL_RATE(165000000, 55, 1, 3), 149738f66d3SMichael Turquette PLL_RATE(168000000, 56, 1, 3), 150738f66d3SMichael Turquette PLL_RATE(171000000, 57, 1, 3), 151738f66d3SMichael Turquette PLL_RATE(174000000, 58, 1, 3), 152738f66d3SMichael Turquette PLL_RATE(177000000, 59, 1, 3), 153738f66d3SMichael Turquette PLL_RATE(180000000, 60, 1, 3), 154738f66d3SMichael Turquette PLL_RATE(183000000, 61, 1, 3), 155738f66d3SMichael Turquette PLL_RATE(186000000, 62, 1, 3), 156738f66d3SMichael Turquette PLL_RATE(192000000, 32, 1, 2), 157738f66d3SMichael Turquette PLL_RATE(198000000, 33, 1, 2), 158738f66d3SMichael Turquette PLL_RATE(204000000, 34, 1, 2), 159738f66d3SMichael Turquette PLL_RATE(210000000, 35, 1, 2), 160738f66d3SMichael Turquette PLL_RATE(216000000, 36, 1, 2), 161738f66d3SMichael Turquette PLL_RATE(222000000, 37, 1, 2), 162738f66d3SMichael Turquette PLL_RATE(228000000, 38, 1, 2), 163738f66d3SMichael Turquette PLL_RATE(234000000, 39, 1, 2), 164738f66d3SMichael Turquette PLL_RATE(240000000, 40, 1, 2), 165738f66d3SMichael Turquette PLL_RATE(246000000, 41, 1, 2), 166738f66d3SMichael Turquette PLL_RATE(252000000, 42, 1, 2), 167738f66d3SMichael Turquette PLL_RATE(258000000, 43, 1, 2), 168738f66d3SMichael Turquette PLL_RATE(264000000, 44, 1, 2), 169738f66d3SMichael Turquette PLL_RATE(270000000, 45, 1, 2), 170738f66d3SMichael Turquette PLL_RATE(276000000, 46, 1, 2), 171738f66d3SMichael Turquette PLL_RATE(282000000, 47, 1, 2), 172738f66d3SMichael Turquette PLL_RATE(288000000, 48, 1, 2), 173738f66d3SMichael Turquette PLL_RATE(294000000, 49, 1, 2), 174738f66d3SMichael Turquette PLL_RATE(300000000, 50, 1, 2), 175738f66d3SMichael Turquette PLL_RATE(306000000, 51, 1, 2), 176738f66d3SMichael Turquette PLL_RATE(312000000, 52, 1, 2), 177738f66d3SMichael Turquette PLL_RATE(318000000, 53, 1, 2), 178738f66d3SMichael Turquette PLL_RATE(324000000, 54, 1, 2), 179738f66d3SMichael Turquette PLL_RATE(330000000, 55, 1, 2), 180738f66d3SMichael Turquette PLL_RATE(336000000, 56, 1, 2), 181738f66d3SMichael Turquette PLL_RATE(342000000, 57, 1, 2), 182738f66d3SMichael Turquette PLL_RATE(348000000, 58, 1, 2), 183738f66d3SMichael Turquette PLL_RATE(354000000, 59, 1, 2), 184738f66d3SMichael Turquette PLL_RATE(360000000, 60, 1, 2), 185738f66d3SMichael Turquette PLL_RATE(366000000, 61, 1, 2), 186738f66d3SMichael Turquette PLL_RATE(372000000, 62, 1, 2), 187738f66d3SMichael Turquette PLL_RATE(384000000, 32, 1, 1), 188738f66d3SMichael Turquette PLL_RATE(396000000, 33, 1, 1), 189738f66d3SMichael Turquette PLL_RATE(408000000, 34, 1, 1), 190738f66d3SMichael Turquette PLL_RATE(420000000, 35, 1, 1), 191738f66d3SMichael Turquette PLL_RATE(432000000, 36, 1, 1), 192738f66d3SMichael Turquette PLL_RATE(444000000, 37, 1, 1), 193738f66d3SMichael Turquette PLL_RATE(456000000, 38, 1, 1), 194738f66d3SMichael Turquette PLL_RATE(468000000, 39, 1, 1), 195738f66d3SMichael Turquette PLL_RATE(480000000, 40, 1, 1), 196738f66d3SMichael Turquette PLL_RATE(492000000, 41, 1, 1), 197738f66d3SMichael Turquette PLL_RATE(504000000, 42, 1, 1), 198738f66d3SMichael Turquette PLL_RATE(516000000, 43, 1, 1), 199738f66d3SMichael Turquette PLL_RATE(528000000, 44, 1, 1), 200738f66d3SMichael Turquette PLL_RATE(540000000, 45, 1, 1), 201738f66d3SMichael Turquette PLL_RATE(552000000, 46, 1, 1), 202738f66d3SMichael Turquette PLL_RATE(564000000, 47, 1, 1), 203738f66d3SMichael Turquette PLL_RATE(576000000, 48, 1, 1), 204738f66d3SMichael Turquette PLL_RATE(588000000, 49, 1, 1), 205738f66d3SMichael Turquette PLL_RATE(600000000, 50, 1, 1), 206738f66d3SMichael Turquette PLL_RATE(612000000, 51, 1, 1), 207738f66d3SMichael Turquette PLL_RATE(624000000, 52, 1, 1), 208738f66d3SMichael Turquette PLL_RATE(636000000, 53, 1, 1), 209738f66d3SMichael Turquette PLL_RATE(648000000, 54, 1, 1), 210738f66d3SMichael Turquette PLL_RATE(660000000, 55, 1, 1), 211738f66d3SMichael Turquette PLL_RATE(672000000, 56, 1, 1), 212738f66d3SMichael Turquette PLL_RATE(684000000, 57, 1, 1), 213738f66d3SMichael Turquette PLL_RATE(696000000, 58, 1, 1), 214738f66d3SMichael Turquette PLL_RATE(708000000, 59, 1, 1), 215738f66d3SMichael Turquette PLL_RATE(720000000, 60, 1, 1), 216738f66d3SMichael Turquette PLL_RATE(732000000, 61, 1, 1), 217738f66d3SMichael Turquette PLL_RATE(744000000, 62, 1, 1), 218738f66d3SMichael Turquette PLL_RATE(768000000, 32, 1, 0), 219738f66d3SMichael Turquette PLL_RATE(792000000, 33, 1, 0), 220738f66d3SMichael Turquette PLL_RATE(816000000, 34, 1, 0), 221738f66d3SMichael Turquette PLL_RATE(840000000, 35, 1, 0), 222738f66d3SMichael Turquette PLL_RATE(864000000, 36, 1, 0), 223738f66d3SMichael Turquette PLL_RATE(888000000, 37, 1, 0), 224738f66d3SMichael Turquette PLL_RATE(912000000, 38, 1, 0), 225738f66d3SMichael Turquette PLL_RATE(936000000, 39, 1, 0), 226738f66d3SMichael Turquette PLL_RATE(960000000, 40, 1, 0), 227738f66d3SMichael Turquette PLL_RATE(984000000, 41, 1, 0), 228738f66d3SMichael Turquette PLL_RATE(1008000000, 42, 1, 0), 229738f66d3SMichael Turquette PLL_RATE(1032000000, 43, 1, 0), 230738f66d3SMichael Turquette PLL_RATE(1056000000, 44, 1, 0), 231738f66d3SMichael Turquette PLL_RATE(1080000000, 45, 1, 0), 232738f66d3SMichael Turquette PLL_RATE(1104000000, 46, 1, 0), 233738f66d3SMichael Turquette PLL_RATE(1128000000, 47, 1, 0), 234738f66d3SMichael Turquette PLL_RATE(1152000000, 48, 1, 0), 235738f66d3SMichael Turquette PLL_RATE(1176000000, 49, 1, 0), 236738f66d3SMichael Turquette PLL_RATE(1200000000, 50, 1, 0), 237738f66d3SMichael Turquette PLL_RATE(1224000000, 51, 1, 0), 238738f66d3SMichael Turquette PLL_RATE(1248000000, 52, 1, 0), 239738f66d3SMichael Turquette PLL_RATE(1272000000, 53, 1, 0), 240738f66d3SMichael Turquette PLL_RATE(1296000000, 54, 1, 0), 241738f66d3SMichael Turquette PLL_RATE(1320000000, 55, 1, 0), 242738f66d3SMichael Turquette PLL_RATE(1344000000, 56, 1, 0), 243738f66d3SMichael Turquette PLL_RATE(1368000000, 57, 1, 0), 244738f66d3SMichael Turquette PLL_RATE(1392000000, 58, 1, 0), 245738f66d3SMichael Turquette PLL_RATE(1416000000, 59, 1, 0), 246738f66d3SMichael Turquette PLL_RATE(1440000000, 60, 1, 0), 247738f66d3SMichael Turquette PLL_RATE(1464000000, 61, 1, 0), 248738f66d3SMichael Turquette PLL_RATE(1488000000, 62, 1, 0), 249738f66d3SMichael Turquette { /* sentinel */ }, 250738f66d3SMichael Turquette }; 251738f66d3SMichael Turquette 2520d48fc55SNeil Armstrong static const struct pll_rate_table gxl_gp0_pll_rate_table[] = { 2530d48fc55SNeil Armstrong PLL_RATE(504000000, 42, 1, 1), 2540d48fc55SNeil Armstrong PLL_RATE(516000000, 43, 1, 1), 2550d48fc55SNeil Armstrong PLL_RATE(528000000, 44, 1, 1), 2560d48fc55SNeil Armstrong PLL_RATE(540000000, 45, 1, 1), 2570d48fc55SNeil Armstrong PLL_RATE(552000000, 46, 1, 1), 2580d48fc55SNeil Armstrong PLL_RATE(564000000, 47, 1, 1), 2590d48fc55SNeil Armstrong PLL_RATE(576000000, 48, 1, 1), 2600d48fc55SNeil Armstrong PLL_RATE(588000000, 49, 1, 1), 2610d48fc55SNeil Armstrong PLL_RATE(600000000, 50, 1, 1), 2620d48fc55SNeil Armstrong PLL_RATE(612000000, 51, 1, 1), 2630d48fc55SNeil Armstrong PLL_RATE(624000000, 52, 1, 1), 2640d48fc55SNeil Armstrong PLL_RATE(636000000, 53, 1, 1), 2650d48fc55SNeil Armstrong PLL_RATE(648000000, 54, 1, 1), 2660d48fc55SNeil Armstrong PLL_RATE(660000000, 55, 1, 1), 2670d48fc55SNeil Armstrong PLL_RATE(672000000, 56, 1, 1), 2680d48fc55SNeil Armstrong PLL_RATE(684000000, 57, 1, 1), 2690d48fc55SNeil Armstrong PLL_RATE(696000000, 58, 1, 1), 2700d48fc55SNeil Armstrong PLL_RATE(708000000, 59, 1, 1), 2710d48fc55SNeil Armstrong PLL_RATE(720000000, 60, 1, 1), 2720d48fc55SNeil Armstrong PLL_RATE(732000000, 61, 1, 1), 2730d48fc55SNeil Armstrong PLL_RATE(744000000, 62, 1, 1), 2740d48fc55SNeil Armstrong PLL_RATE(756000000, 63, 1, 1), 2750d48fc55SNeil Armstrong PLL_RATE(768000000, 64, 1, 1), 2760d48fc55SNeil Armstrong PLL_RATE(780000000, 65, 1, 1), 2770d48fc55SNeil Armstrong PLL_RATE(792000000, 66, 1, 1), 2780d48fc55SNeil Armstrong { /* sentinel */ }, 2790d48fc55SNeil Armstrong }; 2800d48fc55SNeil Armstrong 281738f66d3SMichael Turquette static struct meson_clk_pll gxbb_fixed_pll = { 282738f66d3SMichael Turquette .m = { 283738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL, 284738f66d3SMichael Turquette .shift = 0, 285738f66d3SMichael Turquette .width = 9, 286738f66d3SMichael Turquette }, 287738f66d3SMichael Turquette .n = { 288738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL, 289738f66d3SMichael Turquette .shift = 9, 290738f66d3SMichael Turquette .width = 5, 291738f66d3SMichael Turquette }, 292738f66d3SMichael Turquette .od = { 293738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL, 294738f66d3SMichael Turquette .shift = 16, 295738f66d3SMichael Turquette .width = 2, 296738f66d3SMichael Turquette }, 297738f66d3SMichael Turquette .lock = &clk_lock, 298738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 299738f66d3SMichael Turquette .name = "fixed_pll", 300738f66d3SMichael Turquette .ops = &meson_clk_pll_ro_ops, 301738f66d3SMichael Turquette .parent_names = (const char *[]){ "xtal" }, 302738f66d3SMichael Turquette .num_parents = 1, 303738f66d3SMichael Turquette .flags = CLK_GET_RATE_NOCACHE, 304738f66d3SMichael Turquette }, 305738f66d3SMichael Turquette }; 306738f66d3SMichael Turquette 307738f66d3SMichael Turquette static struct meson_clk_pll gxbb_hdmi_pll = { 308738f66d3SMichael Turquette .m = { 309738f66d3SMichael Turquette .reg_off = HHI_HDMI_PLL_CNTL, 310738f66d3SMichael Turquette .shift = 0, 311738f66d3SMichael Turquette .width = 9, 312738f66d3SMichael Turquette }, 313738f66d3SMichael Turquette .n = { 314738f66d3SMichael Turquette .reg_off = HHI_HDMI_PLL_CNTL, 315738f66d3SMichael Turquette .shift = 9, 316738f66d3SMichael Turquette .width = 5, 317738f66d3SMichael Turquette }, 318738f66d3SMichael Turquette .frac = { 319738f66d3SMichael Turquette .reg_off = HHI_HDMI_PLL_CNTL2, 320738f66d3SMichael Turquette .shift = 0, 321738f66d3SMichael Turquette .width = 12, 322738f66d3SMichael Turquette }, 323738f66d3SMichael Turquette .od = { 324738f66d3SMichael Turquette .reg_off = HHI_HDMI_PLL_CNTL2, 325738f66d3SMichael Turquette .shift = 16, 326738f66d3SMichael Turquette .width = 2, 327738f66d3SMichael Turquette }, 328738f66d3SMichael Turquette .od2 = { 329738f66d3SMichael Turquette .reg_off = HHI_HDMI_PLL_CNTL2, 330738f66d3SMichael Turquette .shift = 22, 331738f66d3SMichael Turquette .width = 2, 332738f66d3SMichael Turquette }, 333738f66d3SMichael Turquette .lock = &clk_lock, 334738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 335738f66d3SMichael Turquette .name = "hdmi_pll", 336738f66d3SMichael Turquette .ops = &meson_clk_pll_ro_ops, 337738f66d3SMichael Turquette .parent_names = (const char *[]){ "xtal" }, 338738f66d3SMichael Turquette .num_parents = 1, 339738f66d3SMichael Turquette .flags = CLK_GET_RATE_NOCACHE, 340738f66d3SMichael Turquette }, 341738f66d3SMichael Turquette }; 342738f66d3SMichael Turquette 343738f66d3SMichael Turquette static struct meson_clk_pll gxbb_sys_pll = { 344738f66d3SMichael Turquette .m = { 345738f66d3SMichael Turquette .reg_off = HHI_SYS_PLL_CNTL, 346738f66d3SMichael Turquette .shift = 0, 347738f66d3SMichael Turquette .width = 9, 348738f66d3SMichael Turquette }, 349738f66d3SMichael Turquette .n = { 350738f66d3SMichael Turquette .reg_off = HHI_SYS_PLL_CNTL, 351738f66d3SMichael Turquette .shift = 9, 352738f66d3SMichael Turquette .width = 5, 353738f66d3SMichael Turquette }, 354738f66d3SMichael Turquette .od = { 355738f66d3SMichael Turquette .reg_off = HHI_SYS_PLL_CNTL, 356738f66d3SMichael Turquette .shift = 10, 357738f66d3SMichael Turquette .width = 2, 358738f66d3SMichael Turquette }, 359738f66d3SMichael Turquette .rate_table = sys_pll_rate_table, 360738f66d3SMichael Turquette .rate_count = ARRAY_SIZE(sys_pll_rate_table), 361738f66d3SMichael Turquette .lock = &clk_lock, 362738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 363738f66d3SMichael Turquette .name = "sys_pll", 364738f66d3SMichael Turquette .ops = &meson_clk_pll_ro_ops, 365738f66d3SMichael Turquette .parent_names = (const char *[]){ "xtal" }, 366738f66d3SMichael Turquette .num_parents = 1, 367738f66d3SMichael Turquette .flags = CLK_GET_RATE_NOCACHE, 368738f66d3SMichael Turquette }, 369738f66d3SMichael Turquette }; 370738f66d3SMichael Turquette 371e194401cSNeil Armstrong struct pll_params_table gxbb_gp0_params_table[] = { 372e194401cSNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL, 0x6a000228), 373e194401cSNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL2, 0x69c80000), 374e194401cSNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL3, 0x0a5590c4), 375e194401cSNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL4, 0x0000500d), 376e194401cSNeil Armstrong }; 377e194401cSNeil Armstrong 378738f66d3SMichael Turquette static struct meson_clk_pll gxbb_gp0_pll = { 379738f66d3SMichael Turquette .m = { 380738f66d3SMichael Turquette .reg_off = HHI_GP0_PLL_CNTL, 381738f66d3SMichael Turquette .shift = 0, 382738f66d3SMichael Turquette .width = 9, 383738f66d3SMichael Turquette }, 384738f66d3SMichael Turquette .n = { 385738f66d3SMichael Turquette .reg_off = HHI_GP0_PLL_CNTL, 386738f66d3SMichael Turquette .shift = 9, 387738f66d3SMichael Turquette .width = 5, 388738f66d3SMichael Turquette }, 389738f66d3SMichael Turquette .od = { 390738f66d3SMichael Turquette .reg_off = HHI_GP0_PLL_CNTL, 391738f66d3SMichael Turquette .shift = 16, 392738f66d3SMichael Turquette .width = 2, 393738f66d3SMichael Turquette }, 394e194401cSNeil Armstrong .params = { 395e194401cSNeil Armstrong .params_table = gxbb_gp0_params_table, 396e194401cSNeil Armstrong .params_count = ARRAY_SIZE(gxbb_gp0_params_table), 397e194401cSNeil Armstrong .no_init_reset = true, 398e194401cSNeil Armstrong .clear_reset_for_lock = true, 399e194401cSNeil Armstrong }, 4000d48fc55SNeil Armstrong .rate_table = gxbb_gp0_pll_rate_table, 4010d48fc55SNeil Armstrong .rate_count = ARRAY_SIZE(gxbb_gp0_pll_rate_table), 4020d48fc55SNeil Armstrong .lock = &clk_lock, 4030d48fc55SNeil Armstrong .hw.init = &(struct clk_init_data){ 4040d48fc55SNeil Armstrong .name = "gp0_pll", 4050d48fc55SNeil Armstrong .ops = &meson_clk_pll_ops, 4060d48fc55SNeil Armstrong .parent_names = (const char *[]){ "xtal" }, 4070d48fc55SNeil Armstrong .num_parents = 1, 4080d48fc55SNeil Armstrong .flags = CLK_GET_RATE_NOCACHE, 4090d48fc55SNeil Armstrong }, 4100d48fc55SNeil Armstrong }; 4110d48fc55SNeil Armstrong 4120d48fc55SNeil Armstrong struct pll_params_table gxl_gp0_params_table[] = { 4130d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL, 0x40010250), 4140d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL1, 0xc084a000), 4150d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL2, 0xb75020be), 4160d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL3, 0x0a59a288), 4170d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL4, 0xc000004d), 4180d48fc55SNeil Armstrong PLL_PARAM(HHI_GP0_PLL_CNTL5, 0x00078000), 4190d48fc55SNeil Armstrong }; 4200d48fc55SNeil Armstrong 4210d48fc55SNeil Armstrong static struct meson_clk_pll gxl_gp0_pll = { 4220d48fc55SNeil Armstrong .m = { 4230d48fc55SNeil Armstrong .reg_off = HHI_GP0_PLL_CNTL, 4240d48fc55SNeil Armstrong .shift = 0, 4250d48fc55SNeil Armstrong .width = 9, 4260d48fc55SNeil Armstrong }, 4270d48fc55SNeil Armstrong .n = { 4280d48fc55SNeil Armstrong .reg_off = HHI_GP0_PLL_CNTL, 4290d48fc55SNeil Armstrong .shift = 9, 4300d48fc55SNeil Armstrong .width = 5, 4310d48fc55SNeil Armstrong }, 4320d48fc55SNeil Armstrong .od = { 4330d48fc55SNeil Armstrong .reg_off = HHI_GP0_PLL_CNTL, 4340d48fc55SNeil Armstrong .shift = 16, 4350d48fc55SNeil Armstrong .width = 2, 4360d48fc55SNeil Armstrong }, 4370d48fc55SNeil Armstrong .params = { 4380d48fc55SNeil Armstrong .params_table = gxl_gp0_params_table, 4390d48fc55SNeil Armstrong .params_count = ARRAY_SIZE(gxl_gp0_params_table), 4400d48fc55SNeil Armstrong .no_init_reset = true, 4410d48fc55SNeil Armstrong .reset_lock_loop = true, 4420d48fc55SNeil Armstrong }, 4430d48fc55SNeil Armstrong .rate_table = gxl_gp0_pll_rate_table, 4440d48fc55SNeil Armstrong .rate_count = ARRAY_SIZE(gxl_gp0_pll_rate_table), 445738f66d3SMichael Turquette .lock = &clk_lock, 446738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 447738f66d3SMichael Turquette .name = "gp0_pll", 448738f66d3SMichael Turquette .ops = &meson_clk_pll_ops, 449738f66d3SMichael Turquette .parent_names = (const char *[]){ "xtal" }, 450738f66d3SMichael Turquette .num_parents = 1, 451738f66d3SMichael Turquette .flags = CLK_GET_RATE_NOCACHE, 452738f66d3SMichael Turquette }, 453738f66d3SMichael Turquette }; 454738f66d3SMichael Turquette 455738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div2 = { 456738f66d3SMichael Turquette .mult = 1, 457738f66d3SMichael Turquette .div = 2, 458738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 459738f66d3SMichael Turquette .name = "fclk_div2", 460738f66d3SMichael Turquette .ops = &clk_fixed_factor_ops, 461738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 462738f66d3SMichael Turquette .num_parents = 1, 463738f66d3SMichael Turquette }, 464738f66d3SMichael Turquette }; 465738f66d3SMichael Turquette 466738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div3 = { 467738f66d3SMichael Turquette .mult = 1, 468738f66d3SMichael Turquette .div = 3, 469738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 470738f66d3SMichael Turquette .name = "fclk_div3", 471738f66d3SMichael Turquette .ops = &clk_fixed_factor_ops, 472738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 473738f66d3SMichael Turquette .num_parents = 1, 474738f66d3SMichael Turquette }, 475738f66d3SMichael Turquette }; 476738f66d3SMichael Turquette 477738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div4 = { 478738f66d3SMichael Turquette .mult = 1, 479738f66d3SMichael Turquette .div = 4, 480738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 481738f66d3SMichael Turquette .name = "fclk_div4", 482738f66d3SMichael Turquette .ops = &clk_fixed_factor_ops, 483738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 484738f66d3SMichael Turquette .num_parents = 1, 485738f66d3SMichael Turquette }, 486738f66d3SMichael Turquette }; 487738f66d3SMichael Turquette 488738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div5 = { 489738f66d3SMichael Turquette .mult = 1, 490738f66d3SMichael Turquette .div = 5, 491738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 492738f66d3SMichael Turquette .name = "fclk_div5", 493738f66d3SMichael Turquette .ops = &clk_fixed_factor_ops, 494738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 495738f66d3SMichael Turquette .num_parents = 1, 496738f66d3SMichael Turquette }, 497738f66d3SMichael Turquette }; 498738f66d3SMichael Turquette 499738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div7 = { 500738f66d3SMichael Turquette .mult = 1, 501738f66d3SMichael Turquette .div = 7, 502738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 503738f66d3SMichael Turquette .name = "fclk_div7", 504738f66d3SMichael Turquette .ops = &clk_fixed_factor_ops, 505738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 506738f66d3SMichael Turquette .num_parents = 1, 507738f66d3SMichael Turquette }, 508738f66d3SMichael Turquette }; 509738f66d3SMichael Turquette 510738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll0 = { 511738f66d3SMichael Turquette .sdm = { 512738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL7, 513738f66d3SMichael Turquette .shift = 0, 514738f66d3SMichael Turquette .width = 14, 515738f66d3SMichael Turquette }, 516007e6e5cSJerome Brunet .sdm_en = { 517007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL7, 518007e6e5cSJerome Brunet .shift = 15, 519007e6e5cSJerome Brunet .width = 1, 520007e6e5cSJerome Brunet }, 521738f66d3SMichael Turquette .n2 = { 522738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL7, 523738f66d3SMichael Turquette .shift = 16, 524738f66d3SMichael Turquette .width = 9, 525738f66d3SMichael Turquette }, 526007e6e5cSJerome Brunet .en = { 527007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL7, 528007e6e5cSJerome Brunet .shift = 14, 529007e6e5cSJerome Brunet .width = 1, 530007e6e5cSJerome Brunet }, 531738f66d3SMichael Turquette .lock = &clk_lock, 532738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 533738f66d3SMichael Turquette .name = "mpll0", 53405b43aa2SJerome Brunet .ops = &meson_clk_mpll_ops, 535738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 536738f66d3SMichael Turquette .num_parents = 1, 537738f66d3SMichael Turquette }, 538738f66d3SMichael Turquette }; 539738f66d3SMichael Turquette 540738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll1 = { 541738f66d3SMichael Turquette .sdm = { 542738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL8, 543738f66d3SMichael Turquette .shift = 0, 544738f66d3SMichael Turquette .width = 14, 545738f66d3SMichael Turquette }, 546007e6e5cSJerome Brunet .sdm_en = { 547007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL8, 548007e6e5cSJerome Brunet .shift = 15, 549007e6e5cSJerome Brunet .width = 1, 550007e6e5cSJerome Brunet }, 551738f66d3SMichael Turquette .n2 = { 552738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL8, 553738f66d3SMichael Turquette .shift = 16, 554738f66d3SMichael Turquette .width = 9, 555738f66d3SMichael Turquette }, 556007e6e5cSJerome Brunet .en = { 557007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL8, 558007e6e5cSJerome Brunet .shift = 14, 559007e6e5cSJerome Brunet .width = 1, 560007e6e5cSJerome Brunet }, 561738f66d3SMichael Turquette .lock = &clk_lock, 562738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 563738f66d3SMichael Turquette .name = "mpll1", 56405b43aa2SJerome Brunet .ops = &meson_clk_mpll_ops, 565738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 566738f66d3SMichael Turquette .num_parents = 1, 567738f66d3SMichael Turquette }, 568738f66d3SMichael Turquette }; 569738f66d3SMichael Turquette 570738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll2 = { 571738f66d3SMichael Turquette .sdm = { 572738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL9, 573738f66d3SMichael Turquette .shift = 0, 574738f66d3SMichael Turquette .width = 14, 575738f66d3SMichael Turquette }, 576007e6e5cSJerome Brunet .sdm_en = { 577007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL9, 578007e6e5cSJerome Brunet .shift = 15, 579007e6e5cSJerome Brunet .width = 1, 580007e6e5cSJerome Brunet }, 581738f66d3SMichael Turquette .n2 = { 582738f66d3SMichael Turquette .reg_off = HHI_MPLL_CNTL9, 583738f66d3SMichael Turquette .shift = 16, 584738f66d3SMichael Turquette .width = 9, 585738f66d3SMichael Turquette }, 586007e6e5cSJerome Brunet .en = { 587007e6e5cSJerome Brunet .reg_off = HHI_MPLL_CNTL9, 588007e6e5cSJerome Brunet .shift = 14, 589007e6e5cSJerome Brunet .width = 1, 590007e6e5cSJerome Brunet }, 591738f66d3SMichael Turquette .lock = &clk_lock, 592738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 593738f66d3SMichael Turquette .name = "mpll2", 59405b43aa2SJerome Brunet .ops = &meson_clk_mpll_ops, 595738f66d3SMichael Turquette .parent_names = (const char *[]){ "fixed_pll" }, 596738f66d3SMichael Turquette .num_parents = 1, 597738f66d3SMichael Turquette }, 598738f66d3SMichael Turquette }; 599738f66d3SMichael Turquette 600738f66d3SMichael Turquette /* 60196b61c8dSMartin Blumenstingl * FIXME The legacy composite clocks (e.g. clk81) are both PLL post-dividers 60296b61c8dSMartin Blumenstingl * and should be modeled with their respective PLLs via the forthcoming 60396b61c8dSMartin Blumenstingl * coordinated clock rates feature 604738f66d3SMichael Turquette */ 605738f66d3SMichael Turquette 606215c80a7SJerome Brunet static u32 mux_table_clk81[] = { 0, 2, 3, 4, 5, 6, 7 }; 607215c80a7SJerome Brunet static const char * const clk81_parent_names[] = { 608215c80a7SJerome Brunet "xtal", "fclk_div7", "mpll1", "mpll2", "fclk_div4", 609215c80a7SJerome Brunet "fclk_div3", "fclk_div5" 610215c80a7SJerome Brunet }; 611738f66d3SMichael Turquette 612738f66d3SMichael Turquette static struct clk_mux gxbb_mpeg_clk_sel = { 613738f66d3SMichael Turquette .reg = (void *)HHI_MPEG_CLK_CNTL, 614738f66d3SMichael Turquette .mask = 0x7, 615738f66d3SMichael Turquette .shift = 12, 616738f66d3SMichael Turquette .flags = CLK_MUX_READ_ONLY, 617738f66d3SMichael Turquette .table = mux_table_clk81, 618738f66d3SMichael Turquette .lock = &clk_lock, 619738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 620738f66d3SMichael Turquette .name = "mpeg_clk_sel", 621738f66d3SMichael Turquette .ops = &clk_mux_ro_ops, 622738f66d3SMichael Turquette /* 623215c80a7SJerome Brunet * bits 14:12 selects from 8 possible parents: 624738f66d3SMichael Turquette * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2, 625738f66d3SMichael Turquette * fclk_div4, fclk_div3, fclk_div5 626738f66d3SMichael Turquette */ 627215c80a7SJerome Brunet .parent_names = clk81_parent_names, 628215c80a7SJerome Brunet .num_parents = ARRAY_SIZE(clk81_parent_names), 629738f66d3SMichael Turquette .flags = (CLK_SET_RATE_NO_REPARENT | CLK_IGNORE_UNUSED), 630738f66d3SMichael Turquette }, 631738f66d3SMichael Turquette }; 632738f66d3SMichael Turquette 633738f66d3SMichael Turquette static struct clk_divider gxbb_mpeg_clk_div = { 634738f66d3SMichael Turquette .reg = (void *)HHI_MPEG_CLK_CNTL, 635738f66d3SMichael Turquette .shift = 0, 636738f66d3SMichael Turquette .width = 7, 637738f66d3SMichael Turquette .lock = &clk_lock, 638738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 639738f66d3SMichael Turquette .name = "mpeg_clk_div", 640738f66d3SMichael Turquette .ops = &clk_divider_ops, 641738f66d3SMichael Turquette .parent_names = (const char *[]){ "mpeg_clk_sel" }, 642738f66d3SMichael Turquette .num_parents = 1, 643738f66d3SMichael Turquette .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), 644738f66d3SMichael Turquette }, 645738f66d3SMichael Turquette }; 646738f66d3SMichael Turquette 647738f66d3SMichael Turquette /* the mother of dragons^W gates */ 648738f66d3SMichael Turquette static struct clk_gate gxbb_clk81 = { 649738f66d3SMichael Turquette .reg = (void *)HHI_MPEG_CLK_CNTL, 650738f66d3SMichael Turquette .bit_idx = 7, 651738f66d3SMichael Turquette .lock = &clk_lock, 652738f66d3SMichael Turquette .hw.init = &(struct clk_init_data){ 653738f66d3SMichael Turquette .name = "clk81", 654738f66d3SMichael Turquette .ops = &clk_gate_ops, 655738f66d3SMichael Turquette .parent_names = (const char *[]){ "mpeg_clk_div" }, 656738f66d3SMichael Turquette .num_parents = 1, 65739c42ca9SJerome Brunet .flags = (CLK_SET_RATE_PARENT | CLK_IS_CRITICAL), 658738f66d3SMichael Turquette }, 659738f66d3SMichael Turquette }; 660738f66d3SMichael Turquette 66133d0fcdfSMartin Blumenstingl static struct clk_mux gxbb_sar_adc_clk_sel = { 66233d0fcdfSMartin Blumenstingl .reg = (void *)HHI_SAR_CLK_CNTL, 66333d0fcdfSMartin Blumenstingl .mask = 0x3, 66433d0fcdfSMartin Blumenstingl .shift = 9, 66533d0fcdfSMartin Blumenstingl .lock = &clk_lock, 66633d0fcdfSMartin Blumenstingl .hw.init = &(struct clk_init_data){ 66733d0fcdfSMartin Blumenstingl .name = "sar_adc_clk_sel", 66833d0fcdfSMartin Blumenstingl .ops = &clk_mux_ops, 66933d0fcdfSMartin Blumenstingl /* NOTE: The datasheet doesn't list the parents for bit 10 */ 67033d0fcdfSMartin Blumenstingl .parent_names = (const char *[]){ "xtal", "clk81", }, 67133d0fcdfSMartin Blumenstingl .num_parents = 2, 67233d0fcdfSMartin Blumenstingl }, 67333d0fcdfSMartin Blumenstingl }; 67433d0fcdfSMartin Blumenstingl 67533d0fcdfSMartin Blumenstingl static struct clk_divider gxbb_sar_adc_clk_div = { 67633d0fcdfSMartin Blumenstingl .reg = (void *)HHI_SAR_CLK_CNTL, 67733d0fcdfSMartin Blumenstingl .shift = 0, 67833d0fcdfSMartin Blumenstingl .width = 8, 67933d0fcdfSMartin Blumenstingl .lock = &clk_lock, 68033d0fcdfSMartin Blumenstingl .hw.init = &(struct clk_init_data){ 68133d0fcdfSMartin Blumenstingl .name = "sar_adc_clk_div", 68233d0fcdfSMartin Blumenstingl .ops = &clk_divider_ops, 68333d0fcdfSMartin Blumenstingl .parent_names = (const char *[]){ "sar_adc_clk_sel" }, 68433d0fcdfSMartin Blumenstingl .num_parents = 1, 68533d0fcdfSMartin Blumenstingl }, 68633d0fcdfSMartin Blumenstingl }; 68733d0fcdfSMartin Blumenstingl 68833d0fcdfSMartin Blumenstingl static struct clk_gate gxbb_sar_adc_clk = { 68933d0fcdfSMartin Blumenstingl .reg = (void *)HHI_SAR_CLK_CNTL, 69033d0fcdfSMartin Blumenstingl .bit_idx = 8, 69133d0fcdfSMartin Blumenstingl .lock = &clk_lock, 69233d0fcdfSMartin Blumenstingl .hw.init = &(struct clk_init_data){ 69333d0fcdfSMartin Blumenstingl .name = "sar_adc_clk", 69433d0fcdfSMartin Blumenstingl .ops = &clk_gate_ops, 69533d0fcdfSMartin Blumenstingl .parent_names = (const char *[]){ "sar_adc_clk_div" }, 69633d0fcdfSMartin Blumenstingl .num_parents = 1, 69733d0fcdfSMartin Blumenstingl .flags = CLK_SET_RATE_PARENT, 69833d0fcdfSMartin Blumenstingl }, 69933d0fcdfSMartin Blumenstingl }; 70033d0fcdfSMartin Blumenstingl 701fac9a55bSNeil Armstrong /* 702fac9a55bSNeil Armstrong * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) 703fac9a55bSNeil Armstrong * muxed by a glitch-free switch. 704fac9a55bSNeil Armstrong */ 705fac9a55bSNeil Armstrong 706fac9a55bSNeil Armstrong static u32 mux_table_mali_0_1[] = {0, 1, 2, 3, 4, 5, 6, 7}; 707c3c4cb8dSStephen Boyd static const char * const gxbb_mali_0_1_parent_names[] = { 708fac9a55bSNeil Armstrong "xtal", "gp0_pll", "mpll2", "mpll1", "fclk_div7", 709fac9a55bSNeil Armstrong "fclk_div4", "fclk_div3", "fclk_div5" 710fac9a55bSNeil Armstrong }; 711fac9a55bSNeil Armstrong 712fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali_0_sel = { 713fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 714fac9a55bSNeil Armstrong .mask = 0x7, 715fac9a55bSNeil Armstrong .shift = 9, 716fac9a55bSNeil Armstrong .table = mux_table_mali_0_1, 717fac9a55bSNeil Armstrong .lock = &clk_lock, 718fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 719fac9a55bSNeil Armstrong .name = "mali_0_sel", 720fac9a55bSNeil Armstrong .ops = &clk_mux_ops, 721fac9a55bSNeil Armstrong /* 722fac9a55bSNeil Armstrong * bits 10:9 selects from 8 possible parents: 723fac9a55bSNeil Armstrong * xtal, gp0_pll, mpll2, mpll1, fclk_div7, 724fac9a55bSNeil Armstrong * fclk_div4, fclk_div3, fclk_div5 725fac9a55bSNeil Armstrong */ 726fac9a55bSNeil Armstrong .parent_names = gxbb_mali_0_1_parent_names, 727fac9a55bSNeil Armstrong .num_parents = 8, 728fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_NO_REPARENT, 729fac9a55bSNeil Armstrong }, 730fac9a55bSNeil Armstrong }; 731fac9a55bSNeil Armstrong 732fac9a55bSNeil Armstrong static struct clk_divider gxbb_mali_0_div = { 733fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 734fac9a55bSNeil Armstrong .shift = 0, 735fac9a55bSNeil Armstrong .width = 7, 736fac9a55bSNeil Armstrong .lock = &clk_lock, 737fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 738fac9a55bSNeil Armstrong .name = "mali_0_div", 739fac9a55bSNeil Armstrong .ops = &clk_divider_ops, 740fac9a55bSNeil Armstrong .parent_names = (const char *[]){ "mali_0_sel" }, 741fac9a55bSNeil Armstrong .num_parents = 1, 742fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_NO_REPARENT, 743fac9a55bSNeil Armstrong }, 744fac9a55bSNeil Armstrong }; 745fac9a55bSNeil Armstrong 746fac9a55bSNeil Armstrong static struct clk_gate gxbb_mali_0 = { 747fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 748fac9a55bSNeil Armstrong .bit_idx = 8, 749fac9a55bSNeil Armstrong .lock = &clk_lock, 750fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 751fac9a55bSNeil Armstrong .name = "mali_0", 752fac9a55bSNeil Armstrong .ops = &clk_gate_ops, 753fac9a55bSNeil Armstrong .parent_names = (const char *[]){ "mali_0_div" }, 754fac9a55bSNeil Armstrong .num_parents = 1, 755fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_PARENT, 756fac9a55bSNeil Armstrong }, 757fac9a55bSNeil Armstrong }; 758fac9a55bSNeil Armstrong 759fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali_1_sel = { 760fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 761fac9a55bSNeil Armstrong .mask = 0x7, 762fac9a55bSNeil Armstrong .shift = 25, 763fac9a55bSNeil Armstrong .table = mux_table_mali_0_1, 764fac9a55bSNeil Armstrong .lock = &clk_lock, 765fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 766fac9a55bSNeil Armstrong .name = "mali_1_sel", 767fac9a55bSNeil Armstrong .ops = &clk_mux_ops, 768fac9a55bSNeil Armstrong /* 769fac9a55bSNeil Armstrong * bits 10:9 selects from 8 possible parents: 770fac9a55bSNeil Armstrong * xtal, gp0_pll, mpll2, mpll1, fclk_div7, 771fac9a55bSNeil Armstrong * fclk_div4, fclk_div3, fclk_div5 772fac9a55bSNeil Armstrong */ 773fac9a55bSNeil Armstrong .parent_names = gxbb_mali_0_1_parent_names, 774fac9a55bSNeil Armstrong .num_parents = 8, 775fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_NO_REPARENT, 776fac9a55bSNeil Armstrong }, 777fac9a55bSNeil Armstrong }; 778fac9a55bSNeil Armstrong 779fac9a55bSNeil Armstrong static struct clk_divider gxbb_mali_1_div = { 780fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 781fac9a55bSNeil Armstrong .shift = 16, 782fac9a55bSNeil Armstrong .width = 7, 783fac9a55bSNeil Armstrong .lock = &clk_lock, 784fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 785fac9a55bSNeil Armstrong .name = "mali_1_div", 786fac9a55bSNeil Armstrong .ops = &clk_divider_ops, 787fac9a55bSNeil Armstrong .parent_names = (const char *[]){ "mali_1_sel" }, 788fac9a55bSNeil Armstrong .num_parents = 1, 789fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_NO_REPARENT, 790fac9a55bSNeil Armstrong }, 791fac9a55bSNeil Armstrong }; 792fac9a55bSNeil Armstrong 793fac9a55bSNeil Armstrong static struct clk_gate gxbb_mali_1 = { 794fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 795fac9a55bSNeil Armstrong .bit_idx = 24, 796fac9a55bSNeil Armstrong .lock = &clk_lock, 797fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 798fac9a55bSNeil Armstrong .name = "mali_1", 799fac9a55bSNeil Armstrong .ops = &clk_gate_ops, 800fac9a55bSNeil Armstrong .parent_names = (const char *[]){ "mali_1_div" }, 801fac9a55bSNeil Armstrong .num_parents = 1, 802fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_PARENT, 803fac9a55bSNeil Armstrong }, 804fac9a55bSNeil Armstrong }; 805fac9a55bSNeil Armstrong 806fac9a55bSNeil Armstrong static u32 mux_table_mali[] = {0, 1}; 807c3c4cb8dSStephen Boyd static const char * const gxbb_mali_parent_names[] = { 808fac9a55bSNeil Armstrong "mali_0", "mali_1" 809fac9a55bSNeil Armstrong }; 810fac9a55bSNeil Armstrong 811fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali = { 812fac9a55bSNeil Armstrong .reg = (void *)HHI_MALI_CLK_CNTL, 813fac9a55bSNeil Armstrong .mask = 1, 814fac9a55bSNeil Armstrong .shift = 31, 815fac9a55bSNeil Armstrong .table = mux_table_mali, 816fac9a55bSNeil Armstrong .lock = &clk_lock, 817fac9a55bSNeil Armstrong .hw.init = &(struct clk_init_data){ 818fac9a55bSNeil Armstrong .name = "mali", 819fac9a55bSNeil Armstrong .ops = &clk_mux_ops, 820fac9a55bSNeil Armstrong .parent_names = gxbb_mali_parent_names, 821fac9a55bSNeil Armstrong .num_parents = 2, 822fac9a55bSNeil Armstrong .flags = CLK_SET_RATE_NO_REPARENT, 823fac9a55bSNeil Armstrong }, 824fac9a55bSNeil Armstrong }; 825fac9a55bSNeil Armstrong 8264087bd4bSJerome Brunet static struct clk_mux gxbb_cts_amclk_sel = { 8274087bd4bSJerome Brunet .reg = (void *) HHI_AUD_CLK_CNTL, 8284087bd4bSJerome Brunet .mask = 0x3, 8294087bd4bSJerome Brunet .shift = 9, 8304087bd4bSJerome Brunet /* Default parent unknown (register reset value: 0) */ 8314087bd4bSJerome Brunet .table = (u32[]){ 1, 2, 3 }, 8324087bd4bSJerome Brunet .lock = &clk_lock, 8334087bd4bSJerome Brunet .hw.init = &(struct clk_init_data){ 8344087bd4bSJerome Brunet .name = "cts_amclk_sel", 8354087bd4bSJerome Brunet .ops = &clk_mux_ops, 8364087bd4bSJerome Brunet .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" }, 8374087bd4bSJerome Brunet .num_parents = 3, 8384087bd4bSJerome Brunet .flags = CLK_SET_RATE_PARENT, 8394087bd4bSJerome Brunet }, 8404087bd4bSJerome Brunet }; 8414087bd4bSJerome Brunet 8424087bd4bSJerome Brunet static struct meson_clk_audio_divider gxbb_cts_amclk_div = { 8434087bd4bSJerome Brunet .div = { 8444087bd4bSJerome Brunet .reg_off = HHI_AUD_CLK_CNTL, 8454087bd4bSJerome Brunet .shift = 0, 8464087bd4bSJerome Brunet .width = 8, 8474087bd4bSJerome Brunet }, 848004f6f46SJerome Brunet .flags = CLK_DIVIDER_ROUND_CLOSEST, 8494087bd4bSJerome Brunet .lock = &clk_lock, 8504087bd4bSJerome Brunet .hw.init = &(struct clk_init_data){ 8514087bd4bSJerome Brunet .name = "cts_amclk_div", 8524087bd4bSJerome Brunet .ops = &meson_clk_audio_divider_ops, 8534087bd4bSJerome Brunet .parent_names = (const char *[]){ "cts_amclk_sel" }, 8544087bd4bSJerome Brunet .num_parents = 1, 855004f6f46SJerome Brunet .flags = CLK_SET_RATE_PARENT, 8564087bd4bSJerome Brunet }, 8574087bd4bSJerome Brunet }; 8584087bd4bSJerome Brunet 8594087bd4bSJerome Brunet static struct clk_gate gxbb_cts_amclk = { 8604087bd4bSJerome Brunet .reg = (void *) HHI_AUD_CLK_CNTL, 8614087bd4bSJerome Brunet .bit_idx = 8, 8624087bd4bSJerome Brunet .lock = &clk_lock, 8634087bd4bSJerome Brunet .hw.init = &(struct clk_init_data){ 8644087bd4bSJerome Brunet .name = "cts_amclk", 8654087bd4bSJerome Brunet .ops = &clk_gate_ops, 8664087bd4bSJerome Brunet .parent_names = (const char *[]){ "cts_amclk_div" }, 8674087bd4bSJerome Brunet .num_parents = 1, 8684087bd4bSJerome Brunet .flags = CLK_SET_RATE_PARENT, 8694087bd4bSJerome Brunet }, 8704087bd4bSJerome Brunet }; 8714087bd4bSJerome Brunet 8723c277c24SJerome Brunet static struct clk_mux gxbb_cts_mclk_i958_sel = { 8733c277c24SJerome Brunet .reg = (void *)HHI_AUD_CLK_CNTL2, 8743c277c24SJerome Brunet .mask = 0x3, 8753c277c24SJerome Brunet .shift = 25, 8763c277c24SJerome Brunet /* Default parent unknown (register reset value: 0) */ 8773c277c24SJerome Brunet .table = (u32[]){ 1, 2, 3 }, 8783c277c24SJerome Brunet .lock = &clk_lock, 8793c277c24SJerome Brunet .hw.init = &(struct clk_init_data) { 8803c277c24SJerome Brunet .name = "cts_mclk_i958_sel", 8813c277c24SJerome Brunet .ops = &clk_mux_ops, 8823c277c24SJerome Brunet .parent_names = (const char *[]){ "mpll0", "mpll1", "mpll2" }, 8833c277c24SJerome Brunet .num_parents = 3, 8843c277c24SJerome Brunet .flags = CLK_SET_RATE_PARENT, 8853c277c24SJerome Brunet }, 8863c277c24SJerome Brunet }; 8873c277c24SJerome Brunet 8883c277c24SJerome Brunet static struct clk_divider gxbb_cts_mclk_i958_div = { 8893c277c24SJerome Brunet .reg = (void *)HHI_AUD_CLK_CNTL2, 8903c277c24SJerome Brunet .shift = 16, 8913c277c24SJerome Brunet .width = 8, 8923c277c24SJerome Brunet .lock = &clk_lock, 8937605aa5bSJerome Brunet .flags = CLK_DIVIDER_ROUND_CLOSEST, 8943c277c24SJerome Brunet .hw.init = &(struct clk_init_data) { 8953c277c24SJerome Brunet .name = "cts_mclk_i958_div", 8963c277c24SJerome Brunet .ops = &clk_divider_ops, 8973c277c24SJerome Brunet .parent_names = (const char *[]){ "cts_mclk_i958_sel" }, 8983c277c24SJerome Brunet .num_parents = 1, 8997605aa5bSJerome Brunet .flags = CLK_SET_RATE_PARENT, 9003c277c24SJerome Brunet }, 9013c277c24SJerome Brunet }; 9023c277c24SJerome Brunet 9033c277c24SJerome Brunet static struct clk_gate gxbb_cts_mclk_i958 = { 9043c277c24SJerome Brunet .reg = (void *)HHI_AUD_CLK_CNTL2, 9053c277c24SJerome Brunet .bit_idx = 24, 9063c277c24SJerome Brunet .lock = &clk_lock, 9073c277c24SJerome Brunet .hw.init = &(struct clk_init_data){ 9083c277c24SJerome Brunet .name = "cts_mclk_i958", 9093c277c24SJerome Brunet .ops = &clk_gate_ops, 9103c277c24SJerome Brunet .parent_names = (const char *[]){ "cts_mclk_i958_div" }, 9113c277c24SJerome Brunet .num_parents = 1, 9123c277c24SJerome Brunet .flags = CLK_SET_RATE_PARENT, 9133c277c24SJerome Brunet }, 9143c277c24SJerome Brunet }; 9153c277c24SJerome Brunet 9167eaa44f6SJerome Brunet static struct clk_mux gxbb_cts_i958 = { 9177eaa44f6SJerome Brunet .reg = (void *)HHI_AUD_CLK_CNTL2, 9187eaa44f6SJerome Brunet .mask = 0x1, 9197eaa44f6SJerome Brunet .shift = 27, 9207eaa44f6SJerome Brunet .lock = &clk_lock, 9217eaa44f6SJerome Brunet .hw.init = &(struct clk_init_data){ 9227eaa44f6SJerome Brunet .name = "cts_i958", 9237eaa44f6SJerome Brunet .ops = &clk_mux_ops, 9247eaa44f6SJerome Brunet .parent_names = (const char *[]){ "cts_amclk", "cts_mclk_i958" }, 9257eaa44f6SJerome Brunet .num_parents = 2, 9267eaa44f6SJerome Brunet /* 9277eaa44f6SJerome Brunet *The parent is specific to origin of the audio data. Let the 9287eaa44f6SJerome Brunet * consumer choose the appropriate parent 9297eaa44f6SJerome Brunet */ 9307eaa44f6SJerome Brunet .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 9317eaa44f6SJerome Brunet }, 9327eaa44f6SJerome Brunet }; 9337eaa44f6SJerome Brunet 93414c735c8SNeil Armstrong static struct clk_divider gxbb_32k_clk_div = { 93514c735c8SNeil Armstrong .reg = (void *)HHI_32K_CLK_CNTL, 93614c735c8SNeil Armstrong .shift = 0, 93714c735c8SNeil Armstrong .width = 14, 93814c735c8SNeil Armstrong .lock = &clk_lock, 93914c735c8SNeil Armstrong .hw.init = &(struct clk_init_data){ 94014c735c8SNeil Armstrong .name = "32k_clk_div", 94114c735c8SNeil Armstrong .ops = &clk_divider_ops, 94214c735c8SNeil Armstrong .parent_names = (const char *[]){ "32k_clk_sel" }, 94314c735c8SNeil Armstrong .num_parents = 1, 94414c735c8SNeil Armstrong .flags = CLK_SET_RATE_PARENT | CLK_DIVIDER_ROUND_CLOSEST, 94514c735c8SNeil Armstrong }, 94614c735c8SNeil Armstrong }; 94714c735c8SNeil Armstrong 94814c735c8SNeil Armstrong static struct clk_gate gxbb_32k_clk = { 94914c735c8SNeil Armstrong .reg = (void *)HHI_32K_CLK_CNTL, 95014c735c8SNeil Armstrong .bit_idx = 15, 95114c735c8SNeil Armstrong .lock = &clk_lock, 95214c735c8SNeil Armstrong .hw.init = &(struct clk_init_data){ 95314c735c8SNeil Armstrong .name = "32k_clk", 95414c735c8SNeil Armstrong .ops = &clk_gate_ops, 95514c735c8SNeil Armstrong .parent_names = (const char *[]){ "32k_clk_div" }, 95614c735c8SNeil Armstrong .num_parents = 1, 95714c735c8SNeil Armstrong .flags = CLK_SET_RATE_PARENT, 95814c735c8SNeil Armstrong }, 95914c735c8SNeil Armstrong }; 96014c735c8SNeil Armstrong 961c3c4cb8dSStephen Boyd static const char * const gxbb_32k_clk_parent_names[] = { 96214c735c8SNeil Armstrong "xtal", "cts_slow_oscin", "fclk_div3", "fclk_div5" 96314c735c8SNeil Armstrong }; 96414c735c8SNeil Armstrong 96514c735c8SNeil Armstrong static struct clk_mux gxbb_32k_clk_sel = { 96614c735c8SNeil Armstrong .reg = (void *)HHI_32K_CLK_CNTL, 96714c735c8SNeil Armstrong .mask = 0x3, 96814c735c8SNeil Armstrong .shift = 16, 96914c735c8SNeil Armstrong .lock = &clk_lock, 97014c735c8SNeil Armstrong .hw.init = &(struct clk_init_data){ 97114c735c8SNeil Armstrong .name = "32k_clk_sel", 97214c735c8SNeil Armstrong .ops = &clk_mux_ops, 97314c735c8SNeil Armstrong .parent_names = gxbb_32k_clk_parent_names, 97414c735c8SNeil Armstrong .num_parents = 4, 97514c735c8SNeil Armstrong .flags = CLK_SET_RATE_PARENT, 97614c735c8SNeil Armstrong }, 97714c735c8SNeil Armstrong }; 97814c735c8SNeil Armstrong 979738f66d3SMichael Turquette /* Everything Else (EE) domain gates */ 9807ba64d82SAlexander Müller static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0); 9817ba64d82SAlexander Müller static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1); 9827ba64d82SAlexander Müller static MESON_GATE(gxbb_isa, HHI_GCLK_MPEG0, 5); 9837ba64d82SAlexander Müller static MESON_GATE(gxbb_pl301, HHI_GCLK_MPEG0, 6); 9847ba64d82SAlexander Müller static MESON_GATE(gxbb_periphs, HHI_GCLK_MPEG0, 7); 9857ba64d82SAlexander Müller static MESON_GATE(gxbb_spicc, HHI_GCLK_MPEG0, 8); 9867ba64d82SAlexander Müller static MESON_GATE(gxbb_i2c, HHI_GCLK_MPEG0, 9); 9877ba64d82SAlexander Müller static MESON_GATE(gxbb_sar_adc, HHI_GCLK_MPEG0, 10); 9887ba64d82SAlexander Müller static MESON_GATE(gxbb_smart_card, HHI_GCLK_MPEG0, 11); 9897ba64d82SAlexander Müller static MESON_GATE(gxbb_rng0, HHI_GCLK_MPEG0, 12); 9907ba64d82SAlexander Müller static MESON_GATE(gxbb_uart0, HHI_GCLK_MPEG0, 13); 9917ba64d82SAlexander Müller static MESON_GATE(gxbb_sdhc, HHI_GCLK_MPEG0, 14); 9927ba64d82SAlexander Müller static MESON_GATE(gxbb_stream, HHI_GCLK_MPEG0, 15); 9937ba64d82SAlexander Müller static MESON_GATE(gxbb_async_fifo, HHI_GCLK_MPEG0, 16); 9947ba64d82SAlexander Müller static MESON_GATE(gxbb_sdio, HHI_GCLK_MPEG0, 17); 9957ba64d82SAlexander Müller static MESON_GATE(gxbb_abuf, HHI_GCLK_MPEG0, 18); 9967ba64d82SAlexander Müller static MESON_GATE(gxbb_hiu_iface, HHI_GCLK_MPEG0, 19); 9977ba64d82SAlexander Müller static MESON_GATE(gxbb_assist_misc, HHI_GCLK_MPEG0, 23); 9987ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_a, HHI_GCLK_MPEG0, 24); 9997ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_b, HHI_GCLK_MPEG0, 25); 10007ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_c, HHI_GCLK_MPEG0, 26); 10017ba64d82SAlexander Müller static MESON_GATE(gxbb_spi, HHI_GCLK_MPEG0, 30); 1002738f66d3SMichael Turquette 10037ba64d82SAlexander Müller static MESON_GATE(gxbb_i2s_spdif, HHI_GCLK_MPEG1, 2); 10047ba64d82SAlexander Müller static MESON_GATE(gxbb_eth, HHI_GCLK_MPEG1, 3); 10057ba64d82SAlexander Müller static MESON_GATE(gxbb_demux, HHI_GCLK_MPEG1, 4); 10067ba64d82SAlexander Müller static MESON_GATE(gxbb_aiu_glue, HHI_GCLK_MPEG1, 6); 10077ba64d82SAlexander Müller static MESON_GATE(gxbb_iec958, HHI_GCLK_MPEG1, 7); 10087ba64d82SAlexander Müller static MESON_GATE(gxbb_i2s_out, HHI_GCLK_MPEG1, 8); 10097ba64d82SAlexander Müller static MESON_GATE(gxbb_amclk, HHI_GCLK_MPEG1, 9); 10107ba64d82SAlexander Müller static MESON_GATE(gxbb_aififo2, HHI_GCLK_MPEG1, 10); 10117ba64d82SAlexander Müller static MESON_GATE(gxbb_mixer, HHI_GCLK_MPEG1, 11); 10127ba64d82SAlexander Müller static MESON_GATE(gxbb_mixer_iface, HHI_GCLK_MPEG1, 12); 10137ba64d82SAlexander Müller static MESON_GATE(gxbb_adc, HHI_GCLK_MPEG1, 13); 10147ba64d82SAlexander Müller static MESON_GATE(gxbb_blkmv, HHI_GCLK_MPEG1, 14); 10157ba64d82SAlexander Müller static MESON_GATE(gxbb_aiu, HHI_GCLK_MPEG1, 15); 10167ba64d82SAlexander Müller static MESON_GATE(gxbb_uart1, HHI_GCLK_MPEG1, 16); 10177ba64d82SAlexander Müller static MESON_GATE(gxbb_g2d, HHI_GCLK_MPEG1, 20); 10187ba64d82SAlexander Müller static MESON_GATE(gxbb_usb0, HHI_GCLK_MPEG1, 21); 10197ba64d82SAlexander Müller static MESON_GATE(gxbb_usb1, HHI_GCLK_MPEG1, 22); 10207ba64d82SAlexander Müller static MESON_GATE(gxbb_reset, HHI_GCLK_MPEG1, 23); 10217ba64d82SAlexander Müller static MESON_GATE(gxbb_nand, HHI_GCLK_MPEG1, 24); 10227ba64d82SAlexander Müller static MESON_GATE(gxbb_dos_parser, HHI_GCLK_MPEG1, 25); 10237ba64d82SAlexander Müller static MESON_GATE(gxbb_usb, HHI_GCLK_MPEG1, 26); 10247ba64d82SAlexander Müller static MESON_GATE(gxbb_vdin1, HHI_GCLK_MPEG1, 28); 10257ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_arb0, HHI_GCLK_MPEG1, 29); 10267ba64d82SAlexander Müller static MESON_GATE(gxbb_efuse, HHI_GCLK_MPEG1, 30); 10277ba64d82SAlexander Müller static MESON_GATE(gxbb_boot_rom, HHI_GCLK_MPEG1, 31); 1028738f66d3SMichael Turquette 10297ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_data_bus, HHI_GCLK_MPEG2, 1); 10307ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2); 10317ba64d82SAlexander Müller static MESON_GATE(gxbb_hdmi_intr_sync, HHI_GCLK_MPEG2, 3); 10327ba64d82SAlexander Müller static MESON_GATE(gxbb_hdmi_pclk, HHI_GCLK_MPEG2, 4); 10337ba64d82SAlexander Müller static MESON_GATE(gxbb_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8); 10347ba64d82SAlexander Müller static MESON_GATE(gxbb_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9); 10357ba64d82SAlexander Müller static MESON_GATE(gxbb_mmc_pclk, HHI_GCLK_MPEG2, 11); 10367ba64d82SAlexander Müller static MESON_GATE(gxbb_dvin, HHI_GCLK_MPEG2, 12); 10377ba64d82SAlexander Müller static MESON_GATE(gxbb_uart2, HHI_GCLK_MPEG2, 15); 10387ba64d82SAlexander Müller static MESON_GATE(gxbb_sana, HHI_GCLK_MPEG2, 22); 10397ba64d82SAlexander Müller static MESON_GATE(gxbb_vpu_intr, HHI_GCLK_MPEG2, 25); 10407ba64d82SAlexander Müller static MESON_GATE(gxbb_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26); 10417ba64d82SAlexander Müller static MESON_GATE(gxbb_clk81_a53, HHI_GCLK_MPEG2, 29); 1042738f66d3SMichael Turquette 10437ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venci0, HHI_GCLK_OTHER, 1); 10447ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venci1, HHI_GCLK_OTHER, 2); 10457ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencp0, HHI_GCLK_OTHER, 3); 10467ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencp1, HHI_GCLK_OTHER, 4); 10477ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_venci_int0, HHI_GCLK_OTHER, 8); 10487ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_vencp_int, HHI_GCLK_OTHER, 9); 10497ba64d82SAlexander Müller static MESON_GATE(gxbb_dac_clk, HHI_GCLK_OTHER, 10); 10507ba64d82SAlexander Müller static MESON_GATE(gxbb_aoclk_gate, HHI_GCLK_OTHER, 14); 10517ba64d82SAlexander Müller static MESON_GATE(gxbb_iec958_gate, HHI_GCLK_OTHER, 16); 10527ba64d82SAlexander Müller static MESON_GATE(gxbb_enc480p, HHI_GCLK_OTHER, 20); 10537ba64d82SAlexander Müller static MESON_GATE(gxbb_rng1, HHI_GCLK_OTHER, 21); 10547ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_venci_int1, HHI_GCLK_OTHER, 22); 10557ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venclmcc, HHI_GCLK_OTHER, 24); 10567ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencl, HHI_GCLK_OTHER, 25); 10577ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk_other, HHI_GCLK_OTHER, 26); 10587ba64d82SAlexander Müller static MESON_GATE(gxbb_edp, HHI_GCLK_OTHER, 31); 1059738f66d3SMichael Turquette 1060738f66d3SMichael Turquette /* Always On (AO) domain gates */ 1061738f66d3SMichael Turquette 10627ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_media_cpu, HHI_GCLK_AO, 0); 10637ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_ahb_sram, HHI_GCLK_AO, 1); 10647ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_ahb_bus, HHI_GCLK_AO, 2); 10657ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_iface, HHI_GCLK_AO, 3); 10667ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_i2c, HHI_GCLK_AO, 4); 1067738f66d3SMichael Turquette 1068738f66d3SMichael Turquette /* Array of all clocks provided by this provider */ 1069738f66d3SMichael Turquette 1070738f66d3SMichael Turquette static struct clk_hw_onecell_data gxbb_hw_onecell_data = { 1071738f66d3SMichael Turquette .hws = { 1072738f66d3SMichael Turquette [CLKID_SYS_PLL] = &gxbb_sys_pll.hw, 1073738f66d3SMichael Turquette [CLKID_HDMI_PLL] = &gxbb_hdmi_pll.hw, 1074738f66d3SMichael Turquette [CLKID_FIXED_PLL] = &gxbb_fixed_pll.hw, 1075738f66d3SMichael Turquette [CLKID_FCLK_DIV2] = &gxbb_fclk_div2.hw, 1076738f66d3SMichael Turquette [CLKID_FCLK_DIV3] = &gxbb_fclk_div3.hw, 1077738f66d3SMichael Turquette [CLKID_FCLK_DIV4] = &gxbb_fclk_div4.hw, 1078738f66d3SMichael Turquette [CLKID_FCLK_DIV5] = &gxbb_fclk_div5.hw, 1079738f66d3SMichael Turquette [CLKID_FCLK_DIV7] = &gxbb_fclk_div7.hw, 1080738f66d3SMichael Turquette [CLKID_GP0_PLL] = &gxbb_gp0_pll.hw, 1081738f66d3SMichael Turquette [CLKID_MPEG_SEL] = &gxbb_mpeg_clk_sel.hw, 1082738f66d3SMichael Turquette [CLKID_MPEG_DIV] = &gxbb_mpeg_clk_div.hw, 1083738f66d3SMichael Turquette [CLKID_CLK81] = &gxbb_clk81.hw, 1084738f66d3SMichael Turquette [CLKID_MPLL0] = &gxbb_mpll0.hw, 1085738f66d3SMichael Turquette [CLKID_MPLL1] = &gxbb_mpll1.hw, 1086738f66d3SMichael Turquette [CLKID_MPLL2] = &gxbb_mpll2.hw, 1087738f66d3SMichael Turquette [CLKID_DDR] = &gxbb_ddr.hw, 1088738f66d3SMichael Turquette [CLKID_DOS] = &gxbb_dos.hw, 1089738f66d3SMichael Turquette [CLKID_ISA] = &gxbb_isa.hw, 1090738f66d3SMichael Turquette [CLKID_PL301] = &gxbb_pl301.hw, 1091738f66d3SMichael Turquette [CLKID_PERIPHS] = &gxbb_periphs.hw, 1092738f66d3SMichael Turquette [CLKID_SPICC] = &gxbb_spicc.hw, 1093738f66d3SMichael Turquette [CLKID_I2C] = &gxbb_i2c.hw, 1094738f66d3SMichael Turquette [CLKID_SAR_ADC] = &gxbb_sar_adc.hw, 1095738f66d3SMichael Turquette [CLKID_SMART_CARD] = &gxbb_smart_card.hw, 1096738f66d3SMichael Turquette [CLKID_RNG0] = &gxbb_rng0.hw, 1097738f66d3SMichael Turquette [CLKID_UART0] = &gxbb_uart0.hw, 1098738f66d3SMichael Turquette [CLKID_SDHC] = &gxbb_sdhc.hw, 1099738f66d3SMichael Turquette [CLKID_STREAM] = &gxbb_stream.hw, 1100738f66d3SMichael Turquette [CLKID_ASYNC_FIFO] = &gxbb_async_fifo.hw, 1101738f66d3SMichael Turquette [CLKID_SDIO] = &gxbb_sdio.hw, 1102738f66d3SMichael Turquette [CLKID_ABUF] = &gxbb_abuf.hw, 1103738f66d3SMichael Turquette [CLKID_HIU_IFACE] = &gxbb_hiu_iface.hw, 1104738f66d3SMichael Turquette [CLKID_ASSIST_MISC] = &gxbb_assist_misc.hw, 1105738f66d3SMichael Turquette [CLKID_SPI] = &gxbb_spi.hw, 1106738f66d3SMichael Turquette [CLKID_I2S_SPDIF] = &gxbb_i2s_spdif.hw, 1107738f66d3SMichael Turquette [CLKID_ETH] = &gxbb_eth.hw, 1108738f66d3SMichael Turquette [CLKID_DEMUX] = &gxbb_demux.hw, 1109738f66d3SMichael Turquette [CLKID_AIU_GLUE] = &gxbb_aiu_glue.hw, 1110738f66d3SMichael Turquette [CLKID_IEC958] = &gxbb_iec958.hw, 1111738f66d3SMichael Turquette [CLKID_I2S_OUT] = &gxbb_i2s_out.hw, 1112738f66d3SMichael Turquette [CLKID_AMCLK] = &gxbb_amclk.hw, 1113738f66d3SMichael Turquette [CLKID_AIFIFO2] = &gxbb_aififo2.hw, 1114738f66d3SMichael Turquette [CLKID_MIXER] = &gxbb_mixer.hw, 1115738f66d3SMichael Turquette [CLKID_MIXER_IFACE] = &gxbb_mixer_iface.hw, 1116738f66d3SMichael Turquette [CLKID_ADC] = &gxbb_adc.hw, 1117738f66d3SMichael Turquette [CLKID_BLKMV] = &gxbb_blkmv.hw, 1118738f66d3SMichael Turquette [CLKID_AIU] = &gxbb_aiu.hw, 1119738f66d3SMichael Turquette [CLKID_UART1] = &gxbb_uart1.hw, 1120738f66d3SMichael Turquette [CLKID_G2D] = &gxbb_g2d.hw, 1121738f66d3SMichael Turquette [CLKID_USB0] = &gxbb_usb0.hw, 1122738f66d3SMichael Turquette [CLKID_USB1] = &gxbb_usb1.hw, 1123738f66d3SMichael Turquette [CLKID_RESET] = &gxbb_reset.hw, 1124738f66d3SMichael Turquette [CLKID_NAND] = &gxbb_nand.hw, 1125738f66d3SMichael Turquette [CLKID_DOS_PARSER] = &gxbb_dos_parser.hw, 1126738f66d3SMichael Turquette [CLKID_USB] = &gxbb_usb.hw, 1127738f66d3SMichael Turquette [CLKID_VDIN1] = &gxbb_vdin1.hw, 1128738f66d3SMichael Turquette [CLKID_AHB_ARB0] = &gxbb_ahb_arb0.hw, 1129738f66d3SMichael Turquette [CLKID_EFUSE] = &gxbb_efuse.hw, 1130738f66d3SMichael Turquette [CLKID_BOOT_ROM] = &gxbb_boot_rom.hw, 1131738f66d3SMichael Turquette [CLKID_AHB_DATA_BUS] = &gxbb_ahb_data_bus.hw, 1132738f66d3SMichael Turquette [CLKID_AHB_CTRL_BUS] = &gxbb_ahb_ctrl_bus.hw, 1133738f66d3SMichael Turquette [CLKID_HDMI_INTR_SYNC] = &gxbb_hdmi_intr_sync.hw, 1134738f66d3SMichael Turquette [CLKID_HDMI_PCLK] = &gxbb_hdmi_pclk.hw, 1135738f66d3SMichael Turquette [CLKID_USB1_DDR_BRIDGE] = &gxbb_usb1_ddr_bridge.hw, 1136738f66d3SMichael Turquette [CLKID_USB0_DDR_BRIDGE] = &gxbb_usb0_ddr_bridge.hw, 1137738f66d3SMichael Turquette [CLKID_MMC_PCLK] = &gxbb_mmc_pclk.hw, 1138738f66d3SMichael Turquette [CLKID_DVIN] = &gxbb_dvin.hw, 1139738f66d3SMichael Turquette [CLKID_UART2] = &gxbb_uart2.hw, 1140738f66d3SMichael Turquette [CLKID_SANA] = &gxbb_sana.hw, 1141738f66d3SMichael Turquette [CLKID_VPU_INTR] = &gxbb_vpu_intr.hw, 1142738f66d3SMichael Turquette [CLKID_SEC_AHB_AHB3_BRIDGE] = &gxbb_sec_ahb_ahb3_bridge.hw, 1143738f66d3SMichael Turquette [CLKID_CLK81_A53] = &gxbb_clk81_a53.hw, 1144738f66d3SMichael Turquette [CLKID_VCLK2_VENCI0] = &gxbb_vclk2_venci0.hw, 1145738f66d3SMichael Turquette [CLKID_VCLK2_VENCI1] = &gxbb_vclk2_venci1.hw, 1146738f66d3SMichael Turquette [CLKID_VCLK2_VENCP0] = &gxbb_vclk2_vencp0.hw, 1147738f66d3SMichael Turquette [CLKID_VCLK2_VENCP1] = &gxbb_vclk2_vencp1.hw, 1148738f66d3SMichael Turquette [CLKID_GCLK_VENCI_INT0] = &gxbb_gclk_venci_int0.hw, 1149738f66d3SMichael Turquette [CLKID_GCLK_VENCI_INT] = &gxbb_gclk_vencp_int.hw, 1150738f66d3SMichael Turquette [CLKID_DAC_CLK] = &gxbb_dac_clk.hw, 1151738f66d3SMichael Turquette [CLKID_AOCLK_GATE] = &gxbb_aoclk_gate.hw, 1152738f66d3SMichael Turquette [CLKID_IEC958_GATE] = &gxbb_iec958_gate.hw, 1153738f66d3SMichael Turquette [CLKID_ENC480P] = &gxbb_enc480p.hw, 1154738f66d3SMichael Turquette [CLKID_RNG1] = &gxbb_rng1.hw, 1155738f66d3SMichael Turquette [CLKID_GCLK_VENCI_INT1] = &gxbb_gclk_venci_int1.hw, 1156738f66d3SMichael Turquette [CLKID_VCLK2_VENCLMCC] = &gxbb_vclk2_venclmcc.hw, 1157738f66d3SMichael Turquette [CLKID_VCLK2_VENCL] = &gxbb_vclk2_vencl.hw, 1158738f66d3SMichael Turquette [CLKID_VCLK_OTHER] = &gxbb_vclk_other.hw, 1159738f66d3SMichael Turquette [CLKID_EDP] = &gxbb_edp.hw, 1160738f66d3SMichael Turquette [CLKID_AO_MEDIA_CPU] = &gxbb_ao_media_cpu.hw, 1161738f66d3SMichael Turquette [CLKID_AO_AHB_SRAM] = &gxbb_ao_ahb_sram.hw, 1162738f66d3SMichael Turquette [CLKID_AO_AHB_BUS] = &gxbb_ao_ahb_bus.hw, 1163738f66d3SMichael Turquette [CLKID_AO_IFACE] = &gxbb_ao_iface.hw, 1164738f66d3SMichael Turquette [CLKID_AO_I2C] = &gxbb_ao_i2c.hw, 116533608dcdSKevin Hilman [CLKID_SD_EMMC_A] = &gxbb_emmc_a.hw, 116633608dcdSKevin Hilman [CLKID_SD_EMMC_B] = &gxbb_emmc_b.hw, 116733608dcdSKevin Hilman [CLKID_SD_EMMC_C] = &gxbb_emmc_c.hw, 116833d0fcdfSMartin Blumenstingl [CLKID_SAR_ADC_CLK] = &gxbb_sar_adc_clk.hw, 116933d0fcdfSMartin Blumenstingl [CLKID_SAR_ADC_SEL] = &gxbb_sar_adc_clk_sel.hw, 117033d0fcdfSMartin Blumenstingl [CLKID_SAR_ADC_DIV] = &gxbb_sar_adc_clk_div.hw, 1171fac9a55bSNeil Armstrong [CLKID_MALI_0_SEL] = &gxbb_mali_0_sel.hw, 1172fac9a55bSNeil Armstrong [CLKID_MALI_0_DIV] = &gxbb_mali_0_div.hw, 1173fac9a55bSNeil Armstrong [CLKID_MALI_0] = &gxbb_mali_0.hw, 1174fac9a55bSNeil Armstrong [CLKID_MALI_1_SEL] = &gxbb_mali_1_sel.hw, 1175fac9a55bSNeil Armstrong [CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw, 1176fac9a55bSNeil Armstrong [CLKID_MALI_1] = &gxbb_mali_1.hw, 1177fac9a55bSNeil Armstrong [CLKID_MALI] = &gxbb_mali.hw, 11784087bd4bSJerome Brunet [CLKID_CTS_AMCLK] = &gxbb_cts_amclk.hw, 11794087bd4bSJerome Brunet [CLKID_CTS_AMCLK_SEL] = &gxbb_cts_amclk_sel.hw, 11804087bd4bSJerome Brunet [CLKID_CTS_AMCLK_DIV] = &gxbb_cts_amclk_div.hw, 11813c277c24SJerome Brunet [CLKID_CTS_MCLK_I958] = &gxbb_cts_mclk_i958.hw, 11823c277c24SJerome Brunet [CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw, 11833c277c24SJerome Brunet [CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw, 11847eaa44f6SJerome Brunet [CLKID_CTS_I958] = &gxbb_cts_i958.hw, 118514c735c8SNeil Armstrong [CLKID_32K_CLK] = &gxbb_32k_clk.hw, 118614c735c8SNeil Armstrong [CLKID_32K_CLK_SEL] = &gxbb_32k_clk_sel.hw, 118714c735c8SNeil Armstrong [CLKID_32K_CLK_DIV] = &gxbb_32k_clk_div.hw, 11881f6f1dcbSJerome Brunet [NR_CLKS] = NULL, 1189738f66d3SMichael Turquette }, 1190738f66d3SMichael Turquette .num = NR_CLKS, 1191738f66d3SMichael Turquette }; 1192738f66d3SMichael Turquette 11930d48fc55SNeil Armstrong static struct clk_hw_onecell_data gxl_hw_onecell_data = { 11940d48fc55SNeil Armstrong .hws = { 11950d48fc55SNeil Armstrong [CLKID_SYS_PLL] = &gxbb_sys_pll.hw, 11960d48fc55SNeil Armstrong [CLKID_HDMI_PLL] = &gxbb_hdmi_pll.hw, 11970d48fc55SNeil Armstrong [CLKID_FIXED_PLL] = &gxbb_fixed_pll.hw, 11980d48fc55SNeil Armstrong [CLKID_FCLK_DIV2] = &gxbb_fclk_div2.hw, 11990d48fc55SNeil Armstrong [CLKID_FCLK_DIV3] = &gxbb_fclk_div3.hw, 12000d48fc55SNeil Armstrong [CLKID_FCLK_DIV4] = &gxbb_fclk_div4.hw, 12010d48fc55SNeil Armstrong [CLKID_FCLK_DIV5] = &gxbb_fclk_div5.hw, 12020d48fc55SNeil Armstrong [CLKID_FCLK_DIV7] = &gxbb_fclk_div7.hw, 12030d48fc55SNeil Armstrong [CLKID_GP0_PLL] = &gxl_gp0_pll.hw, 12040d48fc55SNeil Armstrong [CLKID_MPEG_SEL] = &gxbb_mpeg_clk_sel.hw, 12050d48fc55SNeil Armstrong [CLKID_MPEG_DIV] = &gxbb_mpeg_clk_div.hw, 12060d48fc55SNeil Armstrong [CLKID_CLK81] = &gxbb_clk81.hw, 12070d48fc55SNeil Armstrong [CLKID_MPLL0] = &gxbb_mpll0.hw, 12080d48fc55SNeil Armstrong [CLKID_MPLL1] = &gxbb_mpll1.hw, 12090d48fc55SNeil Armstrong [CLKID_MPLL2] = &gxbb_mpll2.hw, 12100d48fc55SNeil Armstrong [CLKID_DDR] = &gxbb_ddr.hw, 12110d48fc55SNeil Armstrong [CLKID_DOS] = &gxbb_dos.hw, 12120d48fc55SNeil Armstrong [CLKID_ISA] = &gxbb_isa.hw, 12130d48fc55SNeil Armstrong [CLKID_PL301] = &gxbb_pl301.hw, 12140d48fc55SNeil Armstrong [CLKID_PERIPHS] = &gxbb_periphs.hw, 12150d48fc55SNeil Armstrong [CLKID_SPICC] = &gxbb_spicc.hw, 12160d48fc55SNeil Armstrong [CLKID_I2C] = &gxbb_i2c.hw, 12170d48fc55SNeil Armstrong [CLKID_SAR_ADC] = &gxbb_sar_adc.hw, 12180d48fc55SNeil Armstrong [CLKID_SMART_CARD] = &gxbb_smart_card.hw, 12190d48fc55SNeil Armstrong [CLKID_RNG0] = &gxbb_rng0.hw, 12200d48fc55SNeil Armstrong [CLKID_UART0] = &gxbb_uart0.hw, 12210d48fc55SNeil Armstrong [CLKID_SDHC] = &gxbb_sdhc.hw, 12220d48fc55SNeil Armstrong [CLKID_STREAM] = &gxbb_stream.hw, 12230d48fc55SNeil Armstrong [CLKID_ASYNC_FIFO] = &gxbb_async_fifo.hw, 12240d48fc55SNeil Armstrong [CLKID_SDIO] = &gxbb_sdio.hw, 12250d48fc55SNeil Armstrong [CLKID_ABUF] = &gxbb_abuf.hw, 12260d48fc55SNeil Armstrong [CLKID_HIU_IFACE] = &gxbb_hiu_iface.hw, 12270d48fc55SNeil Armstrong [CLKID_ASSIST_MISC] = &gxbb_assist_misc.hw, 12280d48fc55SNeil Armstrong [CLKID_SPI] = &gxbb_spi.hw, 12290d48fc55SNeil Armstrong [CLKID_I2S_SPDIF] = &gxbb_i2s_spdif.hw, 12300d48fc55SNeil Armstrong [CLKID_ETH] = &gxbb_eth.hw, 12310d48fc55SNeil Armstrong [CLKID_DEMUX] = &gxbb_demux.hw, 12320d48fc55SNeil Armstrong [CLKID_AIU_GLUE] = &gxbb_aiu_glue.hw, 12330d48fc55SNeil Armstrong [CLKID_IEC958] = &gxbb_iec958.hw, 12340d48fc55SNeil Armstrong [CLKID_I2S_OUT] = &gxbb_i2s_out.hw, 12350d48fc55SNeil Armstrong [CLKID_AMCLK] = &gxbb_amclk.hw, 12360d48fc55SNeil Armstrong [CLKID_AIFIFO2] = &gxbb_aififo2.hw, 12370d48fc55SNeil Armstrong [CLKID_MIXER] = &gxbb_mixer.hw, 12380d48fc55SNeil Armstrong [CLKID_MIXER_IFACE] = &gxbb_mixer_iface.hw, 12390d48fc55SNeil Armstrong [CLKID_ADC] = &gxbb_adc.hw, 12400d48fc55SNeil Armstrong [CLKID_BLKMV] = &gxbb_blkmv.hw, 12410d48fc55SNeil Armstrong [CLKID_AIU] = &gxbb_aiu.hw, 12420d48fc55SNeil Armstrong [CLKID_UART1] = &gxbb_uart1.hw, 12430d48fc55SNeil Armstrong [CLKID_G2D] = &gxbb_g2d.hw, 12440d48fc55SNeil Armstrong [CLKID_USB0] = &gxbb_usb0.hw, 12450d48fc55SNeil Armstrong [CLKID_USB1] = &gxbb_usb1.hw, 12460d48fc55SNeil Armstrong [CLKID_RESET] = &gxbb_reset.hw, 12470d48fc55SNeil Armstrong [CLKID_NAND] = &gxbb_nand.hw, 12480d48fc55SNeil Armstrong [CLKID_DOS_PARSER] = &gxbb_dos_parser.hw, 12490d48fc55SNeil Armstrong [CLKID_USB] = &gxbb_usb.hw, 12500d48fc55SNeil Armstrong [CLKID_VDIN1] = &gxbb_vdin1.hw, 12510d48fc55SNeil Armstrong [CLKID_AHB_ARB0] = &gxbb_ahb_arb0.hw, 12520d48fc55SNeil Armstrong [CLKID_EFUSE] = &gxbb_efuse.hw, 12530d48fc55SNeil Armstrong [CLKID_BOOT_ROM] = &gxbb_boot_rom.hw, 12540d48fc55SNeil Armstrong [CLKID_AHB_DATA_BUS] = &gxbb_ahb_data_bus.hw, 12550d48fc55SNeil Armstrong [CLKID_AHB_CTRL_BUS] = &gxbb_ahb_ctrl_bus.hw, 12560d48fc55SNeil Armstrong [CLKID_HDMI_INTR_SYNC] = &gxbb_hdmi_intr_sync.hw, 12570d48fc55SNeil Armstrong [CLKID_HDMI_PCLK] = &gxbb_hdmi_pclk.hw, 12580d48fc55SNeil Armstrong [CLKID_USB1_DDR_BRIDGE] = &gxbb_usb1_ddr_bridge.hw, 12590d48fc55SNeil Armstrong [CLKID_USB0_DDR_BRIDGE] = &gxbb_usb0_ddr_bridge.hw, 12600d48fc55SNeil Armstrong [CLKID_MMC_PCLK] = &gxbb_mmc_pclk.hw, 12610d48fc55SNeil Armstrong [CLKID_DVIN] = &gxbb_dvin.hw, 12620d48fc55SNeil Armstrong [CLKID_UART2] = &gxbb_uart2.hw, 12630d48fc55SNeil Armstrong [CLKID_SANA] = &gxbb_sana.hw, 12640d48fc55SNeil Armstrong [CLKID_VPU_INTR] = &gxbb_vpu_intr.hw, 12650d48fc55SNeil Armstrong [CLKID_SEC_AHB_AHB3_BRIDGE] = &gxbb_sec_ahb_ahb3_bridge.hw, 12660d48fc55SNeil Armstrong [CLKID_CLK81_A53] = &gxbb_clk81_a53.hw, 12670d48fc55SNeil Armstrong [CLKID_VCLK2_VENCI0] = &gxbb_vclk2_venci0.hw, 12680d48fc55SNeil Armstrong [CLKID_VCLK2_VENCI1] = &gxbb_vclk2_venci1.hw, 12690d48fc55SNeil Armstrong [CLKID_VCLK2_VENCP0] = &gxbb_vclk2_vencp0.hw, 12700d48fc55SNeil Armstrong [CLKID_VCLK2_VENCP1] = &gxbb_vclk2_vencp1.hw, 12710d48fc55SNeil Armstrong [CLKID_GCLK_VENCI_INT0] = &gxbb_gclk_venci_int0.hw, 12720d48fc55SNeil Armstrong [CLKID_GCLK_VENCI_INT] = &gxbb_gclk_vencp_int.hw, 12730d48fc55SNeil Armstrong [CLKID_DAC_CLK] = &gxbb_dac_clk.hw, 12740d48fc55SNeil Armstrong [CLKID_AOCLK_GATE] = &gxbb_aoclk_gate.hw, 12750d48fc55SNeil Armstrong [CLKID_IEC958_GATE] = &gxbb_iec958_gate.hw, 12760d48fc55SNeil Armstrong [CLKID_ENC480P] = &gxbb_enc480p.hw, 12770d48fc55SNeil Armstrong [CLKID_RNG1] = &gxbb_rng1.hw, 12780d48fc55SNeil Armstrong [CLKID_GCLK_VENCI_INT1] = &gxbb_gclk_venci_int1.hw, 12790d48fc55SNeil Armstrong [CLKID_VCLK2_VENCLMCC] = &gxbb_vclk2_venclmcc.hw, 12800d48fc55SNeil Armstrong [CLKID_VCLK2_VENCL] = &gxbb_vclk2_vencl.hw, 12810d48fc55SNeil Armstrong [CLKID_VCLK_OTHER] = &gxbb_vclk_other.hw, 12820d48fc55SNeil Armstrong [CLKID_EDP] = &gxbb_edp.hw, 12830d48fc55SNeil Armstrong [CLKID_AO_MEDIA_CPU] = &gxbb_ao_media_cpu.hw, 12840d48fc55SNeil Armstrong [CLKID_AO_AHB_SRAM] = &gxbb_ao_ahb_sram.hw, 12850d48fc55SNeil Armstrong [CLKID_AO_AHB_BUS] = &gxbb_ao_ahb_bus.hw, 12860d48fc55SNeil Armstrong [CLKID_AO_IFACE] = &gxbb_ao_iface.hw, 12870d48fc55SNeil Armstrong [CLKID_AO_I2C] = &gxbb_ao_i2c.hw, 12880d48fc55SNeil Armstrong [CLKID_SD_EMMC_A] = &gxbb_emmc_a.hw, 12890d48fc55SNeil Armstrong [CLKID_SD_EMMC_B] = &gxbb_emmc_b.hw, 12900d48fc55SNeil Armstrong [CLKID_SD_EMMC_C] = &gxbb_emmc_c.hw, 12910d48fc55SNeil Armstrong [CLKID_SAR_ADC_CLK] = &gxbb_sar_adc_clk.hw, 12920d48fc55SNeil Armstrong [CLKID_SAR_ADC_SEL] = &gxbb_sar_adc_clk_sel.hw, 12930d48fc55SNeil Armstrong [CLKID_SAR_ADC_DIV] = &gxbb_sar_adc_clk_div.hw, 12940d48fc55SNeil Armstrong [CLKID_MALI_0_SEL] = &gxbb_mali_0_sel.hw, 12950d48fc55SNeil Armstrong [CLKID_MALI_0_DIV] = &gxbb_mali_0_div.hw, 12960d48fc55SNeil Armstrong [CLKID_MALI_0] = &gxbb_mali_0.hw, 12970d48fc55SNeil Armstrong [CLKID_MALI_1_SEL] = &gxbb_mali_1_sel.hw, 12980d48fc55SNeil Armstrong [CLKID_MALI_1_DIV] = &gxbb_mali_1_div.hw, 12990d48fc55SNeil Armstrong [CLKID_MALI_1] = &gxbb_mali_1.hw, 13000d48fc55SNeil Armstrong [CLKID_MALI] = &gxbb_mali.hw, 13014087bd4bSJerome Brunet [CLKID_CTS_AMCLK] = &gxbb_cts_amclk.hw, 13024087bd4bSJerome Brunet [CLKID_CTS_AMCLK_SEL] = &gxbb_cts_amclk_sel.hw, 13034087bd4bSJerome Brunet [CLKID_CTS_AMCLK_DIV] = &gxbb_cts_amclk_div.hw, 13043c277c24SJerome Brunet [CLKID_CTS_MCLK_I958] = &gxbb_cts_mclk_i958.hw, 13053c277c24SJerome Brunet [CLKID_CTS_MCLK_I958_SEL] = &gxbb_cts_mclk_i958_sel.hw, 13063c277c24SJerome Brunet [CLKID_CTS_MCLK_I958_DIV] = &gxbb_cts_mclk_i958_div.hw, 13077eaa44f6SJerome Brunet [CLKID_CTS_I958] = &gxbb_cts_i958.hw, 130814c735c8SNeil Armstrong [CLKID_32K_CLK] = &gxbb_32k_clk.hw, 130914c735c8SNeil Armstrong [CLKID_32K_CLK_SEL] = &gxbb_32k_clk_sel.hw, 131014c735c8SNeil Armstrong [CLKID_32K_CLK_DIV] = &gxbb_32k_clk_div.hw, 13111f6f1dcbSJerome Brunet [NR_CLKS] = NULL, 13120d48fc55SNeil Armstrong }, 13130d48fc55SNeil Armstrong .num = NR_CLKS, 13140d48fc55SNeil Armstrong }; 13150d48fc55SNeil Armstrong 1316738f66d3SMichael Turquette /* Convenience tables to populate base addresses in .probe */ 1317738f66d3SMichael Turquette 1318738f66d3SMichael Turquette static struct meson_clk_pll *const gxbb_clk_plls[] = { 1319738f66d3SMichael Turquette &gxbb_fixed_pll, 1320738f66d3SMichael Turquette &gxbb_hdmi_pll, 1321738f66d3SMichael Turquette &gxbb_sys_pll, 1322738f66d3SMichael Turquette &gxbb_gp0_pll, 1323738f66d3SMichael Turquette }; 1324738f66d3SMichael Turquette 13250d48fc55SNeil Armstrong static struct meson_clk_pll *const gxl_clk_plls[] = { 13260d48fc55SNeil Armstrong &gxbb_fixed_pll, 13270d48fc55SNeil Armstrong &gxbb_hdmi_pll, 13280d48fc55SNeil Armstrong &gxbb_sys_pll, 13290d48fc55SNeil Armstrong &gxl_gp0_pll, 13300d48fc55SNeil Armstrong }; 13310d48fc55SNeil Armstrong 1332738f66d3SMichael Turquette static struct meson_clk_mpll *const gxbb_clk_mplls[] = { 1333738f66d3SMichael Turquette &gxbb_mpll0, 1334738f66d3SMichael Turquette &gxbb_mpll1, 1335738f66d3SMichael Turquette &gxbb_mpll2, 1336738f66d3SMichael Turquette }; 1337738f66d3SMichael Turquette 1338f7e3a826SJerome Brunet static struct clk_gate *const gxbb_clk_gates[] = { 1339738f66d3SMichael Turquette &gxbb_clk81, 1340738f66d3SMichael Turquette &gxbb_ddr, 1341738f66d3SMichael Turquette &gxbb_dos, 1342738f66d3SMichael Turquette &gxbb_isa, 1343738f66d3SMichael Turquette &gxbb_pl301, 1344738f66d3SMichael Turquette &gxbb_periphs, 1345738f66d3SMichael Turquette &gxbb_spicc, 1346738f66d3SMichael Turquette &gxbb_i2c, 1347738f66d3SMichael Turquette &gxbb_sar_adc, 1348738f66d3SMichael Turquette &gxbb_smart_card, 1349738f66d3SMichael Turquette &gxbb_rng0, 1350738f66d3SMichael Turquette &gxbb_uart0, 1351738f66d3SMichael Turquette &gxbb_sdhc, 1352738f66d3SMichael Turquette &gxbb_stream, 1353738f66d3SMichael Turquette &gxbb_async_fifo, 1354738f66d3SMichael Turquette &gxbb_sdio, 1355738f66d3SMichael Turquette &gxbb_abuf, 1356738f66d3SMichael Turquette &gxbb_hiu_iface, 1357738f66d3SMichael Turquette &gxbb_assist_misc, 1358738f66d3SMichael Turquette &gxbb_spi, 1359738f66d3SMichael Turquette &gxbb_i2s_spdif, 1360738f66d3SMichael Turquette &gxbb_eth, 1361738f66d3SMichael Turquette &gxbb_demux, 1362738f66d3SMichael Turquette &gxbb_aiu_glue, 1363738f66d3SMichael Turquette &gxbb_iec958, 1364738f66d3SMichael Turquette &gxbb_i2s_out, 1365738f66d3SMichael Turquette &gxbb_amclk, 1366738f66d3SMichael Turquette &gxbb_aififo2, 1367738f66d3SMichael Turquette &gxbb_mixer, 1368738f66d3SMichael Turquette &gxbb_mixer_iface, 1369738f66d3SMichael Turquette &gxbb_adc, 1370738f66d3SMichael Turquette &gxbb_blkmv, 1371738f66d3SMichael Turquette &gxbb_aiu, 1372738f66d3SMichael Turquette &gxbb_uart1, 1373738f66d3SMichael Turquette &gxbb_g2d, 1374738f66d3SMichael Turquette &gxbb_usb0, 1375738f66d3SMichael Turquette &gxbb_usb1, 1376738f66d3SMichael Turquette &gxbb_reset, 1377738f66d3SMichael Turquette &gxbb_nand, 1378738f66d3SMichael Turquette &gxbb_dos_parser, 1379738f66d3SMichael Turquette &gxbb_usb, 1380738f66d3SMichael Turquette &gxbb_vdin1, 1381738f66d3SMichael Turquette &gxbb_ahb_arb0, 1382738f66d3SMichael Turquette &gxbb_efuse, 1383738f66d3SMichael Turquette &gxbb_boot_rom, 1384738f66d3SMichael Turquette &gxbb_ahb_data_bus, 1385738f66d3SMichael Turquette &gxbb_ahb_ctrl_bus, 1386738f66d3SMichael Turquette &gxbb_hdmi_intr_sync, 1387738f66d3SMichael Turquette &gxbb_hdmi_pclk, 1388738f66d3SMichael Turquette &gxbb_usb1_ddr_bridge, 1389738f66d3SMichael Turquette &gxbb_usb0_ddr_bridge, 1390738f66d3SMichael Turquette &gxbb_mmc_pclk, 1391738f66d3SMichael Turquette &gxbb_dvin, 1392738f66d3SMichael Turquette &gxbb_uart2, 1393738f66d3SMichael Turquette &gxbb_sana, 1394738f66d3SMichael Turquette &gxbb_vpu_intr, 1395738f66d3SMichael Turquette &gxbb_sec_ahb_ahb3_bridge, 1396738f66d3SMichael Turquette &gxbb_clk81_a53, 1397738f66d3SMichael Turquette &gxbb_vclk2_venci0, 1398738f66d3SMichael Turquette &gxbb_vclk2_venci1, 1399738f66d3SMichael Turquette &gxbb_vclk2_vencp0, 1400738f66d3SMichael Turquette &gxbb_vclk2_vencp1, 1401738f66d3SMichael Turquette &gxbb_gclk_venci_int0, 1402738f66d3SMichael Turquette &gxbb_gclk_vencp_int, 1403738f66d3SMichael Turquette &gxbb_dac_clk, 1404738f66d3SMichael Turquette &gxbb_aoclk_gate, 1405738f66d3SMichael Turquette &gxbb_iec958_gate, 1406738f66d3SMichael Turquette &gxbb_enc480p, 1407738f66d3SMichael Turquette &gxbb_rng1, 1408738f66d3SMichael Turquette &gxbb_gclk_venci_int1, 1409738f66d3SMichael Turquette &gxbb_vclk2_venclmcc, 1410738f66d3SMichael Turquette &gxbb_vclk2_vencl, 1411738f66d3SMichael Turquette &gxbb_vclk_other, 1412738f66d3SMichael Turquette &gxbb_edp, 1413738f66d3SMichael Turquette &gxbb_ao_media_cpu, 1414738f66d3SMichael Turquette &gxbb_ao_ahb_sram, 1415738f66d3SMichael Turquette &gxbb_ao_ahb_bus, 1416738f66d3SMichael Turquette &gxbb_ao_iface, 1417738f66d3SMichael Turquette &gxbb_ao_i2c, 141833608dcdSKevin Hilman &gxbb_emmc_a, 141933608dcdSKevin Hilman &gxbb_emmc_b, 142033608dcdSKevin Hilman &gxbb_emmc_c, 142133d0fcdfSMartin Blumenstingl &gxbb_sar_adc_clk, 1422fac9a55bSNeil Armstrong &gxbb_mali_0, 1423fac9a55bSNeil Armstrong &gxbb_mali_1, 14244087bd4bSJerome Brunet &gxbb_cts_amclk, 14253c277c24SJerome Brunet &gxbb_cts_mclk_i958, 142614c735c8SNeil Armstrong &gxbb_32k_clk, 1427738f66d3SMichael Turquette }; 1428738f66d3SMichael Turquette 1429b92332eeSJerome Brunet static struct clk_mux *const gxbb_clk_muxes[] = { 1430b92332eeSJerome Brunet &gxbb_mpeg_clk_sel, 1431b92332eeSJerome Brunet &gxbb_sar_adc_clk_sel, 1432fac9a55bSNeil Armstrong &gxbb_mali_0_sel, 1433fac9a55bSNeil Armstrong &gxbb_mali_1_sel, 1434fac9a55bSNeil Armstrong &gxbb_mali, 14354087bd4bSJerome Brunet &gxbb_cts_amclk_sel, 14363c277c24SJerome Brunet &gxbb_cts_mclk_i958_sel, 14377eaa44f6SJerome Brunet &gxbb_cts_i958, 143814c735c8SNeil Armstrong &gxbb_32k_clk_sel, 1439b92332eeSJerome Brunet }; 1440b92332eeSJerome Brunet 1441b92332eeSJerome Brunet static struct clk_divider *const gxbb_clk_dividers[] = { 1442b92332eeSJerome Brunet &gxbb_mpeg_clk_div, 1443b92332eeSJerome Brunet &gxbb_sar_adc_clk_div, 1444fac9a55bSNeil Armstrong &gxbb_mali_0_div, 1445fac9a55bSNeil Armstrong &gxbb_mali_1_div, 14463c277c24SJerome Brunet &gxbb_cts_mclk_i958_div, 144714c735c8SNeil Armstrong &gxbb_32k_clk_div, 1448b92332eeSJerome Brunet }; 1449b92332eeSJerome Brunet 14504087bd4bSJerome Brunet static struct meson_clk_audio_divider *const gxbb_audio_dividers[] = { 14514087bd4bSJerome Brunet &gxbb_cts_amclk_div, 14524087bd4bSJerome Brunet }; 14534087bd4bSJerome Brunet 14540d48fc55SNeil Armstrong struct clkc_data { 14550d48fc55SNeil Armstrong struct clk_gate *const *clk_gates; 14560d48fc55SNeil Armstrong unsigned int clk_gates_count; 14570d48fc55SNeil Armstrong struct meson_clk_mpll *const *clk_mplls; 14580d48fc55SNeil Armstrong unsigned int clk_mplls_count; 14590d48fc55SNeil Armstrong struct meson_clk_pll *const *clk_plls; 14600d48fc55SNeil Armstrong unsigned int clk_plls_count; 14610d48fc55SNeil Armstrong struct clk_mux *const *clk_muxes; 14620d48fc55SNeil Armstrong unsigned int clk_muxes_count; 14630d48fc55SNeil Armstrong struct clk_divider *const *clk_dividers; 14640d48fc55SNeil Armstrong unsigned int clk_dividers_count; 14654087bd4bSJerome Brunet struct meson_clk_audio_divider *const *clk_audio_dividers; 14664087bd4bSJerome Brunet unsigned int clk_audio_dividers_count; 14670d48fc55SNeil Armstrong struct clk_hw_onecell_data *hw_onecell_data; 14680d48fc55SNeil Armstrong }; 14690d48fc55SNeil Armstrong 14700d48fc55SNeil Armstrong static const struct clkc_data gxbb_clkc_data = { 14710d48fc55SNeil Armstrong .clk_gates = gxbb_clk_gates, 14720d48fc55SNeil Armstrong .clk_gates_count = ARRAY_SIZE(gxbb_clk_gates), 14730d48fc55SNeil Armstrong .clk_mplls = gxbb_clk_mplls, 14740d48fc55SNeil Armstrong .clk_mplls_count = ARRAY_SIZE(gxbb_clk_mplls), 14750d48fc55SNeil Armstrong .clk_plls = gxbb_clk_plls, 14760d48fc55SNeil Armstrong .clk_plls_count = ARRAY_SIZE(gxbb_clk_plls), 14770d48fc55SNeil Armstrong .clk_muxes = gxbb_clk_muxes, 14780d48fc55SNeil Armstrong .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes), 14790d48fc55SNeil Armstrong .clk_dividers = gxbb_clk_dividers, 14800d48fc55SNeil Armstrong .clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers), 14814087bd4bSJerome Brunet .clk_audio_dividers = gxbb_audio_dividers, 14824087bd4bSJerome Brunet .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers), 14830d48fc55SNeil Armstrong .hw_onecell_data = &gxbb_hw_onecell_data, 14840d48fc55SNeil Armstrong }; 14850d48fc55SNeil Armstrong 14860d48fc55SNeil Armstrong static const struct clkc_data gxl_clkc_data = { 14870d48fc55SNeil Armstrong .clk_gates = gxbb_clk_gates, 14880d48fc55SNeil Armstrong .clk_gates_count = ARRAY_SIZE(gxbb_clk_gates), 14890d48fc55SNeil Armstrong .clk_mplls = gxbb_clk_mplls, 14900d48fc55SNeil Armstrong .clk_mplls_count = ARRAY_SIZE(gxbb_clk_mplls), 14910d48fc55SNeil Armstrong .clk_plls = gxl_clk_plls, 14920d48fc55SNeil Armstrong .clk_plls_count = ARRAY_SIZE(gxl_clk_plls), 14930d48fc55SNeil Armstrong .clk_muxes = gxbb_clk_muxes, 14940d48fc55SNeil Armstrong .clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes), 14950d48fc55SNeil Armstrong .clk_dividers = gxbb_clk_dividers, 14960d48fc55SNeil Armstrong .clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers), 14974087bd4bSJerome Brunet .clk_audio_dividers = gxbb_audio_dividers, 14984087bd4bSJerome Brunet .clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers), 14990d48fc55SNeil Armstrong .hw_onecell_data = &gxl_hw_onecell_data, 15000d48fc55SNeil Armstrong }; 15010d48fc55SNeil Armstrong 15020d48fc55SNeil Armstrong static const struct of_device_id clkc_match_table[] = { 15030d48fc55SNeil Armstrong { .compatible = "amlogic,gxbb-clkc", .data = &gxbb_clkc_data }, 15040d48fc55SNeil Armstrong { .compatible = "amlogic,gxl-clkc", .data = &gxl_clkc_data }, 15050d48fc55SNeil Armstrong {}, 15060d48fc55SNeil Armstrong }; 15070d48fc55SNeil Armstrong 1508738f66d3SMichael Turquette static int gxbb_clkc_probe(struct platform_device *pdev) 1509738f66d3SMichael Turquette { 15100d48fc55SNeil Armstrong const struct clkc_data *clkc_data; 1511738f66d3SMichael Turquette void __iomem *clk_base; 1512738f66d3SMichael Turquette int ret, clkid, i; 1513738f66d3SMichael Turquette struct device *dev = &pdev->dev; 1514738f66d3SMichael Turquette 15150d48fc55SNeil Armstrong clkc_data = of_device_get_match_data(&pdev->dev); 15160d48fc55SNeil Armstrong if (!clkc_data) 15170d48fc55SNeil Armstrong return -EINVAL; 15180d48fc55SNeil Armstrong 1519738f66d3SMichael Turquette /* Generic clocks and PLLs */ 1520738f66d3SMichael Turquette clk_base = of_iomap(dev->of_node, 0); 1521738f66d3SMichael Turquette if (!clk_base) { 1522738f66d3SMichael Turquette pr_err("%s: Unable to map clk base\n", __func__); 1523738f66d3SMichael Turquette return -ENXIO; 1524738f66d3SMichael Turquette } 1525738f66d3SMichael Turquette 1526738f66d3SMichael Turquette /* Populate base address for PLLs */ 15270d48fc55SNeil Armstrong for (i = 0; i < clkc_data->clk_plls_count; i++) 15280d48fc55SNeil Armstrong clkc_data->clk_plls[i]->base = clk_base; 1529738f66d3SMichael Turquette 1530738f66d3SMichael Turquette /* Populate base address for MPLLs */ 15310d48fc55SNeil Armstrong for (i = 0; i < clkc_data->clk_mplls_count; i++) 15320d48fc55SNeil Armstrong clkc_data->clk_mplls[i]->base = clk_base; 1533738f66d3SMichael Turquette 1534738f66d3SMichael Turquette /* Populate base address for gates */ 15350d48fc55SNeil Armstrong for (i = 0; i < clkc_data->clk_gates_count; i++) 15360d48fc55SNeil Armstrong clkc_data->clk_gates[i]->reg = clk_base + 15370d48fc55SNeil Armstrong (u64)clkc_data->clk_gates[i]->reg; 1538738f66d3SMichael Turquette 1539b92332eeSJerome Brunet /* Populate base address for muxes */ 15400d48fc55SNeil Armstrong for (i = 0; i < clkc_data->clk_muxes_count; i++) 15410d48fc55SNeil Armstrong clkc_data->clk_muxes[i]->reg = clk_base + 15420d48fc55SNeil Armstrong (u64)clkc_data->clk_muxes[i]->reg; 1543b92332eeSJerome Brunet 1544b92332eeSJerome Brunet /* Populate base address for dividers */ 15450d48fc55SNeil Armstrong for (i = 0; i < clkc_data->clk_dividers_count; i++) 15460d48fc55SNeil Armstrong clkc_data->clk_dividers[i]->reg = clk_base + 15470d48fc55SNeil Armstrong (u64)clkc_data->clk_dividers[i]->reg; 1548b92332eeSJerome Brunet 15494087bd4bSJerome Brunet /* Populate base address for the audio dividers */ 15504087bd4bSJerome Brunet for (i = 0; i < clkc_data->clk_audio_dividers_count; i++) 15514087bd4bSJerome Brunet clkc_data->clk_audio_dividers[i]->base = clk_base; 15524087bd4bSJerome Brunet 1553738f66d3SMichael Turquette /* 1554738f66d3SMichael Turquette * register all clks 1555738f66d3SMichael Turquette */ 15560d48fc55SNeil Armstrong for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) { 1557a70c6e06SJerome Brunet /* array might be sparse */ 1558a70c6e06SJerome Brunet if (!clkc_data->hw_onecell_data->hws[clkid]) 1559a70c6e06SJerome Brunet continue; 1560a70c6e06SJerome Brunet 15610d48fc55SNeil Armstrong ret = devm_clk_hw_register(dev, 15620d48fc55SNeil Armstrong clkc_data->hw_onecell_data->hws[clkid]); 1563738f66d3SMichael Turquette if (ret) 1564738f66d3SMichael Turquette goto iounmap; 1565738f66d3SMichael Turquette } 1566738f66d3SMichael Turquette 1567738f66d3SMichael Turquette return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, 15680d48fc55SNeil Armstrong clkc_data->hw_onecell_data); 1569738f66d3SMichael Turquette 1570738f66d3SMichael Turquette iounmap: 1571738f66d3SMichael Turquette iounmap(clk_base); 1572738f66d3SMichael Turquette return ret; 1573738f66d3SMichael Turquette } 1574738f66d3SMichael Turquette 1575738f66d3SMichael Turquette static struct platform_driver gxbb_driver = { 1576738f66d3SMichael Turquette .probe = gxbb_clkc_probe, 1577738f66d3SMichael Turquette .driver = { 1578738f66d3SMichael Turquette .name = "gxbb-clkc", 15790d48fc55SNeil Armstrong .of_match_table = clkc_match_table, 1580738f66d3SMichael Turquette }, 1581738f66d3SMichael Turquette }; 1582738f66d3SMichael Turquette 158300746f10SWei Yongjun builtin_platform_driver(gxbb_driver); 1584