* [PATCH v2 0/2] MediaTek MT6735 TOPRGU/WDT support
@ 2024-11-06 10:47 Yassine Oudjana
2024-11-06 10:47 ` [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart Yassine Oudjana
2024-11-06 10:47 ` [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Yassine Oudjana
0 siblings, 2 replies; 8+ messages in thread
From: Yassine Oudjana @ 2024-11-06 10:47 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Yassine Oudjana, linux-watchdog, linux-kernel, linux-arm-kernel,
linux-mediatek
These patches are part of a larger effort to support the MT6735 SoC family
in mainline Linux. More patches (unsent or sent and pending review or
revision) can be found here[1].
This series adds support for the top reset generation unit (TOPRGU) found
on the MediaTek MT6735 SoC. TOPRGU generates several reset signals and
provides watchdog timer functionality.
While doing so, a fix is made to the restart handler to make it work even
when the watchdog is disabled by default (never enabled by the bootloader).
[1] https://gitlab.com/mt6735-mainline/linux/-/commits/mt6735-staging
Changes since v1:
- Split restart handler fix and MT6735 support into separate patches.
Yassine Oudjana (2):
watchdog: mediatek: Fix mtk_wdt_restart
watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
drivers/watchdog/mtk_wdt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--
2.47.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart
2024-11-06 10:47 [PATCH v2 0/2] MediaTek MT6735 TOPRGU/WDT support Yassine Oudjana
@ 2024-11-06 10:47 ` Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-06 14:57 ` Guenter Roeck
2024-11-06 10:47 ` [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Yassine Oudjana
1 sibling, 2 replies; 8+ messages in thread
From: Yassine Oudjana @ 2024-11-06 10:47 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Yassine Oudjana, linux-watchdog, linux-kernel, linux-arm-kernel,
linux-mediatek
Clear the IRQ enable bit of WDT_MODE before asserting software reset
in order to make TOPRGU issue a system reset signal instead of an IRQ.
Fixes: a44a45536f7b ("watchdog: Add driver for Mediatek watchdog")
Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
---
drivers/watchdog/mtk_wdt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index c35f85ce8d69c..e2d7a57d6ea2e 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -225,9 +225,15 @@ static int mtk_wdt_restart(struct watchdog_device *wdt_dev,
{
struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
void __iomem *wdt_base;
+ u32 reg;
wdt_base = mtk_wdt->wdt_base;
+ /* Enable reset in order to issue a system reset instead of an IRQ */
+ reg = readl(wdt_base + WDT_MODE);
+ reg &= ~WDT_MODE_IRQ_EN;
+ writel(reg | WDT_MODE_KEY, wdt_base + WDT_MODE);
+
while (1) {
writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
mdelay(5);
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
2024-11-06 10:47 [PATCH v2 0/2] MediaTek MT6735 TOPRGU/WDT support Yassine Oudjana
2024-11-06 10:47 ` [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart Yassine Oudjana
@ 2024-11-06 10:47 ` Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-06 14:57 ` Guenter Roeck
1 sibling, 2 replies; 8+ messages in thread
From: Yassine Oudjana @ 2024-11-06 10:47 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Yassine Oudjana, linux-watchdog, linux-kernel, linux-arm-kernel,
linux-mediatek
Add support for the Top Reset Generation Unit/Watchdog Timer found on
MT6735.
Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
---
drivers/watchdog/mtk_wdt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index e2d7a57d6ea2e..91d110646e16f 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -10,6 +10,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/mt7986-resets.h>
#include <dt-bindings/reset/mt8183-resets.h>
@@ -87,6 +88,10 @@ static const struct mtk_wdt_data mt2712_data = {
.toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM,
};
+static const struct mtk_wdt_data mt6735_data = {
+ .toprgu_sw_rst_num = MT6735_TOPRGU_RST_NUM,
+};
+
static const struct mtk_wdt_data mt6795_data = {
.toprgu_sw_rst_num = MT6795_TOPRGU_SW_RST_NUM,
};
@@ -489,6 +494,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,mt6735-wdt", .data = &mt6735_data },
{ .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
{ .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },
--
2.47.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
2024-11-06 10:47 ` [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Yassine Oudjana
@ 2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-06 14:57 ` Guenter Roeck
1 sibling, 0 replies; 8+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-11-06 12:31 UTC (permalink / raw)
To: Yassine Oudjana, Wim Van Sebroeck, Guenter Roeck,
Matthias Brugger
Cc: linux-watchdog, linux-kernel, linux-arm-kernel, linux-mediatek
Il 06/11/24 11:47, Yassine Oudjana ha scritto:
> Add support for the Top Reset Generation Unit/Watchdog Timer found on
> MT6735.
>
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart
2024-11-06 10:47 ` [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart Yassine Oudjana
@ 2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-07 10:40 ` Wim Van Sebroeck
2024-11-06 14:57 ` Guenter Roeck
1 sibling, 1 reply; 8+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-11-06 12:31 UTC (permalink / raw)
To: Yassine Oudjana, Wim Van Sebroeck, Guenter Roeck,
Matthias Brugger
Cc: linux-watchdog, linux-kernel, linux-arm-kernel, linux-mediatek
Il 06/11/24 11:47, Yassine Oudjana ha scritto:
> Clear the IRQ enable bit of WDT_MODE before asserting software reset
> in order to make TOPRGU issue a system reset signal instead of an IRQ.
>
> Fixes: a44a45536f7b ("watchdog: Add driver for Mediatek watchdog")
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
I'd be more comfortable with a title like:
watchdog: mediatek: Make sure system reset gets asserted in mtk_wdt_restart()
or along those lines, saying what's this commit about, because a generic
"fix" doesn't really mean anything...
About the commit description - that's good.
Btw, I wonder if maintainers can fix the title without you sending a v3...
Anyway - you can get my:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cheers!
Angelo
> ---
> drivers/watchdog/mtk_wdt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index c35f85ce8d69c..e2d7a57d6ea2e 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -225,9 +225,15 @@ static int mtk_wdt_restart(struct watchdog_device *wdt_dev,
> {
> struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
> void __iomem *wdt_base;
> + u32 reg;
>
> wdt_base = mtk_wdt->wdt_base;
>
> + /* Enable reset in order to issue a system reset instead of an IRQ */
> + reg = readl(wdt_base + WDT_MODE);
> + reg &= ~WDT_MODE_IRQ_EN;
> + writel(reg | WDT_MODE_KEY, wdt_base + WDT_MODE);
> +
> while (1) {
> writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
> mdelay(5);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart
2024-11-06 10:47 ` [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
@ 2024-11-06 14:57 ` Guenter Roeck
1 sibling, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2024-11-06 14:57 UTC (permalink / raw)
To: Yassine Oudjana, Wim Van Sebroeck, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-watchdog, linux-kernel, linux-arm-kernel, linux-mediatek
On 11/6/24 02:47, Yassine Oudjana wrote:
> Clear the IRQ enable bit of WDT_MODE before asserting software reset
> in order to make TOPRGU issue a system reset signal instead of an IRQ.
>
> Fixes: a44a45536f7b ("watchdog: Add driver for Mediatek watchdog")
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/mtk_wdt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index c35f85ce8d69c..e2d7a57d6ea2e 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -225,9 +225,15 @@ static int mtk_wdt_restart(struct watchdog_device *wdt_dev,
> {
> struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
> void __iomem *wdt_base;
> + u32 reg;
>
> wdt_base = mtk_wdt->wdt_base;
>
> + /* Enable reset in order to issue a system reset instead of an IRQ */
> + reg = readl(wdt_base + WDT_MODE);
> + reg &= ~WDT_MODE_IRQ_EN;
> + writel(reg | WDT_MODE_KEY, wdt_base + WDT_MODE);
> +
> while (1) {
> writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
> mdelay(5);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
2024-11-06 10:47 ` [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
@ 2024-11-06 14:57 ` Guenter Roeck
1 sibling, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2024-11-06 14:57 UTC (permalink / raw)
To: Yassine Oudjana, Wim Van Sebroeck, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-watchdog, linux-kernel, linux-arm-kernel, linux-mediatek
On 11/6/24 02:47, Yassine Oudjana wrote:
> Add support for the Top Reset Generation Unit/Watchdog Timer found on
> MT6735.
>
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/mtk_wdt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index e2d7a57d6ea2e..91d110646e16f 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -10,6 +10,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/mt7986-resets.h>
> #include <dt-bindings/reset/mt8183-resets.h>
> @@ -87,6 +88,10 @@ static const struct mtk_wdt_data mt2712_data = {
> .toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM,
> };
>
> +static const struct mtk_wdt_data mt6735_data = {
> + .toprgu_sw_rst_num = MT6735_TOPRGU_RST_NUM,
> +};
> +
> static const struct mtk_wdt_data mt6795_data = {
> .toprgu_sw_rst_num = MT6795_TOPRGU_SW_RST_NUM,
> };
> @@ -489,6 +494,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,mt6735-wdt", .data = &mt6735_data },
> { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
> { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
> { .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart
2024-11-06 12:31 ` AngeloGioacchino Del Regno
@ 2024-11-07 10:40 ` Wim Van Sebroeck
0 siblings, 0 replies; 8+ messages in thread
From: Wim Van Sebroeck @ 2024-11-07 10:40 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: Yassine Oudjana, Wim Van Sebroeck, Guenter Roeck,
Matthias Brugger, linux-watchdog, linux-kernel, linux-arm-kernel,
linux-mediatek
Hi Angelo, Yassine,
> Il 06/11/24 11:47, Yassine Oudjana ha scritto:
> >Clear the IRQ enable bit of WDT_MODE before asserting software reset
> >in order to make TOPRGU issue a system reset signal instead of an IRQ.
> >
> >Fixes: a44a45536f7b ("watchdog: Add driver for Mediatek watchdog")
> >Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
>
> I'd be more comfortable with a title like:
>
> watchdog: mediatek: Make sure system reset gets asserted in mtk_wdt_restart()
>
> or along those lines, saying what's this commit about, because a generic
> "fix" doesn't really mean anything...
>
> About the commit description - that's good.
> Btw, I wonder if maintainers can fix the title without you sending a v3...
I added it into linux-watchdog-next and changed the commit description whiledoing that.
Kind regards,
Wim.
>
> Anyway - you can get my:
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> Cheers!
> Angelo
>
> >---
> > drivers/watchdog/mtk_wdt.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> >diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> >index c35f85ce8d69c..e2d7a57d6ea2e 100644
> >--- a/drivers/watchdog/mtk_wdt.c
> >+++ b/drivers/watchdog/mtk_wdt.c
> >@@ -225,9 +225,15 @@ static int mtk_wdt_restart(struct watchdog_device *wdt_dev,
> > {
> > struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
> > void __iomem *wdt_base;
> >+ u32 reg;
> > wdt_base = mtk_wdt->wdt_base;
> >+ /* Enable reset in order to issue a system reset instead of an IRQ */
> >+ reg = readl(wdt_base + WDT_MODE);
> >+ reg &= ~WDT_MODE_IRQ_EN;
> >+ writel(reg | WDT_MODE_KEY, wdt_base + WDT_MODE);
> >+
> > while (1) {
> > writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
> > mdelay(5);
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-07 11:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06 10:47 [PATCH v2 0/2] MediaTek MT6735 TOPRGU/WDT support Yassine Oudjana
2024-11-06 10:47 ` [PATCH v2 1/2] watchdog: mediatek: Fix mtk_wdt_restart Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-07 10:40 ` Wim Van Sebroeck
2024-11-06 14:57 ` Guenter Roeck
2024-11-06 10:47 ` [PATCH v2 2/2] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Yassine Oudjana
2024-11-06 12:31 ` AngeloGioacchino Del Regno
2024-11-06 14:57 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).