From patchwork Wed Mar 27 10:11:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 1916668 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=aTZ4A4hi; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=fAHZtXMc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256 header.s=google header.b=WgoeaL6X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V4Msl6Rh6z1yXq for ; Wed, 27 Mar 2024 21:12:11 +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=bh2iAlAGHJRTjF3reT2tYHCfrMx8+VowFhVETjmO5EE=; b=aTZ4A4hiioctWK takt91uq0KgMZ66wzkoe1RsfO+e10BNsYm+hMXOCPHeRgL+dkKRfGgSxwdIhhzFUi56aq1WJZjJkW ZlJulQXWd6masMQ029K4evDNSazy7tRiawXTA26kboaW8TiAySDDYhfNE6b/uOfjAKp/qE+jh7vI1 aJk+o5IyFtU3zk6Zkcc/BFxBBuP+GDidC5ndCdCI4MsEuZtAWz7Tib3HpeaD+vz9KC7yx74pX9jLq X3YAiqsWH46PnTHI5glVGlawqXjGInAOX5ceRLtXCKfenLR8Og0zhExiuvX/eZymZHiIVIpCPe/TN oZ0nPvP+Ckv+V6hlLFlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpQGK-00000008MLL-1qBG; Wed, 27 Mar 2024 10:12:04 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpQGG-00000008MHM-3igW for opensbi@bombadil.infradead.org; Wed, 27 Mar 2024 10:12:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=sdDamzyxWTmZZ1fBKFGAuSURrGvc93shUJBZpN8LPx0=; b=fAHZtXMc/ZphTyy/6Pozfw5/Pf tRVjtHhimKxcu/dUX2RJjOAm6Hl82HS8eb0wMs02Em9LU3AtTtw2fQjn4XehKw6N6qLXlmNBBKIzE bh19ouT2mMXMeBdjTi+pUadzI+TBb2uS9kYRqCchwfEvoMIS+F4Oj4ECE9tw3e3kZPrzn+fue21O4 MofvVtfS8YfyuypUUAOpFS77FROE3p7WB4FeDBZzdrEP6gNYRAu+AqXK/nQaGRTot2edaTAYsCskV zVbkV8Zvw28qSUucKpAgTcncwHHz8Gw9ZFs6YvKyBp1XdXdRUZ3xNmvgEzo9hLm+fyljSAKOk808/ kO7neR/g==; Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpQGB-00000000AEr-2fxY for opensbi@lists.infradead.org; Wed, 27 Mar 2024 10:11:59 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56c36f8f932so1272772a12.0 for ; Wed, 27 Mar 2024 03:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1711534313; x=1712139113; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sdDamzyxWTmZZ1fBKFGAuSURrGvc93shUJBZpN8LPx0=; b=WgoeaL6X+7nm19hF2NU2TZsB8Lx54DafTzA1TnAO9QsrrQDG7SU8IvWYGf4yassI6O JfTREtAimMxjgI5v8t9WPQIRYT1xghxCaXBSEwW0pX9QzDJA+6XMFnn6dtYH5trQDyMJ ixRJ9Qx5VuqeMmW0a//LAN6y0ANGyL0KmDok1KRGu5C49Lg3uXoaPoQQEA7dhbQjobyY GmB7P/LVmK8l62IAhKEaftRXq2CCHrc02Nr7bGk49MFwnaE4qf1v/YUjgDP0GKlcGG9U 7p0RL1g8VtsK31y2oezjYOX5QzKm0mFQgyStPhikdN/ZqMcLels10hnWJR0jWGH9Jb6r KXQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711534313; x=1712139113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sdDamzyxWTmZZ1fBKFGAuSURrGvc93shUJBZpN8LPx0=; b=qCS/AvjX0YfaNQsTvVzRTyrY0aPfRi8+dZiDwo/XJ1wB6ZrznoSPommcGqFUZRiXlV JxvNWZph6doDFX3OecOPBEWug2Uuxpfbzy5DgYpaTX6lbRHE9H8FvsCZbr5wCGE67iwT /C3NkBnIi4R5Ul3zeN6iO4+YBVD4aJRF9zkv3wbiFy/huIgZrM9zm0P8o6uag9p3xQxd LrPNy/qhlvYYfqlp/fcezSJhnVk3jUvsU0etFg8KZ6TbHTps+Rl3v35vj23hjPkDRu2m 2K1ldtIOGYKqhqin2WsISanXAyKX10BIqMMQDBYsyrQsmGAQsJaWWcH9hBHTon6VpZrx 0/mQ== X-Gm-Message-State: AOJu0Yx1yhsIWF3q8MRXs1GMWlf35yq8CWVpWs3p3Xd1rocxew0w4uNS mU4Kxv0FeCTdCa3LLfiEy1KiJtu0b0tTttX1CWB1PERde4qXlUIpQZLXF2lcbggrNZxteWl4flL 0tH8= X-Google-Smtp-Source: AGHT+IEMta42o+Oy10r7YkYR6/PwTC/GFMf+pCmKhlnxf/ivQhiZsaeL+jdDO2H+5c45Luwj/KuVqg== X-Received: by 2002:a50:9303:0:b0:56c:16c9:cb00 with SMTP id m3-20020a509303000000b0056c16c9cb00mr3700201eda.12.1711534313641; Wed, 27 Mar 2024 03:11:53 -0700 (PDT) Received: from antares.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id dh16-20020a0564021d3000b0056c1c4b870asm2451653edb.16.2024.03.27.03.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 03:11:53 -0700 (PDT) From: =?utf-8?q?Christoph_M=C3=BCllner?= To: opensbi@lists.infradead.org, Philipp Tomsich , Cooper Qu , Zhiwei Liu , Huang Tao , Alistair Francis Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH 9/9] platform: generic: Add generic T-Head override Date: Wed, 27 Mar 2024 11:11:37 +0100 Message-ID: <20240327101137.3644359-10-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327101137.3644359-1-christoph.muellner@vrull.eu> References: <20240327101137.3644359-1-christoph.muellner@vrull.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_101157_052327_BFEF4204 X-CRM114-Status: GOOD ( 14.59 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: Currently, we have support for three T-Head C9xx platforms: * Allwinner D1 * T-Head TH1520 * Sophgo SG2042 To make the platform detection more generic, let's add a T-Head generic override that matches on T-Head's vendor ID. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:529 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Currently, we have support for three T-Head C9xx platforms: * Allwinner D1 * T-Head TH1520 * Sophgo SG2042 To make the platform detection more generic, let's add a T-Head generic override that matches on T-Head's vendor ID. Proper detection of T-Head harts is needed so we can insert the CSR read-handler for th.mxstatus. Signed-off-by: Christoph Müllner --- platform/generic/Kconfig | 5 +++++ platform/generic/configs/defconfig | 1 + platform/generic/thead/objects.mk | 3 +++ platform/generic/thead/thead-generic.c | 27 ++++++++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 platform/generic/thead/thead-generic.c diff --git a/platform/generic/Kconfig b/platform/generic/Kconfig index 6d85e51..e53582b 100644 --- a/platform/generic/Kconfig +++ b/platform/generic/Kconfig @@ -63,6 +63,11 @@ config PLATFORM_STARFIVE_JH7110 bool "StarFive JH7110 support" default n +config PLATFORM_THEAD_GENERIC + bool "T-HEAD generic support" + select THEAD_C9XX_CSR + default n + config PLATFORM_THEAD_TH1520 bool "T-HEAD TH1520 support" select THEAD_C9XX_CSR diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig index 52ec0f6..e435b6d 100644 --- a/platform/generic/configs/defconfig +++ b/platform/generic/configs/defconfig @@ -5,6 +5,7 @@ CONFIG_PLATFORM_SIFIVE_FU540=y CONFIG_PLATFORM_SIFIVE_FU740=y CONFIG_PLATFORM_SOPHGO_SG2042=y CONFIG_PLATFORM_STARFIVE_JH7110=y +CONFIG_PLATFORM_THEAD_GENERIC=y CONFIG_PLATFORM_THEAD_TH1520=y CONFIG_FDT_GPIO=y CONFIG_FDT_GPIO_DESIGNWARE=y diff --git a/platform/generic/thead/objects.mk b/platform/generic/thead/objects.mk index 42f1f53..9d3a7e2 100644 --- a/platform/generic/thead/objects.mk +++ b/platform/generic/thead/objects.mk @@ -12,5 +12,8 @@ platform-objs-$(CONFIG_THEAD_C9XX_PMU) += thead/thead_c9xx_pmu.o platform-objs-$(CONFIG_THEAD_C9XX_ERRATA) += thead/thead_c9xx_tlb_trap_handler.o platform-objs-$(CONFIG_THEAD_C9XX_ERRATA) += thead/thead_c9xx_errata_tlb_flush.o +carray-platform_override_modules-$(CONFIG_PLATFORM_THEAD_GENERIC) += thead_generic +platform-objs-$(CONFIG_PLATFORM_THEAD_GENERIC) += thead/thead-generic.o + carray-platform_override_modules-$(CONFIG_PLATFORM_THEAD_TH1520) += thead_th1520 platform-objs-$(CONFIG_PLATFORM_THEAD_TH1520) += thead/thead-th1520.o diff --git a/platform/generic/thead/thead-generic.c b/platform/generic/thead/thead-generic.c new file mode 100644 index 0000000..f694b90 --- /dev/null +++ b/platform/generic/thead/thead-generic.c @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Authors: + * Christoph Müllner + */ + +#include +#include +#include +#include +#include + +static unsigned long thead_generic_vendor_ids[] = { + THEAD_VENDOR_ID, + 0, +}; + +static const struct fdt_match thead_generic_match[] = { + { }, +}; + +const struct platform_override thead_generic = { + .match_table = thead_generic_match, + .match_vendor_ids = thead_generic_vendor_ids, + .read_csr = thead_c9xx_read_csr, +};