From patchwork Fri Mar 5 07:01:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 12117873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE531C433DB for ; Fri, 5 Mar 2021 07:03:50 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6607064D74 for ; Fri, 5 Mar 2021 07:03:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6607064D74 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Lt5yb83M8gPLM+j9q52mXhbhFXC8o/d6b/DP2Exg0fg=; b=SnexO2MHTkOcpMxZ13jlvQ6Al TpjCNeHFKNHoKgh6yO0BhoUvk2W48HnQIS/J+BzSwhx0usJPeK8VV0LvLROVxn8EcdEmNQAdpBCQJ LmEeKcIN1pBXdXSlDI23t9jirc6N3I6yjkM6E0nPUYBGGTlEAO5TlrCSDyRgz+lFQdoqtaAlVIPwE OsSpFQSoiHYhzylGixf+Tf+ZONqc5gGkT4CjKe4gFrkXF/EdGM1ooeAG0RDUTWns1CW85MXgGlUkm UaJlVayrO8sQzmz0wwbiYCYDepN1bpUyfaXz9X8Q+/tpgxzDQ0WERapfev/L7Bh6zL22NU1N488Ts 8BOSl4gSQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lI4TN-00DWf6-Di; Fri, 05 Mar 2021 07:02:07 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lI4Su-00DWM2-BR; Fri, 05 Mar 2021 07:01:38 +0000 Received: by mail-wr1-x436.google.com with SMTP id j2so883802wrx.9; Thu, 04 Mar 2021 23:01:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ua2t/yBcyeLhQb6et5ovZpSh5qBfeyV1CmPe3Ubpqw4=; b=dXPG05Y3q9M56ir9GDeAlCeIp/gQGc54yedo7eS5nYaF4/V64Iz0BAMB8A9o4D237Z P1u/Uo/LHtyqzYqDN/5qZ+YDyObVH+WoDTit4aae0nZAggUmWiTX2wAl/Ske8lTTDZ4C +FN8OqjLhLcKGD3nUba0mmIM5PkKsyGXvgZ+QrQGYM7hL+yyuvc2FWR/ZLXdJAS+A0C5 22fA8X+rbrs8nAfcdQge8QF7848zbFjxz1ljcKJbCURqG1Hn3Iyh2gIZs1HUKtz96ayQ ANU5XmY5hoBG0hH393O++kSU2sRparpxHQappf24mTc2EibnPGukDJeSKFk7igjG+ROt 2iBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ua2t/yBcyeLhQb6et5ovZpSh5qBfeyV1CmPe3Ubpqw4=; b=tIaQhQrGFD0m3WKThW10vd8hMYSbfI/ZkvxZEIpYSfkomS/qAsNXkjZaNDYY0S0uHD 8qa9QhhfXz3OeG26KmxSGVd/rp4Bla32A402JaVLvDloNtcrdDmsVjn/fgowBo+zbNXs oZz8KI67zcNpoFi6HYJwGMgmuopsquDL+1AZLFRN8qgqqjbLYVlc/BKN7qQPAh4Mhwwc Wfs31YUQtcNvgiB8nrZ6u4HknBSRxw2tfXC71A53G6NUqa96UaI0ukeZejEsrN2MJYMO YzdrlS4SkhQAWbyXGWmi84H8qnsyEzbJidPJb9EOFhRwRrBBeslJ0ff80DsqpEoYjAkF qaEg== X-Gm-Message-State: AOAM530ClbsArnH1f+yjAsfKihf/uZ9Qc/P7ny6e0Uvl3rUzql42L1NQ B9ntrQ2COgY6PZ1NvwXYdew= X-Google-Smtp-Source: ABdhPJxo+xAiAsPRqicUOz3h36tqGtCljoVRmcJ8qeVK1QdDaq0WIAPMLT0eQkaKK4xWueYmKmezsg== X-Received: by 2002:adf:a302:: with SMTP id c2mr7664961wrb.212.1614927695824; Thu, 04 Mar 2021 23:01:35 -0800 (PST) Received: from skynet.lan (170.red-88-1-105.dynamicip.rima-tde.net. [88.1.105.170]) by smtp.gmail.com with ESMTPSA id y18sm2799220wrq.61.2021.03.04.23.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 23:01:35 -0800 (PST) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Matt Mackall , Herbert Xu , Rob Herring , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Philipp Zabel , =?utf-8?q?=C3=81lvaro_Fern=C3=A1nde?= =?utf-8?q?z_Rojas?= , Lee Jones , Bjorn Andersson , Alexandru Ardelean , Rikard Falkeborn , Tian Tao , Stefan Wahren , linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/3] dt-bindings: rng: bcm2835: add clock constraints Date: Fri, 5 Mar 2021 08:01:30 +0100 Message-Id: <20210305070132.2986-2-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210305070132.2986-1-noltari@gmail.com> References: <20210305070132.2986-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_070136_969550_3B544E69 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org brcm,bcm6368-rng controllers require enabling the IPSEC clock in order to get a functional RNG. Signed-off-by: Álvaro Fernández Rojas Reviewed-by: Rob Herring Acked-by: Florian Fainelli --- v6: add new patch making clocks mandatory for BCM6368. .../devicetree/bindings/rng/brcm,bcm2835.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml index c147900f9041..5174492e22f3 100644 --- a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml +++ b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml @@ -35,6 +35,16 @@ required: - compatible - reg +if: + properties: + compatible: + enum: + - brcm,bcm6368-rng +then: + required: + - clocks + - clock-names + additionalProperties: false examples: From patchwork Fri Mar 5 07:01:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 12117875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A25DC433E6 for ; Fri, 5 Mar 2021 07:03:52 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2419E601FA for ; Fri, 5 Mar 2021 07:03:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2419E601FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jc7K41WXXrE402mSXfdQoIN3j+1XyD0bQed2vwh/Do0=; b=LKcUV7J3hvMhLCXw9IN04tJHr rouxqw2eckuV6D2gjZgI44h1kzTBPxWESELPiijg7ywyKDTCyBk97ks6e9cTII7vygSbgmjEWf8dh /kJeWXPA6WEb+NJ3WMQpnB2w6iJ7rSZOnhUAkl9ZuOmYffTSOKBiZNWZlyViYCWT27HxAvM0bstOP G0mPL0HiXP1WLJg2NC9nNuoUqCKfG8qc7VwSoxGNLiLNuDEN1h3aTh4PTN08KVPitCVKY6/n/L/4N qkHQuJ7DIj9st/ZkLwIMO292FkmxJjicOZcQAdZeHuThk13pvsjrYTuZx4DQ6YMj6AwM+Amxr1mbK gWQ7UFtOA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lI4Tb-00DWqn-RP; Fri, 05 Mar 2021 07:02:20 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lI4Sv-00DWNL-2y; Fri, 05 Mar 2021 07:01:39 +0000 Received: by mail-wr1-x436.google.com with SMTP id 7so916886wrz.0; Thu, 04 Mar 2021 23:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cpm1I6vNvcl3kiHD76Q0yTBdgdimTTTYjPonH8WEMdM=; b=TPc2LhWikM0HlIzyp8G+Z7A4JSdGI36TpxSDLCMjFqYBpJ+DHw+yq+awAVu4z7A7g+ wJeANx9HDW8742DaWNDzxdaWWD7LzH4HNiZ5oLBMj4S3LREsQO2souLqhv4DcaAB9eo4 R0umYixu2f9iVZDOz43UgviYGOa3Ql6PRsxyUqAFef1z8VzJ8kd8X1DPE4kNmgw4BcA0 j3clZrbd+uDbT06MZjYLyuKlwLma9vV0vGF+i4UBK53nK1NP27/330zvL8+Omh3ZYqJ4 G01tNdAfyQcRXhWyz5kdde2ypOwRu6xPnqORVDgQkaQ2CF8b1vuUpcL+we7vmvR8zRzm 02DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cpm1I6vNvcl3kiHD76Q0yTBdgdimTTTYjPonH8WEMdM=; b=iXAkncMmsoHKQBSVVyLW3JZc6CfdtZf29sOgySKpp3nVkRAm6xG92bfvWTVZ1ryAHl 0DmeTdIlBsDxxDBiE+h6+r2Tzq7gzjlirygm11TcLI+T/n4Pzedk2C3w88+cweBkoO0c RhxMqWFpKv4RFQh/78Ctpe7GXIqnyAk45yyx9ENGljmPIhtJCHdlyQCpZH+kpyZmZtKR iQ0Aku8tKW8XqGotRolHsx7s1j+WjLysgOIK73id0S00g1YPAhamhpCuo5GaqZgrhLbF hiK5yA0iJ3SA58rars/XrMfDNFfBLmg288zmkiIYgUcGQvStdS2DkXSqVrwgmm12djqN 5cqw== X-Gm-Message-State: AOAM530pBvY6S76EXSDnfGpUpV/syBnEpYRuJCvv9SwS0fPXoooSv5a3 cGEw8SJA4HSdx5eTmUso5RWulqTaC/GCOAzR X-Google-Smtp-Source: ABdhPJyETTsqP++VXP0jCDPXYUXNHuIEzrElpImRKuJZ6o7dZkQMRX1O1T+s7L6/DSY5UkvZEv58Lg== X-Received: by 2002:a05:6000:245:: with SMTP id m5mr7909261wrz.284.1614927696736; Thu, 04 Mar 2021 23:01:36 -0800 (PST) Received: from skynet.lan (170.red-88-1-105.dynamicip.rima-tde.net. [88.1.105.170]) by smtp.gmail.com with ESMTPSA id y18sm2799220wrq.61.2021.03.04.23.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 23:01:36 -0800 (PST) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Matt Mackall , Herbert Xu , Rob Herring , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Philipp Zabel , =?utf-8?q?=C3=81lvaro_Fern=C3=A1nde?= =?utf-8?q?z_Rojas?= , Lee Jones , Bjorn Andersson , Alexandru Ardelean , Rikard Falkeborn , Tian Tao , Stefan Wahren , linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 2/3] dt-bindings: rng: bcm2835: document reset support Date: Fri, 5 Mar 2021 08:01:31 +0100 Message-Id: <20210305070132.2986-3-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210305070132.2986-1-noltari@gmail.com> References: <20210305070132.2986-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_070137_645892_F6D8959C X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org brcm,bcm6368-rng controllers require resetting the IPSEC clock in order to get a functional RNG. Signed-off-by: Álvaro Fernández Rojas Reviewed-by: Rob Herring Acked-by: Florian Fainelli --- v6: fix dt-bindings warnings. v5: no changes. v4: pass dt_binding_check. v3: make resets required if brcm,bcm6368-rng. v2: document reset support. .../devicetree/bindings/rng/brcm,bcm2835.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml index 5174492e22f3..6da674666d45 100644 --- a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml +++ b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml @@ -28,6 +28,12 @@ properties: clock-names: const: ipsec + resets: + maxItems: 1 + + reset-names: + const: ipsec + interrupts: maxItems: 1 @@ -44,6 +50,8 @@ then: required: - clocks - clock-names + - resets + - reset-names additionalProperties: false @@ -68,4 +76,7 @@ examples: clocks = <&periph_clk 18>; clock-names = "ipsec"; + + resets = <&periph_rst 4>; + reset-names = "ipsec"; }; From patchwork Fri Mar 5 07:01:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 12117877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 660E8C433E0 for ; Fri, 5 Mar 2021 07:04:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA52364D74 for ; Fri, 5 Mar 2021 07:04:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA52364D74 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4Hl7FvI994v/QJAbN1AagATEQu9TtVYHwOxOW/MEHLQ=; b=qc0SZKE+SZqd4PzQ+1FzNF5QL YJtJp+6WmH3Q9kAY8VRNjJqGlMHLwE10SX+awDCOaoiZxpzIwBiGeik8XVA7NEN8MxSKE7NGg0Eha ZdDc0i4dTsTkYaDoveZtdv+fY4/urTohLydnbMJyxBHyb5ek4ps0iS4LPLM0tVeWGTqVjeBfxDKVi DSBgzmgImdoB507b++WoYjJnOLFXL8430Sv2OsYS2JBojZkVa3/Y/6mW1bdBj+alizHek0RZCyQVZ Dlka+9Nu4cGc0bGyZ8WLEmvvTqL5fbAMS/1gQTZ9wYRAOBe0gMoq1t99R+PPCFE3jXF1WXLJsTix8 lmIZ3O49g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lI4Ti-00DWww-Li; Fri, 05 Mar 2021 07:02:26 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lI4Sw-00DWOJ-07; Fri, 05 Mar 2021 07:01:40 +0000 Received: by mail-wr1-x436.google.com with SMTP id b18so892463wrn.6; Thu, 04 Mar 2021 23:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=z1XetKjHCD1nkGlnf/Dumzc1flLXCFdZJxrK1LQl/AU=; b=AncSwcHaKNhaUNvGU/ZDEHzZwdWwZWWSSJWgBASMhdDbzmmsxO75PY9Pgdp41K5p2Z wzwndus7xmuAK+ZSgL9pgoir6UA5gN5ehlvu61j6E1vLwWMbdnRI8wlCKnC5UFwRaG43 aWhpqDD2D4eRB6FIZVf/XWj/QJFJCSNp8/5PrssVOEA1caVP/AgmadhAMHq7fgiy29nU Ef2sEf7BTBJ8E01fhP2dEyRNzOQ5qKTDClCiqgEMlozwcdsb5ycQx/57+jwEnjOycDvp DKTeNcjPujRu8+hUncggvndEGaccke+9+og1uIpQJTGeB9wvQ9WLGWr84A3uQotAjgME HfCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z1XetKjHCD1nkGlnf/Dumzc1flLXCFdZJxrK1LQl/AU=; b=MZxYlwQmQJNtA54uiZqCsRteM0CmonVilPtLfUP7fZyWwCryOGTEpG+Gmn/9j8goyk B6I9o3EXtJxvJvduqfoXhwjewkj0tlEHSnq41iFS2S044a9HHijf28Uc/TG8tzaAsCRm mBCggFAd8k5rvGVDY1jg3tBjTa7LfJjMDRqG3U1OUSsKBADe2RJCk/7JoYoy4jPGxvDq nd3YPj3TvjLf7RFiNvwdp/LmK6q+hVpBLAu4pZsQwQZJglm8Mw8HDR7AS6LSKDAZCbu4 1oAdErBJUgrqjnpjRuVXvzl3OixSNFfvnRVsExfJIJ1UvE3dIzaa1HAt76RkhD9fdogH iyTA== X-Gm-Message-State: AOAM530gGqhqRk5gNh7bLhhRcCDAap+T36AJ/3fXW9aG1TMMKDID4PJd 1+G/5BIr6R/1RtUNksRRcaM= X-Google-Smtp-Source: ABdhPJyBljkf3jOAJ6LZyQb5bqYgFgIUFjzoDgfhnXSg5I23sThciOmq9Cxh/hEeu1Jt4qFsUfpbZA== X-Received: by 2002:adf:a418:: with SMTP id d24mr7554007wra.187.1614927697667; Thu, 04 Mar 2021 23:01:37 -0800 (PST) Received: from skynet.lan (170.red-88-1-105.dynamicip.rima-tde.net. [88.1.105.170]) by smtp.gmail.com with ESMTPSA id y18sm2799220wrq.61.2021.03.04.23.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 23:01:37 -0800 (PST) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: Matt Mackall , Herbert Xu , Rob Herring , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Philipp Zabel , =?utf-8?q?=C3=81lvaro_Fern=C3=A1nde?= =?utf-8?q?z_Rojas?= , Lee Jones , Bjorn Andersson , Alexandru Ardelean , Rikard Falkeborn , Tian Tao , Stefan Wahren , linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 3/3] hwrng: bcm2835: add reset support Date: Fri, 5 Mar 2021 08:01:32 +0100 Message-Id: <20210305070132.2986-4-noltari@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210305070132.2986-1-noltari@gmail.com> References: <20210305070132.2986-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_070138_403697_158170D4 X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org BCM6368 devices need to reset the IPSEC controller in order to generate true random numbers. This is what BCM6368 produces without a reset: root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000 rngtest 6.10 Copyright (c) 2004 by Henrique de Moraes Holschuh This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. rngtest: starting FIPS tests... rngtest: bits received from input: 20000032 rngtest: FIPS 140-2 successes: 0 rngtest: FIPS 140-2 failures: 1000 rngtest: FIPS 140-2(2001-10-10) Monobit: 2 rngtest: FIPS 140-2(2001-10-10) Poker: 1000 rngtest: FIPS 140-2(2001-10-10) Runs: 1000 rngtest: FIPS 140-2(2001-10-10) Long run: 30 rngtest: FIPS 140-2(2001-10-10) Continuous run: 0 rngtest: input channel speed: (min=37.253; avg=320.827; max=635.783)Mibits/s rngtest: FIPS tests speed: (min=12.141; avg=15.034; max=16.428)Mibits/s rngtest: Program run time: 1336176 microseconds Signed-off-by: Álvaro Fernández Rojas Reviewed-by: Philipp Zabel Acked-by: Florian Fainelli --- v6: fix commit description. v5: remove reset_control_rearm(). v4: add reset_control_rearm(). v3: no changes. v2: no changes. drivers/char/hw_random/bcm2835-rng.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index be5be395b341..e7dd457e9b22 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c @@ -13,6 +13,7 @@ #include #include #include +#include #define RNG_CTRL 0x0 #define RNG_STATUS 0x4 @@ -32,6 +33,7 @@ struct bcm2835_rng_priv { void __iomem *base; bool mask_interrupts; struct clk *clk; + struct reset_control *reset; }; static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) @@ -92,6 +94,10 @@ static int bcm2835_rng_init(struct hwrng *rng) if (ret) return ret; + ret = reset_control_reset(priv->reset); + if (ret) + return ret; + if (priv->mask_interrupts) { /* mask the interrupt */ val = rng_readl(priv, RNG_INT_MASK); @@ -156,6 +162,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev) if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk); + priv->reset = devm_reset_control_get_optional_exclusive(dev, NULL); + if (IS_ERR(priv->reset)) + return PTR_ERR(priv->reset); + priv->rng.name = pdev->name; priv->rng.init = bcm2835_rng_init; priv->rng.read = bcm2835_rng_read;