diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2013-09-20 09:25:07 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-10-08 15:02:12 -0400 |
commit | d2065e2b5bb3ec986f0f3ba044a81a136767d0b4 (patch) | |
tree | 56d60a70b45e2bfbc43cebdb54f0943073a9b2ab | |
parent | 4748a7240284b0f68bd47a66365c2cd561939830 (diff) |
RX-51: Add support for OMAP3 ROM Random Number Generator
Adding this driver as platform device and only for RX-51 until somebody test if
it working also on other OMAP3 HS devices and until there will be generic ARM
way to deal with SMC calls.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
[tony@atomide.com: folded in the clock alias change]
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/board-rx51-peripherals.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-omap2/cclock3xxx_data.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.h | 1 |
4 files changed, 32 insertions, 0 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/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 146a7c4e2a13..5ac122e88f67 100644 --- a/arch/arm/mach-omap2/omap-secure.c +++ b/arch/arm/mach-omap2/omap-secure.c | |||
@@ -135,3 +135,14 @@ u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits) | |||
135 | FLAG_START_CRITICAL, | 135 | FLAG_START_CRITICAL, |
136 | 1, acr, 0, 0, 0); | 136 | 1, acr, 0, 0, 0); |
137 | } | 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 51b59c686a53..f6cabb0033fc 100644 --- a/arch/arm/mach-omap2/omap-secure.h +++ b/arch/arm/mach-omap2/omap-secure.h | |||
@@ -65,6 +65,7 @@ extern int omap_secure_ram_reserve_memblock(void); | |||
65 | extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, | 65 | extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, |
66 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); | 66 | u32 arg1, u32 arg2, u32 arg3, u32 arg4); |
67 | extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits); | 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); | ||
68 | 69 | ||
69 | #ifdef CONFIG_OMAP4_ERRATA_I688 | 70 | #ifdef CONFIG_OMAP4_ERRATA_I688 |
70 | extern int omap_barrier_reserve_memblock(void); | 71 | extern int omap_barrier_reserve_memblock(void); |