18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Definitions for timer registers 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright 2004 Philip Rischel <rischelp@idt.com> 58c2ecf20Sopenharmony_ci * Copyright 2008 Florian Fainelli <florian@openwrt.org> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 88c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 98c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 108c2ecf20Sopenharmony_ci * option) any later version. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 138c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 148c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 158c2ecf20Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 168c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 178c2ecf20Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 188c2ecf20Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 198c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 208c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 218c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 248c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 258c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#ifndef __ASM_RC32434_TIMER_H 308c2ecf20Sopenharmony_ci#define __ASM_RC32434_TIMER_H 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#include <asm/mach-rc32434/rb.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define TIMER0_BASE_ADDR 0x18028000 358c2ecf20Sopenharmony_ci#define TIMER_COUNT 3 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct timer_counter { 388c2ecf20Sopenharmony_ci u32 count; 398c2ecf20Sopenharmony_ci u32 compare; 408c2ecf20Sopenharmony_ci u32 ctc; /*use CTC_ */ 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistruct timer { 448c2ecf20Sopenharmony_ci struct timer_counter tim[TIMER_COUNT]; 458c2ecf20Sopenharmony_ci u32 rcount; /* use RCOUNT_ */ 468c2ecf20Sopenharmony_ci u32 rcompare; /* use RCOMPARE_ */ 478c2ecf20Sopenharmony_ci u32 rtc; /* use RTC_ */ 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define RC32434_CTC_EN_BIT 0 518c2ecf20Sopenharmony_ci#define RC32434_CTC_TO_BIT 1 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* Real time clock registers */ 548c2ecf20Sopenharmony_ci#define RC32434_RTC_MSK(x) BIT_TO_MASK(x) 558c2ecf20Sopenharmony_ci#define RC32434_RTC_CE_BIT 0 568c2ecf20Sopenharmony_ci#define RC32434_RTC_TO_BIT 1 578c2ecf20Sopenharmony_ci#define RC32434_RTC_RQE_BIT 2 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* Counter registers */ 608c2ecf20Sopenharmony_ci#define RC32434_RCOUNT_BIT 0 618c2ecf20Sopenharmony_ci#define RC32434_RCOUNT_MSK 0x0000ffff 628c2ecf20Sopenharmony_ci#define RC32434_RCOMP_BIT 0 638c2ecf20Sopenharmony_ci#define RC32434_RCOMP_MSK 0x0000ffff 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#endif /* __ASM_RC32434_TIMER_H */ 66