162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *  Definitions for timer registers
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  Copyright 2004 Philip Rischel <rischelp@idt.com>
562306a36Sopenharmony_ci *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  This program is free software; you can redistribute  it and/or modify it
862306a36Sopenharmony_ci *  under  the terms of  the GNU General  Public License as published by the
962306a36Sopenharmony_ci *  Free Software Foundation;  either version 2 of the  License, or (at your
1062306a36Sopenharmony_ci *  option) any later version.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1362306a36Sopenharmony_ci *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1462306a36Sopenharmony_ci *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1562306a36Sopenharmony_ci *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1662306a36Sopenharmony_ci *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1762306a36Sopenharmony_ci *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1862306a36Sopenharmony_ci *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1962306a36Sopenharmony_ci *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
2062306a36Sopenharmony_ci *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2162306a36Sopenharmony_ci *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci *  You should have received a copy of the  GNU General Public License along
2462306a36Sopenharmony_ci *  with this program; if not, write  to the Free Software Foundation, Inc.,
2562306a36Sopenharmony_ci *  675 Mass Ave, Cambridge, MA 02139, USA.
2662306a36Sopenharmony_ci *
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#ifndef __ASM_RC32434_TIMER_H
3062306a36Sopenharmony_ci#define __ASM_RC32434_TIMER_H
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#include <asm/mach-rc32434/rb.h>
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define TIMER0_BASE_ADDR		0x18028000
3562306a36Sopenharmony_ci#define TIMER_COUNT			3
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cistruct timer_counter {
3862306a36Sopenharmony_ci	u32 count;
3962306a36Sopenharmony_ci	u32 compare;
4062306a36Sopenharmony_ci	u32 ctc;		/*use CTC_ */
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistruct timer {
4462306a36Sopenharmony_ci	struct timer_counter tim[TIMER_COUNT];
4562306a36Sopenharmony_ci	u32 rcount;	/* use RCOUNT_ */
4662306a36Sopenharmony_ci	u32 rcompare;	/* use RCOMPARE_ */
4762306a36Sopenharmony_ci	u32 rtc;	/* use RTC_ */
4862306a36Sopenharmony_ci};
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define RC32434_CTC_EN_BIT		0
5162306a36Sopenharmony_ci#define RC32434_CTC_TO_BIT		1
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/* Real time clock registers */
5462306a36Sopenharmony_ci#define RC32434_RTC_MSK(x)		BIT_TO_MASK(x)
5562306a36Sopenharmony_ci#define RC32434_RTC_CE_BIT		0
5662306a36Sopenharmony_ci#define RC32434_RTC_TO_BIT		1
5762306a36Sopenharmony_ci#define RC32434_RTC_RQE_BIT		2
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* Counter registers */
6062306a36Sopenharmony_ci#define RC32434_RCOUNT_BIT		0
6162306a36Sopenharmony_ci#define RC32434_RCOUNT_MSK		0x0000ffff
6262306a36Sopenharmony_ci#define RC32434_RCOMP_BIT		0
6362306a36Sopenharmony_ci#define RC32434_RCOMP_MSK		0x0000ffff
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#endif	/* __ASM_RC32434_TIMER_H */
66