diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-07-29 02:26:00 -0400 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2008-08-04 21:26:02 -0400 |
commit | 04fef228fb00dd79475a2313f4ba73b4fbfe2faa (patch) | |
tree | fee94286fb6b53562e1f9a3c2d6f7f20f8014346 /arch | |
parent | ab277121426edca2ee0601fc6318c9467350771e (diff) |
[ARM] pxa: introduce reset_status and clear_reset_status for driver's usage
Due to the problem of reset status bits being handled by different
registers between pxa2xx and pxa3xx, introduce a global reset_status
variable, initialized by SoC-specific code and later being used by
other drivers.
And also introduce clear_reset_status(), which is used to clear the
corresponding status bits. Pass RESET_STATUS_ALL to clear all bits.
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-pxa/generic.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/generic.h | 8 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa25x.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa2xx.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/reset.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 3 |
8 files changed, 52 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index ca053226fba0..36638926c5ce 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c | |||
@@ -26,9 +26,19 @@ | |||
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | 27 | ||
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/reset.h> | ||
29 | 30 | ||
30 | #include "generic.h" | 31 | #include "generic.h" |
31 | 32 | ||
33 | void clear_reset_status(unsigned int mask) | ||
34 | { | ||
35 | if (cpu_is_pxa2xx()) | ||
36 | pxa2xx_clear_reset_status(mask); | ||
37 | |||
38 | if (cpu_is_pxa3xx()) | ||
39 | pxa3xx_clear_reset_status(mask); | ||
40 | } | ||
41 | |||
32 | /* | 42 | /* |
33 | * Get the clock frequency as reflected by CCCR and the turbo flag. | 43 | * Get the clock frequency as reflected by CCCR and the turbo flag. |
34 | * We assume these values have been applied via a fcs. | 44 | * We assume these values have been applied via a fcs. |
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index 5bb7ae757831..041c048320e4 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h | |||
@@ -47,12 +47,20 @@ extern unsigned pxa27x_get_memclk_frequency_10khz(void); | |||
47 | #define pxa27x_get_memclk_frequency_10khz() (0) | 47 | #define pxa27x_get_memclk_frequency_10khz() (0) |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x) | ||
51 | extern void pxa2xx_clear_reset_status(unsigned int); | ||
52 | #else | ||
53 | static inline void pxa2xx_clear_reset_status(unsigned int mask) {} | ||
54 | #endif | ||
55 | |||
50 | #ifdef CONFIG_PXA3xx | 56 | #ifdef CONFIG_PXA3xx |
51 | extern unsigned pxa3xx_get_clk_frequency_khz(int); | 57 | extern unsigned pxa3xx_get_clk_frequency_khz(int); |
52 | extern unsigned pxa3xx_get_memclk_frequency_10khz(void); | 58 | extern unsigned pxa3xx_get_memclk_frequency_10khz(void); |
59 | extern void pxa3xx_clear_reset_status(unsigned int); | ||
53 | #else | 60 | #else |
54 | #define pxa3xx_get_clk_frequency_khz(x) (0) | 61 | #define pxa3xx_get_clk_frequency_khz(x) (0) |
55 | #define pxa3xx_get_memclk_frequency_10khz() (0) | 62 | #define pxa3xx_get_memclk_frequency_10khz() (0) |
63 | static inline void pxa3xx_clear_reset_status(unsigned int mask) {} | ||
56 | #endif | 64 | #endif |
57 | 65 | ||
58 | extern struct sysdev_class pxa_irq_sysclass; | 66 | extern struct sysdev_class pxa_irq_sysclass; |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index c5b845b935bb..49a7a296ff31 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/arch/pxa-regs.h> | 28 | #include <asm/arch/pxa-regs.h> |
29 | #include <asm/arch/pxa2xx-regs.h> | 29 | #include <asm/arch/pxa2xx-regs.h> |
30 | #include <asm/arch/mfp-pxa25x.h> | 30 | #include <asm/arch/mfp-pxa25x.h> |
31 | #include <asm/arch/reset.h> | ||
31 | #include <asm/arch/pm.h> | 32 | #include <asm/arch/pm.h> |
32 | #include <asm/arch/dma.h> | 33 | #include <asm/arch/dma.h> |
33 | 34 | ||
@@ -348,6 +349,9 @@ static int __init pxa25x_init(void) | |||
348 | clks_register(&pxa25x_hwuart_clk, 1); | 349 | clks_register(&pxa25x_hwuart_clk, 1); |
349 | 350 | ||
350 | if (cpu_is_pxa21x() || cpu_is_pxa25x()) { | 351 | if (cpu_is_pxa21x() || cpu_is_pxa25x()) { |
352 | |||
353 | reset_status = RCSR; | ||
354 | |||
351 | clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks)); | 355 | clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks)); |
352 | 356 | ||
353 | if ((ret = pxa_init_dma(16))) | 357 | if ((ret = pxa_init_dma(16))) |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index d5d14ea33f27..a8c12347a5a9 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/arch/pxa-regs.h> | 24 | #include <asm/arch/pxa-regs.h> |
25 | #include <asm/arch/pxa2xx-regs.h> | 25 | #include <asm/arch/pxa2xx-regs.h> |
26 | #include <asm/arch/mfp-pxa27x.h> | 26 | #include <asm/arch/mfp-pxa27x.h> |
27 | #include <asm/arch/reset.h> | ||
27 | #include <asm/arch/ohci.h> | 28 | #include <asm/arch/ohci.h> |
28 | #include <asm/arch/pm.h> | 29 | #include <asm/arch/pm.h> |
29 | #include <asm/arch/dma.h> | 30 | #include <asm/arch/dma.h> |
@@ -384,6 +385,9 @@ static int __init pxa27x_init(void) | |||
384 | int i, ret = 0; | 385 | int i, ret = 0; |
385 | 386 | ||
386 | if (cpu_is_pxa27x()) { | 387 | if (cpu_is_pxa27x()) { |
388 | |||
389 | reset_status = RCSR; | ||
390 | |||
387 | clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks)); | 391 | clks_register(pxa27x_clks, ARRAY_SIZE(pxa27x_clks)); |
388 | 392 | ||
389 | if ((ret = pxa_init_dma(32))) | 393 | if ((ret = pxa_init_dma(32))) |
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index d4f6415e8413..d93d3e6a6e27 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c | |||
@@ -14,10 +14,19 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | 16 | ||
17 | #include <asm/hardware.h> | ||
18 | #include <asm/arch/pxa2xx-regs.h> | ||
17 | #include <asm/arch/mfp-pxa2xx.h> | 19 | #include <asm/arch/mfp-pxa2xx.h> |
18 | #include <asm/arch/mfp-pxa25x.h> | 20 | #include <asm/arch/mfp-pxa25x.h> |
21 | #include <asm/arch/reset.h> | ||
19 | #include <asm/arch/irda.h> | 22 | #include <asm/arch/irda.h> |
20 | 23 | ||
24 | void pxa2xx_clear_reset_status(unsigned int mask) | ||
25 | { | ||
26 | /* RESET_STATUS_* has a 1:1 mapping with RCSR */ | ||
27 | RCSR = mask; | ||
28 | } | ||
29 | |||
21 | static unsigned long pxa2xx_mfp_fir[] = { | 30 | static unsigned long pxa2xx_mfp_fir[] = { |
22 | GPIO46_FICP_RXD, | 31 | GPIO46_FICP_RXD, |
23 | GPIO47_FICP_TXD, | 32 | GPIO47_FICP_TXD, |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index f491025a0c82..3d36c790f5ce 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <asm/hardware.h> | 25 | #include <asm/hardware.h> |
26 | #include <asm/arch/pxa3xx-regs.h> | 26 | #include <asm/arch/pxa3xx-regs.h> |
27 | #include <asm/arch/reset.h> | ||
27 | #include <asm/arch/ohci.h> | 28 | #include <asm/arch/ohci.h> |
28 | #include <asm/arch/pm.h> | 29 | #include <asm/arch/pm.h> |
29 | #include <asm/arch/dma.h> | 30 | #include <asm/arch/dma.h> |
@@ -109,6 +110,12 @@ unsigned int pxa3xx_get_memclk_frequency_10khz(void) | |||
109 | return (clk / 10000); | 110 | return (clk / 10000); |
110 | } | 111 | } |
111 | 112 | ||
113 | void pxa3xx_clear_reset_status(unsigned int mask) | ||
114 | { | ||
115 | /* RESET_STATUS_* has a 1:1 mapping with ARSR */ | ||
116 | ARSR = mask; | ||
117 | } | ||
118 | |||
112 | /* | 119 | /* |
113 | * Return the current AC97 clock frequency. | 120 | * Return the current AC97 clock frequency. |
114 | */ | 121 | */ |
@@ -532,6 +539,9 @@ static int __init pxa3xx_init(void) | |||
532 | int i, ret = 0; | 539 | int i, ret = 0; |
533 | 540 | ||
534 | if (cpu_is_pxa3xx()) { | 541 | if (cpu_is_pxa3xx()) { |
542 | |||
543 | reset_status = ARSR; | ||
544 | |||
535 | /* | 545 | /* |
536 | * clear RDH bit every time after reset | 546 | * clear RDH bit every time after reset |
537 | * | 547 | * |
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c index d610a1244abb..56f60d923a9d 100644 --- a/arch/arm/mach-pxa/reset.c +++ b/arch/arm/mach-pxa/reset.c | |||
@@ -11,9 +11,11 @@ | |||
11 | #include <asm/proc-fns.h> | 11 | #include <asm/proc-fns.h> |
12 | 12 | ||
13 | #include <asm/arch/pxa-regs.h> | 13 | #include <asm/arch/pxa-regs.h> |
14 | #include <asm/arch/pxa2xx-regs.h> | ||
15 | #include <asm/arch/reset.h> | 14 | #include <asm/arch/reset.h> |
16 | 15 | ||
16 | unsigned int reset_status; | ||
17 | EXPORT_SYMBOL(reset_status); | ||
18 | |||
17 | static void do_hw_reset(void); | 19 | static void do_hw_reset(void); |
18 | 20 | ||
19 | static int reset_gpio = -1; | 21 | static int reset_gpio = -1; |
@@ -78,8 +80,7 @@ static void do_hw_reset(void) | |||
78 | 80 | ||
79 | void arch_reset(char mode) | 81 | void arch_reset(char mode) |
80 | { | 82 | { |
81 | if (cpu_is_pxa2xx()) | 83 | clear_reset_status(RESET_STATUS_ALL); |
82 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
83 | 84 | ||
84 | switch (mode) { | 85 | switch (mode) { |
85 | case 's': | 86 | case 's': |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 0c2fa1c4fb4c..3b6fc090c8ef 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -31,6 +31,9 @@ | |||
31 | 31 | ||
32 | #include "generic.h" | 32 | #include "generic.h" |
33 | 33 | ||
34 | unsigned int reset_status; | ||
35 | EXPORT_SYMBOL(reset_status); | ||
36 | |||
34 | #define NR_FREQS 16 | 37 | #define NR_FREQS 16 |
35 | 38 | ||
36 | /* | 39 | /* |