]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/cbus/retu.h
Add CBUS support
[linux-2.6-omap-h63xx.git] / drivers / cbus / retu.h
1 /**
2  * drivers/cbus/retu.h
3  *
4  * Copyright (C) 2004, 2005 Nokia Corporation
5  *
6  * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
7  *            David Weinehall <david.weinehall@nokia.com>
8  *
9  * This file is subject to the terms and conditions of the GNU General
10  * Public License. See the file "COPYING" in the main directory of this
11  * archive for more details.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __DRIVERS_CBUS_RETU_H
24 #define __DRIVERS_CBUS_RETU_H
25
26 #include <linux/types.h>
27
28 /* Registers */
29 #define RETU_REG_ASICR          0x00    /* ASIC ID & revision */
30 #define RETU_REG_IDR            0x01    /* Interrupt ID */
31 #define RETU_REG_IMR            0x02    /* Interrupt mask */
32 #define RETU_REG_RTCDSR         0x03    /* RTC seconds register */
33 #define RETU_REG_RTCHMR         0x04    /* RTC hours and minutes register */
34 #define RETU_REG_RTCHMAR        0x05    /* RTC hours and minutes alarm and time set register */
35 #define RETU_REG_RTCCALR        0x06    /* RTC calibration register */
36 #define RETU_REG_ADCR           0x08    /* ADC result */
37 #define RETU_REG_CC1            0x0d    /* Common control register 1 */
38 #define RETU_REG_CC2            0x0e    /* Common control register 2 */
39 #define RETU_REG_CTRL_CLR       0x0f    /* Regulator clear register */
40 #define RETU_REG_CTRL_SET       0x10    /* Regulator set register */
41 #define RETU_REG_STATUS         0x16    /* Status register */
42 #define RETU_REG_WATCHDOG       0x17    /* Watchdog register */
43 #define RETU_REG_MAX            0x1f
44
45 /* Interrupt sources */
46 #define RETU_INT_PWR            0
47 #define RETU_INT_CHAR           1
48 #define RETU_INT_RTCS           2
49 #define RETU_INT_RTCM           3
50 #define RETU_INT_RTCD           4
51 #define RETU_INT_RTCA           5
52 #define RETU_INT_ADCS           8
53
54 #define MAX_RETU_IRQ_HANDLERS   16
55
56 int retu_read_reg(int reg);
57 void retu_write_reg(int reg, u16 val);
58 void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
59 int retu_read_adc(int channel);
60 int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
61 void retu_free_irq(int id);
62 void retu_enable_irq(int id);
63 void retu_disable_irq(int id);
64 void retu_ack_irq(int id);
65
66 #ifdef CONFIG_CBUS_RETU_USER
67 int retu_user_init(void);
68 void retu_user_cleanup(void);
69 #endif
70
71 extern spinlock_t retu_lock;
72
73 #endif /* __DRIVERS_CBUS_RETU_H */