* [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets
@ 2026-09-08 17:38 Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
Currently mt8167 inherits its watchdog from the included mt8516 dtsi,
which in turn falls back on mt6589-wdt, which does not support toprgu
resets yet. In the first two patches we add support for the 12 mt6589
toprgu resets.
However, according to its data sheet, mt8167 has 14 sw resets instead of
12, and its reset bits are non-contiguous. This is currently unsupported
by the mtk-wdt driver and it caused confusion between reset IDs and reset
bits in other mtk SoCs device tree includes.
Therefore we introduce a dedicated mediatek,mt8167-wdt compatible for the
watchdog driver that describes correctly this SoC's resets. Since its
reset bits are non-contiguous, we add support for a watchdog reset table
to accommodate the distinction between device tree reset IDs and the
actual bits in the registers. Code is inspired by the reset table
currently implemented in the mmsys driver. There should be no effect
on existing sequential wdt resets.
In the last three patches we describe the mmsys reset table for the SoC.
According to the datasheet there are 28 mmsys reset bits divided across
two adjacent registers.
The series has been tested on a Sony PlayStation Classic Mini, on a Xiaomi
Mi Smart Clock and on a Lenovo Smart Clock 2.
Changes in v5:
- Dropped the binding header for mt6589 reset IDs;
- Moved the definition of the number of resets for mt6589 inside
mtk-wdt driver;
- Separated the mmsys related changes to the last three commits.
Changes in v4 [4]:
- Squashed the reset IDs includes together with the bindings change;
- Added support for a reset table to the mtk-wdt driver. This allows us
to decouple reset IDs from device trees from reset bits and lets us
describe correctly the non-contiguous reset bits of mt8167;
- Improved explanations in commit messages.
Changes in v3 [3]:
- Improved explanations in the commit messages;
- Added the #reset-cells property to mt6589 watchdog node;
- Included the mediatek,mt6589-resets.h file in mt6589.dtsi;
- Included the mediatek,mt8167-resets.h file in mt8167.dtsi;
- Moved the mmsys reset table from the mt8167-mmsys.h header file to
the mmsys driver implementation.
Changes in v2 [2]:
- Sashiko pointed out correctly a missing entry in the mmsys reset table
in the last patch.
Initial version: [1]
[1] https://lore.kernel.org/linux-mediatek/20260717151134.678839-1-l.scorcia@gmail.com/
[2] https://lore.kernel.org/linux-mediatek/20260717163959.714561-1-l.scorcia@gmail.com/
[3] https://lore.kernel.org/linux-mediatek/20260809160643.33991-1-l.scorcia@gmail.com/
[4] https://lore.kernel.org/linux-mediatek/20260819101853.44681-1-l.scorcia@gmail.com/
Luca Leonardo Scorcia (8):
watchdog: mediatek: Add wdt/toprgu resets for mt6589
arm: dts: mediatek: mt6589: Enable toprgu reset controller
dt-bindings: watchdog: Add compatible for MediaTek mt8167
watchdog: mediatek: Add support for mt8167 toprgu/watchdog
arm64: dts: mt8167: Properly describe the SoC watchdog resets
dt-bindings: reset: Add mmsys reset ids for mt8167
soc: mediatek: mtk-mmsys: Add resets for mt8167
arm64: dts: mt8167: Add support for mmsys resets
.../bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
arch/arm/boot/dts/mediatek/mt6589.dtsi | 1 +
arch/arm64/boot/dts/mediatek/mt8167.dtsi | 9 ++++
drivers/soc/mediatek/mt8167-mmsys.h | 3 ++
drivers/soc/mediatek/mtk-mmsys.c | 38 +++++++++++++
drivers/watchdog/mtk_wdt.c | 54 +++++++++++++++++--
.../dt-bindings/reset/mediatek,mt8167-mmsys.h | 35 ++++++++++++
.../dt-bindings/reset/mediatek,mt8167-wdt.h | 21 ++++++++
8 files changed, 157 insertions(+), 5 deletions(-)
create mode 100644 include/dt-bindings/reset/mediatek,mt8167-mmsys.h
create mode 100644 include/dt-bindings/reset/mediatek,mt8167-wdt.h
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-09 21:24 ` Guenter Roeck
2026-09-08 17:38 ` [PATCH v5 2/8] arm: dts: mediatek: mt6589: Enable toprgu reset controller Luca Leonardo Scorcia
` (7 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
According to Android sources, mt6589 has 12 reset bits in the
WDT_SWSYSRST register. Populate toprgu_sw_rst_num to allow toprgu resets
in device trees of the many compatible devices.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
drivers/watchdog/mtk_wdt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index d9c30e4c80e3..d609f0fa35e3 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -64,6 +64,7 @@
#define DRV_NAME "mtk-wdt"
#define DRV_VERSION "1.0"
+#define MT6589_TOPRGU_SW_RST_NUM 12
#define MT7988_TOPRGU_SW_RST_NUM 24
static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -88,6 +89,10 @@ static const struct mtk_wdt_data mt2712_data = {
.toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM,
};
+static const struct mtk_wdt_data mt6589_data = {
+ .toprgu_sw_rst_num = MT6589_TOPRGU_SW_RST_NUM,
+};
+
static const struct mtk_wdt_data mt6735_data = {
.toprgu_sw_rst_num = MT6735_TOPRGU_RST_NUM,
};
@@ -493,7 +498,7 @@ static int mtk_wdt_resume(struct device *dev)
static const struct of_device_id mtk_wdt_dt_ids[] = {
{ .compatible = "mediatek,mt2712-wdt", .data = &mt2712_data },
- { .compatible = "mediatek,mt6589-wdt" },
+ { .compatible = "mediatek,mt6589-wdt", .data = &mt6589_data },
{ .compatible = "mediatek,mt6735-wdt", .data = &mt6735_data },
{ .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 2/8] arm: dts: mediatek: mt6589: Enable toprgu reset controller
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 3/8] dt-bindings: watchdog: Add compatible for MediaTek mt8167 Luca Leonardo Scorcia
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
Enable the toprgu reset controller feature for the mt6589 SoC. This
allows generating reset signals for the 12 subsystems managed by its
top reset generation unit.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
arch/arm/boot/dts/mediatek/mt6589.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/mediatek/mt6589.dtsi b/arch/arm/boot/dts/mediatek/mt6589.dtsi
index 46dea445742b..2645054a4a61 100644
--- a/arch/arm/boot/dts/mediatek/mt6589.dtsi
+++ b/arch/arm/boot/dts/mediatek/mt6589.dtsi
@@ -147,6 +147,7 @@ uart3: serial@11009000 {
wdt: watchdog@10000000 {
compatible = "mediatek,mt6589-wdt";
reg = <0x10000000 0x44>;
+ #reset-cells = <1>;
};
};
};
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 3/8] dt-bindings: watchdog: Add compatible for MediaTek mt8167
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 2/8] arm: dts: mediatek: mt6589: Enable toprgu reset controller Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 4/8] watchdog: mediatek: Add support for mt8167 toprgu/watchdog Luca Leonardo Scorcia
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, AngeloGioacchino Del Regno,
Wim Van Sebroeck, Guenter Roeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Philipp Zabel, linux-watchdog, devicetree, linux-kernel,
linux-arm-kernel
Currently mt8167 inherits its watchdog from the included mt8516 dtsi,
which in turn falls back on mt6589-wdt. However according to the data
sheet mt8167 toprgu is not actually compatible with mt6589 (it has 14 sw
resets instead of 12, and its reset bit map table is different from
mt6589).
Update the mtk-wdt binding to add a dedicated compatible for mt8167 and
add the IDs that can be used in device trees to identify subsystem resets.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
.../bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
.../dt-bindings/reset/mediatek,mt8167-wdt.h | 21 +++++++++++++++++++
2 files changed, 22 insertions(+)
create mode 100644 include/dt-bindings/reset/mediatek,mt8167-wdt.h
diff --git a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
index 953629cb9558..f514be8a5851 100644
--- a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
@@ -26,6 +26,7 @@ properties:
- mediatek,mt6795-wdt
- mediatek,mt7986-wdt
- mediatek,mt7988-wdt
+ - mediatek,mt8167-wdt
- mediatek,mt8183-wdt
- mediatek,mt8186-wdt
- mediatek,mt8188-wdt
diff --git a/include/dt-bindings/reset/mediatek,mt8167-wdt.h b/include/dt-bindings/reset/mediatek,mt8167-wdt.h
new file mode 100644
index 000000000000..1a24bfe079ca
--- /dev/null
+++ b/include/dt-bindings/reset/mediatek,mt8167-wdt.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
+#ifndef _DT_BINDINGS_RESET_MEDIATEK_MT8167_WDT_H_
+#define _DT_BINDINGS_RESET_MEDIATEK_MT8167_WDT_H_
+
+/* TOPRGU reset IDs */
+#define MT8167_TOPRGU_DDRPHY_FLASH_RST 0
+#define MT8167_TOPRGU_AUD_PAD_RST 1
+#define MT8167_TOPRGU_MM_RST 2
+#define MT8167_TOPRGU_MFG_RST 3
+#define MT8167_TOPRGU_MDSYS_RST 4
+#define MT8167_TOPRGU_CONN_RST 5
+#define MT8167_TOPRGU_PAD2CAM_DIG_MIPI_RX_RST 6
+#define MT8167_TOPRGU_DIG_MIPI_TX_RST 7
+#define MT8167_TOPRGU_SPI_PAD_MACRO_RST 8
+#define MT8167_TOPRGU_APMIXED_RST 9
+#define MT8167_TOPRGU_VDEC_RST 10
+#define MT8167_TOPRGU_CONN_MCU_RST 11
+#define MT8167_TOPRGU_EFUSE_RST 12
+#define MT8167_TOPRGU_PWRAP_SPICTL_RST 13
+
+#endif /* _DT_BINDINGS_RESET_MEDIATEK_MT8167_WDT_H_ */
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 4/8] watchdog: mediatek: Add support for mt8167 toprgu/watchdog
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (2 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 3/8] dt-bindings: watchdog: Add compatible for MediaTek mt8167 Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 5/8] arm64: dts: mt8167: Properly describe the SoC watchdog resets Luca Leonardo Scorcia
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
Add support for the Top Reset Generation Unit/Watchdog Timer found on
mt8167.
Since according to its data sheet mt8167 toprgu reset bits are not
contiguous, add support for a reset table to the driver. This lets us
define reset identifiers as contiguous indexes in the binding headers.
Also address a preexisting Sashiko finding that noticed that the
has_swsysrst_en configuration was set after the reset controller
registration.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
drivers/watchdog/mtk_wdt.c | 47 ++++++++++++++++++++++++++++++++++----
1 file changed, 43 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index d609f0fa35e3..abe58ed6a504 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -12,6 +12,7 @@
#include <dt-bindings/reset/mt2712-resets.h>
#include <dt-bindings/reset/mediatek,mt6735-wdt.h>
#include <dt-bindings/reset/mediatek,mt6795-resets.h>
+#include <dt-bindings/reset/mediatek,mt8167-wdt.h>
#include <dt-bindings/reset/mt7986-resets.h>
#include <dt-bindings/reset/mt8183-resets.h>
#include <dt-bindings/reset/mt8186-resets.h>
@@ -78,11 +79,14 @@ struct mtk_wdt_dev {
bool disable_wdt_extrst;
bool reset_by_toprgu;
bool has_swsysrst_en;
+ const u8 *toprgu_sw_rst_tb;
+ int toprgu_sw_rst_num;
};
struct mtk_wdt_data {
- int toprgu_sw_rst_num;
- bool has_swsysrst_en;
+ const u8 *toprgu_sw_rst_tb;
+ const int toprgu_sw_rst_num;
+ const bool has_swsysrst_en;
};
static const struct mtk_wdt_data mt2712_data = {
@@ -130,6 +134,29 @@ static const struct mtk_wdt_data mt8195_data = {
.toprgu_sw_rst_num = MT8195_TOPRGU_SW_RST_NUM,
};
+static const u8 mt8167_toprgu_sw_rst_tb[] = {
+ [MT8167_TOPRGU_DDRPHY_FLASH_RST] = 0,
+ [MT8167_TOPRGU_AUD_PAD_RST] = 1,
+ [MT8167_TOPRGU_MM_RST] = 2,
+ [MT8167_TOPRGU_MFG_RST] = 3,
+ [MT8167_TOPRGU_MDSYS_RST] = 4,
+ [MT8167_TOPRGU_CONN_RST] = 5,
+ [MT8167_TOPRGU_PAD2CAM_DIG_MIPI_RX_RST] = 6,
+ [MT8167_TOPRGU_DIG_MIPI_TX_RST] = 7,
+ [MT8167_TOPRGU_SPI_PAD_MACRO_RST] = 8,
+ /* The data sheet describes bit 9 as "reserved, unused" */
+ [MT8167_TOPRGU_APMIXED_RST] = 10,
+ [MT8167_TOPRGU_VDEC_RST] = 11,
+ [MT8167_TOPRGU_CONN_MCU_RST] = 12,
+ [MT8167_TOPRGU_EFUSE_RST] = 13,
+ [MT8167_TOPRGU_PWRAP_SPICTL_RST] = 14
+};
+
+static const struct mtk_wdt_data mt8167_data = {
+ .toprgu_sw_rst_tb = mt8167_toprgu_sw_rst_tb,
+ .toprgu_sw_rst_num = ARRAY_SIZE(mt8167_toprgu_sw_rst_tb),
+};
+
/**
* toprgu_reset_sw_en_unlocked() - enable/disable software control for reset bit
* @data: Pointer to instance of driver data.
@@ -160,6 +187,15 @@ static int toprgu_reset_update(struct reset_controller_dev *rcdev,
struct mtk_wdt_dev *data =
container_of(rcdev, struct mtk_wdt_dev, rcdev);
+ if (data->toprgu_sw_rst_tb) {
+ if (id >= data->toprgu_sw_rst_num) {
+ dev_err(rcdev->dev, "Invalid reset ID: %lu (>=%u)\n",
+ id, data->toprgu_sw_rst_num);
+ return -EINVAL;
+ }
+ id = data->toprgu_sw_rst_tb[id];
+ }
+
spin_lock_irqsave(&data->lock, flags);
if (assert && data->has_swsysrst_en)
@@ -457,12 +493,14 @@ static int mtk_wdt_probe(struct platform_device *pdev)
wdt_data = of_device_get_match_data(dev);
if (wdt_data) {
+ mtk_wdt->toprgu_sw_rst_num = wdt_data->toprgu_sw_rst_num;
+ mtk_wdt->toprgu_sw_rst_tb = wdt_data->toprgu_sw_rst_tb;
+ mtk_wdt->has_swsysrst_en = wdt_data->has_swsysrst_en;
+
err = toprgu_register_reset_controller(pdev,
wdt_data->toprgu_sw_rst_num);
if (err)
return err;
-
- mtk_wdt->has_swsysrst_en = wdt_data->has_swsysrst_en;
}
mtk_wdt->disable_wdt_extrst =
@@ -503,6 +541,7 @@ static const struct of_device_id mtk_wdt_dt_ids[] = {
{ .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
{ .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },
+ { .compatible = "mediatek,mt8167-wdt", .data = &mt8167_data },
{ .compatible = "mediatek,mt8183-wdt", .data = &mt8183_data },
{ .compatible = "mediatek,mt8186-wdt", .data = &mt8186_data },
{ .compatible = "mediatek,mt8188-wdt", .data = &mt8188_data },
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 5/8] arm64: dts: mt8167: Properly describe the SoC watchdog resets
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (3 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 4/8] watchdog: mediatek: Add support for mt8167 toprgu/watchdog Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 6/8] dt-bindings: reset: Add mmsys reset ids for mt8167 Luca Leonardo Scorcia
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
Currently mt8167 inherits its watchdog from the included mt8516 dtsi,
which in turn falls back on mt6589-wdt. However according to the data
sheet mt8167 toprgu is not really compatible with mt6589 (it has 14 sw
resets instead of 12, and the reset IDs are different from mt6589).
Use the dedicated mediatek,mt8167-wdt compatible for the watchdog driver,
as it correctly describes the SoC resets.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
arch/arm64/boot/dts/mediatek/mt8167.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8167.dtsi b/arch/arm64/boot/dts/mediatek/mt8167.dtsi
index 27cf32d7ae35..be215390730b 100644
--- a/arch/arm64/boot/dts/mediatek/mt8167.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8167.dtsi
@@ -8,6 +8,7 @@
#include <dt-bindings/clock/mt8167-clk.h>
#include <dt-bindings/memory/mt8167-larb-port.h>
#include <dt-bindings/power/mt8167-power.h>
+#include <dt-bindings/reset/mediatek,mt8167-wdt.h>
#include "mt8167-pinfunc.h"
@@ -95,6 +96,13 @@ power-domain@MT8167_POWER_DOMAIN_CONN {
};
};
+ watchdog: watchdog@10007000 {
+ compatible = "mediatek,mt8167-wdt";
+ reg = <0 0x10007000 0 0x1000>;
+ interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>;
+ #reset-cells = <1>;
+ };
+
pio: pinctrl@1000b000 {
compatible = "mediatek,mt8167-pinctrl";
reg = <0 0x1000b000 0 0x1000>;
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 6/8] dt-bindings: reset: Add mmsys reset ids for mt8167
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (4 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 5/8] arm64: dts: mt8167: Properly describe the SoC watchdog resets Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 7/8] soc: mediatek: mtk-mmsys: Add resets " Luca Leonardo Scorcia
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, AngeloGioacchino Del Regno,
Wim Van Sebroeck, Guenter Roeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Philipp Zabel, linux-watchdog, devicetree, linux-kernel,
linux-arm-kernel
According to the SoC data sheet mt8167 has 28 mmsys resets. Add the IDs
that can be used in device trees to identify subsystem resets.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
.../dt-bindings/reset/mediatek,mt8167-mmsys.h | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 include/dt-bindings/reset/mediatek,mt8167-mmsys.h
diff --git a/include/dt-bindings/reset/mediatek,mt8167-mmsys.h b/include/dt-bindings/reset/mediatek,mt8167-mmsys.h
new file mode 100644
index 000000000000..b21f67b3b55c
--- /dev/null
+++ b/include/dt-bindings/reset/mediatek,mt8167-mmsys.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
+#ifndef _DT_BINDINGS_RESET_MEDIATEK_MT8167_MMSYS_H_
+#define _DT_BINDINGS_RESET_MEDIATEK_MT8167_MMSYS_H_
+
+/* MMSYS reset IDs */
+#define MT8167_MMSYS_SW0_RST_B_SMI_COMMON 0
+#define MT8167_MMSYS_SW0_RST_B_SMI_LARB0 1
+#define MT8167_MMSYS_SW0_RST_B_CAM_MDP 2
+#define MT8167_MMSYS_SW0_RST_B_MDP_RDMA0 3
+#define MT8167_MMSYS_SW0_RST_B_MDP_RSZ0 4
+#define MT8167_MMSYS_SW0_RST_B_MDP_RSZ1 5
+#define MT8167_MMSYS_SW0_RST_B_MDP_TDSHP0 6
+#define MT8167_MMSYS_SW0_RST_B_MDP_WDMA 7
+#define MT8167_MMSYS_SW0_RST_B_MDP_WROT0 8
+#define MT8167_MMSYS_SW0_RST_B_FAKE_ENG 9
+#define MT8167_MMSYS_SW0_RST_B_MUTEX 10
+#define MT8167_MMSYS_SW0_RST_B_DISP_OVL0 11
+#define MT8167_MMSYS_SW0_RST_B_DISP_RDMA0 12
+#define MT8167_MMSYS_SW0_RST_B_DISP_RDMA1 13
+#define MT8167_MMSYS_SW0_RST_B_DISP_WDMA0 14
+#define MT8167_MMSYS_SW0_RST_B_DISP_COLOR 15
+#define MT8167_MMSYS_SW0_RST_B_DISP_CCORR 16
+#define MT8167_MMSYS_SW0_RST_B_DISP_AAL 17
+#define MT8167_MMSYS_SW0_RST_B_DISP_GAMMA 18
+#define MT8167_MMSYS_SW0_RST_B_DISP_DITHER 19
+#define MT8167_MMSYS_SW0_RST_B_DISP_UFOE 20
+#define MT8167_MMSYS_SW0_RST_B_DISP_PWM 21
+#define MT8167_MMSYS_SW0_RST_B_DSI0 22
+#define MT8167_MMSYS_SW0_RST_B_DPI0 23
+#define MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG 24
+#define MT8167_MMSYS_SW1_RST_B_LVDS_ENCODER 25
+#define MT8167_MMSYS_SW1_RST_B_DPI1 26
+#define MT8167_MMSYS_SW1_RST_B_HDMI 27
+
+#endif /* _DT_BINDINGS_RESET_MEDIATEK_MT8167_MMSYS_H_ */
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 7/8] soc: mediatek: mtk-mmsys: Add resets for mt8167
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (5 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 6/8] dt-bindings: reset: Add mmsys reset ids for mt8167 Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 8/8] arm64: dts: mt8167: Add support for mmsys resets Luca Leonardo Scorcia
2026-09-09 9:42 ` [PATCH v5 0/8] Add support for mt8167 toprgu and " AngeloGioacchino Del Regno
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
The mt8167 SoC has 28 mmsys resets, split across two contiguous 32-bits
registers, MMSYS_SW0_RST_B (0x140) and MMSYS_SW1_RST_B (0x144).
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
drivers/soc/mediatek/mt8167-mmsys.h | 3 +++
drivers/soc/mediatek/mtk-mmsys.c | 38 +++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/soc/mediatek/mt8167-mmsys.h b/drivers/soc/mediatek/mt8167-mmsys.h
index 001379373507..5c7cded5cfa4 100644
--- a/drivers/soc/mediatek/mt8167-mmsys.h
+++ b/drivers/soc/mediatek/mt8167-mmsys.h
@@ -3,6 +3,9 @@
#ifndef __SOC_MEDIATEK_MT8167_MMSYS_H
#define __SOC_MEDIATEK_MT8167_MMSYS_H
+#define MT8167_MMSYS_SW0_RST_B 0x140
+#define MT8167_MMSYS_SW1_RST_B 0x144
+
#define MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN 0x030
#define MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN 0x038
#define MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x058
diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index 2f3e0778bb17..015dc5b86478 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -4,6 +4,7 @@
* Author: James Liao <jamesjj.liao@mediatek.com>
*/
+#include <dt-bindings/reset/mediatek,mt8167-mmsys.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/io.h>
@@ -53,10 +54,47 @@ static const struct mtk_mmsys_driver_data mt6797_mmsys_driver_data = {
.clk_driver = "clk-mt6797-mm",
};
+static const u8 mmsys_mt8167_rst_tb[] = {
+ [MT8167_MMSYS_SW0_RST_B_SMI_COMMON] = MMSYS_RST_NR(0, 0),
+ [MT8167_MMSYS_SW0_RST_B_SMI_LARB0] = MMSYS_RST_NR(0, 1),
+ [MT8167_MMSYS_SW0_RST_B_CAM_MDP] = MMSYS_RST_NR(0, 2),
+ [MT8167_MMSYS_SW0_RST_B_MDP_RDMA0] = MMSYS_RST_NR(0, 3),
+ [MT8167_MMSYS_SW0_RST_B_MDP_RSZ0] = MMSYS_RST_NR(0, 4),
+ [MT8167_MMSYS_SW0_RST_B_MDP_RSZ1] = MMSYS_RST_NR(0, 5),
+ [MT8167_MMSYS_SW0_RST_B_MDP_TDSHP0] = MMSYS_RST_NR(0, 6),
+ [MT8167_MMSYS_SW0_RST_B_MDP_WDMA] = MMSYS_RST_NR(0, 7),
+ [MT8167_MMSYS_SW0_RST_B_MDP_WROT0] = MMSYS_RST_NR(0, 8),
+ [MT8167_MMSYS_SW0_RST_B_FAKE_ENG] = MMSYS_RST_NR(0, 9),
+ [MT8167_MMSYS_SW0_RST_B_MUTEX] = MMSYS_RST_NR(0, 10),
+ [MT8167_MMSYS_SW0_RST_B_DISP_OVL0] = MMSYS_RST_NR(0, 11),
+ [MT8167_MMSYS_SW0_RST_B_DISP_RDMA0] = MMSYS_RST_NR(0, 12),
+ [MT8167_MMSYS_SW0_RST_B_DISP_RDMA1] = MMSYS_RST_NR(0, 13),
+ [MT8167_MMSYS_SW0_RST_B_DISP_WDMA0] = MMSYS_RST_NR(0, 14),
+ [MT8167_MMSYS_SW0_RST_B_DISP_COLOR] = MMSYS_RST_NR(0, 15),
+ [MT8167_MMSYS_SW0_RST_B_DISP_CCORR] = MMSYS_RST_NR(0, 16),
+ [MT8167_MMSYS_SW0_RST_B_DISP_AAL] = MMSYS_RST_NR(0, 17),
+ [MT8167_MMSYS_SW0_RST_B_DISP_GAMMA] = MMSYS_RST_NR(0, 18),
+ [MT8167_MMSYS_SW0_RST_B_DISP_DITHER] = MMSYS_RST_NR(0, 19),
+ [MT8167_MMSYS_SW0_RST_B_DISP_UFOE] = MMSYS_RST_NR(0, 20),
+ [MT8167_MMSYS_SW0_RST_B_DISP_PWM] = MMSYS_RST_NR(0, 21),
+ [MT8167_MMSYS_SW0_RST_B_DSI0] = MMSYS_RST_NR(0, 22),
+ [MT8167_MMSYS_SW0_RST_B_DPI0] = MMSYS_RST_NR(0, 23),
+ /* bit 24 is SMI_COMMON again according to data sheet */
+ /* bit 25 is SMI_LARB0 again according to data sheet */
+ [MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG] = MMSYS_RST_NR(0, 26),
+ /* all other bits are not described in data sheet */
+ [MT8167_MMSYS_SW1_RST_B_LVDS_ENCODER] = MMSYS_RST_NR(1, 2),
+ [MT8167_MMSYS_SW1_RST_B_DPI1] = MMSYS_RST_NR(1, 3),
+ [MT8167_MMSYS_SW1_RST_B_HDMI] = MMSYS_RST_NR(1, 4),
+};
+
static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = {
.clk_driver = "clk-mt8167-mm",
.routes = mt8167_mmsys_routing_table,
.num_routes = ARRAY_SIZE(mt8167_mmsys_routing_table),
+ .sw0_rst_offset = MT8167_MMSYS_SW0_RST_B,
+ .rst_tb = mmsys_mt8167_rst_tb,
+ .num_resets = ARRAY_SIZE(mmsys_mt8167_rst_tb),
};
static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v5 8/8] arm64: dts: mt8167: Add support for mmsys resets
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (6 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 7/8] soc: mediatek: mtk-mmsys: Add resets " Luca Leonardo Scorcia
@ 2026-09-08 17:38 ` Luca Leonardo Scorcia
2026-09-09 9:42 ` [PATCH v5 0/8] Add support for mt8167 toprgu and " AngeloGioacchino Del Regno
8 siblings, 0 replies; 11+ messages in thread
From: Luca Leonardo Scorcia @ 2026-09-08 17:38 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Wim Van Sebroeck, Guenter Roeck,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
Add support for mmsys resets by declaring the reset-cells property.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
arch/arm64/boot/dts/mediatek/mt8167.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8167.dtsi b/arch/arm64/boot/dts/mediatek/mt8167.dtsi
index be215390730b..9eb24dc8715f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8167.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8167.dtsi
@@ -132,6 +132,7 @@ mmsys: syscon@14000000 {
compatible = "mediatek,mt8167-mmsys", "syscon";
reg = <0 0x14000000 0 0x1000>;
#clock-cells = <1>;
+ #reset-cells = <1>;
};
larb0: larb@14016000 {
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
` (7 preceding siblings ...)
2026-09-08 17:38 ` [PATCH v5 8/8] arm64: dts: mt8167: Add support for mmsys resets Luca Leonardo Scorcia
@ 2026-09-09 9:42 ` AngeloGioacchino Del Regno
8 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-09-09 9:42 UTC (permalink / raw)
To: Luca Leonardo Scorcia, linux-mediatek
Cc: Wim Van Sebroeck, Guenter Roeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Philipp Zabel, linux-watchdog, devicetree, linux-kernel,
linux-arm-kernel
On 9/8/26 19:38, Luca Leonardo Scorcia wrote:
> Currently mt8167 inherits its watchdog from the included mt8516 dtsi,
> which in turn falls back on mt6589-wdt, which does not support toprgu
> resets yet. In the first two patches we add support for the 12 mt6589
> toprgu resets.
>
> However, according to its data sheet, mt8167 has 14 sw resets instead of
> 12, and its reset bits are non-contiguous. This is currently unsupported
> by the mtk-wdt driver and it caused confusion between reset IDs and reset
> bits in other mtk SoCs device tree includes.
>
> Therefore we introduce a dedicated mediatek,mt8167-wdt compatible for the
> watchdog driver that describes correctly this SoC's resets. Since its
> reset bits are non-contiguous, we add support for a watchdog reset table
> to accommodate the distinction between device tree reset IDs and the
> actual bits in the registers. Code is inspired by the reset table
> currently implemented in the mmsys driver. There should be no effect
> on existing sequential wdt resets.
>
> In the last three patches we describe the mmsys reset table for the SoC.
> According to the datasheet there are 28 mmsys reset bits divided across
> two adjacent registers.
>
> The series has been tested on a Sony PlayStation Classic Mini, on a Xiaomi
> Mi Smart Clock and on a Lenovo Smart Clock 2.
>
Whole series is
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Changes in v5:
> - Dropped the binding header for mt6589 reset IDs;
> - Moved the definition of the number of resets for mt6589 inside
> mtk-wdt driver;
> - Separated the mmsys related changes to the last three commits.
>
> Changes in v4 [4]:
> - Squashed the reset IDs includes together with the bindings change;
> - Added support for a reset table to the mtk-wdt driver. This allows us
> to decouple reset IDs from device trees from reset bits and lets us
> describe correctly the non-contiguous reset bits of mt8167;
> - Improved explanations in commit messages.
>
> Changes in v3 [3]:
> - Improved explanations in the commit messages;
> - Added the #reset-cells property to mt6589 watchdog node;
> - Included the mediatek,mt6589-resets.h file in mt6589.dtsi;
> - Included the mediatek,mt8167-resets.h file in mt8167.dtsi;
> - Moved the mmsys reset table from the mt8167-mmsys.h header file to
> the mmsys driver implementation.
>
> Changes in v2 [2]:
> - Sashiko pointed out correctly a missing entry in the mmsys reset table
> in the last patch.
>
> Initial version: [1]
>
> [1] https://lore.kernel.org/linux-mediatek/20260717151134.678839-1-l.scorcia@gmail.com/
> [2] https://lore.kernel.org/linux-mediatek/20260717163959.714561-1-l.scorcia@gmail.com/
> [3] https://lore.kernel.org/linux-mediatek/20260809160643.33991-1-l.scorcia@gmail.com/
> [4] https://lore.kernel.org/linux-mediatek/20260819101853.44681-1-l.scorcia@gmail.com/
>
> Luca Leonardo Scorcia (8):
> watchdog: mediatek: Add wdt/toprgu resets for mt6589
> arm: dts: mediatek: mt6589: Enable toprgu reset controller
> dt-bindings: watchdog: Add compatible for MediaTek mt8167
> watchdog: mediatek: Add support for mt8167 toprgu/watchdog
> arm64: dts: mt8167: Properly describe the SoC watchdog resets
> dt-bindings: reset: Add mmsys reset ids for mt8167
> soc: mediatek: mtk-mmsys: Add resets for mt8167
> arm64: dts: mt8167: Add support for mmsys resets
>
> .../bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
> arch/arm/boot/dts/mediatek/mt6589.dtsi | 1 +
> arch/arm64/boot/dts/mediatek/mt8167.dtsi | 9 ++++
> drivers/soc/mediatek/mt8167-mmsys.h | 3 ++
> drivers/soc/mediatek/mtk-mmsys.c | 38 +++++++++++++
> drivers/watchdog/mtk_wdt.c | 54 +++++++++++++++++--
> .../dt-bindings/reset/mediatek,mt8167-mmsys.h | 35 ++++++++++++
> .../dt-bindings/reset/mediatek,mt8167-wdt.h | 21 ++++++++
> 8 files changed, 157 insertions(+), 5 deletions(-)
> create mode 100644 include/dt-bindings/reset/mediatek,mt8167-mmsys.h
> create mode 100644 include/dt-bindings/reset/mediatek,mt8167-wdt.h
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589
2026-09-08 17:38 ` [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
@ 2026-09-09 21:24 ` Guenter Roeck
0 siblings, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2026-09-09 21:24 UTC (permalink / raw)
To: Luca Leonardo Scorcia
Cc: linux-mediatek, Wim Van Sebroeck, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Philipp Zabel, linux-watchdog,
devicetree, linux-kernel, linux-arm-kernel
On Tue, Sep 08, 2026 at 07:38:28PM +0200, Luca Leonardo Scorcia wrote:
> According to Android sources, mt6589 has 12 reset bits in the
> WDT_SWSYSRST register. Populate toprgu_sw_rst_num to allow toprgu resets
> in device trees of the many compatible devices.
>
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-09-09 21:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 17:38 [PATCH v5 0/8] Add support for mt8167 toprgu and mmsys resets Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 1/8] watchdog: mediatek: Add wdt/toprgu resets for mt6589 Luca Leonardo Scorcia
2026-09-09 21:24 ` Guenter Roeck
2026-09-08 17:38 ` [PATCH v5 2/8] arm: dts: mediatek: mt6589: Enable toprgu reset controller Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 3/8] dt-bindings: watchdog: Add compatible for MediaTek mt8167 Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 4/8] watchdog: mediatek: Add support for mt8167 toprgu/watchdog Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 5/8] arm64: dts: mt8167: Properly describe the SoC watchdog resets Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 6/8] dt-bindings: reset: Add mmsys reset ids for mt8167 Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 7/8] soc: mediatek: mtk-mmsys: Add resets " Luca Leonardo Scorcia
2026-09-08 17:38 ` [PATCH v5 8/8] arm64: dts: mt8167: Add support for mmsys resets Luca Leonardo Scorcia
2026-09-09 9:42 ` [PATCH v5 0/8] Add support for mt8167 toprgu and " AngeloGioacchino Del Regno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®