|
@@ -11,39 +11,45 @@
|
|
|
* is licensed "as is" without any warranty of any kind, whether express
|
|
|
* or implied.
|
|
|
*/
|
|
|
+
|
|
|
+#include <linux/clk-provider.h>
|
|
|
+#include <linux/clk/davinci.h>
|
|
|
#include <linux/clkdev.h>
|
|
|
+#include <linux/cpufreq.h>
|
|
|
#include <linux/gpio.h>
|
|
|
#include <linux/init.h>
|
|
|
-#include <linux/clk.h>
|
|
|
+#include <linux/mfd/da8xx-cfgchip.h>
|
|
|
+#include <linux/platform_data/clk-da8xx-cfgchip.h>
|
|
|
+#include <linux/platform_data/clk-davinci-pll.h>
|
|
|
+#include <linux/platform_data/gpio-davinci.h>
|
|
|
#include <linux/platform_device.h>
|
|
|
-#include <linux/cpufreq.h>
|
|
|
+#include <linux/regmap.h>
|
|
|
#include <linux/regulator/consumer.h>
|
|
|
-#include <linux/platform_data/gpio-davinci.h>
|
|
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
|
-#include "psc.h"
|
|
|
-#include <mach/irqs.h>
|
|
|
-#include <mach/cputype.h>
|
|
|
#include <mach/common.h>
|
|
|
-#include <mach/time.h>
|
|
|
-#include <mach/da8xx.h>
|
|
|
#include <mach/cpufreq.h>
|
|
|
+#include <mach/cputype.h>
|
|
|
+#include <mach/da8xx.h>
|
|
|
+#include <mach/irqs.h>
|
|
|
#include <mach/pm.h>
|
|
|
+#include <mach/time.h>
|
|
|
|
|
|
-#include "clock.h"
|
|
|
#include "mux.h"
|
|
|
|
|
|
+#ifndef CONFIG_COMMON_CLK
|
|
|
+#include "clock.h"
|
|
|
+#include "psc.h"
|
|
|
+#endif
|
|
|
+
|
|
|
#define DA850_PLL1_BASE 0x01e1a000
|
|
|
#define DA850_TIMER64P2_BASE 0x01f0c000
|
|
|
#define DA850_TIMER64P3_BASE 0x01f0d000
|
|
|
|
|
|
#define DA850_REF_FREQ 24000000
|
|
|
|
|
|
-#define CFGCHIP3_ASYNC3_CLKSRC BIT(4)
|
|
|
-#define CFGCHIP3_PLL1_MASTER_LOCK BIT(5)
|
|
|
-#define CFGCHIP0_PLL_MASTER_LOCK BIT(4)
|
|
|
-
|
|
|
+#ifndef CONFIG_COMMON_CLK
|
|
|
static int da850_set_armrate(struct clk *clk, unsigned long rate);
|
|
|
static int da850_round_armrate(struct clk *clk, unsigned long rate);
|
|
|
static int da850_set_pll0rate(struct clk *clk, unsigned long armrate);
|
|
@@ -583,6 +589,7 @@ static struct clk_lookup da850_clks[] = {
|
|
|
CLK("ecap.2", "fck", &ecap2_clk),
|
|
|
CLK(NULL, NULL, NULL),
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
/*
|
|
|
* Device specific mux setup
|
|
@@ -1170,6 +1177,7 @@ int da850_register_cpufreq(char *async_clk)
|
|
|
return platform_device_register(&da850_cpufreq_device);
|
|
|
}
|
|
|
|
|
|
+#ifndef CONFIG_COMMON_CLK
|
|
|
static int da850_round_armrate(struct clk *clk, unsigned long rate)
|
|
|
{
|
|
|
int ret = 0, diff;
|
|
@@ -1232,12 +1240,14 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long rate)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
+#endif /* CONFIG_COMMON_CLK */
|
|
|
#else
|
|
|
int __init da850_register_cpufreq(char *async_clk)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+#ifndef CONFIG_COMMON_CLK
|
|
|
static int da850_set_armrate(struct clk *clk, unsigned long rate)
|
|
|
{
|
|
|
return -EINVAL;
|
|
@@ -1252,6 +1262,7 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
|
|
|
{
|
|
|
return clk->rate;
|
|
|
}
|
|
|
+#endif /* CONFIG_COMMON_CLK */
|
|
|
#endif
|
|
|
|
|
|
/* VPIF resource, platform data */
|
|
@@ -1395,6 +1406,124 @@ void __init da850_init(void)
|
|
|
|
|
|
void __init da850_init_time(void)
|
|
|
{
|
|
|
+#ifdef CONFIG_COMMON_CLK
|
|
|
+ void __iomem *pll0;
|
|
|
+ struct regmap *cfgchip;
|
|
|
+ struct clk *clk;
|
|
|
+
|
|
|
+ clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA850_REF_FREQ);
|
|
|
+
|
|
|
+ pll0 = ioremap(DA8XX_PLL0_BASE, SZ_4K);
|
|
|
+ cfgchip = da8xx_get_cfgchip();
|
|
|
+
|
|
|
+ da850_pll0_init(NULL, pll0, cfgchip);
|
|
|
+
|
|
|
+ clk = clk_get(NULL, "timer0");
|
|
|
+
|
|
|
+ davinci_timer_init(clk);
|
|
|
+#else
|
|
|
davinci_clk_init(da850_clks);
|
|
|
davinci_timer_init(&timerp64_0_clk);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+static struct resource da850_pll1_resources[] = {
|
|
|
+ {
|
|
|
+ .start = DA850_PLL1_BASE,
|
|
|
+ .end = DA850_PLL1_BASE + SZ_4K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct davinci_pll_platform_data da850_pll1_pdata;
|
|
|
+
|
|
|
+static struct platform_device da850_pll1_device = {
|
|
|
+ .name = "da850-pll1",
|
|
|
+ .id = -1,
|
|
|
+ .resource = da850_pll1_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(da850_pll1_resources),
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &da850_pll1_pdata,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct resource da850_psc0_resources[] = {
|
|
|
+ {
|
|
|
+ .start = DA8XX_PSC0_BASE,
|
|
|
+ .end = DA8XX_PSC0_BASE + SZ_4K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device da850_psc0_device = {
|
|
|
+ .name = "da850-psc0",
|
|
|
+ .id = -1,
|
|
|
+ .resource = da850_psc0_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(da850_psc0_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static struct resource da850_psc1_resources[] = {
|
|
|
+ {
|
|
|
+ .start = DA8XX_PSC1_BASE,
|
|
|
+ .end = DA8XX_PSC1_BASE + SZ_4K - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device da850_psc1_device = {
|
|
|
+ .name = "da850-psc1",
|
|
|
+ .id = -1,
|
|
|
+ .resource = da850_psc1_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(da850_psc1_resources),
|
|
|
+};
|
|
|
+
|
|
|
+static struct da8xx_cfgchip_clk_platform_data da850_async1_pdata;
|
|
|
+
|
|
|
+static struct platform_device da850_async1_clksrc_device = {
|
|
|
+ .name = "da850-async1-clksrc",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &da850_async1_pdata,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct da8xx_cfgchip_clk_platform_data da850_async3_pdata;
|
|
|
+
|
|
|
+static struct platform_device da850_async3_clksrc_device = {
|
|
|
+ .name = "da850-async3-clksrc",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &da850_async3_pdata,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct da8xx_cfgchip_clk_platform_data da850_tbclksync_pdata;
|
|
|
+
|
|
|
+static struct platform_device da850_tbclksync_device = {
|
|
|
+ .name = "da830-tbclksync",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &da850_tbclksync_pdata,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+void __init da850_register_clocks(void)
|
|
|
+{
|
|
|
+ /* PLL0 is registered in da850_init_time() */
|
|
|
+
|
|
|
+ da850_pll1_pdata.cfgchip = da8xx_get_cfgchip();
|
|
|
+ platform_device_register(&da850_pll1_device);
|
|
|
+
|
|
|
+ da850_async1_pdata.cfgchip = da8xx_get_cfgchip();
|
|
|
+ platform_device_register(&da850_async1_clksrc_device);
|
|
|
+
|
|
|
+ da850_async3_pdata.cfgchip = da8xx_get_cfgchip();
|
|
|
+ platform_device_register(&da850_async3_clksrc_device);
|
|
|
+
|
|
|
+ platform_device_register(&da850_psc0_device);
|
|
|
+
|
|
|
+ platform_device_register(&da850_psc1_device);
|
|
|
+
|
|
|
+ da850_tbclksync_pdata.cfgchip = da8xx_get_cfgchip();
|
|
|
+ platform_device_register(&da850_tbclksync_device);
|
|
|
}
|