diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-01-20 01:15:18 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-03-22 22:11:34 -0400 |
commit | 49cbe78637eb0503f45fc9b556ec08918a616534 (patch) | |
tree | 96de29959c5ef512d8f1e0bea7eae2245b7cc3f9 /arch/arm/mach-mmp/clock.c | |
parent | f8dec04d33b94a4cfa9358fd9666c01480bb164d (diff) |
[ARM] pxa: add base support for Marvell's PXA168 processor line
"""The MarvellĀ® PXA168 processor is the first in a family of application
processors targeted at mass market opportunities in computing and consumer
devices. It balances high computing and multimedia performance with low
power consumption to support extended battery life, and includes a wealth
of integrated peripherals to reduce overall BOM cost .... """
See http://www.marvell.com/featured/pxa168.jsp for more information.
1. Marvell Mohawk core is a hybrid of xscale3 and its own ARM core,
there are many enhancements like instructions for flushing the
whole D-cache, and so on
2. Clock reuses Russell's common clkdev, and added the basic support
for UART1/2.
3. Devices are a bit different from the 'mach-pxa' way, the platform
devices are now dynamically allocated only when necessary (i.e.
when pxa_register_device() is called). Description for each device
are stored in an array of 'struct pxa_device_desc'. Now that:
a. this array of device description is marked with __initdata and
can be freed up system is fully up
b. which means board code has to add all needed devices early in
his initializing function
c. platform specific data can now be marked as __initdata since
they are allocated and copied by platform_device_add_data()
4. only the basic UART1/2/3 are added, more devices will come later.
Signed-off-by: Jason Chagas <chagas@marvell.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-mmp/clock.c')
-rw-r--r-- | arch/arm/mach-mmp/clock.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c new file mode 100644 index 000000000000..2d9cc5a7122f --- /dev/null +++ b/arch/arm/mach-mmp/clock.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-mmp/clock.c | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/list.h> | ||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/io.h> | ||
15 | |||
16 | #include <mach/regs-apbc.h> | ||
17 | #include "clock.h" | ||
18 | |||
19 | static void apbc_clk_enable(struct clk *clk) | ||
20 | { | ||
21 | uint32_t clk_rst; | ||
22 | |||
23 | clk_rst = APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(clk->fnclksel); | ||
24 | __raw_writel(clk_rst, clk->clk_rst); | ||
25 | } | ||
26 | |||
27 | static void apbc_clk_disable(struct clk *clk) | ||
28 | { | ||
29 | __raw_writel(0, clk->clk_rst); | ||
30 | } | ||
31 | |||
32 | struct clkops apbc_clk_ops = { | ||
33 | .enable = apbc_clk_enable, | ||
34 | .disable = apbc_clk_disable, | ||
35 | }; | ||
36 | |||
37 | static DEFINE_SPINLOCK(clocks_lock); | ||
38 | |||
39 | int clk_enable(struct clk *clk) | ||
40 | { | ||
41 | unsigned long flags; | ||
42 | |||
43 | spin_lock_irqsave(&clocks_lock, flags); | ||
44 | if (clk->enabled++ == 0) | ||
45 | clk->ops->enable(clk); | ||
46 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
47 | return 0; | ||
48 | } | ||
49 | EXPORT_SYMBOL(clk_enable); | ||
50 | |||
51 | void clk_disable(struct clk *clk) | ||
52 | { | ||
53 | unsigned long flags; | ||
54 | |||
55 | WARN_ON(clk->enabled == 0); | ||
56 | |||
57 | spin_lock_irqsave(&clocks_lock, flags); | ||
58 | if (--clk->enabled == 0) | ||
59 | clk->ops->disable(clk); | ||
60 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
61 | } | ||
62 | EXPORT_SYMBOL(clk_disable); | ||
63 | |||
64 | unsigned long clk_get_rate(struct clk *clk) | ||
65 | { | ||
66 | unsigned long rate; | ||
67 | |||
68 | if (clk->ops->getrate) | ||
69 | rate = clk->ops->getrate(clk); | ||
70 | else | ||
71 | rate = clk->rate; | ||
72 | |||
73 | return rate; | ||
74 | } | ||
75 | EXPORT_SYMBOL(clk_get_rate); | ||
76 | |||
77 | void clks_register(struct clk_lookup *clks, size_t num) | ||
78 | { | ||
79 | int i; | ||
80 | |||
81 | for (i = 0; i < num; i++) | ||
82 | clkdev_add(&clks[i]); | ||
83 | } | ||