History log of /linux-master/drivers/watchdog/s3c2410_wdt.c
Revision Date Author Comments
# 746f0770 20-Feb-2024 Peter Griffin <peter.griffin@linaro.org>

watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs

Obtain the PMU regmap using the new API added to exynos-pmu driver rather
than syscon_regmap_lookup_by_phandle(). As this driver no longer depends
on mfd syscon remove that header and Kconfig dependency.

Tested-by: Alexey Klimov <alexey.klimov@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20240220220613.797068-3-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


# 796bb2d3 11-Dec-2023 Peter Griffin <peter.griffin@linaro.org>

watchdog: s3c2410_wdt: Add support for Google gs101 SoC

This patch adds the compatibles and drvdata for the Google
gs101 SoC found in Pixel 6, Pixel 6a & Pixel 6 pro phones.

Similar to Exynos850 it has two watchdog instances, one for
each cluster and has some control bits in PMU registers.

gs101 also has the dbgack_mask bit in wtcon register, so
we also enable QUIRK_HAS_DBGACK_BIT.

Tested-by: Will McVicker <willmcvicker@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20231211162331.435900-13-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


# d429928d 11-Dec-2023 Peter Griffin <peter.griffin@linaro.org>

watchdog: s3c2410_wdt: Update QUIRK macros to use BIT macro

Update the remaining QUIRK macros to use the BIT macro.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20231211162331.435900-12-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


# 6584cd34 11-Dec-2023 Peter Griffin <peter.griffin@linaro.org>

watchdog: s3c2410_wdt: Add support for WTCON register DBGACK_MASK bit

The WDT uses the CPU core signal DBGACK to determine whether the SoC
is running in debug mode or not. If the DBGACK signal is asserted and
DBGACK_MASK bit is enabled, then WDT output and interrupt is masked
(disabled).

Presence of the DBGACK_MASK bit is determined by adding a new
QUIRK_HAS_DBGACK_BIT quirk. Also update to use BIT macro to avoid
checkpatch --strict warnings.

Tested-by: Will McVicker <willmcvicker@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20231211162331.435900-11-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


# aeb3ef51 05-Jul-2023 Chengfeng Ye <dg573847474@gmail.com>

watchdog: s3c2410: Fix potential deadlock on &wdt->lock

As &wdt->lock is acquired by hard irq s3c2410wdt_irq(),
other acquisition of the same lock under process context should
disable irq, otherwise deadlock could happen if the
irq preempt the execution while the lock is held in process context
on the same CPU.

[Deadlock Scenario]
s3c2410wdt_suspend()
-> s3c2410wdt_stop()
-> spin_lock(&wdt->lock)
<irq iterrupt>
-> s3c2410wdt_irq()
-> s3c2410wdt_keepalive()
-> spin_lock(&wdt->lock) (deadlock here)

[Deadlock Scenario]
s3c2410wdt_probe()
-> s3c2410wdt_start()
-> spin_lock(&wdt->lock)
<irq iterrupt>
-> s3c2410wdt_irq()
-> s3c2410wdt_keepalive()
-> spin_lock(&wdt->lock) (deadlock here)

[Deadlock Scenario]
s3c2410wdt_keepalive()
-> spin_lock(&wdt->lock)
<irq iterrupt>
-> s3c2410wdt_irq()
-> s3c2410wdt_keepalive()
-> spin_lock(&wdt->lock) (deadlock here)

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock, which reported the above
warning when analyzing the linux kernel 6.4-rc7 release.

The tentative patch fix the potential deadlock by spin_lock_irqsave()
under process context.

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230705090951.63762-1-dg573847474@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# cc85f87a 26-Jul-2023 Rob Herring <robh@kernel.org>

watchdog: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230726233302.3812749-1-robh@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# fc0c5db5 21-Mar-2023 Tom Rix <trix@redhat.com>

watchdog: s3c2410: remove unused freq_to_wdt and s3c2410wdt_is_running functions

clang with W=1 reports
drivers/watchdog/s3c2410_wdt.c:311:35: error: unused function
'freq_to_wdt' [-Werror,-Wunused-function]
static inline struct s3c2410_wdt *freq_to_wdt(struct notifier_block *nb)
^
drivers/watchdog/s3c2410_wdt.c:446:19: error: unused function
's3c2410wdt_is_running' [-Werror,-Wunused-function]
static inline int s3c2410wdt_is_running(struct s3c2410_wdt *wdt)
^
These functions are not used, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230321183439.1826823-1-trix@redhat.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# e0e0ee02 06-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

watchdog: s3c2410_wdt: Simplify using dev_err_probe()

Make use of dev_err_probe() also for error paths that don't have to
handle -EPROBE_DEFER. While the code handing -EPROBE_DEFER isn't used
for these error paths, it still simpler as it cares for pretty printing
the error code and usually needs one code line less as it combines
message emitting and error returning. This also unifies the format of
the error messages.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230307065603.2253054-3-u.kleine-koenig@pengutronix.de
[groeck: Split long line to avoid checkpatch warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 16d477a1 06-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

watchdog: s3c2410: Make s3c2410_get_wdt_drv_data() return an int

This is a preparation for making more use of dev_err_probe(). The idea
is that s3c2410_get_wdt_drv_data() (as it's called only by .probe()) can
make effective use of dev_err_probe() only if it returns an int. For
that the assignment to wdt->drv_data has to happen in the function. The
caller can then just pass on the return value in the error case.

This seems to be nicer for the compiler: bloatometer reports for an
ARCH=arm s3c6400_defconfig build:

add/remove: 1/1 grow/shrink: 0/1 up/down: 4/-64 (-60)
Function old new delta
__initcall__kmod_s3c2410_wdt__209_821_s3c2410wdt_driver_init6 - 4 +4
__initcall__kmod_s3c2410_wdt__209_819_s3c2410wdt_driver_init6 4 - -4
s3c2410wdt_probe 1332 1272 -60

There is no semantical change. (Just one minor difference: Before this
patch wdt->drv_data was always assigned, now that only happens in the
non-error case. That doesn't matter however as *wdt is freed in the
error case.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230307065603.2253054-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 89baf252 04-Mar-2023 Guenter Roeck <linux@roeck-us.net>

watchdog: s3c2410_wdt: Use devm_add_action_or_reset() to disable watchdog

Use devm_add_action_or_reset() to disable the watchdog when the driver
is removed to simplify the code. With this in place, we can use
devm_watchdog_register_device() to register the watchdog, and the removal
function is no longer necessary.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230304165653.2179835-2-linux@roeck-us.net
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 9b31b1ea 04-Mar-2023 Guenter Roeck <linux@roeck-us.net>

watchdog: s3c2410_wdt: Use devm_clk_get[_optional]_enabled() helpers

The devm_clk_get[_optional]_enabled() helpers:
- call devm_clk_get[_optional]()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

While at it, use dev_err_probe consistently, and use its return value
to return the error code.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230304165653.2179835-1-linux@roeck-us.net
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 1ea35b35 29-Sep-2022 Arnd Bergmann <arnd@arndb.de>

ARM: s3c: remove s3c24xx specific hacks

A number of device drivers reference CONFIG_ARM_S3C24XX_CPUFREQ or
similar symbols that are no longer available with the platform gone,
though the drivers themselves are still used on newer platforms,
so remove these hacks.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# 0c91aa18 20-May-2022 Chanho Park <chanho61.park@samsung.com>

watchdog: s3c2410_wdt: support exynosautov9 watchdog

Like exynos850, exynosautov9 SoC also has two cpu watchdogs.
Unfortunately, some configurations are slightly different so we need to
add samsung,exynosautov9-wdt and separate drv data for those watchdogs.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220520121750.71473-3-chanho61.park@samsung.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# aa55761a 28-Jun-2022 Paul Cercueil <paul@crapouillou.net>

watchdog: s3c2410_wdt: Remove #ifdef guards for PM related functions

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to
handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards. Not using #ifdef guards means that the code is
always compiled independently of any Kconfig option, and thanks to that
bugs and regressions are easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220628193449.160585-5-paul@crapouillou.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# f7bcb023 12-Dec-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Fix getting the optional clock

"watchdog_src" clock is optional and may not be present for some SoCs
supported by this driver. Nevertheless, in case the clock is provided
but some error happens during its getting, that error should be handled
properly. Use devm_clk_get_optional() API for that. Also report possible
errors using dev_err_probe() to handle properly -EPROBE_DEFER error (if
clock provider is not ready by the time WDT probe function is executed).

Fixes: e249d01b5e8b ("watchdog: s3c2410: Support separate source clock")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20211212170247.30646-1-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# a51f5896 16-Dec-2021 Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

watchdog: s3c2410: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypassed the hierarchical setup and messed up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20211216214747.10454-1-prabhakar.mahadev-lad.rj@bp.renesas.com
[groeck: Fixed context conflicts]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# cd4eadf2 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Add Exynos850 support

Exynos850 is a bit different from SoCs already supported in WDT driver:
- AUTOMATIC_WDT_RESET_DISABLE register is removed, so its value is
always 0; .disable_auto_reset callback is not set for that reason
- MASK_WDT_RESET_REQUEST register is replaced with
CLUSTERx_NONCPU_IN_EN register; instead of masking (disabling) WDT
reset interrupt it's now enabled with the same value; .mask_reset
callback is reused for that functionality though
- To make WDT functional, WDT counter needs to be enabled in
CLUSTERx_NONCPU_OUT register; it's done using .enable_counter
callback

Also Exynos850 has two CPU clusters, each has its own dedicated WDT
instance. Different PMU registers and bits are used for each cluster. So
driver data is now modified in probe, adding needed info depending on
cluster index passed from device tree.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211121165647.26706-13-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 1a47cda0 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Remove superfluous err label

'err' label in probe function is not really need, it just returns.
Remove it and replace all 'goto' statements with actual returns in
place.

No functional change here, just a cleanup patch.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-12-semen.protsenko@linaro.org
[groeck: Fixed context conflicts]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# e249d01b 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Support separate source clock

Right now all devices supported in the driver have the single clock: it
acts simultaneously as a bus clock (providing register interface
clocking) and source clock (driving watchdog counter). Some newer Exynos
chips, like Exynos850, have two separate clocks for that. In that case
two clocks will be passed to the driver from the resource provider, e.g.
Device Tree. Provide necessary infrastructure to support that case:
- use source clock's rate for all timer related calculations
- use bus clock to gate/ungate the register interface

All devices that use the single clock are kept intact: if only one clock
is passed from Device Tree, it will be used for both purposes as before.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-11-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# cf3fad4e 23-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Cleanup PMU related code

Now that PMU enablement code was extended for new Exynos SoCs, it
doesn't look very cohesive and consistent anymore. Do a bit of renaming,
grouping and style changes, to make it look good again. While at it, add
quirks documentation as well.

No functional change, just a refactoring commit.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211123232613.22438-1-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# aa220bc6 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Add support for WDT counter enable register

On new Exynos chips (e.g. Exynos850) new CLUSTERx_NONCPU_OUT register is
introduced, where CNT_EN_WDT bit must be enabled to make watchdog
counter running. Add corresponding quirk and proper infrastructure to
handle that register if the quirk is set.

This commit doesn't bring any functional change to existing devices, but
merely provides an infrastructure for upcoming chips support.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-9-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 370bc7f5 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Implement a way to invert mask reg value

On new Exynos chips (like Exynos850) the MASK_WDT_RESET_REQUEST register
is replaced with CLUSTERx_NONCPU_INT_EN, and its mask bit value meaning
was reversed: for new register the bit value "1" means "Interrupt
enabled", while for MASK_WDT_RESET_REQUEST register "1" means "Mask the
interrupt" (i.e. "Interrupt disabled").

Introduce "mask_reset_inv" boolean field in driver data structure; when
that field is "true", mask register handling function will invert the
value before setting it to the register.

This commit doesn't bring any functional change to existing devices, but
merely provides an infrastructure for upcoming chips support.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-8-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 2bd33bb4 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Extract disable and mask code into separate functions

The s3c2410wdt_mask_and_disable_reset() function content is bound to be
changed further. Prepare it for upcoming changes by splitting into
separate "mask reset" and "disable reset" functions. But keep
s3c2410wdt_mask_and_disable_reset() function present as a facade.

This commit doesn't bring any functional change to existing devices, but
merely provides an infrastructure for upcoming chips support.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-7-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 8d9fdf60 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Make reset disable register optional

On new Exynos chips (e.g. Exynos850 and Exynos9) the
AUTOMATIC_WDT_RESET_DISABLE register was removed, and its value can be
thought of as "always 0x0". Add correspondig quirk bit, so that the
driver can omit accessing it if it's not present.

This commit doesn't bring any functional change to existing devices, but
merely provides an infrastructure for upcoming chips support.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-6-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# a90102e3 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Let kernel kick watchdog

When "tmr_atboot" module param is set, the watchdog is started in
driver's probe. In that case, also set WDOG_HW_RUNNING bit to let
watchdog core driver know it's running. This way watchdog core can kick
the watchdog for us (if CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED option is
enabled), until user space takes control.

WDOG_HW_RUNNING bit must be set before registering the watchdog. So the
"tmr_atboot" handling code is moved before watchdog registration, to
avoid performing the same check twice. This is also logical because
WDOG_HW_RUNNING bit makes WDT core expect actually running watchdog.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-5-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# f197d475 21-Nov-2021 Sam Protsenko <semen.protsenko@linaro.org>

watchdog: s3c2410: Fail probe if can't find valid timeout

Driver can't work properly if there no valid timeout was found in
s3c2410wdt_set_heartbeat(). Ideally, that function should be reworked in
a way that it's always able to find some valid timeout. As a temporary
solution let's for now just fail the driver probe in case the valid
timeout can't be found in s3c2410wdt_set_heartbeat() function.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20211107202943.8859-4-semen.protsenko@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 386f465a 18-May-2019 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: s3c2410_wdt: drop warning after registering device

The core will print out details now.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# c942fddf 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157

Based on 3 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1105 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0f0a6a28 02-Apr-2019 Guenter Roeck <linux@roeck-us.net>

watchdog: Convert to use devm_platform_ioremap_resource

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>


# 08497f22 13-Mar-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Minor code cleanup

Cleanup the code from minor readability issues (no functional changes):
1. Fix checkpatch: ERROR: Do not include the paragraph about writing to
the Free Software Foundation's mailing address.
2. Fix checkpatch: WARNING: quoted string split across lines
3. Fix chechpatch: WARNING: Prefer 'unsigned int' to bare use of
'unsigned'
4. Use 'dev' consistently in probe function instead of mixing dev with
&pdev->dev.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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>


# a9a02c46 13-Mar-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Simplify getting driver data

Simplify the flow in helper function for getting the driver data by
using of_device_get_match_data() and only one if() branch.

The code should be equivalent.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
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>


# 58415efe 13-Mar-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Constify local structures

Structures watchdog_device, watchdog_ops and s3c2410_wdt_variant are not
modified so they can be made const to increase code safeness.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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>


# e3a60ead 24-Feb-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Add prefix to local function

Functions marked static inline might not be inlined so a driver-specific
prefix for function name helps when looking through call backtrace.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 456f53d6 24-Feb-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Use dev_dbg instead of pr_info

Replace the 'debug' module parameter and pr_info() with proper device
dynamic debug calls because this is the preferred and flexible way of
enabling debugging printks.

Also remove some obvious debug printks.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 0b445549 24-Feb-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Fix infinite interrupt in soft mode

In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
of an interrupt. However the interrupt itself was not cleared thus on
first hit, the system enters infinite interrupt handling loop.

On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
argument the console is flooded:
# killall -9 watchdog
[ 60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
[ 60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)

Fix this by writing something to the WTCLRINT register to clear the
interrupt. The register WTCLRINT however appeared in S3C6410 so a new
watchdog quirk and flavor are needed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 4f21195d 24-Feb-2017 Krzysztof Kozlowski <krzk@kernel.org>

watchdog: s3c2410: Remove confusing CONFIG prefix from local defines

The CONFIG prefix from defines in the s3c2410_wdt.c might suggest that
these constants come from Kconfig.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# b893e344 28-Jan-2017 Bhumika Goyal <bhumirks@gmail.com>

watchdog: constify watchdog_ops structures

Declare watchdog_ops structures as const as they are only stored in the
ops field of a watchdog_device structure. This field is of type const, so
watchdog_ops structures having this property can be made const too.
Done using Coccinelle:

@r disable optional_qualifier@
identifier x;
position p;
@@
static struct watchdog_ops x@p={...};

@ok@
struct watchdog_device w;
identifier r.x;
position p;
@@
w.ops=&x@p;

@bad@
position p != {r.p,ok.p};
identifier r.x;
@@
x@p

@depends on !bad disable optional_qualifier@
identifier r.x;
@@
+const
struct watchdog_ops x;

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

text data bss dec hex filename

1340 544 0 1884 75c drivers/watchdog/bcm_kona_wdt.o
1436 440 0 1876 754 drivers/watchdog/bcm_kona_wdt.o

1176 544 4 1724 6bc drivers/watchdog/digicolor_wdt.o
1272 440 4 1716 6b4 drivers/watchdog/digicolor_wdt.o

925 580 89 1594 63a drivers/watchdog/ep93xx_wdt.o
1021 476 89 1586 632 drivers/watchdog/ep93xx_wdt.o

4932 288 17 5237 1475 drivers/watchdog/s3c2410_wdt.o
5028 192 17 5237 1475 drivers/watchdog/s3c2410_wdt.o

1977 292 1 2270 8de drivers/watchdog/sama5d4_wdt.o
2073 196 1 2270 8de drivers/watchdog/sama5d4_wdt.o

1375 484 1 1860 744 drivers/watchdog/sirfsoc_wdt.o
1471 380 1 1852 73c drivers/watchdog/sirfsoc_wdt.o

Size remains the same for the files drivers/watchdog/diag288_wdt.o
drivers/watchdog/asm9260_wdt.o and drivers/watchdog/atlas7_wdt.o

The following .o files did not compile:
drivers/watchdog/sun4v_wdt.o, drivers/watchdog/sbsa_gwdt.o,
drivers/watchdog/rt2880_wdt.o, drivers/watchdog/booke_wdt.o
drivers/watchdog/mt7621_wdt.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 882dec1f 01-Mar-2016 Javier Martinez Canillas <javier@osg.samsung.com>

watchdog: s3c2410_wdt: Add max and min timeout values

The watchdog maximum timeout value is determined by the number of bits
for the interval timer counter, its source clock frequency, the number
of bits of the prescaler and maximum divider value.

This can be calculated with the following equation:

max_timeout = counter / (freq / (max_prescale + 1) / max_divider)

Setting a maximum timeout value will allow the watchdog core to refuse
user-space calls to the WDIOC_SETTIMEOUT ioctl that sets not supported
timeout values.

For example, systemd tries to set a timeout of 10 minutes on reboot to
ensure that the machine will be rebooted even if a reboot failed. This
leads to the following error message on an Exynos5422 Odroid XU4 board:

[ 147.986045] s3c2410-wdt 101d0000.watchdog: timeout 600 too big

Reported-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 4d8b229d 26-Feb-2016 Guenter Roeck <linux@roeck-us.net>

watchdog: Add 'action' and 'data' parameters to restart handler callback

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>


# c71f5cd2 15-Nov-2015 Damien Riegel <damien.riegel@savoirfairelinux.com>

watchdog: s3c2410_wdt: use core restart handler

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>


# 6551881c 20-Aug-2015 Pratyush Anand <panand@redhat.com>

Watchdog: Fix parent of watchdog_devices

/sys/class/watchdog/watchdogn/device/modalias can help to identify the
driver/module for a given watchdog node. However, many wdt devices do not
set their parent and so, we do not see an entry for device in sysfs for
such devices.

This patch fixes parent of watchdog_device so that
/sys/class/watchdog/watchdogn/device is populated.

Exceptions: booke, diag288, octeon, softdog and w83627hf -- They do not
have any parent. Not sure, how we can identify driver for these devices.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 5476b2b7 17-Oct-2014 Abhilash Kesavan <a.kesavan@samsung.com>

watchdog: s3c2410_wdt: Fix the mask bit offset for Exynos7

The watchdog mask bit offset listed for Exynos7 is incorrect.
Fix this.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Acked-by: Naveen Krishna Chatradhi <naveenkrishna.ch@gmail.com
Reviewd-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# f286e133 19-Aug-2014 Heiko Stuebner <heiko@sntech.de>

watchdog: s3c2410: add restart handler

On a lot of Samsung systems the watchdog is responsible for restarting the
system and until now this code was contained in plat-samsung/watchdog-reset.c.

With the introduction of the restart handlers, this code can now move into
driver itself, removing the need for arch-specific code.

Tested on a S3C2442 based GTA02

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# 2b9366b6 27-Aug-2014 Naveen Krishna Chatradhi <ch.naveen@samsung.com>

watchdog: s3c2410_wdt: Add support for Watchdog device on Exynos7

Exynos7 SoC has a Watchdog for Atlas (A57) cores
This patch adds support for the Atlas watchdog.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# fa21a580 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

watchdog: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 01b6af91 04-Mar-2014 Sachin Kamat <sachin.kamat@linaro.org>

watchdog: s3c2410_wdt: Check return value of clk_prepare_enable

clk_prepare_enable can fail. Check its return value.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# a94dd879 04-Mar-2014 Sachin Kamat <sachin.kamat@linaro.org>

watchdog: s3c2410_wdt: Remove unneeded initialization

Initializing clk to NULL as a reset/error condition does not
help as NULL is not an invalid condition w.r.t clk. Remove this
initialization altogether as there is no state retention.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 8126334b 21-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

watchdog: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org


# cffc9a60 06-Dec-2013 Doug Anderson <dianders@chromium.org>

watchdog: s3c2410_wdt: Report when the watchdog reset the system

A good watchdog driver is supposed to report when it was responsible
for resetting the system. Implement this for the s3c2410, at least on
exynos5250 and exynos5420 where we already have a pointer to the PMU
registers to read the information.

Note that exynos4 SoCs also provide the reset status, but providing
that is left as an exercise for future changes and is not plumbed up
in this patch series. Also note the exynos4 SoCs don't appear to need
any PMU config, which is why this patch separates the concepts of
having PMU Registers vs. needing PMU Config.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 4f1f653a 05-Dec-2013 Leela Krishna Amudala <l.krishna@samsung.com>

watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register

Add device tree support for exynos5250 and 5420 SoCs and use syscon regmap interface
to configure AUTOMATIC_WDT_RESET_DISABLE and MASK_WDT_RESET_REQUEST registers of PMU
to mask/unmask enable/disable of watchdog in probe and s2r scenarios.

Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 17862440 26-Nov-2013 Doug Anderson <dianders@chromium.org>

watchdog: s3c2410_wdt: Handle rounding a little better for timeout

The existing watchdog timeout worked OK but didn't deal with
rounding in an ideal way when dividing out all of its clocks.

Specifically if you had a timeout of 32 seconds and an input clock of
66666666, you'd end up setting a timeout of 31.9998 seconds and
reporting a timeout of 31 seconds.

Specifically DBG printouts showed:
s3c2410wdt_set_heartbeat: count=16666656, timeout=32, freq=520833
s3c2410wdt_set_heartbeat: timeout=32, divisor=255, count=16666656 (0000ff4f)
and the final timeout reported to the user was:
((count / divisor) * divisor) / freq
(0xff4f * 255) / 520833 = 31 (truncated from 31.9998)
the technically "correct" value is:
(0xff4f * 255) / (66666666.0 / 128) = 31.9998

By using "DIV_ROUND_UP" we can be a little more correct.
s3c2410wdt_set_heartbeat: count=16666688, timeout=32, freq=520834
s3c2410wdt_set_heartbeat: timeout=32, divisor=255, count=16666688 (0000ff50)
and the final timeout reported to the user:
(0xff50 * 255) / 520834 = 32
the technically "correct" value is:
(0xff50 * 255) / (66666666.0 / 128) = 32.0003

We'll use a DIV_ROUND_UP to solve this, generally erroring on the side
of reporting shorter values to the user and setting the watchdog to
slightly longer than requested:
* Round input frequency up to assume watchdog is counting faster.
* Round divisions by divisor up to give us extra time.

At the same time we can avoid a for loop by just doing the right math.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0f1dd98d 25-Nov-2013 Doug Anderson <dianders@chromium.org>

watchdog: s3c2410_wdt: Only register for cpufreq on ARM_S3C24XX_CPUFREQ

On modern SoCs the watchdog timer is parented on a clock that doesn't
change every time we have a cpufreq change. That means we don't need
to constantly adjust the watchdog timer, so avoid registering for and
dealing with cpufreq transitions unless we've actually got
CONFIG_ARM_S3C24XX_CPUFREQ defined.

Note that this is more than just an optimization. The s3c2410
watchdog driver actually pats the watchdog on every CPU frequency
change. On modern systems these happen many times per second (even in
a system where "nothing" is happening). That effectively makes any
userspace watchdog program useless (the watchdog is constantly patted
by the kernel). If we need ARM_S3C24XX_CPUFREQ defined on a
multiplatform kernel we'll need to make sure that kernel supports
common clock and change this to user common clock framework.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 487722cf 21-Oct-2013 Jean Delvare <jdelvare@suse.de>

watchdog: Get rid of MODULE_ALIAS_MISCDEV statements

I just can't find any value in MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR)
and MODULE_ALIAS_MISCDEV(TEMP_MINOR) statements.

Either the device is enumerated and the driver already has a module
alias (e.g. PCI, USB etc.) that will get the right driver loaded
automatically.

Or the device is not enumerated and loading its driver will lead to
more or less intrusive hardware poking. Such hardware poking should be
limited to a bare minimum, so the user should really decide which
drivers should be tried and in what order. Trying them all in
arbitrary order can't do any good.

On top of that, loading that many drivers at once bloats the kernel
log. Also many drivers will stay loaded afterward, bloating the output
of "lsmod" and wasting memory. Some modules (cs5535_mfgpt which gets
loaded as a dependency) can't even be unloaded!

If defining char-major-10-130 is needed then it should happen in
user-space.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: Jim Cromie <jim.cromie@gmail.com>


# bd5cc119 14-Aug-2013 Julia Lawall <Julia.Lawall@lip6.fr>

watchdog: s3c2410_wdt: simplify use of devm_ioremap_resource

Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.

Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more clear.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# af4ea631 27-Aug-2013 Leela Krishna Amudala <l.krishna@samsung.com>

watchdog: s3c2410_wdt: remove the global variables

This patch removes the global variables in the driver file and
group them into a structure.

Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0183984c 13-Mar-2013 Jingoo Han <jg1.han@samsung.com>

watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 3828924a 13-Mar-2013 Jingoo Han <jg1.han@samsung.com>

watchdog: s3c2410_wdt: use dev_err()/dev_info() instead of pr_err()/pr_info()

dev_err()/dev_info() are more preferred than pr_err()/pr_info().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# a8f5401a 17-Jun-2013 Tomasz Figa <tomasz.figa@gmail.com>

watchdog: s3c2410_wdt: Use local register definitions

This patch moves register and bitfield definitions to the driver itself,
removing remaining dependencies on plat/ and mach/ headers.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>


# 6330c707 03-Mar-2013 Sachin Kamat <sachin.kamat@linaro.org>

watchdog: Convert to devm_ioremap_resource()

Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Gabor Juhos <juhosg@openwrt.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# c1fd5f64 14-Feb-2013 Fabio Porcedda <fabio.porcedda@gmail.com>

watchdog: add timeout-sec property binding

this patchset add the timeout-sec property to the following drivers:
orion_wdt, pnx4008_wdt, s3c2410_wdt and at91sam9_wdt.

The at91sam9_wdt is tested on evk-pr3,
the other drivers are compile tested only.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Masanari Iida <standby24x7@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Andrew Victor <linux@maxim.org.za>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 04ecc7dc 09-Jan-2013 Jingoo Han <jg1.han@samsung.com>

watchdog: s3c2410_wdt: Use devm_* functions

Use devm_* functions to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 50d854c8 02-Oct-2012 Thomas Abraham <thomas.abraham@linaro.org>

watchdog: s3c2410_wdt: use clk_prepare_enable and clk_disable_unprepare

Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
calls as required by common clock framework.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 4b12b896 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

watchdog: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d991a16 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

watchdog: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 82268714 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

watchdog: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6b761b29 12-Jul-2012 Sachin Kamat <sachin.kamat@linaro.org>

watchdog: s3c2410_wdt: Use module_platform_driver()

module_platform_driver() replaces module_init() and module_exit()
and makes the code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 5f2430f5 10-May-2012 Hans de Goede <hdegoede@redhat.com>

watchdog: s3c2410_wdt: Set timeout to actually achieved timeout

While rebasing my "watchdog_dev: Let the driver update the timeout field on
set_timeout success" patch (before I noticed it was already picked up by Wim),
I noticed that the s3c2410_wdt driver may not always have a 1 second
resolution, this patch changes s3c2410wdt_set_heartbeat to update the
timeout to the actually achieved timeout.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 3016a552 02-May-2012 Wim Van Sebroeck <wim@iguana.be>

watchdog: s3c2410-wdt: Use of_match_ptr().

Use of_match_ptr definition for the of_match_table.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>


# ccd4144d 16-Mar-2012 Jaehoon Chung <jh80.chung@samsung.com>

watchdog: fix compiler error for missing parenthesis

Joe's patch(watchdog: Use pr_<fmt> and pr_<level>) missed parenthesis in s3c2410_wdt.c.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0197c1c4 29-Feb-2012 Wim Van Sebroeck <wim@iguana.be>

watchdog: fix set_timeout operations

Since we changed the behaviour of the set_timeout operation in the
watchdog API, we need to change the allready converted drivers so
that they update the timeout field at the end of the set_timeout
operation.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 86a1e189 05-Mar-2012 Wim Van Sebroeck <wim@iguana.be>

watchdog: nowayout is bool

nowayout is actually a boolean value.
So make it bool for all watchdog device drivers.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 27c766aa 15-Feb-2012 Joe Perches <joe@perches.com>

watchdog: Use pr_<fmt> and pr_<level>

Use the current logging styles.

Make sure all output has a prefix.
Add missing newlines.
Remove now unnecessary PFX, NAME, and miscellaneous other #defines.
Coalesce formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 78d3e00b 12-Jan-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

watchdog: fix error in probe() of s3c2410_wdt (reset at booting)

Probe function of s3c2410 watchdog calls request_irq before initializing
required value (wdt_count). This incurs resetting watchdog counter value
and watchdog-reboot during booting up.

This patch addresses such an issue by calling request_irq later.

Error handling in probe function and calling oder in remove function are
also revised accordingly.

Reported-by: Chanwoo Park <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# ff0b3cd4 29-Nov-2011 Wim Van Sebroeck <wim@iguana.be>

watchdog: add nowayout helpers to Watchdog Timer Driver Kernel API

Add two nowayout helpers for the Watchdog Timer Driver Kernel API.
And apply this to the already converted drivers.
Note: s3c2410_wdt lost the nowayout feature during the conversion.

Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 20403e84 15-Nov-2011 Dmitry Artamonow <mad_soft@inbox.ru>

watchdog: fix initialisation printout in s3c2410_wdt

Looks like a typo creeped in, and driver prints
s3c2410-wdt s3c2410-wdt: watchdog active, reset abled, irq abled

instead of
s3c2410-wdt s3c2410-wdt: watchdog active, reset enabled, irq enabled

Also it may completely disinform about irq status, as it prints
"irq enabled" when S3C2410_WTCON_INTEN is in fact 0.

Fix it.

Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Tested-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 25dc46e3 26-Sep-2011 Wolfram Sang <wsa@kernel.org>

watchdog: s3c2410: convert to use the watchdog framework

Make this driver a user of the watchdog framework and remove now
centrally handled parts. Tested on a mini2440.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 9487a9cc 22-Jun-2011 Thomas Abraham <thomas.abraham@linaro.org>

watchdog: s3c2410: Add support for device tree based probe

This patch adds the of_match_table to enable s3c2410-wdt driver
to be probed when watchdog device node is found in the device tree.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# f72401e9 26-Feb-2011 Julia Lawall <julia@diku.dk>

watchdog: s3c2410_wdt.c: Convert release_resource to release_region/release_mem_region

Request_mem_region should be used with release_mem_region, not
release_resource.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E;
@@
*x = request_mem_region(...)
... when != release_mem_region(x)
when != x = E
* release_resource(x);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: stable <stable@kernel.org>


# 5f3b2756 23-Feb-2011 Wim Van Sebroeck <wim@iguana.be>

watchdog: cleanup spaces before tabs

cleanup spaces before tabs in drivers/watchdog/

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 9a372563 21-May-2010 Wim Van Sebroeck <wim@iguana.be>

watchdog: s3c2410_wdt - Fix removing of platform device

When removing the watchdog platform device, we need to
disable the access to userspace first. It makes no sense
to remove the drivers clock, irq's, ... and then disable
userspace access.
the order of removal has also been changed so that it
is the reverse of probing (this way the clock is also
disabled sooner).

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 100fb76f 20-May-2010 Banajit Goswami <banajit.g@samsung.com>

watchdog: s3c2410_wdt - Fix on handling of the request_mem_region fail

If the request for wdt_mem region fails, this patch modifies the driver
such that, it does not try to release the wdt_mem region on exit.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 76550d32 01-May-2010 Randy Dunlap <randy.dunlap@oracle.com>

watchdog: fix several MODULE_PARM_DESC strings

Fix MODULE_PARM_DESC() strings in several watchdog drivers.
Some are simple as add a parenthesis.
Others are problems from __stringify() being used on a
variable name instead of a macro name, so the variable name
is produced in the string instead of its build-time value.
In these cases, create a macro for the value so that the
module param description string is useful.

Only pc87413_wdt has been built (due to toolchains).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# b782a563 03-Dec-2009 H Hartley Sweeten <hartleys@visionengravers.com>

[WATCHDOG] use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Kevin Hilman <khilman@ti.deeprootsystems.com>
Cc: Ulrik Bech Hald <ubh@ti.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Vincent Sanders <support@simtec.co.uk>
Acked-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# e02f838e 29-Oct-2009 Ben Dooks <ben@simtec.co.uk>

[WATCHDOG] CPUFREQ: S3C24XX Watchdog frequency scaling support.

Add support for CPU frequency scaling to the S3C24XX Watchdog
driver.

Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# a77dba7e 14-Apr-2009 Wim Van Sebroeck <wim@iguana.be>

[WATCHDOG] Some more general cleanup

Clean-up the watchdog drivers so that checkpatch.pl get's happy...

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 180ee700 30-Oct-2008 Ben Dooks <ben-linux@fluff.org>

[ARM] S3C: Move regs-watchdog.h to arch/arm/plat-s3c/include/plat

Move regs-watchdog.h to arch/arm/plat-s3c/include/plat ready
to clean out the old include directories

Signed-off-by: Ben Dooks <ben-linux@fluff.org>


# 29fa0586 27-Oct-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

[PATCH] Switch all my contributions stuff to a single common address

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0e65fb29 22-Jun-2008 Ben Dooks <ben-linux@fluff.org>

[WATCHDOG] Fix s3c2410_wdt driver coding style issues

Fixup coding style issues in the s3c2410_wdt driver.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 9e3eaf14 22-Jun-2008 Ben Dooks <ben-linux@fluff.org>

[WATCHDOG] Clean out header of s3c2410_wdt driver.

Remove the changelog from the top of the driver, which
is redundant as this information is more accurately
represented from the revision control holding the
file.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# b4253f8f 22-Jun-2008 Ben Dooks <ben-linux@fluff.org>

[WATCHDOG] Fix NULL usage in s3c2410_wdt driver.

Fix comparison of a pointer to 0, instead of using
NULL for a invalid pointer.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 8b5942c3 09-Aug-2008 Adrian Bunk <bunk@kernel.org>

[ARM] Fix a pile of broken watchdog drivers

These patches from Adrian fix:
- ixp4xx_wdt: 20d35f3e50ea7e573f9568b9fce4e98523aaee5d
CC drivers/watchdog/ixp4xx_wdt.o
ixp4xx_wdt.c:32: error: expected '=', ',', ';', 'asm' or '__attribute__'
ixp4xx_wdt.c: In function 'wdt_enable':
ixp4xx_wdt.c:41: error: 'wdt_lock' undeclared (first use in this
ixp4xx_wdt.c:41: error: (Each undeclared identifier is reported only
ixp4xx_wdt.c:41: error: for each function it appears in.)
ixp4xx_wdt.c: In function 'wdt_disable':
ixp4xx_wdt.c:52: error: 'wdt_lock' undeclared (first use in this
ixp4xx_wdt.c: In function 'ixp4xx_wdt_init':
ixp4xx_wdt.c:186: error: 'wdt_lock' undeclared (first use in this
make[3]: *** [drivers/watchdog/ixp4xx_wdt.o] Error 1

- at91rm9200_wdt: 2760600da2a13d5a2a335ba012d0f3ad5df4c098
CC drivers/watchdog/at91rm9200_wdt.o
at91rm9200_wdt.c:188: error: 'at91_wdt_ioctl' undeclared here (not in a
make[3]: *** [drivers/watchdog/at91rm9200_wdt.o] Error 1

- wdt285: d0e58eed05f9baf77c4f75e794ae245f6dae240a
CC [M] drivers/watchdog/wdt285.o
wdt285.c: In function 'footbridge_watchdog_init':
wdt285.c:211: error: 'KERN_WARN' undeclared (first use in this function)
wdt285.c:211: error: (Each undeclared identifier is reported only once
wdt285.c:211: error: for each function it appears in.)
wdt285.c:212: error: expected ')' before string constant
make[3]: *** [drivers/watchdog/wdt285.o] Error 1

And this patch from rmk:
- s3c2410_wdt: 41dc8b72e37c514f7332cbc3f3dd864910c2a1fa
CC drivers/watchdog/s3c2410_wdt.o
s3c2410_wdt.c: In function `s3c2410wdt_start':
s3c2410_wdt.c:161: warning: `return' with a value, in function returning void

Reported-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>


# c1ec8295 07-Aug-2008 Linus Torvalds <torvalds@linux-foundation.org>

Fix up duplicate '__s3c2410wdt_stop()' function

Looks like somebody didn't get enough sleep.

Noticed-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# a09e64fb 05-Aug-2008 Russell King <rmk@dyn-67.arm.linux.org.uk>

[ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach

This just leaves include/asm-arm/plat-* to deal with.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>


# 0c06090c 18-Jul-2008 Wim Van Sebroeck <wim@iguana.be>

[WATCHDOG] Coding style - Indentation - part 2

This brings the watchdog drivers into line with coding style.
This patch takes cares of the indentation as described in chapter 1.
Main changes:
* Re-structure the ioctl switch call for all drivers as follows:
switch (cmd) {
case WDIOC_GETSUPPORT:
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
case WDIOC_GETTEMP:
case WDIOC_SETOPTIONS:
case WDIOC_KEEPALIVE:
case WDIOC_SETTIMEOUT:
case WDIOC_GETTIMEOUT:
case WDIOC_GETTIMELEFT:
default:
}

This to make the migration from the drivers to the uniform watchdog
device driver easier in the future.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 41dc8b72 04-Aug-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

s3c2410_wdt watchdog driver: Locking and coding style

Kill off use of semaphores.
Fix ioctl races and locking holes.

From: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# edef7a93 19-May-2008 Alan Cox <alan@redhat.com>

[WATCHDOG 35/57] s3c2410: watchdog cleanup and switch to unlocked_ioctl

Review and switch to unlocked_ioctl

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# f37d193c 10-Apr-2008 Kay Sievers <kay.sievers@vrfy.org>

watchdog: fix platform driver hotplug/coldplug

Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is
prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable watchdog
drivers, to re-enable auto loading.

[dbrownell@users.sourceforge.net: more drivers; registration fixes]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# fa9363c5 05-Mar-2008 Harvey Harrison <harvey.harrison@gmail.com>

[WATCHDOG] replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# b7e04f8c 17-Aug-2007 Wim Van Sebroeck <wim@iguana.be>

mv watchdog tree under drivers

move watchdog tree from drivers/char/watchdog to drivers/watchdog.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>