summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/rpi'Sascha Hauer2019-03-071-0/+5
|\
| * watchdog: bcm2835: set timeout_max.Tomaz Solc2019-02-181-0/+5
| | | | | | | | | | | | BCM2835 watchdog timeout can be set to maximum 15 seconds (0xffffff >> 16). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-03-071-1/+1
|\ \
| * | watchdog: fix WATCHDOG_POLLER menuconfigOleksij Rempel2019-02-271-1/+1
| |/ | | | | | | | | | | | | make it properly represented by menuconfig Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / watchdog: add (U)EFI driverOleksij Rempel2019-02-183-0/+71
|/ | | | | | | | This driver is using SetWatchdogTimer() UEFI interface and was tested on iBASE MI991AF Mini-ITX motherboard. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: When SRSR shows wdog then lookup reset source in wdogSascha Hauer2018-11-161-3/+7
| | | | | | | | | | | | | On i.MX6 when the watchdog has resetted the system then the SRSR register correctly shows that the watchdog has resetted the system. This is not the desired result though, a "reset" in barebox or "reboot" in Linux should result in "RST" as reset source. So instead of making the SRSR register value overwrite the reset source read from the watchdog registers, interpret the SRSR value corresponding to watchdog reset as "lookup details in the watchdog registers". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsourceAndrey Smirnov2018-06-261-38/+41
| | | | | | | | | | | | | | | | RAVE SP firmware versions found on RDU2 provide decicated bootsource manipulation commands, which, under the hood, are just thin wrappers around write/read to a particular location in EEPROM. Unfortunately, RAVE SP firmware found on RDU1, does not provide any dedicated bootsource commands and its users are expected to access EEPROM directly. In order to avoid having separate code paths for handling those two cases, convert the code to access EEPROM directly via NVMEM API. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rave-sp-wdt: Remove bogus leftover codeAndrey Smirnov2018-06-261-4/+1
| | | | | | | | This code should've been removed when the driver was rebased against latest watchdog plumbing in Barebox. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-05-093-0/+432
|\
| * watchdog: Port RAVE SP watchdog driver from Linux kernelAndrey Smirnov2018-05-043-0/+432
| | | | | | | | | | | | | | Port RAVE SP watchdog driver from Linux kernel Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: omap: set hwdev before call watchdog_registerAndreas Schmidt2018-04-251-0/+1
| | | | | | | | | | | | | | | | | | Since watchdog_register access to hwdev (see commit 65a644388e845bde01215bf378d4df2a6a260a6a) hwdev has to be initiate/set before calling watchdog_register. Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: core: check hwdev before use itAndreas Schmidt2018-04-251-2/+4
|/ | | | | | | | Avoid null pointer access, if hwdev was not set before call watchdog_register. Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add watchdog pollerOleksij Rempel2018-03-262-6/+77
| | | | | | | | | | In some cases it is practical to supervise as much as possible of the barebox execution with a watchdog (or multiple watchdogs). This patch provides an async poller for watchdog core framework which can be enabled by the user and stores this configuration to nv. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: provide timeout_cur valueOleksij Rempel2018-03-231-0/+18
| | | | | | | | | | timeout_cur will be used for watchdog poller. Provided values should be good enough for most users and still can be changed for separate projects and fit to needed requirements. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: set some reasonable timeout_max value if no other is availableOleksij Rempel2018-03-231-1/+7
| | | | | | | | Some drivers do not provide timeout_max value. Using some value is probably better then setting timeout_max to 0. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: move max timeout test in to wd_coreOleksij Rempel2018-03-235-23/+16
| | | | | | | this also will be needed for watchdog poller as well Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: register watchdog virtual device with short name wdogOleksij Rempel2018-03-231-0/+24
| | | | | | | | | | | | the watchdog hwdev is usually named with devicetree schema which is not practical for CLI. On device registration "wdog" will be extended with some index number extracted from devicetree (if awailable) or automatically assigned first available number. End result will be "wdog0" .. etc. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rename dev to hwdevSascha Hauer2018-03-228-10/+10
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: implement bcm2835 watchdogLucas Stach2018-02-093-0/+148
| | | | | | | Move out of architecture code and add some real watchdog functionality. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add ar9344-wdt driverOleksij Rempel2018-01-053-0/+145
| | | | | | | | | This driver was developed and tested on QCA AR9344 WiSoC but it may work on most known Atheros/QCA WiSoCs. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2017-06-141-0/+6
|\
| * i.MX/WD: setup the watchdog according to its datasheetJuergen Borleis2017-06-071-0/+6
| | | | | | | | | | | | | | | | | | From earlier SoCs like the i.MX21 up to i.MX7 their datasheets states after reset the watchdog timer has to be set first prior enabling the watchdog itself. This change do it this way. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: i.MX: fix i.MX6 resetChristian Hemp2017-06-131-0/+4
|/ | | | | | | | | | | | According to the Errata ERR004346 (WDOG: WDOG SRS bit requires to be written twice), add another two writes to ensure there must be at least two writes happen in the same one 32kHz clock period. Without this two additional writes, the system will not reset always. Tested with i.MX6Quad and i.MX6 UltraLite Signed-off-by: Christian Hemp <c.hemp@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: new driver for Armada XPUwe Kleine-König2017-03-313-0/+130
| | | | | | | | | | This SoC uses a variant of the IP that is also used on most other Marvell SoCs. For now it only supports Armada XP but the naming is already chosen such that adding support for further SoCs doesn't result in much renaming. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: i.MX: Fix internal/external resetSascha Hauer2017-01-201-2/+14
| | | | | | | | | | | The watchdog can either reset only the SoC or assert the WDOG_B output signal instead. On some boards it's necessary to use the external WDOG_B output to make sure that external devices like the PMIC are also properly resetted. This has been fixed in the Linux driver which honours a fsl,ext-reset-output device tree property to select between both ways. Do the same in the barebox driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: i.MX: add soc_reset operationSascha Hauer2017-01-201-15/+25
| | | | | | | | On i.MX21 watchdog type the reset operation is really different from the watchdog enable/set timeout operation, so create an extra callback for this instead of folding both things together. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add designware driverSteffen Trumtrar2016-11-033-0/+200
| | | | | | | Port the linux v4.8-rc1 Synopsys DesignWare watchdog driver to barebox. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-075-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-232-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* Merge branch 'for-next/omap'Sascha Hauer2015-12-083-0/+206
|\
| * driver: watchdog: Add support for omap_wdtTeresa Remmet2015-11-233-0/+206
| | | | | | | | | | | | | | | | | | Add support for OMAP Watchdog driver. Based on omap_wdt Linux driver (v4.3-rc1). Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | wdog: imx-wd: watchdog cannot be disabled againStefan Christ2015-11-301-1/+4
|/ | | | | | | | | The i.MX21/i.MX6 watchdog cannot be disabled after it was activated. Bit 2 (WDE) cannot be set to 0 again. Notify the user about that by returning -ENOSYS. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: Give watchdogs a nameSascha Hauer2015-08-274-1/+17
| | | | | | | This adds a dev and name member to struct watchdog which helps distinguishing between different watchdogs. Also add some debugging aids. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: Allow multiple watchdogsSascha Hauer2015-08-271-12/+45
| | | | | | | | | Put watchdogs on a list to allow multiple watchdogs. Add a priority field to be able to pick the highest priority watchdog. This patch also provides a of_get_watchdog_priority() function to allow configuring the watchdog priority from the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* restart: replace reset_cpu with registered restart handlersSascha Hauer2015-08-272-29/+30
| | | | | | | | | | | | | | | | | | | | | | This replaces the reset_cpu() function which every SoC or board must provide with registered handlers. This makes it possible to have multiple reset functions for boards which have multiple ways to reset the machine. Also boards which have no way at all to reset the machine no longer have to provide a dummy reset_cpu() function. The problem this solves is that some machines have external PMICs or similar to reset the system which have to be preferred over the internal SoC reset, because the PMIC can reset not only the SoC but also the external devices. To pick the right way to reset a machine each handler has a priority. The default priority is 100 and all currently existing restart handlers are registered with this priority. of_get_restart_priority() allows to retrieve the priority from the device tree which makes it possible for boards to give certain restart handlers a higher priority in order to use this one instead of the default one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: imxwd: remove remove callbackSascha Hauer2015-08-261-12/+0
| | | | | | | | | The imxwd is for resetting the system, so we should not unregister it during shutdown_barebox() as it may leave us without a restart handler. Only a bug (not setting reset_wd to NULL in remove()) made the whole thing work. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add davinci watchdog driverJan Luebbe2015-08-033-0/+179
| | | | | | | This driver is based on the Linux driver (v4.0). Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* wdog: imx-wd: Disable watchdog powerdown counterMarkus Pargmann2015-04-131-0/+6
| | | | | | | | | Disable the watchdog powerdown counter at start. Otherwise this may trigger a reset or poweroff over the WDOG_B line to a PMIC. This counter is set to 16 seconds after poweron. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* wdog: imx-wd: Introduce ops struct for imx21/imx1Markus Pargmann2015-04-131-12/+43
| | | | | | | | Replace the set_timeout function in the device platform data by an ops struct which stores a set_timeout and init function. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM/MXS/i.MX28: recognize watchdog resetSteffen Trumtrar2015-03-301-0/+7
| | | | | | | | | | | When a watchdog timeout is set in the linux kernel, the FORCE_UPDATE bit is set. Use this to recognize a system reset that was triggered by the watchdog. Since only the wdt part of the kernel driver sets this bit, this is a safe distinguishing feature. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-161-0/+3
| | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: i.MX: check requested mem region in imx_wd_probe()Antony Pavlov2014-08-011-0/+4
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add minimal jz4740 driverAntony Pavlov2014-08-013-0/+110
| | | | | | | | | | | | Also move reset_cpu() for jz4755 SoC from platform code into the new driver code. At the moment mach-xburst lacks clk support so jz4740 watchdog driver looks like a template. We can improve jz4740 watchdog driver later after adding clk support. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: rename set_reset_source to reset_source_setSascha Hauer2014-01-292-7/+7
| | | | | | | To get all reset source related functions into the same function namespace. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM/MXS: add more ROM code related documentationJuergen Beisert2013-04-091-1/+74
| | | | | | | | | | | Commit 17176c2e2bba606190d9ae51943acb5701063573 adds a test of a new RTC register flag to distinguish a system reset and a wake up event. Shame on me, I have forgotten to define the newly used flag yet. While already here, I also try to document the other flags the RTC provides. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use new device_platform_driver() macro for driversAlexander Shiyan2013-02-132-15/+2
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'kconfig'Sascha Hauer2012-12-081-1/+1
|\