Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2668959pxu; Mon, 14 Dec 2020 08:08:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKxMVgOOLoBtkewKIpddTA7oNOZMpCzqM9LY+10Or345TUdspwD7Y07maX77d5A1Ciwt8I X-Received: by 2002:a17:906:5213:: with SMTP id g19mr18968935ejm.383.1607962099314; Mon, 14 Dec 2020 08:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607962099; cv=none; d=google.com; s=arc-20160816; b=g2WxuJs1Xw09rJXqW5cw3xtE89bb/s6gIRboudz6XuGvHWiaoWs3I5582ZvWQd+kak zz/AauQvq1dlBouXrJZhIOBWZDjQcNRiny3q7paS6pbdsmTCg+072ZeDpNarI4Ed3Bgu r/zabq1tAU8aQtOM2BaAOMDvPNMXl3d1kPNGIveP4vQZmUKjP6b0ES+acrPZjCiMpszg NcbJDE/Ey9Z1LaVlvMXmrC/v1xkbJz/9kRAODcB4uLC2VAhC3ZeN/QGKnoJEyatH2gXw x6hfnQLjUVyj6iq90Yhj5t+wWFOx9VjQpMcbRb0aMqpC42PVlt/U1ztbYbxfK5CHnMLS LwJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CnE52XRq5Z8TRPjvih3FD5aLTMyGdd6/AYyo6/zaC8Y=; b=H3WciYdRSkaPzfGJhyqvFGCb29YgM3LfH4foKyGZgo0sAR6bBCitskAF0/PwlYZaUr 5e5c4A9oRh8OYhXbdv8sIiI8Gm7v5X7qYtmC+HtoBrtyzq5i8ckbo3nBd949GoF/7tWO jG5V7UpNZT6wB5Rg1RpMDXinBvlSnO28nPQ+RfGNA3Sp2vPJPOVvrRu9y5OQNHvXXTt7 RhxWJm3VOwD7S50on6JEbZzkYtRj3A9XLjQ28/JsNp/AJrYbmZ8oz9MfCBzOPF81QKG8 EbBYsp9iE8mAfjb2DPWYOR9Jjs22ATtjMBeMVl7zKE0Q4w+pzAsVdkcAFQQcVpM7mA8V DXDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb2si10160454ejb.489.2020.12.14.08.07.55; Mon, 14 Dec 2020 08:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730647AbgLNQGW (ORCPT + 99 others); Mon, 14 Dec 2020 11:06:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:44452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440057AbgLNQFn (ORCPT ); Mon, 14 Dec 2020 11:05:43 -0500 From: matthias.bgg@kernel.org Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: mpm@selenic.com, herbert@gondor.apana.org.au, rjui@broadcom.com, sbranden@broadcom.com, f.fainelli@gmail.com Cc: linux-kernel@vger.kernel.org, Julia.Lawall@inria.fr, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, nsaenzjulienne@suse.de, linux-crypto@vger.kernel.org, Matthias Brugger Subject: [PATCH 1/2] hwrng: iproc-rng200: Fix disable of the block. Date: Mon, 14 Dec 2020 17:04:53 +0100 Message-Id: <20201214160454.22769-1-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Matthias Brugger When trying to disable the block we bitwise or the control register with value zero. This will leave the block always turned on. Fix this by setting the corresponding bit to zero. Fixes: c83d45d5685f ("hwrng: iproc-rng200 - Add Broadcom IPROC RNG driver") Signed-off-by: Matthias Brugger --- drivers/char/hw_random/iproc-rng200.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/iproc-rng200.c b/drivers/char/hw_random/iproc-rng200.c index 01583faf9893..e106ce3c0146 100644 --- a/drivers/char/hw_random/iproc-rng200.c +++ b/drivers/char/hw_random/iproc-rng200.c @@ -28,7 +28,6 @@ #define RNG_CTRL_OFFSET 0x00 #define RNG_CTRL_RNG_RBGEN_MASK 0x00001FFF #define RNG_CTRL_RNG_RBGEN_ENABLE 0x00000001 -#define RNG_CTRL_RNG_RBGEN_DISABLE 0x00000000 #define RNG_SOFT_RESET_OFFSET 0x04 #define RNG_SOFT_RESET 0x00000001 @@ -61,7 +60,7 @@ static void iproc_rng200_restart(void __iomem *rng_base) /* Disable RBG */ val = ioread32(rng_base + RNG_CTRL_OFFSET); val &= ~RNG_CTRL_RNG_RBGEN_MASK; - val |= RNG_CTRL_RNG_RBGEN_DISABLE; + val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; iowrite32(val, rng_base + RNG_CTRL_OFFSET); /* Clear all interrupt status */ @@ -174,7 +173,7 @@ static void iproc_rng200_cleanup(struct hwrng *rng) /* Disable RNG hardware */ val = ioread32(priv->base + RNG_CTRL_OFFSET); val &= ~RNG_CTRL_RNG_RBGEN_MASK; - val |= RNG_CTRL_RNG_RBGEN_DISABLE; + val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; iowrite32(val, priv->base + RNG_CTRL_OFFSET); } -- 2.29.2