Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2224923/?format=api
{ "id": 2224923, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2224923/?format=api", "web_url": "http://patchwork.ozlabs.org/project/opensbi/patch/20260419150857.2705843-3-aurelien@aurel32.net/", "project": { "id": 67, "url": "http://patchwork.ozlabs.org/api/1.1/projects/67/?format=api", "name": "OpenSBI development", "link_name": "opensbi", "list_id": "opensbi.lists.infradead.org", "list_email": "opensbi@lists.infradead.org", "web_url": "https://github.com/riscv/opensbi", "scm_url": "", "webscm_url": "" }, "msgid": "<20260419150857.2705843-3-aurelien@aurel32.net>", "date": "2026-04-19T14:49:20", "name": "[2/2] lib: utils/reset: add SpacemiT P1 PMIC support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9cf947470a0f67c7b2d20466a9eb0cf4c6a1c4ce", "submitter": { "id": 2775, "url": "http://patchwork.ozlabs.org/api/1.1/people/2775/?format=api", "name": "Aurelien Jarno", "email": "aurelien@aurel32.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/opensbi/patch/20260419150857.2705843-3-aurelien@aurel32.net/mbox/", "series": [ { "id": 500513, "url": "http://patchwork.ozlabs.org/api/1.1/series/500513/?format=api", "web_url": "http://patchwork.ozlabs.org/project/opensbi/list/?series=500513", "date": "2026-04-19T14:49:20", "name": "Add reboot support for SpacemiT K1 platforms", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500513/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2224923/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2224923/checks/", "tags": {}, "headers": { "Return-Path": "\n <opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=f78GoDQg;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n secure) header.d=aurel32.net header.i=@aurel32.net header.a=rsa-sha256\n header.s=202004.hall header.b=xrshYe9e;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fzBqK1xQ4z1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 01:09:29 +1000 (AEST)", "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wETlt-00000005sEj-2l6s;\n\tSun, 19 Apr 2026 15:09:17 +0000", "from hall.aurel32.net ([2001:bc8:30d7:100::1])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wETlq-00000005sDh-3efJ\n\tfor opensbi@lists.infradead.org;\n\tSun, 19 Apr 2026 15:09:15 +0000", "from authenticated user\n\tby hall.aurel32.net with esmtpsa (TLS1.3) tls\n TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\n\t(Exim 4.98.2)\n\t(envelope-from <aurelien@aurel32.net>)\n\tid 1wETli-0000000CKQs-04kA;\n\tSun, 19 Apr 2026 17:09:06 +0200" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=+uYYT6nJ9cMxFI2a8y6NeGBV0RLYBjJPbNDVBNsuo98=; b=f78GoDQg/02iSa\n\tck7tMLMcGt+COB2KlLInrbDZo+HQFy5632E4MXdk8IcViumcxeYRPNg8QYdvtbaMXQAoXbNvxTd3p\n\teA1TEAvNoA6983o6MN6arOoTHhffdlZVezDx424WMzg9mp408bTYsFb1gZWDJbfSPzTTNeENhueej\n\tpxChnZ/OfJu2IshX599hYTdwAaPSBDqPfOmbSA+7tVM8/iQKX+OuFBw0QtC06JfHjvllVdC4hGQ/g\n\tXSGsxFfZ/b7sq0fQJc5ryCt2MbTVFNqIiAhWJwT4yfw9xnMxdVAEVwLMvZVVgBwqx7AlvJQ3bVqgb\n\tJCCOrBTqsNbScQQp2pYg==;", "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net\n\t; s=202004.hall; h=Content-Transfer-Encoding:MIME-Version:References:\n\tIn-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:From:Reply-To:\n\tSubject:Content-ID:Content-Description:X-Debbugs-Cc;\n\tbh=o5SeCtw89wWdCv2Aojtx42l0VpfqzBNXcnHFTU1Xpac=; b=xrshYe9e2WpQx5wtmPpnb1RrjR\n\tdezAnvUYuLiBISN3jDmx6gyyaoPvNYRobVojjz6QHGNxHjK1b6JYFQuUc5cyC+hWEyBwJVNnWJFst\n\t/p1Dw4Vf24tGb8HdqBo9Uk8UBAC1ev2MPDWXt5YL7wZc+0i6XcPNVcDvC1pUt/g3XzL4nOSVXZBAG\n\tqBFAm1u2dw7wow43rQn3Qjil3rCGvuLOeIJG5ngsnYivO2IS54Lc0xFwkpPK+qXXpqQg1SKbTfL2G\n\tJBZPYFn6UwD4ykjHSsC65uARnezLPaGoQSEb3IKUjeoZ+DiEKnnqO4soJvjH7Lb9J3DiWsz3hpkB9\n\tSwC7yekA==;" ], "From": "Aurelien Jarno <aurelien@aurel32.net>", "To": "opensbi@lists.infradead.org", "Cc": "Aurelien Jarno <aurelien@aurel32.net>", "Subject": "[PATCH 2/2] lib: utils/reset: add SpacemiT P1 PMIC support", "Date": "Sun, 19 Apr 2026 16:49:20 +0200", "Message-ID": "<20260419150857.2705843-3-aurelien@aurel32.net>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260419150857.2705843-1-aurelien@aurel32.net>", "References": "<20260419150857.2705843-1-aurelien@aurel32.net>", "MIME-Version": "1.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20260419_080914_916884_FA57FD7C ", "X-CRM114-Status": "GOOD ( 17.25 )", "X-Spam-Score": "-4.4 (----)", "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam. The original\n message has been attached to this so you can view it or label\n similar future email. If you have any questions, see\n the administrator of that system for details.\n Content preview: The SpacemiT P1 is a PMIC commonly found with SpacemiT CPU\n like K1. Add a reset driver for it. Signed-off-by: Aurelien Jarno\n <aurelien@aurel32.net>\n --- lib/utils/reset/Kconfig | 4 + lib/utils/reset/fdt_reset_spacemit_p1.c\n | 112 ++++++++++++++++++++++++ lib/utils/reset/objects.mk | 3 + platform/\n [...]\n Content analysis details: (-4.4 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/,\n medium trust\n [2001:bc8:30d7:100:0:0:0:1 listed in]\n [list.dnswl.org]\n -0.0 SPF_HELO_PASS SPF: HELO matches SPF record\n -0.0 SPF_PASS SPF: sender matches SPF record\n -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n author's\n domain\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n -0.1 DKIM_VALID Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n [score: 0.0000]\n 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay\n lines", "X-BeenThere": "opensbi@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "<opensbi.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/opensbi/>", "List-Post": "<mailto:opensbi@lists.infradead.org>", "List-Help": "<mailto:opensbi-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"opensbi\" <opensbi-bounces@lists.infradead.org>", "Errors-To": "opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "The SpacemiT P1 is a PMIC commonly found with SpacemiT CPU like K1. Add\na reset driver for it.\n\nSigned-off-by: Aurelien Jarno <aurelien@aurel32.net>\n---\n lib/utils/reset/Kconfig | 4 +\n lib/utils/reset/fdt_reset_spacemit_p1.c | 112 ++++++++++++++++++++++++\n lib/utils/reset/objects.mk | 3 +\n platform/generic/configs/defconfig | 1 +\n 4 files changed, 120 insertions(+)\n create mode 100644 lib/utils/reset/fdt_reset_spacemit_p1.c", "diff": "diff --git a/lib/utils/reset/Kconfig b/lib/utils/reset/Kconfig\nindex 4835921f..f98926e5 100644\n--- a/lib/utils/reset/Kconfig\n+++ b/lib/utils/reset/Kconfig\n@@ -33,6 +33,10 @@ config FDT_RESET_SG2042_HWMON_MCU\n \tbool \"Sophgo SG2042 hwmon MCU FDT reset driver\"\n \tdefault n\n \n+config FDT_RESET_SPACEMIT_P1\n+\tbool \"SpacemiT P1 reset driver\"\n+\tdefault n\n+\n config FDT_RESET_SUNXI_WDT\n \tbool \"Sunxi WDT FDT reset driver\"\n \tdefault n\ndiff --git a/lib/utils/reset/fdt_reset_spacemit_p1.c b/lib/utils/reset/fdt_reset_spacemit_p1.c\nnew file mode 100644\nindex 00000000..5312e741\n--- /dev/null\n+++ b/lib/utils/reset/fdt_reset_spacemit_p1.c\n@@ -0,0 +1,112 @@\n+/*\n+ * SPDX-License-Identifier: BSD-2-Clause\n+ *\n+ * Copyright (c) 2026 Aurelien Jarno\n+ * Authors:\n+ * Aurelien Jarno <aurelien@aurel32.net>\n+ */\n+\n+#include <libfdt.h>\n+#include <platform_override.h>\n+#include <sbi/sbi_bitops.h>\n+#include <sbi/sbi_console.h>\n+#include <sbi/sbi_system.h>\n+#include <sbi_utils/fdt/fdt_driver.h>\n+#include <sbi_utils/i2c/fdt_i2c.h>\n+\n+/* SpacemiT P1 Power Control Register 2 */\n+#define PWR_CTRL2\t\t0x7e\n+#define PWR_CTRL2_SHUTDOWN\tBIT(2)\t/* Shutdown request */\n+#define PWR_CTRL2_RST\t\tBIT(1)\t/* Reset request */\n+\n+static struct i2c_adapter *p1_adapter = NULL;\n+static uint32_t p1_reg = 0;\n+\n+static int p1_system_reset_check(uint32_t type, uint32_t reason)\n+{\n+\tswitch (type) {\n+\tcase SBI_SRST_RESET_TYPE_SHUTDOWN:\n+\t\treturn 1;\n+\tcase SBI_SRST_RESET_TYPE_COLD_REBOOT:\n+\tcase SBI_SRST_RESET_TYPE_WARM_REBOOT:\n+\t\treturn 255;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void p1_ops(uint32_t type)\n+{\n+\tuint8_t byte;\n+\tint rc;\n+\n+\trc = i2c_adapter_reg_read(p1_adapter, p1_reg, PWR_CTRL2, &byte);\n+\tif (rc) {\n+\t\tsbi_printf(\"%s: cannot read P1 Power Control Register 2\\n\", __func__);\n+\t\treturn;\n+\t}\n+\n+\tif (type == SBI_SRST_RESET_TYPE_SHUTDOWN)\n+\t\tbyte |= PWR_CTRL2_SHUTDOWN;\n+\telse\n+\t\tbyte |= PWR_CTRL2_RST;\n+\n+\trc = i2c_adapter_reg_write(p1_adapter, p1_reg, PWR_CTRL2, byte);\n+\tif (rc)\n+\t\tsbi_printf(\"%s: cannot write P1 Power Control Register 2\\n\", __func__);\n+}\n+\n+static void p1_system_reset(uint32_t type, uint32_t reason)\n+{\n+\tswitch (type) {\n+\tcase SBI_SRST_RESET_TYPE_SHUTDOWN:\n+\tcase SBI_SRST_RESET_TYPE_COLD_REBOOT:\n+\tcase SBI_SRST_RESET_TYPE_WARM_REBOOT:\n+\t\tp1_ops(type);\n+\t\tbreak;\n+\t}\n+}\n+\n+static struct sbi_system_reset_device p1_reset = {\n+\t.name = \"spacemit-p1-reset\",\n+\t.system_reset_check = p1_system_reset_check,\n+\t.system_reset = p1_system_reset\n+};\n+\n+static int p1_reset_init(const void *fdt, int nodeoff,\n+\t\t\t const struct fdt_match *match)\n+{\n+\tint rc, i2c_bus;\n+\tuint64_t addr;\n+\n+\t/* we are spacemit,p1 node */\n+\trc = fdt_get_node_addr_size(fdt, nodeoff, 0, &addr, NULL);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tp1_reg = addr;\n+\n+\t/* find i2c bus parent node */\n+\ti2c_bus = fdt_parent_offset(fdt, nodeoff);\n+\tif (i2c_bus < 0)\n+\t\treturn i2c_bus;\n+\n+\t/* i2c adapter get */\n+\trc = fdt_i2c_adapter_get(fdt, i2c_bus, &p1_adapter);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tsbi_system_reset_add_device(&p1_reset);\n+\n+\treturn 0;\n+}\n+\n+static const struct fdt_match p1_reset_match[] = {\n+\t{ .compatible = \"spacemit,p1\", .data = (void *)true },\n+\t{ },\n+};\n+\n+const struct fdt_driver fdt_reset_spacemit_p1 = {\n+\t.match_table = p1_reset_match,\n+\t.init = p1_reset_init,\n+};\ndiff --git a/lib/utils/reset/objects.mk b/lib/utils/reset/objects.mk\nindex ac38b49d..3c681c27 100644\n--- a/lib/utils/reset/objects.mk\n+++ b/lib/utils/reset/objects.mk\n@@ -20,6 +20,9 @@ libsbiutils-objs-$(CONFIG_FDT_RESET_HTIF) += reset/fdt_reset_htif.o\n carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SG2042_HWMON_MCU) += fdt_reset_sg2042_mcu\n libsbiutils-objs-$(CONFIG_FDT_RESET_SG2042_HWMON_MCU) += reset/fdt_reset_sg2042_hwmon_mcu.o\n \n+carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SPACEMIT_P1) += fdt_reset_spacemit_p1\n+libsbiutils-objs-$(CONFIG_FDT_RESET_SPACEMIT_P1) += reset/fdt_reset_spacemit_p1.o\n+\n carray-fdt_early_drivers-$(CONFIG_FDT_RESET_SUNXI_WDT) += fdt_reset_sunxi_wdt\n libsbiutils-objs-$(CONFIG_FDT_RESET_SUNXI_WDT) += reset/fdt_reset_sunxi_wdt.o\n \ndiff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig\nindex a9cb0f06..ae278856 100644\n--- a/platform/generic/configs/defconfig\n+++ b/platform/generic/configs/defconfig\n@@ -51,6 +51,7 @@ CONFIG_FDT_RESET_GPIO=y\n CONFIG_FDT_RESET_HTIF=y\n CONFIG_FDT_RESET_RPMI=y\n CONFIG_FDT_RESET_SG2042_HWMON_MCU=y\n+CONFIG_FDT_RESET_SPACEMIT_P1=y\n CONFIG_FDT_RESET_SUNXI_WDT=y\n CONFIG_FDT_RESET_SYSCON=y\n CONFIG_FDT_SERIAL=y\n", "prefixes": [ "2/2" ] }