Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2667430ybl; Mon, 20 Jan 2020 07:12:43 -0800 (PST) X-Google-Smtp-Source: APXvYqz2xhY2kj2oF95a1aaqpmV2mesr9X/+drO+nCgvV5a4cgvzerIKtw0CW1835gq8veYG2FGb X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr16017218otq.134.1579533163615; Mon, 20 Jan 2020 07:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579533163; cv=none; d=google.com; s=arc-20160816; b=Ry/ruUN2Rk/jaCN60oy82ZwqdCiYd1a03nS7otMOLWiwjAl/vkgJSPIfcnrZ648fBJ P3UnhWH9Y08/vZUhHfvZzGGjcdbFWsNMwMQfsc6YauEtsVLat1i5ABMhMkax4VwEkESm B29gtnTknleAGdEWAhemvgls3JimG/rVwc2tRenTtX7DvkSEmrN+vWfP/ZQjdyScHPqg Xnv1+5wzAttnKL5L0WtfhXL5CyOyIn3YUSk2tEZnnQamfl76cYTNkWFzUMwVOfmXfT2h 60ec6C9N7wn0wF76IWA2sj54RJKpQTx0Ia8gTMJOGY7HTcDIBAN4QBIzGYIKR4mk2JbT 94OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=7bjqKkG238OM/+7Pd7rRxXIJDv3x+HsptePBUBb/EVo=; b=0ozxfx2KHVcUcwkZkmKwB5X04gBDPguyemq4BR+FnU+UnZfifOiWtH+nzPxbgEslSL xkNHZ5ZmA+jxE0Exwfe+KeYtSneDhJkScB25f/Gpioiz+jUbkJcwzm0iZWPjPDElGO4T mvTs6i97+bs7RoOHe8oi7Z8x5rbiQkJjpnznMiP+00IrXT4REkMurn6Ohi/vLnG0Q4/7 3uhRLHB08Ojmz3S06ZSLUeeUpc/wqdqZaCiF0iHYYg9FVluhFTWpfrv/r49IrooVmwOQ sr6wkoM3pnhdmSOQ3Ei1ATumn67rbnDbx1Df/mYa9ZEnCvDD3hMJZr6tGkicfYO3JV+b e75w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@neuralgames.com header.s=default header.b=kY+GPOBB; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t125si17989564oih.183.2020.01.20.07.12.27; Mon, 20 Jan 2020 07:12:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@neuralgames.com header.s=default header.b=kY+GPOBB; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729165AbgATPLr (ORCPT + 99 others); Mon, 20 Jan 2020 10:11:47 -0500 Received: from kross.rwserver.com ([69.13.37.146]:37040 "EHLO kross2019.rwserver.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728783AbgATPLr (ORCPT ); Mon, 20 Jan 2020 10:11:47 -0500 Received: from localhost (localhost [127.0.0.1]) by kross2019.rwserver.com (Postfix) with ESMTP id 3E1EBB3629; Mon, 20 Jan 2020 09:01:33 -0600 (CST) Authentication-Results: kross2019.rwserver.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=neuralgames.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=neuralgames.com; h=x-mailer:message-id:date:date:subject:subject:from:from; s= default; t=1579532490; x=1581346891; bh=dshgkKumJVS0zAqIIrcV+cw7 enEW8iyIBXeKU3OU9w4=; b=kY+GPOBBbjAO2SEjaQm70ehoBqYzhl9zuqJcDvf9 rZjYn0c8QmwPVNoZ13ejhQEWEEnhy4Kh5ot8OLH+v4A4uxbzILR/GUZ+2SXAfMJp Ie2Jt9n13YD3PsTv8s1wVAI0BzbzOf1+onms+kCrTQTe3ti050chJ2HoYxhOJn6F Yyg= X-Virus-Scanned: Debian amavisd-new at kross2019.rwserver.com Received: from kross2019.rwserver.com ([127.0.0.1]) by localhost (kross2019.rwserver.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5l7g2zoo_9du; Mon, 20 Jan 2020 09:01:30 -0600 (CST) Received: from localhost (ZT-GROUP-IN.bear1.Houston1.Level3.net [4.14.58.158]) (Authenticated sender: linux@neuralgames.com) by kross2019.rwserver.com (Postfix) with ESMTPSA id 9F147B3628; Mon, 20 Jan 2020 09:01:30 -0600 (CST) From: Oscar A Perez To: Matt Mackall , Herbert Xu , Rob Herring , Mark Rutland , Joel Stanley , Andrew Jeffery , Oscar A Perez , linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] hwrng: Add support for ASPEED RNG Date: Mon, 20 Jan 2020 15:01:08 +0000 Message-Id: <20200120150113.2565-1-linux@neuralgames.com> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This minimal driver adds support for the Hardware Random Number Generator that comes with the AST2400/AST2500/AST2600 SOCs from AspeedTech. The HRNG on these SOCs uses Ring Oscillators working together to generate a stream of random bits that can be read by the platform via a 32bit data register. Signed-off-by: Oscar A Perez --- .../devicetree/bindings/rng/aspeed-rng.yaml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/rng/aspeed-rng.yaml diff --git a/Documentation/devicetree/bindings/rng/aspeed-rng.yaml b/Documentation/devicetree/bindings/rng/aspeed-rng.yaml new file mode 100644 index 000000000000..06070ebe1c33 --- /dev/null +++ b/Documentation/devicetree/bindings/rng/aspeed-rng.yaml @@ -0,0 +1,90 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/rng/aspeed-rng.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + + +title: Bindings for Aspeed Hardware Random Number Generator + + +maintainers: + - Oscar A Perez + + +description: | + The HRNG on the AST2400/AST2500/AST2600 SOCs from AspeedTech uses four Ring + Oscillators working together to generate a stream of random bits that can be + read by the platform via a 32bit data register every one microsecond. + All the platform has to do is to provide to the driver the 'quality' entropy + value, the 'mode' in which the combining ROs will generate the stream of + random bits and, the 'period' value that is used as a wait-time between reads + from the 32bit data register. + + +properties: + compatible: + oneOf: + - items: + - enum: + - aspeed,ast2400-rng + - aspeed,ast2500-rng + - aspeed,ast2600-rng + + + reg: + description: + Base address and length of the register set of this block. + Currently 'reg' must be eight bytes wide and 32-bit aligned. + + maxItems: 1 + + + period: + description: + Wait time in microseconds to be used between reads. + The RNG on these Aspeed SOCs generates 32bit of random data + every one microsecond. Choose between 1 and n microseconds. + + maxItems: 1 + + + mode: + description: + One of the eight modes in which the four internal ROs (Ring + Oscillators) are combined to generate a stream of random + bits. The default mode is seven which is the default method + of combining RO random bits on these Aspeed SOCs. + + maxItems: 1 + + + quality: + description: + Estimated number of bits of entropy per 1024 bits read from + the RNG. Note that the default quality is zero which stops + this HRNG from automatically filling the kernel's entropy + pool with data. + + maxItems: 1 + + +required: + - compatible + - reg + - period + - quality + + +examples: + - | + rng: hwrng@1e6e2074 { + compatible = "aspeed,ast2500-rng"; + reg = <0x1e6e2074 0x8>; + period = <4>; + quality = <128>; + mode = <0x7>; + }; + + +... -- 2.17.1