diff options
| -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 | /** | ||
