From patchwork Tue Oct 6 16:12:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 54540 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id B5F6222F05 for ; Tue, 6 Oct 2015 16:15:42 +0000 (UTC) Received: by lauu8 with SMTP id u8sf7896663lau.2 for ; Tue, 06 Oct 2015 09:15:41 -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=TiPnY5kDL75g9SsCOW+EzEUkQAQy6eXMyfc0JGBRECk=; b=Bph7hTgfYIfUEa1dUanHp1SF4l7WoBhJPgKiNgsQQckID2C5bpe0Mu7IOkheVHV9PM RnrOgiDXUol45brP70TcqstAV477zDunlqRXG5Cva7l/X1pnh5axplaZYpi2JVOGtrpY eB4V+cjeg91huxjlc7044kLwMCnJABJ3HtMIO/Mx8hm4TLkP2GcSurtuXQc4tHjt4IBl IUd58pf1V+GA3SKKrSbMWeaDQiHpwXbf6jBzuYYZcSMbOpm7ceyNw9IJujwH1xSmATBf aTGkhklgFWOTI1oDvbxXr3fTuVFmG4Bh0FFOY16MzWi2JyZ1r8+5of+zkV+QtyULfvjU dxPw== X-Gm-Message-State: ALoCoQm3QU3n7Nc4EF7XnmCiq8nmF4+KWk7V1YVj7niV0jdPmM3iYmkbthrCecYSQBnaj4cg/Gzk X-Received: by 10.195.18.100 with SMTP id gl4mr6642411wjd.4.1444148141681; Tue, 06 Oct 2015 09:15:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.18.93 with SMTP id h90ls603441lfi.9.gmail; Tue, 06 Oct 2015 09:15:41 -0700 (PDT) X-Received: by 10.112.180.198 with SMTP id dq6mr15026209lbc.90.1444148141366; Tue, 06 Oct 2015 09:15:41 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id xp1si21451278lbb.134.2015.10.06.09.15.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 09:15:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laddr2 with SMTP id dr2so30082863lad.3 for ; Tue, 06 Oct 2015 09:15:41 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr14816463lbc.72.1444148141237; Tue, 06 Oct 2015 09:15:41 -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 w3csp1941253lbq; Tue, 6 Oct 2015 09:15:40 -0700 (PDT) X-Received: by 10.50.114.5 with SMTP id jc5mr16087249igb.25.1444148139342; Tue, 06 Oct 2015 09:15:39 -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.39; Tue, 06 Oct 2015 09:15:39 -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 S1753165AbbJFQP1 (ORCPT + 30 others); Tue, 6 Oct 2015 12:15:27 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35239 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbbJFQPS (ORCPT ); Tue, 6 Oct 2015 12:15:18 -0400 Received: by wicge5 with SMTP id ge5so174359428wic.0 for ; Tue, 06 Oct 2015 09:15:16 -0700 (PDT) X-Received: by 10.194.179.137 with SMTP id dg9mr37297224wjc.55.1444148116878; Tue, 06 Oct 2015 09:15:16 -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.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Oct 2015 09:15:16 -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 3/3] hwrng: st: Report correct FIFO size Date: Tue, 6 Oct 2015 17:12:51 +0100 Message-Id: <1444147971-25778-3-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.215.41 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: , The values supplied to the 'read random data from FIFO' arithmetic are not correct. The value fed in to initialise the iterator describes the FIFO depth, but then the iterator is treated in Bytes and subsequently increased by 2 in value for every read word. This means only 4 of the 8 available values are being read during each invocation of .read(). This change increased the device bandwidth by a factor of 2. Reported-by: Daniel Thompson Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones --- drivers/char/hw_random/st-rng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c index a1ff080..3b1432c 100644 --- a/drivers/char/hw_random/st-rng.c +++ b/drivers/char/hw_random/st-rng.c @@ -29,8 +29,9 @@ #define ST_RNG_STATUS_BAD_ALTERNANCE BIT(1) #define ST_RNG_STATUS_FIFO_FULL BIT(5) -#define ST_RNG_FIFO_SIZE 8 #define ST_RNG_SAMPLE_SIZE 2 /* 2 Byte (16bit) samples */ +#define ST_RNG_FIFO_DEPTH 8 +#define ST_RNG_FIFO_SIZE (ST_RNG_FIFO_DEPTH * ST_RNG_SAMPLE_SIZE) /* * Samples are documented to be available every 0.667us, so in theory