Commit 97114f39 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'imx-clk-common-fixes' of git://git.pengutronix.de/git/imx/linux-2.6 into fixes

From Sascha Hauer: "Some fixes for the fresh i.MX common clock support"

Resolved trivial conflict in arch/arm/plat-mxc/include/mach/common.h.

* tag 'imx-clk-common-fixes' of git://git.pengutronix.de/git/imx/linux-2.6:
  ARM: imx6q: prepare and enable init on clks directly instead of clk_get first
  ARM i.MX: remove now unnecessary argument from mxc_timer_init
  ARM: i.MX: change timer clock from ipg to perclk
  ARM i.MX5: fix gpt peripheral clock path
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents f8f5701b b0286f20
...@@ -108,8 +108,7 @@ int __init mx1_clocks_init(unsigned long fref) ...@@ -108,8 +108,7 @@ int __init mx1_clocks_init(unsigned long fref)
clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0"); clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0");
clk_register_clkdev(clk[clko], "clko", NULL); clk_register_clkdev(clk[clko], "clko", NULL);
mxc_timer_init(NULL, MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
MX1_TIM1_INT);
return 0; return 0;
} }
...@@ -180,7 +180,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href) ...@@ -180,7 +180,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
clk_register_clkdev(clk[sdhc1_ipg_gate], "sdhc1", NULL); clk_register_clkdev(clk[sdhc1_ipg_gate], "sdhc1", NULL);
clk_register_clkdev(clk[sdhc2_ipg_gate], "sdhc2", NULL); clk_register_clkdev(clk[sdhc2_ipg_gate], "sdhc2", NULL);
mxc_timer_init(NULL, MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), mxc_timer_init(MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), MX21_INT_GPT1);
MX21_INT_GPT1);
return 0; return 0;
} }
...@@ -243,6 +243,6 @@ int __init mx25_clocks_init(void) ...@@ -243,6 +243,6 @@ int __init mx25_clocks_init(void)
clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma");
clk_register_clkdev(clk[iim_ipg], "iim", NULL); clk_register_clkdev(clk[iim_ipg], "iim", NULL);
mxc_timer_init(NULL, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
return 0; return 0;
} }
...@@ -263,8 +263,7 @@ int __init mx27_clocks_init(unsigned long fref) ...@@ -263,8 +263,7 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[ssi1_baud_gate], "bitrate" , "imx-ssi.0"); clk_register_clkdev(clk[ssi1_baud_gate], "bitrate" , "imx-ssi.0");
clk_register_clkdev(clk[ssi2_baud_gate], "bitrate" , "imx-ssi.1"); clk_register_clkdev(clk[ssi2_baud_gate], "bitrate" , "imx-ssi.1");
mxc_timer_init(NULL, MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
MX27_INT_GPT1);
clk_prepare_enable(clk[emi_ahb_gate]); clk_prepare_enable(clk[emi_ahb_gate]);
......
...@@ -175,8 +175,7 @@ int __init mx31_clocks_init(unsigned long fref) ...@@ -175,8 +175,7 @@ int __init mx31_clocks_init(unsigned long fref)
mx31_revision(); mx31_revision();
clk_disable_unprepare(clk[iim_gate]); clk_disable_unprepare(clk[iim_gate]);
mxc_timer_init(NULL, MX31_IO_ADDRESS(MX31_GPT1_BASE_ADDR), mxc_timer_init(MX31_IO_ADDRESS(MX31_GPT1_BASE_ADDR), MX31_INT_GPT);
MX31_INT_GPT);
return 0; return 0;
} }
...@@ -267,11 +267,9 @@ int __init mx35_clocks_init() ...@@ -267,11 +267,9 @@ int __init mx35_clocks_init()
imx_print_silicon_rev("i.MX35", mx35_revision()); imx_print_silicon_rev("i.MX35", mx35_revision());
#ifdef CONFIG_MXC_USE_EPIT #ifdef CONFIG_MXC_USE_EPIT
epit_timer_init(&epit1_clk, epit_timer_init(MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
#else #else
mxc_timer_init(NULL, MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), mxc_timer_init(MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT);
MX35_INT_GPT);
#endif #endif
return 0; return 0;
......
...@@ -104,12 +104,12 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, ...@@ -104,12 +104,12 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
periph_apm_sel, ARRAY_SIZE(periph_apm_sel)); periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1, clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
main_bus_sel, ARRAY_SIZE(main_bus_sel)); main_bus_sel, ARRAY_SIZE(main_bus_sel));
clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCDR, 1, 1, clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel)); per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2); clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3); clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3);
clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3); clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3);
clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCDR, 1, 0, clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1,
per_root_sel, ARRAY_SIZE(per_root_sel)); per_root_sel, ARRAY_SIZE(per_root_sel));
clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3); clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3);
clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28); clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28);
...@@ -172,7 +172,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, ...@@ -172,7 +172,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "ipg", MXC_CCM_CCGR2, 12); clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "ipg", MXC_CCM_CCGR2, 12);
clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14); clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14);
clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "ipg", MXC_CCM_CCGR2, 16); clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "ipg", MXC_CCM_CCGR2, 16);
clk[gpt_gate] = imx_clk_gate2("gpt_gate", "ipg", MXC_CCM_CCGR2, 18); clk[gpt_gate] = imx_clk_gate2("gpt_gate", "per_root", MXC_CCM_CCGR2, 18);
clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24); clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24);
clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26); clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26);
clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28); clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28);
...@@ -366,8 +366,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, ...@@ -366,8 +366,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
clk_set_rate(clk[esdhc_b_podf], 166250000); clk_set_rate(clk[esdhc_b_podf], 166250000);
/* System timer */ /* System timer */
mxc_timer_init(NULL, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT);
MX51_INT_GPT);
clk_prepare_enable(clk[iim_gate]); clk_prepare_enable(clk[iim_gate]);
imx_print_silicon_rev("i.MX51", mx51_revision()); imx_print_silicon_rev("i.MX51", mx51_revision());
...@@ -452,8 +451,7 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, ...@@ -452,8 +451,7 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
clk_set_rate(clk[esdhc_b_podf], 200000000); clk_set_rate(clk[esdhc_b_podf], 200000000);
/* System timer */ /* System timer */
mxc_timer_init(NULL, MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), mxc_timer_init(MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), MX53_INT_GPT);
MX53_INT_GPT);
clk_prepare_enable(clk[iim_gate]); clk_prepare_enable(clk[iim_gate]);
imx_print_silicon_rev("i.MX53", mx53_revision()); imx_print_silicon_rev("i.MX53", mx53_revision());
......
...@@ -122,10 +122,6 @@ static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5 ...@@ -122,10 +122,6 @@ static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5
"dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0", "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0",
"ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio", }; "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio", };
static const char * const clks_init_on[] __initconst = {
"mmdc_ch0_axi", "mmdc_ch1_axi", "usboh3",
};
enum mx6q_clks { enum mx6q_clks {
dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m,
pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m, pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m,
...@@ -161,11 +157,14 @@ enum mx6q_clks { ...@@ -161,11 +157,14 @@ enum mx6q_clks {
static struct clk *clk[clk_max]; static struct clk *clk[clk_max];
static enum mx6q_clks const clks_init_on[] __initconst = {
mmdc_ch0_axi, mmdc_ch1_axi,
};
int __init mx6q_clocks_init(void) int __init mx6q_clocks_init(void)
{ {
struct device_node *np; struct device_node *np;
void __iomem *base; void __iomem *base;
struct clk *c;
int i, irq; int i, irq;
clk[dummy] = imx_clk_fixed("dummy", 0); clk[dummy] = imx_clk_fixed("dummy", 0);
...@@ -424,21 +423,14 @@ int __init mx6q_clocks_init(void) ...@@ -424,21 +423,14 @@ int __init mx6q_clocks_init(void)
clk_register_clkdev(clk[ahb], "ahb", NULL); clk_register_clkdev(clk[ahb], "ahb", NULL);
clk_register_clkdev(clk[cko1], "cko1", NULL); clk_register_clkdev(clk[cko1], "cko1", NULL);
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) { for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
c = clk_get_sys(clks_init_on[i], NULL); clk_prepare_enable(clk[clks_init_on[i]]);
if (IS_ERR(c)) {
pr_err("%s: failed to get clk %s", __func__,
clks_init_on[i]);
return PTR_ERR(c);
}
clk_prepare_enable(c);
}
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");
base = of_iomap(np, 0); base = of_iomap(np, 0);
WARN_ON(!base); WARN_ON(!base);
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
mxc_timer_init(NULL, base, irq); mxc_timer_init(base, irq);
return 0; return 0;
} }
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -201,8 +202,16 @@ static int __init epit_clockevent_init(struct clk *timer_clk) ...@@ -201,8 +202,16 @@ static int __init epit_clockevent_init(struct clk *timer_clk)
return 0; return 0;
} }
void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) void __init epit_timer_init(void __iomem *base, int irq)
{ {
struct clk *timer_clk;
timer_clk = clk_get_sys("imx-epit.0", NULL);
if (IS_ERR(timer_clk)) {
pr_err("i.MX epit: unable to get clk\n");
return;
}
clk_prepare_enable(timer_clk); clk_prepare_enable(timer_clk);
timer_base = base; timer_base = base;
......
...@@ -54,8 +54,8 @@ extern void imx50_soc_init(void); ...@@ -54,8 +54,8 @@ extern void imx50_soc_init(void);
extern void imx51_soc_init(void); extern void imx51_soc_init(void);
extern void imx53_soc_init(void); extern void imx53_soc_init(void);
extern void imx51_init_late(void); extern void imx51_init_late(void);
extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); extern void epit_timer_init(void __iomem *base, int irq);
extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); extern void mxc_timer_init(void __iomem *, int);
extern int mx1_clocks_init(unsigned long fref); extern int mx1_clocks_init(unsigned long fref);
extern int mx21_clocks_init(unsigned long lref, unsigned long fref); extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
extern int mx25_clocks_init(void); extern int mx25_clocks_init(void);
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
/* MX31, MX35, MX25, MX5 */ /* MX31, MX35, MX25, MX5 */
#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */ #define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */
#define V2_TCTL_CLK_IPG (1 << 6) #define V2_TCTL_CLK_IPG (1 << 6)
#define V2_TCTL_CLK_PER (2 << 6)
#define V2_TCTL_FRR (1 << 9) #define V2_TCTL_FRR (1 << 9)
#define V2_IR 0x0c #define V2_IR 0x0c
#define V2_TSTAT 0x08 #define V2_TSTAT 0x08
...@@ -280,12 +281,12 @@ static int __init mxc_clockevent_init(struct clk *timer_clk) ...@@ -280,12 +281,12 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
return 0; return 0;
} }
void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) void __init mxc_timer_init(void __iomem *base, int irq)
{ {
uint32_t tctl_val; uint32_t tctl_val;
struct clk *timer_clk;
struct clk *timer_ipg_clk; struct clk *timer_ipg_clk;
if (!timer_clk) {
timer_clk = clk_get_sys("imx-gpt.0", "per"); timer_clk = clk_get_sys("imx-gpt.0", "per");
if (IS_ERR(timer_clk)) { if (IS_ERR(timer_clk)) {
pr_err("i.MX timer: unable to get clk\n"); pr_err("i.MX timer: unable to get clk\n");
...@@ -295,7 +296,6 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) ...@@ -295,7 +296,6 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg"); timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg");
if (!IS_ERR(timer_ipg_clk)) if (!IS_ERR(timer_ipg_clk))
clk_prepare_enable(timer_ipg_clk); clk_prepare_enable(timer_ipg_clk);
}
clk_prepare_enable(timer_clk); clk_prepare_enable(timer_clk);
...@@ -309,7 +309,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) ...@@ -309,7 +309,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
__raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */
if (timer_is_v2()) if (timer_is_v2())
tctl_val = V2_TCTL_CLK_IPG | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; tctl_val = V2_TCTL_CLK_PER | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN;
else else
tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment