Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mux.h
Go to the documentation of this file.
1 /*
2  * arch/arm/plat-omap/include/mach/mux.h
3  *
4  * Table of the Omap register configurations for the FUNC_MUX and
5  * PULL_DWN combinations.
6  *
7  * Copyright (C) 2004 - 2008 Texas Instruments Inc.
8  * Copyright (C) 2003 - 2008 Nokia Corporation
9  *
10  * Written by Tony Lindgren
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * NOTE: Please use the following naming style for new pin entries.
27  * For example, W8_1610_MMC2_DAT0, where:
28  * - W8 = ball
29  * - 1610 = 1510 or 1610, none if common for both 1510 and 1610
30  * - MMC2_DAT0 = function
31  */
32 
33 #ifndef __ASM_ARCH_MUX_H
34 #define __ASM_ARCH_MUX_H
35 
36 #define PU_PD_SEL_NA 0 /* No pu_pd reg available */
37 #define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */
38 
39 #ifdef CONFIG_OMAP_MUX_DEBUG
40 #define MUX_REG(reg, mode_offset, mode) .mux_reg_name = "FUNC_MUX_CTRL_"#reg, \
41  .mux_reg = FUNC_MUX_CTRL_##reg, \
42  .mask_offset = mode_offset, \
43  .mask = mode,
44 
45 #define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \
46  .pull_reg = PULL_DWN_CTRL_##reg, \
47  .pull_bit = bit, \
48  .pull_val = status,
49 
50 #define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \
51  .pu_pd_reg = PU_PD_SEL_##reg, \
52  .pu_pd_val = status,
53 
54 #define MUX_REG_7XX(reg, mode_offset, mode) .mux_reg_name = "OMAP7XX_IO_CONF_"#reg, \
55  .mux_reg = OMAP7XX_IO_CONF_##reg, \
56  .mask_offset = mode_offset, \
57  .mask = mode,
58 
59 #define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \
60  .pull_reg = OMAP7XX_IO_CONF_##reg, \
61  .pull_bit = bit, \
62  .pull_val = status,
63 
64 #else
65 
66 #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \
67  .mask_offset = mode_offset, \
68  .mask = mode,
69 
70 #define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \
71  .pull_bit = bit, \
72  .pull_val = status,
73 
74 #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
75  .pu_pd_val = status,
76 
77 #define MUX_REG_7XX(reg, mode_offset, mode) \
78  .mux_reg = OMAP7XX_IO_CONF_##reg, \
79  .mask_offset = mode_offset, \
80  .mask = mode,
81 
82 #define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \
83  .pull_bit = bit, \
84  .pull_val = status,
85 
86 #endif /* CONFIG_OMAP_MUX_DEBUG */
87 
88 #define MUX_CFG(desc, mux_reg, mode_offset, mode, \
89  pull_reg, pull_bit, pull_status, \
90  pu_pd_reg, pu_pd_status, debug_status) \
91 { \
92  .name = desc, \
93  .debug = debug_status, \
94  MUX_REG(mux_reg, mode_offset, mode) \
95  PULL_REG(pull_reg, pull_bit, pull_status) \
96  PU_PD_REG(pu_pd_reg, pu_pd_status) \
97 },
98 
99 
100 /*
101  * OMAP730/850 has a slightly different config for the pin mux.
102  * - config regs are the OMAP7XX_IO_CONF_x regs (see omap7xx.h) regs and
103  * not the FUNC_MUX_CTRL_x regs from hardware.h
104  * - for pull-up/down, only has one enable bit which is is in the same register
105  * as mux config
106  */
107 #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \
108  pull_bit, pull_status, debug_status)\
109 { \
110  .name = desc, \
111  .debug = debug_status, \
112  MUX_REG_7XX(mux_reg, mode_offset, mode) \
113  PULL_REG_7XX(mux_reg, pull_bit, pull_status) \
114  PU_PD_REG(NA, 0) \
115 },
116 
117 struct pin_config {
118  char *name;
119  const unsigned int mux_reg;
120  unsigned char debug;
121 
122  const unsigned char mask_offset;
123  const unsigned char mask;
124 
125  const char *pull_name;
126  const unsigned int pull_reg;
127  const unsigned char pull_val;
128  const unsigned char pull_bit;
129 
130  const char *pu_pd_name;
131  const unsigned int pu_pd_reg;
132  const unsigned char pu_pd_val;
133 
134 #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS)
135  const char *mux_reg_name;
136 #endif
137 
138 };
139 
141  /* OMAP 730 keyboard */
152 
153  /* USB */
159 
160  /* MMC */
164 
165  /* I2C */
168 
169  /* SPI */
176 
177  /* UART */
180 };
181 
183  /* UART1 (BT_UART_GATING)*/
184  UART1_TX = 0,
186 
187  /* UART2 (COM_UART_GATING)*/
192 
193  /* UART3 (GIGA_UART_GATING) */
199  UART3_BCLK, /* 12MHz clock out */
201 
202  /* PWT & PWL */
205 
206  /* USB master generic */
213 
214  /* USB1 master */
226 
227  /* USB2 master */
235 
236  /* OMAP-1510 GPIO */
240 
241  /* OMAP1610 GPIO */
244 
245  /* OMAP-1710 GPIO */
250 
251  /* MPUIO */
265 
266  /* MCBSP2 */
273 
274  /* MCBSP3 */
276 
277  /* Misc ballouts */
280 
281  /* OMAP-1610 MMC2 */
292 
293  /* OMAP-1610 External Trace Interface */
300 
301  /* OMAP16XX GPIO */
315 
316  /* OMAP-1610 uWire */
323 
324  /* OMAP-1610 SPI */
334 
335  /* OMAP-1610 Flash */
338 
339  /* First MMC */
346 
347  /* OMAP-1710 MMC CMDDIR and DATDIR0 */
351 
352  /* OMAP-1610 USB0 alternate pin configuration */
361 
362  /* USB2 */
369 
370  /* 16XX UART */
377 
378  /* I2C OMAP-1610 */
381 
382  /* Keypad */
394 
395  /* Power management */
397 
398  /* MCLK Settings */
403 
404  /* CompactFlash controller */
410 
411  /* parallel camera */
425 
426  /* serial camera */
432 
433 };
434 
435 struct omap_mux_cfg {
436  struct pin_config *pins;
437  unsigned long size;
438  int (*cfg_reg)(const struct pin_config *cfg);
439 };
440 
441 #ifdef CONFIG_OMAP_MUX
442 /* setup pin muxing in Linux */
443 extern int omap1_mux_init(void);
444 extern int omap_mux_register(struct omap_mux_cfg *);
445 extern int omap_cfg_reg(unsigned long reg_cfg);
446 #else
447 /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
448 static inline int omap1_mux_init(void) { return 0; }
449 static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; }
450 #endif
451 
452 extern int omap2_mux_init(void);
453 
454 #endif