/*1* Copyright (C) 2010, Lars-Peter Clausen <[email protected]>2* JZ4740 platform timer support3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License as published by the6* Free Software Foundation; either version 2 of the License, or (at your7* option) any later version.8*9* You should have received a copy of the GNU General Public License along10* with this program; if not, write to the Free Software Foundation, Inc.,11* 675 Mass Ave, Cambridge, MA 02139, USA.12*13*/1415#include <linux/io.h>16#include <linux/kernel.h>17#include <linux/module.h>1819#include "timer.h"2021#include <asm/mach-jz4740/base.h>2223void __iomem *jz4740_timer_base;2425void jz4740_timer_enable_watchdog(void)26{27writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_CLEAR);28}29EXPORT_SYMBOL_GPL(jz4740_timer_enable_watchdog);3031void jz4740_timer_disable_watchdog(void)32{33writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_SET);34}35EXPORT_SYMBOL_GPL(jz4740_timer_disable_watchdog);3637void __init jz4740_timer_init(void)38{39jz4740_timer_base = ioremap(JZ4740_TCU_BASE_ADDR, 0x100);4041if (!jz4740_timer_base)42panic("Failed to ioremap timer registers");4344/* Disable all timer clocks except for those used as system timers */45writel(0x000100fc, jz4740_timer_base + JZ_REG_TIMER_STOP_SET);4647/* Timer irqs are unmasked by default, mask them */48writel(0x00ff00ff, jz4740_timer_base + JZ_REG_TIMER_MASK_SET);49}505152