diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2012-11-18 22:00:41 -0500 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2012-12-19 00:10:22 -0500 |
commit | c622b29d1f38021411965b7e0170ab055551b257 (patch) | |
tree | f86875612ade331965b80abafb14cbd796924461 | |
parent | 733536b865441d9bad02c4711a4372d48ce21e54 (diff) |
xtensa: initialize atomctl SR
In order to use S32C1I instruction on cores with ATOMCTL SR the register
must be properly initialized.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
-rw-r--r-- | Documentation/xtensa/atomctl.txt | 44 | ||||
-rw-r--r-- | arch/xtensa/include/asm/initialize_mmu.h | 55 | ||||
-rw-r--r-- | arch/xtensa/kernel/head.S | 3 |
3 files changed, 102 insertions, 0 deletions
diff --git a/Documentation/xtensa/atomctl.txt b/Documentation/xtensa/atomctl.txt new file mode 100644 index 000000000000..10a8d1ff35ec --- /dev/null +++ b/Documentation/xtensa/atomctl.txt | |||
@@ -0,0 +1,44 @@ | |||
1 | We Have Atomic Operation Control (ATOMCTL) Register. | ||
2 | This register determines the effect of using a S32C1I instruction | ||
3 | with various combinations of: | ||
4 | |||
5 | 1. With and without an Coherent Cache Controller which | ||
6 | can do Atomic Transactions to the memory internally. | ||
7 | |||
8 | 2. With and without An Intelligent Memory Controller which | ||
9 | can do Atomic Transactions itself. | ||
10 | |||
11 | The Core comes up with a default value of for the three types of cache ops: | ||
12 | |||
13 | 0x28: (WB: Internal, WT: Internal, BY:Exception) | ||
14 | |||
15 | On the FPGA Cards we typically simulate an Intelligent Memory controller | ||
16 | which can implement RCW transactions. For FPGA cards with an External | ||
17 | Memory controller we let it to the atomic operations internally while | ||
18 | doing a Cached (WB) transaction and use the Memory RCW for un-cached | ||
19 | operations. | ||
20 | |||
21 | For systems without an coherent cache controller, non-MX, we always | ||
22 | use the memory controllers RCW, thought non-MX controlers likely | ||
23 | support the Internal Operation. | ||
24 | |||
25 | CUSTOMER-WARNING: | ||
26 | Virtually all customers buy their memory controllers from vendors that | ||
27 | don't support atomic RCW memory transactions and will likely want to | ||
28 | configure this register to not use RCW. | ||
29 | |||
30 | Developers might find using RCW in Bypass mode convenient when testing | ||
31 | with the cache being bypassed; for example studying cache alias problems. | ||
32 | |||
33 | See Section 4.3.12.4 of ISA; Bits: | ||
34 | |||
35 | WB WT BY | ||
36 | 5 4 | 3 2 | 1 0 | ||
37 | 2 Bit | ||
38 | Field | ||
39 | Values WB - Write Back WT - Write Thru BY - Bypass | ||
40 | --------- --------------- ----------------- ---------------- | ||
41 | 0 Exception Exception Exception | ||
42 | 1 RCW Transaction RCW Transaction RCW Transaction | ||
43 | 2 Internal Operation Exception Reserved | ||
44 | 3 Reserved Reserved Reserved | ||
diff --git a/arch/xtensa/include/asm/initialize_mmu.h b/arch/xtensa/include/asm/initialize_mmu.h new file mode 100644 index 000000000000..e1f8ba4061ed --- /dev/null +++ b/arch/xtensa/include/asm/initialize_mmu.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * arch/xtensa/include/asm/initialize_mmu.h | ||
3 | * | ||
4 | * Initializes MMU: | ||
5 | * | ||
6 | * For the new V3 MMU we remap the TLB from virtual == physical | ||
7 | * to the standard Linux mapping used in earlier MMU's. | ||
8 | * | ||
9 | * The the MMU we also support a new configuration register that | ||
10 | * specifies how the S32C1I instruction operates with the cache | ||
11 | * controller. | ||
12 | * | ||
13 | * This file is subject to the terms and conditions of the GNU General | ||
14 | * Public License. See the file "COPYING" in the main directory of | ||
15 | * this archive for more details. | ||
16 | * | ||
17 | * Copyright (C) 2008 - 2012 Tensilica, Inc. | ||
18 | * | ||
19 | * Marc Gauthier <marc@tensilica.com> | ||
20 | * Pete Delaney <piet@tensilica.com> | ||
21 | */ | ||
22 | |||
23 | #ifndef _XTENSA_INITIALIZE_MMU_H | ||
24 | #define _XTENSA_INITIALIZE_MMU_H | ||
25 | |||
26 | #ifdef __ASSEMBLY__ | ||
27 | |||
28 | #define XTENSA_HWVERSION_RC_2009_0 230000 | ||
29 | |||
30 | .macro initialize_mmu | ||
31 | |||
32 | #if XCHAL_HAVE_S32C1I && (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0) | ||
33 | /* | ||
34 | * We Have Atomic Operation Control (ATOMCTL) Register; Initialize it. | ||
35 | * For details see Documentation/xtensa/atomctl.txt | ||
36 | */ | ||
37 | #if XCHAL_DCACHE_IS_COHERENT | ||
38 | movi a3, 0x25 /* For SMP/MX -- internal for writeback, | ||
39 | * RCW otherwise | ||
40 | */ | ||
41 | #else | ||
42 | movi a3, 0x29 /* non-MX -- Most cores use Std Memory | ||
43 | * Controlers which usually can't use RCW | ||
44 | */ | ||
45 | #endif | ||
46 | wsr a3, atomctl | ||
47 | #endif /* XCHAL_HAVE_S32C1I && | ||
48 | * (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0) | ||
49 | */ | ||
50 | |||
51 | .endm | ||
52 | |||
53 | #endif /*__ASSEMBLY__*/ | ||
54 | |||
55 | #endif /* _XTENSA_INITIALIZE_MMU_H */ | ||
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S index 417998c02108..9013ae0174f8 100644 --- a/arch/xtensa/kernel/head.S +++ b/arch/xtensa/kernel/head.S | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
19 | #include <asm/page.h> | 19 | #include <asm/page.h> |
20 | #include <asm/cacheasm.h> | 20 | #include <asm/cacheasm.h> |
21 | #include <asm/initialize_mmu.h> | ||
21 | 22 | ||
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
23 | #include <linux/linkage.h> | 24 | #include <linux/linkage.h> |
@@ -155,6 +156,8 @@ ENTRY(_startup) | |||
155 | 156 | ||
156 | isync | 157 | isync |
157 | 158 | ||
159 | initialize_mmu | ||
160 | |||
158 | /* Unpack data sections | 161 | /* Unpack data sections |
159 | * | 162 | * |
160 | * The linker script used to build the Linux kernel image | 163 | * The linker script used to build the Linux kernel image |