From patchwork Wed Oct 20 01:58:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1543656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=MfC3ymn/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm1 header.b=oUwG9o24; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=DjTKlmLQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HYv0t3ZYnz9shx for ; Wed, 20 Oct 2021 12:58:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=+8rs827y4KbPACMjfYv7RFszgZFS7PH6hGF8Mp78PUo=; b=MfC3ymn/yX9HiE R6TqcxcWBSJwubphYo0nE8ExBo1cr2GbmeAUPtHbPqTdYy+whSkrR4aDlT/TQyagIZqINfD3LKvAy 7cuerF4J5j039wZiHqHf0sObY12x5uk8XL5o4r/GaDa5ay+t4Cih8BoqVjE2pufIAeaueP/ST+tzY HocvkwohtRbLRjcp2+baZEDDcgp7AgQq5sY9OR07nouEAWVPVVmRJq36r12FeyZ3uBVJKSbb/yk7E Cw5F/zvnTDug3mmguZd6gw4RxURcXQgRs6ShB+xIWGcenCf3vEIDp20XiZ07Vzsbl9dMmUE1JdatT WC4e6rvKncK8ixQpRvMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1md0sR-003ACy-2p; Wed, 20 Oct 2021 01:58:47 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1md0sO-003ABe-1f for opensbi@lists.infradead.org; Wed, 20 Oct 2021 01:58:46 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id CD0355C010D; Tue, 19 Oct 2021 21:58:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 19 Oct 2021 21:58:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=Q56EsxAcy67bL iyBJBBw/FOo6MZ5lITSfkz3hXXQ8EA=; b=oUwG9o24RtXKJa0M+mto3s4cVqqD/ XhASlqR8+RzmkCIblIcTczw+idFh/DyHBRVIDkxkOPaGnZ/Cr6sejnPvWICUPL2p bOuz7i+YBB4ADXiLB66oJjFEECVmjZ1OsJSpR7yH0nIYl7B3grhH2vSa6mpbXFmY jNYaG20m80GuKMyOiXq6va8VthJthBXtpvhHnBIAY6983zf5q+BG0tlJqjOavLIR YLm1LEckZEhFG7I1OGJtd8zTW9Zvck3uKedhsFaOAw3GvxYrmnJ6gmdzZFLsdYvg nACtLjS/Y96/1ER7e1n5s5um6WdoNqguDY7NJ5T3OJKlBkz6bK2z9wF/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Q56EsxAcy67bLiyBJBBw/FOo6MZ5lITSfkz3hXXQ8EA=; b=DjTKlmLQ myGaqaBnfki3CRrfibOEw4pRP4eAjlZeKXI8Mc5lENzeEsTsKqjUPrRumdZih+0L DS7W5K0/txVY4H5fpQOqYw3Sj0LKWdPfehgVPaeGT3mGqk3+FJnV0EMjOiNgafM6 bcURbR+qNu9KCnO40F+sma/Ny+DQTDRrZlbDF3Wxm9HwVFAZwH/4HpjfzSlXnYrh 4Vd+1t7VovYfZK/x2dJ8lBKoYvjg0Ecekkx8mpt7bjtd7zuJnODJw1AiGOwXZPX9 vokqVQi25ahVdH44ZCLfChPemCZWZP76x/EA8b1GwzEJchuOoKxlDOjt7hLey7Mp q4meYVk8aEaAeg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvfedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Oct 2021 21:58:39 -0400 (EDT) From: Samuel Holland To: opensbi@lists.infradead.org Cc: Heinrich Schuchardt , Guo Ren , Anup Patel , Samuel Holland Subject: [PATCH 1/2] lib: utils/fdt: Require match data to be const Date: Tue, 19 Oct 2021 20:58:37 -0500 Message-Id: <20211020015838.45399-2-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211020015838.45399-1-samuel@sholland.org> References: <20211020015838.45399-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_185845_040072_62404942 X-CRM114-Status: GOOD ( 11.51 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Match data stores hardware attributes which do not change at runtime, so it does not need to be mutable. Make it const. Signed-off-by: Samuel Holland --- include/sbi_utils/fdt/fdt_helper.h | 2 +- lib/utils/ipi/fdt_ipi_mswi.c | 2 +- lib/utils/reset/fdt_reset_gpio.c | 4 ++-- 3 files changed, 4 inser [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [66.111.4.29 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [66.111.4.29 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Match data stores hardware attributes which do not change at runtime, so it does not need to be mutable. Make it const. Signed-off-by: Samuel Holland Reviewed-by: Guo Ren Reviewed-by: Xiang W --- include/sbi_utils/fdt/fdt_helper.h | 2 +- lib/utils/ipi/fdt_ipi_mswi.c | 2 +- lib/utils/reset/fdt_reset_gpio.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h index 5cb7340..d51c3d3 100644 --- a/include/sbi_utils/fdt/fdt_helper.h +++ b/include/sbi_utils/fdt/fdt_helper.h @@ -14,7 +14,7 @@ struct fdt_match { const char *compatible; - void *data; + const void *data; }; #define FDT_MAX_PHANDLE_ARGS 16 diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c index 1f0fda7..0176941 100644 --- a/lib/utils/ipi/fdt_ipi_mswi.c +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -51,7 +51,7 @@ static int ipi_mswi_cold_init(void *fdt, int nodeoff, return 0; } -static unsigned long clint_offset = CLINT_MSWI_OFFSET; +static const unsigned long clint_offset = CLINT_MSWI_OFFSET; static const struct fdt_match ipi_mswi_match[] = { { .compatible = "riscv,clint0", .data = &clint_offset }, diff --git a/lib/utils/reset/fdt_reset_gpio.c b/lib/utils/reset/fdt_reset_gpio.c index 4da1450..b683d88 100644 --- a/lib/utils/reset/fdt_reset_gpio.c +++ b/lib/utils/reset/fdt_reset_gpio.c @@ -121,7 +121,7 @@ static int gpio_reset_init(void *fdt, int nodeoff, } static const struct fdt_match gpio_poweroff_match[] = { - { .compatible = "gpio-poweroff", .data = (void *)FALSE }, + { .compatible = "gpio-poweroff", .data = (const void *)FALSE }, { }, }; @@ -131,7 +131,7 @@ struct fdt_reset fdt_poweroff_gpio = { }; static const struct fdt_match gpio_reset_match[] = { - { .compatible = "gpio-restart", .data = (void *)TRUE }, + { .compatible = "gpio-restart", .data = (const void *)TRUE }, { }, }; From patchwork Wed Oct 20 01:58:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1543658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ekcAs3wF; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.a=rsa-sha256 header.s=fm1 header.b=j9EUfvEK; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=ZzoU+3XZ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HYv0t02j8z9sRN for ; Wed, 20 Oct 2021 12:58:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=cWsmeJNhGMfwEPV9NFRy+Vw9DTGT5WzB4Cvd74bddpA=; b=ekcAs3wF8dkUHg u3+MhhoGyRl++Gb4/ohvXDDj+13r5F14IHl8PC/WWDAY82LVMy8urzPYsCaD+olVnV1ahqeHWaQku f/a5Mk/4uKxghhG29Ytm6ezDdqGjHMJ5HYjfLdVFXui2FphzmI+5cC7HcyOfYvWrEmXyhgYKPable OfAP0tA634QWDSCK5W+cibXExXTySL9zN8R9seYEQbMQihoP40iFAKHRa2TQfDb39MTl47WMmi1cc vFwe/ubf/hBmVwx9KkZLv98WUCPiwaUr9s3DGTc4g/J+npobWsXn2Y3vjPTYT8/6k3RulHymj3YnI 7uiki9u4NGPfInu8eoqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1md0sT-003ADM-2D; Wed, 20 Oct 2021 01:58:49 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1md0sO-003ABf-2z for opensbi@lists.infradead.org; Wed, 20 Oct 2021 01:58:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5BC1F5C0198; Tue, 19 Oct 2021 21:58:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 19 Oct 2021 21:58:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=L6PoMUoeDp1p3 W+zI3/ccGZBcxSTWi5HEgyDenbRXV4=; b=j9EUfvEKJZp4Hzivmw0zFfARwG8u3 m6AIvh9paZlZjm1uHoXXop5uyTFog9EqgoOOG1i8sIgNTluuMPgJ7Yl0+SKfpVVf bMqJ5+D34IZRyzhkiu33XivoIpVJwa727b9SN03nHB8bz0dVGM8XSMLaoCQxFw/T TEpp3W4gQnzD31iUNKk7VF7Mp79mRotLh/U8dtmU6L3P/1iWiBFIQ+v5fo9O8dgL oriRFecYptLXq1TdWOb2hcqrHxBVNp0WH9qXb3rDUtEueqRdHWYDno5P4/Lf8WA7 UWiTwya6S3glH8H+Q0PvT4JwEzG9VDbQd71cMuHC3d33JB7/IDyHZI1rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=L6PoMUoeDp1p3W+zI3/ccGZBcxSTWi5HEgyDenbRXV4=; b=ZzoU+3XZ 4hRnLeqMFe3z64qHPr30LrzHMNE6pBojseP9asscVLy9jBQ4+4dNApDkUgTYHQ6C hIO1vmOtU4lfqmv7M08Gkbstr/bQ5YpD5B7EoKKJW6CIcZmtJsMxUu+gAGUyE0C+ iMGXdH07h/+7QjzvClrIqm/Bm2Ek5rgTDdZO3GdbVHai2v0p8XBKtFxnJjIn8myF cv5K0uSaqDU+g3l213UAJIWAUTUej+B9NP9olNUpw3+bj46u4K7V5DJ033tYZtvY nwWq+8+rp+J3dh0l0f5ROIImWvwZzi2SzQR6I0MKgC3f8RO2BF6OC3Mw0OTgkvIX G4tgSEPcFNd0Mw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvfedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Oct 2021 21:58:39 -0400 (EDT) From: Samuel Holland To: opensbi@lists.infradead.org Cc: Heinrich Schuchardt , Guo Ren , Anup Patel , Samuel Holland Subject: [RFC PATCH 2/2] lib: utils/timer: Add a separate compatible for the D1 CLINT Date: Tue, 19 Oct 2021 20:58:38 -0500 Message-Id: <20211020015838.45399-3-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211020015838.45399-1-samuel@sholland.org> References: <20211020015838.45399-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_185845_040023_12ED51CF X-CRM114-Status: GOOD ( 15.42 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The CLINT in the Allwinner D1 SoC apparently does not support 64-bit MMIO access. A property was added to support this quirk (and that property was copied to the ACLINT MTIMER code). However, since th [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [66.111.4.29 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [66.111.4.29 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The CLINT in the Allwinner D1 SoC apparently does not support 64-bit MMIO access. A property was added to support this quirk (and that property was copied to the ACLINT MTIMER code). However, since this difference in behavior makes the D1 CLINT incompatible with the SiFive CLINT's programming interface, a better solution is to use a separate compatible string. Signed-off-by: Samuel Holland Reviewed-by: Anup Patel --- docs/platform/thead-c9xx.md | 4 +-- lib/utils/ipi/fdt_ipi_mswi.c | 1 + lib/utils/timer/fdt_timer_mtimer.c | 39 +++++++++++++++++++----------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/docs/platform/thead-c9xx.md b/docs/platform/thead-c9xx.md index 3490ed5..ced784d 100644 --- a/docs/platform/thead-c9xx.md +++ b/docs/platform/thead-c9xx.md @@ -52,12 +52,11 @@ DTS Example1: (Single core, eg: Allwinner D1 - c906) ranges; clint0: clint@14000000 { - compatible = "riscv,clint0"; + compatible = "allwinner,sun20i-d1-clint"; interrupts-extended = < &cpu0_intc 3 &cpu0_intc 7 >; reg = <0x0 0x14000000 0x0 0x04000000>; - clint,has-no-64bit-mmio; }; intc: interrupt-controller@10000000 { @@ -163,7 +162,6 @@ DTS Example2: (Multi cores with soc reset-regs) &cpu4_intc 3 &cpu4_intc 7 >; reg = <0xff 0xdc000000 0x0 0x04000000>; - clint,has-no-64bit-mmio; }; intc: interrupt-controller@ffd8000000 { diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c index 0176941..af69e16 100644 --- a/lib/utils/ipi/fdt_ipi_mswi.c +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -54,6 +54,7 @@ static int ipi_mswi_cold_init(void *fdt, int nodeoff, static const unsigned long clint_offset = CLINT_MSWI_OFFSET; static const struct fdt_match ipi_mswi_match[] = { + { .compatible = "allwinner,sun20i-d1-clint", .data = &clint_offset }, { .compatible = "riscv,clint0", .data = &clint_offset }, { .compatible = "sifive,clint0", .data = &clint_offset }, { .compatible = "riscv,aclint-mswi" }, diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c index 1ad8508..e140567 100644 --- a/lib/utils/timer/fdt_timer_mtimer.c +++ b/lib/utils/timer/fdt_timer_mtimer.c @@ -15,6 +15,11 @@ #define MTIMER_MAX_NR 16 +struct timer_mtimer_quirks { + unsigned int mtime_offset; + bool has_64bit_mmio; +}; + static unsigned long mtimer_count = 0; static struct aclint_mtimer_data mtimer[MTIMER_MAX_NR]; static struct aclint_mtimer_data *mt_reference = NULL; @@ -23,7 +28,7 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff, const struct fdt_match *match) { int i, rc; - unsigned long offset, addr[2], size[2]; + unsigned long addr[2], size[2]; struct aclint_mtimer_data *mt; if (MTIMER_MAX_NR <= mtimer_count) @@ -43,28 +48,25 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff, return rc; if (match->data) { /* SiFive CLINT */ + const struct timer_mtimer_quirks *quirks = match->data; + /* Set CLINT addresses */ mt->mtimecmp_addr = addr[0] + ACLINT_DEFAULT_MTIMECMP_OFFSET; mt->mtimecmp_size = ACLINT_DEFAULT_MTIMECMP_SIZE; mt->mtime_addr = addr[0] + ACLINT_DEFAULT_MTIME_OFFSET; mt->mtime_size = size[0] - mt->mtimecmp_size; /* Adjust MTIMER address and size for CLINT device */ - offset = *((unsigned long *)match->data); - mt->mtime_addr += offset; - mt->mtimecmp_addr += offset; - mt->mtime_size -= offset; - /* Parse additional CLINT properties */ - if (fdt_getprop(fdt, nodeoff, "clint,has-no-64bit-mmio", &rc)) - mt->has_64bit_mmio = false; + mt->mtime_addr += quirks->mtime_offset; + mt->mtimecmp_addr += quirks->mtime_offset; + mt->mtime_size -= quirks->mtime_offset; + /* Apply additional CLINT quirks */ + mt->has_64bit_mmio = quirks->has_64bit_mmio; } else { /* RISC-V ACLINT MTIMER */ /* Set ACLINT MTIMER addresses */ mt->mtime_addr = addr[0]; mt->mtime_size = size[0]; mt->mtimecmp_addr = addr[1]; mt->mtimecmp_size = size[1]; - /* Parse additional ACLINT MTIMER properties */ - if (fdt_getprop(fdt, nodeoff, "mtimer,no-64bit-mmio", &rc)) - mt->has_64bit_mmio = false; } /* Check if MTIMER device has shared MTIME address */ @@ -107,11 +109,20 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff, return 0; } -static unsigned long clint_offset = CLINT_MTIMER_OFFSET; +static const struct timer_mtimer_quirks d1_clint_quirks = { + .mtime_offset = CLINT_MTIMER_OFFSET, + .has_64bit_mmio = false, +}; + +static const struct timer_mtimer_quirks sifive_clint_quirks = { + .mtime_offset = CLINT_MTIMER_OFFSET, + .has_64bit_mmio = true, +}; static const struct fdt_match timer_mtimer_match[] = { - { .compatible = "riscv,clint0", .data = &clint_offset }, - { .compatible = "sifive,clint0", .data = &clint_offset }, + { .compatible = "allwinner,sun20i-d1-clint", .data = &d1_clint_quirks }, + { .compatible = "riscv,clint0", .data = &sifive_clint_quirks }, + { .compatible = "sifive,clint0", .data = &sifive_clint_quirks }, { .compatible = "riscv,aclint-mtimer" }, { }, };