aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig31
-rw-r--r--arch/arm/boot/compressed/misc.c2
-rw-r--r--arch/arm/common/Kconfig3
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/clkdev.c128
-rw-r--r--arch/arm/include/asm/clkdev.h30
-rw-r--r--arch/arm/include/asm/page.h2
-rw-r--r--arch/arm/include/asm/processor.h2
-rw-r--r--arch/arm/include/asm/string.h9
-rw-r--r--arch/arm/include/asm/uaccess.h2
-rw-r--r--arch/arm/lib/memset.S2
-rw-r--r--arch/arm/mach-at91/Kconfig7
-rw-r--r--arch/arm/mach-integrator/clock.c80
-rw-r--r--arch/arm/mach-integrator/clock.h25
-rw-r--r--arch/arm/mach-integrator/core.c35
-rw-r--r--arch/arm/mach-integrator/impd1.c26
-rw-r--r--arch/arm/mach-integrator/include/mach/clkdev.h25
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c18
-rw-r--r--arch/arm/mach-omap1/Kconfig3
-rw-r--r--arch/arm/mach-pxa/Kconfig3
-rw-r--r--arch/arm/mach-pxa/clock.c66
-rw-r--r--arch/arm/mach-pxa/clock.h59
-rw-r--r--arch/arm/mach-pxa/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-pxa/pwm.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c71
-rw-r--r--arch/arm/mach-pxa/pxa27x.c89
-rw-r--r--arch/arm/mach-pxa/pxa300.c18
-rw-r--r--arch/arm/mach-pxa/pxa320.c8
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c87
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/arm/mach-realview/Kconfig2
-rw-r--r--arch/arm/mach-realview/clock.c80
-rw-r--r--arch/arm/mach-realview/clock.h6
-rw-r--r--arch/arm/mach-realview/core.c52
-rw-r--r--arch/arm/mach-realview/core.h1
-rw-r--r--arch/arm/mach-realview/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-realview/realview_eb.c2
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c2
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c2
-rw-r--r--arch/arm/mach-s3c2410/Kconfig1
-rw-r--r--arch/arm/mach-s3c2412/Kconfig1
-rw-r--r--arch/arm/mach-s3c2440/Kconfig1
-rw-r--r--arch/arm/mach-s3c2442/Kconfig1
-rw-r--r--arch/arm/mach-sa1100/clock.c100
-rw-r--r--arch/arm/mach-versatile/Kconfig2
-rw-r--r--arch/arm/mach-versatile/clock.c80
-rw-r--r--arch/arm/mach-versatile/clock.h7
-rw-r--r--arch/arm/mach-versatile/core.c56
-rw-r--r--arch/arm/mach-versatile/include/mach/clkdev.h7
-rw-r--r--arch/arm/mm/Kconfig65
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm/mm/pgd.c2
-rw-r--r--arch/arm/plat-mxc/Kconfig2
-rw-r--r--arch/arm/plat-omap/Kconfig2
54 files changed, 680 insertions, 646 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6946d95c939..29759cd2555 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -201,6 +201,7 @@ choice
201 201
202config ARCH_AAEC2000 202config ARCH_AAEC2000
203 bool "Agilent AAEC-2000 based" 203 bool "Agilent AAEC-2000 based"
204 select CPU_ARM920T
204 select ARM_AMBA 205 select ARM_AMBA
205 select HAVE_CLK 206 select HAVE_CLK
206 help 207 help
@@ -210,6 +211,7 @@ config ARCH_INTEGRATOR
210 bool "ARM Ltd. Integrator family" 211 bool "ARM Ltd. Integrator family"
211 select ARM_AMBA 212 select ARM_AMBA
212 select HAVE_CLK 213 select HAVE_CLK
214 select COMMON_CLKDEV
213 select ICST525 215 select ICST525
214 help 216 help
215 Support for ARM's Integrator platform. 217 Support for ARM's Integrator platform.
@@ -218,6 +220,7 @@ config ARCH_REALVIEW
218 bool "ARM Ltd. RealView family" 220 bool "ARM Ltd. RealView family"
219 select ARM_AMBA 221 select ARM_AMBA
220 select HAVE_CLK 222 select HAVE_CLK
223 select COMMON_CLKDEV
221 select ICST307 224 select ICST307
222 select GENERIC_TIME 225 select GENERIC_TIME
223 select GENERIC_CLOCKEVENTS 226 select GENERIC_CLOCKEVENTS
@@ -229,6 +232,7 @@ config ARCH_VERSATILE
229 select ARM_AMBA 232 select ARM_AMBA
230 select ARM_VIC 233 select ARM_VIC
231 select HAVE_CLK 234 select HAVE_CLK
235 select COMMON_CLKDEV
232 select ICST307 236 select ICST307
233 select GENERIC_TIME 237 select GENERIC_TIME
234 select GENERIC_CLOCKEVENTS 238 select GENERIC_CLOCKEVENTS
@@ -245,11 +249,13 @@ config ARCH_AT91
245 249
246config ARCH_CLPS711X 250config ARCH_CLPS711X
247 bool "Cirrus Logic CLPS711x/EP721x-based" 251 bool "Cirrus Logic CLPS711x/EP721x-based"
252 select CPU_ARM720T
248 help 253 help
249 Support for Cirrus Logic 711x/721x based boards. 254 Support for Cirrus Logic 711x/721x based boards.
250 255
251config ARCH_EBSA110 256config ARCH_EBSA110
252 bool "EBSA-110" 257 bool "EBSA-110"
258 select CPU_SA110
253 select ISA 259 select ISA
254 select NO_IOPORT 260 select NO_IOPORT
255 help 261 help
@@ -260,6 +266,7 @@ config ARCH_EBSA110
260 266
261config ARCH_EP93XX 267config ARCH_EP93XX
262 bool "EP93xx-based" 268 bool "EP93xx-based"
269 select CPU_ARM920T
263 select ARM_AMBA 270 select ARM_AMBA
264 select ARM_VIC 271 select ARM_VIC
265 select GENERIC_GPIO 272 select GENERIC_GPIO
@@ -270,6 +277,7 @@ config ARCH_EP93XX
270 277
271config ARCH_FOOTBRIDGE 278config ARCH_FOOTBRIDGE
272 bool "FootBridge" 279 bool "FootBridge"
280 select CPU_SA110
273 select FOOTBRIDGE 281 select FOOTBRIDGE
274 help 282 help
275 Support for systems based on the DC21285 companion chip 283 Support for systems based on the DC21285 companion chip
@@ -277,18 +285,21 @@ config ARCH_FOOTBRIDGE
277 285
278config ARCH_NETX 286config ARCH_NETX
279 bool "Hilscher NetX based" 287 bool "Hilscher NetX based"
288 select CPU_ARM926T
280 select ARM_VIC 289 select ARM_VIC
281 help 290 help
282 This enables support for systems based on the Hilscher NetX Soc 291 This enables support for systems based on the Hilscher NetX Soc
283 292
284config ARCH_H720X 293config ARCH_H720X
285 bool "Hynix HMS720x-based" 294 bool "Hynix HMS720x-based"
295 select CPU_ARM720T
286 select ISA_DMA_API 296 select ISA_DMA_API
287 help 297 help
288 This enables support for systems based on the Hynix HMS720x 298 This enables support for systems based on the Hynix HMS720x
289 299
290config ARCH_IMX 300config ARCH_IMX
291 bool "IMX" 301 bool "IMX"
302 select CPU_ARM920T
292 select GENERIC_GPIO 303 select GENERIC_GPIO
293 select GENERIC_TIME 304 select GENERIC_TIME
294 select GENERIC_CLOCKEVENTS 305 select GENERIC_CLOCKEVENTS
@@ -298,6 +309,7 @@ config ARCH_IMX
298config ARCH_IOP13XX 309config ARCH_IOP13XX
299 bool "IOP13xx-based" 310 bool "IOP13xx-based"
300 depends on MMU 311 depends on MMU
312 select CPU_XSC3
301 select PLAT_IOP 313 select PLAT_IOP
302 select PCI 314 select PCI
303 select ARCH_SUPPORTS_MSI 315 select ARCH_SUPPORTS_MSI
@@ -308,6 +320,7 @@ config ARCH_IOP13XX
308config ARCH_IOP32X 320config ARCH_IOP32X
309 bool "IOP32x-based" 321 bool "IOP32x-based"
310 depends on MMU 322 depends on MMU
323 select CPU_XSCALE
311 select PLAT_IOP 324 select PLAT_IOP
312 select PCI 325 select PCI
313 select GENERIC_GPIO 326 select GENERIC_GPIO
@@ -319,6 +332,7 @@ config ARCH_IOP32X
319config ARCH_IOP33X 332config ARCH_IOP33X
320 bool "IOP33x-based" 333 bool "IOP33x-based"
321 depends on MMU 334 depends on MMU
335 select CPU_XSCALE
322 select PLAT_IOP 336 select PLAT_IOP
323 select PCI 337 select PCI
324 select GENERIC_GPIO 338 select GENERIC_GPIO
@@ -329,6 +343,7 @@ config ARCH_IOP33X
329config ARCH_IXP23XX 343config ARCH_IXP23XX
330 bool "IXP23XX-based" 344 bool "IXP23XX-based"
331 depends on MMU 345 depends on MMU
346 select CPU_XSC3
332 select PCI 347 select PCI
333 help 348 help
334 Support for Intel's IXP23xx (XScale) family of processors. 349 Support for Intel's IXP23xx (XScale) family of processors.
@@ -336,6 +351,7 @@ config ARCH_IXP23XX
336config ARCH_IXP2000 351config ARCH_IXP2000
337 bool "IXP2400/2800-based" 352 bool "IXP2400/2800-based"
338 depends on MMU 353 depends on MMU
354 select CPU_XSCALE
339 select PCI 355 select PCI
340 help 356 help
341 Support for Intel's IXP2400/2800 (XScale) family of processors. 357 Support for Intel's IXP2400/2800 (XScale) family of processors.
@@ -343,6 +359,7 @@ config ARCH_IXP2000
343config ARCH_IXP4XX 359config ARCH_IXP4XX
344 bool "IXP4xx-based" 360 bool "IXP4xx-based"
345 depends on MMU 361 depends on MMU
362 select CPU_XSCALE
346 select GENERIC_GPIO 363 select GENERIC_GPIO
347 select GENERIC_TIME 364 select GENERIC_TIME
348 select GENERIC_CLOCKEVENTS 365 select GENERIC_CLOCKEVENTS
@@ -352,6 +369,7 @@ config ARCH_IXP4XX
352 369
353config ARCH_L7200 370config ARCH_L7200
354 bool "LinkUp-L7200" 371 bool "LinkUp-L7200"
372 select CPU_ARM720T
355 select FIQ 373 select FIQ
356 help 374 help
357 Say Y here if you intend to run this kernel on a LinkUp Systems 375 Say Y here if you intend to run this kernel on a LinkUp Systems
@@ -365,6 +383,7 @@ config ARCH_L7200
365 383
366config ARCH_KIRKWOOD 384config ARCH_KIRKWOOD
367 bool "Marvell Kirkwood" 385 bool "Marvell Kirkwood"
386 select CPU_FEROCEON
368 select PCI 387 select PCI
369 select GENERIC_TIME 388 select GENERIC_TIME
370 select GENERIC_CLOCKEVENTS 389 select GENERIC_CLOCKEVENTS
@@ -375,6 +394,7 @@ config ARCH_KIRKWOOD
375 394
376config ARCH_KS8695 395config ARCH_KS8695
377 bool "Micrel/Kendin KS8695" 396 bool "Micrel/Kendin KS8695"
397 select CPU_ARM922T
378 select GENERIC_GPIO 398 select GENERIC_GPIO
379 help 399 help
380 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based 400 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
@@ -382,6 +402,7 @@ config ARCH_KS8695
382 402
383config ARCH_NS9XXX 403config ARCH_NS9XXX
384 bool "NetSilicon NS9xxx" 404 bool "NetSilicon NS9xxx"
405 select CPU_ARM926T
385 select GENERIC_GPIO 406 select GENERIC_GPIO
386 select GENERIC_TIME 407 select GENERIC_TIME
387 select GENERIC_CLOCKEVENTS 408 select GENERIC_CLOCKEVENTS
@@ -394,6 +415,7 @@ config ARCH_NS9XXX
394 415
395config ARCH_LOKI 416config ARCH_LOKI
396 bool "Marvell Loki (88RC8480)" 417 bool "Marvell Loki (88RC8480)"
418 select CPU_FEROCEON
397 select GENERIC_TIME 419 select GENERIC_TIME
398 select GENERIC_CLOCKEVENTS 420 select GENERIC_CLOCKEVENTS
399 select PLAT_ORION 421 select PLAT_ORION
@@ -402,6 +424,7 @@ config ARCH_LOKI
402 424
403config ARCH_MV78XX0 425config ARCH_MV78XX0
404 bool "Marvell MV78xx0" 426 bool "Marvell MV78xx0"
427 select CPU_FEROCEON
405 select PCI 428 select PCI
406 select GENERIC_TIME 429 select GENERIC_TIME
407 select GENERIC_CLOCKEVENTS 430 select GENERIC_CLOCKEVENTS
@@ -423,6 +446,7 @@ config ARCH_MXC
423config ARCH_ORION5X 446config ARCH_ORION5X
424 bool "Marvell Orion" 447 bool "Marvell Orion"
425 depends on MMU 448 depends on MMU
449 select CPU_FEROCEON
426 select PCI 450 select PCI
427 select GENERIC_GPIO 451 select GENERIC_GPIO
428 select GENERIC_TIME 452 select GENERIC_TIME
@@ -435,6 +459,7 @@ config ARCH_ORION5X
435 459
436config ARCH_PNX4008 460config ARCH_PNX4008
437 bool "Philips Nexperia PNX4008 Mobile" 461 bool "Philips Nexperia PNX4008 Mobile"
462 select CPU_ARM926T
438 select HAVE_CLK 463 select HAVE_CLK
439 help 464 help
440 This enables support for Philips PNX4008 mobile platform. 465 This enables support for Philips PNX4008 mobile platform.
@@ -445,6 +470,7 @@ config ARCH_PXA
445 select ARCH_MTD_XIP 470 select ARCH_MTD_XIP
446 select GENERIC_GPIO 471 select GENERIC_GPIO
447 select HAVE_CLK 472 select HAVE_CLK
473 select COMMON_CLKDEV
448 select ARCH_REQUIRE_GPIOLIB 474 select ARCH_REQUIRE_GPIOLIB
449 select GENERIC_TIME 475 select GENERIC_TIME
450 select GENERIC_CLOCKEVENTS 476 select GENERIC_CLOCKEVENTS
@@ -468,6 +494,7 @@ config ARCH_RPC
468 494
469config ARCH_SA1100 495config ARCH_SA1100
470 bool "SA1100-based" 496 bool "SA1100-based"
497 select CPU_SA1100
471 select ISA 498 select ISA
472 select ARCH_SPARSEMEM_ENABLE 499 select ARCH_SPARSEMEM_ENABLE
473 select ARCH_MTD_XIP 500 select ARCH_MTD_XIP
@@ -491,6 +518,7 @@ config ARCH_S3C2410
491 518
492config ARCH_SHARK 519config ARCH_SHARK
493 bool "Shark" 520 bool "Shark"
521 select CPU_SA110
494 select ISA 522 select ISA
495 select ISA_DMA 523 select ISA_DMA
496 select ZONE_DMA 524 select ZONE_DMA
@@ -501,6 +529,7 @@ config ARCH_SHARK
501 529
502config ARCH_LH7A40X 530config ARCH_LH7A40X
503 bool "Sharp LH7A40X" 531 bool "Sharp LH7A40X"
532 select CPU_ARM922T
504 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM 533 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
505 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 534 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
506 help 535 help
@@ -511,6 +540,7 @@ config ARCH_LH7A40X
511 540
512config ARCH_DAVINCI 541config ARCH_DAVINCI
513 bool "TI DaVinci" 542 bool "TI DaVinci"
543 select CPU_ARM926T
514 select GENERIC_TIME 544 select GENERIC_TIME
515 select GENERIC_CLOCKEVENTS 545 select GENERIC_CLOCKEVENTS
516 select GENERIC_GPIO 546 select GENERIC_GPIO
@@ -532,6 +562,7 @@ config ARCH_OMAP
532 562
533config ARCH_MSM 563config ARCH_MSM
534 bool "Qualcomm MSM" 564 bool "Qualcomm MSM"
565 select CPU_V6
535 select GENERIC_TIME 566 select GENERIC_TIME
536 select GENERIC_CLOCKEVENTS 567 select GENERIC_CLOCKEVENTS
537 help 568 help
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 65ce8fff29d..3fc08413fff 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -86,6 +86,8 @@ static void putstr(const char *ptr)
86 86
87#define __ptr_t void * 87#define __ptr_t void *
88 88
89#define memzero(s,n) __memzero(s,n)
90
89/* 91/*
90 * Optimised C version of memzero for the ARM. 92 * Optimised C version of memzero for the ARM.
91 */ 93 */
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 86b5e698266..a2cd9beaf37 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -33,3 +33,6 @@ config SHARPSL_PM
33 33
34config SHARP_SCOOP 34config SHARP_SCOOP
35 bool 35 bool
36
37config COMMON_CLKDEV
38 bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 325e4b6a6af..7cb7961d81c 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o
17obj-$(CONFIG_ARCH_IXP2000) += uengine.o 17obj-$(CONFIG_ARCH_IXP2000) += uengine.o
18obj-$(CONFIG_ARCH_IXP23XX) += uengine.o 18obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
19obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 19obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
20obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
new file mode 100644
index 00000000000..17a17b49a45
--- /dev/null
+++ b/arch/arm/common/clkdev.c
@@ -0,0 +1,128 @@
1/*
2 * arch/arm/common/clkdev.c
3 *
4 * Copyright (C) 2008 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Helper for the clk API to assist looking up a struct clk.
11 */
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/device.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/string.h>
19#include <linux/mutex.h>
20
21#include <asm/clkdev.h>
22#include <mach/clkdev.h>
23
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27static struct clk *clk_find(const char *dev_id, const char *con_id)
28{
29 struct clk_lookup *p;
30 struct clk *clk = NULL;
31 int match, best = 0;
32
33 list_for_each_entry(p, &clocks, node) {
34 if ((p->dev_id && !dev_id) || (p->con_id && !con_id))
35 continue;
36 match = 0;
37 if (p->dev_id)
38 match += 2 * (strcmp(p->dev_id, dev_id) == 0);
39 if (p->con_id)
40 match += 1 * (strcmp(p->con_id, con_id) == 0);
41 if (match == 0)
42 continue;
43
44 if (match > best) {
45 clk = p->clk;
46 best = match;
47 }
48 }
49 return clk;
50}
51
52struct clk *clk_get(struct device *dev, const char *con_id)
53{
54 const char *dev_id = dev ? dev_name(dev) : NULL;
55 struct clk *clk;
56
57 mutex_lock(&clocks_mutex);
58 clk = clk_find(dev_id, con_id);
59 if (clk && !__clk_get(clk))
60 clk = NULL;
61 mutex_unlock(&clocks_mutex);
62
63 return clk ? clk : ERR_PTR(-ENOENT);
64}
65EXPORT_SYMBOL(clk_get);
66
67void clk_put(struct clk *clk)
68{
69 __clk_put(clk);
70}
71EXPORT_SYMBOL(clk_put);
72
73void clkdev_add(struct clk_lookup *cl)
74{
75 mutex_lock(&clocks_mutex);
76 list_add_tail(&cl->node, &clocks);
77 mutex_unlock(&clocks_mutex);
78}
79EXPORT_SYMBOL(clkdev_add);
80
81#define MAX_DEV_ID 20
82#define MAX_CON_ID 16
83
84struct clk_lookup_alloc {
85 struct clk_lookup cl;
86 char dev_id[MAX_DEV_ID];
87 char con_id[MAX_CON_ID];
88};
89
90struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
91 const char *dev_fmt, ...)
92{
93 struct clk_lookup_alloc *cla;
94
95 cla = kzalloc(sizeof(*cla), GFP_KERNEL);
96 if (!cla)
97 return NULL;
98
99 cla->cl.clk = clk;
100 if (con_id) {
101 strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
102 cla->cl.con_id = cla->con_id;
103 }
104
105 if (dev_fmt) {
106 va_list ap;
107
108 va_start(ap, dev_fmt);
109 vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
110 cla->cl.dev_id = cla->dev_id;
111 va_end(ap);
112 }
113
114 return &cla->cl;
115}
116EXPORT_SYMBOL(clkdev_alloc);
117
118/*
119 * clkdev_drop - remove a clock dynamically allocated
120 */
121void clkdev_drop(struct clk_lookup *cl)
122{
123 mutex_lock(&clocks_mutex);
124 list_del(&cl->node);
125 mutex_unlock(&clocks_mutex);
126 kfree(cl);
127}
128EXPORT_SYMBOL(clkdev_drop);
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
new file mode 100644
index 00000000000..b6ec7c627b3
--- /dev/null
+++ b/arch/arm/include/asm/clkdev.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/include/asm/clkdev.h
3 *
4 * Copyright (C) 2008 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Helper for the clk API to assist looking up a struct clk.
11 */
12#ifndef __ASM_CLKDEV_H
13#define __ASM_CLKDEV_H
14
15struct clk;
16
17struct clk_lookup {
18 struct list_head node;
19 const char *dev_id;
20 const char *con_id;
21 struct clk *clk;
22};
23
24struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
25 const char *dev_fmt, ...);
26
27void clkdev_add(struct clk_lookup *cl);
28void clkdev_drop(struct clk_lookup *cl);
29
30#endif
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index bed1c0a0036..5fee45e2303 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -133,7 +133,7 @@ extern void __cpu_copy_user_page(void *to, const void *from,
133#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr) 133#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr)
134#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr) 134#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr)
135 135
136#define clear_page(page) memzero((void *)(page), PAGE_SIZE) 136#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
137extern void copy_page(void *to, const void *from); 137extern void copy_page(void *to, const void *from);
138 138
139#undef STRICT_MM_TYPECHECKS 139#undef STRICT_MM_TYPECHECKS
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 517a4d6ffc7..2320508443a 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -64,7 +64,7 @@ struct thread_struct {
64({ \ 64({ \
65 unsigned long *stack = (unsigned long *)sp; \ 65 unsigned long *stack = (unsigned long *)sp; \
66 set_fs(USER_DS); \ 66 set_fs(USER_DS); \
67 memzero(regs->uregs, sizeof(regs->uregs)); \ 67 memset(regs->uregs, 0, sizeof(regs->uregs)); \
68 if (current->personality & ADDR_LIMIT_32BIT) \ 68 if (current->personality & ADDR_LIMIT_32BIT) \
69 regs->ARM_cpsr = USR_MODE; \ 69 regs->ARM_cpsr = USR_MODE; \
70 else \ 70 else \
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h
index e50c4a39b69..cf4f3aad0fc 100644
--- a/arch/arm/include/asm/string.h
+++ b/arch/arm/include/asm/string.h
@@ -21,7 +21,6 @@ extern void * memmove(void *, const void *, __kernel_size_t);
21#define __HAVE_ARCH_MEMCHR 21#define __HAVE_ARCH_MEMCHR
22extern void * memchr(const void *, int, __kernel_size_t); 22extern void * memchr(const void *, int, __kernel_size_t);
23 23
24#define __HAVE_ARCH_MEMZERO
25#define __HAVE_ARCH_MEMSET 24#define __HAVE_ARCH_MEMSET
26extern void * memset(void *, int, __kernel_size_t); 25extern void * memset(void *, int, __kernel_size_t);
27 26
@@ -39,12 +38,4 @@ extern void __memzero(void *ptr, __kernel_size_t n);
39 (__p); \ 38 (__p); \
40 }) 39 })
41 40
42#define memzero(p,n) \
43 ({ \
44 void *__p = (p); size_t __n = n; \
45 if ((__n) != 0) \
46 __memzero((__p),(__n)); \
47 (__p); \
48 })
49
50#endif 41#endif
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index e98ec60b340..cbb7a37e297 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -400,7 +400,7 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
400 if (access_ok(VERIFY_READ, from, n)) 400 if (access_ok(VERIFY_READ, from, n))
401 n = __copy_from_user(to, from, n); 401 n = __copy_from_user(to, from, n);
402 else /* security hole - plug it */ 402 else /* security hole - plug it */
403 memzero(to, n); 403 memset(to, 0, n);
404 return n; 404 return n;
405} 405}
406 406
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 761eefa7624..650d5923ab8 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -25,7 +25,7 @@
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) 25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
26/* 26/*
27 * The pointer is now aligned and the length is adjusted. Try doing the 27 * The pointer is now aligned and the length is adjusted. Try doing the
28 * memzero again. 28 * memset again.
29 */ 29 */
30 30
31ENTRY(memset) 31ENTRY(memset)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 5aafb2e2ca7..95dc71aaa66 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -7,36 +7,43 @@ choice
7 7
8config ARCH_AT91RM9200 8config ARCH_AT91RM9200
9 bool "AT91RM9200" 9 bool "AT91RM9200"
10 select CPU_ARM920T
10 select GENERIC_TIME 11 select GENERIC_TIME
11 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
12 13
13config ARCH_AT91SAM9260 14config ARCH_AT91SAM9260
14 bool "AT91SAM9260 or AT91SAM9XE" 15 bool "AT91SAM9260 or AT91SAM9XE"
16 select CPU_ARM926T
15 select GENERIC_TIME 17 select GENERIC_TIME
16 select GENERIC_CLOCKEVENTS 18 select GENERIC_CLOCKEVENTS
17 19
18config ARCH_AT91SAM9261 20config ARCH_AT91SAM9261
19 bool "AT91SAM9261" 21 bool "AT91SAM9261"
22 select CPU_ARM926T
20 select GENERIC_TIME 23 select GENERIC_TIME
21 select GENERIC_CLOCKEVENTS 24 select GENERIC_CLOCKEVENTS
22 25
23config ARCH_AT91SAM9263 26config ARCH_AT91SAM9263
24 bool "AT91SAM9263" 27 bool "AT91SAM9263"
28 select CPU_ARM926T
25 select GENERIC_TIME 29 select GENERIC_TIME
26 select GENERIC_CLOCKEVENTS 30 select GENERIC_CLOCKEVENTS
27 31
28config ARCH_AT91SAM9RL 32config ARCH_AT91SAM9RL
29 bool "AT91SAM9RL" 33 bool "AT91SAM9RL"
34 select CPU_ARM926T
30 select GENERIC_TIME 35 select GENERIC_TIME
31 select GENERIC_CLOCKEVENTS 36 select GENERIC_CLOCKEVENTS
32 37
33config ARCH_AT91SAM9G20 38config ARCH_AT91SAM9G20
34 bool "AT91SAM9G20" 39 bool "AT91SAM9G20"
40 select CPU_ARM926T
35 select GENERIC_TIME 41 select GENERIC_TIME
36 select GENERIC_CLOCKEVENTS 42 select GENERIC_CLOCKEVENTS
37 43
38config ARCH_AT91CAP9 44config ARCH_AT91CAP9
39 bool "AT91CAP9" 45 bool "AT91CAP9"
46 select CPU_ARM926T
40 select GENERIC_TIME 47 select GENERIC_TIME
41 select GENERIC_CLOCKEVENTS 48 select GENERIC_CLOCKEVENTS
42 49
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c
index 8d761fdd2ec..989ecf5f5c4 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/mach-integrator/clock.c
@@ -10,42 +10,12 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/list.h>
14#include <linux/errno.h> 13#include <linux/errno.h>
15#include <linux/err.h>
16#include <linux/string.h>
17#include <linux/clk.h> 14#include <linux/clk.h>
18#include <linux/mutex.h> 15#include <linux/mutex.h>
19 16
20#include <asm/hardware/icst525.h> 17#include <asm/clkdev.h>
21 18#include <mach/clkdev.h>
22#include "clock.h"
23
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27struct clk *clk_get(struct device *dev, const char *id)
28{
29 struct clk *p, *clk = ERR_PTR(-ENOENT);
30
31 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p;
35 break;
36 }
37 }
38 mutex_unlock(&clocks_mutex);
39
40 return clk;
41}
42EXPORT_SYMBOL(clk_get);
43
44void clk_put(struct clk *clk)
45{
46 module_put(clk->owner);
47}
48EXPORT_SYMBOL(clk_put);
49 19
50int clk_enable(struct clk *clk) 20int clk_enable(struct clk *clk)
51{ 21{
@@ -67,7 +37,6 @@ EXPORT_SYMBOL(clk_get_rate);
67long clk_round_rate(struct clk *clk, unsigned long rate) 37long clk_round_rate(struct clk *clk, unsigned long rate)
68{ 38{
69 struct icst525_vco vco; 39 struct icst525_vco vco;
70
71 vco = icst525_khz_to_vco(clk->params, rate / 1000); 40 vco = icst525_khz_to_vco(clk->params, rate / 1000);
72 return icst525_khz(clk->params, vco) * 1000; 41 return icst525_khz(clk->params, vco) * 1000;
73} 42}
@@ -76,56 +45,15 @@ EXPORT_SYMBOL(clk_round_rate);
76int clk_set_rate(struct clk *clk, unsigned long rate) 45int clk_set_rate(struct clk *clk, unsigned long rate)
77{ 46{
78 int ret = -EIO; 47 int ret = -EIO;
48
79 if (clk->setvco) { 49 if (clk->setvco) {
80 struct icst525_vco vco; 50 struct icst525_vco vco;
81 51
82 vco = icst525_khz_to_vco(clk->params, rate / 1000); 52 vco = icst525_khz_to_vco(clk->params, rate / 1000);
83 clk->rate = icst525_khz(clk->params, vco) * 1000; 53 clk->rate = icst525_khz(clk->params, vco) * 1000;
84
85 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
86 clk->name, vco.s, vco.r, vco.v);
87
88 clk->setvco(clk, vco); 54 clk->setvco(clk, vco);
89 ret = 0; 55 ret = 0;
90 } 56 }
91 return 0; 57 return ret;
92} 58}
93EXPORT_SYMBOL(clk_set_rate); 59EXPORT_SYMBOL(clk_set_rate);
94
95/*
96 * These are fixed clocks.
97 */
98static struct clk kmi_clk = {
99 .name = "KMIREFCLK",
100 .rate = 24000000,
101};
102
103static struct clk uart_clk = {
104 .name = "UARTCLK",
105 .rate = 14745600,
106};
107
108int clk_register(struct clk *clk)
109{
110 mutex_lock(&clocks_mutex);
111 list_add(&clk->node, &clocks);
112 mutex_unlock(&clocks_mutex);
113 return 0;
114}
115EXPORT_SYMBOL(clk_register);
116
117void clk_unregister(struct clk *clk)
118{
119 mutex_lock(&clocks_mutex);
120 list_del(&clk->node);
121 mutex_unlock(&clocks_mutex);
122}
123EXPORT_SYMBOL(clk_unregister);
124
125static int __init clk_init(void)
126{
127 clk_register(&kmi_clk);
128 clk_register(&uart_clk);
129 return 0;
130}
131arch_initcall(clk_init);
diff --git a/arch/arm/mach-integrator/clock.h b/arch/arm/mach-integrator/clock.h
index 09e6328ceba..e69de29bb2d 100644
--- a/arch/arm/mach-integrator/clock.h
+++ b/arch/arm/mach-integrator/clock.h
@@ -1,25 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/clock.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11struct module;
12struct icst525_params;
13
14struct clk {
15 struct list_head node;
16 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst525_params *params;
20 void *data;
21 void (*setvco)(struct clk *, struct icst525_vco vco);
22};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 595b7392ee4..c89c949b4d4 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -21,6 +21,8 @@
21#include <linux/amba/serial.h> 21#include <linux/amba/serial.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <asm/clkdev.h>
25#include <mach/clkdev.h>
24#include <mach/hardware.h> 26#include <mach/hardware.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
26#include <asm/hardware/arm_timer.h> 28#include <asm/hardware/arm_timer.h>
@@ -108,10 +110,43 @@ static struct amba_device *amba_devs[] __initdata = {
108 &kmi1_device, 110 &kmi1_device,
109}; 111};
110 112
113/*
114 * These are fixed clocks.
115 */
116static struct clk clk24mhz = {
117 .rate = 24000000,
118};
119
120static struct clk uartclk = {
121 .rate = 14745600,
122};
123
124static struct clk_lookup lookups[] __initdata = {
125 { /* UART0 */
126 .dev_id = "mb:16",
127 .clk = &uartclk,
128 }, { /* UART1 */
129 .dev_id = "mb:17",
130 .clk = &uartclk,
131 }, { /* KMI0 */
132 .dev_id = "mb:18",
133 .clk = &clk24mhz,
134 }, { /* KMI1 */
135 .dev_id = "mb:19",
136 .clk = &clk24mhz,
137 }, { /* MMCI - IntegratorCP */
138 .dev_id = "mb:1c",
139 .clk = &uartclk,
140 }
141};
142
111static int __init integrator_init(void) 143static int __init integrator_init(void)
112{ 144{
113 int i; 145 int i;
114 146
147 for (i = 0; i < ARRAY_SIZE(lookups); i++)
148 clkdev_add(&lookups[i]);
149
115 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 150 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
116 struct amba_device *d = amba_devs[i]; 151 struct amba_device *d = amba_devs[i];
117 amba_device_register(d, &iomem_resource); 152 amba_device_register(d, &iomem_resource);
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 172299a7830..0058c937719 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -22,13 +22,13 @@
22#include <linux/amba/clcd.h> 22#include <linux/amba/clcd.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <asm/clkdev.h>
26#include <mach/clkdev.h>
25#include <asm/hardware/icst525.h> 27#include <asm/hardware/icst525.h>
26#include <mach/lm.h> 28#include <mach/lm.h>
27#include <mach/impd1.h> 29#include <mach/impd1.h>
28#include <asm/sizes.h> 30#include <asm/sizes.h>
29 31
30#include "clock.h"
31
32static int module_id; 32static int module_id;
33 33
34module_param_named(lmid, module_id, int, 0444); 34module_param_named(lmid, module_id, int, 0444);
@@ -37,6 +37,7 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
37struct impd1_module { 37struct impd1_module {
38 void __iomem *base; 38 void __iomem *base;
39 struct clk vcos[2]; 39 struct clk vcos[2];
40 struct clk_lookup *clks[3];
40}; 41};
41 42
42static const struct icst525_params impd1_vco_params = { 43static const struct icst525_params impd1_vco_params = {
@@ -339,9 +340,8 @@ static struct impd1_device impd1_devs[] = {
339 } 340 }
340}; 341};
341 342
342static const char *impd1_vconames[2] = { 343static struct clk fixed_14745600 = {
343 "CLCDCLK", 344 .rate = 14745600,
344 "AUXVCO2",
345}; 345};
346 346
347static int impd1_probe(struct lm_device *dev) 347static int impd1_probe(struct lm_device *dev)
@@ -374,14 +374,20 @@ static int impd1_probe(struct lm_device *dev)
374 374
375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 375 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
376 impd1->vcos[i].owner = THIS_MODULE, 376 impd1->vcos[i].owner = THIS_MODULE,
377 impd1->vcos[i].name = impd1_vconames[i],
378 impd1->vcos[i].params = &impd1_vco_params, 377 impd1->vcos[i].params = &impd1_vco_params,
379 impd1->vcos[i].data = impd1, 378 impd1->vcos[i].data = impd1,
380 impd1->vcos[i].setvco = impd1_setvco; 379 impd1->vcos[i].setvco = impd1_setvco;
381
382 clk_register(&impd1->vcos[i]);
383 } 380 }
384 381
382 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
383 dev->id);
384 impd1->clks[1] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00100",
385 dev->id);
386 impd1->clks[2] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00200",
387 dev->id);
388 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
389 clkdev_add(impd1->clks[i]);
390
385 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { 391 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
386 struct impd1_device *idev = impd1_devs + i; 392 struct impd1_device *idev = impd1_devs + i;
387 struct amba_device *d; 393 struct amba_device *d;
@@ -434,8 +440,8 @@ static void impd1_remove(struct lm_device *dev)
434 440
435 device_for_each_child(&dev->dev, NULL, impd1_remove_one); 441 device_for_each_child(&dev->dev, NULL, impd1_remove_one);
436 442
437 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) 443 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
438 clk_unregister(&impd1->vcos[i]); 444 clkdev_drop(impd1->clks[i]);
439 445
440 lm_set_drvdata(dev, NULL); 446 lm_set_drvdata(dev, NULL);
441 447
diff --git a/arch/arm/mach-integrator/include/mach/clkdev.h b/arch/arm/mach-integrator/include/mach/clkdev.h
new file mode 100644
index 00000000000..9293e410832
--- /dev/null
+++ b/arch/arm/mach-integrator/include/mach/clkdev.h
@@ -0,0 +1,25 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#include <linux/module.h>
5#include <asm/hardware/icst525.h>
6
7struct clk {
8 unsigned long rate;
9 struct module *owner;
10 const struct icst525_params *params;
11 void *data;
12 void (*setvco)(struct clk *, struct icst525_vco vco);
13};
14
15static inline int __clk_get(struct clk *clk)
16{
17 return try_module_get(clk->owner);
18}
19
20static inline void __clk_put(struct clk *clk)
21{
22 module_put(clk->owner);
23}
24
25#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 88026ccd5ac..427c2d8dc12 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -21,6 +21,8 @@
21#include <linux/amba/clcd.h> 21#include <linux/amba/clcd.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <asm/clkdev.h>
25#include <mach/clkdev.h>
24#include <mach/hardware.h> 26#include <mach/hardware.h>
25#include <asm/irq.h> 27#include <asm/irq.h>
26#include <asm/setup.h> 28#include <asm/setup.h>
@@ -38,7 +40,6 @@
38#include <asm/mach/time.h> 40#include <asm/mach/time.h>
39 41
40#include "common.h" 42#include "common.h"
41#include "clock.h"
42 43
43#define INTCP_PA_MMC_BASE 0x1c000000 44#define INTCP_PA_MMC_BASE 0x1c000000
44#define INTCP_PA_AACI_BASE 0x1d000000 45#define INTCP_PA_AACI_BASE 0x1d000000
@@ -289,15 +290,16 @@ static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco)
289 writel(0, CM_LOCK); 290 writel(0, CM_LOCK);
290} 291}
291 292
292static struct clk cp_clcd_clk = { 293static struct clk cp_auxclk = {
293 .name = "CLCDCLK",
294 .params = &cp_auxvco_params, 294 .params = &cp_auxvco_params,
295 .setvco = cp_auxvco_set, 295 .setvco = cp_auxvco_set,
296}; 296};
297 297
298static struct clk cp_mmci_clk = { 298static struct clk_lookup cp_lookups[] = {
299 .name = "MCLK", 299 { /* CLCD */
300 .rate = 14745600, 300 .dev_id = "mb:c0",
301 .clk = &cp_auxclk,
302 },
301}; 303};
302 304
303/* 305/*
@@ -554,8 +556,8 @@ static void __init intcp_init(void)
554{ 556{
555 int i; 557 int i;
556 558
557 clk_register(&cp_clcd_clk); 559 for (i = 0; i < ARRAY_SIZE(cp_lookups); i++)
558 clk_register(&cp_mmci_clk); 560 clkdev_add(&cp_lookups[i]);
559 561
560 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); 562 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
561 563
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 79f0b1f8497..10a301e3243 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -4,16 +4,19 @@ comment "OMAP Core Type"
4config ARCH_OMAP730 4config ARCH_OMAP730
5 depends on ARCH_OMAP1 5 depends on ARCH_OMAP1
6 bool "OMAP730 Based System" 6 bool "OMAP730 Based System"
7 select CPU_ARM926T
7 select ARCH_OMAP_OTG 8 select ARCH_OMAP_OTG
8 9
9config ARCH_OMAP15XX 10config ARCH_OMAP15XX
10 depends on ARCH_OMAP1 11 depends on ARCH_OMAP1
11 default y 12 default y
12 bool "OMAP15xx Based System" 13 bool "OMAP15xx Based System"
14 select CPU_ARM925T
13 15
14config ARCH_OMAP16XX 16config ARCH_OMAP16XX
15 depends on ARCH_OMAP1 17 depends on ARCH_OMAP1
16 bool "OMAP16xx Based System" 18 bool "OMAP16xx Based System"
19 select CPU_ARM926T
17 select ARCH_OMAP_OTG 20 select ARCH_OMAP_OTG
18 21
19comment "OMAP Board Type" 22comment "OMAP Board Type"
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index a062235e83a..740f0a382ba 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -386,16 +386,19 @@ endmenu
386 386
387config PXA25x 387config PXA25x
388 bool 388 bool
389 select CPU_XSCALE
389 help 390 help
390 Select code specific to PXA21x/25x/26x variants 391 Select code specific to PXA21x/25x/26x variants
391 392
392config PXA27x 393config PXA27x
393 bool 394 bool
395 select CPU_XSCALE
394 help 396 help
395 Select code specific to PXA27x variants 397 Select code specific to PXA27x variants
396 398
397config PXA3xx 399config PXA3xx
398 bool 400 bool
401 select CPU_XSC3
399 help 402 help
400 Select code specific to PXA3xx variants 403 Select code specific to PXA3xx variants
401 404
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index ca8e2053815..a3e0e1989a6 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -12,6 +12,7 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14 14
15#include <asm/clkdev.h>
15#include <mach/pxa2xx-regs.h> 16#include <mach/pxa2xx-regs.h>
16#include <mach/pxa2xx-gpio.h> 17#include <mach/pxa2xx-gpio.h>
17#include <mach/hardware.h> 18#include <mach/hardware.h>
@@ -20,45 +21,8 @@
20#include "generic.h" 21#include "generic.h"
21#include "clock.h" 22#include "clock.h"
22 23
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25static DEFINE_SPINLOCK(clocks_lock); 24static DEFINE_SPINLOCK(clocks_lock);
26 25
27static struct clk *clk_lookup(struct device *dev, const char *id)
28{
29 struct clk *p;
30
31 list_for_each_entry(p, &clocks, node)
32 if (strcmp(id, p->name) == 0 && p->dev == dev)
33 return p;
34
35 return NULL;
36}
37
38struct clk *clk_get(struct device *dev, const char *id)
39{
40 struct clk *p, *clk = ERR_PTR(-ENOENT);
41
42 mutex_lock(&clocks_mutex);
43 p = clk_lookup(dev, id);
44 if (!p)
45 p = clk_lookup(NULL, id);
46 if (p)
47 clk = p;
48 mutex_unlock(&clocks_mutex);
49
50 if (!IS_ERR(clk) && clk->ops == NULL)
51 clk = clk->other;
52
53 return clk;
54}
55EXPORT_SYMBOL(clk_get);
56
57void clk_put(struct clk *clk)
58{
59}
60EXPORT_SYMBOL(clk_put);
61
62int clk_enable(struct clk *clk) 26int clk_enable(struct clk *clk)
63{ 27{
64 unsigned long flags; 28 unsigned long flags;
@@ -116,37 +80,27 @@ const struct clkops clk_cken_ops = {
116 .disable = clk_cken_disable, 80 .disable = clk_cken_disable,
117}; 81};
118 82
119void clks_register(struct clk *clks, size_t num) 83void clks_register(struct clk_lookup *clks, size_t num)
120{ 84{
121 int i; 85 int i;
122 86
123 mutex_lock(&clocks_mutex);
124 for (i = 0; i < num; i++) 87 for (i = 0; i < num; i++)
125 list_add(&clks[i].node, &clocks); 88 clkdev_add(&clks[i]);
126 mutex_unlock(&clocks_mutex);
127} 89}
128 90
129int clk_add_alias(char *alias, struct device *alias_dev, char *id, 91int clk_add_alias(char *alias, struct device *alias_dev, char *id,
130 struct device *dev) 92 struct device *dev)
131{ 93{
132 struct clk *r = clk_lookup(dev, id); 94 struct clk *r = clk_get(dev, id);
133 struct clk *new; 95 struct clk_lookup *l;
134 96
135 if (!r) 97 if (!r)
136 return -ENODEV; 98 return -ENODEV;
137 99
138 new = kzalloc(sizeof(struct clk), GFP_KERNEL); 100 l = clkdev_alloc(r, alias, alias_dev ? dev_name(alias_dev) : NULL);
139 101 clk_put(r);
140 if (!new) 102 if (!l)
141 return -ENOMEM; 103 return -ENODEV;
142 104 clkdev_add(l);
143 new->name = alias;
144 new->dev = alias_dev;
145 new->other = r;
146
147 mutex_lock(&clocks_mutex);
148 list_add(&new->node, &clocks);
149 mutex_unlock(&clocks_mutex);
150
151 return 0; 105 return 0;
152} 106}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 73be795fe3b..4e9c613c676 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -1,6 +1,4 @@
1#include <linux/list.h> 1#include <asm/clkdev.h>
2
3struct clk;
4 2
5struct clkops { 3struct clkops {
6 void (*enable)(struct clk *); 4 void (*enable)(struct clk *);
@@ -9,9 +7,6 @@ struct clkops {
9}; 7};
10 8
11struct clk { 9struct clk {
12 struct list_head node;
13 const char *name;
14 struct device *dev;
15 const struct clkops *ops; 10 const struct clkops *ops;
16 unsigned long rate; 11 unsigned long rate;
17 unsigned int cken; 12 unsigned int cken;
@@ -20,41 +15,31 @@ struct clk {
20 struct clk *other; 15 struct clk *other;
21}; 16};
22 17
23#define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \ 18#define INIT_CLKREG(_clk,_devname,_conname) \
24 { \ 19 { \
25 .name = _name, \ 20 .clk = _clk, \
26 .dev = _dev, \ 21 .dev_id = _devname, \
22 .con_id = _conname, \
23 }
24
25#define DEFINE_CKEN(_name, _cken, _rate, _delay) \
26struct clk clk_##_name = { \
27 .ops = &clk_cken_ops, \ 27 .ops = &clk_cken_ops, \
28 .rate = _rate, \ 28 .rate = _rate, \
29 .cken = CKEN_##_cken, \ 29 .cken = CKEN_##_cken, \
30 .delay = _delay, \ 30 .delay = _delay, \
31 } 31 }
32 32
33#define INIT_CK(_name, _cken, _ops, _dev) \ 33#define DEFINE_CK(_name, _cken, _ops) \
34 { \ 34struct clk clk_##_name = { \
35 .name = _name, \
36 .dev = _dev, \
37 .ops = _ops, \ 35 .ops = _ops, \
38 .cken = CKEN_##_cken, \ 36 .cken = CKEN_##_cken, \
39 } 37 }
40 38
41/* 39#define DEFINE_CLK(_name, _ops, _rate, _delay) \
42 * This is a placeholder to alias one clock device+name pair 40struct clk clk_##_name = { \
43 * to another struct clk. 41 .ops = _ops, \
44 */ 42 .rate = _rate, \
45#define INIT_CKOTHER(_name, _other, _dev) \
46 { \
47 .name = _name, \
48 .dev = _dev, \
49 .other = _other, \
50 }
51
52#define INIT_CLK(_name, _ops, _rate, _delay, _dev) \
53 { \
54 .name = _name, \
55 .dev = _dev, \
56 .ops = _ops, \
57 .rate = _rate, \
58 .delay = _delay, \ 43 .delay = _delay, \
59 } 44 }
60 45
@@ -64,20 +49,16 @@ void clk_cken_enable(struct clk *clk);
64void clk_cken_disable(struct clk *clk); 49void clk_cken_disable(struct clk *clk);
65 50
66#ifdef CONFIG_PXA3xx 51#ifdef CONFIG_PXA3xx
67#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ 52#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
68 { \ 53struct clk clk_##_name = { \
69 .name = _name, \
70 .dev = _dev, \
71 .ops = &clk_pxa3xx_cken_ops, \ 54 .ops = &clk_pxa3xx_cken_ops, \
72 .rate = _rate, \ 55 .rate = _rate, \
73 .cken = CKEN_##_cken, \ 56 .cken = CKEN_##_cken, \
74 .delay = _delay, \ 57 .delay = _delay, \
75 } 58 }
76 59
77#define PXA3xx_CK(_name, _cken, _ops, _dev) \ 60#define DEFINE_PXA3_CK(_name, _cken, _ops) \
78 { \ 61struct clk clk_##_name = { \
79 .name = _name, \
80 .dev = _dev, \
81 .ops = _ops, \ 62 .ops = _ops, \
82 .cken = CKEN_##_cken, \ 63 .cken = CKEN_##_cken, \
83 } 64 }
@@ -87,7 +68,7 @@ extern void clk_pxa3xx_cken_enable(struct clk *);
87extern void clk_pxa3xx_cken_disable(struct clk *); 68extern void clk_pxa3xx_cken_disable(struct clk *);
88#endif 69#endif
89 70
90void clks_register(struct clk *clks, size_t num); 71void clks_register(struct clk_lookup *clks, size_t num);
91int clk_add_alias(char *alias, struct device *alias_dev, char *id, 72int clk_add_alias(char *alias, struct device *alias_dev, char *id,
92 struct device *dev); 73 struct device *dev);
93 74
diff --git a/arch/arm/mach-pxa/include/mach/clkdev.h b/arch/arm/mach-pxa/include/mach/clkdev.h
new file mode 100644
index 00000000000..04b37a89801
--- /dev/null
+++ b/arch/arm/mach-pxa/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-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
index 74e2ead8cee..3ca7ffc6904 100644
--- a/arch/arm/mach-pxa/pwm.c
+++ b/arch/arm/mach-pxa/pwm.c
@@ -173,7 +173,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
173 return ERR_PTR(-ENOMEM); 173 return ERR_PTR(-ENOMEM);
174 } 174 }
175 175
176 pwm->clk = clk_get(&pdev->dev, "PWMCLK"); 176 pwm->clk = clk_get(&pdev->dev, NULL);
177 if (IS_ERR(pwm->clk)) { 177 if (IS_ERR(pwm->clk)) {
178 ret = PTR_ERR(pwm->clk); 178 ret = PTR_ERR(pwm->clk);
179 goto err_free; 179 goto err_free;
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 25d17a1dab7..344b3282caf 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -167,36 +167,51 @@ static const struct clkops clk_pxa25x_gpio11_ops = {
167 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz 167 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
168 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly) 168 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
169 */ 169 */
170static struct clk pxa25x_hwuart_clk = 170static DEFINE_CKEN(pxa25x_hwuart, HWUART, 14745600, 1);
171 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev) 171
172; 172static struct clk_lookup pxa25x_hwuart_clkreg =
173 INIT_CLKREG(&clk_pxa25x_hwuart, "pxa2xx-uart.3", NULL);
173 174
174/* 175/*
175 * PXA 2xx clock declarations. 176 * PXA 2xx clock declarations.
176 */ 177 */
177static struct clk pxa25x_clks[] = { 178static DEFINE_CK(pxa25x_lcd, LCD, &clk_pxa25x_lcd_ops);
178 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 179static DEFINE_CKEN(pxa25x_ffuart, FFUART, 14745600, 1);
179 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 180static DEFINE_CKEN(pxa25x_btuart, BTUART, 14745600, 1);
180 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 181static DEFINE_CKEN(pxa25x_stuart, STUART, 14745600, 1);
181 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 182static DEFINE_CKEN(pxa25x_usb, USB, 47923000, 5);
182 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev), 183static DEFINE_CLK(pxa25x_gpio11, &clk_pxa25x_gpio11_ops, 3686400, 0);
183 INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL), 184static DEFINE_CLK(pxa25x_gpio12, &clk_pxa25x_gpio12_ops, 32768, 0);
184 INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL), 185static DEFINE_CKEN(pxa25x_mmc, MMC, 19169000, 0);
185 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 186static DEFINE_CKEN(pxa25x_i2c, I2C, 31949000, 0);
186 INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev), 187static DEFINE_CKEN(pxa25x_ssp, SSP, 3686400, 0);
187 188static DEFINE_CKEN(pxa25x_nssp, NSSP, 3686400, 0);
188 INIT_CKEN("SSPCLK", SSP, 3686400, 0, &pxa25x_device_ssp.dev), 189static DEFINE_CKEN(pxa25x_assp, ASSP, 3686400, 0);
189 INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev), 190static DEFINE_CKEN(pxa25x_pwm0, PWM0, 3686400, 0);
190 INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev), 191static DEFINE_CKEN(pxa25x_pwm1, PWM1, 3686400, 0);
191 INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev), 192static DEFINE_CKEN(pxa25x_ac97, AC97, 24576000, 0);
192 INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev), 193static DEFINE_CKEN(pxa25x_i2s, I2S, 14745600, 0);
193 194static DEFINE_CKEN(pxa25x_ficp, FICP, 47923000, 0);
194 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 195
195 196static struct clk_lookup pxa25x_clkregs[] = {
196 /* 197 INIT_CLKREG(&clk_pxa25x_lcd, "pxa2xx-fb", NULL),
197 INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL), 198 INIT_CLKREG(&clk_pxa25x_ffuart, "pxa2xx-uart.0", NULL),
198 */ 199 INIT_CLKREG(&clk_pxa25x_btuart, "pxa2xx-uart.1", NULL),
199 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 200 INIT_CLKREG(&clk_pxa25x_stuart, "pxa2xx-uart.2", NULL),
201 INIT_CLKREG(&clk_pxa25x_usb, "pxa25x-udc", NULL),
202 INIT_CLKREG(&clk_pxa25x_mmc, "pxa2xx-mci.0", NULL),
203 INIT_CLKREG(&clk_pxa25x_i2c, "pxa2xx-i2c.0", NULL),
204 INIT_CLKREG(&clk_pxa25x_ssp, "pxa25x-ssp.0", NULL),
205 INIT_CLKREG(&clk_pxa25x_nssp, "pxa25x-nssp.1", NULL),
206 INIT_CLKREG(&clk_pxa25x_assp, "pxa25x-nssp.2", NULL),
207 INIT_CLKREG(&clk_pxa25x_pwm0, "pxa25x-pwm.0", NULL),
208 INIT_CLKREG(&clk_pxa25x_pwm1, "pxa25x-pwm.1", NULL),
209 INIT_CLKREG(&clk_pxa25x_i2s, "pxa2xx-i2s", NULL),
210 INIT_CLKREG(&clk_pxa25x_stuart, "pxa2xx-ir", "UARTCLK"),
211 INIT_CLKREG(&clk_pxa25x_ficp, "pxa2xx-ir", "FICPCLK"),
212 INIT_CLKREG(&clk_pxa25x_ac97, NULL, "AC97CLK"),
213 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
214 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
200}; 215};
201 216
202#ifdef CONFIG_PM 217#ifdef CONFIG_PM
@@ -336,7 +351,7 @@ static int __init pxa25x_init(void)
336 351
337 reset_status = RCSR; 352 reset_status = RCSR;
338 353
339 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks)); 354 clks_register(pxa25x_clkregs, ARRAY_SIZE(pxa25x_clkregs));
340 355
341 if ((ret = pxa_init_dma(16))) 356 if ((ret = pxa_init_dma(16)))
342 return ret; 357 return ret;
@@ -357,7 +372,7 @@ static int __init pxa25x_init(void)
357 372
358 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */ 373 /* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */
359 if (cpu_is_pxa255() || cpu_is_pxa26x()) { 374 if (cpu_is_pxa255() || cpu_is_pxa26x()) {
360 clks_register(&pxa25x_hwuart_clk, 1); 375 clks_register(&pxa25x_hwuart_clkreg, 1);
361 ret = platform_device_register(&pxa_device_hwuart); 376 ret = platform_device_register(&pxa_device_hwuart);
362 } 377 }
363 378
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 3e4ab2279c9..15c8e5b9f9b 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -144,40 +144,59 @@ static const struct clkops clk_pxa27x_lcd_ops = {
144 .getrate = clk_pxa27x_lcd_getrate, 144 .getrate = clk_pxa27x_lcd_getrate,
145}; 145};
146 146
147static struct clk pxa27x_clks[] = { 147static DEFINE_CK(pxa27x_lcd, LCD, &clk_pxa27x_lcd_ops);
148 INIT_CK("LCDCLK", LCD, &clk_pxa27x_lcd_ops, &pxa_device_fb.dev), 148static DEFINE_CK(pxa27x_camera, CAMERA, &clk_pxa27x_lcd_ops);
149 INIT_CK("CAMCLK", CAMERA, &clk_pxa27x_lcd_ops, NULL), 149static DEFINE_CKEN(pxa27x_ffuart, FFUART, 14857000, 1);
150 150static DEFINE_CKEN(pxa27x_btuart, BTUART, 14857000, 1);
151 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), 151static DEFINE_CKEN(pxa27x_stuart, STUART, 14857000, 1);
152 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), 152static DEFINE_CKEN(pxa27x_i2s, I2S, 14682000, 0);
153 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 153static DEFINE_CKEN(pxa27x_i2c, I2C, 32842000, 0);
154 154static DEFINE_CKEN(pxa27x_usb, USB, 48000000, 5);
155 INIT_CKEN("I2SCLK", I2S, 14682000, 0, &pxa_device_i2s.dev), 155static DEFINE_CKEN(pxa27x_mmc, MMC, 19500000, 0);
156 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 156static DEFINE_CKEN(pxa27x_ficp, FICP, 48000000, 0);
157 INIT_CKEN("UDCCLK", USB, 48000000, 5, &pxa27x_device_udc.dev), 157static DEFINE_CKEN(pxa27x_usbhost, USBHOST, 48000000, 0);
158 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 158static DEFINE_CKEN(pxa27x_pwri2c, PWRI2C, 13000000, 0);
159 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 159static DEFINE_CKEN(pxa27x_keypad, KEYPAD, 32768, 0);
160 160static DEFINE_CKEN(pxa27x_ssp1, SSP1, 13000000, 0);
161 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev), 161static DEFINE_CKEN(pxa27x_ssp2, SSP2, 13000000, 0);
162 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 162static DEFINE_CKEN(pxa27x_ssp3, SSP3, 13000000, 0);
163 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), 163static DEFINE_CKEN(pxa27x_pwm0, PWM0, 13000000, 0);
164 164static DEFINE_CKEN(pxa27x_pwm1, PWM1, 13000000, 0);
165 INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 165static DEFINE_CKEN(pxa27x_ac97, AC97, 24576000, 0);
166 INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 166static DEFINE_CKEN(pxa27x_ac97conf, AC97CONF, 24576000, 0);
167 INIT_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 167static DEFINE_CKEN(pxa27x_msl, MSL, 48000000, 0);
168 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev), 168static DEFINE_CKEN(pxa27x_usim, USIM, 48000000, 0);
169 INIT_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev), 169static DEFINE_CKEN(pxa27x_memstk, MEMSTK, 19500000, 0);
170 170static DEFINE_CKEN(pxa27x_im, IM, 0, 0);
171 INIT_CKEN("AC97CLK", AC97, 24576000, 0, NULL), 171static DEFINE_CKEN(pxa27x_memc, MEMC, 0, 0);
172 INIT_CKEN("AC97CONFCLK", AC97CONF, 24576000, 0, NULL), 172
173 173static struct clk_lookup pxa27x_clkregs[] = {
174 /* 174 INIT_CLKREG(&clk_pxa27x_lcd, "pxa2xx-fb", NULL),
175 INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL), 175 INIT_CLKREG(&clk_pxa27x_camera, "pxa27x-camera.0", NULL),
176 INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL), 176 INIT_CLKREG(&clk_pxa27x_ffuart, "pxa2xx-uart.0", NULL),
177 INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL), 177 INIT_CLKREG(&clk_pxa27x_btuart, "pxa2xx-uart.1", NULL),
178 INIT_CKEN("IMCLK", IM, 0, 0, NULL), 178 INIT_CLKREG(&clk_pxa27x_stuart, "pxa2xx-uart.2", NULL),
179 INIT_CKEN("MEMCLK", MEMC, 0, 0, NULL), 179 INIT_CLKREG(&clk_pxa27x_i2s, "pxa2xx-i2s", NULL),
180 */ 180 INIT_CLKREG(&clk_pxa27x_i2c, "pxa2xx-i2c.0", NULL),
181 INIT_CLKREG(&clk_pxa27x_usb, "pxa27x-udc", NULL),
182 INIT_CLKREG(&clk_pxa27x_mmc, "pxa2xx-mci.0", NULL),
183 INIT_CLKREG(&clk_pxa27x_stuart, "pxa2xx-ir", "UARTCLK"),
184 INIT_CLKREG(&clk_pxa27x_ficp, "pxa2xx-ir", "FICPCLK"),
185 INIT_CLKREG(&clk_pxa27x_usbhost, "pxa27x-ohci", NULL),
186 INIT_CLKREG(&clk_pxa27x_pwri2c, "pxa2xx-i2c.1", NULL),
187 INIT_CLKREG(&clk_pxa27x_keypad, "pxa27x-keypad", NULL),
188 INIT_CLKREG(&clk_pxa27x_ssp1, "pxa27x-ssp.0", NULL),
189 INIT_CLKREG(&clk_pxa27x_ssp2, "pxa27x-ssp.1", NULL),
190 INIT_CLKREG(&clk_pxa27x_ssp3, "pxa27x-ssp.2", NULL),
191 INIT_CLKREG(&clk_pxa27x_pwm0, "pxa27x-pwm.0", NULL),
192 INIT_CLKREG(&clk_pxa27x_pwm1, "pxa27x-pwm.1", NULL),
193 INIT_CLKREG(&clk_pxa27x_ac97, NULL, "AC97CLK"),
194 INIT_CLKREG(&clk_pxa27x_ac97conf, NULL, "AC97CONFCLK"),
195 INIT_CLKREG(&clk_pxa27x_msl, NULL, "MSLCLK"),
196 INIT_CLKREG(&clk_pxa27x_usim, NULL, "USIMCLK"),
197 INIT_CLKREG(&clk_pxa27x_memstk, NULL, "MSTKCLK"),
198 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
199 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
181}; 200};
182 201
183#ifdef CONFIG_PM 202#ifdef CONFIG_PM
@@ -380,7 +399,7 @@ static int __init pxa27x_init(void)
380 399
381 reset_status = RCSR; 400 reset_status = RCSR;
382 401
383 clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks)); 402 clks_register(pxa27x_clkregs, ARRAY_SIZE(pxa27x_clkregs));
384 403
385 if ((ret = pxa_init_dma(32))) 404 if ((ret = pxa_init_dma(32)))
386 return ret; 405 return ret;
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 9adc7fc4618..f735e58e666 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -85,14 +85,16 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
85 MFP_ADDR_END, 85 MFP_ADDR_END,
86}; 86};
87 87
88static struct clk common_clks[] = { 88static DEFINE_PXA3_CKEN(common_nand, NAND, 156000000, 0);
89 PXA3xx_CKEN("NANDCLK", NAND, 156000000, 0, &pxa3xx_device_nand.dev), 89
90static struct clk_lookup common_clkregs[] = {
91 INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", "NANDCLK"),
90}; 92};
91 93
92static struct clk pxa310_clks[] = { 94static DEFINE_PXA3_CKEN(pxa310_mmc3, MMC3, 19500000, 0);
93#ifdef CONFIG_CPU_PXA310 95
94 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev), 96static struct clk_lookup pxa310_clkregs[] = {
95#endif 97 INIT_CLKREG(&clk_pxa310_mmc3, "pxa2xx-mci.2", "MMCCLK"),
96}; 98};
97 99
98static int __init pxa300_init(void) 100static int __init pxa300_init(void)
@@ -100,12 +102,12 @@ static int __init pxa300_init(void)
100 if (cpu_is_pxa300() || cpu_is_pxa310()) { 102 if (cpu_is_pxa300() || cpu_is_pxa310()) {
101 pxa3xx_init_mfp(); 103 pxa3xx_init_mfp();
102 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map); 104 pxa3xx_mfp_init_addr(pxa300_mfp_addr_map);
103 clks_register(ARRAY_AND_SIZE(common_clks)); 105 clks_register(ARRAY_AND_SIZE(common_clkregs));
104 } 106 }
105 107
106 if (cpu_is_pxa310()) { 108 if (cpu_is_pxa310()) {
107 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map); 109 pxa3xx_mfp_init_addr(pxa310_mfp_addr_map);
108 clks_register(ARRAY_AND_SIZE(pxa310_clks)); 110 clks_register(ARRAY_AND_SIZE(pxa310_clkregs));
109 } 111 }
110 112
111 return 0; 113 return 0;
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 016eb18f01a..effe408c186 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -80,8 +80,10 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
80 MFP_ADDR_END, 80 MFP_ADDR_END,
81}; 81};
82 82
83static struct clk pxa320_clks[] = { 83static DEFINE_PXA3_CKEN(pxa320_nand, NAND, 104000000, 0);
84 PXA3xx_CKEN("NANDCLK", NAND, 104000000, 0, &pxa3xx_device_nand.dev), 84
85static struct clk_lookup pxa320_clkregs[] = {
86 INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", "NANDCLK"),
85}; 87};
86 88
87static int __init pxa320_init(void) 89static int __init pxa320_init(void)
@@ -89,7 +91,7 @@ static int __init pxa320_init(void)
89 if (cpu_is_pxa320()) { 91 if (cpu_is_pxa320()) {
90 pxa3xx_init_mfp(); 92 pxa3xx_init_mfp();
91 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map); 93 pxa3xx_mfp_init_addr(pxa320_mfp_addr_map);
92 clks_register(ARRAY_AND_SIZE(pxa320_clks)); 94 clks_register(ARRAY_AND_SIZE(pxa320_clkregs));
93 } 95 }
94 96
95 return 0; 97 return 0;
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index b3cd5d0b0f3..b7e53829d37 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -216,43 +216,58 @@ static const struct clkops clk_dummy_ops = {
216 .disable = clk_dummy_disable, 216 .disable = clk_dummy_disable,
217}; 217};
218 218
219static struct clk pxa3xx_clks[] = { 219static struct clk clk_pxa3xx_pout = {
220 { 220 .ops = &clk_pout_ops,
221 .name = "CLK_POUT", 221 .rate = 13000000,
222 .ops = &clk_pout_ops, 222 .delay = 70,
223 .rate = 13000000, 223};
224 .delay = 70,
225 },
226
227 /* Power I2C clock is always on */
228 {
229 .name = "I2CCLK",
230 .ops = &clk_dummy_ops,
231 .dev = &pxa3xx_device_i2c_power.dev,
232 },
233
234 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
235 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
236 PXA3xx_CK("AC97CLK", AC97, &clk_pxa3xx_ac97_ops, NULL),
237
238 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
239 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
240 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
241
242 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
243 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa27x_device_udc.dev),
244 PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev),
245 PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
246 224
247 PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), 225static struct clk clk_dummy = {
248 PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), 226 .ops = &clk_dummy_ops,
249 PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), 227};
250 PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev),
251 PXA3xx_CKEN("PWMCLK", PWM0, 13000000, 0, &pxa27x_device_pwm0.dev),
252 PXA3xx_CKEN("PWMCLK", PWM1, 13000000, 0, &pxa27x_device_pwm1.dev),
253 228
254 PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), 229static DEFINE_PXA3_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops);
255 PXA3xx_CKEN("MMCCLK", MMC2, 19500000, 0, &pxa3xx_device_mci2.dev), 230static DEFINE_PXA3_CK(pxa3xx_camera, CAMERA, &clk_pxa3xx_hsio_ops);
231static DEFINE_PXA3_CK(pxa3xx_ac97, AC97, &clk_pxa3xx_ac97_ops);
232static DEFINE_PXA3_CKEN(pxa3xx_ffuart, FFUART, 14857000, 1);
233static DEFINE_PXA3_CKEN(pxa3xx_btuart, BTUART, 14857000, 1);
234static DEFINE_PXA3_CKEN(pxa3xx_stuart, STUART, 14857000, 1);
235static DEFINE_PXA3_CKEN(pxa3xx_i2c, I2C, 32842000, 0);
236static DEFINE_PXA3_CKEN(pxa3xx_udc, UDC, 48000000, 5);
237static DEFINE_PXA3_CKEN(pxa3xx_usbh, USBH, 48000000, 0);
238static DEFINE_PXA3_CKEN(pxa3xx_keypad, KEYPAD, 32768, 0);
239static DEFINE_PXA3_CKEN(pxa3xx_ssp1, SSP1, 13000000, 0);
240static DEFINE_PXA3_CKEN(pxa3xx_ssp2, SSP2, 13000000, 0);
241static DEFINE_PXA3_CKEN(pxa3xx_ssp3, SSP3, 13000000, 0);
242static DEFINE_PXA3_CKEN(pxa3xx_ssp4, SSP4, 13000000, 0);
243static DEFINE_PXA3_CKEN(pxa3xx_pwm0, PWM0, 13000000, 0);
244static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0);
245static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0);
246static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
247
248static struct clk_lookup pxa3xx_clkregs[] = {
249 INIT_CLKREG(&clk_pxa3xx_pout, NULL, "CLK_POUT"),
250 /* Power I2C clock is always on */
251 INIT_CLKREG(&clk_dummy, "pxa2xx-i2c.1", NULL),
252 INIT_CLKREG(&clk_pxa3xx_lcd, "pxa2xx-fb", NULL),
253 INIT_CLKREG(&clk_pxa3xx_camera, NULL, "CAMCLK"),
254 INIT_CLKREG(&clk_pxa3xx_ac97, NULL, "AC97CLK"),
255 INIT_CLKREG(&clk_pxa3xx_ffuart, "pxa2xx-uart.0", NULL),
256 INIT_CLKREG(&clk_pxa3xx_btuart, "pxa2xx-uart.1", NULL),
257 INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-uart.2", NULL),
258 INIT_CLKREG(&clk_pxa3xx_stuart, "pxa2xx-ir", "UARTCLK"),
259 INIT_CLKREG(&clk_pxa3xx_i2c, "pxa2xx-i2c.0", NULL),
260 INIT_CLKREG(&clk_pxa3xx_udc, "pxa27x-udc", NULL),
261 INIT_CLKREG(&clk_pxa3xx_usbh, "pxa27x-ohci", NULL),
262 INIT_CLKREG(&clk_pxa3xx_keypad, "pxa27x-keypad", NULL),
263 INIT_CLKREG(&clk_pxa3xx_ssp1, "pxa27x-ssp.0", NULL),
264 INIT_CLKREG(&clk_pxa3xx_ssp2, "pxa27x-ssp.1", NULL),
265 INIT_CLKREG(&clk_pxa3xx_ssp3, "pxa27x-ssp.2", NULL),
266 INIT_CLKREG(&clk_pxa3xx_ssp4, "pxa27x-ssp.3", NULL),
267 INIT_CLKREG(&clk_pxa3xx_pwm0, "pxa27x-pwm.0", NULL),
268 INIT_CLKREG(&clk_pxa3xx_pwm1, "pxa27x-pwm.1", NULL),
269 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
270 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
256}; 271};
257 272
258#ifdef CONFIG_PM 273#ifdef CONFIG_PM
@@ -595,7 +610,7 @@ static int __init pxa3xx_init(void)
595 */ 610 */
596 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 611 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S);
597 612
598 clks_register(pxa3xx_clks, ARRAY_SIZE(pxa3xx_clks)); 613 clks_register(pxa3xx_clkregs, ARRAY_SIZE(pxa3xx_clkregs));
599 614
600 if ((ret = pxa_init_dma(32))) 615 if ((ret = pxa_init_dma(32)))
601 return ret; 616 return ret;
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 2c31ec72568..6f42004db3e 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -356,7 +356,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
356 } 356 }
357 ssp->pdev = pdev; 357 ssp->pdev = pdev;
358 358
359 ssp->clk = clk_get(&pdev->dev, "SSPCLK"); 359 ssp->clk = clk_get(&pdev->dev, NULL);
360 if (IS_ERR(ssp->clk)) { 360 if (IS_ERR(ssp->clk)) {
361 ret = PTR_ERR(ssp->clk); 361 ret = PTR_ERR(ssp->clk);
362 goto err_free; 362 goto err_free;
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 5ccde7cf39e..603d1db9baf 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -10,6 +10,7 @@ config MACH_REALVIEW_EB
10config REALVIEW_EB_ARM11MP 10config REALVIEW_EB_ARM11MP
11 bool "Support ARM11MPCore tile" 11 bool "Support ARM11MPCore tile"
12 depends on MACH_REALVIEW_EB 12 depends on MACH_REALVIEW_EB
13 select CPU_V6
13 help 14 help
14 Enable support for the ARM11MPCore tile on the Realview platform. 15 Enable support for the ARM11MPCore tile on the Realview platform.
15 16
@@ -33,6 +34,7 @@ config MACH_REALVIEW_PB11MP
33 34
34config MACH_REALVIEW_PB1176 35config MACH_REALVIEW_PB1176
35 bool "Support RealView/PB1176 platform" 36 bool "Support RealView/PB1176 platform"
37 select CPU_V6
36 select ARM_GIC 38 select ARM_GIC
37 help 39 help
38 Include support for the ARM(R) RealView ARM1176 Platform Baseboard. 40 Include support for the ARM(R) RealView ARM1176 Platform Baseboard.
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index 3347c4236a6..a7043115de7 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -10,9 +10,11 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/device.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
15#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/string.h>
16#include <linux/clk.h> 18#include <linux/clk.h>
17#include <linux/mutex.h> 19#include <linux/mutex.h>
18 20
@@ -20,32 +22,6 @@
20 22
21#include "clock.h" 23#include "clock.h"
22 24
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25
26struct clk *clk_get(struct device *dev, const char *id)
27{
28 struct clk *p, *clk = ERR_PTR(-ENOENT);
29
30 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p;
34 break;
35 }
36 }
37 mutex_unlock(&clocks_mutex);
38
39 return clk;
40}
41EXPORT_SYMBOL(clk_get);
42
43void clk_put(struct clk *clk)
44{
45 module_put(clk->owner);
46}
47EXPORT_SYMBOL(clk_put);
48
49int clk_enable(struct clk *clk) 25int clk_enable(struct clk *clk)
50{ 26{
51 return 0; 27 return 0;
@@ -65,7 +41,9 @@ EXPORT_SYMBOL(clk_get_rate);
65 41
66long clk_round_rate(struct clk *clk, unsigned long rate) 42long clk_round_rate(struct clk *clk, unsigned long rate)
67{ 43{
68 return rate; 44 struct icst307_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000);
46 return icst307_khz(clk->params, vco) * 1000;
69} 47}
70EXPORT_SYMBOL(clk_round_rate); 48EXPORT_SYMBOL(clk_round_rate);
71 49
@@ -78,57 +56,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
78 56
79 vco = icst307_khz_to_vco(clk->params, rate / 1000); 57 vco = icst307_khz_to_vco(clk->params, rate / 1000);
80 clk->rate = icst307_khz(clk->params, vco) * 1000; 58 clk->rate = icst307_khz(clk->params, vco) * 1000;
81
82 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
83 clk->name, vco.s, vco.r, vco.v);
84
85 clk->setvco(clk, vco); 59 clk->setvco(clk, vco);
86 ret = 0; 60 ret = 0;
87 } 61 }
88 return ret; 62 return ret;
89} 63}
90EXPORT_SYMBOL(clk_set_rate); 64EXPORT_SYMBOL(clk_set_rate);
91
92/*
93 * These are fixed clocks.
94 */
95static struct clk kmi_clk = {
96 .name = "KMIREFCLK",
97 .rate = 24000000,
98};
99
100static struct clk uart_clk = {
101 .name = "UARTCLK",
102 .rate = 24000000,
103};
104
105static struct clk mmci_clk = {
106 .name = "MCLK",
107 .rate = 24000000,
108};
109
110int clk_register(struct clk *clk)
111{
112 mutex_lock(&clocks_mutex);
113 list_add(&clk->node, &clocks);
114 mutex_unlock(&clocks_mutex);
115 return 0;
116}
117EXPORT_SYMBOL(clk_register);
118
119void clk_unregister(struct clk *clk)
120{
121 mutex_lock(&clocks_mutex);
122 list_del(&clk->node);
123 mutex_unlock(&clocks_mutex);
124}
125EXPORT_SYMBOL(clk_unregister);
126
127static int __init clk_init(void)
128{
129 clk_register(&kmi_clk);
130 clk_register(&uart_clk);
131 clk_register(&mmci_clk);
132 return 0;
133}
134arch_initcall(clk_init);
diff --git a/arch/arm/mach-realview/clock.h b/arch/arm/mach-realview/clock.h
index dadba695e18..ebbb0f06b60 100644
--- a/arch/arm/mach-realview/clock.h
+++ b/arch/arm/mach-realview/clock.h
@@ -12,14 +12,8 @@ struct module;
12struct icst307_params; 12struct icst307_params;
13 13
14struct clk { 14struct clk {
15 struct list_head node;
16 unsigned long rate; 15 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst307_params *params; 16 const struct icst307_params *params;
20 void *data; 17 void *data;
21 void (*setvco)(struct clk *, struct icst307_vco vco); 18 void (*setvco)(struct clk *, struct icst307_vco vco);
22}; 19};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 2f04d54711e..2491374818e 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -29,6 +29,7 @@
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30#include <linux/io.h> 30#include <linux/io.h>
31 31
32#include <asm/clkdev.h>
32#include <asm/system.h> 33#include <asm/system.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
@@ -188,13 +189,60 @@ static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
188 writel(0, sys_lock); 189 writel(0, sys_lock);
189} 190}
190 191
191struct clk realview_clcd_clk = { 192static struct clk oscvco_clk = {
192 .name = "CLCDCLK",
193 .params = &realview_oscvco_params, 193 .params = &realview_oscvco_params,
194 .setvco = realview_oscvco_set, 194 .setvco = realview_oscvco_set,
195}; 195};
196 196
197/* 197/*
198 * These are fixed clocks.
199 */
200static struct clk ref24_clk = {
201 .rate = 24000000,
202};
203
204static struct clk_lookup lookups[] = {
205 { /* UART0 */
206 .dev_id = "dev:f1",
207 .clk = &ref24_clk,
208 }, { /* UART1 */
209 .dev_id = "dev:f2",
210 .clk = &ref24_clk,
211 }, { /* UART2 */
212 .dev_id = "dev:f3",
213 .clk = &ref24_clk,
214 }, { /* UART3 */
215 .dev_id = "fpga:09",
216 .clk = &ref24_clk,
217 }, { /* KMI0 */
218 .dev_id = "fpga:06",
219 .clk = &ref24_clk,
220 }, { /* KMI1 */
221 .dev_id = "fpga:07",
222 .clk = &ref24_clk,
223 }, { /* MMC0 */
224 .dev_id = "fpga:05",
225 .clk = &ref24_clk,
226 }, { /* EB:CLCD */
227 .dev_id = "dev:20",
228 .clk = &oscvco_clk,
229 }, { /* PB:CLCD */
230 .dev_id = "issp:20",
231 .clk = &oscvco_clk,
232 }
233};
234
235static int __init clk_init(void)
236{
237 int i;
238
239 for (i = 0; i < ARRAY_SIZE(lookups); i++)
240 clkdev_add(&lookups[i]);
241 return 0;
242}
243arch_initcall(clk_init);
244
245/*
198 * CLCD support. 246 * CLCD support.
199 */ 247 */
200#define SYS_CLCD_NLCDIOON (1 << 2) 248#define SYS_CLCD_NLCDIOON (1 << 2)
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 3cea92c70d8..614e8cb3171 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -48,7 +48,6 @@ extern struct platform_device realview_flash_device;
48extern struct platform_device realview_i2c_device; 48extern struct platform_device realview_i2c_device;
49extern struct mmc_platform_data realview_mmc0_plat_data; 49extern struct mmc_platform_data realview_mmc0_plat_data;
50extern struct mmc_platform_data realview_mmc1_plat_data; 50extern struct mmc_platform_data realview_mmc1_plat_data;
51extern struct clk realview_clcd_clk;
52extern struct clcd_board clcd_plat_data; 51extern struct clcd_board clcd_plat_data;
53extern void __iomem *gic_cpu_base_addr; 52extern void __iomem *gic_cpu_base_addr;
54#ifdef CONFIG_LOCAL_TIMERS 53#ifdef CONFIG_LOCAL_TIMERS
diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h
new file mode 100644
index 00000000000..04b37a89801
--- /dev/null
+++ b/arch/arm/mach-realview/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-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index eb829eb1ebe..3420e2e719e 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -372,8 +372,6 @@ static void __init realview_eb_init(void)
372#endif 372#endif
373 } 373 }
374 374
375 clk_register(&realview_clcd_clk);
376
377 realview_flash_register(&realview_eb_flash_resource, 1); 375 realview_flash_register(&realview_eb_flash_resource, 1);
378 platform_device_register(&realview_i2c_device); 376 platform_device_register(&realview_i2c_device);
379 eth_device_register(); 377 eth_device_register();
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index cccdb3eb90f..0481416d37c 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -265,8 +265,6 @@ static void __init realview_pb1176_init(void)
265 l2x0_init(__io_address(REALVIEW_PB1176_L220_BASE), 0x00730000, 0xfe000fff); 265 l2x0_init(__io_address(REALVIEW_PB1176_L220_BASE), 0x00730000, 0xfe000fff);
266#endif 266#endif
267 267
268 clk_register(&realview_clcd_clk);
269
270 realview_flash_register(&realview_pb1176_flash_resource, 1); 268 realview_flash_register(&realview_pb1176_flash_resource, 1);
271 platform_device_register(&realview_pb1176_smsc911x_device); 269 platform_device_register(&realview_pb1176_smsc911x_device);
272 270
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 8b863148ec1..6197dd8e8ed 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -312,8 +312,6 @@ static void __init realview_pb11mp_init(void)
312 l2x0_init(__io_address(REALVIEW_TC11MP_L220_BASE), 0x00790000, 0xfe000fff); 312 l2x0_init(__io_address(REALVIEW_TC11MP_L220_BASE), 0x00790000, 0xfe000fff);
313#endif 313#endif
314 314
315 clk_register(&realview_clcd_clk);
316
317 realview_flash_register(realview_pb11mp_flash_resource, 315 realview_flash_register(realview_pb11mp_flash_resource,
318 ARRAY_SIZE(realview_pb11mp_flash_resource)); 316 ARRAY_SIZE(realview_pb11mp_flash_resource));
319 platform_device_register(&realview_pb11mp_smsc911x_device); 317 platform_device_register(&realview_pb11mp_smsc911x_device);
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 99fdc736698..7315569fbfd 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2410 7config CPU_S3C2410
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_GPIO 12 select S3C2410_GPIO
12 select CPU_LLSERIAL_S3C2410 13 select CPU_LLSERIAL_S3C2410
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index c59a9d2ee9a..ca99564ae4b 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2412 7config CPU_S3C2412
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM926T
10 select CPU_LLSERIAL_S3C2440 11 select CPU_LLSERIAL_S3C2440
11 select S3C2412_PM if PM 12 select S3C2412_PM if PM
12 select S3C2412_DMA if S3C2410_DMA 13 select S3C2412_DMA if S3C2410_DMA
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index 25de042ab99..0429d255b0d 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2440 7config CPU_S3C2440
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_PM if PM 12 select S3C2410_PM if PM
12 select S3C2410_GPIO 13 select S3C2410_GPIO
diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig
index 26d131a7707..b289d198020 100644
--- a/arch/arm/mach-s3c2442/Kconfig
+++ b/arch/arm/mach-s3c2442/Kconfig
@@ -7,6 +7,7 @@
7config CPU_S3C2442 7config CPU_S3C2442
8 bool 8 bool
9 depends on ARCH_S3C2410 9 depends on ARCH_S3C2410
10 select CPU_ARM920T
10 select S3C2410_CLOCK 11 select S3C2410_CLOCK
11 select S3C2410_GPIO 12 select S3C2410_GPIO
12 select S3C2410_PM if PM 13 select S3C2410_PM if PM
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 43c30f84abf..dab3c6347a8 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -3,6 +3,7 @@
3 */ 3 */
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/device.h>
6#include <linux/list.h> 7#include <linux/list.h>
7#include <linux/errno.h> 8#include <linux/errno.h>
8#include <linux/err.h> 9#include <linux/err.h>
@@ -14,36 +15,39 @@
14#include <mach/hardware.h> 15#include <mach/hardware.h>
15 16
16/* 17/*
17 * Very simple clock implementation - we only have one clock to 18 * Very simple clock implementation - we only have one clock to deal with.
18 * deal with at the moment, so we only match using the "name".
19 */ 19 */
20struct clk { 20struct clk {
21 struct list_head node;
22 unsigned long rate;
23 const char *name;
24 unsigned int enabled; 21 unsigned int enabled;
25 void (*enable)(void);
26 void (*disable)(void);
27}; 22};
28 23
29static LIST_HEAD(clocks); 24static void clk_gpio27_enable(void)
30static DEFINE_MUTEX(clocks_mutex); 25{
26 /*
27 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
28 * (SA-1110 Developer's Manual, section 9.1.2.1)
29 */
30 GAFR |= GPIO_32_768kHz;
31 GPDR |= GPIO_32_768kHz;
32 TUCR = TUCR_3_6864MHz;
33}
34
35static void clk_gpio27_disable(void)
36{
37 TUCR = 0;
38 GPDR &= ~GPIO_32_768kHz;
39 GAFR &= ~GPIO_32_768kHz;
40}
41
42static struct clk clk_gpio27;
43
31static DEFINE_SPINLOCK(clocks_lock); 44static DEFINE_SPINLOCK(clocks_lock);
32 45
33struct clk *clk_get(struct device *dev, const char *id) 46struct clk *clk_get(struct device *dev, const char *id)
34{ 47{
35 struct clk *p, *clk = ERR_PTR(-ENOENT); 48 const char *devname = dev_name(dev);
36
37 mutex_lock(&clocks_mutex);
38 list_for_each_entry(p, &clocks, node) {
39 if (strcmp(id, p->name) == 0) {
40 clk = p;
41 break;
42 }
43 }
44 mutex_unlock(&clocks_mutex);
45 49
46 return clk; 50 return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27;
47} 51}
48EXPORT_SYMBOL(clk_get); 52EXPORT_SYMBOL(clk_get);
49 53
@@ -58,7 +62,7 @@ int clk_enable(struct clk *clk)
58 62
59 spin_lock_irqsave(&clocks_lock, flags); 63 spin_lock_irqsave(&clocks_lock, flags);
60 if (clk->enabled++ == 0) 64 if (clk->enabled++ == 0)
61 clk->enable(); 65 clk_gpio27_enable();
62 spin_unlock_irqrestore(&clocks_lock, flags); 66 spin_unlock_irqrestore(&clocks_lock, flags);
63 return 0; 67 return 0;
64} 68}
@@ -72,63 +76,13 @@ void clk_disable(struct clk *clk)
72 76
73 spin_lock_irqsave(&clocks_lock, flags); 77 spin_lock_irqsave(&clocks_lock, flags);
74 if (--clk->enabled == 0) 78 if (--clk->enabled == 0)
75 clk->disable(); 79 clk_gpio27_disable();
76 spin_unlock_irqrestore(&clocks_lock, flags); 80 spin_unlock_irqrestore(&clocks_lock, flags);
77} 81}
78EXPORT_SYMBOL(clk_disable); 82EXPORT_SYMBOL(clk_disable);
79 83
80unsigned long clk_get_rate(struct clk *clk) 84unsigned long clk_get_rate(struct clk *clk)
81{ 85{
82 return clk->rate; 86 return 3686400;
83} 87}
84EXPORT_SYMBOL(clk_get_rate); 88EXPORT_SYMBOL(clk_get_rate);
85
86
87static void clk_gpio27_enable(void)
88{
89 /*
90 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
91 * (SA-1110 Developer's Manual, section 9.1.2.1)
92 */
93 GAFR |= GPIO_32_768kHz;
94 GPDR |= GPIO_32_768kHz;
95 TUCR = TUCR_3_6864MHz;
96}
97
98static void clk_gpio27_disable(void)
99{
100 TUCR = 0;
101 GPDR &= ~GPIO_32_768kHz;
102 GAFR &= ~GPIO_32_768kHz;
103}
104
105static struct clk clk_gpio27 = {
106 .name = "SA1111_CLK",
107 .rate = 3686400,
108 .enable = clk_gpio27_enable,
109 .disable = clk_gpio27_disable,
110};
111
112int clk_register(struct clk *clk)
113{
114 mutex_lock(&clocks_mutex);
115 list_add(&clk->node, &clocks);
116 mutex_unlock(&clocks_mutex);
117 return 0;
118}
119EXPORT_SYMBOL(clk_register);
120
121void clk_unregister(struct clk *clk)
122{
123 mutex_lock(&clocks_mutex);
124 list_del(&clk->node);
125 mutex_unlock(&clocks_mutex);
126}
127EXPORT_SYMBOL(clk_unregister);
128
129static int __init clk_init(void)
130{
131 clk_register(&clk_gpio27);
132 return 0;
133}
134arch_initcall(clk_init);
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 95096afd527..c781f30c836 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -3,12 +3,14 @@ menu "Versatile platform type"
3 3
4config ARCH_VERSATILE_PB 4config ARCH_VERSATILE_PB
5 bool "Support Versatile/PB platform" 5 bool "Support Versatile/PB platform"
6 select CPU_ARM926T
6 default y 7 default y
7 help 8 help
8 Include support for the ARM(R) Versatile/PB platform. 9 Include support for the ARM(R) Versatile/PB platform.
9 10
10config MACH_VERSATILE_AB 11config MACH_VERSATILE_AB
11 bool "Support Versatile/AB platform" 12 bool "Support Versatile/AB platform"
13 select CPU_ARM926T
12 help 14 help
13 Include support for the ARM(R) Versatile/AP platform. 15 Include support for the ARM(R) Versatile/AP platform.
14 16
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
index 58937f1fb38..c50a44ea7ee 100644
--- a/arch/arm/mach-versatile/clock.c
+++ b/arch/arm/mach-versatile/clock.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/device.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
15#include <linux/err.h> 16#include <linux/err.h>
@@ -17,36 +18,11 @@
17#include <linux/clk.h> 18#include <linux/clk.h>
18#include <linux/mutex.h> 19#include <linux/mutex.h>
19 20
21#include <asm/clkdev.h>
20#include <asm/hardware/icst307.h> 22#include <asm/hardware/icst307.h>
21 23
22#include "clock.h" 24#include "clock.h"
23 25
24static LIST_HEAD(clocks);
25static DEFINE_MUTEX(clocks_mutex);
26
27struct clk *clk_get(struct device *dev, const char *id)
28{
29 struct clk *p, *clk = ERR_PTR(-ENOENT);
30
31 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p;
35 break;
36 }
37 }
38 mutex_unlock(&clocks_mutex);
39
40 return clk;
41}
42EXPORT_SYMBOL(clk_get);
43
44void clk_put(struct clk *clk)
45{
46 module_put(clk->owner);
47}
48EXPORT_SYMBOL(clk_put);
49
50int clk_enable(struct clk *clk) 26int clk_enable(struct clk *clk)
51{ 27{
52 return 0; 28 return 0;
@@ -66,7 +42,9 @@ EXPORT_SYMBOL(clk_get_rate);
66 42
67long clk_round_rate(struct clk *clk, unsigned long rate) 43long clk_round_rate(struct clk *clk, unsigned long rate)
68{ 44{
69 return rate; 45 struct icst307_vco vco;
46 vco = icst307_khz_to_vco(clk->params, rate / 1000);
47 return icst307_khz(clk->params, vco) * 1000;
70} 48}
71EXPORT_SYMBOL(clk_round_rate); 49EXPORT_SYMBOL(clk_round_rate);
72 50
@@ -79,57 +57,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
79 57
80 vco = icst307_khz_to_vco(clk->params, rate / 1000); 58 vco = icst307_khz_to_vco(clk->params, rate / 1000);
81 clk->rate = icst307_khz(clk->params, vco) * 1000; 59 clk->rate = icst307_khz(clk->params, vco) * 1000;
82
83 printk("Clock %s: setting VCO reg params: S=%d R=%d V=%d\n",
84 clk->name, vco.s, vco.r, vco.v);
85
86 clk->setvco(clk, vco); 60 clk->setvco(clk, vco);
87 ret = 0; 61 ret = 0;
88 } 62 }
89 return ret; 63 return ret;
90} 64}
91EXPORT_SYMBOL(clk_set_rate); 65EXPORT_SYMBOL(clk_set_rate);
92
93/*
94 * These are fixed clocks.
95 */
96static struct clk kmi_clk = {
97 .name = "KMIREFCLK",
98 .rate = 24000000,
99};
100
101static struct clk uart_clk = {
102 .name = "UARTCLK",
103 .rate = 24000000,
104};
105
106static struct clk mmci_clk = {
107 .name = "MCLK",
108 .rate = 24000000,
109};
110
111int clk_register(struct clk *clk)
112{
113 mutex_lock(&clocks_mutex);
114 list_add(&clk->node, &clocks);
115 mutex_unlock(&clocks_mutex);
116 return 0;
117}
118EXPORT_SYMBOL(clk_register);
119
120void clk_unregister(struct clk *clk)
121{
122 mutex_lock(&clocks_mutex);
123 list_del(&clk->node);
124 mutex_unlock(&clocks_mutex);
125}
126EXPORT_SYMBOL(clk_unregister);
127
128static int __init clk_init(void)
129{
130 clk_register(&kmi_clk);
131 clk_register(&uart_clk);
132 clk_register(&mmci_clk);
133 return 0;
134}
135arch_initcall(clk_init);
diff --git a/arch/arm/mach-versatile/clock.h b/arch/arm/mach-versatile/clock.h
index 8b0b61dd17e..03468fdc3e5 100644
--- a/arch/arm/mach-versatile/clock.h
+++ b/arch/arm/mach-versatile/clock.h
@@ -12,14 +12,9 @@ struct module;
12struct icst307_params; 12struct icst307_params;
13 13
14struct clk { 14struct clk {
15 struct list_head node;
16 unsigned long rate; 15 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 const struct icst307_params *params; 16 const struct icst307_params *params;
17 u32 oscoff;
20 void *data; 18 void *data;
21 void (*setvco)(struct clk *, struct icst307_vco vco); 19 void (*setvco)(struct clk *, struct icst307_vco vco);
22}; 20};
23
24int clk_register(struct clk *clk);
25void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 565e0ba0d67..df25aa13850 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -31,6 +31,7 @@
31#include <linux/cnt32_to_63.h> 31#include <linux/cnt32_to_63.h>
32#include <linux/io.h> 32#include <linux/io.h>
33 33
34#include <asm/clkdev.h>
34#include <asm/system.h> 35#include <asm/system.h>
35#include <mach/hardware.h> 36#include <mach/hardware.h>
36#include <asm/irq.h> 37#include <asm/irq.h>
@@ -373,22 +374,60 @@ static const struct icst307_params versatile_oscvco_params = {
373 374
374static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco) 375static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
375{ 376{
376 void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET; 377 void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
377 void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSCCLCD_OFFSET; 378 void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;
378 u32 val; 379 u32 val;
379 380
380 val = readl(sys_osc) & ~0x7ffff; 381 val = readl(sys + clk->oscoff) & ~0x7ffff;
381 val |= vco.v | (vco.r << 9) | (vco.s << 16); 382 val |= vco.v | (vco.r << 9) | (vco.s << 16);
382 383
383 writel(0xa05f, sys_lock); 384 writel(0xa05f, sys_lock);
384 writel(val, sys_osc); 385 writel(val, sys + clk->oscoff);
385 writel(0, sys_lock); 386 writel(0, sys_lock);
386} 387}
387 388
388static struct clk versatile_clcd_clk = { 389static struct clk osc4_clk = {
389 .name = "CLCDCLK",
390 .params = &versatile_oscvco_params, 390 .params = &versatile_oscvco_params,
391 .setvco = versatile_oscvco_set, 391 .oscoff = VERSATILE_SYS_OSCCLCD_OFFSET,
392 .setvco = versatile_oscvco_set,
393};
394
395/*
396 * These are fixed clocks.
397 */
398static struct clk ref24_clk = {
399 .rate = 24000000,
400};
401
402static struct clk_lookup lookups[] __initdata = {
403 { /* UART0 */
404 .dev_id = "dev:f1",
405 .clk = &ref24_clk,
406 }, { /* UART1 */
407 .dev_id = "dev:f2",
408 .clk = &ref24_clk,
409 }, { /* UART2 */
410 .dev_id = "dev:f3",
411 .clk = &ref24_clk,
412 }, { /* UART3 */
413 .dev_id = "fpga:09",
414 .clk = &ref24_clk,
415 }, { /* KMI0 */
416 .dev_id = "fpga:06",
417 .clk = &ref24_clk,
418 }, { /* KMI1 */
419 .dev_id = "fpga:07",
420 .clk = &ref24_clk,
421 }, { /* MMC0 */
422 .dev_id = "fpga:05",
423 .clk = &ref24_clk,
424 }, { /* MMC1 */
425 .dev_id = "fpga:0b",
426 .clk = &ref24_clk,
427 }, { /* CLCD */
428 .dev_id = "dev:20",
429 .clk = &osc4_clk,
430 }
392}; 431};
393 432
394/* 433/*
@@ -786,7 +825,8 @@ void __init versatile_init(void)
786{ 825{
787 int i; 826 int i;
788 827
789 clk_register(&versatile_clcd_clk); 828 for (i = 0; i < ARRAY_SIZE(lookups); i++)
829 clkdev_add(&lookups[i]);
790 830
791 platform_device_register(&versatile_flash_device); 831 platform_device_register(&versatile_flash_device);
792 platform_device_register(&versatile_i2c_device); 832 platform_device_register(&versatile_i2c_device);
diff --git a/arch/arm/mach-versatile/include/mach/clkdev.h b/arch/arm/mach-versatile/include/mach/clkdev.h
new file mode 100644
index 00000000000..04b37a89801
--- /dev/null
+++ b/arch/arm/mach-versatile/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/mm/Kconfig b/arch/arm/mm/Kconfig
index ab5f7a21350..cf44de51283 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -10,8 +10,7 @@ config CPU_32
10 10
11# ARM610 11# ARM610
12config CPU_ARM610 12config CPU_ARM610
13 bool "Support ARM610 processor" 13 bool "Support ARM610 processor" if ARCH_RPC
14 depends on ARCH_RPC
15 select CPU_32v3 14 select CPU_32v3
16 select CPU_CACHE_V3 15 select CPU_CACHE_V3
17 select CPU_CACHE_VIVT 16 select CPU_CACHE_VIVT
@@ -43,8 +42,7 @@ config CPU_ARM7TDMI
43 42
44# ARM710 43# ARM710
45config CPU_ARM710 44config CPU_ARM710
46 bool "Support ARM710 processor" if !ARCH_CLPS7500 && ARCH_RPC 45 bool "Support ARM710 processor" if ARCH_RPC
47 default y if ARCH_CLPS7500
48 select CPU_32v3 46 select CPU_32v3
49 select CPU_CACHE_V3 47 select CPU_CACHE_V3
50 select CPU_CACHE_VIVT 48 select CPU_CACHE_VIVT
@@ -63,8 +61,7 @@ config CPU_ARM710
63 61
64# ARM720T 62# ARM720T
65config CPU_ARM720T 63config CPU_ARM720T
66 bool "Support ARM720T processor" if !ARCH_CLPS711X && !ARCH_L7200 && !ARCH_CDB89712 && ARCH_INTEGRATOR 64 bool "Support ARM720T processor" if ARCH_INTEGRATOR
67 default y if ARCH_CLPS711X || ARCH_L7200 || ARCH_CDB89712 || ARCH_H720X
68 select CPU_32v4T 65 select CPU_32v4T
69 select CPU_ABRT_LV4T 66 select CPU_ABRT_LV4T
70 select CPU_PABRT_NOIFAR 67 select CPU_PABRT_NOIFAR
@@ -114,9 +111,7 @@ config CPU_ARM9TDMI
114 111
115# ARM920T 112# ARM920T
116config CPU_ARM920T 113config CPU_ARM920T
117 bool "Support ARM920T processor" 114 bool "Support ARM920T processor" if ARCH_INTEGRATOR
118 depends on ARCH_EP93XX || ARCH_INTEGRATOR || CPU_S3C2410 || CPU_S3C2440 || CPU_S3C2442 || ARCH_IMX || ARCH_AAEC2000 || ARCH_AT91RM9200
119 default y if CPU_S3C2410 || CPU_S3C2440 || CPU_S3C2442 || ARCH_AT91RM9200
120 select CPU_32v4T 115 select CPU_32v4T
121 select CPU_ABRT_EV4T 116 select CPU_ABRT_EV4T
122 select CPU_PABRT_NOIFAR 117 select CPU_PABRT_NOIFAR
@@ -138,8 +133,6 @@ config CPU_ARM920T
138# ARM922T 133# ARM922T
139config CPU_ARM922T 134config CPU_ARM922T
140 bool "Support ARM922T processor" if ARCH_INTEGRATOR 135 bool "Support ARM922T processor" if ARCH_INTEGRATOR
141 depends on ARCH_LH7A40X || ARCH_INTEGRATOR || ARCH_KS8695
142 default y if ARCH_LH7A40X || ARCH_KS8695
143 select CPU_32v4T 136 select CPU_32v4T
144 select CPU_ABRT_EV4T 137 select CPU_ABRT_EV4T
145 select CPU_PABRT_NOIFAR 138 select CPU_PABRT_NOIFAR
@@ -159,8 +152,6 @@ config CPU_ARM922T
159# ARM925T 152# ARM925T
160config CPU_ARM925T 153config CPU_ARM925T
161 bool "Support ARM925T processor" if ARCH_OMAP1 154 bool "Support ARM925T processor" if ARCH_OMAP1
162 depends on ARCH_OMAP15XX
163 default y if ARCH_OMAP15XX
164 select CPU_32v4T 155 select CPU_32v4T
165 select CPU_ABRT_EV4T 156 select CPU_ABRT_EV4T
166 select CPU_PABRT_NOIFAR 157 select CPU_PABRT_NOIFAR
@@ -179,22 +170,7 @@ config CPU_ARM925T
179 170
180# ARM926T 171# ARM926T
181config CPU_ARM926T 172config CPU_ARM926T
182 bool "Support ARM926T processor" 173 bool "Support ARM926T processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
183 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || \
184 MACH_VERSATILE_AB || ARCH_OMAP730 || \
185 ARCH_OMAP16XX || MACH_REALVIEW_EB || \
186 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
190 ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \
192 ARCH_OMAP730 || ARCH_OMAP16XX || \
193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
194 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
195 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
196 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
197 ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
198 select CPU_32v5 174 select CPU_32v5
199 select CPU_ABRT_EV5TJ 175 select CPU_ABRT_EV5TJ
200 select CPU_PABRT_NOIFAR 176 select CPU_PABRT_NOIFAR
@@ -247,8 +223,7 @@ config CPU_ARM946E
247 223
248# ARM1020 - needs validating 224# ARM1020 - needs validating
249config CPU_ARM1020 225config CPU_ARM1020
250 bool "Support ARM1020T (rev 0) processor" 226 bool "Support ARM1020T (rev 0) processor" if ARCH_INTEGRATOR
251 depends on ARCH_INTEGRATOR
252 select CPU_32v5 227 select CPU_32v5
253 select CPU_ABRT_EV4T 228 select CPU_ABRT_EV4T
254 select CPU_PABRT_NOIFAR 229 select CPU_PABRT_NOIFAR
@@ -266,8 +241,7 @@ config CPU_ARM1020
266 241
267# ARM1020E - needs validating 242# ARM1020E - needs validating
268config CPU_ARM1020E 243config CPU_ARM1020E
269 bool "Support ARM1020E processor" 244 bool "Support ARM1020E processor" if ARCH_INTEGRATOR
270 depends on ARCH_INTEGRATOR
271 select CPU_32v5 245 select CPU_32v5
272 select CPU_ABRT_EV4T 246 select CPU_ABRT_EV4T
273 select CPU_PABRT_NOIFAR 247 select CPU_PABRT_NOIFAR
@@ -280,8 +254,7 @@ config CPU_ARM1020E
280 254
281# ARM1022E 255# ARM1022E
282config CPU_ARM1022 256config CPU_ARM1022
283 bool "Support ARM1022E processor" 257 bool "Support ARM1022E processor" if ARCH_INTEGRATOR
284 depends on ARCH_INTEGRATOR
285 select CPU_32v5 258 select CPU_32v5
286 select CPU_ABRT_EV4T 259 select CPU_ABRT_EV4T
287 select CPU_PABRT_NOIFAR 260 select CPU_PABRT_NOIFAR
@@ -299,8 +272,7 @@ config CPU_ARM1022
299 272
300# ARM1026EJ-S 273# ARM1026EJ-S
301config CPU_ARM1026 274config CPU_ARM1026
302 bool "Support ARM1026EJ-S processor" 275 bool "Support ARM1026EJ-S processor" if ARCH_INTEGRATOR
303 depends on ARCH_INTEGRATOR
304 select CPU_32v5 276 select CPU_32v5
305 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10 277 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10
306 select CPU_PABRT_NOIFAR 278 select CPU_PABRT_NOIFAR
@@ -317,8 +289,7 @@ config CPU_ARM1026
317 289
318# SA110 290# SA110
319config CPU_SA110 291config CPU_SA110
320 bool "Support StrongARM(R) SA-110 processor" if !ARCH_EBSA110 && !FOOTBRIDGE && !ARCH_TBOX && !ARCH_SHARK && !ARCH_NEXUSPCI && ARCH_RPC 292 bool "Support StrongARM(R) SA-110 processor" if ARCH_RPC
321 default y if ARCH_EBSA110 || FOOTBRIDGE || ARCH_TBOX || ARCH_SHARK || ARCH_NEXUSPCI
322 select CPU_32v3 if ARCH_RPC 293 select CPU_32v3 if ARCH_RPC
323 select CPU_32v4 if !ARCH_RPC 294 select CPU_32v4 if !ARCH_RPC
324 select CPU_ABRT_EV4 295 select CPU_ABRT_EV4
@@ -340,8 +311,6 @@ config CPU_SA110
340# SA1100 311# SA1100
341config CPU_SA1100 312config CPU_SA1100
342 bool 313 bool
343 depends on ARCH_SA1100
344 default y
345 select CPU_32v4 314 select CPU_32v4
346 select CPU_ABRT_EV4 315 select CPU_ABRT_EV4
347 select CPU_PABRT_NOIFAR 316 select CPU_PABRT_NOIFAR
@@ -353,8 +322,6 @@ config CPU_SA1100
353# XScale 322# XScale
354config CPU_XSCALE 323config CPU_XSCALE
355 bool 324 bool
356 depends on ARCH_IOP32X || ARCH_IOP33X || PXA25x || PXA27x || ARCH_IXP4XX || ARCH_IXP2000
357 default y
358 select CPU_32v5 325 select CPU_32v5
359 select CPU_ABRT_EV5T 326 select CPU_ABRT_EV5T
360 select CPU_PABRT_NOIFAR 327 select CPU_PABRT_NOIFAR
@@ -365,8 +332,6 @@ config CPU_XSCALE
365# XScale Core Version 3 332# XScale Core Version 3
366config CPU_XSC3 333config CPU_XSC3
367 bool 334 bool
368 depends on ARCH_IXP23XX || ARCH_IOP13XX || PXA3xx
369 default y
370 select CPU_32v5 335 select CPU_32v5
371 select CPU_ABRT_EV5T 336 select CPU_ABRT_EV5T
372 select CPU_PABRT_NOIFAR 337 select CPU_PABRT_NOIFAR
@@ -378,8 +343,6 @@ config CPU_XSC3
378# Feroceon 343# Feroceon
379config CPU_FEROCEON 344config CPU_FEROCEON
380 bool 345 bool
381 depends on ARCH_ORION5X || ARCH_LOKI || ARCH_KIRKWOOD || ARCH_MV78XX0
382 default y
383 select CPU_32v5 346 select CPU_32v5
384 select CPU_ABRT_EV5T 347 select CPU_ABRT_EV5T
385 select CPU_PABRT_NOIFAR 348 select CPU_PABRT_NOIFAR
@@ -399,10 +362,7 @@ config CPU_FEROCEON_OLD_ID
399 362
400# ARMv6 363# ARMv6
401config CPU_V6 364config CPU_V6
402 bool "Support ARM V6 processor" 365 bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
403 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP2 || ARCH_MX3 || ARCH_MSM || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176
404 default y if ARCH_MX3
405 default y if ARCH_MSM
406 select CPU_32v6 366 select CPU_32v6
407 select CPU_ABRT_EV6 367 select CPU_ABRT_EV6
408 select CPU_PABRT_NOIFAR 368 select CPU_PABRT_NOIFAR
@@ -427,8 +387,7 @@ config CPU_32v6K
427 387
428# ARMv7 388# ARMv7
429config CPU_V7 389config CPU_V7
430 bool "Support ARM V7 processor" 390 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB
431 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP3
432 select CPU_32v6K 391 select CPU_32v6K
433 select CPU_32v7 392 select CPU_32v7
434 select CPU_ABRT_EV7 393 select CPU_ABRT_EV7
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 7f36c825718..f24803c1fb0 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -896,7 +896,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
896 * allocate the zero page. Note that we count on this going ok. 896 * allocate the zero page. Note that we count on this going ok.
897 */ 897 */
898 zero_page = alloc_bootmem_low_pages(PAGE_SIZE); 898 zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
899 memzero(zero_page, PAGE_SIZE); 899 memset(zero_page, 0, PAGE_SIZE);
900 empty_zero_page = virt_to_page(zero_page); 900 empty_zero_page = virt_to_page(zero_page);
901 flush_dcache_page(empty_zero_page); 901 flush_dcache_page(empty_zero_page);
902} 902}
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index e0f19ab9116..2690146161b 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -31,7 +31,7 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
31 if (!new_pgd) 31 if (!new_pgd)
32 goto no_pgd; 32 goto no_pgd;
33 33
34 memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t)); 34 memset(new_pgd, 0, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
35 35
36 /* 36 /*
37 * Copy over the kernel and IO PGD entries 37 * Copy over the kernel and IO PGD entries
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index b2a7e3fad11..a1612958a59 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -8,11 +8,13 @@ choice
8 8
9config ARCH_MX2 9config ARCH_MX2
10 bool "MX2-based" 10 bool "MX2-based"
11 select CPU_ARM926T
11 help 12 help
12 This enables support for systems based on the Freescale i.MX2 family 13 This enables support for systems based on the Freescale i.MX2 family
13 14
14config ARCH_MX3 15config ARCH_MX3
15 bool "MX3-based" 16 bool "MX3-based"
17 select CPU_V6
16 help 18 help
17 This enables support for systems based on the Freescale i.MX3 family 19 This enables support for systems based on the Freescale i.MX3 family
18 20
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index a94f0c44ebc..46d3b0b9ce6 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -14,9 +14,11 @@ config ARCH_OMAP1
14 14
15config ARCH_OMAP2 15config ARCH_OMAP2
16 bool "TI OMAP2" 16 bool "TI OMAP2"
17 select CPU_V6
17 18
18config ARCH_OMAP3 19config ARCH_OMAP3
19 bool "TI OMAP3" 20 bool "TI OMAP3"
21 select CPU_V7
20 22
21endchoice 23endchoice
22 24