summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\
| * Cleanup Kconfig filesAlexander Shiyan2012-12-081-1/+1
| | | | | | | | | | | | | | | | | | This patch provides a global cleanup barebox Kconfig files. This includes replacing spaces to tabs, formatting in accordance format, removing extraneous lines and spaces. No functional changes. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM/MXS/i.MX28: distinguish POR and wake-up event correctlyJuergen Beisert2012-12-031-0/+11
|/ | | | | | | | | | | When the built-in RTC in the i.MX28 is programmed to wake-up the SoC, the RTC reports two events: RST and WAKE. RST is okay in this case, because the PMIC was really powered down. But the real event is the WAKE from the RTC and should have precedence over the RST event. So, report the WAKE event for this special case. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX: move reset source detection codeSascha Hauer2012-10-081-0/+34
| | | | | | | | | - for i.MX1 the register is in the System Control unit, so move the code to arch/arm/mach-imx/imx1.c - for the other i.MX the register is in the watchdog unit, so move the code to drivers/watchdog/imxwd.c Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX/watchdog: Make i.MX watchdog driver the reset source on i.MXSascha Hauer2012-10-053-8/+32
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: Add i.MX watchdog supportSascha Hauer2012-10-053-0/+187
| | | | | | This adds a driver for the watchdog found on i.MX1-i.MX6. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* ARM/MXS: add reset cause detectionJuergen Beisert2012-07-181-0/+25
| | | | | Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM/MXS: add a watchdog driver for i.MX28Juergen Beisert2012-06-293-0/+131
| | | | | Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add a simple watchdog frameworkJuergen Beisert2012-06-293-0/+67
This patch adds a simple wd command which can setup, trigger and stop a watchdog on the platform. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>