From patchwork Thu Apr 29 08:36:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230781 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 6B507C433B4 for ; Thu, 29 Apr 2021 08:38:33 +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 C869C6141E for ; Thu, 29 Apr 2021 08:38:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C869C6141E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5yJkiTJErVOayduR1xB9COvGe6eXd58otiWS91n3UgQ=; b=RRztROfBQ42izUbraxXWGWbwA nbkUfo1xB7gLW2kXKXwM3fuWRSh6lBX8nXuGE6pdWfhRQuPEUPYg4Y5LZ8dGqd9fE3uugKslH3DuS KykBBdMDPnxgXjWDJjB6MGRutP5l97F+YV7OfW50DtGxtfka0i5iTHvKpa3KAcjb+WBfP7NthfeP7 U/73dWeyUrCSIYMgFdBOV3wn8mhTSpoQXrvwQznDW+WAdQ6vd85RSj967vz4ISk6YNbCbxITCRUZO 7kKgYJCcR1MJjU7NZGtBhO5gbJluqqsijkOL5US3U4TqWnGBKeZgGjeJkFD/n8rEMfBny1B7NNeJA u8nByfbtg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AE-005KBD-UF; Thu, 29 Apr 2021 08:36:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AC-005KB4-GY for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=IYZf9Sj/B6q1uSGbdo4UoJLBuSfrW/IizBNvOD56C7M=; b=YeKZQyTR7rYfuX5xDWc3/my/jX KMUlJaFmu/Wi6dc2oDcXKqAAy2Gr8LiX4IeMZuON9mcTV698SJMWBoA1srzFxWfXl6Lb+cml7Y4Wd W6mYmuwXFWhwLgXGxA+Kpbb6t0K/JqfFStAjjBhMdTzgPJJKE6menV57BrToglUdX2tDnIWAcV4r6 ywxXpc4IVX/ggUnRv4POlEfqRbPq0PpTwFIAxXwDk5ObYAxfEP61tOYlL5EfavNYH7W7yAYP4FH6M V2BCkrfchvclU4HQTXwdAUxh5GkyEvS06SnWTcW9spicAqW7WNRmGx2Bk927xtkwy6Led4SGEpnZU nvHrmreA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2A9-000UYl-U0 for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 941AA61186; Thu, 29 Apr 2021 08:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685404; bh=Q527VIq+GkpwCLejgbAK+745j3ug5PUj0Wy3UZuSaBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BA2K7uPPUo06DkGGdeG2QlunBOog1xiioiaPZ6qpA8wb8V9SCqQVykZJ4wr3Cg6J7 6kD6JSabGa42dpT3KR9nNAvvC0V5MvXZGPpoxc8h5kcrU7KBS/URZ8H2ywsxKcU0UI hwT5SBoYisskV+jeKJzgZaUKSefWAFgxwjrYpccD7QqiaEfINhy7bkdlvIJ9IWrrty xZFv5gmTou9Z8zG6LwsMHsmIcDHTuhetHKmAbRb0qq0DqfUWG4BLoh9HwwlUXUfhK/ qpe9a1LYMf/qlRE4R51TzK1NZMIc2xVUsLMafKBTz1DAag4UmhcCIZwCeMDNHtGnTg ql9XCu9to6+pw== Received: by pali.im (Postfix) id D757C7DF; Thu, 29 Apr 2021 10:36:41 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 1/6] firmware: turris-mox-rwtm: fix reply status decoding function Date: Thu, 29 Apr 2021 10:36:31 +0200 Message-Id: <20210429083636.22560-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308153703.23097-1-kabel@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013646_052064_3792F539 X-CRM114-Status: GOOD ( 11.72 ) 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 From: Marek Behún The status decoding function mox_get_status() currently contains a dead code path: if the error status is not MBOX_STS_SUCCESS, it always returns -EIO, so the comparison to MBOX_STS_FAIL is never executed and we don't get the actual error code sent by the firmware. Fix this. Signed-off-by: Marek Behún Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") --- drivers/firmware/turris-mox-rwtm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 62f0d1a5dd32..f85acdb3130c 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -147,11 +147,14 @@ MOX_ATTR_RO(pubkey, "%s\n", pubkey); static int mox_get_status(enum mbox_cmd cmd, u32 retval) { - if (MBOX_STS_CMD(retval) != cmd || - MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) + if (MBOX_STS_CMD(retval) != cmd) return -EIO; else if (MBOX_STS_ERROR(retval) == MBOX_STS_FAIL) return -(int)MBOX_STS_VALUE(retval); + else if (MBOX_STS_ERROR(retval) == MBOX_STS_BADCMD) + return -ENOSYS; + else if (MBOX_STS_ERROR(retval) != MBOX_STS_SUCCESS) + return -EIO; else return MBOX_STS_VALUE(retval); } From patchwork Thu Apr 29 08:36:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230785 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 7CC51C433B4 for ; Thu, 29 Apr 2021 08:38:37 +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 E1D0A6141E for ; Thu, 29 Apr 2021 08:38:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1D0A6141E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=X692JUFgjtG6gdFC3apVjirsrsABb5UuTS0RL+oIxA0=; b=OvLEaNEaPh6RYLR1g0dWhiqwC Ld3N+QqP5ZV2T/sAZG8t4eMxfW9WitKeyVS7yM2Wtr1LiSbjQV1I3+m82iljM1RU2PSnGFZtf3x1D wdnTpGw79juox2sfRV6hplDNlqhQ3kfOX+QFK8l2Nw3lD/dp5EaI94Mxn0cq2s4TIWh8jMLuTa85z Wxh+k4acNMwnd5VfhPk6NO5CXwHwIk8ljwXT1WCfkhnhF9j5oVA7uSrzkXV3On4vXV6d3ePsatSNM ZqlbI+tHA/XlHaD7RLetTrelGaGdbD5F12XOPY7XOH4V1sFMSapWtflI3Us4qo6l0R5PRGZOVOPNN maCXxm5oQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AQ-005KC5-MH; Thu, 29 Apr 2021 08:37:02 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AG-005KBG-VR for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=pd9ug0/iBbRhIbfZpZwiccfCmUnYf+oX0lPztqVLGZ4=; b=t29E2XMaShK+XGHEu67DnSfNpP keI5G4lvWO++20Q5XjNMwyexo1l6RJ1KWeUiiS8paVXAJmCSQpTqHYwxgIssEQ45zcS0Dd0PSiKWH IeSy+/QsDG+dCJgu/8n4Ocu9Zje25e1CILRNJ10ZGGwaUM5HC1nWbETV4v/FiIUIj5974iuFcGciM MqDvJ4tHNz4szcuUw3iuAszzi/5rPVYUUE7WA+Ow2AsJW6mIV3Vq5lv4QGu8btA93jfjMrAY/Vo5g rif6S9NQDCNQFbsyjUrDUUGogWysdIo9G1iFyi18GtYRKl1xxrIe7xd0F0ZmySRs8zx+GQK1s0lpT lK2PEJiQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AE-000UZF-Hk for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02CBE61289; Thu, 29 Apr 2021 08:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685410; bh=MeLEsLw6D27yIvjQ/kVD7YJHUqg3HKZl6KtwqpCreNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IW7NtWq1kOKSpdZ0t3EbHV1G9raGE+iIzxS46CQTSI3s4y9uQ/263WJfMZ3aMSAcD 3wQE3PYuMC3RSGsU6ad9jTzoX+vAfnWiRULC+CcPDb5MDRCDGVQNWzz4gld6H3DODW m4KEUBiD4QNqIISPOb+lbOomUGyOG/P4UCUyzdoM+QKHkaY2MHAHrb6Qbv1JU+zgsh qm7Y7EPApU9qh4OtJRVwtRcMxm+dhHJkDFd3vAP91wKtbuPhdFw5BA5gxfgR22wOyo IdUI0XrOljA3ugdMH1nzmIlD5LwdzvJPoV9Zy6NDIRBE28NKqlbHZH7pLrvVWZLoTp TSe0oV5GwQtOg== Received: by pali.im (Postfix) id 295097DF; Thu, 29 Apr 2021 10:36:48 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 2/6] firmware: turris-mox-rwtm: report failures better Date: Thu, 29 Apr 2021 10:36:32 +0200 Message-Id: <20210429083636.22560-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210429083636.22560-1-pali@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> <20210429083636.22560-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013650_644827_4D2AAF23 X-CRM114-Status: GOOD ( 13.55 ) 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 From: Marek Behún Report a notice level message if a command is not supported by the rWTM firmware. This should not be an error, merely a notice, because the firmware can be used on non-CZ.NIC boards that do not have manufacturing information burned. Signed-off-by: Marek Behún Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") --- drivers/firmware/turris-mox-rwtm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index f85acdb3130c..d7e3489e4bf2 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -204,11 +204,14 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) return ret; ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); - if (ret < 0 && ret != -ENODATA) { - return ret; - } else if (ret == -ENODATA) { + if (ret == -ENODATA) { dev_warn(rwtm->dev, "Board does not have manufacturing information burned!\n"); + } else if (ret == -ENOSYS) { + dev_notice(rwtm->dev, + "Firmware does not support the BOARD_INFO command\n"); + } else if (ret < 0) { + return ret; } else { rwtm->serial_number = reply->status[1]; rwtm->serial_number <<= 32; @@ -237,10 +240,13 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) return ret; ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); - if (ret < 0 && ret != -ENODATA) { - return ret; - } else if (ret == -ENODATA) { + if (ret == -ENODATA) { dev_warn(rwtm->dev, "Board has no public key burned!\n"); + } else if (ret == -ENOSYS) { + dev_notice(rwtm->dev, + "Firmware does not support the ECDSA_PUB_KEY command\n"); + } else if (ret < 0) { + return ret; } else { u32 *s = reply->status; From patchwork Thu Apr 29 08:36:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230787 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 E6AA4C433B4 for ; Thu, 29 Apr 2021 08:38:58 +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 4C0AC6135B for ; Thu, 29 Apr 2021 08:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C0AC6135B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HiUL0s3NFVMgkXKINyLc7BxOgRW7xtuluoVj0Sm2yFY=; b=NLEJl83mTtmxLh7cNWKW+7MX7 InIQ67ZgBf02QuXBZGFsjt8VGpB3MyzeTm0BPDO6GX/3YjdHZyg55k5zn8k0dNcJjfCxu9f9Z3weG ceI5pFNO6IU+txmZfwmBgfQe6T3/UpL7gnT0Ocr6QWapEoy3E58p6NRmtUgwduMiZEWzg0MeTHm/M ZX9s9sbeymjG9t9QYTySV0nWctzqosvDHUILnfNSjbJpa7YjotM63kTjwyiBZQQtpouQFWQ6lSBPV 8u96jtNSZgC4hsO+zhUVoKJZG3L/PN5O+whxbE3vlRxL5rmmPYg14vB3RpdjuBgp7PsE7Ehkmd6Ip q+Vh2sIKg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2Ak-005KEL-Dq; Thu, 29 Apr 2021 08:37:23 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AI-005KBT-Ik for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=FLlvs6ovGZfb8w0iuNcZbBcfcNUF7mpFvitEWswOGNY=; b=imp9nQNQojKI9zzNudaauEL1Zv v0v3+V6jdmvCvmSahujK258hpgCmj8JoDAv0DgMfoe2TKMofdhQbAZ0udtpXxMSRP2T7jbg5fAmnA F//fzD8SLmt603dmPTAFHnijs76b1li2M3recLimpANAZ9I27p1PJK3J7Eo8l4FDO+aXT/efuKn3h xOJ6G2oQP8rvjAIbDDqw4UlcdQJrXzWoZjh6iLma7yf0udxtL/ycKJlEjwm7CNA7vMuaVCUHs9+pt fo3Fr6BtpNl7QFIwfCpwMHgDKy0Cy6A5QhgwlRIaMFcm7Wz4vTacRGxm2V9zFfme6LRfaR2Ajc1z3 v5gj1CDQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AG-000UZg-0o for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 67951613B4; Thu, 29 Apr 2021 08:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685411; bh=2qAnuZ0glq7AD0WdQxX0rOeTrE+qvGfHUxQ2lCXNL8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5z99kBzrOrO5N3XTumPMUpPZExJtOdotoLhGXf3C20gqEqJ256d5oK7P5uXcGKLS ohvR7hBUHcGkALFvgWY90FCamd5G+EevWmbnVOQOzFi2DHn/mkA1bob8KDHb3epsnf DGckQ6/iwtqKn66b+ZxR0sAtjlGVEbdZpYVS5/4u+Y9iFDjz6wUTmZFa+KgkBZN4Rq CEdnXwToC2xePL1NRXbPWiKxPUeqji5RZ8sr2LjbkywAoBelXx5NbR5jkvqXrQVCYh ygjkli9u4EYqhKDm8w6qBdSNRlJr9fKLaz9M+OFgCvNzepXH0M3SZJoWKHzmRO/B2a VsT4BdsSq1NlQ== Received: by pali.im (Postfix) id 693FDA43; Thu, 29 Apr 2021 10:36:49 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 3/6] firmware: turris-mox-rwtm: fail probing when firmware does not support hwrng Date: Thu, 29 Apr 2021 10:36:33 +0200 Message-Id: <20210429083636.22560-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210429083636.22560-1-pali@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> <20210429083636.22560-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013652_117680_4391991B X-CRM114-Status: GOOD ( 14.51 ) 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 When Marvell's rWTM firmware, which does not support the GET_RANDOM command, is used, kernel prints an error message hwrng: no data available every 10 seconds. Fail probing of this driver if the rWTM firmware does not support the GET_RANDOM command. This makes it possible to put this driver's compatible into generic armada-37xx device tree, to be available for other Armada 3720 devices besides Turris MOX. If they use the rWTM firmware from CZ.NIC, they will have HWRNG available, and if not, the driver won't be complaining. Signed-off-by: Pali Rohár Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") Signed-off-by: Marek Behún --- drivers/firmware/turris-mox-rwtm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index d7e3489e4bf2..3ef9687dddca 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -260,6 +260,27 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) return 0; } +static int check_get_random_support(struct mox_rwtm *rwtm) +{ + struct armada_37xx_rwtm_tx_msg msg; + int ret; + + msg.command = MBOX_CMD_GET_RANDOM; + msg.args[0] = 1; + msg.args[1] = rwtm->buf_phys; + msg.args[2] = 4; + + ret = mbox_send_message(rwtm->mbox, &msg); + if (ret < 0) + return ret; + + ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); + if (ret < 0) + return ret; + + return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); +} + static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) { struct mox_rwtm *rwtm = (struct mox_rwtm *) rng->priv; @@ -497,6 +518,13 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) if (ret < 0) dev_warn(dev, "Cannot read board information: %i\n", ret); + ret = check_get_random_support(rwtm); + if (ret < 0) { + dev_notice(dev, + "Firmware does not support the GET_RANDOM command\n"); + goto free_channel; + } + rwtm->hwrng.name = DRIVER_NAME "_hwrng"; rwtm->hwrng.read = mox_hwrng_read; rwtm->hwrng.priv = (unsigned long) rwtm; From patchwork Thu Apr 29 08:36:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230783 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 36D52C433ED for ; Thu, 29 Apr 2021 08:38:37 +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 D3F0A6135B for ; Thu, 29 Apr 2021 08:38:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3F0A6135B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QUq2MzDeDQXJt73c+eDPu1rNSOy9/yXfg/LrzWYrRYY=; b=qFAHrxqwmn3x2l2uSg6m0139M vupkjbYmZYJBO+Lok0acUXnKiH9oRgyYvSbGCTqzP5wf4q4r1GuvSxQA+nD9y+i2ExvQdr9bNbd16 kWxLgPGoWoyPk0EEFfB9VGhr3ce0wOyWl/7MNqeKxnWiC3v2kpFVnCFy1E+XBqH/nja4qULCjwkYe OLNVuCkAed+4CaLYv5hnYGrCf8g/QilROZLMqPco/FGvwUfrUR0Jwshk8Wbp7J9Tmlyf2W791XOK+ oOFNK1LDJTmCfyIRUXQFDCjgyW1bCw9bq/qKyNIyJmOiTZYqQUiUeFVtd/ae85hNDJoRVppJa+rdM vQoqZ7pDw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2Aa-005KD7-M6; Thu, 29 Apr 2021 08:37:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AI-005KBR-1Y for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=8NZnA7V+z/EHW9keu1iVSVZG84qryZ9Vb6MgLmI5Xdk=; b=RmYFg5YVQxd6c2jyRCIAUlPxyq Hv4oq3woRgkYBCFvHvL9lW15gK6vmH6phir6QW8hVhOPU2RArGYIelbuzd6Az5GaB6fm90EbeXvwM MG/aRQu4yqf9gY90IuJDqDCMY60eWJyKDIQKm0DIH+wmDG2lf945fT27Vi3HMPbQoKjoAFD0/iWqS wimULJFefGIs6eynAdVlncPiJinV/htpwTjNAhXubw6+kOLfb5Aa9V/A24LgYIjoBllPrL80WdlNr n6N9zoIv+dInfBK7wDQSuUHcDSJXMOndGoA5ENCzzDqkbJ3P/0vYkjcjdPFSlumwAGeiEZst7n1yw r9EjRYlQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AF-000UZU-BB for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C084261186; Thu, 29 Apr 2021 08:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685410; bh=+OylOm4Xj8hBbMUtVil2h9pLATRR6MkYlmUTGrTyvwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNhuNvCOvWoT5QiNHqzkYjm4/oZfCG9xk1G8IbaSStbr0eaedpPsbdCOdspR/6hjW rJ664iDKPkaiLOy+d7Uxu/rKH5XOj4Hs6W/FMJR8XknFuAzTsmzW4q+UtIdv3uuP5e JYrfjDUtHQLYYUswY2BvUtLpW65G6r+H8X2OxTmzaBsyw7VaGNh3/Q1WY8BzKVNUTy scz3TXBpWQSjHPlawqd6od+MKB9qzK7BsxSc7uwnbl570ITBlbLtAj+d1oTwHEygnl kuOsRf5WlCMg2PXmsmVaOD5DZftBbkkaEBoTvE74ac3NsA/C1BihITZliIjEAr2jM3 gu1bx+d8AsHEQ== Received: by pali.im (Postfix) id 79FB37DF; Thu, 29 Apr 2021 10:36:50 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 4/6] firmware: turris-mox-rwtm: show message about HWRNG registration Date: Thu, 29 Apr 2021 10:36:34 +0200 Message-Id: <20210429083636.22560-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210429083636.22560-1-pali@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> <20210429083636.22560-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013651_434878_2A44302A X-CRM114-Status: UNSURE ( 9.76 ) 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 Currently it is hard to determinate if on Armada 3720 device is HWRNG by running kernel accessible or not. So print information message into dmesg when HWRNG is available and registration was successful. Signed-off-by: Pali Rohár Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") --- drivers/firmware/turris-mox-rwtm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 3ef9687dddca..1cf4f1087492 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -542,6 +542,8 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) goto free_channel; } + dev_info(dev, "HWRNG successfully registered\n"); + return 0; free_channel: From patchwork Thu Apr 29 08:36:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230789 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 7AF9DC433ED for ; Thu, 29 Apr 2021 08:39:03 +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 277FA613BC for ; Thu, 29 Apr 2021 08:39:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 277FA613BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y0x2PGL4X92TcV/+ZIbelGttoe/nk72BPEEBGwuNtGE=; b=F8XkGyIgGqd8ZIT/jClZ5EiUR YDP0dTmXVZ6CRxZbQZ620sQxREMhEG4FSR9aIDq+/9aGdCoz8HesGsHIq+PR4ZD8mYucCaMj6X/f0 1H4j1voHL1xzhmHVi+G93FuY6mXOuqB1qhy5rKPAl6iFZ7OIzM8xAAv+U9Jh8yKGOP56oeRf4P7zF 6lLiFGQVw+IvIIqqL6NUsWYkJ7AHDmISakv/4bOUFR6dagsAiDER9X2oBQ0xufdpEwoX0mkiklZcf RPov9aHc7+f40+B+GtcI1lAOzQqSgb3tiHSAiFeQPob+X0OOiHFr9Go1S+ZZqUCsnJyvJn3BXOpV/ mtomux38A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2Av-005KGX-9O; Thu, 29 Apr 2021 08:37:34 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AJ-005KBd-5H for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:36:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Xi4gcxr07Z2fqZn/n6VFBWXZX6ZNrFmE9ap6PKkWJIg=; b=S3wh/VVC6zVGGkbvkXXPG7KpjF M2+FiuI1x0FMSWXSUIN9Whx3T+VosS+Ck3YiS4zVvBpMexVh/GFAN/t6RD6nrwVZOsjXc/TX9/Klr BkApND0y7rsxzJ8g6pbxkWW5xNWY21+2PLGiQFGGHtMS0IOYmiN+QSMqZnTD0nH6g0xocBus9e9mS UT3Ys1tA0HYM6ObKUKyWTNowdEjgRe1IiDyPtWRDySVT7JNcb0QyyU14e3WYMxjvdzwx9bfAPenkx qEclWH5bpaJO4OPdD/V8lsCGj8ginMcvBRN8tzAxeLeQ8jxG5Kpp0A+alATHeYCwma27BG1u4qQur 4wGUzKdQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2AG-000UZx-IO for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:36:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id EAF01613F0; Thu, 29 Apr 2021 08:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685412; bh=J5vHzzxX2VNER+zka6PEWkClrD68ro+cEjhzakb7mic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pyT6fF4xg5D7Mnqdmc1RjIpsFN/xyGEZHtIejDsPt31etCpuENVLYnPeb5lfk+YBC BH6hqv8IeuQi7x9BC1dB2290WHQzp8XB/9gQEM6cyWmduwZ3HnKmPPAQz9GEL5vVcZ gju0Pj766jODFEj35NIzUQp02Epm/z2nCWAhGL1eM1tn1ObBM8glU/fEkYtGy+MX1B 9Ud53B/frNAtwyvWbgQWy8yMnt6tAfthXv7hcw5RI52o2XUtPIFzokIK9vBQ8gGKsa g/C2VYkwqOxZL/PvSruO6/ytzP3J3LzFI1cx7LwEy+1qVk6pbHb4t1Q0XQ28s3CjvG QfxJcRA7PZXzQ== Received: by pali.im (Postfix) id A5C1B7DF; Thu, 29 Apr 2021 10:36:51 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 5/6] firmware: turris-mox-rwtm: add marvell, armada-3700-rwtm-firmware compatible string Date: Thu, 29 Apr 2021 10:36:35 +0200 Message-Id: <20210429083636.22560-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210429083636.22560-1-pali@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> <20210429083636.22560-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013652_660524_70CCB861 X-CRM114-Status: GOOD ( 11.32 ) 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 Add more generic compatible string 'marvell,armada-3700-rwtm-firmware' for this driver, since it can also be used on other Armada 3720 devices. Current compatible string 'cznic,turris-mox-rwtm' is kept for backward compatibility. Signed-off-by: Pali Rohár Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") --- We are also planning to work on extending this driver to support accessing OTP, which will also work with Marvell's default WTMI firmware. --- drivers/firmware/turris-mox-rwtm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 1cf4f1087492..c2d34dc8ba46 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -569,6 +569,7 @@ static int turris_mox_rwtm_remove(struct platform_device *pdev) static const struct of_device_id turris_mox_rwtm_match[] = { { .compatible = "cznic,turris-mox-rwtm", }, + { .compatible = "marvell,armada-3700-rwtm-firmware", }, { }, }; From patchwork Thu Apr 29 08:36:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12230791 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 C81CCC433ED for ; Thu, 29 Apr 2021 08:39:19 +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 1A2166135B for ; Thu, 29 Apr 2021 08:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A2166135B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ErTYoBYR5Fn/49pxg9kMJhlr/gvqpXlms9EwffxkBEY=; b=QjktsRfX1AFG6BCVrmyvuZsPr xeDB4B08AR1XJUy/mYjHRr4ceecf4PYCGJsxm51YLl33JUkBS52b8lQn0k0Cg39RbVLVavVqq/sAZ BcFI7ds4PdB2BYmtG0VW3rTwjZKh6Wdl952MqWcWNHts3D2GKtkMxTIMqKbxHpSzq89TJcpVKL+fe OfTwIp/5zgIdnEnqewN4cvxBQQ2OXwk08UT3u9h/9w4n6fyFlZ6Znn2J2eTkp48PcXcdmKinQOvvX iYy2HPq5UCuOODVvg31EuX0Mzc3Fw50gW3NxUn+xj5wk+Zeerq+3eeXDEFSM11tXTIPti9ET7xkeX Up3MyF7/A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc2BA-005KKc-U5; Thu, 29 Apr 2021 08:37:49 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2As-005KFx-7m for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 08:37:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=QAs0VKDf2DS+kHVA7k/n+0JwJhlXpIcQsC7I+/kBXa0=; b=S0yHtUFby3f3n9wd03sKsiquQf lAmhA6C+QEXvgI2pq3hSOfvv4hPugFBQVQupmkOImdfDq2YXhYB6INp3t5IjXH9ih5UpMMRP3nVJR ekZAl7GeEZL1/1lsvch7oz127LnwvvDB6sGYOVrv/wHU5JrIExV8Z8Xwi2YlRY2KIMNHjrYmi1m59 VrQuhT0JpssZePa8S0PTOUdV2Zxq4ihskzRUdxFfyNlk8qGNghw4CyiY22NzINvsTJ6qA/vFIZZwo Sp8Tr7dbo3KvbGyrpmcx9HbDz6ZQJwS7FSgzFnMxkn2g+d2hlaqg0uVWLL6+TVOVXi0bZNZuA0Hu7 3HQWmfWw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc2Ap-000Ubx-Pi for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 08:37:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 124A5613CC; Thu, 29 Apr 2021 08:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619685447; bh=HaAfWtOAafkNSsvz88e84TAEk52kR7zNGm+Hs1lufVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9cwET2lfBWx4z21Rbb5XQMMhagUx2mZffCLo2Lp3v/hzb4OAB6NrKG31LTSxwiKc lVch/kCh8FFLY5N9U5tNB9qh03SCzDBRwkuYoMM206585XP4FdSHs8ux+y3jD1Wt9l HiH+s+W2q5JX1mo5P7mLWnVKEHCT5wf9OfNl3//yR3epiOmS3Ub3Jmnkg8IVKOJCV/ fZsDZEsCMLNF2+R8iihbHsEw0q1B/uYa29DsAom/etGTcGe6qoFnnBH2HqDWiyuIZ1 r68ti6+chgwa5tf+bOYsDae1tsDYvngA+sdcim/uCP2r9VCopjnqL5zV0jkKjddaMy 8XEt2Nr8sbvgQ== Received: by pali.im (Postfix) id C4B347DF; Thu, 29 Apr 2021 10:37:24 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Gregory CLEMENT , Andrew Lunn Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 mvebu + mvebu/dt64 6/6] arm64: dts: marvell: armada-37xx: move firmware node to generic dtsi file Date: Thu, 29 Apr 2021 10:36:36 +0200 Message-Id: <20210429083636.22560-6-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210429083636.22560-1-pali@kernel.org> References: <20210308153703.23097-1-kabel@kernel.org> <20210429083636.22560-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_013727_890052_A4228C17 X-CRM114-Status: GOOD ( 13.97 ) 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 Move the turris-mox-rwtm firmware node from Turris MOX' device tree into the generic armada-37xx.dtsi file and use the generic compatible string 'marvell,armada-3700-rwtm-firmware' instead of the current one. The Turris MOX rWTM firmware can be used on any Armada 37xx device, giving them access to the rWTM hardware random number generator, which is otherwise unavailable. This change allows Linux to load the turris-mox-rwtm.ko module on these boards. Tested on ESPRESSObin v5 with both default Marvell WTMI firmware and CZ.NIC's firmware. With default WTMI firmware the turris-mox-rwtm fails to probe, while with CZ.NIC's firmware it registers the HW random number generator. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Cc: # 5.4+: 46d2f6d0c99f ("arm64: dts: armada-3720-turris-mox: add firmware node") --- arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts | 8 -------- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts index 0753cc489638..ebb0ddf8d306 100644 --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts @@ -107,14 +107,6 @@ /* enabled by U-Boot if SFP module is present */ status = "disabled"; }; - - firmware { - turris-mox-rwtm { - compatible = "cznic,turris-mox-rwtm"; - mboxes = <&rwtm 0>; - status = "okay"; - }; - }; }; &i2c0 { diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi index 1b7f43e27589..847a2d12a4be 100644 --- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi @@ -505,4 +505,12 @@ }; }; }; + + firmware { + armada-3700-rwtm { + compatible = "marvell,armada-3700-rwtm-firmware"; + mboxes = <&rwtm 0>; + status = "okay"; + }; + }; };