aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-05-07 17:06:36 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-05-13 13:05:27 -0400
commite4c822c7e98cdda78b10a696b030fc20b22dcab4 (patch)
tree95a1ec13b404369fbc5104aed64adf29a8f78709
parent1bcd38ad2de4c1cd30387c588dfb28d637d4111d (diff)
Davinci: psc - use ioremap()
This patch modifies the psc and clock control code to use ioremap()ed registers. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-davinci/clock.c14
-rw-r--r--arch/arm/mach-davinci/da830.c5
-rw-r--r--arch/arm/mach-davinci/da850.c5
-rw-r--r--arch/arm/mach-davinci/dm355.c4
-rw-r--r--arch/arm/mach-davinci/dm365.c4
-rw-r--r--arch/arm/mach-davinci/dm644x.c4
-rw-r--r--arch/arm/mach-davinci/dm646x.c4
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h2
-rw-r--r--arch/arm/mach-davinci/psc.c7
9 files changed, 23 insertions, 26 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 868cb7693499..054c303caead 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -302,7 +302,6 @@ static unsigned long clk_pllclk_recalc(struct clk *clk)
302 struct pll_data *pll = clk->pll_data; 302 struct pll_data *pll = clk->pll_data;
303 unsigned long rate = clk->rate; 303 unsigned long rate = clk->rate;
304 304
305 pll->base = IO_ADDRESS(pll->phys_base);
306 ctrl = __raw_readl(pll->base + PLLCTL); 305 ctrl = __raw_readl(pll->base + PLLCTL);
307 rate = pll->input_rate = clk->parent->rate; 306 rate = pll->input_rate = clk->parent->rate;
308 307
@@ -458,8 +457,17 @@ int __init davinci_clk_init(struct clk_lookup *clocks)
458 clk->recalc = clk_leafclk_recalc; 457 clk->recalc = clk_leafclk_recalc;
459 } 458 }
460 459
461 if (clk->pll_data && !clk->pll_data->div_ratio_mask) 460 if (clk->pll_data) {
462 clk->pll_data->div_ratio_mask = PLLDIV_RATIO_MASK; 461 struct pll_data *pll = clk->pll_data;
462
463 if (!pll->div_ratio_mask)
464 pll->div_ratio_mask = PLLDIV_RATIO_MASK;
465
466 if (pll->phys_base && !pll->base) {
467 pll->base = ioremap(pll->phys_base, SZ_4K);
468 WARN_ON(!pll->base);
469 }
470 }
463 471
464 if (clk->recalc) 472 if (clk->recalc)
465 clk->rate = clk->recalc(clk); 473 clk->rate = clk->recalc(clk);
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 8a2510c5236f..47a7f490cf6a 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1127,10 +1127,7 @@ static struct map_desc da830_io_desc[] = {
1127 }, 1127 },
1128}; 1128};
1129 1129
1130static void __iomem *da830_psc_bases[] = { 1130static u32 da830_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
1131 IO_ADDRESS(DA8XX_PSC0_BASE),
1132 IO_ADDRESS(DA8XX_PSC1_BASE),
1133};
1134 1131
1135/* Contents of JTAG ID register used to identify exact cpu type */ 1132/* Contents of JTAG ID register used to identify exact cpu type */
1136static struct davinci_id da830_ids[] = { 1133static struct davinci_id da830_ids[] = {
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index ebfa5ca29a81..2a430bbbd393 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -782,10 +782,7 @@ static struct map_desc da850_io_desc[] = {
782 }, 782 },
783}; 783};
784 784
785static void __iomem *da850_psc_bases[] = { 785static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
786 IO_ADDRESS(DA8XX_PSC0_BASE),
787 IO_ADDRESS(DA8XX_PSC1_BASE),
788};
789 786
790/* Contents of JTAG ID register used to identify exact cpu type */ 787/* Contents of JTAG ID register used to identify exact cpu type */
791static struct davinci_id da850_ids[] = { 788static struct davinci_id da850_ids[] = {
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 228b6d1460e5..70a18275c5da 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -783,9 +783,7 @@ static struct davinci_id dm355_ids[] = {
783 }, 783 },
784}; 784};
785 785
786static void __iomem *dm355_psc_bases[] = { 786static u32 dm355_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE };
787 IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
788};
789 787
790/* 788/*
791 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 789 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index b396d58f130a..451a4efb7ddf 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1002,9 +1002,7 @@ static struct davinci_id dm365_ids[] = {
1002 }, 1002 },
1003}; 1003};
1004 1004
1005static void __iomem *dm365_psc_bases[] = { 1005static u32 dm365_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE };
1006 IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
1007};
1008 1006
1009static struct davinci_timer_info dm365_timer_info = { 1007static struct davinci_timer_info dm365_timer_info = {
1010 .timers = davinci_timer_instance, 1008 .timers = davinci_timer_instance,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 9859567788c9..ee654de38f34 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -674,9 +674,7 @@ static struct davinci_id dm644x_ids[] = {
674 }, 674 },
675}; 675};
676 676
677static void __iomem *dm644x_psc_bases[] = { 677static u32 dm644x_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE };
678 IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
679};
680 678
681/* 679/*
682 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 680 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index f9a8cc46eafd..4c98ef003c47 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -758,9 +758,7 @@ static struct davinci_id dm646x_ids[] = {
758 }, 758 },
759}; 759};
760 760
761static void __iomem *dm646x_psc_bases[] = { 761static u32 dm646x_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE };
762 IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE),
763};
764 762
765/* 763/*
766 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 764 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 2e1546401397..4c8dfcb4d930 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -49,7 +49,7 @@ struct davinci_soc_info {
49 struct davinci_id *ids; 49 struct davinci_id *ids;
50 unsigned long ids_num; 50 unsigned long ids_num;
51 struct clk_lookup *cpu_clks; 51 struct clk_lookup *cpu_clks;
52 void __iomem **psc_bases; 52 u32 *psc_bases;
53 unsigned long psc_bases_num; 53 unsigned long psc_bases_num;
54 void __iomem *pinmux_base; 54 void __iomem *pinmux_base;
55 const struct mux_config *pinmux_pins; 55 const struct mux_config *pinmux_pins;
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index d7cb438c4df6..1b15dbd0a77b 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -38,8 +38,9 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id)
38 return 0; 38 return 0;
39 } 39 }
40 40
41 psc_base = soc_info->psc_bases[ctlr]; 41 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K);
42 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 42 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
43 iounmap(psc_base);
43 44
44 /* if clocked, state can be "Enable" or "SyncReset" */ 45 /* if clocked, state can be "Enable" or "SyncReset" */
45 return mdstat & BIT(12); 46 return mdstat & BIT(12);
@@ -59,7 +60,7 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
59 return; 60 return;
60 } 61 }
61 62
62 psc_base = soc_info->psc_bases[ctlr]; 63 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K);
63 64
64 mdctl = __raw_readl(psc_base + MDCTL + 4 * id); 65 mdctl = __raw_readl(psc_base + MDCTL + 4 * id);
65 mdctl &= ~MDSTAT_STATE_MASK; 66 mdctl &= ~MDSTAT_STATE_MASK;
@@ -99,4 +100,6 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
99 do { 100 do {
100 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 101 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
101 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); 102 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state));
103
104 iounmap(psc_base);
102} 105}