From patchwork Tue Oct 6 16:12:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 54539 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 8932422F05 for ; Tue, 6 Oct 2015 16:15:41 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf50198650lbb.3 for ; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=ll+oOIkisbUNjAlVvFVk/7QnoKgkUFvAz4xXcbtA3Bo=; b=Yk3yjXu7CfJAHZV6SvHxvsYKwnuAIdTx60v8xI4izdYMSkxEdU32DyjN/Kyj+k+srK df2JC5z9/6mNmC21XvQ8kpkOt5v9FhNXP4rGPi2TlwTNwUP9aabPLQvNWCqaq2FBw2rF ljvR5PROUVIJ8oA6A76XTw+rSB3AHUZvmZMZOmuo5/6iDnbpQL+hW87SI6KftrDI092G bpyVjSGQYQB05NDQ1SVrgFrMe4Cip0Nf6rxAHLZ5+6RCRH2iTVD7Yn7jzzSolgdlbU9+ pkYImBNUVD1frbOd2b+pbFQEUUxJTiGPFN8kdMASV4++zh/lZOrhtFMp9Pk3wieQax2L +yKg== X-Gm-Message-State: ALoCoQnWYNwCEl3t/c/wgpmymL/MygIyvRtFJBVFaTTf5r49N8GZOO79scHO3z5/oJZO6wqUG6N4 X-Received: by 10.194.240.230 with SMTP id wd6mr6637186wjc.0.1444148140430; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.16.210 with SMTP id 79ls637143lfq.12.gmail; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) X-Received: by 10.25.86.213 with SMTP id k204mr9927495lfb.36.1444148140241; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id wm1si21449806lbb.165.2015.10.06.09.15.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 09:15:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbos8 with SMTP id s8so79338570lbo.0 for ; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) X-Received: by 10.112.202.35 with SMTP id kf3mr15140116lbc.19.1444148140035; Tue, 06 Oct 2015 09:15:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1941241lbq; Tue, 6 Oct 2015 09:15:38 -0700 (PDT) X-Received: by 10.50.22.101 with SMTP id c5mr16267857igf.57.1444148138874; Tue, 06 Oct 2015 09:15:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m185si23382071iom.21.2015.10.06.09.15.38; Tue, 06 Oct 2015 09:15:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753131AbbJFQPX (ORCPT + 30 others); Tue, 6 Oct 2015 12:15:23 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37554 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753044AbbJFQPS (ORCPT ); Tue, 6 Oct 2015 12:15:18 -0400 Received: by wicfx3 with SMTP id fx3so166440622wic.0 for ; Tue, 06 Oct 2015 09:15:17 -0700 (PDT) X-Received: by 10.180.103.72 with SMTP id fu8mr19052052wib.7.1444148115091; Tue, 06 Oct 2015 09:15:15 -0700 (PDT) Received: from localhost.localdomain (host81-129-171-83.range81-129.btcentralplus.com. [81.129.171.83]) by smtp.gmail.com with ESMTPSA id ki7sm33447912wjc.28.2015.10.06.09.15.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Oct 2015 09:15:14 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, peter@korsgaard.com, festevam@gmail.com, pankaj.dev@st.com, daniel.thompson@linaro.org, Lee Jones Subject: [RESEND 2/3] hwrng: st: Use real-world device timings for timeout Date: Tue, 6 Oct 2015 17:12:50 +0100 Message-Id: <1444147971-25778-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444147971-25778-1-git-send-email-lee.jones@linaro.org> References: <1444147971-25778-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Samples are documented to be available every 0.667us, so in theory the 8 sample deep FIFO should take 5.336us to fill. However, during thorough testing, it became apparent that filling the FIFO actually takes closer to 12us. Signed-off-by: Lee Jones --- drivers/char/hw_random/st-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c index 8c8a435..a1ff080 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -32,8 +32,13 @@ #define ST_RNG_FIFO_SIZE 8 #define ST_RNG_SAMPLE_SIZE 2 /* 2 Byte (16bit) samples */ -/* Samples are available every 0.667us, which we round to 1us */ -#define ST_RNG_FILL_FIFO_TIMEOUT (1 * (ST_RNG_FIFO_SIZE / ST_RNG_SAMPLE_SIZE)) +/* + * Samples are documented to be available every 0.667us, so in theory + * the 8 sample deep FIFO should take 5.336us to fill. However, during + * thorough testing, it became apparent that filling the FIFO actually + * takes closer to 12us. + */ +#define ST_RNG_FILL_FIFO_TIMEOUT 12 struct st_rng_data { void __iomem *base;