diff options
author | Tony Lindgren <tony@atomide.com> | 2013-10-11 19:14:23 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-10-11 19:14:23 -0400 |
commit | 9e490f486ea9ce7644be913e03ee5ccdf1be20f7 (patch) | |
tree | 7e8396a6addebd72e228f3beaa53826f3da227f3 | |
parent | 576e5bda70a5442381ee31285edada114d692132 (diff) | |
parent | d2065e2b5bb3ec986f0f3ba044a81a136767d0b4 (diff) |
Merge branch 'omap-for-v3.13/n900' into omap-for-v3.13/board
-rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-rx51.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-omap2/cclock3xxx_data.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.c | 76 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-smc.S | 21 |
6 files changed, 141 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index c3270c0f1fce..497d2604c7c5 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -57,6 +57,8 @@ | |||
57 | #include "common-board-devices.h" | 57 | #include "common-board-devices.h" |
58 | #include "gpmc.h" | 58 | #include "gpmc.h" |
59 | #include "gpmc-onenand.h" | 59 | #include "gpmc-onenand.h" |
60 | #include "soc.h" | ||
61 | #include "omap-secure.h" | ||
60 | 62 | ||
61 | #define SYSTEM_REV_B_USES_VAUX3 0x1699 | 63 | #define SYSTEM_REV_B_USES_VAUX3 0x1699 |
62 | #define SYSTEM_REV_S_USES_VAUX3 0x8 | 64 | #define SYSTEM_REV_S_USES_VAUX3 0x8 |
@@ -1289,6 +1291,22 @@ static void __init rx51_init_twl4030_hwmon(void) | |||
1289 | platform_device_register(&madc_hwmon); | 1291 | platform_device_register(&madc_hwmon); |
1290 | } | 1292 | } |
1291 | 1293 | ||
1294 | static struct platform_device omap3_rom_rng_device = { | ||
1295 | .name = "omap3-rom-rng", | ||
1296 | .id = -1, | ||
1297 | .dev = { | ||
1298 | .platform_data = rx51_secure_rng_call, | ||
1299 | }, | ||
1300 | }; | ||
1301 | |||
1302 | static void __init rx51_init_omap3_rom_rng(void) | ||
1303 | { | ||
1304 | if (omap_type() == OMAP2_DEVICE_TYPE_SEC) { | ||
1305 | pr_info("RX-51: Registring OMAP3 HWRNG device\n"); | ||
1306 | platform_device_register(&omap3_rom_rng_device); | ||
1307 | } | ||
1308 | } | ||
1309 | |||
1292 | void __init rx51_peripherals_init(void) | 1310 | void __init rx51_peripherals_init(void) |
1293 | { | 1311 | { |
1294 | rx51_i2c_init(); | 1312 | rx51_i2c_init(); |
@@ -1309,5 +1327,6 @@ void __init rx51_peripherals_init(void) | |||
1309 | 1327 | ||
1310 | rx51_charger_init(); | 1328 | rx51_charger_init(); |
1311 | rx51_init_twl4030_hwmon(); | 1329 | rx51_init_twl4030_hwmon(); |
1330 | rx51_init_omap3_rom_rng(); | ||
1312 | } | 1331 | } |
1313 | 1332 | ||
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index 7735105561d8..db168c9627a1 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -2,6 +2,8 @@ | |||
2 | * Board support file for Nokia N900 (aka RX-51). | 2 | * Board support file for Nokia N900 (aka RX-51). |
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Nokia | 4 | * Copyright (C) 2007, 2008 Nokia |
5 | * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> | ||
6 | * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> | ||
5 | * | 7 | * |
6 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -31,7 +33,9 @@ | |||
31 | #include "mux.h" | 33 | #include "mux.h" |
32 | #include "gpmc.h" | 34 | #include "gpmc.h" |
33 | #include "pm.h" | 35 | #include "pm.h" |
36 | #include "soc.h" | ||
34 | #include "sdram-nokia.h" | 37 | #include "sdram-nokia.h" |
38 | #include "omap-secure.h" | ||
35 | 39 | ||
36 | #define RX51_GPIO_SLEEP_IND 162 | 40 | #define RX51_GPIO_SLEEP_IND 162 |
37 | 41 | ||
@@ -103,6 +107,14 @@ static void __init rx51_init(void) | |||
103 | usb_musb_init(&musb_board_data); | 107 | usb_musb_init(&musb_board_data); |
104 | rx51_peripherals_init(); | 108 | rx51_peripherals_init(); |
105 | 109 | ||
110 | if (omap_type() == OMAP2_DEVICE_TYPE_SEC) { | ||
111 | #ifdef CONFIG_ARM_ERRATA_430973 | ||
112 | pr_info("RX-51: Enabling ARM errata 430973 workaround\n"); | ||
113 | /* set IBE to 1 */ | ||
114 | rx51_secure_update_aux_cr(BIT(6), 0); | ||
115 | #endif | ||
116 | } | ||
117 | |||
106 | /* Ensure SDRC pins are mux'd for self-refresh */ | 118 | /* Ensure SDRC pins are mux'd for self-refresh */ |
107 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 119 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
108 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 120 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c index 334b76745900..03a2829beb8e 100644 --- a/arch/arm/mach-omap2/cclock3xxx_data.c +++ b/arch/arm/mach-omap2/cclock3xxx_data.c | |||
@@ -3275,6 +3275,7 @@ static struct omap_clk omap36xx_clks[] = { | |||
3275 | static struct omap_clk omap34xx_omap36xx_clks[] = { | 3275 | static struct omap_clk omap34xx_omap36xx_clks[] = { |
3276 | CLK(NULL, "aes1_ick", &aes1_ick), | 3276 | CLK(NULL, "aes1_ick", &aes1_ick), |
3277 | CLK("omap_rng", "ick", &rng_ick), | 3277 | CLK("omap_rng", "ick", &rng_ick), |
3278 | CLK("omap3-rom-rng", "ick", &rng_ick), | ||
3278 | CLK(NULL, "sha11_ick", &sha11_ick), | 3279 | CLK(NULL, "sha11_ick", &sha11_ick), |
3279 | CLK(NULL, "des1_ick", &des1_ick), | 3280 | CLK(NULL, "des1_ick", &des1_ick), |
3280 | CLK(NULL, "cam_mclk", &cam_mclk), | 3281 | CLK(NULL, "cam_mclk", &cam_mclk), |
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c index b970440cffca..5ac122e88f67 100644 --- a/arch/arm/mach-omap2/omap-secure.c +++ b/arch/arm/mach-omap2/omap-secure.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011 Texas Instruments, Inc. |
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | 5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
6 | * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> | ||
7 | * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> | ||
6 | * | 8 | * |
7 | * | 9 | * |
8 | * This program is free software,you can redistribute it and/or modify | 10 | * This program is free software,you can redistribute it and/or modify |
@@ -70,3 +72,77 @@ phys_addr_t omap_secure_ram_mempool_base(void) | |||
70 | { | 72 | { |
71 | return omap_secure_memblock_base; | 73 | return omap_secure_memblock_base; |
72 | } | 74 | } |
75 | |||
76 | /** | ||
77 | * rx51_secure_dispatcher: Routine to dispatch secure PPA API calls | ||
78 | * @idx: The PPA API index | ||
79 | * @process: Process ID | ||
80 | * @flag: The flag indicating criticality of operation | ||
81 | * @nargs: Number of valid arguments out of four. | ||
82 | * @arg1, arg2, arg3 args4: Parameters passed to secure API | ||
83 | * | ||
84 | * Return the non-zero error value on failure. | ||
85 | * | ||
86 | * NOTE: rx51_secure_dispatcher differs from omap_secure_dispatcher because | ||
87 | * it calling omap_smc3() instead omap_smc2() and param[0] is nargs+1 | ||
88 | */ | ||
89 | u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, | ||
90 | u32 arg1, u32 arg2, u32 arg3, u32 arg4) | ||
91 | { | ||
92 | u32 ret; | ||
93 | u32 param[5]; | ||
94 | |||
95 | param[0] = nargs+1; /* RX-51 needs number of arguments + 1 */ | ||
96 | param[1] = arg1; | ||
97 | param[2] = arg2; | ||
98 | param[3] = arg3; | ||
99 | param[4] = arg4; | ||
100 | |||
101 | /* | ||
102 | * Secure API needs physical address | ||
103 | * pointer for the parameters | ||
104 | */ | ||
105 | local_irq_disable(); | ||
106 | local_fiq_disable(); | ||
107 | flush_cache_all(); | ||
108 | outer_clean_range(__pa(param), __pa(param + 5)); | ||
109 | ret = omap_smc3(idx, process, flag, __pa(param)); | ||
110 | flush_cache_all(); | ||
111 | local_fiq_enable(); | ||
112 | local_irq_enable(); | ||
113 | |||
114 | return ret; | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * rx51_secure_update_aux_cr: Routine to modify the contents of Auxiliary Control Register | ||
119 | * @set_bits: bits to set in ACR | ||
120 | * @clr_bits: bits to clear in ACR | ||
121 | * | ||
122 | * Return the non-zero error value on failure. | ||
123 | */ | ||
124 | u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits) | ||
125 | { | ||
126 | u32 acr; | ||
127 | |||
128 | /* Read ACR */ | ||
129 | asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); | ||
130 | acr &= ~clear_bits; | ||
131 | acr |= set_bits; | ||
132 | |||
133 | return rx51_secure_dispatcher(RX51_PPA_WRITE_ACR, | ||
134 | 0, | ||
135 | FLAG_START_CRITICAL, | ||
136 | 1, acr, 0, 0, 0); | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * rx51_secure_rng_call: Routine for HW random generator | ||
141 | */ | ||
142 | u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag) | ||
143 | { | ||
144 | return rx51_secure_dispatcher(RX51_PPA_HWRNG, | ||
145 | 0, | ||
146 | NO_FLAG, | ||
147 | 3, ptr, count, flag, 0); | ||
148 | } | ||
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h index 0e729170c46b..f6cabb0033fc 100644 --- a/arch/arm/mach-omap2/omap-secure.h +++ b/arch/arm/mach-omap2/omap-secure.h | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011 Texas Instruments, Inc. |
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | 5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
6 | * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> | ||
7 | * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> | ||
6 | * | 8 | * |
7 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -46,14 +48,25 @@ | |||
46 | #define OMAP4_PPA_L2_POR_INDEX 0x23 | 48 | #define OMAP4_PPA_L2_POR_INDEX 0x23 |
47 | #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 | 49 | #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 |
48 | 50 | ||
51 | /* Secure RX-51 PPA (Primary Protected Application) APIs */ | ||
52 | #define RX51_PPA_HWRNG 29 | ||
53 | #define RX51_PPA_L2_INVAL 40 | ||
54 | #define RX51_PPA_WRITE_ACR 42 | ||
55 | |||
49 | #ifndef __ASSEMBLER__ | 56 | #ifndef __ASSEMBLER__ |
50 | 57 | ||
51 | extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, | 58 | extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, |
52 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); | 59 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); |
53 | extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); | 60 | extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); |
61 | extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32 pargs); | ||
54 | extern phys_addr_t omap_secure_ram_mempool_base(void); | 62 | extern phys_addr_t omap_secure_ram_mempool_base(void); |
55 | extern int omap_secure_ram_reserve_memblock(void); | 63 | extern int omap_secure_ram_reserve_memblock(void); |
56 | 64 | ||
65 | extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, | ||
66 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); | ||
67 | extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits); | ||
68 | extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag); | ||
69 | |||
57 | #ifdef CONFIG_OMAP4_ERRATA_I688 | 70 | #ifdef CONFIG_OMAP4_ERRATA_I688 |
58 | extern int omap_barrier_reserve_memblock(void); | 71 | extern int omap_barrier_reserve_memblock(void); |
59 | #else | 72 | #else |
diff --git a/arch/arm/mach-omap2/omap-smc.S b/arch/arm/mach-omap2/omap-smc.S index f6441c13cd8c..fd90125bffc7 100644 --- a/arch/arm/mach-omap2/omap-smc.S +++ b/arch/arm/mach-omap2/omap-smc.S | |||
@@ -1,9 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP44xx secure APIs file. | 2 | * OMAP34xx and OMAP44xx secure APIs file. |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2010 Texas Instruments, Inc. |
5 | * Written by Santosh Shilimkar <santosh.shilimkar@ti.com> | 5 | * Written by Santosh Shilimkar <santosh.shilimkar@ti.com> |
6 | * | 6 | * |
7 | * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> | ||
8 | * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> | ||
7 | * | 9 | * |
8 | * This program is free software,you can redistribute it and/or modify | 10 | * This program is free software,you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -54,6 +56,23 @@ ENTRY(omap_smc2) | |||
54 | ldmfd sp!, {r4-r12, pc} | 56 | ldmfd sp!, {r4-r12, pc} |
55 | ENDPROC(omap_smc2) | 57 | ENDPROC(omap_smc2) |
56 | 58 | ||
59 | /** | ||
60 | * u32 omap_smc3(u32 service_id, u32 process_id, u32 flag, u32 pargs) | ||
61 | * Low level common routine for secure HAL and PPA APIs via smc #1 | ||
62 | * r0 - @service_id: Secure Service ID | ||
63 | * r1 - @process_id: Process ID | ||
64 | * r2 - @flag: Flag to indicate the criticality of operation | ||
65 | * r3 - @pargs: Physical address of parameter list | ||
66 | */ | ||
67 | ENTRY(omap_smc3) | ||
68 | stmfd sp!, {r4-r11, lr} | ||
69 | mov r12, r0 @ Copy the secure service ID | ||
70 | mov r6, #0xff @ Indicate new Task call | ||
71 | dsb @ Memory Barrier (not sure if needed, copied from omap_smc2) | ||
72 | smc #1 @ Call PPA service | ||
73 | ldmfd sp!, {r4-r11, pc} | ||
74 | ENDPROC(omap_smc3) | ||
75 | |||
57 | ENTRY(omap_modify_auxcoreboot0) | 76 | ENTRY(omap_modify_auxcoreboot0) |
58 | stmfd sp!, {r1-r12, lr} | 77 | stmfd sp!, {r1-r12, lr} |
59 | ldr r12, =0x104 | 78 | ldr r12, =0x104 |