From patchwork Tue Oct 6 14:44:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 54537 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 94E6922FC5 for ; Tue, 6 Oct 2015 14:46:58 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf42612157wic.3 for ; Tue, 06 Oct 2015 07:46:57 -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=d1lbD1l6aufb8MjCAiHDAZWtySARB0JpiAlxcclVZKQ=; b=kthSGOrQVYzv2zwBrfUNxJBl/XRJZEW7G6W1ackLnLLyRKJF3B/Yq04jSLhVS1BOhu bLxrLkrW5MbF00644REaYLWFiVPAKN8ON2g9PIaEfqLkYzXJGWcDn/+fR8mlUzZGZvL6 YY4aees9Ahwv4tucdEEDk0vQXz6y0ZiiOncPxhyVQtQZyRwKXVh63Ip+dMsvDTBhh/vr 9+aCTVksvGOxdw16lr5zIy+B4JobVliU82aj5X1LQHwBpeoJjixuN0ZQ4eWnUU+liI6X CkTOFjqXaQFUjvah6+JE5y/j9egxhALX2d70TU4AwpPBPlySvkZK+xMnmRafuewCavta 9Anw== X-Gm-Message-State: ALoCoQl2JmVDUGam3a9aW68YM0vbzysxoqnMvpv6NY66xX0wyZo1YCB9dxDohY6DaMN69IUeR8+2 X-Received: by 10.112.209.73 with SMTP id mk9mr6477346lbc.14.1444142817852; Tue, 06 Oct 2015 07:46:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.163.73 with SMTP id m70ls606104lfe.39.gmail; Tue, 06 Oct 2015 07:46:57 -0700 (PDT) X-Received: by 10.25.23.170 with SMTP id 42mr9743894lfx.42.1444142817680; Tue, 06 Oct 2015 07:46:57 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id oj2si21161027lbb.154.2015.10.06.07.46.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 07:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by laddr2 with SMTP id dr2so28381729lad.3 for ; Tue, 06 Oct 2015 07:46:57 -0700 (PDT) X-Received: by 10.25.40.130 with SMTP id o124mr9506272lfo.41.1444142817516; Tue, 06 Oct 2015 07:46:57 -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 w3csp1893478lbq; Tue, 6 Oct 2015 07:46:56 -0700 (PDT) X-Received: by 10.107.136.87 with SMTP id k84mr33573263iod.26.1444142816356; Tue, 06 Oct 2015 07:46:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hv1si13481898igb.60.2015.10.06.07.46.56; Tue, 06 Oct 2015 07:46:56 -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 S1752963AbbJFOqy (ORCPT + 30 others); Tue, 6 Oct 2015 10:46:54 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:36163 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752161AbbJFOqJ (ORCPT ); Tue, 6 Oct 2015 10:46:09 -0400 Received: by wicgb1 with SMTP id gb1so168962371wic.1 for ; Tue, 06 Oct 2015 07:46:08 -0700 (PDT) X-Received: by 10.194.116.73 with SMTP id ju9mr28394388wjb.108.1444142768635; Tue, 06 Oct 2015 07:46:08 -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 gd10sm10936535wjb.47.2015.10.06.07.46.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Oct 2015 07:46:08 -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, peter@korsgaard.com, festevam@gmail.com, pankaj.dev@st.com, daniel.thompson@linaro.org, Lee Jones Subject: [PATCH 3/3] hwrng: st: Use real-world device timings for timeout Date: Tue, 6 Oct 2015 15:44:00 +0100 Message-Id: <1444142640-14721-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444142640-14721-1-git-send-email-lee.jones@linaro.org> References: <1444142640-14721-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.215.42 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 44480fe..3b1432c 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -33,8 +33,13 @@ #define ST_RNG_FIFO_DEPTH 8 #define ST_RNG_FIFO_SIZE (ST_RNG_FIFO_DEPTH * ST_RNG_SAMPLE_SIZE) -/* 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;