From patchwork Tue Oct 6 14:43:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 54536 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 7610022FC5 for ; Tue, 6 Oct 2015 14:46:33 +0000 (UTC) Received: by lafb9 with SMTP id b9sf37219718laf.3 for ; Tue, 06 Oct 2015 07:46:32 -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=N0ZFrxR/9hb8Cq9h5UWKMz+wWUzjf3KIJ98cF1aYfqA=; b=hLx01ypB2iEtejkEz0wg65/EGhANDHfAKvtgJn5YRCLC2xD5EzcHgtfGFn7J7jGZxJ eiYdX3tsehfWKnOi/ApymSXsiGDL07mYujiJFP1P+ZOhlcLX41rPEsISf1gGGV//wqqv OiZTaV47Du1iTrNfa7TTREe+cR8xSeAYULEbszgSv5dHTJNsFmMufOcgecIA+zFl70Rn iUpBx1DGrmxx9zfu+Fj45xOVoE1CtiGSVC89N13pz3K1sbidkS2v8CWf6cqUDVm35W09 7jd+Gu414AwRnTpajzsEA0Km0Ix415eT45+Y6grmc8X5pHDYynvxcwUMrks2WhFSFfYH zQ/Q== X-Gm-Message-State: ALoCoQnXy0QkYMd60y/xwVQSyXpQ21sjsBoEE62JlcaxEGP+33tlUxUHSd3qyac8UKLBvG13s2/V X-Received: by 10.112.169.34 with SMTP id ab2mr6470031lbc.23.1444142792334; Tue, 06 Oct 2015 07:46:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.15.156 with SMTP id 28ls623462lfp.5.gmail; Tue, 06 Oct 2015 07:46:32 -0700 (PDT) X-Received: by 10.112.147.10 with SMTP id tg10mr15341545lbb.58.1444142791998; Tue, 06 Oct 2015 07:46:31 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id m7si21181216lbd.21.2015.10.06.07.46.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 07:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laddr2 with SMTP id dr2so28373648lad.3 for ; Tue, 06 Oct 2015 07:46:31 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr15057998lbc.86.1444142791809; Tue, 06 Oct 2015 07:46:31 -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 w3csp1893237lbq; Tue, 6 Oct 2015 07:46:31 -0700 (PDT) X-Received: by 10.50.137.34 with SMTP id qf2mr17680105igb.20.1444142790877; Tue, 06 Oct 2015 07:46:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f201si22982748iof.103.2015.10.06.07.46.30; Tue, 06 Oct 2015 07:46:30 -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 S1752868AbbJFOqL (ORCPT + 30 others); Tue, 6 Oct 2015 10:46:11 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:37290 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbbJFOqI (ORCPT ); Tue, 6 Oct 2015 10:46:08 -0400 Received: by wicfx3 with SMTP id fx3so162460848wic.0 for ; Tue, 06 Oct 2015 07:46:07 -0700 (PDT) X-Received: by 10.180.85.229 with SMTP id k5mr19012810wiz.76.1444142767682; Tue, 06 Oct 2015 07:46:07 -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.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Oct 2015 07:46:07 -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 2/3] hwrng: st: Report correct FIFO size Date: Tue, 6 Oct 2015 15:43:59 +0100 Message-Id: <1444142640-14721-2-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.49 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 Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson --- 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 8c8a435..44480fe 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 available every 0.667us, which we round to 1us */ #define ST_RNG_FILL_FIFO_TIMEOUT (1 * (ST_RNG_FIFO_SIZE / ST_RNG_SAMPLE_SIZE))