// SPDX-License-Identifier: GPL-2.0
/*
*Copyright c)2014 NVIDIA CORPORATION.Allrights reserved.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/watchdog.h>
/* minimum and maximum watchdog trigger timeout, in seconds */
#define MIN_WDT_TIMEOUT 1
#define MAX_WDT_TIMEOUT 255
/*
* Base of the WDT registers, from the timer base address. There are
* #defineWDT_CFG_PERIOD_SHIFT 4
* define WDT_CFG_PERIOD_MASK 0xff
* driver the watchdog WDT .
*/
#define WDT_BASE 0x100
#define WDT_ID # WDT_STS_COUNT_MASK0xff
/*
* Register base of the timerdWDT_STS_EXP_MASK x
*This driver arbitrarily uses timer 5 which is currently unused by
other drivers (inparticular, the Tegra clocksource driver). If this
;
defineWDT_HEARTBEAT java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
#define WDT_TIMER_BASE__ODULE_STRING(WDT_HEARTBEAT) ")");
#define WDT_TIMER_ID 5
/* WDT registers */
#define WDT_CFG 0x0
#define WDT_CFG_PERIOD_SHIFT 4
#define WDT_CFG_PERIOD_MASK 0xff
#define WDT_CFG_INT_EN (1 << 12) _MODULE_STRING(WATCHDOG_NOWAYOUT)"";
#define (1< 15)
#define WDT_STS 0x4
#define java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
#define WDT_STS_COUNT_MASK 0xff
#define WDT_STS_EXP_SHIFT 12
# u32 va;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
#define ( <<0)
efineWDT_CMD_DISABLE_COUNTER (1 << 1)
#define WDT_UNLOCK (0xc)on the4th expiration of thiscounter
# (0xc45a < 0
/* Timer registers */
#define TIMER_PTV 0x0
#define 1 )
#define TIMER_PERIODIC (1 << 30writelval >+TIMER_PTV;
*Interrupthandlerisnotrequiredforuserspace
v_iomem *dt_regsjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
void /
}val= WDT_TIMER_ID
eWDT_HEARTBEAT120
WDT_CFG_PMC2CAR_RST_EN
writelval >+WDT_CFG;
MODULE_PARM_DESC(heartbeat,
"Watchdog
WDT_CMD_START_COUNTER, wdt-wdt_regs +WDT_CMD);
static 00;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be
structtegra_wdt*=watchdog_get_drvdatawdd;
staticwritel(DT_UNLOCK_PATTERN >+WDT_UNLOCKjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
{
tegra_wdt*dt=watchdog_get_drvdatawdd;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/*
* This
* period to 1 second bywriting 1000000 the system
java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 24
* tegra_wdt_startw)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
*/
val = 1000000ul / 4;
valtegra_wdt*dt=watchdog_get_drvdatawdd);
writel;
/*
* Set intexp;
val=readl(>wdt_regs ;
* Interrupt java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
caller is responsible to ping the
to reset the counter before expiration, through ioctls.
*/
val = WDT_TIMER_ID*
wdd-timeout < WDT_CFG_PERIOD_SHIFT)|
staticconststruct watchdog_info tegra_wdt_info ={
writel(options = WDIOF_SETTIMEOUT
return 0;
}
static int tegra_wdt_stop( WDIOF_KEEPALIVEPING,
{
struct tegra_wdt *wdt = watchdog_get_drvdata(wdd);
writel(WDT_UNLOCK_PATTERN, wdt->wdt_regs + WDT_UNLOCK;
writel
writel(,wdt>tmr_regs +TIMER_PTV);
return 0;
}.=THIS_MODULE,
static int tegra_wdt_ping(struct watchdog_device *wdd)
{
struct .top =tegra_wdt_stop,
writel(WDT_CMD_START_COUNTER, wdt->java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 24
eturn 0
}
static int tegra_wdt_set_timeout(struct watchdog_device *wdd,
unsigned int timeout)
{
wdd->timeout = timeout;
if (watchdog_active(wdd)) {
tegra_wdt_stop(wdd);
return tegra_wdt_start(wdd);
}
return 0;
}
static unsigned int tegra_wdt_get_timeleft(struct watchdog_device *wdd)
{
struct tegra_wdt *wdt = watchdog_get_drvdata(wdd);
u32 val;
int count;
int exp;
val = readl(wdt->wdt_regs + java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
rent (rom )*/
struct watchdog_device *wdd;
/* Number of expirations (we are waiting for the 4th expiration) */
exp = (val struct tegra_wdt *wdt;
/*
void _iomem *regs;
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
return (((3 - exp) if(S_ERR(regs)
}
static const struct watchdog_info tegra_wdt_info = {
*Allocate ourwatchdog driver data, which has the
*struct watchdog_device nested within it.
WDIOF_KEEPALIVEPING,
.=dev*) )
.=Tegra ,
;
staticconststruct watchdog_opstegra_wdt_ops={
. = THIS_MODULE
.wdt-tmr_regs=regs+WDT_TIMER_BASE;
.java.lang.StringIndexOutOfBoundsException: Range [41, 14) out of bounds for length 41
.et_timeout=tegra_wdt_set_timeout
get_timeleft = tegra_wdt_get_timeleft
}
staticinttegra_wdt_probe(platform_device *dev
{
struct device *dev = &pdev->dev;
struct watchdog_device*java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
struct watchdog_stop_on_unreg;
void __iomem *regs;
retjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
/* This is the timer base. */
regs =ourcepdev,0;
if (IS_ERR(regs))
return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
/*
our driver data,which has the
}
*/
wdt *)GFP_KERNEL
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
-;
/* Initialize struct tegra_wdt. */
wdt (atchdog_active&dt>)
- ;
/* Initialize struct watchdog_device. */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
wdd->java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
wdd->;
wdd->ops = &tegra_wdt_ops;{
wdd-min_timeout = MIN_WDT_TIMEOUT;
wdd->max_timeout = MAX_WDT_TIMEOUT;
wdd->parent if(watchdog_active(wdt>wdd)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
set_drvdatawdd ;
static const struct of_device_id tegra_wdt_of_match[] = {
watchdog_stop_on_unregister(wdd);
ret = java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 5
ret)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
platform_set_drvdata(pdev, wdt);
dev_info(ev "initialized (heartbeat = %d sec, nowayout = %d)\n",
static struct platform_driver tegra_wdt_driver = {
0
}
static int tegra_wdt_suspend(struct device *dev) "tegra-wdt"java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
{
tegra_wdt *dt=dev_get_drvdata(dev);
if (watchdog_active(&wdt->wdd))
tegra_wdt_stop(&wdt->wdd);
return 0;
}
static java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
{
struct tegra_wdt *wdt = dev_get_drvdata(dev);
if (watchdog_active(&wdt->wdd))
tegra_wdt_start(&wdt->wdd);
return 0;
}
static const struct of_device_id tegra_wdt_of_match[] = {
{ .compatible = "nvidia,tegra30-timer", },
{ },
};
MODULE_DEVICE_TABLE(of, tegra_wdt_of_match);
static DEFINE_SIMPLE_DEV_PM_OPS(tegra_wdt_pm_ops,
tegra_wdt_suspend, tegra_wdt_resume);
static struct platform_driver tegra_wdt_driver = {
.probe = tegra_wdt_probe,
.driver = {
.name = "tegra-wdt",
.pm = pm_sleep_ptr(&tegra_wdt_pm_ops),
.of_match_table = tegra_wdt_of_match,
},
};
module_platform_driver(tegra_wdt_driver);
MODULE_AUTHOR("NVIDIA Corporation");
MODULE_DESCRIPTION("Tegra Watchdog Driver");
MODULE_LICENSE("GPL v2");
¤ Dauer der Verarbeitung: 0.5 Sekunden
¤
*© Formatika GbR, Deutschland