diff options
author | Arnd Bergmann <arnd@arndb.de> | 2014-05-23 18:44:17 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2014-05-23 18:44:17 -0400 |
commit | 80e98a9ca6ded6d0fb6c2362c07638cbe3c58e2c (patch) | |
tree | ba98513f6b5d676980145fef7092910141009eaa /arch/arm/mach-bcm | |
parent | 3c2580173e3bc820a8f8c0db968f757b8eca7fe5 (diff) | |
parent | eeda4cb92ee0fb63a5917738e107b0bc8168079e (diff) |
Merge branch 'bcm/cleanup' into next/soc
Conflicts:
arch/arm/mach-bcm/Kconfig
Diffstat (limited to 'arch/arm/mach-bcm')
-rw-r--r-- | arch/arm/mach-bcm/Kconfig | 40 | ||||
-rw-r--r-- | arch/arm/mach-bcm/Makefile | 21 | ||||
-rw-r--r-- | arch/arm/mach-bcm/bcm_kona_smc.c | 136 | ||||
-rw-r--r-- | arch/arm/mach-bcm/bcm_kona_smc.h | 52 | ||||
-rw-r--r-- | arch/arm/mach-bcm/bcm_kona_smc_asm.S | 41 | ||||
-rw-r--r-- | arch/arm/mach-bcm/board_bcm21664.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-bcm/board_bcm281xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-bcm/kona_l2_cache.c (renamed from arch/arm/mach-bcm/kona.c) | 16 | ||||
-rw-r--r-- | arch/arm/mach-bcm/kona_l2_cache.h (renamed from arch/arm/mach-bcm/kona.h) | 6 |
9 files changed, 170 insertions, 149 deletions
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig index 9f19636fea2f..b8cc9e8992f1 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig | |||
@@ -10,21 +10,51 @@ if ARCH_BCM | |||
10 | menu "Broadcom SoC Selection" | 10 | menu "Broadcom SoC Selection" |
11 | 11 | ||
12 | config ARCH_BCM_MOBILE | 12 | config ARCH_BCM_MOBILE |
13 | bool "Broadcom Mobile SoC" if ARCH_MULTI_V7 | 13 | bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 |
14 | select ARCH_REQUIRE_GPIOLIB | 14 | select ARCH_REQUIRE_GPIOLIB |
15 | select ARM_ERRATA_754322 | 15 | select ARM_ERRATA_754322 |
16 | select ARM_ERRATA_764369 if SMP | 16 | select ARM_ERRATA_764369 if SMP |
17 | select ARM_GIC | 17 | select ARM_GIC |
18 | select GPIO_BCM_KONA | 18 | select GPIO_BCM_KONA |
19 | select TICK_ONESHOT | 19 | select TICK_ONESHOT |
20 | select CACHE_L2X0 | ||
21 | select HAVE_ARM_ARCH_TIMER | 20 | select HAVE_ARM_ARCH_TIMER |
22 | select PINCTRL | 21 | select PINCTRL |
23 | help | 22 | help |
24 | This enables support for systems based on Broadcom mobile SoCs. | 23 | This enables support for systems based on Broadcom mobile SoCs. |
25 | It currently supports the 'BCM281XX' family, which includes | 24 | |
26 | BCM11130, BCM11140, BCM11351, BCM28145 and | 25 | if ARCH_BCM_MOBILE |
27 | BCM28155 variants. | 26 | |
27 | menu "Broadcom Mobile SoC Selection" | ||
28 | |||
29 | config ARCH_BCM_281XX | ||
30 | bool "Broadcom BCM281XX SoC family" | ||
31 | default y | ||
32 | help | ||
33 | Enable support for the the BCM281XX family, which includes | ||
34 | BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155 | ||
35 | variants. | ||
36 | |||
37 | config ARCH_BCM_21664 | ||
38 | bool "Broadcom BCM21664 SoC family" | ||
39 | default y | ||
40 | help | ||
41 | Enable support for the the BCM21664 family, which includes | ||
42 | BCM21663 and BCM21664 variants. | ||
43 | |||
44 | config ARCH_BCM_MOBILE_L2_CACHE | ||
45 | bool "Broadcom mobile SoC level 2 cache support" | ||
46 | depends on (ARCH_BCM_281XX || ARCH_BCM_21664) | ||
47 | default y | ||
48 | select CACHE_L2X0 | ||
49 | select ARCH_BCM_MOBILE_SMC | ||
50 | |||
51 | config ARCH_BCM_MOBILE_SMC | ||
52 | bool | ||
53 | depends on ARCH_BCM_281XX || ARCH_BCM_21664 | ||
54 | |||
55 | endmenu | ||
56 | |||
57 | endif | ||
28 | 58 | ||
29 | config ARCH_BCM2835 | 59 | config ARCH_BCM2835 |
30 | bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 | 60 | bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 |
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile index a326b28c4406..731292114975 100644 --- a/arch/arm/mach-bcm/Makefile +++ b/arch/arm/mach-bcm/Makefile | |||
@@ -10,10 +10,23 @@ | |||
10 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | # GNU General Public License for more details. | 11 | # GNU General Public License for more details. |
12 | 12 | ||
13 | obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o board_bcm21664.o \ | 13 | # BCM281XX |
14 | bcm_kona_smc.o bcm_kona_smc_asm.o kona.o | 14 | obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o |
15 | |||
16 | # BCM21664 | ||
17 | obj-$(CONFIG_ARCH_BCM_21664) += board_bcm21664.o | ||
18 | |||
19 | # BCM281XX and BCM21664 L2 cache control | ||
20 | obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o | ||
21 | |||
22 | # Support for secure monitor traps | ||
23 | obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o | ||
24 | ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec) | ||
25 | CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC | ||
26 | endif | ||
27 | |||
28 | # BCM2835 | ||
15 | obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o | 29 | obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o |
16 | 30 | ||
17 | plus_sec := $(call as-instr,.arch_extension sec,+sec) | 31 | # BCM5301X |
18 | AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec) | ||
19 | obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o | 32 | obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o |
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index 5e31e918f325..a55a7ecf146a 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c | |||
@@ -21,11 +21,8 @@ | |||
21 | 21 | ||
22 | #include "bcm_kona_smc.h" | 22 | #include "bcm_kona_smc.h" |
23 | 23 | ||
24 | struct secure_bridge_data { | 24 | static u32 bcm_smc_buffer_phys; /* physical address */ |
25 | void __iomem *bounce; /* virtual address */ | 25 | static void __iomem *bcm_smc_buffer; /* virtual address */ |
26 | u32 __iomem buffer_addr; /* physical address */ | ||
27 | int initialized; | ||
28 | } bridge_data; | ||
29 | 26 | ||
30 | struct bcm_kona_smc_data { | 27 | struct bcm_kona_smc_data { |
31 | unsigned service_id; | 28 | unsigned service_id; |
@@ -33,6 +30,7 @@ struct bcm_kona_smc_data { | |||
33 | unsigned arg1; | 30 | unsigned arg1; |
34 | unsigned arg2; | 31 | unsigned arg2; |
35 | unsigned arg3; | 32 | unsigned arg3; |
33 | unsigned result; | ||
36 | }; | 34 | }; |
37 | 35 | ||
38 | static const struct of_device_id bcm_kona_smc_ids[] __initconst = { | 36 | static const struct of_device_id bcm_kona_smc_ids[] __initconst = { |
@@ -41,59 +39,125 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = { | |||
41 | {}, | 39 | {}, |
42 | }; | 40 | }; |
43 | 41 | ||
44 | /* Map in the bounce area */ | 42 | /* Map in the args buffer area */ |
45 | int __init bcm_kona_smc_init(void) | 43 | int __init bcm_kona_smc_init(void) |
46 | { | 44 | { |
47 | struct device_node *node; | 45 | struct device_node *node; |
46 | const __be32 *prop_val; | ||
47 | u64 prop_size = 0; | ||
48 | unsigned long buffer_size; | ||
49 | u32 buffer_phys; | ||
48 | 50 | ||
49 | /* Read buffer addr and size from the device tree node */ | 51 | /* Read buffer addr and size from the device tree node */ |
50 | node = of_find_matching_node(NULL, bcm_kona_smc_ids); | 52 | node = of_find_matching_node(NULL, bcm_kona_smc_ids); |
51 | if (!node) | 53 | if (!node) |
52 | return -ENODEV; | 54 | return -ENODEV; |
53 | 55 | ||
54 | /* Don't care about size or flags of the DT node */ | 56 | prop_val = of_get_address(node, 0, &prop_size, NULL); |
55 | bridge_data.buffer_addr = | 57 | if (!prop_val) |
56 | be32_to_cpu(*of_get_address(node, 0, NULL, NULL)); | 58 | return -EINVAL; |
57 | BUG_ON(!bridge_data.buffer_addr); | ||
58 | 59 | ||
59 | bridge_data.bounce = of_iomap(node, 0); | 60 | /* We assume space for four 32-bit arguments */ |
60 | BUG_ON(!bridge_data.bounce); | 61 | if (prop_size < 4 * sizeof(u32) || prop_size > (u64)ULONG_MAX) |
62 | return -EINVAL; | ||
63 | buffer_size = (unsigned long)prop_size; | ||
61 | 64 | ||
62 | bridge_data.initialized = 1; | 65 | buffer_phys = be32_to_cpup(prop_val); |
66 | if (!buffer_phys) | ||
67 | return -EINVAL; | ||
68 | |||
69 | bcm_smc_buffer = ioremap(buffer_phys, buffer_size); | ||
70 | if (!bcm_smc_buffer) | ||
71 | return -ENOMEM; | ||
72 | bcm_smc_buffer_phys = buffer_phys; | ||
63 | 73 | ||
64 | pr_info("Kona Secure API initialized\n"); | 74 | pr_info("Kona Secure API initialized\n"); |
65 | 75 | ||
66 | return 0; | 76 | return 0; |
67 | } | 77 | } |
68 | 78 | ||
79 | /* | ||
80 | * int bcm_kona_do_smc(u32 service_id, u32 buffer_addr) | ||
81 | * | ||
82 | * Only core 0 can run the secure monitor code. If an "smc" request | ||
83 | * is initiated on a different core it must be redirected to core 0 | ||
84 | * for execution. We rely on the caller to handle this. | ||
85 | * | ||
86 | * Each "smc" request supplies a service id and the address of a | ||
87 | * buffer containing parameters related to the service to be | ||
88 | * performed. A flags value defines the behavior of the level 2 | ||
89 | * cache and interrupt handling while the secure monitor executes. | ||
90 | * | ||
91 | * Parameters to the "smc" request are passed in r4-r6 as follows: | ||
92 | * r4 service id | ||
93 | * r5 flags (SEC_ROM_*) | ||
94 | * r6 physical address of buffer with other parameters | ||
95 | * | ||
96 | * Execution of an "smc" request produces two distinct results. | ||
97 | * | ||
98 | * First, the secure monitor call itself (regardless of the specific | ||
99 | * service request) can succeed, or can produce an error. When an | ||
100 | * "smc" request completes this value is found in r12; it should | ||
101 | * always be SEC_EXIT_NORMAL. | ||
102 | * | ||
103 | * In addition, the particular service performed produces a result. | ||
104 | * The values that should be expected depend on the service. We | ||
105 | * therefore return this value to the caller, so it can handle the | ||
106 | * request result appropriately. This result value is found in r0 | ||
107 | * when the "smc" request completes. | ||
108 | */ | ||
109 | static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) | ||
110 | { | ||
111 | register u32 ip asm("ip"); /* Also called r12 */ | ||
112 | register u32 r0 asm("r0"); | ||
113 | register u32 r4 asm("r4"); | ||
114 | register u32 r5 asm("r5"); | ||
115 | register u32 r6 asm("r6"); | ||
116 | |||
117 | r4 = service_id; | ||
118 | r5 = 0x3; /* Keep IRQ and FIQ off in SM */ | ||
119 | r6 = buffer_phys; | ||
120 | |||
121 | asm volatile ( | ||
122 | /* Make sure we got the registers we want */ | ||
123 | __asmeq("%0", "ip") | ||
124 | __asmeq("%1", "r0") | ||
125 | __asmeq("%2", "r4") | ||
126 | __asmeq("%3", "r5") | ||
127 | __asmeq("%4", "r6") | ||
128 | #ifdef REQUIRES_SEC | ||
129 | ".arch_extension sec\n" | ||
130 | #endif | ||
131 | " smc #0\n" | ||
132 | : "=r" (ip), "=r" (r0) | ||
133 | : "r" (r4), "r" (r5), "r" (r6) | ||
134 | : "r1", "r2", "r3", "r7", "lr"); | ||
135 | |||
136 | BUG_ON(ip != SEC_EXIT_NORMAL); | ||
137 | |||
138 | return r0; | ||
139 | } | ||
140 | |||
69 | /* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */ | 141 | /* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */ |
70 | static void __bcm_kona_smc(void *info) | 142 | static void __bcm_kona_smc(void *info) |
71 | { | 143 | { |
72 | struct bcm_kona_smc_data *data = info; | 144 | struct bcm_kona_smc_data *data = info; |
73 | u32 *args = bridge_data.bounce; | 145 | u32 *args = bcm_smc_buffer; |
74 | int rc = 0; | ||
75 | 146 | ||
76 | /* Must run on CPU 0 */ | ||
77 | BUG_ON(smp_processor_id() != 0); | 147 | BUG_ON(smp_processor_id() != 0); |
148 | BUG_ON(!args); | ||
78 | 149 | ||
79 | /* Check map in the bounce area */ | 150 | /* Copy the four 32 bit argument values into the bounce area */ |
80 | BUG_ON(!bridge_data.initialized); | 151 | writel_relaxed(data->arg0, args++); |
81 | 152 | writel_relaxed(data->arg1, args++); | |
82 | /* Copy one 32 bit word into the bounce area */ | 153 | writel_relaxed(data->arg2, args++); |
83 | args[0] = data->arg0; | 154 | writel(data->arg3, args); |
84 | args[1] = data->arg1; | ||
85 | args[2] = data->arg2; | ||
86 | args[3] = data->arg3; | ||
87 | 155 | ||
88 | /* Flush caches for input data passed to Secure Monitor */ | 156 | /* Flush caches for input data passed to Secure Monitor */ |
89 | if (data->service_id != SSAPI_BRCM_START_VC_CORE) | 157 | flush_cache_all(); |
90 | flush_cache_all(); | ||
91 | |||
92 | /* Trap into Secure Monitor */ | ||
93 | rc = bcm_kona_smc_asm(data->service_id, bridge_data.buffer_addr); | ||
94 | 158 | ||
95 | if (rc != SEC_ROM_RET_OK) | 159 | /* Trap into Secure Monitor and record the request result */ |
96 | pr_err("Secure Monitor call failed (0x%x)!\n", rc); | 160 | data->result = bcm_kona_do_smc(data->service_id, bcm_smc_buffer_phys); |
97 | } | 161 | } |
98 | 162 | ||
99 | unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, | 163 | unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, |
@@ -106,17 +170,13 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, | |||
106 | data.arg1 = arg1; | 170 | data.arg1 = arg1; |
107 | data.arg2 = arg2; | 171 | data.arg2 = arg2; |
108 | data.arg3 = arg3; | 172 | data.arg3 = arg3; |
173 | data.result = 0; | ||
109 | 174 | ||
110 | /* | 175 | /* |
111 | * Due to a limitation of the secure monitor, we must use the SMP | 176 | * Due to a limitation of the secure monitor, we must use the SMP |
112 | * infrastructure to forward all secure monitor calls to Core 0. | 177 | * infrastructure to forward all secure monitor calls to Core 0. |
113 | */ | 178 | */ |
114 | if (get_cpu() != 0) | 179 | smp_call_function_single(0, __bcm_kona_smc, &data, 1); |
115 | smp_call_function_single(0, __bcm_kona_smc, (void *)&data, 1); | ||
116 | else | ||
117 | __bcm_kona_smc(&data); | ||
118 | 180 | ||
119 | put_cpu(); | 181 | return data.result; |
120 | |||
121 | return 0; | ||
122 | } | 182 | } |
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.h b/arch/arm/mach-bcm/bcm_kona_smc.h index d098a7e76744..2e29ec67e414 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.h +++ b/arch/arm/mach-bcm/bcm_kona_smc.h | |||
@@ -15,55 +15,12 @@ | |||
15 | #define BCM_KONA_SMC_H | 15 | #define BCM_KONA_SMC_H |
16 | 16 | ||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #define FLAGS (SEC_ROM_ICACHE_ENABLE_MASK | SEC_ROM_DCACHE_ENABLE_MASK | \ | ||
19 | SEC_ROM_IRQ_ENABLE_MASK | SEC_ROM_FIQ_ENABLE_MASK) | ||
20 | 18 | ||
21 | /*! | 19 | /* Broadcom Secure Service API service IDs, return codes, and exit codes */ |
22 | * Definitions for IRQ & FIQ Mask for ARM | 20 | #define SSAPI_ENABLE_L2_CACHE 0x01000002 |
23 | */ | ||
24 | |||
25 | #define FIQ_IRQ_MASK 0xC0 | ||
26 | #define FIQ_MASK 0x40 | ||
27 | #define IRQ_MASK 0x80 | ||
28 | |||
29 | /*! | ||
30 | * Secure Mode FLAGs | ||
31 | */ | ||
32 | |||
33 | /* When set, enables ICache within the secure mode */ | ||
34 | #define SEC_ROM_ICACHE_ENABLE_MASK 0x00000001 | ||
35 | |||
36 | /* When set, enables DCache within the secure mode */ | ||
37 | #define SEC_ROM_DCACHE_ENABLE_MASK 0x00000002 | ||
38 | |||
39 | /* When set, enables IRQ within the secure mode */ | ||
40 | #define SEC_ROM_IRQ_ENABLE_MASK 0x00000004 | ||
41 | |||
42 | /* When set, enables FIQ within the secure mode */ | ||
43 | #define SEC_ROM_FIQ_ENABLE_MASK 0x00000008 | ||
44 | |||
45 | /* When set, enables Unified L2 cache within the secure mode */ | ||
46 | #define SEC_ROM_UL2_CACHE_ENABLE_MASK 0x00000010 | ||
47 | |||
48 | /* Broadcom Secure Service API Service IDs */ | ||
49 | #define SSAPI_DORMANT_ENTRY_SERV 0x01000000 | ||
50 | #define SSAPI_PUBLIC_OTP_SERV 0x01000001 | ||
51 | #define SSAPI_ENABLE_L2_CACHE 0x01000002 | ||
52 | #define SSAPI_DISABLE_L2_CACHE 0x01000003 | ||
53 | #define SSAPI_WRITE_SCU_STATUS 0x01000004 | ||
54 | #define SSAPI_WRITE_PWR_GATE 0x01000005 | ||
55 | |||
56 | /* Broadcom Secure Service API Return Codes */ | ||
57 | #define SEC_ROM_RET_OK 0x00000001 | 21 | #define SEC_ROM_RET_OK 0x00000001 |
58 | #define SEC_ROM_RET_FAIL 0x00000009 | ||
59 | |||
60 | #define SSAPI_RET_FROM_INT_SERV 0x4 | ||
61 | #define SEC_EXIT_NORMAL 0x1 | 22 | #define SEC_EXIT_NORMAL 0x1 |
62 | 23 | ||
63 | #define SSAPI_ROW_AES 0x0E000006 | ||
64 | #define SSAPI_BRCM_START_VC_CORE 0x0E000008 | ||
65 | |||
66 | #ifndef __ASSEMBLY__ | ||
67 | extern int __init bcm_kona_smc_init(void); | 24 | extern int __init bcm_kona_smc_init(void); |
68 | 25 | ||
69 | extern unsigned bcm_kona_smc(unsigned service_id, | 26 | extern unsigned bcm_kona_smc(unsigned service_id, |
@@ -72,9 +29,4 @@ extern unsigned bcm_kona_smc(unsigned service_id, | |||
72 | unsigned arg2, | 29 | unsigned arg2, |
73 | unsigned arg3); | 30 | unsigned arg3); |
74 | 31 | ||
75 | extern int bcm_kona_smc_asm(u32 service_id, | ||
76 | u32 buffer_addr); | ||
77 | |||
78 | #endif /* __ASSEMBLY__ */ | ||
79 | |||
80 | #endif /* BCM_KONA_SMC_H */ | 32 | #endif /* BCM_KONA_SMC_H */ |
diff --git a/arch/arm/mach-bcm/bcm_kona_smc_asm.S b/arch/arm/mach-bcm/bcm_kona_smc_asm.S deleted file mode 100644 index a1608480d60d..000000000000 --- a/arch/arm/mach-bcm/bcm_kona_smc_asm.S +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
9 | * kind, whether express or implied; without even the implied warranty | ||
10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/linkage.h> | ||
15 | #include "bcm_kona_smc.h" | ||
16 | |||
17 | /* | ||
18 | * int bcm_kona_smc_asm(u32 service_id, u32 buffer_addr) | ||
19 | */ | ||
20 | |||
21 | ENTRY(bcm_kona_smc_asm) | ||
22 | stmfd sp!, {r4-r12, lr} | ||
23 | mov r4, r0 @ service_id | ||
24 | mov r5, #3 @ Keep IRQ and FIQ off in SM | ||
25 | /* | ||
26 | * Since interrupts are disabled in the open mode, we must keep | ||
27 | * interrupts disabled in secure mode by setting R5=0x3. If interrupts | ||
28 | * are enabled in open mode, we can set R5=0x0 to allow interrupts in | ||
29 | * secure mode. If we did this, the secure monitor would return back | ||
30 | * control to the open mode to handle the interrupt prior to completing | ||
31 | * the secure service. If this happened, R12 would not be | ||
32 | * SEC_EXIT_NORMAL and we would need to call SMC again after resetting | ||
33 | * R5 (it gets clobbered by the secure monitor) and setting R4 to | ||
34 | * SSAPI_RET_FROM_INT_SERV to indicate that we want the secure monitor | ||
35 | * to finish up the previous uncompleted secure service. | ||
36 | */ | ||
37 | mov r6, r1 @ buffer_addr | ||
38 | smc #0 | ||
39 | /* Check r12 for SEC_EXIT_NORMAL here if interrupts are enabled */ | ||
40 | ldmfd sp!, {r4-r12, pc} | ||
41 | ENDPROC(bcm_kona_smc_asm) | ||
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c index acc1573fd005..f0521cc0640d 100644 --- a/arch/arm/mach-bcm/board_bcm21664.c +++ b/arch/arm/mach-bcm/board_bcm21664.c | |||
@@ -11,14 +11,13 @@ | |||
11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/clocksource.h> | ||
15 | #include <linux/of_address.h> | 14 | #include <linux/of_address.h> |
16 | #include <linux/of_platform.h> | 15 | #include <linux/of_platform.h> |
16 | #include <linux/io.h> | ||
17 | 17 | ||
18 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
19 | 19 | ||
20 | #include "bcm_kona_smc.h" | 20 | #include "kona_l2_cache.h" |
21 | #include "kona.h" | ||
22 | 21 | ||
23 | #define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr" | 22 | #define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr" |
24 | 23 | ||
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c index 6be54c10f8cb..1ac59fc0cb15 100644 --- a/arch/arm/mach-bcm/board_bcm281xx.c +++ b/arch/arm/mach-bcm/board_bcm281xx.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
19 | 19 | ||
20 | #include "kona.h" | 20 | #include "kona_l2_cache.h" |
21 | 21 | ||
22 | #define SECWDOG_OFFSET 0x00000000 | 22 | #define SECWDOG_OFFSET 0x00000000 |
23 | #define SECWDOG_RESERVED_MASK 0xe2000000 | 23 | #define SECWDOG_RESERVED_MASK 0xe2000000 |
diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona_l2_cache.c index 768bc2837bf5..b31970377c20 100644 --- a/arch/arm/mach-bcm/kona.c +++ b/arch/arm/mach-bcm/kona_l2_cache.c | |||
@@ -11,19 +11,18 @@ | |||
11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/of_platform.h> | 14 | |
15 | #include <linux/init.h> | ||
16 | #include <linux/printk.h> | ||
15 | #include <asm/hardware/cache-l2x0.h> | 17 | #include <asm/hardware/cache-l2x0.h> |
16 | 18 | ||
17 | #include "bcm_kona_smc.h" | 19 | #include "bcm_kona_smc.h" |
18 | #include "kona.h" | ||
19 | 20 | ||
20 | void __init kona_l2_cache_init(void) | 21 | void __init kona_l2_cache_init(void) |
21 | { | 22 | { |
23 | unsigned int result; | ||
22 | int ret; | 24 | int ret; |
23 | 25 | ||
24 | if (!IS_ENABLED(CONFIG_CACHE_L2X0)) | ||
25 | return; | ||
26 | |||
27 | ret = bcm_kona_smc_init(); | 26 | ret = bcm_kona_smc_init(); |
28 | if (ret) { | 27 | if (ret) { |
29 | pr_info("Secure API not available (%d). Skipping L2 init.\n", | 28 | pr_info("Secure API not available (%d). Skipping L2 init.\n", |
@@ -31,7 +30,12 @@ void __init kona_l2_cache_init(void) | |||
31 | return; | 30 | return; |
32 | } | 31 | } |
33 | 32 | ||
34 | bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); | 33 | result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); |
34 | if (result != SEC_ROM_RET_OK) { | ||
35 | pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n", | ||
36 | result); | ||
37 | return; | ||
38 | } | ||
35 | 39 | ||
36 | /* | 40 | /* |
37 | * The aux_val and aux_mask have no effect since L2 cache is already | 41 | * The aux_val and aux_mask have no effect since L2 cache is already |
diff --git a/arch/arm/mach-bcm/kona.h b/arch/arm/mach-bcm/kona_l2_cache.h index 3a7a017c29cd..46f84a95ab1c 100644 --- a/arch/arm/mach-bcm/kona.h +++ b/arch/arm/mach-bcm/kona_l2_cache.h | |||
@@ -11,4 +11,8 @@ | |||
11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | void __init kona_l2_cache_init(void); | 14 | #ifdef CONFIG_ARCH_BCM_MOBILE_L2_CACHE |
15 | void kona_l2_cache_init(void); | ||
16 | #else | ||
17 | #define kona_l2_cache_init() ((void)0) | ||
18 | #endif | ||