/* * Hardware supports following mode of operation: * 1) Interrupt Only: * This will generate the interrupt to arm core whenever timeout happens. * * 2) Interrupt + del3t (Interrupt to firmware (SCP processor)). * This will generate interrupt to arm core on 1st timeout happens * This will generate interrupt to SCP processor on 2nd timeout happens * * 3) Interrupt + Interrupt to SCP processor (called delt3t) + reboot. * This will generate interrupt to arm core on 1st timeout happens * Will generate interrupt to SCP processor on 2nd timeout happens, * if interrupt is configured. * Reboot on 3rd timeout. * * Driver will use hardware in mode-3 above so that system can reboot in case * a hardware hang. Also h/w is configured not to generate SCP interrupt, so * effectively 2nd timeout is ignored within hardware. * * First timeout is effectively watchdog pretimeout.
*/
struct gti_wdt_priv { struct watchdog_device wdev; void __iomem *base;
u32 clock_freq; struct clk *sclk; /* wdt_timer_idx used for timer to be used for system watchdog */
u32 wdt_timer_idx; conststruct gti_match_data *data;
};
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM;
priv->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->base)) return dev_err_probe(&pdev->dev, PTR_ERR(priv->base), "reg property not valid/found\n");
err = gti_wdt_get_cntfrq(pdev, priv); if (err) return dev_err_probe(&pdev->dev, err, "GTI clock frequency not valid/found");
priv->data = of_device_get_match_data(dev);
/* default use last timer for watchdog */
priv->wdt_timer_idx = priv->data->gti_num_timers - 1;
err = of_property_read_u32(dev->of_node, "marvell,wdt-timer-index",
&wdt_idx); if (!err) { if (wdt_idx >= priv->data->gti_num_timers) return dev_err_probe(&pdev->dev, -EINVAL, "GTI wdog timer index not valid");
priv->wdt_timer_idx = wdt_idx;
}
wdog_dev = &priv->wdev;
wdog_dev->info = >i_wdt_ident;
wdog_dev->ops = >i_wdt_ops;
wdog_dev->parent = dev; /* * Watchdog counter is 24 bit where lower 8 bits are zeros * This counter decrements every 1024 clock cycles.
*/
max_pretimeout = (GTI_CWD_WDOG_CNT_MASK >> GTI_CWD_WDOG_CNT_SHIFT);
max_pretimeout &= ~0xFFUL;
max_pretimeout = (max_pretimeout * 1024) / priv->clock_freq;
wdog_dev->pretimeout = max_pretimeout;
/* Maximum timeout is 3 times the pretimeout */
wdog_dev->max_timeout = max_pretimeout * 3;
wdog_dev->max_hw_heartbeat_ms = max_pretimeout * 1000; /* Minimum first timeout (pretimeout) is 1, so min_timeout as 3 */
wdog_dev->min_timeout = 3;
wdog_dev->timeout = wdog_dev->pretimeout;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.