Skip to contentSkip to conversation

MAINTAINERS: Add Apple watchdog to ARM/APPLE MACHINE SUPPORT

PATCH In review Sven Peter 2 participants 3 messages Dec 11, 2021 – Dec 12, 2021

Subsystems (2)
lore
Share & tools
lore

Sven Peter

author
#0 lore raw

PATCH v3 1/2 MAINTAINERS: Add Apple watchdog to ARM/APPLE MACHINE SUPPORT

Add apple_wdt.c under the ARM/APPLE MACHINE SUPPORT entry.

---
v3: new commit to be taken through the SoC tree to prevent
merge conflicts upstream since we have multiple drivers that all touch the same section in-flight as requested by Hector Martin

 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 43007f2d29e0..0e919de0a808 100644
@@ -1756,6 +1756,7 @@ F:	drivers/i2c/busses/i2c-pasemi-platform.c
 F:	drivers/irqchip/irq-apple-aic.c
 F:	drivers/mailbox/apple-mailbox.c
 F:	drivers/pinctrl/pinctrl-apple-gpio.c
+F:	drivers/watchdog/apple_wdt.c
 F:	include/dt-bindings/interrupt-controller/apple-aic.h
 F:	include/dt-bindings/pinctrl/apple.h
 F:	include/linux/apple-mailbox.h
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v3 2/2 watchdog: Add Apple SoC watchdog driver

Add support for the watchdog timer found in Apple SoCs. This driver is also required to reboot these machines.

---
v2 -> v3:
- removed MAINTAINERS changes as requested by Hector Martin to be able to take them through the soc tree instead
- typo fix: s/APPLE_WDTx_WD1_CUR_TIME/APPLE_WDT_WDx_CUR_TIME/
- added review and test tags

v1 -> v2:
- set the default timeout to 30s and call watchdog_init_timeout to allow the device tree to override it
- set WDOG_HW_RUNNING if the watchdog is enabled at boot
- check that the clock rate is not zero
- use unsigned long instead of u32 for clk_rate
- use devm_add_action_or_reset instead of manually calling clk_disable_unprepare
- explain the magic number in apple_wdt_restart

 drivers/watchdog/Kconfig     |  12 ++
 drivers/watchdog/Makefile    |   1 +
 drivers/watchdog/apple_wdt.c | 226 +++++++++++++++++++++++++++++++++++
 3 files changed, 239 insertions(+)
 create mode 100644 drivers/watchdog/apple_wdt.c
drivers/watchdog/Kconfig +12 -0
index 9d222ba17ec6..170dec880c8f 100644
@@ -976,6 +976,18 @@ config MSC313E_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called msc313e_wdt.
 
+config APPLE_WATCHDOG
+	tristate "Apple SoC watchdog"
+	depends on ARCH_APPLE || COMPILE_TEST
+	select WATCHDOG_CORE
+	help
+	  Say Y here to include support for the Watchdog found in Apple
+	  SoCs such as the M1. Next to the common watchdog features this
+	  driver is also required in order to reboot these SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called apple_wdt.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
drivers/watchdog/Makefile +1 -0
index 2ee97064145b..270a518bd8f3 100644
@@ -93,6 +93,7 @@ obj-$(CONFIG_PM8916_WATCHDOG) += pm8916_wdt.o
 obj-$(CONFIG_ARM_SMC_WATCHDOG) += arm_smc_wdt.o
 obj-$(CONFIG_VISCONTI_WATCHDOG) += visconti_wdt.o
 obj-$(CONFIG_MSC313E_WATCHDOG) += msc313e_wdt.o
+obj-$(CONFIG_APPLE_WATCHDOG) += apple_wdt.o
 
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
drivers/watchdog/apple_wdt.c new file +226 -0

226 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by on v3 1/2
#2 lore raw
In reply to Sven Peter
Quoted 18 lines · Sven Peter

Add apple_wdt.c under the ARM/APPLE MACHINE SUPPORT entry.

---
v3: new commit to be taken through the SoC tree to prevent
merge conflicts upstream since we have multiple drivers that all touch the same section in-flight as requested by Hector Martin

  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 43007f2d29e0..0e919de0a808 100644

MAINTAINERS F: drivers/i2c/busses/i2c-pasemi-platform.c · line 1762

Quoted 7 lines
MAINTAINERS +1 -0
@@ -1756,6 +1756,7 @@ F:	drivers/i2c/busses/i2c-pasemi-platform.c
  F:	drivers/irqchip/irq-apple-aic.c
  F:	drivers/mailbox/apple-mailbox.c
  F:	drivers/pinctrl/pinctrl-apple-gpio.c
+F:	drivers/watchdog/apple_wdt.c
  F:	include/dt-bindings/interrupt-controller/apple-aic.h
  F:	include/dt-bindings/pinctrl/apple.h
  F:	include/linux/apple-mailbox.h

Thanks! Guenter, if you can merge the driver through your tree I'll be happy to take care of the MAINTAINERS and DT stuff via Asahi-SoC :)

Signature · 2 lines
Hector Martin ([email protected])
Public Key: https://mrcn.st/pub