diff options
author | Chao Xie <chao.xie@marvell.com> | 2012-08-26 22:54:01 -0400 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@gmail.com> | 2012-09-08 11:37:51 -0400 |
commit | 9e73d6982314a903beebb2e47e585a9804f237cf (patch) | |
tree | 66b0703c5d05ad274be155ab2d20444d5da74217 /arch/arm/mach-mmp | |
parent | 50d0e24499787a39e5fa585a770591648a9760fd (diff) |
arm: mmp: move pxa910 clock definition to separated file
move pxa910 clock definition to another file. Then pxa910 can
choose common clock framework or private clock framework.
Signed-off-by: Chao Xie <xiechao.mail@gmail.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Diffstat (limited to 'arch/arm/mach-mmp')
-rw-r--r-- | arch/arm/mach-mmp/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-mmp/clock-pxa910.c | 67 | ||||
-rw-r--r-- | arch/arm/mach-mmp/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-mmp/pxa910.c | 40 |
4 files changed, 73 insertions, 36 deletions
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile index bb63f86185a9..ac0e8858c9d8 100644 --- a/arch/arm/mach-mmp/Makefile +++ b/arch/arm/mach-mmp/Makefile | |||
@@ -12,6 +12,7 @@ obj-$(CONFIG_CPU_MMP2) += mmp2.o sram.o | |||
12 | ifeq ($(CONFIG_COMMON_CLK), ) | 12 | ifeq ($(CONFIG_COMMON_CLK), ) |
13 | obj-y += clock.o | 13 | obj-y += clock.o |
14 | obj-$(CONFIG_CPU_PXA168) += clock-pxa168.o | 14 | obj-$(CONFIG_CPU_PXA168) += clock-pxa168.o |
15 | obj-$(CONFIG_CPU_PXA910) += clock-pxa910.o | ||
15 | endif | 16 | endif |
16 | ifeq ($(CONFIG_PM),y) | 17 | ifeq ($(CONFIG_PM),y) |
17 | obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o | 18 | obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o |
diff --git a/arch/arm/mach-mmp/clock-pxa910.c b/arch/arm/mach-mmp/clock-pxa910.c new file mode 100644 index 000000000000..933ea71d0b56 --- /dev/null +++ b/arch/arm/mach-mmp/clock-pxa910.c | |||
@@ -0,0 +1,67 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/init.h> | ||
4 | #include <linux/list.h> | ||
5 | #include <linux/io.h> | ||
6 | #include <linux/clk.h> | ||
7 | |||
8 | #include <mach/addr-map.h> | ||
9 | |||
10 | #include "common.h" | ||
11 | #include "clock.h" | ||
12 | |||
13 | /* | ||
14 | * APB Clock register offsets for PXA910 | ||
15 | */ | ||
16 | #define APBC_UART0 APBC_REG(0x000) | ||
17 | #define APBC_UART1 APBC_REG(0x004) | ||
18 | #define APBC_GPIO APBC_REG(0x008) | ||
19 | #define APBC_PWM1 APBC_REG(0x00c) | ||
20 | #define APBC_PWM2 APBC_REG(0x010) | ||
21 | #define APBC_PWM3 APBC_REG(0x014) | ||
22 | #define APBC_PWM4 APBC_REG(0x018) | ||
23 | #define APBC_SSP1 APBC_REG(0x01c) | ||
24 | #define APBC_SSP2 APBC_REG(0x020) | ||
25 | #define APBC_RTC APBC_REG(0x028) | ||
26 | #define APBC_TWSI0 APBC_REG(0x02c) | ||
27 | #define APBC_KPC APBC_REG(0x030) | ||
28 | #define APBC_SSP3 APBC_REG(0x04c) | ||
29 | #define APBC_TWSI1 APBC_REG(0x06c) | ||
30 | |||
31 | #define APMU_NAND APMU_REG(0x060) | ||
32 | #define APMU_USB APMU_REG(0x05c) | ||
33 | |||
34 | static APBC_CLK(uart1, UART0, 1, 14745600); | ||
35 | static APBC_CLK(uart2, UART1, 1, 14745600); | ||
36 | static APBC_CLK(twsi0, TWSI0, 1, 33000000); | ||
37 | static APBC_CLK(twsi1, TWSI1, 1, 33000000); | ||
38 | static APBC_CLK(pwm1, PWM1, 1, 13000000); | ||
39 | static APBC_CLK(pwm2, PWM2, 1, 13000000); | ||
40 | static APBC_CLK(pwm3, PWM3, 1, 13000000); | ||
41 | static APBC_CLK(pwm4, PWM4, 1, 13000000); | ||
42 | static APBC_CLK(gpio, GPIO, 0, 13000000); | ||
43 | static APBC_CLK(rtc, RTC, 8, 32768); | ||
44 | |||
45 | static APMU_CLK(nand, NAND, 0x19b, 156000000); | ||
46 | static APMU_CLK(u2o, USB, 0x1b, 480000000); | ||
47 | |||
48 | /* device and clock bindings */ | ||
49 | static struct clk_lookup pxa910_clkregs[] = { | ||
50 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), | ||
51 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), | ||
52 | INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL), | ||
53 | INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL), | ||
54 | INIT_CLKREG(&clk_pwm1, "pxa910-pwm.0", NULL), | ||
55 | INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL), | ||
56 | INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), | ||
57 | INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), | ||
58 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), | ||
59 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), | ||
60 | INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"), | ||
61 | INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), | ||
62 | }; | ||
63 | |||
64 | void __init pxa910_clk_init(void) | ||
65 | { | ||
66 | clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs)); | ||
67 | } | ||
diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h index e47f73f55c45..1cad41b41c51 100644 --- a/arch/arm/mach-mmp/common.h +++ b/arch/arm/mach-mmp/common.h | |||
@@ -8,3 +8,4 @@ extern void __init icu_init_irq(void); | |||
8 | extern void __init mmp_map_io(void); | 8 | extern void __init mmp_map_io(void); |
9 | extern void mmp_restart(char, const char *); | 9 | extern void mmp_restart(char, const char *); |
10 | extern void __init pxa168_clk_init(void); | 10 | extern void __init pxa168_clk_init(void); |
11 | extern void __init pxa910_clk_init(void); | ||
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c index 6da52e9f2bdc..7d84521bb715 100644 --- a/arch/arm/mach-mmp/pxa910.c +++ b/arch/arm/mach-mmp/pxa910.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <asm/mach/time.h> | 17 | #include <asm/mach/time.h> |
18 | #include <mach/addr-map.h> | 18 | #include <mach/addr-map.h> |
19 | #include <mach/regs-apbc.h> | 19 | #include <mach/regs-apbc.h> |
20 | #include <mach/regs-apmu.h> | ||
21 | #include <mach/cputype.h> | 20 | #include <mach/cputype.h> |
22 | #include <mach/irqs.h> | 21 | #include <mach/irqs.h> |
23 | #include <mach/dma.h> | 22 | #include <mach/dma.h> |
@@ -25,7 +24,6 @@ | |||
25 | #include <mach/devices.h> | 24 | #include <mach/devices.h> |
26 | 25 | ||
27 | #include "common.h" | 26 | #include "common.h" |
28 | #include "clock.h" | ||
29 | 27 | ||
30 | #define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000) | 28 | #define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000) |
31 | 29 | ||
@@ -82,44 +80,13 @@ void __init pxa910_init_irq(void) | |||
82 | icu_init_irq(); | 80 | icu_init_irq(); |
83 | } | 81 | } |
84 | 82 | ||
85 | /* APB peripheral clocks */ | ||
86 | static APBC_CLK(uart1, PXA910_UART0, 1, 14745600); | ||
87 | static APBC_CLK(uart2, PXA910_UART1, 1, 14745600); | ||
88 | static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000); | ||
89 | static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000); | ||
90 | static APBC_CLK(pwm1, PXA910_PWM1, 1, 13000000); | ||
91 | static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000); | ||
92 | static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); | ||
93 | static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); | ||
94 | static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); | ||
95 | static APBC_CLK(rtc, PXA910_RTC, 8, 32768); | ||
96 | |||
97 | static APMU_CLK(nand, NAND, 0x19b, 156000000); | ||
98 | static APMU_CLK(u2o, USB, 0x1b, 480000000); | ||
99 | |||
100 | /* device and clock bindings */ | ||
101 | static struct clk_lookup pxa910_clkregs[] = { | ||
102 | INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL), | ||
103 | INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL), | ||
104 | INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL), | ||
105 | INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL), | ||
106 | INIT_CLKREG(&clk_pwm1, "pxa910-pwm.0", NULL), | ||
107 | INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL), | ||
108 | INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), | ||
109 | INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), | ||
110 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), | ||
111 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), | ||
112 | INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"), | ||
113 | INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), | ||
114 | }; | ||
115 | |||
116 | static int __init pxa910_init(void) | 83 | static int __init pxa910_init(void) |
117 | { | 84 | { |
118 | if (cpu_is_pxa910()) { | 85 | if (cpu_is_pxa910()) { |
119 | mfp_init_base(MFPR_VIRT_BASE); | 86 | mfp_init_base(MFPR_VIRT_BASE); |
120 | mfp_init_addr(pxa910_mfp_addr_map); | 87 | mfp_init_addr(pxa910_mfp_addr_map); |
121 | pxa_init_dma(IRQ_PXA910_DMA_INT0, 32); | 88 | pxa_init_dma(IRQ_PXA910_DMA_INT0, 32); |
122 | clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs)); | 89 | pxa910_clk_init(); |
123 | } | 90 | } |
124 | 91 | ||
125 | return 0; | 92 | return 0; |
@@ -128,12 +95,13 @@ postcore_initcall(pxa910_init); | |||
128 | 95 | ||
129 | /* system timer - clock enabled, 3.25MHz */ | 96 | /* system timer - clock enabled, 3.25MHz */ |
130 | #define TIMER_CLK_RST (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(3)) | 97 | #define TIMER_CLK_RST (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(3)) |
98 | #define APBC_TIMERS APBC_REG(0x34) | ||
131 | 99 | ||
132 | static void __init pxa910_timer_init(void) | 100 | static void __init pxa910_timer_init(void) |
133 | { | 101 | { |
134 | /* reset and configure */ | 102 | /* reset and configure */ |
135 | __raw_writel(APBC_APBCLK | APBC_RST, APBC_PXA910_TIMERS); | 103 | __raw_writel(APBC_APBCLK | APBC_RST, APBC_TIMERS); |
136 | __raw_writel(TIMER_CLK_RST, APBC_PXA910_TIMERS); | 104 | __raw_writel(TIMER_CLK_RST, APBC_TIMERS); |
137 | 105 | ||
138 | timer_init(IRQ_PXA910_AP1_TIMER1); | 106 | timer_init(IRQ_PXA910_AP1_TIMER1); |
139 | } | 107 | } |