Skip to contentSkip to conversation

MIPS: qemu-malta: use generic syscon reset driver

PATCH Applied Antony Pavlov 2 participants 3 messages Apr 25, 2021 – May 3, 2021 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: qemu-malta: use generic syscon reset driver

---
 arch/mips/configs/qemu-malta_defconfig |  2 ++
 arch/mips/dts/qemu-malta.dts           | 13 +++++++++++
 arch/mips/mach-malta/Makefile          |  1 -
 arch/mips/mach-malta/reset.c           | 31 --------------------------
 4 files changed, 15 insertions(+), 32 deletions(-)
arch/mips/configs/qemu-malta_defconfig +2 -0
index b9994f392c..ab3abb7a2a 100644
@@ -75,6 +75,8 @@ CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_GPIO_MALTA_FPGA_I2C=y
 CONFIG_PCI=y
 CONFIG_PCI_DEBUG=y
+CONFIG_SYSCON_REBOOT_MODE=y
+CONFIG_POWER_RESET_SYSCON=y
 CONFIG_FS_CRAMFS=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
arch/mips/dts/qemu-malta.dts +13 -0
index 32e473cac0..2d6f4a0ca3 100644
@@ -27,6 +27,19 @@
 		clock-frequency = <1843200>;
 	};
 
+	fpga_regs: system-controller@1f000000 {
+		compatible = "mti,malta-fpga", "syscon", "simple-mfd";
+		reg = <0x1f000000 0x600>;
+		native-endian;
+
+		reboot {
+			compatible = "syscon-reboot";
+			regmap = <&fpga_regs>;
+			offset = <0x500>;
+			mask = <0x42>;
+		};
+	};
+
 	gpio: gpio@1f000b00 {
 		compatible = "mti,malta-fpga-i2c-gpio";
 		gpio-controller;
arch/mips/mach-malta/Makefile +0 -1
index 0c5a7018d4..7d56f215b0 100644
@@ -1,2 +1 @@
-obj-y += reset.o
 obj-$(CONFIG_PCI) += pci.o
arch/mips/mach-malta/reset.c deleted +0 -31
deleted file mode 100644
index ad0de2741b..0000000000
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Antony Pavlov <[email protected]>
- */
-
-/**
- * @file
- * @brief Resetting an malta board
- */
-
-#include <common.h>
-#include <io.h>
-#include <init.h>
-#include <restart.h>
-#include <mach/hardware.h>
-
-static void __noreturn malta_restart_soc(struct restart_handler *rst)
-{
-	__raw_writel(GORESET, (char *)SOFTRES_REG);
-
-	hang();
-	/*NOTREACHED*/
-}
-
-static int restart_register_feature(void)
-{
-	restart_handler_register_fn("soc", malta_restart_soc);
-
-	return 0;
-}
-coredevice_initcall(restart_register_feature);
Signature · 7 lines
2.31.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

On Sun, 25 Apr 2021 09:35:17 +0300
Antony Pavlov <[email protected]> wrote:

ping

Quoted 92 lines
---
 arch/mips/configs/qemu-malta_defconfig |  2 ++
 arch/mips/dts/qemu-malta.dts           | 13 +++++++++++
 arch/mips/mach-malta/Makefile          |  1 -
 arch/mips/mach-malta/reset.c           | 31 --------------------------
 4 files changed, 15 insertions(+), 32 deletions(-)
arch/mips/configs/qemu-malta_defconfig +2 -0
index b9994f392c..ab3abb7a2a 100644
@@ -75,6 +75,8 @@ CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_GPIO_MALTA_FPGA_I2C=y
 CONFIG_PCI=y
 CONFIG_PCI_DEBUG=y
+CONFIG_SYSCON_REBOOT_MODE=y
+CONFIG_POWER_RESET_SYSCON=y
 CONFIG_FS_CRAMFS=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
arch/mips/dts/qemu-malta.dts +13 -0
index 32e473cac0..2d6f4a0ca3 100644
@@ -27,6 +27,19 @@
 		clock-frequency = <1843200>;
 	};
 
+	fpga_regs: system-controller@1f000000 {
+		compatible = "mti,malta-fpga", "syscon", "simple-mfd";
+		reg = <0x1f000000 0x600>;
+		native-endian;
+
+		reboot {
+			compatible = "syscon-reboot";
+			regmap = <&fpga_regs>;
+			offset = <0x500>;
+			mask = <0x42>;
+		};
+	};
+
 	gpio: gpio@1f000b00 {
 		compatible = "mti,malta-fpga-i2c-gpio";
 		gpio-controller;
arch/mips/mach-malta/Makefile +0 -1
index 0c5a7018d4..7d56f215b0 100644
@@ -1,2 +1 @@
-obj-y += reset.o
 obj-$(CONFIG_PCI) += pci.o
arch/mips/mach-malta/reset.c deleted +0 -31
deleted file mode 100644
index ad0de2741b..0000000000
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Antony Pavlov <[email protected]>
- */
-
-/**
- * @file
- * @brief Resetting an malta board
- */
-
-#include <common.h>
-#include <io.h>
-#include <init.h>
-#include <restart.h>
-#include <mach/hardware.h>
-
-static void __noreturn malta_restart_soc(struct restart_handler *rst)
-{
-	__raw_writel(GORESET, (char *)SOFTRES_REG);
-
-	hang();
-	/*NOTREACHED*/
-}
-
-static int restart_register_feature(void)
-{
-	restart_handler_register_fn("soc", malta_restart_soc);
-
-	return 0;
-}
-coredevice_initcall(restart_register_feature);
Signature · 1 line
2.31.1
Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Antony Pavlov
Quoted 7 lines · Antony Pavlov
---
 arch/mips/configs/qemu-malta_defconfig |  2 ++
 arch/mips/dts/qemu-malta.dts           | 13 +++++++++++
 arch/mips/mach-malta/Makefile          |  1 -
 arch/mips/mach-malta/reset.c           | 31 --------------------------
 4 files changed, 15 insertions(+), 32 deletions(-)

Applied, thanks

Sascha

Quoted 86 lines
arch/mips/configs/qemu-malta_defconfig +2 -0
index b9994f392c..ab3abb7a2a 100644
@@ -75,6 +75,8 @@ CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_GPIO_MALTA_FPGA_I2C=y
 CONFIG_PCI=y
 CONFIG_PCI_DEBUG=y
+CONFIG_SYSCON_REBOOT_MODE=y
+CONFIG_POWER_RESET_SYSCON=y
 CONFIG_FS_CRAMFS=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
arch/mips/dts/qemu-malta.dts +13 -0
index 32e473cac0..2d6f4a0ca3 100644
@@ -27,6 +27,19 @@
 		clock-frequency = <1843200>;
 	};
 
+	fpga_regs: system-controller@1f000000 {
+		compatible = "mti,malta-fpga", "syscon", "simple-mfd";
+		reg = <0x1f000000 0x600>;
+		native-endian;
+
+		reboot {
+			compatible = "syscon-reboot";
+			regmap = <&fpga_regs>;
+			offset = <0x500>;
+			mask = <0x42>;
+		};
+	};
+
 	gpio: gpio@1f000b00 {
 		compatible = "mti,malta-fpga-i2c-gpio";
 		gpio-controller;
arch/mips/mach-malta/Makefile +0 -1
index 0c5a7018d4..7d56f215b0 100644
@@ -1,2 +1 @@
-obj-y += reset.o
 obj-$(CONFIG_PCI) += pci.o
arch/mips/mach-malta/reset.c deleted +0 -31
deleted file mode 100644
index ad0de2741b..0000000000
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Antony Pavlov <[email protected]>
- */
-
-/**
- * @file
- * @brief Resetting an malta board
- */
-
-#include <common.h>
-#include <io.h>
-#include <init.h>
-#include <restart.h>
-#include <mach/hardware.h>
-
-static void __noreturn malta_restart_soc(struct restart_handler *rst)
-{
-	__raw_writel(GORESET, (char *)SOFTRES_REG);
-
-	hang();
-	/*NOTREACHED*/
-}
-
-static int restart_register_feature(void)
-{
-	restart_handler_register_fn("soc", malta_restart_soc);
-
-	return 0;
-}
-coredevice_initcall(restart_register_feature);
Signature · 1 line
2.31.1
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox