Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pv210/clock.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
| 6 | * S5PV210 - Clock support |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/list.h> |
| 17 | #include <linux/errno.h> |
| 18 | #include <linux/err.h> |
| 19 | #include <linux/clk.h> |
| 20 | #include <linux/sysdev.h> |
| 21 | #include <linux/io.h> |
| 22 | |
| 23 | #include <mach/map.h> |
| 24 | |
| 25 | #include <plat/cpu-freq.h> |
| 26 | #include <mach/regs-clock.h> |
| 27 | #include <plat/clock.h> |
| 28 | #include <plat/cpu.h> |
| 29 | #include <plat/pll.h> |
| 30 | #include <plat/s5p-clock.h> |
| 31 | #include <plat/clock-clksrc.h> |
| 32 | #include <plat/s5pv210.h> |
| 33 | |
Jaecheol Lee | 8869584 | 2010-10-12 09:19:26 +0900 | [diff] [blame] | 34 | static unsigned long xtal; |
| 35 | |
Thomas Abraham | 59cda52 | 2010-05-17 09:38:01 +0900 | [diff] [blame] | 36 | static struct clksrc_clk clk_mout_apll = { |
| 37 | .clk = { |
| 38 | .name = "mout_apll", |
Thomas Abraham | 59cda52 | 2010-05-17 09:38:01 +0900 | [diff] [blame] | 39 | }, |
| 40 | .sources = &clk_src_apll, |
| 41 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, |
| 42 | }; |
| 43 | |
| 44 | static struct clksrc_clk clk_mout_epll = { |
| 45 | .clk = { |
| 46 | .name = "mout_epll", |
Thomas Abraham | 59cda52 | 2010-05-17 09:38:01 +0900 | [diff] [blame] | 47 | }, |
| 48 | .sources = &clk_src_epll, |
| 49 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 }, |
| 50 | }; |
| 51 | |
| 52 | static struct clksrc_clk clk_mout_mpll = { |
| 53 | .clk = { |
| 54 | .name = "mout_mpll", |
Thomas Abraham | 59cda52 | 2010-05-17 09:38:01 +0900 | [diff] [blame] | 55 | }, |
| 56 | .sources = &clk_src_mpll, |
| 57 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 }, |
| 58 | }; |
| 59 | |
Thomas Abraham | 374e0bf | 2010-05-17 09:38:31 +0900 | [diff] [blame] | 60 | static struct clk *clkset_armclk_list[] = { |
| 61 | [0] = &clk_mout_apll.clk, |
| 62 | [1] = &clk_mout_mpll.clk, |
| 63 | }; |
| 64 | |
| 65 | static struct clksrc_sources clkset_armclk = { |
| 66 | .sources = clkset_armclk_list, |
| 67 | .nr_sources = ARRAY_SIZE(clkset_armclk_list), |
| 68 | }; |
| 69 | |
| 70 | static struct clksrc_clk clk_armclk = { |
| 71 | .clk = { |
| 72 | .name = "armclk", |
Thomas Abraham | 374e0bf | 2010-05-17 09:38:31 +0900 | [diff] [blame] | 73 | }, |
| 74 | .sources = &clkset_armclk, |
| 75 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 1 }, |
| 76 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 3 }, |
| 77 | }; |
| 78 | |
Thomas Abraham | af76a20 | 2010-05-17 09:38:34 +0900 | [diff] [blame] | 79 | static struct clksrc_clk clk_hclk_msys = { |
| 80 | .clk = { |
| 81 | .name = "hclk_msys", |
Thomas Abraham | af76a20 | 2010-05-17 09:38:34 +0900 | [diff] [blame] | 82 | .parent = &clk_armclk.clk, |
| 83 | }, |
| 84 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 8, .size = 3 }, |
| 85 | }; |
| 86 | |
Thomas Abraham | 6ed91a2 | 2010-05-17 09:38:42 +0900 | [diff] [blame] | 87 | static struct clksrc_clk clk_pclk_msys = { |
| 88 | .clk = { |
| 89 | .name = "pclk_msys", |
Thomas Abraham | 6ed91a2 | 2010-05-17 09:38:42 +0900 | [diff] [blame] | 90 | .parent = &clk_hclk_msys.clk, |
| 91 | }, |
| 92 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 12, .size = 3 }, |
| 93 | }; |
| 94 | |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 95 | static struct clksrc_clk clk_sclk_a2m = { |
| 96 | .clk = { |
| 97 | .name = "sclk_a2m", |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 98 | .parent = &clk_mout_apll.clk, |
| 99 | }, |
| 100 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 }, |
| 101 | }; |
| 102 | |
| 103 | static struct clk *clkset_hclk_sys_list[] = { |
| 104 | [0] = &clk_mout_mpll.clk, |
| 105 | [1] = &clk_sclk_a2m.clk, |
| 106 | }; |
| 107 | |
| 108 | static struct clksrc_sources clkset_hclk_sys = { |
| 109 | .sources = clkset_hclk_sys_list, |
| 110 | .nr_sources = ARRAY_SIZE(clkset_hclk_sys_list), |
| 111 | }; |
| 112 | |
| 113 | static struct clksrc_clk clk_hclk_dsys = { |
| 114 | .clk = { |
| 115 | .name = "hclk_dsys", |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 116 | }, |
| 117 | .sources = &clkset_hclk_sys, |
| 118 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 1 }, |
| 119 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 }, |
| 120 | }; |
| 121 | |
Thomas Abraham | 58772cd | 2010-05-17 09:38:48 +0900 | [diff] [blame] | 122 | static struct clksrc_clk clk_pclk_dsys = { |
| 123 | .clk = { |
| 124 | .name = "pclk_dsys", |
Thomas Abraham | 58772cd | 2010-05-17 09:38:48 +0900 | [diff] [blame] | 125 | .parent = &clk_hclk_dsys.clk, |
| 126 | }, |
| 127 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 }, |
| 128 | }; |
| 129 | |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 130 | static struct clksrc_clk clk_hclk_psys = { |
| 131 | .clk = { |
| 132 | .name = "hclk_psys", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 133 | }, |
| 134 | .sources = &clkset_hclk_sys, |
| 135 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 24, .size = 1 }, |
| 136 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 }, |
| 137 | }; |
| 138 | |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 139 | static struct clksrc_clk clk_pclk_psys = { |
| 140 | .clk = { |
| 141 | .name = "pclk_psys", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 142 | .parent = &clk_hclk_psys.clk, |
| 143 | }, |
| 144 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 }, |
| 145 | }; |
| 146 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 147 | static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable) |
| 148 | { |
| 149 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); |
| 150 | } |
| 151 | |
| 152 | static int s5pv210_clk_ip1_ctrl(struct clk *clk, int enable) |
| 153 | { |
| 154 | return s5p_gatectrl(S5P_CLKGATE_IP1, clk, enable); |
| 155 | } |
| 156 | |
| 157 | static int s5pv210_clk_ip2_ctrl(struct clk *clk, int enable) |
| 158 | { |
| 159 | return s5p_gatectrl(S5P_CLKGATE_IP2, clk, enable); |
| 160 | } |
| 161 | |
| 162 | static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable) |
| 163 | { |
| 164 | return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); |
| 165 | } |
| 166 | |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 167 | static int s5pv210_clk_mask0_ctrl(struct clk *clk, int enable) |
| 168 | { |
| 169 | return s5p_gatectrl(S5P_CLK_SRC_MASK0, clk, enable); |
| 170 | } |
| 171 | |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 172 | static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable) |
| 173 | { |
| 174 | return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable); |
| 175 | } |
| 176 | |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 177 | static struct clk clk_sclk_hdmi27m = { |
| 178 | .name = "sclk_hdmi27m", |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 179 | .rate = 27000000, |
| 180 | }; |
| 181 | |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 182 | static struct clk clk_sclk_hdmiphy = { |
| 183 | .name = "sclk_hdmiphy", |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 184 | }; |
| 185 | |
| 186 | static struct clk clk_sclk_usbphy0 = { |
| 187 | .name = "sclk_usbphy0", |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | static struct clk clk_sclk_usbphy1 = { |
| 191 | .name = "sclk_usbphy1", |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 192 | }; |
| 193 | |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 194 | static struct clk clk_pcmcdclk0 = { |
| 195 | .name = "pcmcdclk", |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | static struct clk clk_pcmcdclk1 = { |
| 199 | .name = "pcmcdclk", |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | static struct clk clk_pcmcdclk2 = { |
| 203 | .name = "pcmcdclk", |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 204 | }; |
| 205 | |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 206 | static struct clk *clkset_vpllsrc_list[] = { |
| 207 | [0] = &clk_fin_vpll, |
| 208 | [1] = &clk_sclk_hdmi27m, |
| 209 | }; |
| 210 | |
| 211 | static struct clksrc_sources clkset_vpllsrc = { |
| 212 | .sources = clkset_vpllsrc_list, |
| 213 | .nr_sources = ARRAY_SIZE(clkset_vpllsrc_list), |
| 214 | }; |
| 215 | |
| 216 | static struct clksrc_clk clk_vpllsrc = { |
| 217 | .clk = { |
| 218 | .name = "vpll_src", |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 219 | .enable = s5pv210_clk_mask0_ctrl, |
| 220 | .ctrlbit = (1 << 7), |
| 221 | }, |
| 222 | .sources = &clkset_vpllsrc, |
| 223 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 28, .size = 1 }, |
| 224 | }; |
| 225 | |
| 226 | static struct clk *clkset_sclk_vpll_list[] = { |
| 227 | [0] = &clk_vpllsrc.clk, |
| 228 | [1] = &clk_fout_vpll, |
| 229 | }; |
| 230 | |
| 231 | static struct clksrc_sources clkset_sclk_vpll = { |
| 232 | .sources = clkset_sclk_vpll_list, |
| 233 | .nr_sources = ARRAY_SIZE(clkset_sclk_vpll_list), |
| 234 | }; |
| 235 | |
| 236 | static struct clksrc_clk clk_sclk_vpll = { |
| 237 | .clk = { |
| 238 | .name = "sclk_vpll", |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 239 | }, |
| 240 | .sources = &clkset_sclk_vpll, |
| 241 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 }, |
| 242 | }; |
| 243 | |
Jaecheol Lee | 08f49d1 | 2010-10-12 09:19:30 +0900 | [diff] [blame] | 244 | static struct clk *clkset_moutdmc0src_list[] = { |
| 245 | [0] = &clk_sclk_a2m.clk, |
| 246 | [1] = &clk_mout_mpll.clk, |
| 247 | [2] = NULL, |
| 248 | [3] = NULL, |
| 249 | }; |
| 250 | |
| 251 | static struct clksrc_sources clkset_moutdmc0src = { |
| 252 | .sources = clkset_moutdmc0src_list, |
| 253 | .nr_sources = ARRAY_SIZE(clkset_moutdmc0src_list), |
| 254 | }; |
| 255 | |
| 256 | static struct clksrc_clk clk_mout_dmc0 = { |
| 257 | .clk = { |
| 258 | .name = "mout_dmc0", |
Jaecheol Lee | 08f49d1 | 2010-10-12 09:19:30 +0900 | [diff] [blame] | 259 | }, |
| 260 | .sources = &clkset_moutdmc0src, |
| 261 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 }, |
| 262 | }; |
| 263 | |
| 264 | static struct clksrc_clk clk_sclk_dmc0 = { |
| 265 | .clk = { |
| 266 | .name = "sclk_dmc0", |
Jaecheol Lee | 08f49d1 | 2010-10-12 09:19:30 +0900 | [diff] [blame] | 267 | .parent = &clk_mout_dmc0.clk, |
| 268 | }, |
| 269 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 }, |
| 270 | }; |
| 271 | |
Thomas Abraham | 664f5b2 | 2010-05-17 09:38:44 +0900 | [diff] [blame] | 272 | static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk) |
| 273 | { |
| 274 | return clk_get_rate(clk->parent) / 2; |
| 275 | } |
| 276 | |
| 277 | static struct clk_ops clk_hclk_imem_ops = { |
| 278 | .get_rate = s5pv210_clk_imem_get_rate, |
| 279 | }; |
| 280 | |
Jaecheol Lee | 8869584 | 2010-10-12 09:19:26 +0900 | [diff] [blame] | 281 | static unsigned long s5pv210_clk_fout_apll_get_rate(struct clk *clk) |
| 282 | { |
| 283 | return s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508); |
| 284 | } |
| 285 | |
| 286 | static struct clk_ops clk_fout_apll_ops = { |
| 287 | .get_rate = s5pv210_clk_fout_apll_get_rate, |
| 288 | }; |
| 289 | |
Kukjin Kim | 3c0fa64 | 2011-01-04 17:51:30 +0900 | [diff] [blame] | 290 | static struct clk init_clocks_off[] = { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 291 | { |
Seungwhan Youn | 313068f | 2010-10-19 18:10:53 +0900 | [diff] [blame] | 292 | .name = "pdma", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 293 | .devname = "s3c-pl330.0", |
Seungwhan Youn | 313068f | 2010-10-19 18:10:53 +0900 | [diff] [blame] | 294 | .parent = &clk_hclk_psys.clk, |
| 295 | .enable = s5pv210_clk_ip0_ctrl, |
| 296 | .ctrlbit = (1 << 3), |
| 297 | }, { |
| 298 | .name = "pdma", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 299 | .devname = "s3c-pl330.1", |
Seungwhan Youn | 313068f | 2010-10-19 18:10:53 +0900 | [diff] [blame] | 300 | .parent = &clk_hclk_psys.clk, |
| 301 | .enable = s5pv210_clk_ip0_ctrl, |
| 302 | .ctrlbit = (1 << 4), |
| 303 | }, { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 304 | .name = "rot", |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 305 | .parent = &clk_hclk_dsys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 306 | .enable = s5pv210_clk_ip0_ctrl, |
| 307 | .ctrlbit = (1<<29), |
| 308 | }, { |
Marek Szyprowski | da01c2f | 2010-09-10 19:43:12 +0900 | [diff] [blame] | 309 | .name = "fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 310 | .devname = "s5pv210-fimc.0", |
Marek Szyprowski | da01c2f | 2010-09-10 19:43:12 +0900 | [diff] [blame] | 311 | .parent = &clk_hclk_dsys.clk, |
| 312 | .enable = s5pv210_clk_ip0_ctrl, |
| 313 | .ctrlbit = (1 << 24), |
| 314 | }, { |
| 315 | .name = "fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 316 | .devname = "s5pv210-fimc.1", |
Marek Szyprowski | da01c2f | 2010-09-10 19:43:12 +0900 | [diff] [blame] | 317 | .parent = &clk_hclk_dsys.clk, |
| 318 | .enable = s5pv210_clk_ip0_ctrl, |
| 319 | .ctrlbit = (1 << 25), |
| 320 | }, { |
| 321 | .name = "fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 322 | .devname = "s5pv210-fimc.2", |
Marek Szyprowski | da01c2f | 2010-09-10 19:43:12 +0900 | [diff] [blame] | 323 | .parent = &clk_hclk_dsys.clk, |
| 324 | .enable = s5pv210_clk_ip0_ctrl, |
| 325 | .ctrlbit = (1 << 26), |
| 326 | }, { |
Kamil Debski | 0f75a96 | 2011-07-21 16:42:30 +0900 | [diff] [blame] | 327 | .name = "mfc", |
| 328 | .devname = "s5p-mfc", |
| 329 | .parent = &clk_pclk_psys.clk, |
| 330 | .enable = s5pv210_clk_ip0_ctrl, |
| 331 | .ctrlbit = (1 << 16), |
| 332 | }, { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 333 | .name = "otg", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 334 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 335 | .enable = s5pv210_clk_ip1_ctrl, |
| 336 | .ctrlbit = (1<<16), |
| 337 | }, { |
| 338 | .name = "usb-host", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 339 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 340 | .enable = s5pv210_clk_ip1_ctrl, |
| 341 | .ctrlbit = (1<<17), |
| 342 | }, { |
| 343 | .name = "lcd", |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 344 | .parent = &clk_hclk_dsys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 345 | .enable = s5pv210_clk_ip1_ctrl, |
| 346 | .ctrlbit = (1<<0), |
| 347 | }, { |
| 348 | .name = "cfcon", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 349 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 350 | .enable = s5pv210_clk_ip1_ctrl, |
| 351 | .ctrlbit = (1<<25), |
| 352 | }, { |
| 353 | .name = "hsmmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 354 | .devname = "s3c-sdhci.0", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 355 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 356 | .enable = s5pv210_clk_ip2_ctrl, |
| 357 | .ctrlbit = (1<<16), |
| 358 | }, { |
| 359 | .name = "hsmmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 360 | .devname = "s3c-sdhci.1", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 361 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 362 | .enable = s5pv210_clk_ip2_ctrl, |
| 363 | .ctrlbit = (1<<17), |
| 364 | }, { |
| 365 | .name = "hsmmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 366 | .devname = "s3c-sdhci.2", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 367 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 368 | .enable = s5pv210_clk_ip2_ctrl, |
| 369 | .ctrlbit = (1<<18), |
| 370 | }, { |
| 371 | .name = "hsmmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 372 | .devname = "s3c-sdhci.3", |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 373 | .parent = &clk_hclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 374 | .enable = s5pv210_clk_ip2_ctrl, |
| 375 | .ctrlbit = (1<<19), |
| 376 | }, { |
| 377 | .name = "systimer", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 378 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 379 | .enable = s5pv210_clk_ip3_ctrl, |
| 380 | .ctrlbit = (1<<16), |
| 381 | }, { |
| 382 | .name = "watchdog", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 383 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 384 | .enable = s5pv210_clk_ip3_ctrl, |
| 385 | .ctrlbit = (1<<22), |
| 386 | }, { |
| 387 | .name = "rtc", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 388 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 389 | .enable = s5pv210_clk_ip3_ctrl, |
| 390 | .ctrlbit = (1<<15), |
| 391 | }, { |
| 392 | .name = "i2c", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 393 | .devname = "s3c2440-i2c.0", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 394 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 395 | .enable = s5pv210_clk_ip3_ctrl, |
| 396 | .ctrlbit = (1<<7), |
| 397 | }, { |
| 398 | .name = "i2c", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 399 | .devname = "s3c2440-i2c.1", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 400 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 401 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | f1c894d | 2010-08-21 09:18:19 +0900 | [diff] [blame] | 402 | .ctrlbit = (1 << 10), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 403 | }, { |
| 404 | .name = "i2c", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 405 | .devname = "s3c2440-i2c.2", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 406 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 407 | .enable = s5pv210_clk_ip3_ctrl, |
| 408 | .ctrlbit = (1<<9), |
| 409 | }, { |
| 410 | .name = "spi", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 411 | .devname = "s3c64xx-spi.0", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 412 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 413 | .enable = s5pv210_clk_ip3_ctrl, |
| 414 | .ctrlbit = (1<<12), |
| 415 | }, { |
| 416 | .name = "spi", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 417 | .devname = "s3c64xx-spi.1", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 418 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 419 | .enable = s5pv210_clk_ip3_ctrl, |
| 420 | .ctrlbit = (1<<13), |
| 421 | }, { |
| 422 | .name = "spi", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 423 | .devname = "s3c64xx-spi.2", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 424 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 425 | .enable = s5pv210_clk_ip3_ctrl, |
| 426 | .ctrlbit = (1<<14), |
| 427 | }, { |
| 428 | .name = "timers", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 429 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 430 | .enable = s5pv210_clk_ip3_ctrl, |
| 431 | .ctrlbit = (1<<23), |
| 432 | }, { |
| 433 | .name = "adc", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 434 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 435 | .enable = s5pv210_clk_ip3_ctrl, |
| 436 | .ctrlbit = (1<<24), |
| 437 | }, { |
| 438 | .name = "keypad", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 439 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 440 | .enable = s5pv210_clk_ip3_ctrl, |
| 441 | .ctrlbit = (1<<21), |
| 442 | }, { |
Jassi Brar | 9aa2570 | 2010-11-19 08:49:44 +0900 | [diff] [blame] | 443 | .name = "iis", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 444 | .devname = "samsung-i2s.0", |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 445 | .parent = &clk_p, |
| 446 | .enable = s5pv210_clk_ip3_ctrl, |
| 447 | .ctrlbit = (1<<4), |
| 448 | }, { |
Jassi Brar | 9aa2570 | 2010-11-19 08:49:44 +0900 | [diff] [blame] | 449 | .name = "iis", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 450 | .devname = "samsung-i2s.1", |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 451 | .parent = &clk_p, |
| 452 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 453 | .ctrlbit = (1 << 5), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 454 | }, { |
Jassi Brar | 9aa2570 | 2010-11-19 08:49:44 +0900 | [diff] [blame] | 455 | .name = "iis", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 456 | .devname = "samsung-i2s.2", |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 457 | .parent = &clk_p, |
| 458 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 459 | .ctrlbit = (1 << 6), |
Seungwhan Youn | aa21ae3 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 460 | }, { |
| 461 | .name = "spdif", |
Seungwhan Youn | aa21ae3 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 462 | .parent = &clk_p, |
| 463 | .enable = s5pv210_clk_ip3_ctrl, |
| 464 | .ctrlbit = (1 << 0), |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 465 | }, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 466 | }; |
| 467 | |
| 468 | static struct clk init_clocks[] = { |
| 469 | { |
Thomas Abraham | 664f5b2 | 2010-05-17 09:38:44 +0900 | [diff] [blame] | 470 | .name = "hclk_imem", |
Thomas Abraham | 664f5b2 | 2010-05-17 09:38:44 +0900 | [diff] [blame] | 471 | .parent = &clk_hclk_msys.clk, |
| 472 | .ctrlbit = (1 << 5), |
| 473 | .enable = s5pv210_clk_ip0_ctrl, |
| 474 | .ops = &clk_hclk_imem_ops, |
| 475 | }, { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 476 | .name = "uart", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 477 | .devname = "s5pv210-uart.0", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 478 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 479 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 480 | .ctrlbit = (1 << 17), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 481 | }, { |
| 482 | .name = "uart", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 483 | .devname = "s5pv210-uart.1", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 484 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 485 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 486 | .ctrlbit = (1 << 18), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 487 | }, { |
| 488 | .name = "uart", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 489 | .devname = "s5pv210-uart.2", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 490 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 491 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 492 | .ctrlbit = (1 << 19), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 493 | }, { |
| 494 | .name = "uart", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 495 | .devname = "s5pv210-uart.3", |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 496 | .parent = &clk_pclk_psys.clk, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 497 | .enable = s5pv210_clk_ip3_ctrl, |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 498 | .ctrlbit = (1 << 20), |
Thomas Abraham | 81f9bec | 2010-12-01 18:12:48 +0530 | [diff] [blame] | 499 | }, { |
| 500 | .name = "sromc", |
Thomas Abraham | 81f9bec | 2010-12-01 18:12:48 +0530 | [diff] [blame] | 501 | .parent = &clk_hclk_psys.clk, |
| 502 | .enable = s5pv210_clk_ip1_ctrl, |
| 503 | .ctrlbit = (1 << 26), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 504 | }, |
| 505 | }; |
| 506 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 507 | static struct clk *clkset_uart_list[] = { |
| 508 | [6] = &clk_mout_mpll.clk, |
| 509 | [7] = &clk_mout_epll.clk, |
| 510 | }; |
| 511 | |
| 512 | static struct clksrc_sources clkset_uart = { |
| 513 | .sources = clkset_uart_list, |
| 514 | .nr_sources = ARRAY_SIZE(clkset_uart_list), |
| 515 | }; |
| 516 | |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 517 | static struct clk *clkset_group1_list[] = { |
| 518 | [0] = &clk_sclk_a2m.clk, |
| 519 | [1] = &clk_mout_mpll.clk, |
| 520 | [2] = &clk_mout_epll.clk, |
| 521 | [3] = &clk_sclk_vpll.clk, |
| 522 | }; |
| 523 | |
| 524 | static struct clksrc_sources clkset_group1 = { |
| 525 | .sources = clkset_group1_list, |
| 526 | .nr_sources = ARRAY_SIZE(clkset_group1_list), |
| 527 | }; |
| 528 | |
| 529 | static struct clk *clkset_sclk_onenand_list[] = { |
| 530 | [0] = &clk_hclk_psys.clk, |
| 531 | [1] = &clk_hclk_dsys.clk, |
| 532 | }; |
| 533 | |
| 534 | static struct clksrc_sources clkset_sclk_onenand = { |
| 535 | .sources = clkset_sclk_onenand_list, |
| 536 | .nr_sources = ARRAY_SIZE(clkset_sclk_onenand_list), |
| 537 | }; |
| 538 | |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 539 | static struct clk *clkset_sclk_dac_list[] = { |
| 540 | [0] = &clk_sclk_vpll.clk, |
| 541 | [1] = &clk_sclk_hdmiphy, |
| 542 | }; |
| 543 | |
| 544 | static struct clksrc_sources clkset_sclk_dac = { |
| 545 | .sources = clkset_sclk_dac_list, |
| 546 | .nr_sources = ARRAY_SIZE(clkset_sclk_dac_list), |
| 547 | }; |
| 548 | |
| 549 | static struct clksrc_clk clk_sclk_dac = { |
| 550 | .clk = { |
| 551 | .name = "sclk_dac", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 552 | .enable = s5pv210_clk_mask0_ctrl, |
| 553 | .ctrlbit = (1 << 2), |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 554 | }, |
| 555 | .sources = &clkset_sclk_dac, |
| 556 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 8, .size = 1 }, |
| 557 | }; |
| 558 | |
| 559 | static struct clksrc_clk clk_sclk_pixel = { |
| 560 | .clk = { |
| 561 | .name = "sclk_pixel", |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 562 | .parent = &clk_sclk_vpll.clk, |
| 563 | }, |
| 564 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4}, |
| 565 | }; |
| 566 | |
| 567 | static struct clk *clkset_sclk_hdmi_list[] = { |
| 568 | [0] = &clk_sclk_pixel.clk, |
| 569 | [1] = &clk_sclk_hdmiphy, |
| 570 | }; |
| 571 | |
| 572 | static struct clksrc_sources clkset_sclk_hdmi = { |
| 573 | .sources = clkset_sclk_hdmi_list, |
| 574 | .nr_sources = ARRAY_SIZE(clkset_sclk_hdmi_list), |
| 575 | }; |
| 576 | |
| 577 | static struct clksrc_clk clk_sclk_hdmi = { |
| 578 | .clk = { |
| 579 | .name = "sclk_hdmi", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 580 | .enable = s5pv210_clk_mask0_ctrl, |
| 581 | .ctrlbit = (1 << 0), |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 582 | }, |
| 583 | .sources = &clkset_sclk_hdmi, |
| 584 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 0, .size = 1 }, |
| 585 | }; |
| 586 | |
| 587 | static struct clk *clkset_sclk_mixer_list[] = { |
| 588 | [0] = &clk_sclk_dac.clk, |
| 589 | [1] = &clk_sclk_hdmi.clk, |
| 590 | }; |
| 591 | |
| 592 | static struct clksrc_sources clkset_sclk_mixer = { |
| 593 | .sources = clkset_sclk_mixer_list, |
| 594 | .nr_sources = ARRAY_SIZE(clkset_sclk_mixer_list), |
| 595 | }; |
| 596 | |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 597 | static struct clk *clkset_sclk_audio0_list[] = { |
| 598 | [0] = &clk_ext_xtal_mux, |
| 599 | [1] = &clk_pcmcdclk0, |
| 600 | [2] = &clk_sclk_hdmi27m, |
| 601 | [3] = &clk_sclk_usbphy0, |
| 602 | [4] = &clk_sclk_usbphy1, |
| 603 | [5] = &clk_sclk_hdmiphy, |
| 604 | [6] = &clk_mout_mpll.clk, |
| 605 | [7] = &clk_mout_epll.clk, |
| 606 | [8] = &clk_sclk_vpll.clk, |
| 607 | }; |
| 608 | |
| 609 | static struct clksrc_sources clkset_sclk_audio0 = { |
| 610 | .sources = clkset_sclk_audio0_list, |
| 611 | .nr_sources = ARRAY_SIZE(clkset_sclk_audio0_list), |
| 612 | }; |
| 613 | |
| 614 | static struct clksrc_clk clk_sclk_audio0 = { |
| 615 | .clk = { |
| 616 | .name = "sclk_audio", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 617 | .devname = "soc-audio.0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 618 | .enable = s5pv210_clk_mask0_ctrl, |
| 619 | .ctrlbit = (1 << 24), |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 620 | }, |
| 621 | .sources = &clkset_sclk_audio0, |
| 622 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 0, .size = 4 }, |
| 623 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 0, .size = 4 }, |
| 624 | }; |
| 625 | |
| 626 | static struct clk *clkset_sclk_audio1_list[] = { |
| 627 | [0] = &clk_ext_xtal_mux, |
| 628 | [1] = &clk_pcmcdclk1, |
| 629 | [2] = &clk_sclk_hdmi27m, |
| 630 | [3] = &clk_sclk_usbphy0, |
| 631 | [4] = &clk_sclk_usbphy1, |
| 632 | [5] = &clk_sclk_hdmiphy, |
| 633 | [6] = &clk_mout_mpll.clk, |
| 634 | [7] = &clk_mout_epll.clk, |
| 635 | [8] = &clk_sclk_vpll.clk, |
| 636 | }; |
| 637 | |
| 638 | static struct clksrc_sources clkset_sclk_audio1 = { |
| 639 | .sources = clkset_sclk_audio1_list, |
| 640 | .nr_sources = ARRAY_SIZE(clkset_sclk_audio1_list), |
| 641 | }; |
| 642 | |
| 643 | static struct clksrc_clk clk_sclk_audio1 = { |
| 644 | .clk = { |
| 645 | .name = "sclk_audio", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 646 | .devname = "soc-audio.1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 647 | .enable = s5pv210_clk_mask0_ctrl, |
| 648 | .ctrlbit = (1 << 25), |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 649 | }, |
| 650 | .sources = &clkset_sclk_audio1, |
| 651 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 4, .size = 4 }, |
| 652 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 4, .size = 4 }, |
| 653 | }; |
| 654 | |
| 655 | static struct clk *clkset_sclk_audio2_list[] = { |
| 656 | [0] = &clk_ext_xtal_mux, |
| 657 | [1] = &clk_pcmcdclk0, |
| 658 | [2] = &clk_sclk_hdmi27m, |
| 659 | [3] = &clk_sclk_usbphy0, |
| 660 | [4] = &clk_sclk_usbphy1, |
| 661 | [5] = &clk_sclk_hdmiphy, |
| 662 | [6] = &clk_mout_mpll.clk, |
| 663 | [7] = &clk_mout_epll.clk, |
| 664 | [8] = &clk_sclk_vpll.clk, |
| 665 | }; |
| 666 | |
| 667 | static struct clksrc_sources clkset_sclk_audio2 = { |
| 668 | .sources = clkset_sclk_audio2_list, |
| 669 | .nr_sources = ARRAY_SIZE(clkset_sclk_audio2_list), |
| 670 | }; |
| 671 | |
| 672 | static struct clksrc_clk clk_sclk_audio2 = { |
| 673 | .clk = { |
| 674 | .name = "sclk_audio", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 675 | .devname = "soc-audio.2", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 676 | .enable = s5pv210_clk_mask0_ctrl, |
| 677 | .ctrlbit = (1 << 26), |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 678 | }, |
| 679 | .sources = &clkset_sclk_audio2, |
| 680 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 8, .size = 4 }, |
| 681 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 8, .size = 4 }, |
| 682 | }; |
| 683 | |
| 684 | static struct clk *clkset_sclk_spdif_list[] = { |
| 685 | [0] = &clk_sclk_audio0.clk, |
| 686 | [1] = &clk_sclk_audio1.clk, |
| 687 | [2] = &clk_sclk_audio2.clk, |
| 688 | }; |
| 689 | |
| 690 | static struct clksrc_sources clkset_sclk_spdif = { |
| 691 | .sources = clkset_sclk_spdif_list, |
| 692 | .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), |
| 693 | }; |
| 694 | |
Seungwhan Youn | aa21ae3 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 695 | static struct clksrc_clk clk_sclk_spdif = { |
| 696 | .clk = { |
| 697 | .name = "sclk_spdif", |
Seungwhan Youn | aa21ae3 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 698 | .enable = s5pv210_clk_mask0_ctrl, |
| 699 | .ctrlbit = (1 << 27), |
Naveen Krishna Chatradhi | 65f5eaa | 2011-07-18 14:44:19 +0900 | [diff] [blame] | 700 | .ops = &s5p_sclk_spdif_ops, |
Seungwhan Youn | aa21ae3 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 701 | }, |
| 702 | .sources = &clkset_sclk_spdif, |
| 703 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 }, |
| 704 | }; |
| 705 | |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 706 | static struct clk *clkset_group2_list[] = { |
| 707 | [0] = &clk_ext_xtal_mux, |
| 708 | [1] = &clk_xusbxti, |
| 709 | [2] = &clk_sclk_hdmi27m, |
| 710 | [3] = &clk_sclk_usbphy0, |
| 711 | [4] = &clk_sclk_usbphy1, |
| 712 | [5] = &clk_sclk_hdmiphy, |
| 713 | [6] = &clk_mout_mpll.clk, |
| 714 | [7] = &clk_mout_epll.clk, |
| 715 | [8] = &clk_sclk_vpll.clk, |
| 716 | }; |
| 717 | |
| 718 | static struct clksrc_sources clkset_group2 = { |
| 719 | .sources = clkset_group2_list, |
| 720 | .nr_sources = ARRAY_SIZE(clkset_group2_list), |
| 721 | }; |
| 722 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 723 | static struct clksrc_clk clksrcs[] = { |
| 724 | { |
| 725 | .clk = { |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 726 | .name = "sclk_dmc", |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 727 | }, |
| 728 | .sources = &clkset_group1, |
| 729 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 }, |
| 730 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 }, |
| 731 | }, { |
| 732 | .clk = { |
| 733 | .name = "sclk_onenand", |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 734 | }, |
| 735 | .sources = &clkset_sclk_onenand, |
| 736 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 28, .size = 1 }, |
| 737 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 12, .size = 3 }, |
| 738 | }, { |
| 739 | .clk = { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 740 | .name = "uclk1", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 741 | .devname = "s5pv210-uart.0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 742 | .enable = s5pv210_clk_mask0_ctrl, |
| 743 | .ctrlbit = (1 << 12), |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 744 | }, |
| 745 | .sources = &clkset_uart, |
| 746 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 16, .size = 4 }, |
| 747 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 }, |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 748 | }, { |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 749 | .clk = { |
| 750 | .name = "uclk1", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 751 | .devname = "s5pv210-uart.1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 752 | .enable = s5pv210_clk_mask0_ctrl, |
| 753 | .ctrlbit = (1 << 13), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 754 | }, |
| 755 | .sources = &clkset_uart, |
| 756 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 20, .size = 4 }, |
| 757 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 }, |
| 758 | }, { |
| 759 | .clk = { |
| 760 | .name = "uclk1", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 761 | .devname = "s5pv210-uart.2", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 762 | .enable = s5pv210_clk_mask0_ctrl, |
| 763 | .ctrlbit = (1 << 14), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 764 | }, |
| 765 | .sources = &clkset_uart, |
| 766 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 24, .size = 4 }, |
| 767 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 24, .size = 4 }, |
| 768 | }, { |
| 769 | .clk = { |
| 770 | .name = "uclk1", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 771 | .devname = "s5pv210-uart.3", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 772 | .enable = s5pv210_clk_mask0_ctrl, |
| 773 | .ctrlbit = (1 << 15), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 774 | }, |
| 775 | .sources = &clkset_uart, |
| 776 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 28, .size = 4 }, |
| 777 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 28, .size = 4 }, |
| 778 | }, { |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 779 | .clk = { |
| 780 | .name = "sclk_mixer", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 781 | .enable = s5pv210_clk_mask0_ctrl, |
| 782 | .ctrlbit = (1 << 1), |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 783 | }, |
| 784 | .sources = &clkset_sclk_mixer, |
| 785 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 }, |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 786 | }, { |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 787 | .clk = { |
| 788 | .name = "sclk_fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 789 | .devname = "s5pv210-fimc.0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 790 | .enable = s5pv210_clk_mask1_ctrl, |
| 791 | .ctrlbit = (1 << 2), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 792 | }, |
| 793 | .sources = &clkset_group2, |
| 794 | .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 4 }, |
| 795 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 12, .size = 4 }, |
| 796 | }, { |
| 797 | .clk = { |
| 798 | .name = "sclk_fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 799 | .devname = "s5pv210-fimc.1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 800 | .enable = s5pv210_clk_mask1_ctrl, |
| 801 | .ctrlbit = (1 << 3), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 802 | }, |
| 803 | .sources = &clkset_group2, |
| 804 | .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 4 }, |
| 805 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 16, .size = 4 }, |
| 806 | }, { |
| 807 | .clk = { |
| 808 | .name = "sclk_fimc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 809 | .devname = "s5pv210-fimc.2", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 810 | .enable = s5pv210_clk_mask1_ctrl, |
| 811 | .ctrlbit = (1 << 4), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 812 | }, |
| 813 | .sources = &clkset_group2, |
| 814 | .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 4 }, |
| 815 | .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 }, |
| 816 | }, { |
| 817 | .clk = { |
Sylwester Nawrocki | 83427c2 | 2011-09-27 07:00:53 +0900 | [diff] [blame^] | 818 | .name = "sclk_cam0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 819 | .enable = s5pv210_clk_mask0_ctrl, |
| 820 | .ctrlbit = (1 << 3), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 821 | }, |
| 822 | .sources = &clkset_group2, |
| 823 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 12, .size = 4 }, |
| 824 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 }, |
| 825 | }, { |
| 826 | .clk = { |
Sylwester Nawrocki | 83427c2 | 2011-09-27 07:00:53 +0900 | [diff] [blame^] | 827 | .name = "sclk_cam1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 828 | .enable = s5pv210_clk_mask0_ctrl, |
| 829 | .ctrlbit = (1 << 4), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 830 | }, |
| 831 | .sources = &clkset_group2, |
| 832 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 16, .size = 4 }, |
| 833 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 16, .size = 4 }, |
| 834 | }, { |
| 835 | .clk = { |
| 836 | .name = "sclk_fimd", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 837 | .enable = s5pv210_clk_mask0_ctrl, |
| 838 | .ctrlbit = (1 << 5), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 839 | }, |
| 840 | .sources = &clkset_group2, |
| 841 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 20, .size = 4 }, |
| 842 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 20, .size = 4 }, |
| 843 | }, { |
| 844 | .clk = { |
| 845 | .name = "sclk_mmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 846 | .devname = "s3c-sdhci.0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 847 | .enable = s5pv210_clk_mask0_ctrl, |
| 848 | .ctrlbit = (1 << 8), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 849 | }, |
| 850 | .sources = &clkset_group2, |
| 851 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 0, .size = 4 }, |
| 852 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 0, .size = 4 }, |
| 853 | }, { |
| 854 | .clk = { |
| 855 | .name = "sclk_mmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 856 | .devname = "s3c-sdhci.1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 857 | .enable = s5pv210_clk_mask0_ctrl, |
| 858 | .ctrlbit = (1 << 9), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 859 | }, |
| 860 | .sources = &clkset_group2, |
| 861 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 4, .size = 4 }, |
| 862 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 4, .size = 4 }, |
| 863 | }, { |
| 864 | .clk = { |
| 865 | .name = "sclk_mmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 866 | .devname = "s3c-sdhci.2", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 867 | .enable = s5pv210_clk_mask0_ctrl, |
| 868 | .ctrlbit = (1 << 10), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 869 | }, |
| 870 | .sources = &clkset_group2, |
| 871 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 8, .size = 4 }, |
| 872 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 8, .size = 4 }, |
| 873 | }, { |
| 874 | .clk = { |
| 875 | .name = "sclk_mmc", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 876 | .devname = "s3c-sdhci.3", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 877 | .enable = s5pv210_clk_mask0_ctrl, |
| 878 | .ctrlbit = (1 << 11), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 879 | }, |
| 880 | .sources = &clkset_group2, |
| 881 | .reg_src = { .reg = S5P_CLK_SRC4, .shift = 12, .size = 4 }, |
| 882 | .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 }, |
| 883 | }, { |
| 884 | .clk = { |
| 885 | .name = "sclk_mfc", |
Kamil Debski | 0f75a96 | 2011-07-21 16:42:30 +0900 | [diff] [blame] | 886 | .devname = "s5p-mfc", |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 887 | .enable = s5pv210_clk_ip0_ctrl, |
| 888 | .ctrlbit = (1 << 16), |
| 889 | }, |
| 890 | .sources = &clkset_group1, |
| 891 | .reg_src = { .reg = S5P_CLK_SRC2, .shift = 4, .size = 2 }, |
| 892 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 }, |
| 893 | }, { |
| 894 | .clk = { |
| 895 | .name = "sclk_g2d", |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 896 | .enable = s5pv210_clk_ip0_ctrl, |
| 897 | .ctrlbit = (1 << 12), |
| 898 | }, |
| 899 | .sources = &clkset_group1, |
| 900 | .reg_src = { .reg = S5P_CLK_SRC2, .shift = 8, .size = 2 }, |
| 901 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 8, .size = 4 }, |
| 902 | }, { |
| 903 | .clk = { |
| 904 | .name = "sclk_g3d", |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 905 | .enable = s5pv210_clk_ip0_ctrl, |
| 906 | .ctrlbit = (1 << 8), |
| 907 | }, |
| 908 | .sources = &clkset_group1, |
| 909 | .reg_src = { .reg = S5P_CLK_SRC2, .shift = 0, .size = 2 }, |
| 910 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 }, |
| 911 | }, { |
| 912 | .clk = { |
| 913 | .name = "sclk_csis", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 914 | .enable = s5pv210_clk_mask0_ctrl, |
| 915 | .ctrlbit = (1 << 6), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 916 | }, |
| 917 | .sources = &clkset_group2, |
| 918 | .reg_src = { .reg = S5P_CLK_SRC1, .shift = 24, .size = 4 }, |
| 919 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 28, .size = 4 }, |
| 920 | }, { |
| 921 | .clk = { |
| 922 | .name = "sclk_spi", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 923 | .devname = "s3c64xx-spi.0", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 924 | .enable = s5pv210_clk_mask0_ctrl, |
| 925 | .ctrlbit = (1 << 16), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 926 | }, |
| 927 | .sources = &clkset_group2, |
| 928 | .reg_src = { .reg = S5P_CLK_SRC5, .shift = 0, .size = 4 }, |
| 929 | .reg_div = { .reg = S5P_CLK_DIV5, .shift = 0, .size = 4 }, |
| 930 | }, { |
| 931 | .clk = { |
| 932 | .name = "sclk_spi", |
Thomas Abraham | b2a9dd4 | 2011-06-14 19:12:27 +0900 | [diff] [blame] | 933 | .devname = "s3c64xx-spi.1", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 934 | .enable = s5pv210_clk_mask0_ctrl, |
| 935 | .ctrlbit = (1 << 17), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 936 | }, |
| 937 | .sources = &clkset_group2, |
| 938 | .reg_src = { .reg = S5P_CLK_SRC5, .shift = 4, .size = 4 }, |
| 939 | .reg_div = { .reg = S5P_CLK_DIV5, .shift = 4, .size = 4 }, |
| 940 | }, { |
| 941 | .clk = { |
| 942 | .name = "sclk_pwi", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 943 | .enable = s5pv210_clk_mask0_ctrl, |
| 944 | .ctrlbit = (1 << 29), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 945 | }, |
| 946 | .sources = &clkset_group2, |
| 947 | .reg_src = { .reg = S5P_CLK_SRC6, .shift = 20, .size = 4 }, |
| 948 | .reg_div = { .reg = S5P_CLK_DIV6, .shift = 24, .size = 4 }, |
| 949 | }, { |
| 950 | .clk = { |
| 951 | .name = "sclk_pwm", |
MyungJoo Ham | 154d62e | 2010-06-26 17:21:50 +0900 | [diff] [blame] | 952 | .enable = s5pv210_clk_mask0_ctrl, |
| 953 | .ctrlbit = (1 << 19), |
Thomas Abraham | f64cacc | 2010-05-17 09:39:03 +0900 | [diff] [blame] | 954 | }, |
| 955 | .sources = &clkset_group2, |
| 956 | .reg_src = { .reg = S5P_CLK_SRC5, .shift = 12, .size = 4 }, |
| 957 | .reg_div = { .reg = S5P_CLK_DIV5, .shift = 12, .size = 4 }, |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 958 | }, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 959 | }; |
| 960 | |
| 961 | /* Clock initialisation code */ |
Thomas Abraham | eb1ef1e | 2010-05-17 09:38:12 +0900 | [diff] [blame] | 962 | static struct clksrc_clk *sysclks[] = { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 963 | &clk_mout_apll, |
| 964 | &clk_mout_epll, |
| 965 | &clk_mout_mpll, |
Thomas Abraham | 374e0bf | 2010-05-17 09:38:31 +0900 | [diff] [blame] | 966 | &clk_armclk, |
Thomas Abraham | af76a20 | 2010-05-17 09:38:34 +0900 | [diff] [blame] | 967 | &clk_hclk_msys, |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 968 | &clk_sclk_a2m, |
| 969 | &clk_hclk_dsys, |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 970 | &clk_hclk_psys, |
Thomas Abraham | 6ed91a2 | 2010-05-17 09:38:42 +0900 | [diff] [blame] | 971 | &clk_pclk_msys, |
Thomas Abraham | 58772cd | 2010-05-17 09:38:48 +0900 | [diff] [blame] | 972 | &clk_pclk_dsys, |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 973 | &clk_pclk_psys, |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 974 | &clk_vpllsrc, |
| 975 | &clk_sclk_vpll, |
Thomas Abraham | 9e20614 | 2010-05-17 09:38:57 +0900 | [diff] [blame] | 976 | &clk_sclk_dac, |
| 977 | &clk_sclk_pixel, |
| 978 | &clk_sclk_hdmi, |
Jaecheol Lee | 08f49d1 | 2010-10-12 09:19:30 +0900 | [diff] [blame] | 979 | &clk_mout_dmc0, |
| 980 | &clk_sclk_dmc0, |
Seungwhan Youn | 900fa01 | 2010-10-14 10:35:24 +0900 | [diff] [blame] | 981 | &clk_sclk_audio0, |
| 982 | &clk_sclk_audio1, |
| 983 | &clk_sclk_audio2, |
| 984 | &clk_sclk_spdif, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 985 | }; |
| 986 | |
Seungwhan Youn | c9fa7a0 | 2010-10-14 10:39:28 +0900 | [diff] [blame] | 987 | static u32 epll_div[][6] = { |
| 988 | { 48000000, 0, 48, 3, 3, 0 }, |
| 989 | { 96000000, 0, 48, 3, 2, 0 }, |
| 990 | { 144000000, 1, 72, 3, 2, 0 }, |
| 991 | { 192000000, 0, 48, 3, 1, 0 }, |
| 992 | { 288000000, 1, 72, 3, 1, 0 }, |
| 993 | { 32750000, 1, 65, 3, 4, 35127 }, |
| 994 | { 32768000, 1, 65, 3, 4, 35127 }, |
| 995 | { 45158400, 0, 45, 3, 3, 10355 }, |
| 996 | { 45000000, 0, 45, 3, 3, 10355 }, |
| 997 | { 45158000, 0, 45, 3, 3, 10355 }, |
| 998 | { 49125000, 0, 49, 3, 3, 9961 }, |
| 999 | { 49152000, 0, 49, 3, 3, 9961 }, |
| 1000 | { 67737600, 1, 67, 3, 3, 48366 }, |
| 1001 | { 67738000, 1, 67, 3, 3, 48366 }, |
| 1002 | { 73800000, 1, 73, 3, 3, 47710 }, |
| 1003 | { 73728000, 1, 73, 3, 3, 47710 }, |
| 1004 | { 36000000, 1, 32, 3, 4, 0 }, |
| 1005 | { 60000000, 1, 60, 3, 3, 0 }, |
| 1006 | { 72000000, 1, 72, 3, 3, 0 }, |
| 1007 | { 80000000, 1, 80, 3, 3, 0 }, |
| 1008 | { 84000000, 0, 42, 3, 2, 0 }, |
| 1009 | { 50000000, 0, 50, 3, 3, 0 }, |
| 1010 | }; |
| 1011 | |
| 1012 | static int s5pv210_epll_set_rate(struct clk *clk, unsigned long rate) |
| 1013 | { |
| 1014 | unsigned int epll_con, epll_con_k; |
| 1015 | unsigned int i; |
| 1016 | |
| 1017 | /* Return if nothing changed */ |
| 1018 | if (clk->rate == rate) |
| 1019 | return 0; |
| 1020 | |
| 1021 | epll_con = __raw_readl(S5P_EPLL_CON); |
| 1022 | epll_con_k = __raw_readl(S5P_EPLL_CON1); |
| 1023 | |
| 1024 | epll_con_k &= ~PLL46XX_KDIV_MASK; |
| 1025 | epll_con &= ~(1 << 27 | |
| 1026 | PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | |
| 1027 | PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | |
| 1028 | PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); |
| 1029 | |
| 1030 | for (i = 0; i < ARRAY_SIZE(epll_div); i++) { |
| 1031 | if (epll_div[i][0] == rate) { |
| 1032 | epll_con_k |= epll_div[i][5] << 0; |
| 1033 | epll_con |= (epll_div[i][1] << 27 | |
| 1034 | epll_div[i][2] << PLL46XX_MDIV_SHIFT | |
| 1035 | epll_div[i][3] << PLL46XX_PDIV_SHIFT | |
| 1036 | epll_div[i][4] << PLL46XX_SDIV_SHIFT); |
| 1037 | break; |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | if (i == ARRAY_SIZE(epll_div)) { |
| 1042 | printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", |
| 1043 | __func__); |
| 1044 | return -EINVAL; |
| 1045 | } |
| 1046 | |
| 1047 | __raw_writel(epll_con, S5P_EPLL_CON); |
| 1048 | __raw_writel(epll_con_k, S5P_EPLL_CON1); |
| 1049 | |
Seungwhan Youn | 9616674 | 2010-10-14 10:39:33 +0900 | [diff] [blame] | 1050 | printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n", |
| 1051 | clk->rate, rate); |
| 1052 | |
Seungwhan Youn | c9fa7a0 | 2010-10-14 10:39:28 +0900 | [diff] [blame] | 1053 | clk->rate = rate; |
| 1054 | |
| 1055 | return 0; |
| 1056 | } |
| 1057 | |
| 1058 | static struct clk_ops s5pv210_epll_ops = { |
| 1059 | .set_rate = s5pv210_epll_set_rate, |
| 1060 | .get_rate = s5p_epll_get_rate, |
| 1061 | }; |
| 1062 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1063 | void __init_or_cpufreq s5pv210_setup_clocks(void) |
| 1064 | { |
| 1065 | struct clk *xtal_clk; |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1066 | unsigned long vpllsrc; |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1067 | unsigned long armclk; |
Thomas Abraham | af76a20 | 2010-05-17 09:38:34 +0900 | [diff] [blame] | 1068 | unsigned long hclk_msys; |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 1069 | unsigned long hclk_dsys; |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 1070 | unsigned long hclk_psys; |
Thomas Abraham | 6ed91a2 | 2010-05-17 09:38:42 +0900 | [diff] [blame] | 1071 | unsigned long pclk_msys; |
Thomas Abraham | 58772cd | 2010-05-17 09:38:48 +0900 | [diff] [blame] | 1072 | unsigned long pclk_dsys; |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 1073 | unsigned long pclk_psys; |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1074 | unsigned long apll; |
| 1075 | unsigned long mpll; |
| 1076 | unsigned long epll; |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1077 | unsigned long vpll; |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1078 | unsigned int ptr; |
| 1079 | u32 clkdiv0, clkdiv1; |
| 1080 | |
Seungwhan Youn | c9fa7a0 | 2010-10-14 10:39:28 +0900 | [diff] [blame] | 1081 | /* Set functions for clk_fout_epll */ |
| 1082 | clk_fout_epll.enable = s5p_epll_enable; |
| 1083 | clk_fout_epll.ops = &s5pv210_epll_ops; |
| 1084 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1085 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); |
| 1086 | |
| 1087 | clkdiv0 = __raw_readl(S5P_CLK_DIV0); |
| 1088 | clkdiv1 = __raw_readl(S5P_CLK_DIV1); |
| 1089 | |
| 1090 | printk(KERN_DEBUG "%s: clkdiv0 = %08x, clkdiv1 = %08x\n", |
| 1091 | __func__, clkdiv0, clkdiv1); |
| 1092 | |
| 1093 | xtal_clk = clk_get(NULL, "xtal"); |
| 1094 | BUG_ON(IS_ERR(xtal_clk)); |
| 1095 | |
| 1096 | xtal = clk_get_rate(xtal_clk); |
| 1097 | clk_put(xtal_clk); |
| 1098 | |
| 1099 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); |
| 1100 | |
| 1101 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508); |
| 1102 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); |
Seungwhan Youn | 42a6e20 | 2010-10-14 10:39:15 +0900 | [diff] [blame] | 1103 | epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON), |
| 1104 | __raw_readl(S5P_EPLL_CON1), pll_4600); |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1105 | vpllsrc = clk_get_rate(&clk_vpllsrc.clk); |
| 1106 | vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1107 | |
Jaecheol Lee | 8869584 | 2010-10-12 09:19:26 +0900 | [diff] [blame] | 1108 | clk_fout_apll.ops = &clk_fout_apll_ops; |
Thomas Abraham | c62ec6a | 2010-05-17 09:38:28 +0900 | [diff] [blame] | 1109 | clk_fout_mpll.rate = mpll; |
| 1110 | clk_fout_epll.rate = epll; |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1111 | clk_fout_vpll.rate = vpll; |
Thomas Abraham | c62ec6a | 2010-05-17 09:38:28 +0900 | [diff] [blame] | 1112 | |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1113 | printk(KERN_INFO "S5PV210: PLL settings, A=%ld, M=%ld, E=%ld V=%ld", |
| 1114 | apll, mpll, epll, vpll); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1115 | |
Thomas Abraham | 374e0bf | 2010-05-17 09:38:31 +0900 | [diff] [blame] | 1116 | armclk = clk_get_rate(&clk_armclk.clk); |
Thomas Abraham | af76a20 | 2010-05-17 09:38:34 +0900 | [diff] [blame] | 1117 | hclk_msys = clk_get_rate(&clk_hclk_msys.clk); |
Thomas Abraham | 0fe967a | 2010-05-17 09:38:37 +0900 | [diff] [blame] | 1118 | hclk_dsys = clk_get_rate(&clk_hclk_dsys.clk); |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 1119 | hclk_psys = clk_get_rate(&clk_hclk_psys.clk); |
Thomas Abraham | 6ed91a2 | 2010-05-17 09:38:42 +0900 | [diff] [blame] | 1120 | pclk_msys = clk_get_rate(&clk_pclk_msys.clk); |
Thomas Abraham | 58772cd | 2010-05-17 09:38:48 +0900 | [diff] [blame] | 1121 | pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk); |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 1122 | pclk_psys = clk_get_rate(&clk_pclk_psys.clk); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1123 | |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 1124 | printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n" |
| 1125 | "HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n", |
| 1126 | armclk, hclk_msys, hclk_dsys, hclk_psys, |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 1127 | pclk_msys, pclk_dsys, pclk_psys); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1128 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1129 | clk_f.rate = armclk; |
Thomas Abraham | acfa245 | 2010-05-17 09:38:40 +0900 | [diff] [blame] | 1130 | clk_h.rate = hclk_psys; |
Thomas Abraham | f44cf78 | 2010-05-17 09:38:50 +0900 | [diff] [blame] | 1131 | clk_p.rate = pclk_psys; |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1132 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1133 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
| 1134 | s3c_set_clksrc(&clksrcs[ptr], true); |
| 1135 | } |
| 1136 | |
| 1137 | static struct clk *clks[] __initdata = { |
Thomas Abraham | f445dbd | 2010-05-17 09:38:52 +0900 | [diff] [blame] | 1138 | &clk_sclk_hdmi27m, |
Thomas Abraham | 2cf4c2e | 2010-05-17 09:38:55 +0900 | [diff] [blame] | 1139 | &clk_sclk_hdmiphy, |
| 1140 | &clk_sclk_usbphy0, |
| 1141 | &clk_sclk_usbphy1, |
Thomas Abraham | 4583487 | 2010-05-17 09:39:00 +0900 | [diff] [blame] | 1142 | &clk_pcmcdclk0, |
| 1143 | &clk_pcmcdclk1, |
| 1144 | &clk_pcmcdclk2, |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1145 | }; |
| 1146 | |
| 1147 | void __init s5pv210_register_clocks(void) |
| 1148 | { |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1149 | int ptr; |
| 1150 | |
Kukjin Kim | 3c0fa64 | 2011-01-04 17:51:30 +0900 | [diff] [blame] | 1151 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1152 | |
Thomas Abraham | eb1ef1e | 2010-05-17 09:38:12 +0900 | [diff] [blame] | 1153 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) |
| 1154 | s3c_register_clksrc(sysclks[ptr], 1); |
| 1155 | |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1156 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); |
| 1157 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); |
| 1158 | |
Kukjin Kim | 3c0fa64 | 2011-01-04 17:51:30 +0900 | [diff] [blame] | 1159 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
| 1160 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
Kukjin Kim | 0c1945d | 2010-02-24 16:40:36 +0900 | [diff] [blame] | 1161 | |
| 1162 | s3c_pwmclk_init(); |
| 1163 | } |