/* TCS Stands for Timer Control/Status: these are masks to be used in */ /* the Timer Count Registers */ #define MASK_TCS_ENABLE 0x01 #define MASK_TCS_PERIOD 0x02 #define MASK_TCS_RELOAD 0x04 #define MASK_TCS_TC 0x80
gxp_timer = kzalloc(sizeof(*gxp_timer), GFP_KERNEL); if (!gxp_timer) {
ret = -ENOMEM;
pr_err("Can't allocate gxp_timer"); return ret;
}
clk = of_clk_get(node, 0); if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
pr_err("%pOFn clock not found: %d\n", node, ret); goto err_free;
}
ret = clk_prepare_enable(clk); if (ret) {
pr_err("%pOFn clock enable failed: %d\n", node, ret); goto err_clk_enable;
}
base = of_iomap(node, 0); if (!base) {
ret = -ENXIO;
pr_err("Can't map timer base registers"); goto err_iomap;
}
/* Set the offsets to the clock register and timer registers */
gxp_timer->counter = base + GXP_TIMER_CNT_OFS;
gxp_timer->control = base + GXP_TIMER_CTRL_OFS;
system_clock = base + GXP_TIMESTAMP_OFS;
/* * This probe gets called after the timer is already up and running. This will create * the watchdog device as a child since the registers are shared.
*/
if (!gxp_timer) {
pr_err("Gxp Timer not initialized, cannot create watchdog"); return -ENOMEM;
}
gxp_watchdog_device = platform_device_alloc("gxp-wdt", -1); if (!gxp_watchdog_device) {
pr_err("Timer failed to allocate gxp-wdt"); return -ENOMEM;
}
/* Pass the base address (counter) as platform data and nothing else */
gxp_watchdog_device->dev.platform_data = gxp_timer->counter;
gxp_watchdog_device->dev.parent = dev;
ret = platform_device_add(gxp_watchdog_device); if (ret)
platform_device_put(gxp_watchdog_device);
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.