aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2010-10-14 11:19:11 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2010-10-26 05:32:48 -0400
commit1345562b449e95e2098cc60eb0eed6d2415cd0b0 (patch)
tree030983c78b1c1472765047f262b9533ae2060098 /arch/arm/mach-at91
parentef4d63e6f51d9669e247c47b670a83511b98eb68 (diff)
AT91: reset routine cleanup, remove not needed icache flush
Generalize assembler reset routine to allow use on several at91sam9 chips. This patch replace double definitions of SDRAM controller registers and RSTC registers with use of classical header files. For this rework, we remove the not needed icache flush as it is already done in the calling function: arm_machine_restart(). Rename at91sam9g20_reset.S to generalize to several chips. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Makefile2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c4
-rw-r--r--arch/arm/mach-at91/at91sam9_alt_reset.S48
-rw-r--r--arch/arm/mach-at91/at91sam9g20_reset.S55
4 files changed, 51 insertions, 58 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 6e97edd47c5f..c94485227b09 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -16,7 +16,7 @@ obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_d
16obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o 16obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o
17obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o 17obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o
18obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o 18obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o
19obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9g20_reset.o 19obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9_alt_reset.o
20obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o 20obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o
21obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o 21obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o
22obj-$(CONFIG_ARCH_AT572D940HF) += at572d940hf.o at91sam926x_time.o at572d940hf_devices.o sam9_smc.o 22obj-$(CONFIG_ARCH_AT572D940HF) += at572d940hf.o at91sam926x_time.o at572d940hf_devices.o sam9_smc.o
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index f8844506eabb..dfd3529cd101 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -25,7 +25,7 @@
25#include "generic.h" 25#include "generic.h"
26#include "clock.h" 26#include "clock.h"
27 27
28extern void at91sam9g20_reset(void); 28extern void at91sam9_alt_reset(void);
29 29
30static struct map_desc at91sam9260_io_desc[] __initdata = { 30static struct map_desc at91sam9260_io_desc[] __initdata = {
31 { 31 {
@@ -330,7 +330,7 @@ void __init at91sam9260_initialize(unsigned long main_clock)
330 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc)); 330 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
331 331
332 if (cpu_is_at91sam9g20()) 332 if (cpu_is_at91sam9g20())
333 at91_arch_reset = at91sam9g20_reset; 333 at91_arch_reset = at91sam9_alt_reset;
334 else 334 else
335 at91_arch_reset = at91sam9260_reset; 335 at91_arch_reset = at91sam9260_reset;
336 336
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
new file mode 100644
index 000000000000..e0256deb91fb
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -0,0 +1,48 @@
1/*
2 * reset AT91SAM9G20 as per errata
3 *
4 * (C) BitBox Ltd 2010
5 *
6 * unless the SDRAM is cleanly shutdown before we hit the
7 * reset register it can be left driving the data bus and
8 * killing the chance of a subsequent boot from NAND
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#include <linux/linkage.h>
17#include <asm/system.h>
18#include <mach/hardware.h>
19#include <mach/at91sam9_sdramc.h>
20#include <mach/at91_rstc.h>
21
22 .arm
23
24 .globl at91sam9_alt_reset
25
26at91sam9_alt_reset: mrc p15, 0, r0, c1, c0, 0
27 orr r0, r0, #CR_I
28 mcr p15, 0, r0, c1, c0, 0 @ enable I-cache
29
30 ldr r0, .at91_va_base_sdramc @ preload constants
31 ldr r1, .at91_va_base_rstc_cr
32
33 mov r2, #1
34 mov r3, #AT91_SDRAMC_LPCB_POWER_DOWN
35 ldr r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
36
37 .balign 32 @ align to cache line
38
39 str r2, [r0, #AT91_SDRAMC_TR] @ disable SDRAM access
40 str r3, [r0, #AT91_SDRAMC_LPR] @ power down SDRAM
41 str r4, [r1] @ reset processor
42
43 b .
44
45.at91_va_base_sdramc:
46 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
47.at91_va_base_rstc_cr:
48 .word AT91_VA_BASE_SYS + AT91_RSTC_CR
diff --git a/arch/arm/mach-at91/at91sam9g20_reset.S b/arch/arm/mach-at91/at91sam9g20_reset.S
deleted file mode 100644
index 1631c38bc6b8..000000000000
--- a/arch/arm/mach-at91/at91sam9g20_reset.S
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * reset AT91SAM9G20 as per errata
3 *
4 * (C) BitBox Ltd 2010
5 *
6 * unless the SDRAM is cleanly shutdown before we hit the
7 * reset register it can be left driving the data bus and
8 * killing the chance of a subsequent boot from NAND
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#define CP15_CR_I (1 << 12)
17
18#define SYS_VIRT_OFS (-0x01000000)
19
20#define SDRAMC_BASE (SYS_VIRT_OFS + 0xffffea00)
21#define SDRAMC_TR 0x0004
22#define SDRAMC_LPR 0x0010
23#define SDRAMC_LPCB_POWER_DOWN 2
24
25#define RSTC_BASE (SYS_VIRT_OFS + 0xfffffd00)
26#define RSTC_CR 0x0000
27#define RSTC_PROCRST (1 << 0)
28#define RSTC_PERRST (1 << 2)
29#define RSTC_KEY (0xa5 << 24)
30
31 .arm
32
33 .globl at91sam9g20_reset
34
35at91sam9g20_reset: mov r0, #0
36 mcr p15, 0, r0, c7, c5, 0 @ flush I-cache
37
38 mrc p15, 0, r0, c1, c0, 0
39 orr r0, r0, #CP15_CR_I
40 mcr p15, 0, r0, c1, c0, 0 @ enable I-cache
41
42 ldr r0, =SDRAMC_BASE @ preload constants
43 ldr r1, =RSTC_BASE
44
45 mov r2, #1
46 mov r3, #SDRAMC_LPCB_POWER_DOWN
47 ldr r4, =RSTC_KEY | RSTC_PERRST | RSTC_PROCRST
48
49 .balign 32 @ align to cache line
50
51 str r2, [r0, #SDRAMC_TR] @ disable SDRAM access
52 str r3, [r0, #SDRAMC_LPR] @ power down SDRAM
53 str r4, [r1, #RSTC_CR] @ reset processor
54
55 b .