aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-05-09 09:57:27 -0400
committerArnd Bergmann <arnd@arndb.de>2016-05-09 09:57:27 -0400
commiteb07e08d54621a2e7bd48a4962b2a786c82a713a (patch)
tree7a4e48c9cd155428bcf62b1f688eceb0e4b30ed6
parentb65b98d9ac27a97a715b076ead50e408026bfbf4 (diff)
parent3f2a09d57bb12ca55f92209b3ef0c0684cdb20b0 (diff)
Merge tag 'davinci-for-v4.7/soc-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci into next/soc
Merge "DaVinci SoC updates for v4.7 (part 2)" from Sekhar Nori: These patches provide ability to add non-PSC clocks to DaVinci clock framwork and are required to support USB PHY clock setting from USB PHY driver. * tag 'davinci-for-v4.7/soc-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci: ARM: davinci: da850: use clk->set_parent for async3 ARM: davinci: Move clock init after ioremap.
-rw-r--r--arch/arm/mach-davinci/clock.c2
-rw-r--r--arch/arm/mach-davinci/common.c6
-rw-r--r--arch/arm/mach-davinci/da830.c2
-rw-r--r--arch/arm/mach-davinci/da850.c83
-rw-r--r--arch/arm/mach-davinci/dm355.c1
-rw-r--r--arch/arm/mach-davinci/dm365.c1
-rw-r--r--arch/arm/mach-davinci/dm644x.c1
-rw-r--r--arch/arm/mach-davinci/dm646x.c1
8 files changed, 42 insertions, 55 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 34b4f9fda35d..df42c93a93d6 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -577,7 +577,7 @@ EXPORT_SYMBOL(davinci_set_pllrate);
577 * than that used by default in <soc>.c file. The reference clock rate 577 * than that used by default in <soc>.c file. The reference clock rate
578 * should be updated early in the boot process; ideally soon after the 578 * should be updated early in the boot process; ideally soon after the
579 * clock tree has been initialized once with the default reference clock 579 * clock tree has been initialized once with the default reference clock
580 * rate (davinci_common_init()). 580 * rate (davinci_clk_init()).
581 * 581 *
582 * Returns 0 on success, error otherwise. 582 * Returns 0 on success, error otherwise.
583 */ 583 */
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index f55ef2ef2f92..6bc8c22b8ace 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -103,12 +103,6 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
103 if (ret < 0) 103 if (ret < 0)
104 goto err; 104 goto err;
105 105
106 if (davinci_soc_info.cpu_clks) {
107 ret = davinci_clk_init(davinci_soc_info.cpu_clks);
108
109 if (ret != 0)
110 goto err;
111 }
112 106
113 return; 107 return;
114 108
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 7187e7fc2822..426fd7477357 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1214,4 +1214,6 @@ void __init da830_init(void)
1214 1214
1215 da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K); 1215 da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
1216 WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module"); 1216 WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module");
1217
1218 davinci_clk_init(davinci_soc_info_da830.cpu_clks);
1217} 1219}
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 97d8779a9a65..239886299968 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -34,9 +34,6 @@
34#include "clock.h" 34#include "clock.h"
35#include "mux.h" 35#include "mux.h"
36 36
37/* SoC specific clock flags */
38#define DA850_CLK_ASYNC3 BIT(16)
39
40#define DA850_PLL1_BASE 0x01e1a000 37#define DA850_PLL1_BASE 0x01e1a000
41#define DA850_TIMER64P2_BASE 0x01f0c000 38#define DA850_TIMER64P2_BASE 0x01f0c000
42#define DA850_TIMER64P3_BASE 0x01f0d000 39#define DA850_TIMER64P3_BASE 0x01f0d000
@@ -161,6 +158,32 @@ static struct clk pll1_sysclk3 = {
161 .div_reg = PLLDIV3, 158 .div_reg = PLLDIV3,
162}; 159};
163 160
161static int da850_async3_set_parent(struct clk *clk, struct clk *parent)
162{
163 u32 val;
164
165 val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
166
167 if (parent == &pll0_sysclk2) {
168 val &= ~CFGCHIP3_ASYNC3_CLKSRC;
169 } else if (parent == &pll1_sysclk2) {
170 val |= CFGCHIP3_ASYNC3_CLKSRC;
171 } else {
172 pr_err("Bad parent on async3 clock mux\n");
173 return -EINVAL;
174 }
175
176 writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
177
178 return 0;
179}
180
181static struct clk async3_clk = {
182 .name = "async3",
183 .parent = &pll1_sysclk2,
184 .set_parent = da850_async3_set_parent,
185};
186
164static struct clk i2c0_clk = { 187static struct clk i2c0_clk = {
165 .name = "i2c0", 188 .name = "i2c0",
166 .parent = &pll0_aux_clk, 189 .parent = &pll0_aux_clk,
@@ -234,18 +257,16 @@ static struct clk uart0_clk = {
234 257
235static struct clk uart1_clk = { 258static struct clk uart1_clk = {
236 .name = "uart1", 259 .name = "uart1",
237 .parent = &pll0_sysclk2, 260 .parent = &async3_clk,
238 .lpsc = DA8XX_LPSC1_UART1, 261 .lpsc = DA8XX_LPSC1_UART1,
239 .gpsc = 1, 262 .gpsc = 1,
240 .flags = DA850_CLK_ASYNC3,
241}; 263};
242 264
243static struct clk uart2_clk = { 265static struct clk uart2_clk = {
244 .name = "uart2", 266 .name = "uart2",
245 .parent = &pll0_sysclk2, 267 .parent = &async3_clk,
246 .lpsc = DA8XX_LPSC1_UART2, 268 .lpsc = DA8XX_LPSC1_UART2,
247 .gpsc = 1, 269 .gpsc = 1,
248 .flags = DA850_CLK_ASYNC3,
249}; 270};
250 271
251static struct clk aintc_clk = { 272static struct clk aintc_clk = {
@@ -300,10 +321,9 @@ static struct clk emac_clk = {
300 321
301static struct clk mcasp_clk = { 322static struct clk mcasp_clk = {
302 .name = "mcasp", 323 .name = "mcasp",
303 .parent = &pll0_sysclk2, 324 .parent = &async3_clk,
304 .lpsc = DA8XX_LPSC1_McASP0, 325 .lpsc = DA8XX_LPSC1_McASP0,
305 .gpsc = 1, 326 .gpsc = 1,
306 .flags = DA850_CLK_ASYNC3,
307}; 327};
308 328
309static struct clk lcdc_clk = { 329static struct clk lcdc_clk = {
@@ -355,10 +375,9 @@ static struct clk spi0_clk = {
355 375
356static struct clk spi1_clk = { 376static struct clk spi1_clk = {
357 .name = "spi1", 377 .name = "spi1",
358 .parent = &pll0_sysclk2, 378 .parent = &async3_clk,
359 .lpsc = DA8XX_LPSC1_SPI1, 379 .lpsc = DA8XX_LPSC1_SPI1,
360 .gpsc = 1, 380 .gpsc = 1,
361 .flags = DA850_CLK_ASYNC3,
362}; 381};
363 382
364static struct clk vpif_clk = { 383static struct clk vpif_clk = {
@@ -386,10 +405,9 @@ static struct clk dsp_clk = {
386 405
387static struct clk ehrpwm_clk = { 406static struct clk ehrpwm_clk = {
388 .name = "ehrpwm", 407 .name = "ehrpwm",
389 .parent = &pll0_sysclk2, 408 .parent = &async3_clk,
390 .lpsc = DA8XX_LPSC1_PWM, 409 .lpsc = DA8XX_LPSC1_PWM,
391 .gpsc = 1, 410 .gpsc = 1,
392 .flags = DA850_CLK_ASYNC3,
393}; 411};
394 412
395#define DA8XX_EHRPWM_TBCLKSYNC BIT(12) 413#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
@@ -421,10 +439,9 @@ static struct clk ehrpwm_tbclk = {
421 439
422static struct clk ecap_clk = { 440static struct clk ecap_clk = {
423 .name = "ecap", 441 .name = "ecap",
424 .parent = &pll0_sysclk2, 442 .parent = &async3_clk,
425 .lpsc = DA8XX_LPSC1_ECAP, 443 .lpsc = DA8XX_LPSC1_ECAP,
426 .gpsc = 1, 444 .gpsc = 1,
427 .flags = DA850_CLK_ASYNC3,
428}; 445};
429 446
430static struct clk_lookup da850_clks[] = { 447static struct clk_lookup da850_clks[] = {
@@ -442,6 +459,7 @@ static struct clk_lookup da850_clks[] = {
442 CLK(NULL, "pll1_aux", &pll1_aux_clk), 459 CLK(NULL, "pll1_aux", &pll1_aux_clk),
443 CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), 460 CLK(NULL, "pll1_sysclk2", &pll1_sysclk2),
444 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 461 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3),
462 CLK(NULL, "async3", &async3_clk),
445 CLK("i2c_davinci.1", NULL, &i2c0_clk), 463 CLK("i2c_davinci.1", NULL, &i2c0_clk),
446 CLK(NULL, "timer0", &timerp64_0_clk), 464 CLK(NULL, "timer0", &timerp64_0_clk),
447 CLK("davinci-wdt", NULL, &timerp64_1_clk), 465 CLK("davinci-wdt", NULL, &timerp64_1_clk),
@@ -909,30 +927,6 @@ static struct davinci_timer_info da850_timer_info = {
909 .clocksource_id = T0_TOP, 927 .clocksource_id = T0_TOP,
910}; 928};
911 929
912static void da850_set_async3_src(int pllnum)
913{
914 struct clk *clk, *newparent = pllnum ? &pll1_sysclk2 : &pll0_sysclk2;
915 struct clk_lookup *c;
916 unsigned int v;
917 int ret;
918
919 for (c = da850_clks; c->clk; c++) {
920 clk = c->clk;
921 if (clk->flags & DA850_CLK_ASYNC3) {
922 ret = clk_set_parent(clk, newparent);
923 WARN(ret, "DA850: unable to re-parent clock %s",
924 clk->name);
925 }
926 }
927
928 v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
929 if (pllnum)
930 v |= CFGCHIP3_ASYNC3_CLKSRC;
931 else
932 v &= ~CFGCHIP3_ASYNC3_CLKSRC;
933 __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
934}
935
936#ifdef CONFIG_CPU_FREQ 930#ifdef CONFIG_CPU_FREQ
937/* 931/*
938 * Notes: 932 * Notes:
@@ -1328,15 +1322,6 @@ void __init da850_init(void)
1328 if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module")) 1322 if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module"))
1329 return; 1323 return;
1330 1324
1331 /*
1332 * Move the clock source of Async3 domain to PLL1 SYSCLK2.
1333 * This helps keeping the peripherals on this domain insulated
1334 * from CPU frequency changes caused by DVFS. The firmware sets
1335 * both PLL0 and PLL1 to the same frequency so, there should not
1336 * be any noticeable change even in non-DVFS use cases.
1337 */
1338 da850_set_async3_src(1);
1339
1340 /* Unlock writing to PLL0 registers */ 1325 /* Unlock writing to PLL0 registers */
1341 v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); 1326 v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG));
1342 v &= ~CFGCHIP0_PLL_MASTER_LOCK; 1327 v &= ~CFGCHIP0_PLL_MASTER_LOCK;
@@ -1346,4 +1331,6 @@ void __init da850_init(void)
1346 v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 1331 v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
1347 v &= ~CFGCHIP3_PLL1_MASTER_LOCK; 1332 v &= ~CFGCHIP3_PLL1_MASTER_LOCK;
1348 __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 1333 __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
1334
1335 davinci_clk_init(davinci_soc_info_da850.cpu_clks);
1349} 1336}
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a0ecf499c2f2..5a19cca7ed6a 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -1052,6 +1052,7 @@ void __init dm355_init(void)
1052{ 1052{
1053 davinci_common_init(&davinci_soc_info_dm355); 1053 davinci_common_init(&davinci_soc_info_dm355);
1054 davinci_map_sysmod(); 1054 davinci_map_sysmod();
1055 davinci_clk_init(davinci_soc_info_dm355.cpu_clks);
1055} 1056}
1056 1057
1057int __init dm355_init_video(struct vpfe_config *vpfe_cfg, 1058int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 384d3674dd9b..8aa004b02fe9 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1176,6 +1176,7 @@ void __init dm365_init(void)
1176{ 1176{
1177 davinci_common_init(&davinci_soc_info_dm365); 1177 davinci_common_init(&davinci_soc_info_dm365);
1178 davinci_map_sysmod(); 1178 davinci_map_sysmod();
1179 davinci_clk_init(davinci_soc_info_dm365.cpu_clks);
1179} 1180}
1180 1181
1181static struct resource dm365_vpss_resources[] = { 1182static struct resource dm365_vpss_resources[] = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index b4b3a8b9ca20..0afa279ec460 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -932,6 +932,7 @@ void __init dm644x_init(void)
932{ 932{
933 davinci_common_init(&davinci_soc_info_dm644x); 933 davinci_common_init(&davinci_soc_info_dm644x);
934 davinci_map_sysmod(); 934 davinci_map_sysmod();
935 davinci_clk_init(davinci_soc_info_dm644x.cpu_clks);
935} 936}
936 937
937int __init dm644x_init_video(struct vpfe_config *vpfe_cfg, 938int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index a43db0f5fbaa..da21353cac45 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -956,6 +956,7 @@ void __init dm646x_init(void)
956{ 956{
957 davinci_common_init(&davinci_soc_info_dm646x); 957 davinci_common_init(&davinci_soc_info_dm646x);
958 davinci_map_sysmod(); 958 davinci_map_sysmod();
959 davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
959} 960}
960 961
961static int __init dm646x_init_devices(void) 962static int __init dm646x_init_devices(void)