xref: /freebsd/sys/arm/ti/omap4/omap4_scm_padconf.h (revision ff0ba87247820afbdfdc1b307c803f7923d0e4d3)
1 /*-
2  * Copyright (c) 2011
3  *	Ben Gray <ben.r.gray@gmail.com>.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the company nor the name of the author may be used to
15  *    endorse or promote products derived from this software without specific
16  *    prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL BEN GRAY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * $FreeBSD$
30  */
31 
32 #ifndef OMAP4_SCM_PADCONF_H
33 #define	OMAP4_SCM_PADCONF_H
34 
35 #define CONTROL_PADCONF_WAKEUP_EVENT     (1UL << 15)
36 #define CONTROL_PADCONF_WAKEUP_ENABLE    (1UL << 14)
37 #define CONTROL_PADCONF_OFF_PULL_UP      (1UL << 13)
38 #define CONTROL_PADCONF_OFF_PULL_ENABLE  (1UL << 12)
39 #define CONTROL_PADCONF_OFF_OUT_HIGH     (1UL << 11)
40 #define CONTROL_PADCONF_OFF_OUT_ENABLE   (1UL << 10)
41 #define CONTROL_PADCONF_OFF_ENABLE       (1UL << 9)
42 #define CONTROL_PADCONF_INPUT_ENABLE     (1UL << 8)
43 #define CONTROL_PADCONF_PULL_UP          (1UL << 4)
44 #define CONTROL_PADCONF_PULL_ENABLE      (1UL << 3)
45 #define CONTROL_PADCONF_MUXMODE_MASK     (0x7)
46 
47 #define CONTROL_PADCONF_SATE_MASK        ( CONTROL_PADCONF_WAKEUP_EVENT \
48                                          | CONTROL_PADCONF_WAKEUP_ENABLE \
49                                          | CONTROL_PADCONF_OFF_PULL_UP \
50                                          | CONTROL_PADCONF_OFF_PULL_ENABLE \
51                                          | CONTROL_PADCONF_OFF_OUT_HIGH \
52                                          | CONTROL_PADCONF_OFF_OUT_ENABLE \
53                                          | CONTROL_PADCONF_OFF_ENABLE \
54                                          | CONTROL_PADCONF_INPUT_ENABLE \
55                                          | CONTROL_PADCONF_PULL_UP \
56                                          | CONTROL_PADCONF_PULL_ENABLE )
57 
58 /* Active pin states */
59 #define PADCONF_PIN_OUTPUT              0
60 #define PADCONF_PIN_INPUT               CONTROL_PADCONF_INPUT_ENABLE
61 #define PADCONF_PIN_INPUT_PULLUP        ( CONTROL_PADCONF_INPUT_ENABLE \
62                                         | CONTROL_PADCONF_PULL_ENABLE \
63                                         | CONTROL_PADCONF_PULL_UP)
64 #define PADCONF_PIN_INPUT_PULLDOWN      ( CONTROL_PADCONF_INPUT_ENABLE \
65                                         | CONTROL_PADCONF_PULL_ENABLE )
66 
67 /* Off mode states */
68 #define PADCONF_PIN_OFF_NONE            0
69 #define PADCONF_PIN_OFF_OUTPUT_HIGH	    ( CONTROL_PADCONF_OFF_ENABLE \
70                                         | CONTROL_PADCONF_OFF_OUT_ENABLE \
71                                         | CONTROL_PADCONF_OFF_OUT_HIGH)
72 #define PADCONF_PIN_OFF_OUTPUT_LOW      ( CONTROL_PADCONF_OFF_ENABLE \
73                                         | CONTROL_PADCONF_OFF_OUT_ENABLE)
74 #define PADCONF_PIN_OFF_INPUT_PULLUP    ( CONTROL_PADCONF_OFF_ENABLE \
75                                         | CONTROL_PADCONF_OFF_PULL_ENABLE \
76                                         | CONTROL_PADCONF_OFF_PULL_UP)
77 #define PADCONF_PIN_OFF_INPUT_PULLDOWN  ( CONTROL_PADCONF_OFF_ENABLE \
78                                         | CONTROL_PADCONF_OFF_PULL_ENABLE)
79 #define PADCONF_PIN_OFF_WAKEUPENABLE	CONTROL_PADCONF_WAKEUP_ENABLE
80 
81 #endif /* OMAP4_SCM_PADCONF_H */
82