173b4390fb23456964201abda79f1210fe337d01aRalf Baechle/* 273b4390fb23456964201abda79f1210fe337d01aRalf Baechle * Definitions for timer registers 373b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 473b4390fb23456964201abda79f1210fe337d01aRalf Baechle * Copyright 2004 Philip Rischel <rischelp@idt.com> 573b4390fb23456964201abda79f1210fe337d01aRalf Baechle * Copyright 2008 Florian Fainelli <florian@openwrt.org> 673b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 773b4390fb23456964201abda79f1210fe337d01aRalf Baechle * This program is free software; you can redistribute it and/or modify it 873b4390fb23456964201abda79f1210fe337d01aRalf Baechle * under the terms of the GNU General Public License as published by the 973b4390fb23456964201abda79f1210fe337d01aRalf Baechle * Free Software Foundation; either version 2 of the License, or (at your 1073b4390fb23456964201abda79f1210fe337d01aRalf Baechle * option) any later version. 1173b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 1273b4390fb23456964201abda79f1210fe337d01aRalf Baechle * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 1373b4390fb23456964201abda79f1210fe337d01aRalf Baechle * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1473b4390fb23456964201abda79f1210fe337d01aRalf Baechle * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 1573b4390fb23456964201abda79f1210fe337d01aRalf Baechle * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1673b4390fb23456964201abda79f1210fe337d01aRalf Baechle * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1773b4390fb23456964201abda79f1210fe337d01aRalf Baechle * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1873b4390fb23456964201abda79f1210fe337d01aRalf Baechle * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1973b4390fb23456964201abda79f1210fe337d01aRalf Baechle * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2073b4390fb23456964201abda79f1210fe337d01aRalf Baechle * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2173b4390fb23456964201abda79f1210fe337d01aRalf Baechle * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2273b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 2373b4390fb23456964201abda79f1210fe337d01aRalf Baechle * You should have received a copy of the GNU General Public License along 2473b4390fb23456964201abda79f1210fe337d01aRalf Baechle * with this program; if not, write to the Free Software Foundation, Inc., 2573b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 675 Mass Ave, Cambridge, MA 02139, USA. 2673b4390fb23456964201abda79f1210fe337d01aRalf Baechle * 2773b4390fb23456964201abda79f1210fe337d01aRalf Baechle */ 2873b4390fb23456964201abda79f1210fe337d01aRalf Baechle 2973b4390fb23456964201abda79f1210fe337d01aRalf Baechle#ifndef __ASM_RC32434_TIMER_H 3073b4390fb23456964201abda79f1210fe337d01aRalf Baechle#define __ASM_RC32434_TIMER_H 3173b4390fb23456964201abda79f1210fe337d01aRalf Baechle 3273b4390fb23456964201abda79f1210fe337d01aRalf Baechle#include <asm/mach-rc32434/rb.h> 3373b4390fb23456964201abda79f1210fe337d01aRalf Baechle 3473b4390fb23456964201abda79f1210fe337d01aRalf Baechle#define TIMER0_BASE_ADDR 0x18028000 3573b4390fb23456964201abda79f1210fe337d01aRalf Baechle#define TIMER_COUNT 3 3673b4390fb23456964201abda79f1210fe337d01aRalf Baechle 3773b4390fb23456964201abda79f1210fe337d01aRalf Baechlestruct timer_counter { 3873b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 count; 3973b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 compare; 4073b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 ctc; /*use CTC_ */ 4173b4390fb23456964201abda79f1210fe337d01aRalf Baechle}; 4273b4390fb23456964201abda79f1210fe337d01aRalf Baechle 4373b4390fb23456964201abda79f1210fe337d01aRalf Baechlestruct timer { 4473b4390fb23456964201abda79f1210fe337d01aRalf Baechle struct timer_counter tim[TIMER_COUNT]; 4573b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 rcount; /* use RCOUNT_ */ 4673b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 rcompare; /* use RCOMPARE_ */ 4773b4390fb23456964201abda79f1210fe337d01aRalf Baechle u32 rtc; /* use RTC_ */ 4873b4390fb23456964201abda79f1210fe337d01aRalf Baechle}; 4973b4390fb23456964201abda79f1210fe337d01aRalf Baechle 5073b4390fb23456964201abda79f1210fe337d01aRalf Baechle#define RC32434_CTC_EN_BIT 0 5173b4390fb23456964201abda79f1210fe337d01aRalf Baechle#define RC32434_CTC_TO_BIT 1 5273b4390fb23456964201abda79f1210fe337d01aRalf Baechle 5373b4390fb23456964201abda79f1210fe337d01aRalf Baechle/* Real time clock registers */ 547034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RTC_MSK(x) BIT_TO_MASK(x) 557034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RTC_CE_BIT 0 567034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RTC_TO_BIT 1 577034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RTC_RQE_BIT 2 5873b4390fb23456964201abda79f1210fe337d01aRalf Baechle 5973b4390fb23456964201abda79f1210fe337d01aRalf Baechle/* Counter registers */ 607034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RCOUNT_BIT 0 617034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RCOUNT_MSK 0x0000ffff 627034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RCOMP_BIT 0 637034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#define RC32434_RCOMP_MSK 0x0000ffff 6473b4390fb23456964201abda79f1210fe337d01aRalf Baechle 657034228792cc561e79ff8600f02884bd4c80e287Ralf Baechle#endif /* __ASM_RC32434_TIMER_H */ 66