summaryrefslogtreecommitdiff
path: root/drivers/watchdog/mtk_wdt.c
AgeCommit message (Collapse)Author
2021-11-10Merge tag 'linux-watchdog-5.16-rc1' of ↵Linus Torvalds
git://www.linux-watchdog.org/linux-watchdog Pull watchdog updates from Wim Van Sebroeck: - f71808e_wdt: convert to watchdog framework - db8500_wdt: Rename driver (was ux500_wdt.c) - sunxi: Add compatibles for R329 and D1 - mtk: add disable_wdt_extrst support - several other small fixes and improvements * tag 'linux-watchdog-5.16-rc1' of git://www.linux-watchdog.org/linux-watchdog: (30 commits) watchdog: db8500_wdt: Rename symbols watchdog: db8500_wdt: Rename driver watchdog: ux500_wdt: Drop platform data watchdog: bcm63xx_wdt: fix fallthrough warning watchdog: iTCO_wdt: No need to stop the timer in probe watchdog: s3c2410: describe driver in KConfig watchdog: sp5100_tco: Add support for get_timeleft watchdog: mtk: add disable_wdt_extrst support dt-bindings: watchdog: mtk-wdt: add disable_wdt_extrst support watchdog: rza_wdt: Use semicolons instead of commas watchdog: mlx-wdt: Use regmap_write_bits() watchdog: rti-wdt: Make use of the helper function devm_platform_ioremap_resource() watchdog: iTCO_wdt: Make use of the helper function devm_platform_ioremap_resource() watchdog: ar7_wdt: Make use of the helper function devm_platform_ioremap_resource_byname() watchdog: sunxi_wdt: Add support for D1 dt-bindings: watchdog: sunxi: Add compatibles for D1 ar7: fix kernel builds for compiler test dt-bindings: watchdog: sunxi: Add compatibles for R329 watchdog: meson_gxbb_wdt: add timeout parameter watchdog: meson_gxbb_wdt: add nowayout parameter ...
2021-10-26watchdog: mtk: add disable_wdt_extrst supportFengquan Chen
In some cases, we may need watchdog just to trigger an internal soc reset without sending any output signal. Provide a disable_wdt_extrst parameter for configuration. We can disable or enable it just by configuring dts. Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210914123454.32603-3-Fengquan.Chen@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2021-10-08arm64: dts: mediatek: Move reset controller constants into common locationEnric Balletbo i Serra
The DT binding includes for reset controllers are located in include/dt-bindings/reset/. Move the Mediatek reset constants in there. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20210930103105.v4.1.I514d9aafff3a062f751b37d3fea7402f67595b86@changeid Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2021-08-22watchdog: mediatek: mt8195: add wdt supportChristine Zhu
Support MT8195 watchdog device. Signed-off-by: Christine Zhu <Christine.Zhu@mediatek.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20210726122901.12195-4-Christine.Zhu@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2021-06-21watchdog: mtk: support pre-timeout when the bark irq is availableWang Qing
Use the bark interrupt as the pretimeout notifier if available. When the watchdog timer expires in dual mode, an interrupt will be triggered first, then the timing restarts. The reset signal will be initiated when the timer expires again. The pretimeout notification shall occur at timeout-sec/2. V2: - panic() by default if WATCHDOG_PRETIMEOUT_GOV is not enabled. V3: - Modify the pretimeout behavior, manually reset after the pretimeout - is processed and wait until timeout. V4: - Remove pretimeout related processing. - Add dual mode control separately. V5: - Fix some formatting and printing problems. V6: - Realize pretimeout processing through dualmode. V7: - Add set_pretimeout(). V8/V9: - Fix some formatting problems. Signed-off-by: Wang Qing <wangqing@vivo.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1619315527-8171-2-git-send-email-wangqing@vivo.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2021-02-07watchdog: mt8192: add wdt supportCrystal Guo
Add support for watchdog device found in MT8192 SoC Signed-off-by: Crystal Guo <crystal.guo@mediatek.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20201014131936.20584-5-crystal.guo@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2021-02-07watchdog: mtk_wdt: Remove mtk_wdt_stop() in probe() to prevent the system ↵freddy.hsin
freeze and it doesn't reboot by watchdog problem Before user space daemon start to access the watchdog device, there is a time interval that watchdog is disabled in the original flow. If the system freezing at this interval, it cannot be rebooted by watchdog hardware automatically. In order to solve this problem, the watchdog hardware should be kept working, and start hrtimer in framework to ping it by setting max_hw_heartbeat_ms and HW_RUNNING used in watchdog_need_worker to determine whether the worker should be started or not. Besides the redundant setting of max_timeout is also removed. Signed-off-by: freddy.hsin <freddy.hsin@mediatek.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1609316157-3748-1-git-send-email-freddy.hsin@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2020-01-27watchdog: mtk_wdt: mt2712: Add reset controlleryong.liang
Add reset controller for 2712. Besides watchdog, MTK toprgu module alsa provide sub-system (eg, audio, camera, codec and connectivity) software reset functionality. Signed-off-by: yong.liang <yong.liang@mediatek.com> Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20200115085828.27791-5-yong.liang@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2020-01-27watchdog: mtk_wdt: mt8183: Add reset controlleryong.liang
Add reset controller API in watchdog driver. Besides watchdog, MTK toprgu module alsa provide sub-system (eg, audio, camera, codec and connectivity) software reset functionality. Signed-off-by: yong.liang <yong.liang@mediatek.com> Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20200115085828.27791-4-yong.liang@mediatek.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2019-05-05watchdog: mtk_wdt: Convert to use device managed functions and other ↵Guenter Roeck
improvements Use device managed functions to simplify error handling, reduce source code size, improve readability, and reduce the likelyhood of bugs. Other improvements as listed below. The conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches - Drop assignments to otherwise unused variables - Drop empty remove function - Introduce local variable 'struct device *dev' and use it instead of dereferencing it repeatedly - Use devm_watchdog_register_driver() to register watchdog device - Replace shutdown function with call to watchdog_stop_on_reboot() Cc: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2019-05-05watchdog: Convert to use devm_platform_ioremap_resourceGuenter Roeck
Use devm_platform_ioremap_resource to reduce source code size, improve readability, and reduce the likelyhood of bugs. The conversion was done automatically with coccinelle using the following semantic patch. @r@ identifier res, pdev; expression a; expression index; expression e; @@ <+... - res = platform_get_resource(pdev, IORESOURCE_MEM, index); - a = devm_ioremap_resource(e, res); + a = devm_platform_ioremap_resource(pdev, index); ...+> @depends on r@ identifier r.res; @@ - struct resource *res; ... when != res @@ identifier res, pdev; expression index; expression a; @@ - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, index); - a = devm_ioremap_resource(&pdev->dev, res); + a = devm_platform_ioremap_resource(pdev, index); Cc: Joel Stanley <joel@jms.id.au> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Keguang Zhang <keguang.zhang@gmail.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Avi Fishman <avifishman70@gmail.com> Cc: Nancy Yuen <yuenn@google.com> Cc: Brendan Higgins <brendanhiggins@google.com> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Kukjin Kim <kgene@kernel.org> Cc: Barry Song <baohua@kernel.org> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Chen-Yu Tsai <wens@csie.org> Cc: Marc Gonzalez <marc.w.gonzalez@free.fr> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Acked-by: Michal Simek <michal.simek@xilinx.com> (cadence/xilinx wdts) Acked-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2018-03-24watchdog: add SPDX identifiers for watchdog subsystemMarcus Folkesson
- Add SPDX identifier - Remove boiler plate license text - If MODULE_LICENSE and boiler plate does not match, go for boiler plate license Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Acked-by: Keiji Hayashibara <hayashibara.keiji@socionext.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Mans Rullgard <mans@mansr.com> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2018-03-03watchdog: mtk: allow setting timeout in devicetreeMarcus Folkesson
watchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout. By following best practice described in Documentation/watchdog/watchdog-kernel-api.txt, it also let us to set timout-sec property in devicetree. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2016-03-01watchdog: Add 'action' and 'data' parameters to restart handler callbackGuenter Roeck
The 'action' (or restart mode) and data parameters may be used by restart handlers, so they should be passed to the restart callback functions. Cc: Sylvain Lemieux <slemieux@tycoint.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-12-13watchdog: mtk_wdt: use core restart handlerDamien Riegel
Get rid of the custom restart handler by using the one provided by the watchdog core. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-11-23watchdog: mtk_wdt: Use MODE_KEY when stopping the watchdogNicolas Boichat
WDT_MODE value need to be or-ed with MODE_KEY when setting watchdog mode. Add it to mtk_wdt_stop function, so that the watchdog can be stopped (e.g. during suspend). Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09watchdog: mtk_wdt: add wdt shutdown callback to disable wdt if enabledGreta Zhang
Without .shutdown(), watchdog might reset the system during power off. For example, if watchdog's timeout is set to 30s, then it is reset to zero by mtk_wdt_ping(). During power off, no app will ping watchdog, but watchdog is still running and may trigger reset. Signed-off-by: Greta Zhang <greta.zhang@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09watchdog: mtk_wdt: add suspend/resume supportGreta Zhang
add mediatek watchdog driver suspend/resume support Signed-off-by: Greta Zhang <greta.zhang@mediatek.com> Signed-off-by: Roger Lu <roger.lu@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-03-27watchdog: mtk_wdt: signedness bug in mtk_wdt_start()Dan Carpenter
"ret" should be signed for the error handling to work correctly. This doesn't matter much in real life since mtk_wdt_set_timeout() always succeeds. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-02-17watchdog: Add driver for Mediatek watchdogMatthias Brugger
This patch adds a driver for the Mediatek SoC integrated watchdog. This driver supports watchdog and software reset for mt65xx and mt81xx SoCs. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Tested-by: Eddie Huang <eddie.huang@mediatek.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>