Home | History | Annotate | Line # | Download | only in samsung
mct_reg.h revision 1.1
      1 /* $NetBSD */
      2 /*-
      3  * Copyright (c) 2014 The NetBSD Foundation, Inc.
      4  * All rights reserved.
      5  *
      6  * This code is derived from software contributed to The NetBSD Foundation
      7  * by Reinoud Zandijk.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28  * POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #ifndef _ARM_SAMSUNG_MCT_REG_H_
     32 #define _ARM_SAMSUNG_MCT_REG_H_
     33 
     34 /* global timer register offsets */
     35 #define MCT_G_CNT_L		0x100		/* lower bits */
     36 #define MCT_G_CNT_U		0x104		/* higher bits */
     37 #define MCT_G_CNT_WSTAT		0x110		/* wait for write OK cntr */
     38 #define   G_CNT_WSTAT_L		__BIT(0)
     39 #define   G_CNT_WSTAT_U		__BIT(1)
     40 
     41 #define MCT_G_COMP0_L		0x200		/* compare0 lower bits */
     42 #define MCT_G_COMP0_U		0x204		/* compare0 higher bits */
     43 #define MCT_G_COMP0_ADD_INCR	0x208		/* compare0 auto add value */
     44 #define MCT_G_TCON		0x240		/* configuration register */
     45 #define   G_TCON_COMP0_ENABLE	__BIT(0)
     46 #define   G_TCON_COMP0_AUTOINC	__BIT(1)
     47 #define   G_TCON_START		__BIT(8)
     48 #define MCT_G_INT_CSTAT		0x244		/* clear interrupt */
     49 #define   G_INT_CSTAT_CLEAR	__BIT(0)
     50 #define MCT_G_INT_ENB		0x248		/* enable interrupts */
     51 #define   G_INT_ENB_ENABLE	__BIT(0)
     52 #define MCT_G_WSTAT		0x24C		/* wait for write OK */
     53 #define   G_WSTAT_COMP0_L	__BIT(0)
     54 #define   G_WSTAT_COMP0_U	__BIT(1)
     55 #define   G_WSTAT_ADD_INCR	__BIT(2)
     56 #define   G_WSTAT_TCON		__BIT(16)
     57 
     58 /* local cpu-bound timers */
     59 #define MCT_L_OFFSET(x)		(0x300 + (0x100 * x))
     60 #define MCT_L_MASK		0xffffff00
     61 
     62 #define MCT_L_TCNTB		0x00		/* TODO: what */
     63 #define MCT_L_ICNTB		0x08		/* interrupt count buffer */
     64 #define   L_INCTB_UPDATE(x)	(__BIT(31) | (x))
     65 #define MCT_L_TCON		0x20		/* configuration register */
     66 #define   L_TCON_TIMER_START	__BIT(0)
     67 #define   L_TCON_INT_START	__BIT(1)
     68 #define   L_TCON_INTERVAL_MODE	__BIT(2)
     69 #define MCT_L_INC_CSTAT		0x30
     70 #define   L_INC_CSTAT_CLEAR	__BIT(0)
     71 #define MCT_L_INT_ENB		0x34
     72 #define   L_INT_ENB_ENABLE	__BIT(0)
     73 #define MCT_L_WSTAT		0x40
     74 #define   L_WSTAT_L_TCNTB	__BIT(0)
     75 #define   L_WSTAT_L_ICNTB	__BIT(1)
     76 #define   L_WSTAT_L_TCON	__BIT(3)
     77 
     78 #endif /* _ARM_SAMSUNG_MCT_REG_H_ */
     79 
     80