aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-02-25 17:10:38 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-25 17:10:38 -0500
commit9f33be2c3a80bdc2cc08342dd77fac87652e0548 (patch)
tree7ad6e825427a15c5ec0fc15540abc0429d7f4bce /arch/arm
parent2741ecb4ce5c2d430b5c44b0a169038338c21df5 (diff)
parenteed18b5fa4d297c681b00144e8c6942dd35d39a7 (diff)
Merge branches 'clks' and 'pnx' into devel
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/common/clkdev.c10
-rw-r--r--arch/arm/include/asm/cacheflush.h20
-rw-r--r--arch/arm/include/asm/clkdev.h3
-rw-r--r--arch/arm/mach-bcmring/core.c3
-rw-r--r--arch/arm/mach-ep93xx/clock.c4
-rw-r--r--arch/arm/mach-integrator/core.c3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c4
-rw-r--r--arch/arm/mach-mmp/clock.c8
-rw-r--r--arch/arm/mach-mmp/clock.h2
-rw-r--r--arch/arm/mach-mmp/pxa168.c2
-rw-r--r--arch/arm/mach-mmp/pxa910.c2
-rw-r--r--arch/arm/mach-mx1/clock.c4
-rw-r--r--arch/arm/mach-mx2/clock_imx21.c4
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c4
-rw-r--r--arch/arm/mach-mx25/clock.c6
-rw-r--r--arch/arm/mach-mx3/clock-imx35.c4
-rw-r--r--arch/arm/mach-mx3/clock.c4
-rw-r--r--arch/arm/mach-mxc91231/clock.c4
-rw-r--r--arch/arm/mach-pnx4008/clock.c173
-rw-r--r--arch/arm/mach-pnx4008/clock.h6
-rw-r--r--arch/arm/mach-pnx4008/i2c.c108
-rw-r--r--arch/arm/mach-pnx4008/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-pnx4008/include/mach/timex.h54
-rw-r--r--arch/arm/mach-pnx4008/pm.c2
-rw-r--r--arch/arm/mach-pnx4008/time.c2
-rw-r--r--arch/arm/mach-pnx4008/time.h70
-rw-r--r--arch/arm/mach-pxa/clock.c8
-rw-r--r--arch/arm/mach-pxa/clock.h4
-rw-r--r--arch/arm/mach-pxa/eseries.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c4
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa300.c4
-rw-r--r--arch/arm/mach-pxa/pxa320.c2
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-realview/core.c5
-rw-r--r--arch/arm/mach-u300/clock.c5
-rw-r--r--arch/arm/mach-ux500/clock.c5
-rw-r--r--arch/arm/mach-versatile/core.c3
-rw-r--r--arch/arm/mach-w90x900/clock.c9
-rw-r--r--arch/arm/mach-w90x900/clock.h1
-rw-r--r--arch/arm/mach-w90x900/cpu.c2
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7.S11
-rw-r--r--arch/arm/plat-stmp3xxx/clock.c3
46 files changed, 249 insertions, 341 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e932da033499..e4a765438ee3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -574,6 +574,7 @@ config ARCH_PNX4008
574 bool "Philips Nexperia PNX4008 Mobile" 574 bool "Philips Nexperia PNX4008 Mobile"
575 select CPU_ARM926T 575 select CPU_ARM926T
576 select HAVE_CLK 576 select HAVE_CLK
577 select COMMON_CLKDEV
577 help 578 help
578 This enables support for Philips PNX4008 mobile platform. 579 This enables support for Philips PNX4008 mobile platform.
579 580
diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
index aae5bc01acc8..446b696196e3 100644
--- a/arch/arm/common/clkdev.c
+++ b/arch/arm/common/clkdev.c
@@ -99,6 +99,16 @@ void clkdev_add(struct clk_lookup *cl)
99} 99}
100EXPORT_SYMBOL(clkdev_add); 100EXPORT_SYMBOL(clkdev_add);
101 101
102void __init clkdev_add_table(struct clk_lookup *cl, size_t num)
103{
104 mutex_lock(&clocks_mutex);
105 while (num--) {
106 list_add_tail(&cl->node, &clocks);
107 cl++;
108 }
109 mutex_unlock(&clocks_mutex);
110}
111
102#define MAX_DEV_ID 20 112#define MAX_DEV_ID 20
103#define MAX_CON_ID 16 113#define MAX_CON_ID 16
104 114
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index be8b4d79cf41..8148a009273a 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -154,16 +154,16 @@
154 * Please note that the implementation of these, and the required 154 * Please note that the implementation of these, and the required
155 * effects are cache-type (VIVT/VIPT/PIPT) specific. 155 * effects are cache-type (VIVT/VIPT/PIPT) specific.
156 * 156 *
157 * flush_cache_kern_all() 157 * flush_kern_all()
158 * 158 *
159 * Unconditionally clean and invalidate the entire cache. 159 * Unconditionally clean and invalidate the entire cache.
160 * 160 *
161 * flush_cache_user_mm(mm) 161 * flush_user_all()
162 * 162 *
163 * Clean and invalidate all user space cache entries 163 * Clean and invalidate all user space cache entries
164 * before a change of page tables. 164 * before a change of page tables.
165 * 165 *
166 * flush_cache_user_range(start, end, flags) 166 * flush_user_range(start, end, flags)
167 * 167 *
168 * Clean and invalidate a range of cache entries in the 168 * Clean and invalidate a range of cache entries in the
169 * specified address space before a change of page tables. 169 * specified address space before a change of page tables.
@@ -179,6 +179,20 @@
179 * - start - virtual start address 179 * - start - virtual start address
180 * - end - virtual end address 180 * - end - virtual end address
181 * 181 *
182 * coherent_user_range(start, end)
183 *
184 * Ensure coherency between the Icache and the Dcache in the
185 * region described by start, end. If you have non-snooping
186 * Harvard caches, you need to implement this function.
187 * - start - virtual start address
188 * - end - virtual end address
189 *
190 * flush_kern_dcache_area(kaddr, size)
191 *
192 * Ensure that the data held in page is written back.
193 * - kaddr - page address
194 * - size - region size
195 *
182 * DMA Cache Coherency 196 * DMA Cache Coherency
183 * =================== 197 * ===================
184 * 198 *
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index b6ec7c627b39..7a0690da5e63 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -27,4 +27,7 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
27void clkdev_add(struct clk_lookup *cl); 27void clkdev_add(struct clk_lookup *cl);
28void clkdev_drop(struct clk_lookup *cl); 28void clkdev_drop(struct clk_lookup *cl);
29 29
30void clkdev_add_table(struct clk_lookup *, size_t);
31int clk_add_alias(const char *, const char *, char *, struct device *);
32
30#endif 33#endif
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index e590bbe0a7b4..72e405df0fb0 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -142,8 +142,7 @@ void __init bcmring_amba_init(void)
142 142
143 chipcHw_busInterfaceClockEnable(bus_clock); 143 chipcHw_busInterfaceClockEnable(bus_clock);
144 144
145 for (i = 0; i < ARRAY_SIZE(lookups); i++) 145 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
146 clkdev_add(&lookups[i]);
147 146
148 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 147 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
149 struct amba_device *d = amba_devs[i]; 148 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 49fa9f8fef4a..5f80092b6ace 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -447,7 +447,6 @@ static void __init ep93xx_dma_clock_init(void)
447static int __init ep93xx_clock_init(void) 447static int __init ep93xx_clock_init(void)
448{ 448{
449 u32 value; 449 u32 value;
450 int i;
451 450
452 /* Determine the bootloader configured pll1 rate */ 451 /* Determine the bootloader configured pll1 rate */
453 value = __raw_readl(EP93XX_SYSCON_CLKSET1); 452 value = __raw_readl(EP93XX_SYSCON_CLKSET1);
@@ -480,8 +479,7 @@ static int __init ep93xx_clock_init(void)
480 clk_f.rate / 1000000, clk_h.rate / 1000000, 479 clk_f.rate / 1000000, clk_h.rate / 1000000,
481 clk_p.rate / 1000000); 480 clk_p.rate / 1000000);
482 481
483 for (i = 0; i < ARRAY_SIZE(clocks); i++) 482 clkdev_add_table(clocks, ARRAY_SIZE(clocks));
484 clkdev_add(&clocks[i]);
485 return 0; 483 return 0;
486} 484}
487arch_initcall(ep93xx_clock_init); 485arch_initcall(ep93xx_clock_init);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index a0f60e55da6a..8b390e36ba69 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -144,8 +144,7 @@ static int __init integrator_init(void)
144{ 144{
145 int i; 145 int i;
146 146
147 for (i = 0; i < ARRAY_SIZE(lookups); i++) 147 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
148 clkdev_add(&lookups[i]);
149 148
150 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 149 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
151 struct amba_device *d = amba_devs[i]; 150 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 3f35293d457a..66ef86d6d9e3 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -558,9 +558,7 @@ static void __init intcp_init(void)
558{ 558{
559 int i; 559 int i;
560 560
561 for (i = 0; i < ARRAY_SIZE(cp_lookups); i++) 561 clkdev_add_table(cp_lookups, ARRAY_SIZE(cp_lookups));
562 clkdev_add(&cp_lookups[i]);
563
564 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); 562 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
565 563
566 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 564 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 2a46ed5cc2a2..886e05648f08 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -88,11 +88,3 @@ unsigned long clk_get_rate(struct clk *clk)
88 return rate; 88 return rate;
89} 89}
90EXPORT_SYMBOL(clk_get_rate); 90EXPORT_SYMBOL(clk_get_rate);
91
92void clks_register(struct clk_lookup *clks, size_t num)
93{
94 int i;
95
96 for (i = 0; i < num; i++)
97 clkdev_add(&clks[i]);
98}
diff --git a/arch/arm/mach-mmp/clock.h b/arch/arm/mach-mmp/clock.h
index eefffbe683b0..016ae94691c0 100644
--- a/arch/arm/mach-mmp/clock.h
+++ b/arch/arm/mach-mmp/clock.h
@@ -68,5 +68,3 @@ struct clk clk_##_name = { \
68 68
69extern struct clk clk_pxa168_gpio; 69extern struct clk clk_pxa168_gpio;
70extern struct clk clk_pxa168_timers; 70extern struct clk clk_pxa168_timers;
71
72extern void clks_register(struct clk_lookup *, size_t);
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 37dbdde17fac..1873c821df90 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -94,7 +94,7 @@ static int __init pxa168_init(void)
94 mfp_init_base(MFPR_VIRT_BASE); 94 mfp_init_base(MFPR_VIRT_BASE);
95 mfp_init_addr(pxa168_mfp_addr_map); 95 mfp_init_addr(pxa168_mfp_addr_map);
96 pxa_init_dma(IRQ_PXA168_DMA_INT0, 32); 96 pxa_init_dma(IRQ_PXA168_DMA_INT0, 32);
97 clks_register(ARRAY_AND_SIZE(pxa168_clkregs)); 97 clkdev_add_table(ARRAY_AND_SIZE(pxa168_clkregs));
98 } 98 }
99 99
100 return 0; 100 return 0;
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index d4049508a4df..46f2d69bef3c 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -131,7 +131,7 @@ static int __init pxa910_init(void)
131 mfp_init_base(MFPR_VIRT_BASE); 131 mfp_init_base(MFPR_VIRT_BASE);
132 mfp_init_addr(pxa910_mfp_addr_map); 132 mfp_init_addr(pxa910_mfp_addr_map);
133 pxa_init_dma(IRQ_PXA910_DMA_INT0, 32); 133 pxa_init_dma(IRQ_PXA910_DMA_INT0, 32);
134 clks_register(ARRAY_AND_SIZE(pxa910_clkregs)); 134 clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs));
135 } 135 }
136 136
137 return 0; 137 return 0;
diff --git a/arch/arm/mach-mx1/clock.c b/arch/arm/mach-mx1/clock.c
index d1b588519ad2..6cf2d4a7511d 100644
--- a/arch/arm/mach-mx1/clock.c
+++ b/arch/arm/mach-mx1/clock.c
@@ -570,7 +570,6 @@ static struct clk_lookup lookups[] __initdata = {
570int __init mx1_clocks_init(unsigned long fref) 570int __init mx1_clocks_init(unsigned long fref)
571{ 571{
572 unsigned int reg; 572 unsigned int reg;
573 int i;
574 573
575 /* disable clocks we are able to */ 574 /* disable clocks we are able to */
576 __raw_writel(0, SCM_GCCR); 575 __raw_writel(0, SCM_GCCR);
@@ -592,8 +591,7 @@ int __init mx1_clocks_init(unsigned long fref)
592 reg = (reg & CCM_CSCR_CLKO_MASK) >> CCM_CSCR_CLKO_OFFSET; 591 reg = (reg & CCM_CSCR_CLKO_MASK) >> CCM_CSCR_CLKO_OFFSET;
593 clko_clk.parent = (struct clk *)clko_clocks[reg]; 592 clko_clk.parent = (struct clk *)clko_clocks[reg];
594 593
595 for (i = 0; i < ARRAY_SIZE(lookups); i++) 594 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
596 clkdev_add(&lookups[i]);
597 595
598 clk_enable(&hclk); 596 clk_enable(&hclk);
599 clk_enable(&fclk); 597 clk_enable(&fclk);
diff --git a/arch/arm/mach-mx2/clock_imx21.c b/arch/arm/mach-mx2/clock_imx21.c
index 91901b5d56c2..e82b489d1215 100644
--- a/arch/arm/mach-mx2/clock_imx21.c
+++ b/arch/arm/mach-mx2/clock_imx21.c
@@ -968,7 +968,6 @@ static struct clk_lookup lookups[] = {
968 */ 968 */
969int __init mx21_clocks_init(unsigned long lref, unsigned long href) 969int __init mx21_clocks_init(unsigned long lref, unsigned long href)
970{ 970{
971 int i;
972 u32 cscr; 971 u32 cscr;
973 972
974 external_low_reference = lref; 973 external_low_reference = lref;
@@ -986,8 +985,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
986 else 985 else
987 spll_clk.parent = &fpm_clk; 986 spll_clk.parent = &fpm_clk;
988 987
989 for (i = 0; i < ARRAY_SIZE(lookups); i++) 988 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
990 clkdev_add(&lookups[i]);
991 989
992 /* Turn off all clock gates */ 990 /* Turn off all clock gates */
993 __raw_writel(0, CCM_PCCR0); 991 __raw_writel(0, CCM_PCCR0);
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index b010bf9ceaab..18c53a6487fa 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -719,7 +719,6 @@ static void __init to2_adjust_clocks(void)
719int __init mx27_clocks_init(unsigned long fref) 719int __init mx27_clocks_init(unsigned long fref)
720{ 720{
721 u32 cscr = __raw_readl(CCM_CSCR); 721 u32 cscr = __raw_readl(CCM_CSCR);
722 int i;
723 722
724 external_high_reference = fref; 723 external_high_reference = fref;
725 724
@@ -736,8 +735,7 @@ int __init mx27_clocks_init(unsigned long fref)
736 735
737 to2_adjust_clocks(); 736 to2_adjust_clocks();
738 737
739 for (i = 0; i < ARRAY_SIZE(lookups); i++) 738 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
740 clkdev_add(&lookups[i]);
741 739
742 /* Turn off all clocks we do not need */ 740 /* Turn off all clocks we do not need */
743 __raw_writel(0, CCM_PCCR0); 741 __raw_writel(0, CCM_PCCR0);
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index 6e838b857712..66916f104812 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -210,11 +210,7 @@ static struct clk_lookup lookups[] = {
210 210
211int __init mx25_clocks_init(unsigned long fref) 211int __init mx25_clocks_init(unsigned long fref)
212{ 212{
213 int i; 213 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
214
215 for (i = 0; i < ARRAY_SIZE(lookups); i++)
216 clkdev_add(&lookups[i]);
217
218 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); 214 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
219 215
220 return 0; 216 return 0;
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 7584b4c6c556..f3f41fa4f21b 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -485,15 +485,13 @@ static struct clk_lookup lookups[] = {
485 485
486int __init mx35_clocks_init() 486int __init mx35_clocks_init()
487{ 487{
488 int i;
489 unsigned int ll = 0; 488 unsigned int ll = 0;
490 489
491#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC) 490#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
492 ll = (3 << 16); 491 ll = (3 << 16);
493#endif 492#endif
494 493
495 for (i = 0; i < ARRAY_SIZE(lookups); i++) 494 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
496 clkdev_add(&lookups[i]);
497 495
498 /* Turn off all clocks except the ones we need to survive, namely: 496 /* Turn off all clocks except the ones we need to survive, namely:
499 * EMI, GPIO1/2/3, GPT, IOMUX, MAX and eventually uart 497 * EMI, GPIO1/2/3, GPT, IOMUX, MAX and eventually uart
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 27a318af0d20..b5c39a016db7 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -578,12 +578,10 @@ static struct clk_lookup lookups[] = {
578int __init mx31_clocks_init(unsigned long fref) 578int __init mx31_clocks_init(unsigned long fref)
579{ 579{
580 u32 reg; 580 u32 reg;
581 int i;
582 581
583 ckih_rate = fref; 582 ckih_rate = fref;
584 583
585 for (i = 0; i < ARRAY_SIZE(lookups); i++) 584 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
586 clkdev_add(&lookups[i]);
587 585
588 /* change the csi_clk parent if necessary */ 586 /* change the csi_clk parent if necessary */
589 reg = __raw_readl(MXC_CCM_CCMR); 587 reg = __raw_readl(MXC_CCM_CCMR);
diff --git a/arch/arm/mach-mxc91231/clock.c b/arch/arm/mach-mxc91231/clock.c
index ecfa37fef8ad..5c85075d8a56 100644
--- a/arch/arm/mach-mxc91231/clock.c
+++ b/arch/arm/mach-mxc91231/clock.c
@@ -624,7 +624,6 @@ static struct clk_lookup lookups[] = {
624int __init mxc91231_clocks_init(unsigned long fref) 624int __init mxc91231_clocks_init(unsigned long fref)
625{ 625{
626 void __iomem *gpt_base; 626 void __iomem *gpt_base;
627 int i;
628 627
629 ckih_rate = fref; 628 ckih_rate = fref;
630 629
@@ -632,8 +631,7 @@ int __init mxc91231_clocks_init(unsigned long fref)
632 sdhc_clk[0].parent = clk_sdhc_parent(&sdhc_clk[0]); 631 sdhc_clk[0].parent = clk_sdhc_parent(&sdhc_clk[0]);
633 sdhc_clk[1].parent = clk_sdhc_parent(&sdhc_clk[1]); 632 sdhc_clk[1].parent = clk_sdhc_parent(&sdhc_clk[1]);
634 633
635 for (i = 0; i < ARRAY_SIZE(lookups); i++) 634 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
636 clkdev_add(&lookups[i]);
637 635
638 gpt_base = MXC91231_IO_ADDRESS(MXC91231_GPT1_BASE_ADDR); 636 gpt_base = MXC91231_IO_ADDRESS(MXC91231_GPT1_BASE_ADDR);
639 mxc_timer_init(&gpt_clk, gpt_base, MXC91231_INT_GPT); 637 mxc_timer_init(&gpt_clk, gpt_base, MXC91231_INT_GPT);
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index 898c0e88acbc..9d1975fa4d9f 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -22,8 +22,9 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <mach/hardware.h> 25#include <asm/clkdev.h>
26 26
27#include <mach/hardware.h>
27#include <mach/clock.h> 28#include <mach/clock.h>
28#include "clock.h" 29#include "clock.h"
29 30
@@ -56,18 +57,19 @@ static void propagate_rate(struct clk *clk)
56 } 57 }
57} 58}
58 59
59static inline void clk_reg_disable(struct clk *clk) 60static void clk_reg_disable(struct clk *clk)
60{ 61{
61 if (clk->enable_reg) 62 if (clk->enable_reg)
62 __raw_writel(__raw_readl(clk->enable_reg) & 63 __raw_writel(__raw_readl(clk->enable_reg) &
63 ~(1 << clk->enable_shift), clk->enable_reg); 64 ~(1 << clk->enable_shift), clk->enable_reg);
64} 65}
65 66
66static inline void clk_reg_enable(struct clk *clk) 67static int clk_reg_enable(struct clk *clk)
67{ 68{
68 if (clk->enable_reg) 69 if (clk->enable_reg)
69 __raw_writel(__raw_readl(clk->enable_reg) | 70 __raw_writel(__raw_readl(clk->enable_reg) |
70 (1 << clk->enable_shift), clk->enable_reg); 71 (1 << clk->enable_shift), clk->enable_reg);
72 return 0;
71} 73}
72 74
73static inline void clk_reg_disable1(struct clk *clk) 75static inline void clk_reg_disable1(struct clk *clk)
@@ -636,31 +638,34 @@ static struct clk flash_ck = {
636static struct clk i2c0_ck = { 638static struct clk i2c0_ck = {
637 .name = "i2c0_ck", 639 .name = "i2c0_ck",
638 .parent = &per_ck, 640 .parent = &per_ck,
639 .flags = NEEDS_INITIALIZATION, 641 .flags = NEEDS_INITIALIZATION | FIXED_RATE,
640 .round_rate = &on_off_round_rate,
641 .set_rate = &on_off_set_rate,
642 .enable_shift = 0, 642 .enable_shift = 0,
643 .enable_reg = I2CCLKCTRL_REG, 643 .enable_reg = I2CCLKCTRL_REG,
644 .rate = 13000000,
645 .enable = clk_reg_enable,
646 .disable = clk_reg_disable,
644}; 647};
645 648
646static struct clk i2c1_ck = { 649static struct clk i2c1_ck = {
647 .name = "i2c1_ck", 650 .name = "i2c1_ck",
648 .parent = &per_ck, 651 .parent = &per_ck,
649 .flags = NEEDS_INITIALIZATION, 652 .flags = NEEDS_INITIALIZATION | FIXED_RATE,
650 .round_rate = &on_off_round_rate,
651 .set_rate = &on_off_set_rate,
652 .enable_shift = 1, 653 .enable_shift = 1,
653 .enable_reg = I2CCLKCTRL_REG, 654 .enable_reg = I2CCLKCTRL_REG,
655 .rate = 13000000,
656 .enable = clk_reg_enable,
657 .disable = clk_reg_disable,
654}; 658};
655 659
656static struct clk i2c2_ck = { 660static struct clk i2c2_ck = {
657 .name = "i2c2_ck", 661 .name = "i2c2_ck",
658 .parent = &per_ck, 662 .parent = &per_ck,
659 .flags = NEEDS_INITIALIZATION, 663 .flags = NEEDS_INITIALIZATION | FIXED_RATE,
660 .round_rate = &on_off_round_rate,
661 .set_rate = &on_off_set_rate,
662 .enable_shift = 2, 664 .enable_shift = 2,
663 .enable_reg = USB_OTG_CLKCTRL_REG, 665 .enable_reg = USB_OTG_CLKCTRL_REG,
666 .rate = 13000000,
667 .enable = clk_reg_enable,
668 .disable = clk_reg_disable,
664}; 669};
665 670
666static struct clk spi0_ck = { 671static struct clk spi0_ck = {
@@ -738,16 +743,16 @@ static struct clk wdt_ck = {
738 .name = "wdt_ck", 743 .name = "wdt_ck",
739 .parent = &per_ck, 744 .parent = &per_ck,
740 .flags = NEEDS_INITIALIZATION, 745 .flags = NEEDS_INITIALIZATION,
741 .round_rate = &on_off_round_rate,
742 .set_rate = &on_off_set_rate,
743 .enable_shift = 0, 746 .enable_shift = 0,
744 .enable_reg = TIMCLKCTRL_REG, 747 .enable_reg = TIMCLKCTRL_REG,
748 .enable = clk_reg_enable,
749 .disable = clk_reg_disable,
745}; 750};
746 751
747/* These clocks are visible outside this module 752/* These clocks are visible outside this module
748 * and can be initialized 753 * and can be initialized
749 */ 754 */
750static struct clk *onchip_clks[] = { 755static struct clk *onchip_clks[] __initdata = {
751 &ck_13MHz, 756 &ck_13MHz,
752 &ck_pll1, 757 &ck_pll1,
753 &ck_pll4, 758 &ck_pll4,
@@ -777,49 +782,74 @@ static struct clk *onchip_clks[] = {
777 &wdt_ck, 782 &wdt_ck,
778}; 783};
779 784
780static int local_clk_enable(struct clk *clk) 785static struct clk_lookup onchip_clkreg[] = {
781{ 786 { .clk = &ck_13MHz, .con_id = "ck_13MHz" },
782 int ret = 0; 787 { .clk = &ck_pll1, .con_id = "ck_pll1" },
783 788 { .clk = &ck_pll4, .con_id = "ck_pll4" },
784 if (!(clk->flags & FIXED_RATE) && !clk->rate && clk->set_rate 789 { .clk = &ck_pll5, .con_id = "ck_pll5" },
785 && clk->user_rate) 790 { .clk = &ck_pll3, .con_id = "ck_pll3" },
786 ret = clk->set_rate(clk, clk->user_rate); 791 { .clk = &vfp9_ck, .con_id = "vfp9_ck" },
787 return ret; 792 { .clk = &m2hclk_ck, .con_id = "m2hclk_ck" },
788} 793 { .clk = &hclk_ck, .con_id = "hclk_ck" },
794 { .clk = &dma_ck, .con_id = "dma_ck" },
795 { .clk = &flash_ck, .con_id = "flash_ck" },
796 { .clk = &dum_ck, .con_id = "dum_ck" },
797 { .clk = &keyscan_ck, .con_id = "keyscan_ck" },
798 { .clk = &pwm1_ck, .con_id = "pwm1_ck" },
799 { .clk = &pwm2_ck, .con_id = "pwm2_ck" },
800 { .clk = &jpeg_ck, .con_id = "jpeg_ck" },
801 { .clk = &ms_ck, .con_id = "ms_ck" },
802 { .clk = &touch_ck, .con_id = "touch_ck" },
803 { .clk = &i2c0_ck, .dev_id = "pnx-i2c.0" },
804 { .clk = &i2c1_ck, .dev_id = "pnx-i2c.1" },
805 { .clk = &i2c2_ck, .dev_id = "pnx-i2c.2" },
806 { .clk = &spi0_ck, .con_id = "spi0_ck" },
807 { .clk = &spi1_ck, .con_id = "spi1_ck" },
808 { .clk = &uart3_ck, .con_id = "uart3_ck" },
809 { .clk = &uart4_ck, .con_id = "uart4_ck" },
810 { .clk = &uart5_ck, .con_id = "uart5_ck" },
811 { .clk = &uart6_ck, .con_id = "uart6_ck" },
812 { .clk = &wdt_ck, .dev_id = "pnx4008-watchdog" },
813};
789 814
790static void local_clk_disable(struct clk *clk) 815static void local_clk_disable(struct clk *clk)
791{ 816{
792 if (!(clk->flags & FIXED_RATE) && clk->rate && clk->set_rate) 817 if (WARN_ON(clk->usecount == 0))
793 clk->set_rate(clk, 0); 818 return;
794}
795 819
796static void local_clk_unuse(struct clk *clk) 820 if (!(--clk->usecount)) {
797{ 821 if (clk->disable)
798 if (clk->usecount > 0 && !(--clk->usecount)) { 822 clk->disable(clk);
799 local_clk_disable(clk); 823 else if (!(clk->flags & FIXED_RATE) && clk->rate && clk->set_rate)
824 clk->set_rate(clk, 0);
800 if (clk->parent) 825 if (clk->parent)
801 local_clk_unuse(clk->parent); 826 local_clk_disable(clk->parent);
802 } 827 }
803} 828}
804 829
805static int local_clk_use(struct clk *clk) 830static int local_clk_enable(struct clk *clk)
806{ 831{
807 int ret = 0; 832 int ret = 0;
808 if (clk->usecount++ == 0) {
809 if (clk->parent)
810 ret = local_clk_use(clk->parent);
811 833
812 if (ret != 0) { 834 if (clk->usecount == 0) {
813 clk->usecount--; 835 if (clk->parent) {
814 goto out; 836 ret = local_clk_enable(clk->parent);
837 if (ret != 0)
838 goto out;
815 } 839 }
816 840
817 ret = local_clk_enable(clk); 841 if (clk->enable)
842 ret = clk->enable(clk);
843 else if (!(clk->flags & FIXED_RATE) && !clk->rate && clk->set_rate
844 && clk->user_rate)
845 ret = clk->set_rate(clk, clk->user_rate);
818 846
819 if (ret != 0 && clk->parent) { 847 if (ret != 0 && clk->parent) {
820 local_clk_unuse(clk->parent); 848 local_clk_disable(clk->parent);
821 clk->usecount--; 849 goto out;
822 } 850 }
851
852 clk->usecount++;
823 } 853 }
824out: 854out:
825 return ret; 855 return ret;
@@ -866,35 +896,6 @@ out:
866 896
867EXPORT_SYMBOL(clk_set_rate); 897EXPORT_SYMBOL(clk_set_rate);
868 898
869struct clk *clk_get(struct device *dev, const char *id)
870{
871 struct clk *clk = ERR_PTR(-ENOENT);
872 struct clk **clkp;
873
874 clock_lock();
875 for (clkp = onchip_clks; clkp < onchip_clks + ARRAY_SIZE(onchip_clks);
876 clkp++) {
877 if (strcmp(id, (*clkp)->name) == 0
878 && try_module_get((*clkp)->owner)) {
879 clk = (*clkp);
880 break;
881 }
882 }
883 clock_unlock();
884
885 return clk;
886}
887EXPORT_SYMBOL(clk_get);
888
889void clk_put(struct clk *clk)
890{
891 clock_lock();
892 if (clk && !IS_ERR(clk))
893 module_put(clk->owner);
894 clock_unlock();
895}
896EXPORT_SYMBOL(clk_put);
897
898unsigned long clk_get_rate(struct clk *clk) 899unsigned long clk_get_rate(struct clk *clk)
899{ 900{
900 unsigned long ret; 901 unsigned long ret;
@@ -907,10 +908,10 @@ EXPORT_SYMBOL(clk_get_rate);
907 908
908int clk_enable(struct clk *clk) 909int clk_enable(struct clk *clk)
909{ 910{
910 int ret = 0; 911 int ret;
911 912
912 clock_lock(); 913 clock_lock();
913 ret = local_clk_use(clk); 914 ret = local_clk_enable(clk);
914 clock_unlock(); 915 clock_unlock();
915 return ret; 916 return ret;
916} 917}
@@ -920,7 +921,7 @@ EXPORT_SYMBOL(clk_enable);
920void clk_disable(struct clk *clk) 921void clk_disable(struct clk *clk)
921{ 922{
922 clock_lock(); 923 clock_lock();
923 local_clk_unuse(clk); 924 local_clk_disable(clk);
924 clock_unlock(); 925 clock_unlock();
925} 926}
926 927
@@ -967,18 +968,24 @@ static int __init clk_init(void)
967 968
968 for (clkp = onchip_clks; clkp < onchip_clks + ARRAY_SIZE(onchip_clks); 969 for (clkp = onchip_clks; clkp < onchip_clks + ARRAY_SIZE(onchip_clks);
969 clkp++) { 970 clkp++) {
970 if (((*clkp)->flags & NEEDS_INITIALIZATION) 971 struct clk *clk = *clkp;
971 && ((*clkp)->set_rate)) { 972 if (clk->flags & NEEDS_INITIALIZATION) {
972 (*clkp)->user_rate = (*clkp)->rate; 973 if (clk->set_rate) {
973 local_set_rate((*clkp), (*clkp)->user_rate); 974 clk->user_rate = clk->rate;
974 if ((*clkp)->set_parent) 975 local_set_rate(clk, clk->user_rate);
975 (*clkp)->set_parent((*clkp), (*clkp)->parent); 976 if (clk->set_parent)
977 clk->set_parent(clk, clk->parent);
978 }
979 if (clk->enable && clk->usecount)
980 clk->enable(clk);
981 if (clk->disable && !clk->usecount)
982 clk->disable(clk);
976 } 983 }
977 pr_debug("%s: clock %s, rate %ld\n", 984 pr_debug("%s: clock %s, rate %ld\n",
978 __func__, (*clkp)->name, (*clkp)->rate); 985 __func__, clk->name, clk->rate);
979 } 986 }
980 987
981 local_clk_use(&ck_pll4); 988 local_clk_enable(&ck_pll4);
982 989
983 /* if ck_13MHz is not used, disable it. */ 990 /* if ck_13MHz is not used, disable it. */
984 if (ck_13MHz.usecount == 0) 991 if (ck_13MHz.usecount == 0)
@@ -987,6 +994,8 @@ static int __init clk_init(void)
987 /* Disable autoclocking */ 994 /* Disable autoclocking */
988 __raw_writeb(0xff, AUTOCLK_CTRL); 995 __raw_writeb(0xff, AUTOCLK_CTRL);
989 996
997 clkdev_add_table(onchip_clkreg, ARRAY_SIZE(onchip_clkreg));
998
990 return 0; 999 return 0;
991} 1000}
992 1001
diff --git a/arch/arm/mach-pnx4008/clock.h b/arch/arm/mach-pnx4008/clock.h
index cd58f372cfd0..39720d6c0d01 100644
--- a/arch/arm/mach-pnx4008/clock.h
+++ b/arch/arm/mach-pnx4008/clock.h
@@ -14,8 +14,6 @@
14#define __ARCH_ARM_PNX4008_CLOCK_H__ 14#define __ARCH_ARM_PNX4008_CLOCK_H__
15 15
16struct clk { 16struct clk {
17 struct list_head node;
18 struct module *owner;
19 const char *name; 17 const char *name;
20 struct clk *parent; 18 struct clk *parent;
21 struct clk *propagate_next; 19 struct clk *propagate_next;
@@ -29,9 +27,11 @@ struct clk {
29 u8 enable_shift1; 27 u8 enable_shift1;
30 u32 enable_reg1; 28 u32 enable_reg1;
31 u32 parent_switch_reg; 29 u32 parent_switch_reg;
32 u32(*round_rate) (struct clk *, u32); 30 u32(*round_rate) (struct clk *, u32);
33 int (*set_rate) (struct clk *, u32); 31 int (*set_rate) (struct clk *, u32);
34 int (*set_parent) (struct clk * clk, struct clk * parent); 32 int (*set_parent) (struct clk * clk, struct clk * parent);
33 int (*enable)(struct clk *);
34 void (*disable)(struct clk *);
35}; 35};
36 36
37/* Flags */ 37/* Flags */
diff --git a/arch/arm/mach-pnx4008/i2c.c b/arch/arm/mach-pnx4008/i2c.c
index f3fea29c00d3..8103f9644e2d 100644
--- a/arch/arm/mach-pnx4008/i2c.c
+++ b/arch/arm/mach-pnx4008/i2c.c
@@ -18,120 +18,24 @@
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19#include <mach/i2c.h> 19#include <mach/i2c.h>
20 20
21static int set_clock_run(struct platform_device *pdev) 21static struct i2c_pnx_data i2c0_data = {
22{ 22 .name = I2C_CHIP_NAME "0",
23 struct clk *clk;
24 char name[10];
25 int retval = 0;
26
27 snprintf(name, 10, "i2c%d_ck", pdev->id);
28 clk = clk_get(&pdev->dev, name);
29 if (!IS_ERR(clk)) {
30 clk_set_rate(clk, 1);
31 clk_put(clk);
32 } else
33 retval = -ENOENT;
34
35 return retval;
36}
37
38static int set_clock_stop(struct platform_device *pdev)
39{
40 struct clk *clk;
41 char name[10];
42 int retval = 0;
43
44 snprintf(name, 10, "i2c%d_ck", pdev->id);
45 clk = clk_get(&pdev->dev, name);
46 if (!IS_ERR(clk)) {
47 clk_set_rate(clk, 0);
48 clk_put(clk);
49 } else
50 retval = -ENOENT;
51
52 return retval;
53}
54
55static int i2c_pnx_suspend(struct platform_device *pdev, pm_message_t state)
56{
57 int retval = 0;
58#ifdef CONFIG_PM
59 retval = set_clock_run(pdev);
60#endif
61 return retval;
62}
63
64static int i2c_pnx_resume(struct platform_device *pdev)
65{
66 int retval = 0;
67#ifdef CONFIG_PM
68 retval = set_clock_run(pdev);
69#endif
70 return retval;
71}
72
73static u32 calculate_input_freq(struct platform_device *pdev)
74{
75 return HCLK_MHZ;
76}
77
78
79static struct i2c_pnx_algo_data pnx_algo_data0 = {
80 .base = PNX4008_I2C1_BASE, 23 .base = PNX4008_I2C1_BASE,
81 .irq = I2C_1_INT, 24 .irq = I2C_1_INT,
82}; 25};
83 26
84static struct i2c_pnx_algo_data pnx_algo_data1 = { 27static struct i2c_pnx_data i2c1_data = {
28 .name = I2C_CHIP_NAME "1",
85 .base = PNX4008_I2C2_BASE, 29 .base = PNX4008_I2C2_BASE,
86 .irq = I2C_2_INT, 30 .irq = I2C_2_INT,
87}; 31};
88 32
89static struct i2c_pnx_algo_data pnx_algo_data2 = { 33static struct i2c_pnx_data i2c2_data = {
34 .name = "USB-I2C",
90 .base = (PNX4008_USB_CONFIG_BASE + 0x300), 35 .base = (PNX4008_USB_CONFIG_BASE + 0x300),
91 .irq = USB_I2C_INT, 36 .irq = USB_I2C_INT,
92}; 37};
93 38
94static struct i2c_adapter pnx_adapter0 = {
95 .name = I2C_CHIP_NAME "0",
96 .algo_data = &pnx_algo_data0,
97};
98static struct i2c_adapter pnx_adapter1 = {
99 .name = I2C_CHIP_NAME "1",
100 .algo_data = &pnx_algo_data1,
101};
102
103static struct i2c_adapter pnx_adapter2 = {
104 .name = "USB-I2C",
105 .algo_data = &pnx_algo_data2,
106};
107
108static struct i2c_pnx_data i2c0_data = {
109 .suspend = i2c_pnx_suspend,
110 .resume = i2c_pnx_resume,
111 .calculate_input_freq = calculate_input_freq,
112 .set_clock_run = set_clock_run,
113 .set_clock_stop = set_clock_stop,
114 .adapter = &pnx_adapter0,
115};
116
117static struct i2c_pnx_data i2c1_data = {
118 .suspend = i2c_pnx_suspend,
119 .resume = i2c_pnx_resume,
120 .calculate_input_freq = calculate_input_freq,
121 .set_clock_run = set_clock_run,
122 .set_clock_stop = set_clock_stop,
123 .adapter = &pnx_adapter1,
124};
125
126static struct i2c_pnx_data i2c2_data = {
127 .suspend = i2c_pnx_suspend,
128 .resume = i2c_pnx_resume,
129 .calculate_input_freq = calculate_input_freq,
130 .set_clock_run = set_clock_run,
131 .set_clock_stop = set_clock_stop,
132 .adapter = &pnx_adapter2,
133};
134
135static struct platform_device i2c0_device = { 39static struct platform_device i2c0_device = {
136 .name = "pnx-i2c", 40 .name = "pnx-i2c",
137 .id = 0, 41 .id = 0,
diff --git a/arch/arm/mach-pnx4008/include/mach/clkdev.h b/arch/arm/mach-pnx4008/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-pnx4008/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-pnx4008/include/mach/timex.h b/arch/arm/mach-pnx4008/include/mach/timex.h
index 5ff0196c0f16..b383c7de7ab4 100644
--- a/arch/arm/mach-pnx4008/include/mach/timex.h
+++ b/arch/arm/mach-pnx4008/include/mach/timex.h
@@ -14,60 +14,6 @@
14#ifndef __PNX4008_TIMEX_H 14#ifndef __PNX4008_TIMEX_H
15#define __PNX4008_TIMEX_H 15#define __PNX4008_TIMEX_H
16 16
17#include <linux/io.h>
18#include <mach/hardware.h>
19
20#define CLOCK_TICK_RATE 1000000 17#define CLOCK_TICK_RATE 1000000
21 18
22#define TICKS2USECS(x) (x)
23
24/* MilliSecond Timer - Chapter 21 Page 202 */
25
26#define MSTIM_INT IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x0))
27#define MSTIM_CTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x4))
28#define MSTIM_COUNTER IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x8))
29#define MSTIM_MCTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x14))
30#define MSTIM_MATCH0 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x18))
31#define MSTIM_MATCH1 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x1c))
32
33/* High Speed Timer - Chpater 22, Page 205 */
34
35#define HSTIM_INT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x0))
36#define HSTIM_CTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x4))
37#define HSTIM_COUNTER IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x8))
38#define HSTIM_PMATCH IO_ADDRESS((PNX4008_HSTIMER_BASE + 0xC))
39#define HSTIM_PCOUNT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x10))
40#define HSTIM_MCTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x14))
41#define HSTIM_MATCH0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x18))
42#define HSTIM_MATCH1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x1c))
43#define HSTIM_MATCH2 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x20))
44#define HSTIM_CCR IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x28))
45#define HSTIM_CR0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x2C))
46#define HSTIM_CR1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x30))
47
48/* IMPORTANT: both timers are UPCOUNTING */
49
50/* xSTIM_MCTRL bit definitions */
51#define MR0_INT 1
52#define RESET_COUNT0 (1<<1)
53#define STOP_COUNT0 (1<<2)
54#define MR1_INT (1<<3)
55#define RESET_COUNT1 (1<<4)
56#define STOP_COUNT1 (1<<5)
57#define MR2_INT (1<<6)
58#define RESET_COUNT2 (1<<7)
59#define STOP_COUNT2 (1<<8)
60
61/* xSTIM_CTRL bit definitions */
62#define COUNT_ENAB 1
63#define RESET_COUNT (1<<1)
64#define DEBUG_EN (1<<2)
65
66/* xSTIM_INT bit definitions */
67#define MATCH0_INT 1
68#define MATCH1_INT (1<<1)
69#define MATCH2_INT (1<<2)
70#define RTC_TICK0 (1<<4)
71#define RTC_TICK1 (1<<5)
72
73#endif 19#endif
diff --git a/arch/arm/mach-pnx4008/pm.c b/arch/arm/mach-pnx4008/pm.c
index b3d8d53e32ef..1f0585329be4 100644
--- a/arch/arm/mach-pnx4008/pm.c
+++ b/arch/arm/mach-pnx4008/pm.c
@@ -21,6 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24
25#include <mach/hardware.h>
24#include <mach/pm.h> 26#include <mach/pm.h>
25#include <mach/clock.h> 27#include <mach/clock.h>
26 28
diff --git a/arch/arm/mach-pnx4008/time.c b/arch/arm/mach-pnx4008/time.c
index fc0ba183fe12..0c8aad4bb0dc 100644
--- a/arch/arm/mach-pnx4008/time.c
+++ b/arch/arm/mach-pnx4008/time.c
@@ -30,6 +30,8 @@
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
31#include <asm/errno.h> 31#include <asm/errno.h>
32 32
33#include "time.h"
34
33/*! Note: all timers are UPCOUNTING */ 35/*! Note: all timers are UPCOUNTING */
34 36
35/*! 37/*!
diff --git a/arch/arm/mach-pnx4008/time.h b/arch/arm/mach-pnx4008/time.h
new file mode 100644
index 000000000000..75e88c570aa7
--- /dev/null
+++ b/arch/arm/mach-pnx4008/time.h
@@ -0,0 +1,70 @@
1/*
2 * arch/arm/mach-pnx4008/include/mach/timex.h
3 *
4 * PNX4008 timers header file
5 *
6 * Author: Dmitry Chigirev <source@mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13#ifndef PNX_TIME_H
14#define PNX_TIME_H
15
16#include <linux/io.h>
17#include <mach/hardware.h>
18
19#define TICKS2USECS(x) (x)
20
21/* MilliSecond Timer - Chapter 21 Page 202 */
22
23#define MSTIM_INT IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x0))
24#define MSTIM_CTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x4))
25#define MSTIM_COUNTER IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x8))
26#define MSTIM_MCTRL IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x14))
27#define MSTIM_MATCH0 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x18))
28#define MSTIM_MATCH1 IO_ADDRESS((PNX4008_MSTIMER_BASE + 0x1c))
29
30/* High Speed Timer - Chpater 22, Page 205 */
31
32#define HSTIM_INT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x0))
33#define HSTIM_CTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x4))
34#define HSTIM_COUNTER IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x8))
35#define HSTIM_PMATCH IO_ADDRESS((PNX4008_HSTIMER_BASE + 0xC))
36#define HSTIM_PCOUNT IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x10))
37#define HSTIM_MCTRL IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x14))
38#define HSTIM_MATCH0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x18))
39#define HSTIM_MATCH1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x1c))
40#define HSTIM_MATCH2 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x20))
41#define HSTIM_CCR IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x28))
42#define HSTIM_CR0 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x2C))
43#define HSTIM_CR1 IO_ADDRESS((PNX4008_HSTIMER_BASE + 0x30))
44
45/* IMPORTANT: both timers are UPCOUNTING */
46
47/* xSTIM_MCTRL bit definitions */
48#define MR0_INT 1
49#define RESET_COUNT0 (1<<1)
50#define STOP_COUNT0 (1<<2)
51#define MR1_INT (1<<3)
52#define RESET_COUNT1 (1<<4)
53#define STOP_COUNT1 (1<<5)
54#define MR2_INT (1<<6)
55#define RESET_COUNT2 (1<<7)
56#define STOP_COUNT2 (1<<8)
57
58/* xSTIM_CTRL bit definitions */
59#define COUNT_ENAB 1
60#define RESET_COUNT (1<<1)
61#define DEBUG_EN (1<<2)
62
63/* xSTIM_INT bit definitions */
64#define MATCH0_INT 1
65#define MATCH1_INT (1<<1)
66#define MATCH2_INT (1<<2)
67#define RTC_TICK0 (1<<4)
68#define RTC_TICK1 (1<<5)
69
70#endif
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index 49ae38292310..abba0089a2ae 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -78,11 +78,3 @@ const struct clkops clk_cken_ops = {
78 .enable = clk_cken_enable, 78 .enable = clk_cken_enable,
79 .disable = clk_cken_disable, 79 .disable = clk_cken_disable,
80}; 80};
81
82void clks_register(struct clk_lookup *clks, size_t num)
83{
84 int i;
85
86 for (i = 0; i < num; i++)
87 clkdev_add(&clks[i]);
88}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 978a3667e90d..d8488742b807 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -67,7 +67,3 @@ extern void clk_pxa3xx_cken_enable(struct clk *);
67extern void clk_pxa3xx_cken_disable(struct clk *); 67extern void clk_pxa3xx_cken_disable(struct clk *);
68#endif 68#endif
69 69
70void clks_register(struct clk_lookup *clks, size_t num);
71int clk_add_alias(const char *alias, const char *alias_name, char *id,
72 struct device *dev);
73
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 91417f035069..96ed13081639 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -128,6 +128,6 @@ static struct clk_lookup eseries_clkregs[] = {
128 128
129void eseries_register_clks(void) 129void eseries_register_clks(void)
130{ 130{
131 clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs)); 131 clkdev_add_table(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
132} 132}
133 133
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 2c1b0b70d01d..0b9ad30bfd51 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -349,7 +349,7 @@ static int __init pxa25x_init(void)
349 349
350 reset_status = RCSR; 350 reset_status = RCSR;
351 351
352 clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs)); 352 clkdev_add_table(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs));
353 353
354 if ((ret = pxa_init_dma(IRQ_DMA, 16))) 354 if ((ret = pxa_init_dma(IRQ_DMA, 16)))
355 return ret; 355 return ret;
@@ -370,7 +370,7 @@ static int __init pxa25x_init(void)
370 370
371 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */ 371 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */
372 if (cpu_is_pxa255()) 372 if (cpu_is_pxa255())
373 clks_register(&pxa25x_hwuart_clkreg, 1); 373 clkdev_add(&pxa25x_hwuart_clkreg);
374 374
375 return ret; 375 return ret;
376} 376}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 6a0b73167e03..d783123e2d48 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -392,7 +392,7 @@ static int __init pxa27x_init(void)
392 392
393 reset_status = RCSR; 393 reset_status = RCSR;
394 394
395 clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs)); 395 clkdev_add_table(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs));
396 396
397 if ((ret = pxa_init_dma(IRQ_DMA, 32))) 397 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
398 return ret; 398 return ret;
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index f4af6e2bef89..40bb16501d86 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -102,12 +102,12 @@ static int __init pxa300_init(void)
102 if (cpu_is_pxa300() || cpu_is_pxa310()) { 102 if (cpu_is_pxa300() || cpu_is_pxa310()) {
103 mfp_init_base(io_p2v(MFPR_BASE)); 103 mfp_init_base(io_p2v(MFPR_BASE));
104 mfp_init_addr(pxa300_mfp_addr_map); 104 mfp_init_addr(pxa300_mfp_addr_map);
105 clks_register(ARRAY_AND_SIZE(common_clkregs)); 105 clkdev_add_table(ARRAY_AND_SIZE(common_clkregs));
106 } 106 }
107 107
108 if (cpu_is_pxa310()) { 108 if (cpu_is_pxa310()) {
109 mfp_init_addr(pxa310_mfp_addr_map); 109 mfp_init_addr(pxa310_mfp_addr_map);
110 clks_register(ARRAY_AND_SIZE(pxa310_clkregs)); 110 clkdev_add_table(ARRAY_AND_SIZE(pxa310_clkregs));
111 } 111 }
112 112
113 return 0; 113 return 0;
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index c7373e74a109..8d614ecd8e99 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -90,7 +90,7 @@ static int __init pxa320_init(void)
90 if (cpu_is_pxa320()) { 90 if (cpu_is_pxa320()) {
91 mfp_init_base(io_p2v(MFPR_BASE)); 91 mfp_init_base(io_p2v(MFPR_BASE));
92 mfp_init_addr(pxa320_mfp_addr_map); 92 mfp_init_addr(pxa320_mfp_addr_map);
93 clks_register(ARRAY_AND_SIZE(pxa320_clkregs)); 93 clkdev_add_table(ARRAY_AND_SIZE(pxa320_clkregs));
94 } 94 }
95 95
96 return 0; 96 return 0;
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index fcb0721f4669..4d7c03e72504 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -634,7 +634,7 @@ static int __init pxa3xx_init(void)
634 */ 634 */
635 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 635 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
636 636
637 clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs)); 637 clkdev_add_table(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs));
638 638
639 if ((ret = pxa_init_dma(IRQ_DMA, 32))) 639 if ((ret = pxa_init_dma(IRQ_DMA, 32)))
640 return ret; 640 return ret;
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 9f293438e020..90bd4ef71b2c 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -346,10 +346,7 @@ static struct clk_lookup lookups[] = {
346 346
347static int __init clk_init(void) 347static int __init clk_init(void)
348{ 348{
349 int i; 349 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
350
351 for (i = 0; i < ARRAY_SIZE(lookups); i++)
352 clkdev_add(&lookups[i]);
353 return 0; 350 return 0;
354} 351}
355arch_initcall(clk_init); 352arch_initcall(clk_init);
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c
index 36ffd6a8b34c..5af71d5ba665 100644
--- a/arch/arm/mach-u300/clock.c
+++ b/arch/arm/mach-u300/clock.c
@@ -1276,11 +1276,8 @@ static struct clk_lookup lookups[] = {
1276 1276
1277static void __init clk_register(void) 1277static void __init clk_register(void)
1278{ 1278{
1279 int i;
1280
1281 /* Register the lookups */ 1279 /* Register the lookups */
1282 for (i = 0; i < ARRAY_SIZE(lookups); i++) 1280 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
1283 clkdev_add(&lookups[i]);
1284} 1281}
1285 1282
1286/* 1283/*
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index 20b6ebb6783a..8359a73d0041 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -85,11 +85,8 @@ static struct clk_lookup lookups[] = {
85 85
86static int __init clk_init(void) 86static int __init clk_init(void)
87{ 87{
88 int i;
89
90 /* register the clock lookups */ 88 /* register the clock lookups */
91 for (i = 0; i < ARRAY_SIZE(lookups); i++) 89 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
92 clkdev_add(&lookups[i]);
93 return 0; 90 return 0;
94} 91}
95arch_initcall(clk_init); 92arch_initcall(clk_init);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index e13be7c444ca..9ddb49b1cb71 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -851,8 +851,7 @@ void __init versatile_init(void)
851{ 851{
852 int i; 852 int i;
853 853
854 for (i = 0; i < ARRAY_SIZE(lookups); i++) 854 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
855 clkdev_add(&lookups[i]);
856 855
857 platform_device_register(&versatile_flash_device); 856 platform_device_register(&versatile_flash_device);
858 platform_device_register(&versatile_i2c_device); 857 platform_device_register(&versatile_i2c_device);
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index b785994bab0a..2c371ff22e51 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -90,12 +90,3 @@ void nuc900_subclk_enable(struct clk *clk, int enable)
90 90
91 __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK); 91 __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
92} 92}
93
94
95void clks_register(struct clk_lookup *clks, size_t num)
96{
97 int i;
98
99 for (i = 0; i < num; i++)
100 clkdev_add(&clks[i]);
101}
diff --git a/arch/arm/mach-w90x900/clock.h b/arch/arm/mach-w90x900/clock.h
index f5816a06eed6..c56ddab3d912 100644
--- a/arch/arm/mach-w90x900/clock.h
+++ b/arch/arm/mach-w90x900/clock.h
@@ -14,7 +14,6 @@
14 14
15void nuc900_clk_enable(struct clk *clk, int enable); 15void nuc900_clk_enable(struct clk *clk, int enable);
16void nuc900_subclk_enable(struct clk *clk, int enable); 16void nuc900_subclk_enable(struct clk *clk, int enable);
17void clks_register(struct clk_lookup *clks, size_t num);
18 17
19struct clk { 18struct clk {
20 unsigned long cken; 19 unsigned long cken;
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index e44b0a0ecf4c..642207e18198 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -219,6 +219,6 @@ void __init nuc900_map_io(struct map_desc *mach_desc, int mach_size)
219 219
220void __init nuc900_init_clocks(void) 220void __init nuc900_init_clocks(void)
221{ 221{
222 clks_register(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs)); 222 clkdev_add_table(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs));
223} 223}
224 224
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 88f5d71248d9..9d4da6ac28eb 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1068,4 +1068,6 @@ void setup_mm_for_reboot(char mode)
1068 pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); 1068 pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));
1069 flush_pmd_entry(pmd); 1069 flush_pmd_entry(pmd);
1070 } 1070 }
1071
1072 local_flush_tlb_all();
1071} 1073}
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 395cc90c6613..7a5337ed7d68 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -59,8 +59,6 @@ ENTRY(cpu_v6_proc_fin)
59 * to what would be the reset vector. 59 * to what would be the reset vector.
60 * 60 *
61 * - loc - location to jump to for soft reset 61 * - loc - location to jump to for soft reset
62 *
63 * It is assumed that:
64 */ 62 */
65 .align 5 63 .align 5
66ENTRY(cpu_v6_reset) 64ENTRY(cpu_v6_reset)
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 3a285218fd15..7aaf88a3b7aa 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -45,7 +45,14 @@ ENTRY(cpu_v7_proc_init)
45ENDPROC(cpu_v7_proc_init) 45ENDPROC(cpu_v7_proc_init)
46 46
47ENTRY(cpu_v7_proc_fin) 47ENTRY(cpu_v7_proc_fin)
48 mov pc, lr 48 stmfd sp!, {lr}
49 cpsid if @ disable interrupts
50 bl v7_flush_kern_cache_all
51 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
52 bic r0, r0, #0x1000 @ ...i............
53 bic r0, r0, #0x0006 @ .............ca.
54 mcr p15, 0, r0, c1, c0, 0 @ disable caches
55 ldmfd sp!, {pc}
49ENDPROC(cpu_v7_proc_fin) 56ENDPROC(cpu_v7_proc_fin)
50 57
51/* 58/*
@@ -56,8 +63,6 @@ ENDPROC(cpu_v7_proc_fin)
56 * to what would be the reset vector. 63 * to what would be the reset vector.
57 * 64 *
58 * - loc - location to jump to for soft reset 65 * - loc - location to jump to for soft reset
59 *
60 * It is assumed that:
61 */ 66 */
62 .align 5 67 .align 5
63ENTRY(cpu_v7_reset) 68ENTRY(cpu_v7_reset)
diff --git a/arch/arm/plat-stmp3xxx/clock.c b/arch/arm/plat-stmp3xxx/clock.c
index 5d2f19a09e44..e593a2a801c6 100644
--- a/arch/arm/plat-stmp3xxx/clock.c
+++ b/arch/arm/plat-stmp3xxx/clock.c
@@ -1126,9 +1126,8 @@ static int __init clk_init(void)
1126 if (ops && ops->set_parent) 1126 if (ops && ops->set_parent)
1127 ops->set_parent(cl->clk, cl->clk->parent); 1127 ops->set_parent(cl->clk, cl->clk->parent);
1128 } 1128 }
1129
1130 clkdev_add(cl);
1131 } 1129 }
1130 clkdev_add_table(onchip_clks, ARRAY_SIZE(onchip_clks));
1132 return 0; 1131 return 0;
1133} 1132}
1134 1133