public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
@ 2025-11-02 23:01 Aurelien Jarno
  2025-11-02 23:01 ` [PATCH v5 1/2] " Aurelien Jarno
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Aurelien Jarno @ 2025-11-02 23:01 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit
  Cc: Aurelien Jarno, open list:SYSTEM RESET/SHUTDOWN DRIVERS,
	open list:RISC-V SPACEMIT SoC Support,
	open list:RISC-V SPACEMIT SoC Support

This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
commonly paired with the SpacemiT K1 SoC.

Note: For reliable operation, this driver depends on a this patch that adds
atomic transfer support to the SpacemiT I2C controller driver:
  https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/

Changes between version 4 and version 5:
- Change default to "MFD_SPACEMIT_P1"

Here is version 4 of this series:
  https://lore.kernel.org/spacemit/20251026224424.1891541-1-aurelien@aurel32.net/

Changes between version 3 and version 4:
- Replace the "select" by a "depends on"
- Remove outdated Reviewed-by

Here is version 3 of this series:
  https://lore.kernel.org/spacemit/20251021201451.1013640-1-aurelien@aurel32.net/

Changes between version 2 and version 3:
- Allow building as a module
- Remove outdated Acked-by and Tested-by
- Collect Reviewed-by

Here is version 2 of this series:
  https://lore.kernel.org/spacemit/20251019191519.3898095-1-aurelien@aurel32.net/

Changes between version 1 and version 2:
- Rebase onto v6.18-rc1
- Use dev_err_probe() to simplify the code
- Fix indentation of patch 1
- Collect Acked-by and Tested-by                                                                                                                                                                                                                                                                                                     
Here is version 1 of this series:
  https://lore.kernel.org/spacemit/20250927220824.1267318-1-aurelien@aurel32.net/ 


Aurelien Jarno (2):
  driver: reset: spacemit-p1: add driver for poweroff/reboot
  mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip

 drivers/mfd/simple-mfd-i2c.c             |  1 +
 drivers/power/reset/Kconfig              |  9 +++
 drivers/power/reset/Makefile             |  1 +
 drivers/power/reset/spacemit-p1-reboot.c | 88 ++++++++++++++++++++++++
 4 files changed, 99 insertions(+)
 create mode 100644 drivers/power/reset/spacemit-p1-reboot.c

-- 
2.47.2


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v5 1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-02 23:01 [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Aurelien Jarno
@ 2025-11-02 23:01 ` Aurelien Jarno
  2025-11-02 23:02 ` [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip Aurelien Jarno
  2025-11-03  0:48 ` (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Sebastian Reichel
  2 siblings, 0 replies; 25+ messages in thread
From: Aurelien Jarno @ 2025-11-02 23:01 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS
  Cc: Aurelien Jarno, open list:SYSTEM RESET/SHUTDOWN DRIVERS,
	open list:RISC-V SPACEMIT SoC Support,
	open list:RISC-V SPACEMIT SoC Support

This driver implements poweroff/reboot support for the SpacemiT P1 PMIC
chip, which is commonly paired with the SpacemiT K1 SoC.

The SpacemiT P1 support is implemented as a MFD driver, so the access is
done directly through the regmap interface. Reboot or poweroff is
triggered by setting a specific bit in a control register, which is
automatically cleared by the hardware afterwards.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
v5:
 - Change default to "MFD_SPACEMIT_P1"

 drivers/power/reset/Kconfig              |  9 +++
 drivers/power/reset/Makefile             |  1 +
 drivers/power/reset/spacemit-p1-reboot.c | 88 ++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
 create mode 100644 drivers/power/reset/spacemit-p1-reboot.c

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 8248895ca9038..f6c1bcbb57def 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -283,6 +283,15 @@ config POWER_RESET_KEYSTONE
 	help
 	  Reboot support for the KEYSTONE SoCs.
 
+config POWER_RESET_SPACEMIT_P1
+	tristate "SpacemiT P1 poweroff and reset driver"
+	depends on ARCH_SPACEMIT || COMPILE_TEST
+	depends on MFD_SPACEMIT_P1
+	default MFD_SPACEMIT_P1
+	help
+	  This driver supports power-off and reset operations for the SpacemiT
+	  P1 PMIC.
+
 config POWER_RESET_SYSCON
 	bool "Generic SYSCON regmap reset driver"
 	depends on OF
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 51da87e05ce76..0e4ae6f6b5c55 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o
 obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
 obj-$(CONFIG_POWER_RESET_REGULATOR) += regulator-poweroff.o
 obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
+obj-$(CONFIG_POWER_RESET_SPACEMIT_P1) += spacemit-p1-reboot.o
 obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
 obj-$(CONFIG_POWER_RESET_TH1520_AON) += th1520-aon-reboot.o
 obj-$(CONFIG_POWER_RESET_TORADEX_EC) += tdx-ec-poweroff.o
diff --git a/drivers/power/reset/spacemit-p1-reboot.c b/drivers/power/reset/spacemit-p1-reboot.c
new file mode 100644
index 0000000000000..9ec3d1fff8f3d
--- /dev/null
+++ b/drivers/power/reset/spacemit-p1-reboot.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 by Aurelien Jarno
+ */
+
+#include <linux/bits.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reboot.h>
+
+/* Power Control Register 2 */
+#define PWR_CTRL2		0x7e
+#define PWR_CTRL2_SHUTDOWN	BIT(2)	/* Shutdown request */
+#define PWR_CTRL2_RST		BIT(1)	/* Reset request */
+
+static int spacemit_p1_pwroff_handler(struct sys_off_data *data)
+{
+	struct regmap *regmap = data->cb_data;
+	int ret;
+
+	/* Put the PMIC into shutdown state */
+	ret = regmap_set_bits(regmap, PWR_CTRL2, PWR_CTRL2_SHUTDOWN);
+	if (ret) {
+		dev_err(data->dev, "shutdown failed: %d\n", ret);
+		return notifier_from_errno(ret);
+	}
+
+	return NOTIFY_DONE;
+}
+
+static int spacemit_p1_restart_handler(struct sys_off_data *data)
+{
+	struct regmap *regmap = data->cb_data;
+	int ret;
+
+	/* Put the PMIC into reset state */
+	ret = regmap_set_bits(regmap, PWR_CTRL2, PWR_CTRL2_RST);
+	if (ret) {
+		dev_err(data->dev, "restart failed: %d\n", ret);
+		return notifier_from_errno(ret);
+	}
+
+	return NOTIFY_DONE;
+}
+
+static int spacemit_p1_reboot_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct regmap *regmap;
+	int ret;
+
+	regmap = dev_get_regmap(dev->parent, NULL);
+	if (!regmap)
+		return -ENODEV;
+
+	ret = devm_register_power_off_handler(dev, &spacemit_p1_pwroff_handler,
+					      regmap);
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "Failed to register power off handler\n");
+
+	ret = devm_register_restart_handler(dev, spacemit_p1_restart_handler,
+					    regmap);
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "Failed to register restart handler\n");
+
+	return 0;
+}
+
+static const struct platform_device_id spacemit_p1_reboot_id_table[] = {
+	{ "spacemit-p1-reboot", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, spacemit_p1_reboot_id_table);
+
+static struct platform_driver spacemit_p1_reboot_driver = {
+	.driver = {
+		.name = "spacemit-p1-reboot",
+	},
+	.probe = spacemit_p1_reboot_probe,
+	.id_table = spacemit_p1_reboot_id_table,
+};
+module_platform_driver(spacemit_p1_reboot_driver);
+
+MODULE_DESCRIPTION("SpacemiT P1 reboot/poweroff driver");
+MODULE_LICENSE("GPL");
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2025-11-02 23:01 [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Aurelien Jarno
  2025-11-02 23:01 ` [PATCH v5 1/2] " Aurelien Jarno
@ 2025-11-02 23:02 ` Aurelien Jarno
  2026-02-26 14:32   ` Yanko Kaneti
  2025-11-03  0:48 ` (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Sebastian Reichel
  2 siblings, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2025-11-02 23:02 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit
  Cc: Aurelien Jarno, open list:SYSTEM RESET/SHUTDOWN DRIVERS,
	open list:RISC-V SPACEMIT SoC Support,
	open list:RISC-V SPACEMIT SoC Support

Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
v5: no changes

 drivers/mfd/simple-mfd-i2c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
index 0a607a1e3ca1d..542d378cdcd1f 100644
--- a/drivers/mfd/simple-mfd-i2c.c
+++ b/drivers/mfd/simple-mfd-i2c.c
@@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
 };
 
 static const struct mfd_cell spacemit_p1_cells[] = {
+	{ .name = "spacemit-p1-reboot", },
 	{ .name = "spacemit-p1-regulator", },
 	{ .name = "spacemit-p1-rtc", },
 };
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-02 23:01 [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Aurelien Jarno
  2025-11-02 23:01 ` [PATCH v5 1/2] " Aurelien Jarno
  2025-11-02 23:02 ` [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip Aurelien Jarno
@ 2025-11-03  0:48 ` Sebastian Reichel
  2025-11-04  1:24   ` Troy Mitchell
  2 siblings, 1 reply; 25+ messages in thread
From: Sebastian Reichel @ 2025-11-03  0:48 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, linux-riscv, spacemit, Aurelien Jarno
  Cc: linux-pm, linux-riscv, spacemit


On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> commonly paired with the SpacemiT K1 SoC.
> 
> Note: For reliable operation, this driver depends on a this patch that adds
> atomic transfer support to the SpacemiT I2C controller driver:
>   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> 
> [...]

Applied, thanks!

[1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
      commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-03  0:48 ` (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Sebastian Reichel
@ 2025-11-04  1:24   ` Troy Mitchell
  2025-11-05  9:34     ` Lee Jones
  2025-11-05  9:35     ` Lee Jones
  0 siblings, 2 replies; 25+ messages in thread
From: Troy Mitchell @ 2025-11-04  1:24 UTC (permalink / raw)
  To: Sebastian Reichel, linux-kernel, Lee Jones, Sebastian Reichel,
	Troy Mitchell, Yixun Lan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-riscv, spacemit, Aurelien Jarno
  Cc: linux-pm

On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> 
> On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > commonly paired with the SpacemiT K1 SoC.
> > 
> > Note: For reliable operation, this driver depends on a this patch that adds
> > atomic transfer support to the SpacemiT I2C controller driver:
> >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > 
> > [...]
> 
> Applied, thanks!
> 
> [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
>       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
Should we apply it now? The dependency patch hasn’t been merged yet...

                                       - Troy

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-04  1:24   ` Troy Mitchell
@ 2025-11-05  9:34     ` Lee Jones
  2025-11-05  9:42       ` Troy Mitchell
  2025-11-05  9:35     ` Lee Jones
  1 sibling, 1 reply; 25+ messages in thread
From: Lee Jones @ 2025-11-05  9:34 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Tue, 04 Nov 2025, Troy Mitchell wrote:

> On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > 
> > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > commonly paired with the SpacemiT K1 SoC.
> > > 
> > > Note: For reliable operation, this driver depends on a this patch that adds
> > > atomic transfer support to the SpacemiT I2C controller driver:
> > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > > 
> > > [...]
> > 
> > Applied, thanks!
> > 
> > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> Should we apply it now? The dependency patch hasn’t been merged yet...

What is the dependency?

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-04  1:24   ` Troy Mitchell
  2025-11-05  9:34     ` Lee Jones
@ 2025-11-05  9:35     ` Lee Jones
  2025-11-05  9:40       ` Troy Mitchell
  1 sibling, 1 reply; 25+ messages in thread
From: Lee Jones @ 2025-11-05  9:35 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Tue, 04 Nov 2025, Troy Mitchell wrote:

> On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > 
> > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > commonly paired with the SpacemiT K1 SoC.
> > > 
> > > Note: For reliable operation, this driver depends on a this patch that adds
> > > atomic transfer support to the SpacemiT I2C controller driver:
> > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > > 
> > > [...]
> > 
> > Applied, thanks!
> > 
> > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> Should we apply it now? The dependency patch hasn’t been merged yet...

And what is: ^[@kernel.org in your recipients list?

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05  9:35     ` Lee Jones
@ 2025-11-05  9:40       ` Troy Mitchell
  0 siblings, 0 replies; 25+ messages in thread
From: Troy Mitchell @ 2025-11-05  9:40 UTC (permalink / raw)
  To: Lee Jones, Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Wed, Nov 05, 2025 at 09:35:44AM +0000, Lee Jones wrote:
> On Tue, 04 Nov 2025, Troy Mitchell wrote:
> 
> > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > 
> > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > commonly paired with the SpacemiT K1 SoC.
> > > > 
> > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > > > 
> > > > [...]
> > > 
> > > Applied, thanks!
> > > 
> > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > Should we apply it now? The dependency patch hasn’t been merged yet...
> 
> And what is: ^[@kernel.org in your recipients list?
Might have accidentally messed up my email...

                      - Troy
> 
> -- 
> Lee Jones [李琼斯]
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05  9:34     ` Lee Jones
@ 2025-11-05  9:42       ` Troy Mitchell
  2025-11-05 10:08         ` Lee Jones
  2025-11-05 22:49         ` Aurelien Jarno
  0 siblings, 2 replies; 25+ messages in thread
From: Troy Mitchell @ 2025-11-05  9:42 UTC (permalink / raw)
  To: Lee Jones, Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> On Tue, 04 Nov 2025, Troy Mitchell wrote:
> 
> > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > 
> > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > commonly paired with the SpacemiT K1 SoC.
> > > > 
> > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dependency is here.
> > > > 
> > > > [...]
> > > 
> > > Applied, thanks!
> > > 
> > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > Should we apply it now? The dependency patch hasn’t been merged yet...
> 
> What is the dependency?
I point it out above.
Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.

                                  - Troy
> 
> -- 
> Lee Jones [李琼斯]
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05  9:42       ` Troy Mitchell
@ 2025-11-05 10:08         ` Lee Jones
  2025-11-05 10:11           ` Lee Jones
  2025-11-05 22:49         ` Aurelien Jarno
  1 sibling, 1 reply; 25+ messages in thread
From: Lee Jones @ 2025-11-05 10:08 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Wed, 05 Nov 2025, Troy Mitchell wrote:

> On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> > On Tue, 04 Nov 2025, Troy Mitchell wrote:
> > 
> > > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > > 
> > > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > > commonly paired with the SpacemiT K1 SoC.
> > > > > 
> > > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> dependency is here.
> > > > > 
> > > > > [...]
> > > > 
> > > > Applied, thanks!
> > > > 
> > > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > > Should we apply it now? The dependency patch hasn’t been merged yet...
> > 
> > What is the dependency?
> I point it out above.
> Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.

Okay, thanks.  I was mostly checking that you weren't referring to the
MFD patch, which doesn't represent a true dependency.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05 10:08         ` Lee Jones
@ 2025-11-05 10:11           ` Lee Jones
  2025-11-05 13:10             ` Troy Mitchell
  0 siblings, 1 reply; 25+ messages in thread
From: Lee Jones @ 2025-11-05 10:11 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Wed, 05 Nov 2025, Lee Jones wrote:

> On Wed, 05 Nov 2025, Troy Mitchell wrote:
> 
> > On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> > > On Tue, 04 Nov 2025, Troy Mitchell wrote:
> > > 
> > > > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > > > 
> > > > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > > > commonly paired with the SpacemiT K1 SoC.
> > > > > > 
> > > > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > dependency is here.
> > > > > > 
> > > > > > [...]
> > > > > 
> > > > > Applied, thanks!
> > > > > 
> > > > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > > > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > > > Should we apply it now? The dependency patch hasn’t been merged yet...
> > > 
> > > What is the dependency?
> > I point it out above.
> > Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.
> 
> Okay, thanks.  I was mostly checking that you weren't referring to the
> MFD patch, which doesn't represent a true dependency.

To save Sebastian some trouble, let's keep the reboot patch applied.

I'll hold off on the MFD one, which will ensure that reboot isn't probed.

Let me know when the dep is merged and I'll hoover up the rest of the set.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05 10:11           ` Lee Jones
@ 2025-11-05 13:10             ` Troy Mitchell
  0 siblings, 0 replies; 25+ messages in thread
From: Troy Mitchell @ 2025-11-05 13:10 UTC (permalink / raw)
  To: Lee Jones, Troy Mitchell
  Cc: Sebastian Reichel, linux-kernel, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, spacemit, Aurelien Jarno, linux-pm

On Wed, Nov 05, 2025 at 10:11:49AM +0000, Lee Jones wrote:
> On Wed, 05 Nov 2025, Lee Jones wrote:
> 
> > On Wed, 05 Nov 2025, Troy Mitchell wrote:
> > 
> > > On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> > > > On Tue, 04 Nov 2025, Troy Mitchell wrote:
> > > > 
> > > > > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > > > > 
> > > > > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > > > > commonly paired with the SpacemiT K1 SoC.
> > > > > > > 
> > > > > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > > > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > dependency is here.
> > > > > > > 
> > > > > > > [...]
> > > > > > 
> > > > > > Applied, thanks!
> > > > > > 
> > > > > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > > > > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > > > > Should we apply it now? The dependency patch hasn’t been merged yet...
> > > > 
> > > > What is the dependency?
> > > I point it out above.
> > > Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.
> > 
> > Okay, thanks.  I was mostly checking that you weren't referring to the
> > MFD patch, which doesn't represent a true dependency.
> 
> To save Sebastian some trouble, let's keep the reboot patch applied.
> 
> I'll hold off on the MFD one, which will ensure that reboot isn't probed.
> 
> Let me know when the dep is merged and I'll hoover up the rest of the set.
Okay. I'll reply this thread when the dependency is merged.

                            - Troy
> 
> -- 
> Lee Jones [李琼斯]
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05  9:42       ` Troy Mitchell
  2025-11-05 10:08         ` Lee Jones
@ 2025-11-05 22:49         ` Aurelien Jarno
  2025-11-06  1:03           ` Troy Mitchell
  1 sibling, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2025-11-05 22:49 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Lee Jones, Sebastian Reichel, linux-kernel, Sebastian Reichel,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, linux-riscv, spacemit, linux-pm

On 2025-11-05 17:42, Troy Mitchell wrote:
> On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> > On Tue, 04 Nov 2025, Troy Mitchell wrote:
> > 
> > > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > > 
> > > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > > commonly paired with the SpacemiT K1 SoC.
> > > > > 
> > > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> dependency is here.

Oh indeed, I have forgotten about this part.

> > > > > 
> > > > > [...]
> > > > 
> > > > Applied, thanks!
> > > > 
> > > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > > Should we apply it now? The dependency patch hasn’t been merged yet...
> > 
> > What is the dependency?
> I point it out above.
> Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.

Note however this is not a strong dependency, it is needed to make the 
reset or power off reliable. Calling non-atomic i2c_transfer lead to a 
successful reset or power off a bit more than half of the time.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
  2025-11-05 22:49         ` Aurelien Jarno
@ 2025-11-06  1:03           ` Troy Mitchell
  0 siblings, 0 replies; 25+ messages in thread
From: Troy Mitchell @ 2025-11-06  1:03 UTC (permalink / raw)
  To: Troy Mitchell, Lee Jones, Sebastian Reichel, linux-kernel,
	Sebastian Reichel, Yixun Lan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, linux-riscv, spacemit, linux-pm

On Wed, Nov 05, 2025 at 11:49:37PM +0100, Aurelien Jarno wrote:
> On 2025-11-05 17:42, Troy Mitchell wrote:
> > On Wed, Nov 05, 2025 at 09:34:21AM +0000, Lee Jones wrote:
> > > On Tue, 04 Nov 2025, Troy Mitchell wrote:
> > > 
> > > > On Mon, Nov 03, 2025 at 01:48:33AM +0100, Sebastian Reichel wrote:
> > > > > 
> > > > > On Mon, 03 Nov 2025 00:01:58 +0100, Aurelien Jarno wrote:
> > > > > > This adds poweroff/reboot support for the SpacemiT P1 PMIC chip, which is
> > > > > > commonly paired with the SpacemiT K1 SoC.
> > > > > > 
> > > > > > Note: For reliable operation, this driver depends on a this patch that adds
> > > > > > atomic transfer support to the SpacemiT I2C controller driver:
> > > > > >   https://lore.kernel.org/spacemit/20251009-k1-i2c-atomic-v4-1-a89367870286@linux.spacemit.com/
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > dependency is here.
> 
> Oh indeed, I have forgotten about this part.
> 
> > > > > > 
> > > > > > [...]
> > > > > 
> > > > > Applied, thanks!
> > > > > 
> > > > > [1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot
> > > > >       commit: 28124cc0fb8c7dc01a6834d227351e25d9a92c58
> > > > Should we apply it now? The dependency patch hasn’t been merged yet...
> > > 
> > > What is the dependency?
> > I point it out above.
> > Without this patch, reboot and shutdown would end up calling the non-atomic i2c_transfer.
> 
> Note however this is not a strong dependency, it is needed to make the 
> reset or power off reliable. Calling non-atomic i2c_transfer lead to a 
> successful reset or power off a bit more than half of the time.
Oh really? I never had success with the non-atomic transfer.

But however, as Lee pointed out, this patch doesn’t need to do
anything special now.
We only needs to ensure that the MFD part won’t be probed.

                          - Troy
> 
> Regards
> Aurelien
> 
> -- 
> Aurelien Jarno                          GPG: 4096R/1DDD8C9B
> aurelien@aurel32.net                     http://aurel32.net
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2025-11-02 23:02 ` [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip Aurelien Jarno
@ 2026-02-26 14:32   ` Yanko Kaneti
  2026-02-26 21:32     ` Aurelien Jarno
  0 siblings, 1 reply; 25+ messages in thread
From: Yanko Kaneti @ 2026-02-26 14:32 UTC (permalink / raw)
  To: Aurelien Jarno, linux-kernel, Lee Jones, Sebastian Reichel,
	Troy Mitchell, Yixun Lan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti,
	open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit
  Cc: open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hello,

On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
> v5: no changes
> 
>  drivers/mfd/simple-mfd-i2c.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> index 0a607a1e3ca1d..542d378cdcd1f 100644
> --- a/drivers/mfd/simple-mfd-i2c.c
> +++ b/drivers/mfd/simple-mfd-i2c.c
> @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
>  };
>  
>  static const struct mfd_cell spacemit_p1_cells[] = {
> +	{ .name = "spacemit-p1-reboot", },
>  	{ .name = "spacemit-p1-regulator", },
>  	{ .name = "spacemit-p1-rtc", },
>  };

Perhaps its safe to merge this one now that everything P1 and I2C is
already in linus tip ?

mainline + patch + dts bits enabling i2c8 on the OrangePi RV2 and R2S
allows both to soft reboot as expected.

-Yanko

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-02-26 14:32   ` Yanko Kaneti
@ 2026-02-26 21:32     ` Aurelien Jarno
  2026-02-27 11:29       ` Yanko Kaneti
  0 siblings, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2026-02-26 21:32 UTC (permalink / raw)
  To: Yanko Kaneti
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hi,

On 2026-02-26 16:32, Yanko Kaneti wrote:
> Hello,
> 
> On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > 
> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > ---
> > v5: no changes
> > 
> >  drivers/mfd/simple-mfd-i2c.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > --- a/drivers/mfd/simple-mfd-i2c.c
> > +++ b/drivers/mfd/simple-mfd-i2c.c
> > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> >  };
> >  
> >  static const struct mfd_cell spacemit_p1_cells[] = {
> > +	{ .name = "spacemit-p1-reboot", },
> >  	{ .name = "spacemit-p1-regulator", },
> >  	{ .name = "spacemit-p1-rtc", },
> >  };
> 
> Perhaps its safe to merge this one now that everything P1 and I2C is
> already in linus tip ?

Unfortunately, this patchset is still missing:
https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/

This means the reboots work most of the time, but are not 100% reliable, 
and that's the reason why this patch got blocked from merging.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-02-26 21:32     ` Aurelien Jarno
@ 2026-02-27 11:29       ` Yanko Kaneti
  2026-03-01 22:16         ` Aurelien Jarno
  0 siblings, 1 reply; 25+ messages in thread
From: Yanko Kaneti @ 2026-02-27 11:29 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> Hi,
> 
> On 2026-02-26 16:32, Yanko Kaneti wrote:
> > Hello,
> > 
> > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > 
> > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > ---
> > > v5: no changes
> > > 
> > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > >  };
> > >  
> > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > +	{ .name = "spacemit-p1-reboot", },
> > >  	{ .name = "spacemit-p1-regulator", },
> > >  	{ .name = "spacemit-p1-rtc", },
> > >  };
> > 
> > Perhaps its safe to merge this one now that everything P1 and I2C is
> > already in linus tip ?
> 
> Unfortunately, this patchset is still missing:
> https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> 
> This means the reboots work most of the time, but are not 100% reliable, 
> and that's the reason why this patch got blocked from merging.

I see. Thanks. Sounds to me like sometimes working compared to never
working is better , but anyway..

FWIW  with this patch and the pio patcheset I get this rcu splat on
reboot (which is still working). Similar splat is there without the pio
patcheset.

..
[   56.411363] systemd-shutdown[1]: Rebooting.
[   56.432988] reboot: Restarting system
[   56.434120] ------------[ cut here ]------------
[   56.438642] Voluntary context switch within RCU read-side critical section!
[   56.438665] WARNING: kernel/rcu/tree_plugin.h:332 at rcu_note_context_switch+0x370/0x510, CPU#0: systemd-shutdow/1
[   56.438693] Modules linked in: rfkill binfmt_misc vfat fat r8169 loop nfnetlink zram lz4hc_compress lz4_compress fuse
[   56.438733] CPU: 0 UID: 0 PID: 1 Comm: systemd-shutdow Not tainted 7.0.0-rc1+ #16 PREEMPT(full) 
[   56.438742] Hardware name: Unknown Unknown Product/Unknown Product, BIOS 2022.10ky-OpenWrt-r28427-6df0e3d02a 10/01/2022
[   56.438747] epc : rcu_note_context_switch+0x370/0x510
[   56.438757]  ra : rcu_note_context_switch+0x370/0x510
[   56.438764] epc : ffffffff801781b8 ra : ffffffff801781b8 sp : ffffffc6000432b0
[   56.438769]  gp : ffffffff83843a90 tp : ffffffd6048bdd00 t0 : ffffffff80036330
[   56.438774]  t1 : ffffffc600043080 t2 : 2d2d2d2d2d2d2d2d s0 : ffffffc600043330
[   56.438780]  s1 : ffffffd67eb15240 a0 : 000000000000003f a1 : ffffffff83559770
[   56.438784]  a2 : 0000000000000010 a3 : ffffffff83559b30 a4 : 0000000000000000
[   56.438789]  a5 : 0000000000000000 a6 : ffffffff83529700 a7 : ffffffff83559758
[   56.438793]  s2 : ffffffff83b55370 s3 : 0000000000000000 s4 : 0000000000000000
[   56.438798]  s5 : ffffffff83b55370 s6 : 0000000000000000 s7 : ffffffd605a1ccc0
[   56.438802]  s8 : 0000000000080009 s9 : 00000000fffc4890 s10: 0000000000000020
[   56.438806]  s11: ffffffff800b5160 t3 : 00000000ffffdfff t4 : 0000000000000001
[   56.438812]  t5 : 000000000000001f t6 : ffffffc600043098 ssp : 0000000000000000
[   56.438817] status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
[   56.438822] [<ffffffff801781b8>] rcu_note_context_switch+0x370/0x510
[   56.438832] [<ffffffff81285038>] __schedule+0x88/0x870
[   56.438844] [<ffffffff8128584e>] schedule+0x2e/0xa8
[   56.438851] [<ffffffff8128d9e4>] schedule_timeout+0x84/0x120
[   56.438860] [<ffffffff81286930>] wait_for_completion_timeout+0x78/0x148
[   56.438869] [<ffffffff80e30ab6>] spacemit_i2c_xfer_common+0x2d6/0x600
[   56.438881] [<ffffffff80e30e2a>] spacemit_i2c_xfer+0x1a/0x40
[   56.438887] [<ffffffff80e24d3a>] __i2c_transfer+0xf2/0x570
[   56.438896] [<ffffffff80e2520c>] i2c_transfer+0x54/0xc0
[   56.438903] [<ffffffff80c7fc02>] regmap_i2c_read+0x5a/0x98
[   56.438912] [<ffffffff80c791d4>] _regmap_raw_read+0xbc/0x380
[   56.438922] [<ffffffff80c794d0>] _regmap_bus_read+0x38/0x70
[   56.438930] [<ffffffff80c7776e>] _regmap_read+0x4e/0x1e0
[   56.438938] [<ffffffff80c7821c>] _regmap_update_bits+0xac/0xe8
[   56.438945] [<ffffffff80c79d04>] regmap_update_bits_base+0x5c/0x80
[   56.438953] [<ffffffff80e3ec1c>] spacemit_p1_restart_handler+0x2c/0x70
[   56.438963] [<ffffffff800b519a>] sys_off_notify+0x3a/0x60
[   56.438973] [<ffffffff800b3450>] notifier_call_chain+0x68/0x1a8
[   56.438980] [<ffffffff800b36c6>] atomic_notifier_call_chain+0x3e/0x60
[   56.438986] [<ffffffff800b5fb2>] do_kernel_restart+0x2a/0x40
[   56.438993] [<ffffffff80028b80>] machine_restart+0x18/0x28
[   56.439005] [<ffffffff800b618a>] kernel_restart+0x92/0xb8
[   56.439013] [<ffffffff800b64f2>] __do_sys_reboot+0x13a/0x238
[   56.439021] [<ffffffff800b671a>] __riscv_sys_reboot+0x22/0x38
[   56.439028] [<ffffffff8127ecfe>] do_trap_ecall_u+0x176/0x608
[   56.439036] [<ffffffff812926ec>] handle_exception+0x16c/0x178
[   56.439049] ---[ end tracsys: 0x0

Regards
Yanko

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-02-27 11:29       ` Yanko Kaneti
@ 2026-03-01 22:16         ` Aurelien Jarno
  2026-03-02 20:08           ` Aurelien Jarno
  0 siblings, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2026-03-01 22:16 UTC (permalink / raw)
  To: Yanko Kaneti
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

On 2026-02-27 13:29, Yanko Kaneti wrote:
> On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> > Hi,
> > 
> > On 2026-02-26 16:32, Yanko Kaneti wrote:
> > > Hello,
> > > 
> > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > > 
> > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > > ---
> > > > v5: no changes
> > > > 
> > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > > >  };
> > > >  
> > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > > +	{ .name = "spacemit-p1-reboot", },
> > > >  	{ .name = "spacemit-p1-regulator", },
> > > >  	{ .name = "spacemit-p1-rtc", },
> > > >  };
> > > 
> > > Perhaps its safe to merge this one now that everything P1 and I2C is
> > > already in linus tip ?
> > 
> > Unfortunately, this patchset is still missing:
> > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> > 
> > This means the reboots work most of the time, but are not 100% reliable, 
> > and that's the reason why this patch got blocked from merging.
> 
> I see. Thanks. Sounds to me like sometimes working compared to never
> working is better , but anyway..

I agree with that, but the decision was to hold on this patch until the 
I2C PIO part got merged.

> FWIW  with this patch and the pio patcheset I get this rcu splat on
> reboot (which is still working). Similar splat is there without the pio
> patcheset.

I haven't been able to reproduce the issue here after 10+ reboots on a 
BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
7.0.0-rc2 kernel and report back.

At a first glance the problem seems to happen in the I2C PIO code. On 
which hardware is that happening?

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-01 22:16         ` Aurelien Jarno
@ 2026-03-02 20:08           ` Aurelien Jarno
  2026-03-02 20:34             ` Yanko Kaneti
  0 siblings, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2026-03-02 20:08 UTC (permalink / raw)
  To: Yanko Kaneti, linux-kernel, Lee Jones, Sebastian Reichel,
	Troy Mitchell, Yixun Lan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti,
	open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hi,

On 2026-03-01 23:16, Aurelien Jarno wrote:
> On 2026-02-27 13:29, Yanko Kaneti wrote:
> > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> > > Hi,
> > > 
> > > On 2026-02-26 16:32, Yanko Kaneti wrote:
> > > > Hello,
> > > > 
> > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > > > 
> > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > > > ---
> > > > > v5: no changes
> > > > > 
> > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > > 
> > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > > > >  };
> > > > >  
> > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > > > +	{ .name = "spacemit-p1-reboot", },
> > > > >  	{ .name = "spacemit-p1-regulator", },
> > > > >  	{ .name = "spacemit-p1-rtc", },
> > > > >  };
> > > > 
> > > > Perhaps its safe to merge this one now that everything P1 and I2C is
> > > > already in linus tip ?
> > > 
> > > Unfortunately, this patchset is still missing:
> > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> > > 
> > > This means the reboots work most of the time, but are not 100% reliable, 
> > > and that's the reason why this patch got blocked from merging.
> > 
> > I see. Thanks. Sounds to me like sometimes working compared to never
> > working is better , but anyway..
> 
> I agree with that, but the decision was to hold on this patch until the 
> I2C PIO part got merged.
> 
> > FWIW  with this patch and the pio patcheset I get this rcu splat on
> > reboot (which is still working). Similar splat is there without the pio
> > patcheset.
> 
> I haven't been able to reproduce the issue here after 10+ reboots on a 
> BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
> 7.0.0-rc2 kernel and report back.

I have tried that, and I am still unable to reproduce the issue with a 
7.0.0-rc2 kernel and a BPI-F3 board.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-02 20:08           ` Aurelien Jarno
@ 2026-03-02 20:34             ` Yanko Kaneti
  2026-03-03 20:38               ` Aurelien Jarno
  0 siblings, 1 reply; 25+ messages in thread
From: Yanko Kaneti @ 2026-03-02 20:34 UTC (permalink / raw)
  To: Aurelien Jarno, linux-kernel, Lee Jones, Sebastian Reichel,
	Troy Mitchell, Yixun Lan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti,
	open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hello,

On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
> On 2026-03-01 23:16, Aurelien Jarno wrote:
> > On 2026-02-27 13:29, Yanko Kaneti wrote:
> > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> > > > Hi,
> > > > 
> > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
> > > > > Hello,
> > > > > 
> > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > > > > 
> > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > > > > ---
> > > > > > v5: no changes
> > > > > > 
> > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > > > > >  1 file changed, 1 insertion(+)
> > > > > > 
> > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > > > > >  };
> > > > > >  
> > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > > > > +	{ .name = "spacemit-p1-reboot", },
> > > > > >  	{ .name = "spacemit-p1-regulator", },
> > > > > >  	{ .name = "spacemit-p1-rtc", },
> > > > > >  };
> > > > > 
> > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
> > > > > already in linus tip ?
> > > > 
> > > > Unfortunately, this patchset is still missing:
> > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> > > > 
> > > > This means the reboots work most of the time, but are not 100% reliable, 
> > > > and that's the reason why this patch got blocked from merging.
> > > 
> > > I see. Thanks. Sounds to me like sometimes working compared to never
> > > working is better , but anyway..
> > 
> > I agree with that, but the decision was to hold on this patch until the 
> > I2C PIO part got merged.
> > 
> > > FWIW  with this patch and the pio patcheset I get this rcu splat on
> > > reboot (which is still working). Similar splat is there without the pio
> > > patcheset.
> > 
> > I haven't been able to reproduce the issue here after 10+ reboots on a 
> > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
> > 7.0.0-rc2 kernel and report back.
> 
> I have tried that, and I am still unable to reproduce the issue with a 
> 7.0.0-rc2 kernel and a BPI-F3 board.

I can still see it on every reboot (with the patches that allow reboot
to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
that flips it.

Regards
Yanko


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-02 20:34             ` Yanko Kaneti
@ 2026-03-03 20:38               ` Aurelien Jarno
  2026-03-11  2:58                 ` Troy Mitchell
  0 siblings, 1 reply; 25+ messages in thread
From: Aurelien Jarno @ 2026-03-03 20:38 UTC (permalink / raw)
  To: Yanko Kaneti
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hi,

On 2026-03-02 22:34, Yanko Kaneti wrote:
> Hello,
> 
> On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
> > On 2026-03-01 23:16, Aurelien Jarno wrote:
> > > On 2026-02-27 13:29, Yanko Kaneti wrote:
> > > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> > > > > Hi,
> > > > > 
> > > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
> > > > > > Hello,
> > > > > > 
> > > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > > > > > 
> > > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > > > > > ---
> > > > > > > v5: no changes
> > > > > > > 
> > > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > > > > > >  1 file changed, 1 insertion(+)
> > > > > > > 
> > > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > > > > > >  };
> > > > > > >  
> > > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > > > > > +	{ .name = "spacemit-p1-reboot", },
> > > > > > >  	{ .name = "spacemit-p1-regulator", },
> > > > > > >  	{ .name = "spacemit-p1-rtc", },
> > > > > > >  };
> > > > > > 
> > > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
> > > > > > already in linus tip ?
> > > > > 
> > > > > Unfortunately, this patchset is still missing:
> > > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> > > > > 
> > > > > This means the reboots work most of the time, but are not 100% reliable, 
> > > > > and that's the reason why this patch got blocked from merging.
> > > > 
> > > > I see. Thanks. Sounds to me like sometimes working compared to never
> > > > working is better , but anyway..
> > > 
> > > I agree with that, but the decision was to hold on this patch until the 
> > > I2C PIO part got merged.
> > > 
> > > > FWIW  with this patch and the pio patcheset I get this rcu splat on
> > > > reboot (which is still working). Similar splat is there without the pio
> > > > patcheset.
> > > 
> > > I haven't been able to reproduce the issue here after 10+ reboots on a 
> > > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
> > > 7.0.0-rc2 kernel and report back.
> > 
> > I have tried that, and I am still unable to reproduce the issue with a 
> > 7.0.0-rc2 kernel and a BPI-F3 board.
> 
> I can still see it on every reboot (with the patches that allow reboot
> to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
> when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
> that flips it.

Thanks for the hint, that option was not activated here, it's not the 
riscv64 defconfig. With it I am also able to reproduce the issue. I'll 
try to debug that and report back.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-03 20:38               ` Aurelien Jarno
@ 2026-03-11  2:58                 ` Troy Mitchell
  2026-03-11  6:46                   ` Aurelien Jarno
  2026-03-11  7:08                   ` Yanko Kaneti
  0 siblings, 2 replies; 25+ messages in thread
From: Troy Mitchell @ 2026-03-11  2:58 UTC (permalink / raw)
  To: Aurelien Jarno, Yanko Kaneti
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Troy Mitchell,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

On Wed Mar 4, 2026 at 4:38 AM CST, Aurelien Jarno wrote:
 Hi, Aurelien and Yanko,
> Hi,
>
> On 2026-03-02 22:34, Yanko Kaneti wrote:
>> Hello,
>> 
>> On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
>> > On 2026-03-01 23:16, Aurelien Jarno wrote:
>> > > On 2026-02-27 13:29, Yanko Kaneti wrote:
>> > > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
>> > > > > Hi,
>> > > > > 
>> > > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
>> > > > > > Hello,
>> > > > > > 
>> > > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
>> > > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
>> > > > > > > 
>> > > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> > > > > > > ---
>> > > > > > > v5: no changes
>> > > > > > > 
>> > > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
>> > > > > > >  1 file changed, 1 insertion(+)
>> > > > > > > 
>> > > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
>> > > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
>> > > > > > >  };
>> > > > > > >  
>> > > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
>> > > > > > > +	{ .name = "spacemit-p1-reboot", },
>> > > > > > >  	{ .name = "spacemit-p1-regulator", },
>> > > > > > >  	{ .name = "spacemit-p1-rtc", },
>> > > > > > >  };
>> > > > > > 
>> > > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
>> > > > > > already in linus tip ?
>> > > > > 
>> > > > > Unfortunately, this patchset is still missing:
>> > > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
>> > > > > 
>> > > > > This means the reboots work most of the time, but are not 100% reliable, 
>> > > > > and that's the reason why this patch got blocked from merging.
>> > > > 
>> > > > I see. Thanks. Sounds to me like sometimes working compared to never
>> > > > working is better , but anyway..
>> > > 
>> > > I agree with that, but the decision was to hold on this patch until the 
>> > > I2C PIO part got merged.
>> > > 
>> > > > FWIW  with this patch and the pio patcheset I get this rcu splat on
>> > > > reboot (which is still working). Similar splat is there without the pio
>> > > > patcheset.
>> > > 
>> > > I haven't been able to reproduce the issue here after 10+ reboots on a 
>> > > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
>> > > 7.0.0-rc2 kernel and report back.
>> > 
>> > I have tried that, and I am still unable to reproduce the issue with a 
>> > 7.0.0-rc2 kernel and a BPI-F3 board.
>> 
>> I can still see it on every reboot (with the patches that allow reboot
>> to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
>> when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
>> that flips it.
>
> Thanks for the hint, that option was not activated here, it's not the 
> riscv64 defconfig. With it I am also able to reproduce the issue. I'll 
> try to debug that and report back.
I have sent a patch to address this issue here[1].

Could you please test it on your hardware when you have a chance?

                        - Troy

Link:
https://lore.kernel.org/all/20260311-v7-0-rc1-rv-dis-int-before-restart-v1-1-bc46b4351cac@linux.dev/ [1]

>
> Regards
> Aurelien


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-11  2:58                 ` Troy Mitchell
@ 2026-03-11  6:46                   ` Aurelien Jarno
  2026-03-11  7:08                   ` Yanko Kaneti
  1 sibling, 0 replies; 25+ messages in thread
From: Aurelien Jarno @ 2026-03-11  6:46 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: Yanko Kaneti, linux-kernel, Lee Jones, Sebastian Reichel,
	Yixun Lan, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

Hi,

On 2026-03-11 10:58, Troy Mitchell wrote:
> On Wed Mar 4, 2026 at 4:38 AM CST, Aurelien Jarno wrote:
>  Hi, Aurelien and Yanko,
> > Hi,
> >
> > On 2026-03-02 22:34, Yanko Kaneti wrote:
> >> Hello,
> >> 
> >> On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
> >> > On 2026-03-01 23:16, Aurelien Jarno wrote:
> >> > > On 2026-02-27 13:29, Yanko Kaneti wrote:
> >> > > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> >> > > > > Hi,
> >> > > > > 
> >> > > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
> >> > > > > > Hello,
> >> > > > > > 
> >> > > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> >> > > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> >> > > > > > > 
> >> > > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> >> > > > > > > ---
> >> > > > > > > v5: no changes
> >> > > > > > > 
> >> > > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> >> > > > > > >  1 file changed, 1 insertion(+)
> >> > > > > > > 
> >> > > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> >> > > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> >> > > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
> >> > > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> >> > > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> >> > > > > > >  };
> >> > > > > > >  
> >> > > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> >> > > > > > > +	{ .name = "spacemit-p1-reboot", },
> >> > > > > > >  	{ .name = "spacemit-p1-regulator", },
> >> > > > > > >  	{ .name = "spacemit-p1-rtc", },
> >> > > > > > >  };
> >> > > > > > 
> >> > > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
> >> > > > > > already in linus tip ?
> >> > > > > 
> >> > > > > Unfortunately, this patchset is still missing:
> >> > > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> >> > > > > 
> >> > > > > This means the reboots work most of the time, but are not 100% reliable, 
> >> > > > > and that's the reason why this patch got blocked from merging.
> >> > > > 
> >> > > > I see. Thanks. Sounds to me like sometimes working compared to never
> >> > > > working is better , but anyway..
> >> > > 
> >> > > I agree with that, but the decision was to hold on this patch until the 
> >> > > I2C PIO part got merged.
> >> > > 
> >> > > > FWIW  with this patch and the pio patcheset I get this rcu splat on
> >> > > > reboot (which is still working). Similar splat is there without the pio
> >> > > > patcheset.
> >> > > 
> >> > > I haven't been able to reproduce the issue here after 10+ reboots on a 
> >> > > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
> >> > > 7.0.0-rc2 kernel and report back.
> >> > 
> >> > I have tried that, and I am still unable to reproduce the issue with a 
> >> > 7.0.0-rc2 kernel and a BPI-F3 board.
> >> 
> >> I can still see it on every reboot (with the patches that allow reboot
> >> to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
> >> when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
> >> that flips it.
> >
> > Thanks for the hint, that option was not activated here, it's not the 
> > riscv64 defconfig. With it I am also able to reproduce the issue. I'll 
> > try to debug that and report back.
> I have sent a patch to address this issue here[1].
> 
> Could you please test it on your hardware when you have a chance?
> 
>                         - Troy
> 
> Link:
> https://lore.kernel.org/all/20260311-v7-0-rc1-rv-dis-int-before-restart-v1-1-bc46b4351cac@linux.dev/ [1]

Thanks, I confirm it fixes the issue \o/.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-11  2:58                 ` Troy Mitchell
  2026-03-11  6:46                   ` Aurelien Jarno
@ 2026-03-11  7:08                   ` Yanko Kaneti
  2026-03-11  7:48                     ` Troy Mitchell
  1 sibling, 1 reply; 25+ messages in thread
From: Yanko Kaneti @ 2026-03-11  7:08 UTC (permalink / raw)
  To: Troy Mitchell, Aurelien Jarno
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

On Wed, 2026-03-11 at 10:58 +0800, Troy Mitchell wrote:
> On Wed Mar 4, 2026 at 4:38 AM CST, Aurelien Jarno wrote:
>  Hi, Aurelien and Yanko,
> > Hi,
> > 
> > On 2026-03-02 22:34, Yanko Kaneti wrote:
> > > Hello,
> > > 
> > > On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
> > > > On 2026-03-01 23:16, Aurelien Jarno wrote:
> > > > > On 2026-02-27 13:29, Yanko Kaneti wrote:
> > > > > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
> > > > > > > Hi,
> > > > > > > 
> > > > > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
> > > > > > > > Hello,
> > > > > > > > 
> > > > > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
> > > > > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> > > > > > > > > ---
> > > > > > > > > v5: no changes
> > > > > > > > > 
> > > > > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
> > > > > > > > >  1 file changed, 1 insertion(+)
> > > > > > > > > 
> > > > > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> > > > > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
> > > > > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
> > > > > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
> > > > > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
> > > > > > > > >  };
> > > > > > > > >  
> > > > > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
> > > > > > > > > +	{ .name = "spacemit-p1-reboot", },
> > > > > > > > >  	{ .name = "spacemit-p1-regulator", },
> > > > > > > > >  	{ .name = "spacemit-p1-rtc", },
> > > > > > > > >  };
> > > > > > > > 
> > > > > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
> > > > > > > > already in linus tip ?
> > > > > > > 
> > > > > > > Unfortunately, this patchset is still missing:
> > > > > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
> > > > > > > 
> > > > > > > This means the reboots work most of the time, but are not 100% reliable, 
> > > > > > > and that's the reason why this patch got blocked from merging.
> > > > > > 
> > > > > > I see. Thanks. Sounds to me like sometimes working compared to never
> > > > > > working is better , but anyway..
> > > > > 
> > > > > I agree with that, but the decision was to hold on this patch until the 
> > > > > I2C PIO part got merged.
> > > > > 
> > > > > > FWIW  with this patch and the pio patcheset I get this rcu splat on
> > > > > > reboot (which is still working). Similar splat is there without the pio
> > > > > > patcheset.
> > > > > 
> > > > > I haven't been able to reproduce the issue here after 10+ reboots on a 
> > > > > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
> > > > > 7.0.0-rc2 kernel and report back.
> > > > 
> > > > I have tried that, and I am still unable to reproduce the issue with a 
> > > > 7.0.0-rc2 kernel and a BPI-F3 board.
> > > 
> > > I can still see it on every reboot (with the patches that allow reboot
> > > to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
> > > when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
> > > that flips it.
> > 
> > Thanks for the hint, that option was not activated here, it's not the 
> > riscv64 defconfig. With it I am also able to reproduce the issue. I'll 
> > try to debug that and report back.
> I have sent a patch to address this issue here[1].
> 
> Could you please test it on your hardware when you have a chance?
> 
>                         - Troy
> 
> Link:
> https://lore.kernel.org/all/20260311-v7-0-rc1-rv-dis-int-before-restart-v1-1-bc46b4351cac@linux.dev/ [1]

Thanks Troy. Seem to fix the issue here.
No splat and reboot still works OK on the R2S

- Yanko

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip
  2026-03-11  7:08                   ` Yanko Kaneti
@ 2026-03-11  7:48                     ` Troy Mitchell
  0 siblings, 0 replies; 25+ messages in thread
From: Troy Mitchell @ 2026-03-11  7:48 UTC (permalink / raw)
  To: Yanko Kaneti, Troy Mitchell, Aurelien Jarno
  Cc: linux-kernel, Lee Jones, Sebastian Reichel, Yixun Lan,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	open list:RISC-V ARCHITECTURE:Keyword:riscv,
	open list:RISC-V SPACEMIT SoC Support:Keyword:spacemit,
	open list:SYSTEM RESET/SHUTDOWN DRIVERS

On Wed Mar 11, 2026 at 3:08 PM CST, Yanko Kaneti wrote:
> On Wed, 2026-03-11 at 10:58 +0800, Troy Mitchell wrote:
>> On Wed Mar 4, 2026 at 4:38 AM CST, Aurelien Jarno wrote:
>>  Hi, Aurelien and Yanko,
>> > Hi,
>> > 
>> > On 2026-03-02 22:34, Yanko Kaneti wrote:
>> > > Hello,
>> > > 
>> > > On Mon, 2026-03-02 at 21:08 +0100, Aurelien Jarno wrote:
>> > > > On 2026-03-01 23:16, Aurelien Jarno wrote:
>> > > > > On 2026-02-27 13:29, Yanko Kaneti wrote:
>> > > > > > On Thu, 2026-02-26 at 22:32 +0100, Aurelien Jarno wrote:
>> > > > > > > Hi,
>> > > > > > > 
>> > > > > > > On 2026-02-26 16:32, Yanko Kaneti wrote:
>> > > > > > > > Hello,
>> > > > > > > > 
>> > > > > > > > On Mon, 2025-11-03 at 00:02 +0100, Aurelien Jarno wrote:
>> > > > > > > > > Add a "spacemit-p1-reboot" cell for the SpacemiT P1 chip.
>> > > > > > > > > 
>> > > > > > > > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> > > > > > > > > ---
>> > > > > > > > > v5: no changes
>> > > > > > > > > 
>> > > > > > > > >  drivers/mfd/simple-mfd-i2c.c | 1 +
>> > > > > > > > >  1 file changed, 1 insertion(+)
>> > > > > > > > > 
>> > > > > > > > > diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > > > index 0a607a1e3ca1d..542d378cdcd1f 100644
>> > > > > > > > > --- a/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > > > +++ b/drivers/mfd/simple-mfd-i2c.c
>> > > > > > > > > @@ -99,6 +99,7 @@ static const struct regmap_config spacemit_p1_regmap_config = {
>> > > > > > > > >  };
>> > > > > > > > >  
>> > > > > > > > >  static const struct mfd_cell spacemit_p1_cells[] = {
>> > > > > > > > > +	{ .name = "spacemit-p1-reboot", },
>> > > > > > > > >  	{ .name = "spacemit-p1-regulator", },
>> > > > > > > > >  	{ .name = "spacemit-p1-rtc", },
>> > > > > > > > >  };
>> > > > > > > > 
>> > > > > > > > Perhaps its safe to merge this one now that everything P1 and I2C is
>> > > > > > > > already in linus tip ?
>> > > > > > > 
>> > > > > > > Unfortunately, this patchset is still missing:
>> > > > > > > https://lore.kernel.org/all/20260207-b4-k3-i2c-pio-v7-0-626942d94d91@linux.spacemit.com/
>> > > > > > > 
>> > > > > > > This means the reboots work most of the time, but are not 100% reliable, 
>> > > > > > > and that's the reason why this patch got blocked from merging.
>> > > > > > 
>> > > > > > I see. Thanks. Sounds to me like sometimes working compared to never
>> > > > > > working is better , but anyway..
>> > > > > 
>> > > > > I agree with that, but the decision was to hold on this patch until the 
>> > > > > I2C PIO part got merged.
>> > > > > 
>> > > > > > FWIW  with this patch and the pio patcheset I get this rcu splat on
>> > > > > > reboot (which is still working). Similar splat is there without the pio
>> > > > > > patcheset.
>> > > > > 
>> > > > > I haven't been able to reproduce the issue here after 10+ reboots on a 
>> > > > > BPI-F3 board, but I tried the patch on top of 6.19. I'll try to build a 
>> > > > > 7.0.0-rc2 kernel and report back.
>> > > > 
>> > > > I have tried that, and I am still unable to reproduce the issue with a 
>> > > > 7.0.0-rc2 kernel and a BPI-F3 board.
>> > > 
>> > > I can still see it on every reboot (with the patches that allow reboot
>> > > to work). Do you have CONFIG_PREEMPT_RCU in your config ? its default on
>> > > when anything PREEMPT is selected. In Fedora its CONFIG_PREEMPT_DYNAMIC
>> > > that flips it.
>> > 
>> > Thanks for the hint, that option was not activated here, it's not the 
>> > riscv64 defconfig. With it I am also able to reproduce the issue. I'll 
>> > try to debug that and report back.
>> I have sent a patch to address this issue here[1].
>> 
>> Could you please test it on your hardware when you have a chance?
>> 
>>                         - Troy
>> 
>> Link:
>> https://lore.kernel.org/all/20260311-v7-0-rc1-rv-dis-int-before-restart-v1-1-bc46b4351cac@linux.dev/ [1]
>
> Thanks Troy. Seem to fix the issue here.
> No splat and reboot still works OK on the R2S
Thank you and Aurelien for the test.

To be honest, I'm still not entirely sure if this is the right fix.
I’m curious why RISC-V doesn't disable interrupts during this task,
as ARM and PowerPC do.

I've sent this out with an RFC prefix and am looking forward to getting
some feedback from the community.

                                            - Troy
>
> - Yanko


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-03-11  7:51 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02 23:01 [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Aurelien Jarno
2025-11-02 23:01 ` [PATCH v5 1/2] " Aurelien Jarno
2025-11-02 23:02 ` [PATCH v5 2/2] mfd: simple-mfd-i2c: add a reboot cell for the SpacemiT P1 chip Aurelien Jarno
2026-02-26 14:32   ` Yanko Kaneti
2026-02-26 21:32     ` Aurelien Jarno
2026-02-27 11:29       ` Yanko Kaneti
2026-03-01 22:16         ` Aurelien Jarno
2026-03-02 20:08           ` Aurelien Jarno
2026-03-02 20:34             ` Yanko Kaneti
2026-03-03 20:38               ` Aurelien Jarno
2026-03-11  2:58                 ` Troy Mitchell
2026-03-11  6:46                   ` Aurelien Jarno
2026-03-11  7:08                   ` Yanko Kaneti
2026-03-11  7:48                     ` Troy Mitchell
2025-11-03  0:48 ` (subset) [PATCH v5 0/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Sebastian Reichel
2025-11-04  1:24   ` Troy Mitchell
2025-11-05  9:34     ` Lee Jones
2025-11-05  9:42       ` Troy Mitchell
2025-11-05 10:08         ` Lee Jones
2025-11-05 10:11           ` Lee Jones
2025-11-05 13:10             ` Troy Mitchell
2025-11-05 22:49         ` Aurelien Jarno
2025-11-06  1:03           ` Troy Mitchell
2025-11-05  9:35     ` Lee Jones
2025-11-05  9:40       ` Troy Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox