From patchwork Fri Sep 20 13:25:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 2918791 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 79F9E9F1BF for ; Fri, 20 Sep 2013 13:27:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51EAD20320 for ; Fri, 20 Sep 2013 13:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DC9820319 for ; Fri, 20 Sep 2013 13:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754784Ab3ITN0U (ORCPT ); Fri, 20 Sep 2013 09:26:20 -0400 Received: from mail-ee0-f52.google.com ([74.125.83.52]:35254 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754772Ab3ITN0O (ORCPT ); Fri, 20 Sep 2013 09:26:14 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so262136eek.39 for ; Fri, 20 Sep 2013 06:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=RafzWGKyb6hrkuPX+hTsDvGay22bSuHNS+VSllZrV4A=; b=ORz/nHYb1BYr6ptawKJ06Srf3qVL7jv2OthqHqK2WH+QinMv2jHf0ITgXUJmXleGNl 5M+eOuwM7kNlv1wvJXSrf8/pWqbstMNgSs41Q/r1CPDN28oI6xCF0hN/iBEsiNEekFQk vQhBsBRLREH+Sp7zS/6Vy9I7CNFxuGyAEuR382BZlcJX0aHhCN1oVkIeWOABnshmZVsh MAsUPv/C3gn1LRgNBySBGtZo0Jfeb6aLwwhpVI1VWDZH2duRNPIDIA+OEdcX3q7X3e7A czfGeadmHr3lOdfBhQTWNGeAdr8yuG4TjmZDmQDTLiii1UmcHqHR55PkvtmZZ2VOn1yJ pzpA== X-Received: by 10.14.204.5 with SMTP id g5mr136582eeo.110.1379683572948; Fri, 20 Sep 2013 06:26:12 -0700 (PDT) Received: from Pali-EliteBook.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id a43sm19429342eep.9.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 06:26:12 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Matt Mackall , Herbert Xu , Tony Lindgren , Russell King , Joe Perches , Aaro Koskinen Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH v2 3/3] RX-51: Add support for OMAP3 ROM Random Number Generator Date: Fri, 20 Sep 2013 15:25:07 +0200 Message-Id: <1379683507-30793-4-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379683507-30793-1-git-send-email-pali.rohar@gmail.com> References: <1379534757-20870-1-git-send-email-pali.rohar@gmail.com> <1379683507-30793-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- arch/arm/mach-omap2/board-rx51-peripherals.c | 19 +++++++++++++++++++ arch/arm/mach-omap2/omap-secure.c | 11 +++++++++++ arch/arm/mach-omap2/omap-secure.h | 1 + 3 files changed, 31 insertions(+) diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index c3270c0..497d260 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -57,6 +57,8 @@ #include "common-board-devices.h" #include "gpmc.h" #include "gpmc-onenand.h" +#include "soc.h" +#include "omap-secure.h" #define SYSTEM_REV_B_USES_VAUX3 0x1699 #define SYSTEM_REV_S_USES_VAUX3 0x8 @@ -1289,6 +1291,22 @@ static void __init rx51_init_twl4030_hwmon(void) platform_device_register(&madc_hwmon); } +static struct platform_device omap3_rom_rng_device = { + .name = "omap3-rom-rng", + .id = -1, + .dev = { + .platform_data = rx51_secure_rng_call, + }, +}; + +static void __init rx51_init_omap3_rom_rng(void) +{ + if (omap_type() == OMAP2_DEVICE_TYPE_SEC) { + pr_info("RX-51: Registring OMAP3 HWRNG device\n"); + platform_device_register(&omap3_rom_rng_device); + } +} + void __init rx51_peripherals_init(void) { rx51_i2c_init(); @@ -1309,5 +1327,6 @@ void __init rx51_peripherals_init(void) rx51_charger_init(); rx51_init_twl4030_hwmon(); + rx51_init_omap3_rom_rng(); } diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c index 146a7c4..5ac122e 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) FLAG_START_CRITICAL, 1, acr, 0, 0, 0); } + +/** + * rx51_secure_rng_call: Routine for HW random generator + */ +u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag) +{ + return rx51_secure_dispatcher(RX51_PPA_HWRNG, + 0, + NO_FLAG, + 3, ptr, count, flag, 0); +} diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h index 51b59c6..f6cabb0 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); extern u32 rx51_secure_dispatcher(u32 idx, u32 process, u32 flag, u32 nargs, u32 arg1, u32 arg2, u32 arg3, u32 arg4); extern u32 rx51_secure_update_aux_cr(u32 set_bits, u32 clear_bits); +extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag); #ifdef CONFIG_OMAP4_ERRATA_I688 extern int omap_barrier_reserve_memblock(void);