Commit Graph

1240 Commits

Author SHA1 Message Date
Linus Torvalds 51a73ba5f4 Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
 - new driver for NXP LPC18xx Watchdog Timer
 - new driver for SAMA5D4 watchdog timer
 - add support for MCP79 to nv_tco driver
 - clean-up and improvement of the mpc8xxx watchdog driver
 - improvements to gpio-wdt
 - at91sam9_wdt clock improvements
 ... and other small fixes and improvements

* git://www.linux-watchdog.org/linux-watchdog: (25 commits)
  Watchdog: Fix parent of watchdog_devices
  watchdog: at91rm9200: Correct check for syscon_node_to_regmap() errors
  watchdog: at91sam9: get and use slow clock
  Documentation: dt: binding: atmel-sama5d4-wdt: for SAMA5D4 watchdog driver
  watchdog: add a driver to support SAMA5D4 watchdog timer
  watchdog: mpc8xxx: allow to compile for MPC512x
  watchdog: mpc8xxx: use better error code when watchdog cannot be enabled
  watchdog: mpc8xxx: use dynamic memory for device specific data
  watchdog: mpc8xxx: use devm_ioremap_resource to map memory
  watchdog: mpc8xxx: make use of of_device_get_match_data
  watchdog: mpc8xxx: simplify registration
  watchdog: mpc8xxx: remove dead code
  watchdog: lpc18xx_wdt_get_timeleft() can be static
  DT: watchdog: Add NXP LPC18xx Watchdog Timer binding documentation
  watchdog: NXP LPC18xx Watchdog Timer Driver
  watchdog: gpio-wdt: ping already at startup for always running devices
  watchdog: gpio-wdt: be more strict about hw_algo matching
  Documentation: watchdog: at91sam9_wdt: add clocks property
  watchdog: booke_wdt: Use infrastructure to check timeout limits
  watchdog: (nv_tco) add support for MCP79
  ...
2015-09-11 15:12:59 -07:00
Pratyush Anand 6551881c86 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>
2015-09-09 21:39:22 +02:00
Bjorn Andersson bf5125d5e0 watchdog: at91rm9200: Correct check for syscon_node_to_regmap() errors
syscon_node_to_regmap() returns a regmap or an ERR_PTR().

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:39:07 +02:00
Alexandre Belloni a97a09bd11 watchdog: at91sam9: get and use slow clock
Commit dca1a4b5ff ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91sam9 watchdog.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:38:52 +02:00
Wenyou Yang 76534860f1 watchdog: add a driver to support SAMA5D4 watchdog timer
From SAMA5D4, the watchdog timer is upgrated with a new feature,
which is describled as in the datasheet, "WDT_MR can be written
until a LOCKMR command is issued in WDT_CR".
That is to say, as long as the bootstrap and u-boot don't issue
a LOCKMR command, WDT_MR can be written more than once in the driver.

So the SAMA5D4 watchdog driver's implementation is different from
the at91sam9260 watchdog driver implemented in file at91sam9_wdt.c.
The user application open the device file to enable the watchdog timer
hardware, and close to disable it, and set the watchdog timer timeout
by seting WDV and WDD fields of WDT_MR register, and ping the watchdog
by issuing WDRSTT command to WDT_CR register with hard-coded key.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:38:29 +02:00
Uwe Kleine-König f8c33e9717 watchdog: mpc8xxx: allow to compile for MPC512x
The MPC5125 processor features a watchdog device that is identical to
the MPC8610 one. So allow to enable the driver for MPC512x kernel
configurations.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:38:16 +02:00
Uwe Kleine-König 72cd501e6a watchdog: mpc8xxx: use better error code when watchdog cannot be enabled
checkpatch warns about ENOSYS, telling "ENOSYS means 'invalid syscall
nr' and nothing else". So use ENODEV instead.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:37:51 +02:00
Uwe Kleine-König 7997ebad4d watchdog: mpc8xxx: use dynamic memory for device specific data
Instead of relying on global static memory dynamically allocate the
needed data. This has the benefit of some saved bytes if the driver is
not in use and making it possible to bind more than one device (even
though this has no known use case).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:37:29 +02:00
Uwe Kleine-König de5f71222b watchdog: mpc8xxx: use devm_ioremap_resource to map memory
This simplifies the error paths and device unbinding.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:37:15 +02:00
Uwe Kleine-König f0ded83b96 watchdog: mpc8xxx: make use of of_device_get_match_data
This function is new in v4.2-rc1 and makes a forward declaration of the
match table superfluous which can so be removed.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:36:51 +02:00
Uwe Kleine-König 50ffb53ef2 watchdog: mpc8xxx: simplify registration
Since commit ef90174f82 ("watchdog: watchdog_core: Add watchdog
registration deferral mechanism") there is no need to delay the call to
watchdog_register_device any more. So simplify the registration code
accordingly.

Resetting wd_base to NULL can the also be dropped because nothing
depends on it being NULL to signal probe failure any more. (The matching
wd_base = NULL in .remove was missing, too.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:36:39 +02:00
Uwe Kleine-König a57e06f7c6 watchdog: mpc8xxx: remove dead code
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:36:31 +02:00
Fengguang Wu 6cd8a1b9f7 watchdog: lpc18xx_wdt_get_timeleft() can be static
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:36:17 +02:00
Ariel D'Alessandro 7c25f8c9f6 watchdog: NXP LPC18xx Watchdog Timer Driver
This commit adds support for the watchdog timer found in NXP LPC SoCs
family, which includes LPC18xx/LPC43xx. Other SoCs in that family may
share the same watchdog hardware.

Watchdog driver registers a restart handler that will restart the system
by performing an incorrect feed after ensuring the watchdog is enabled in
reset mode.

As watchdog cannot be disabled in hardware, driver's stop routine will
regularly send a keepalive ping using a timer.

Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:35:59 +02:00
Uwe Kleine-König 4f2d0b2d1b watchdog: gpio-wdt: ping already at startup for always running devices
During probe for an always-running watchdog a timer is setup to
constantly ping the watchdog while the device is not open. The gpio to
ping the watchdog is setup to inactive.

For a watchdog with hw_algo = "toggle" this results in a ping depending
on the initial state of the gpio, for hw_algo = "level" no ping is
generated.

Make sure that the first automatic ping is sent immediately and not only
when the timer expires the first time. This makes the machine survive in
case more than half of the watchdog timeout is already elapsed. (Which
is very probable for the chip I'm faced with that has a timeout of one
second.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:35:37 +02:00
Uwe Kleine-König 0a0a542f6b watchdog: gpio-wdt: be more strict about hw_algo matching
strncmp(algo, "toggle", 6) doesn't compare the trailing '\0' byte, so
using

	hw_algo = "toggleboggle"

is recognized the same way as

	hw_algo = "toggle"

. While this doesn't introduce any problems for a device tree that
sticks to the documented settings it's still ugly.

Fix this by using strcmp to only match on "toggle" and "level".

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:35:14 +02:00
Guenter Roeck fa928ee8d4 watchdog: booke_wdt: Use infrastructure to check timeout limits
The watchdog infrastructure checks the maximum timeout for us.
Use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:34:34 +02:00
Vivien Didelot 64307b48f7 watchdog: (nv_tco) add support for MCP79
Tested on the Nvidia chipset with an SMBus controller PCI ID 0x0AA2
(as shown in the PCI listing during the boot sequence).

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:34:24 +02:00
Francesco Lavra 0919e44451 watchdog: sunxi: fix activation of system reset
Commit f2147de334 ("watchdog: sunxi: support parameterized compatible
strings") introduced a regression in sunxi_wdt_start(), by which
the system reset function of the watchdog is not enabled upon
starting the watchdog. As a result, the system is not reset when the
watchdog expires. Fix it.

Fixes: f2147de334 ("watchdog: sunxi: support parameterized compatible strings")
Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: stable@vger.kernel.org
2015-09-09 21:34:14 +02:00
Greta Zhang 5724485b18 watchdog: mtk_wdt: add wdt shutdown callback to disable wdt if enabled
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-09 21:34:02 +02:00
Greta Zhang 9fab06920c watchdog: mtk_wdt: add suspend/resume support
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-09-09 21:33:56 +02:00
Ezequiel Garcia 8a340dbbc4 watchdog: imgpdc: Unregister restart handler on remove
Commit c631f20068 ("watchdog: imgpdc: Add reboot support") introduced
a restart handler but forgot to unregister it on driver removal. Fix it.

Fixes: c631f20068 ("watchdog: imgpdc: Add reboot support")
Reported-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-09-09 21:33:41 +02:00
Linus Torvalds 8bd8fd0a29 - New Device Support
- New Clocksource driver from ST
    - New MFD/ACPI/DMA drivers for Intel's Sunrisepoint PCH based platforms
    - Add support for Arizona WM8998 and WM1814
    - Add support for Dialog Semi DA9062 and DA9063
    - Add support for Kontron COMe-bBL6 and COMe-cBW6
    - Add support for X-Powers AXP152
    - Add support for Atmel, many
    - Add support for STMPE, many
    - Add support for USB in X-Powers AXP22X
 
  - Core Frameworks
    - New Base API to traverse devices and their children in reverse order
 
  - Bug Fixes
    - Fix race between runtime-suspend and IRQs
    - Obtain platform data form more reliable source
 
  - Fix-ups
    - Constifying things
    - Variable signage changes
    - Kconfig depends|selects changes
    - Make use of BIT() macro
    - Do not supply .owner attribute in *_driver structures
    - MAINTAINERS entries
    - Stop using set_irq_flags()
    - Start using irq_set_chained_handler_and_data()
    - Export DT device ID structures
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV6FCRAAoJEFGvii+H/HdhO2MP/1GxcbbywMXU4goj40gJaYfx
 kk0zH0S7i8+A8hD7SoCIQNkWN5o7i6sNYUA6sCTnPqixbyrkduWCyid1XsATu+41
 iiKEGyiCRyEHhCwnwCXvaFhpAZBzDi7FKj6hhf6nnRMHSEqwrs2aBqWgzNrOZTs0
 u66i/JHccnDdfHHm9Y7XcKMA8pWVqRMnwwaHreuYTFqfrEB0UGCYpmEeEBynGVKh
 MUGC0lCUrEKp59aOexZRtBUla/5BeALJd//vMQtf/+D0YPvE8lppDNwkgCe4buXN
 ZlNHDQooIWIiZfTj7wbHaTWjrBK7MsOEHWBUjNsk2nyDvDOJoGhTrSdJwPeyhUSh
 d2eUyW6sPEQY21XPwuD0DhfRKYKLOzVRhIcxvjlRAq9QHDWVXKyIlf3M70fculK8
 5FN1Wb6Sc2h0OvMC5RemPpxMwZSq6Ks3XANa718Ju802TGK/xk6iRqhZrEut/qrN
 rLYsU84TLUz6YindozTiI5FrGo+zSp9OlUU4z7HUh+4t3H5/opdsRjRp0ICwgIbY
 NxAmsk2d/vJ7xX7FAAjwMY2rPIC0zIksbGEe1AJweWV455EcDMaBM1/e9zDzHciI
 TXVxbzs3DFBadtQWlLv/VkwZmt43MTI8g6ozTTJJkPQNCKThtz4bvDSu8rQWqFua
 bkbRyQroraX5fM0Q3HIs
 =2blS
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Device Support:
   - New Clocksource driver from ST
   - New MFD/ACPI/DMA drivers for Intel's Sunrisepoint PCH based platforms
   - Add support for Arizona WM8998 and WM1814
   - Add support for Dialog Semi DA9062 and DA9063
   - Add support for Kontron COMe-bBL6 and COMe-cBW6
   - Add support for X-Powers AXP152
   - Add support for Atmel, many
   - Add support for STMPE, many
   - Add support for USB in X-Powers AXP22X

  Core Frameworks:
   - New Base API to traverse devices and their children in reverse order

  Bug Fixes:
   - Fix race between runtime-suspend and IRQs
   - Obtain platform data form more reliable source

  Fix-ups:
   - Constifying things
   - Variable signage changes
   - Kconfig depends|selects changes
   - Make use of BIT() macro
   - Do not supply .owner attribute in *_driver structures
   - MAINTAINERS entries
   - Stop using set_irq_flags()
   - Start using irq_set_chained_handler_and_data()
   - Export DT device ID structures"

* tag 'mfd-for-linus-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (69 commits)
  mfd: jz4740-adc: Init mask cache in generic IRQ chip
  mfd: cros_ec: spi: Add OF match table
  mfd: stmpe: Add OF match table
  mfd: max77686: Split out regulator part from the DT binding
  mfd: Add DT binding for Maxim MAX77802 IC
  mfd: max77686: Use a generic name for the PMIC node in the example
  mfd: max77686: Don't suggest in binding to use a deprecated property
  mfd: Add MFD_CROS_EC dependencies
  mfd: cros_ec: Remove CROS_EC_PROTO dependency for SPI and I2C drivers
  mfd: axp20x: Add a cell for the usb power_supply part of the axp20x PMICs
  mfd: axp20x: Add missing registers, and mark more registers volatile
  mfd: arizona: Fixup some formatting/white space errors
  mfd: wm8994: Fix NULL pointer exception on missing pdata
  of: Add vendor prefix for Nuvoton
  mfd: mt6397: Implement wake handler and suspend/resume to handle wake up event
  mfd: atmel-hlcdc: Add support for new SoCs
  mfd: Export OF module alias information in missing drivers
  mfd: stw481x: Export I2C module alias information
  mfd: da9062: Support for the DA9063 OnKey in the DA9062 core
  mfd: max899x: Avoid redundant irq_data lookup
  ...
2015-09-04 11:35:03 -07:00
Matt Fleming 2a7a0e9bf7 watchdog: iTCO_wdt: Add support for TCO on Intel Sunrisepoint
The revision of the watchdog hardware in Sunrisepoint necessitates a new
"version" inside the TCO watchdog driver because some of the register
layouts have changed.

Also update the Kconfig entry to select both the LPC and SMBus drivers
since the TCO device is on the SMBus in Sunrisepoint.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11 15:03:52 +01:00
Matt Fleming 420b54de25 mfd: watchdog: iTCO_wdt: Expose watchdog properties using platform data
Intel Sunrisepoint (Skylake PCH) has the iTCO watchdog accessible across
the SMBus, unlike previous generations of PCH/ICH where it was on the
LPC bus. Because it's on the SMBus, it doesn't make sense to pass around
a 'struct lpc_ich_info', and leaking the type of bus into the iTCO
watchdog driver is kind of backwards anyway.

This change introduces a new 'struct itco_wdt_platform_data' for use
inside the iTCO watchdog driver and by the upcoming Intel Sunrisepoint
code, which neatly avoids having to include lpc_ich headers in the i801
i2c driver.

This change is overdue because lpc_ich_info has already found its way
into other TCO watchdog users, notably the intel_pmc_ipc driver where
the watchdog actually isn't on the LPC bus as far as I can see.

A simple translation layer is provided for converting from the existing
'struct lpc_ich_info' inside the lpc_ich mfd driver.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Acked-by: Darren Hart <dvhart@linux.intel.com> [drivers/x86 refactoring]
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11 15:03:21 +01:00
Greg Kroah-Hartman f368ed6088 char: make misc_deregister a void function
With well over 200+ users of this api, there are a mere 12 users that
actually checked the return value of this function.  And all of them
really didn't do anything with that information as the system or module
was shutting down no matter what.

So stop pretending like it matters, and just return void from
misc_deregister().  If something goes wrong in the call, you will get a
WARNING splat in the syslog so you know how to fix up your driver.
Other than that, there's nothing that can go wrong.

Cc: Alasdair Kergon <agk@redhat.com>
Cc: Neil Brown <neilb@suse.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-05 10:35:49 -07:00
Viresh Kumar da89947b47 Update Viresh Kumar's email address
Switch to my kernel.org alias instead of a badly named gmail address,
which I rarely use.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-17 16:39:53 -07:00
Linus Torvalds 93899e39e8 Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
 "This contains:

   - new driver for ST's LPC Watchdog
   - new driver for Conexant Digicolor CX92755 SoC
   - new driver for DA9062 watchdog
   - Addition of the watchdog registration deferral mechanism
   - several improvements on omap_wdt
   - several improvements and reboot-support for imgpdc_wdt
   - max63xx_wdt improvements
   - imx2_wdt improvements
   - dw_wdt improvements
   - and other small improvements and fixes"

* git://www.linux-watchdog.org/linux-watchdog: (37 commits)
  watchdog: omap_wdt: early_enable module parameter
  watchdog: gpio_wdt: Add option for early registration
  watchdog: watchdog_core: Add watchdog registration deferral mechanism
  watchdog: max63xx: dynamically allocate device
  watchdog: imx2_wdt: Disable previously acquired clock on error path
  watchdog: imx2_wdt: Check for clk_prepare_enable() error
  watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
  watchdog: docs: omap_wdt also understands nowayout
  watchdog: omap_wdt: implement get_timeleft
  watchdog: da9062: DA9062 watchdog driver
  watchdog: imx2_wdt: set watchdog parent device
  watchdog: mena21_wdt: Fix possible NULL pointer dereference
  watchdog: dw_wdt: keepalive the watchdog at write time
  watchdog: dw_wdt: No need for a spinlock
  watchdog: imx2_wdt: also set wdog->timeout to new_timeout
  watchdog: Allow compile test of GPIO consumers if !GPIOLIB
  watchdog: cadence: Add dependency on HAS_IOMEM
  watchdog: max63xx_wdt: Constify platform_device_id
  watchdog: MAX63XX_WATCHDOG does not depend on ARM
  watchdog: imgpdc: Add some documentation about the timeout
  ...
2015-07-01 19:33:16 -07:00
Lars Poeschel b2102eb36e watchdog: omap_wdt: early_enable module parameter
Add a early_enable module parameter to the omap_wdt that starts the
watchdog on module insertion. The default value is 0 which does not
start the watchdog - which also does not change the behavior if the
parameter is not given.

Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-07-01 16:43:17 +02:00
Jean-Baptiste Theou 5e53c8ed81 watchdog: gpio_wdt: Add option for early registration
In some situation, mainly when it's not possible to disable a
watchdog, you may want the watchdog driver to be started as soon
as possible.

Adding GPIO_WATCHDOG_ARCH_INITCALL to raise initcall from
module_init to arch_initcall.

This patch require watchdog registration deferral mechanism

Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-29 11:51:08 +02:00
Jean-Baptiste Theou ef90174f82 watchdog: watchdog_core: Add watchdog registration deferral mechanism
Currently, watchdog subsystem require the misc subsystem to
register a watchdog. This may not be the case in case of an
early registration of a watchdog, which can be required when
the watchdog cannot be disabled.

This patch introduces a deferral mechanism to remove this requirement.

Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-29 11:51:06 +02:00
Vivien Didelot b9be9660ba watchdog: max63xx: dynamically allocate device
This patch removes the static watchdog device for a new max63xx_wdt data
structure, and constifies the max63xx_timeout data.

The new structure contains pointers to pin access routines, which
abstracts mmap-specific code. This will ease future accesses like GPIO.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-29 11:50:53 +02:00
Linus Torvalds 4aa705b18b ARM: SoC: platform support for v4.2
Our SoC branch usually contains expanded support for new SoCs and
 other core platform code. Some highlights from this round:
 
 - sunxi: SMP support for A23 SoC
 - socpga: big-endian support
 - pxa: conversion to common clock framework
 - bcm: SMP support for BCM63138
 - imx: support new I.MX7D SoC
 - zte: basic support for ZX296702 SoC
 
  Conflicts:
 	arch/arm/mach-socfpga/core.h
 
 Trivial remove/remove conflict with our cleanup branch.
 Resolution: remove both sides
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVi4RMAAoJEFk3GJrT+8Zl6/kP/1Rv9O++1Kxua6R54Og6AF1J
 0miFr2fnUrUWUYg/NVbseRH5bBe6N6ir3SQMfde8W2/QibEjOoEwSwrle+mC/eiq
 CE0x0gtyRvXMrMU/FWkOvbmmw9uv5oz1z3IHZV6AiecNuSMLUBPfamryikQ8C+d1
 O/QZtX543tJQJDOBihO5cuhoVVM37UX0unNmqGsyswlyqTPF8FxcIJAYVNtnxjmj
 AFaOB0nDJKLKFTiX2Ype2wOxxJX1lrLatNo4W4T+YaaK+i1uCOhgTdSN+n49K7YA
 KNDFEgZFQqT8VMJyG+eJVeYF+cI7yWQ7lBzIftPUjPk/7+dIHBjWPz2QdjVz3U38
 kxncf4S9xGAF5G2rcKe4mFrfT3Y8QLWQpA/jFs06yLwW1O3Hlfq3DzMdGNcF7hth
 17LOP8namn9+NepZEp/vAlFzRRypxWWtbkPNBIItkImC6zn0IiGjBy50DE1io27W
 hmQcnMb7d+0wWl2Y8OmR2lZSB97JiRZkRYMCVHVt+0zGJzp4prLvl9wbjh1VXkPv
 ERCDJ9nCmZsl7ZVmIXMI7KNXYuPNp7R/QAzCvuSUueswF0qxTAQ0VSSBwRMqvQsQ
 UUNC6p63VnjUeMUdn2EBsUQZ0Uqw3t2U5TtvooHNt9FkiGsSpwjWrvVD+LItaPoJ
 GPeeJrJaYQsDvTrO8wjU
 =ZtPK
 -----END PGP SIGNATURE-----

Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC platform support updates from Kevin Hilman:
 "Our SoC branch usually contains expanded support for new SoCs and
  other core platform code.  Some highlights from this round:

   - sunxi: SMP support for A23 SoC
   - socpga: big-endian support
   - pxa: conversion to common clock framework
   - bcm: SMP support for BCM63138
   - imx: support new I.MX7D SoC
   - zte: basic support for ZX296702 SoC"

* tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (134 commits)
  ARM: zx: Add basic defconfig support for ZX296702
  ARM: dts: zx: add an initial zx296702 dts and doc
  clk: zx: add clock support to zx296702
  dt-bindings: Add #defines for ZTE ZX296702 clocks
  ARM: socfpga: fix build error due to secondary_startup
  MAINTAINERS: ARM64: EXYNOS: Extend entry for ARM64 DTS
  ARM: ep93xx: simone: support for SPI-based MMC/SD cards
  MAINTAINERS: update Shawn's email to use kernel.org one
  ARM: socfpga: support suspend to ram
  ARM: socfpga: add CPU_METHOD_OF_DECLARE for Arria 10
  ARM: socfpga: use CPU_METHOD_OF_DECLARE for socfpga_cyclone5
  ARM: EXYNOS: register power domain driver from core_initcall
  ARM: EXYNOS: use PS_HOLD based poweroff for all supported SoCs
  ARM: SAMSUNG: Constify platform_device_id
  ARM: EXYNOS: Constify irq_domain_ops
  ARM: EXYNOS: add coupled cpuidle support for Exynos3250
  ARM: EXYNOS: add exynos_get_boot_addr() helper
  ARM: EXYNOS: add exynos_set_boot_addr() helper
  ARM: EXYNOS: make exynos_core_restart() less verbose
  ARM: EXYNOS: fix exynos_boot_secondary() return value on timeout
  ...
2015-06-26 11:34:35 -07:00
Fabio Estevam db11cba205 watchdog: imx2_wdt: Disable previously acquired clock on error path
If watchdog_register_device() fails we should disable the previously
acquired wdev->clk clock on error path.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-26 10:41:18 +02:00
Fabio Estevam aefb163cb2 watchdog: imx2_wdt: Check for clk_prepare_enable() error
clk_prepare_enable() may fail, so we should better check its return value
and propagate it in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-26 10:41:11 +02:00
Jean Delvare 46c80b20d0 watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
WDIOC_SETOPTIONS makes it possible to disable and re-enable the
watchdog timer while the hpwdt driver is loaded.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:36 +02:00
Lars Poeschel 452fafed83 watchdog: omap_wdt: implement get_timeleft
The omap watchdog hardware is able to read the watchdog timer counter
register. This implements this functionality in the omap_wdt driver, so
one is can read the time until the watchdog will trigger the reset in
seconds using WDIOC_GETTIMELEFT.

Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:35 +02:00
S Twiss 7a7cb009dc watchdog: da9062: DA9062 watchdog driver
Add watchdog driver support for DA9062

Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:34 +02:00
Vladimir Zapolskiy 8135193ceb watchdog: imx2_wdt: set watchdog parent device
If on watchdog device registration a parent device is not set, then
the registered watchdog is considered to be a virtual device:

  /sys/devices/virtual/watchdog/watchdog0
  /sys/devices/virtual/watchdog/watchdog1

Setting a correct reference to a platform device allows to
distinguish multiple instances of iMX2+ hardware watchdogs:

  /sys/devices/soc0/soc/2000000.aips-bus/20bc000.wdog/watchdog/watchdog0
  /sys/devices/soc0/soc/2000000.aips-bus/20c0000.wdog/watchdog/watchdog1

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:33 +02:00
Johannes Thumshirn 57337db1b9 watchdog: mena21_wdt: Fix possible NULL pointer dereference
In a21_wdt_remove() we do a watchdog_unregister_device() on struct
a21_wdt_drv->wdt but never assign it.

Also move the dev_set_drvdata() call in front of the watchdog_register_device()
call, so it doesn't look like an error.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:32 +02:00
Doug Anderson 04b1a62e6b watchdog: dw_wdt: keepalive the watchdog at write time
If you've got code that does this in a tight loop
  1. Open watchdog
  2. Send 'expect close'
  3. Close watchdog
...you'll eventually trigger a watchdog reset.  You can reproduce this
by using daisydog (1) and running:
  while true; do daisydog -c > /dev/null; done

The problem is that each time you write to the watchdog for 'expect
close' it moves the timer .5 seconds out.  The timer thus never fires
and never pats the watchdog for you.

1: http://git.chromium.org/gitweb/?p=chromiumos/third_party/daisydog.git

Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:31 +02:00
Doug Anderson 7fb466a7a7 watchdog: dw_wdt: No need for a spinlock
Right now the dw_wdt uses a spinlock to protect dw_wdt_open().  The
problem is that while holding the spinlock we call:
-> dw_wdt_set_top()
   -> dw_wdt_top_in_seconds()
      -> clk_get_rate()
         -> clk_prepare_lock()
            -> mutex_lock()

Locking a mutex while holding a spinlock is not allowed and leads to
warnings like "BUG: spinlock wrong CPU on CPU#1", among other
problems.

There's no reason to use a spinlock.  Only dw_wdt_open() was protected
and the test_and_set_bit() at the start of that function protects us
anyway.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:31 +02:00
Michael Grzeschik 30dd4a8f08 watchdog: imx2_wdt: also set wdog->timeout to new_timeout
Commit faad5de0b1 ("watchdog: imx2_wdt: convert to watchdog core api")
removes the custom ioctl function. The generic ioctl handler is not
setting the wdog->timeout to the new_timeout but handing this preset
value back to the userspace. This patch sets the new value in the
drivers set_timeout function to fix that problem.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:25 +02:00
Geert Uytterhoeven 21a926a340 watchdog: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
2015-06-22 15:54:24 +02:00
Richard Weinberger 6960d4851f watchdog: cadence: Add dependency on HAS_IOMEM
Not all architectures have io memory.

Fixes:
drivers/built-in.o: In function `cdns_wdt_probe':
cadence_wdt.c:(.text+0x33b7c9): undefined reference to `devm_ioremap_resource'

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:23 +02:00
Krzysztof Kozlowski 8c7c72c9bc watchdog: max63xx_wdt: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:22 +02:00
Vivien Didelot 04658449dc watchdog: MAX63XX_WATCHDOG does not depend on ARM
Remove the ARM Kconfig dependency since the Maxim MAX63xx devices are
architecture independent.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:21 +02:00
Ezequiel Garcia c1f263878e watchdog: imgpdc: Add some documentation about the timeout
This watchdog hardware can be configured in terms of power-of-two
clock cycles. Therefore, the watchdog timeout configured by the user
will be rounded-up to the next possible hardware timeout.

This commit adds a comment explaining this.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:15 +02:00
Ezequiel Garcia deb8d50eb4 watchdog: imgpdc: Fix max timeout
Maximum timeout is currently set in clock cycles, but the watchdog
core expects it to be in seconds. Fix it.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:15 +02:00
Andrew Bresticker c631f20068 watchdog: imgpdc: Add reboot support
Register a restart handler that will restart the system by writing
to the watchdog's SOFT_RESET register.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
2015-06-22 15:54:14 +02:00