GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-omap2 / mux.h
bloba8e040c2c7e9817aa67115b0e52860dd81653369
1 /*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
10 #include "mux2420.h"
11 #include "mux2430.h"
12 #include "mux34xx.h"
14 #define OMAP_MUX_TERMINATOR 0xffff
16 /* 34xx mux mode options for each pin. See TRM for options */
17 #define OMAP_MUX_MODE0 0
18 #define OMAP_MUX_MODE1 1
19 #define OMAP_MUX_MODE2 2
20 #define OMAP_MUX_MODE3 3
21 #define OMAP_MUX_MODE4 4
22 #define OMAP_MUX_MODE5 5
23 #define OMAP_MUX_MODE6 6
24 #define OMAP_MUX_MODE7 7
26 /* 24xx/34xx mux bit defines */
27 #define OMAP_PULL_ENA (1 << 3)
28 #define OMAP_PULL_UP (1 << 4)
29 #define OMAP_ALTELECTRICALSEL (1 << 5)
31 /* 34xx specific mux bit defines */
32 #define OMAP_INPUT_EN (1 << 8)
33 #define OMAP_OFF_EN (1 << 9)
34 #define OMAP_OFFOUT_EN (1 << 10)
35 #define OMAP_OFFOUT_VAL (1 << 11)
36 #define OMAP_OFF_PULL_EN (1 << 12)
37 #define OMAP_OFF_PULL_UP (1 << 13)
38 #define OMAP_WAKEUP_EN (1 << 14)
40 /* Active pin states */
41 #define OMAP_PIN_OUTPUT 0
42 #define OMAP_PIN_INPUT OMAP_INPUT_EN
43 #define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \
44 | OMAP_PULL_UP)
45 #define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN)
47 /* Off mode states */
48 #define OMAP_PIN_OFF_NONE 0
49 #define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \
50 | OMAP_OFFOUT_VAL)
51 #define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN)
52 #define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \
53 | OMAP_OFF_PULL_UP)
54 #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN)
55 #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN
57 #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4)
59 /* Flags for omap_mux_init */
60 #define OMAP_PACKAGE_MASK 0xffff
61 #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */
62 #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */
63 #define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */
64 #define OMAP_PACKAGE_CBC 3 /* 515-pin 0.50 0.65 */
65 #define OMAP_PACKAGE_ZAC 2 /* 24xx 447-pin POP */
66 #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */
69 #define OMAP_MUX_NR_MODES 8 /* Available modes */
70 #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */
72 /**
73 * struct omap_mux - data for omap mux register offset and it's value
74 * @reg_offset: mux register offset from the mux base
75 * @gpio: GPIO number
76 * @muxnames: available signal modes for a ball
78 struct omap_mux {
79 u16 reg_offset;
80 u16 gpio;
81 #ifdef CONFIG_OMAP_MUX
82 char *muxnames[OMAP_MUX_NR_MODES];
83 #ifdef CONFIG_DEBUG_FS
84 char *balls[OMAP_MUX_NR_SIDES];
85 #endif
86 #endif
89 /**
90 * struct omap_ball - data for balls on omap package
91 * @reg_offset: mux register offset from the mux base
92 * @balls: available balls on the package
94 struct omap_ball {
95 u16 reg_offset;
96 char *balls[OMAP_MUX_NR_SIDES];
99 /**
100 * struct omap_board_mux - data for initializing mux registers
101 * @reg_offset: mux register offset from the mux base
102 * @mux_value: desired mux value to set
104 struct omap_board_mux {
105 u16 reg_offset;
106 u16 value;
109 #if defined(CONFIG_OMAP_MUX)
112 * omap_mux_init_gpio - initialize a signal based on the GPIO number
113 * @gpio: GPIO number
114 * @val: Options for the mux register value
116 int omap_mux_init_gpio(int gpio, int val);
119 * omap_mux_init_signal - initialize a signal based on the signal name
120 * @muxname: Mux name in mode0_name.signal_name format
121 * @val: Options for the mux register value
123 int omap_mux_init_signal(char *muxname, int val);
125 #else
127 static inline int omap_mux_init_gpio(int gpio, int val)
129 return 0;
131 static inline int omap_mux_init_signal(char *muxname, int val)
133 return 0;
136 #endif
139 * omap_mux_get_gpio() - get mux register value based on GPIO number
140 * @gpio: GPIO number
143 u16 omap_mux_get_gpio(int gpio);
146 * omap_mux_set_gpio() - set mux register value based on GPIO number
147 * @val: New mux register value
148 * @gpio: GPIO number
151 void omap_mux_set_gpio(u16 val, int gpio);
154 * omap_mux_read() - read mux register
155 * @mux_offset: Offset of the mux register
158 u16 omap_mux_read(u16 mux_offset);
161 * omap_mux_write() - write mux register
162 * @val: New mux register value
163 * @mux_offset: Offset of the mux register
165 * This should be only needed for dynamic remuxing of non-gpio signals.
167 void omap_mux_write(u16 val, u16 mux_offset);
170 * omap_mux_write_array() - write an array of mux registers
171 * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR
173 * This should be only needed for dynamic remuxing of non-gpio signals.
175 void omap_mux_write_array(struct omap_board_mux *board_mux);
178 * omap2420_mux_init() - initialize mux system with board specific set
179 * @board_mux: Board specific mux table
180 * @flags: OMAP package type used for the board
182 int omap2420_mux_init(struct omap_board_mux *board_mux, int flags);
185 * omap2430_mux_init() - initialize mux system with board specific set
186 * @board_mux: Board specific mux table
187 * @flags: OMAP package type used for the board
189 int omap2430_mux_init(struct omap_board_mux *board_mux, int flags);
192 * omap3_mux_init() - initialize mux system with board specific set
193 * @board_mux: Board specific mux table
194 * @flags: OMAP package type used for the board
196 int omap3_mux_init(struct omap_board_mux *board_mux, int flags);
199 * omap_mux_init - private mux init function, do not call
201 int omap_mux_init(u32 mux_pbase, u32 mux_size,
202 struct omap_mux *superset,
203 struct omap_mux *package_subset,
204 struct omap_board_mux *board_mux,
205 struct omap_ball *package_balls);