2 * arch/arm/plat-omap/include/mach/mux.h
4 * Table of the Omap register configurations for the FUNC_MUX and
5 * PULL_DWN combinations.
7 * Copyright (C) 2004 - 2008 Texas Instruments Inc.
8 * Copyright (C) 2003 - 2008 Nokia Corporation
10 * Written by Tony Lindgren
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.
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.
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
26 * NOTE: Please use the following naming style for new pin entries.
27 * For example, W8_1610_MMC2_DAT0, where:
29 * - 1610 = 1510 or 1610, none if common for both 1510 and 1610
30 * - MMC2_DAT0 = function
33 #ifndef __ASM_ARCH_MUX_H
34 #define __ASM_ARCH_MUX_H
36 #define PU_PD_SEL_NA 0 /* No pu_pd reg available */
37 #define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */
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, \
45 #define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \
46 .pull_reg = PULL_DWN_CTRL_##reg, \
50 #define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \
51 .pu_pd_reg = PU_PD_SEL_##reg, \
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, \
59 #define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \
60 .pull_reg = OMAP7XX_IO_CONF_##reg, \
66 #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \
67 .mask_offset = mode_offset, \
70 #define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \
74 #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
77 #define MUX_REG_7XX(reg, mode_offset, mode) \
78 .mux_reg = OMAP7XX_IO_CONF_##reg, \
79 .mask_offset = mode_offset, \
82 #define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \
86 #endif /* CONFIG_OMAP_MUX_DEBUG */
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) \
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) \
101 * OMAP730/850 has a slightly different config for the pin mux.
102 * - config regs are the OMAP7XX_IO_CONF_x regs (see omap730.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
107 #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \
108 pull_bit, pull_status, debug_status)\
111 .debug = debug_status, \
112 MUX_REG_7XX(mux_reg, mode_offset, mode) \
113 PULL_REG_7XX(mux_reg, pull_bit, pull_status) \
117 #define MUX_CFG_24XX(desc, reg_offset, mode, \
118 pull_en, pull_mode, dbg) \
122 .mux_reg = reg_offset, \
124 .pull_val = pull_en, \
125 .pu_pd_val = pull_mode, \
128 /* 24xx/34xx mux bit defines */
129 #define OMAP2_PULL_ENA (1 << 3)
130 #define OMAP2_PULL_UP (1 << 4)
131 #define OMAP2_ALTELECTRICALSEL (1 << 5)
133 /* 34xx specific mux bit defines */
134 #define OMAP3_INPUT_EN (1 << 8)
135 #define OMAP3_OFF_EN (1 << 9)
136 #define OMAP3_OFFOUT_EN (1 << 10)
137 #define OMAP3_OFFOUT_VAL (1 << 11)
138 #define OMAP3_OFF_PULL_EN (1 << 12)
139 #define OMAP3_OFF_PULL_UP (1 << 13)
140 #define OMAP3_WAKEUP_EN (1 << 14)
142 /* 34xx mux mode options for each pin. See TRM for options */
143 #define OMAP34XX_MUX_MODE0 0
144 #define OMAP34XX_MUX_MODE1 1
145 #define OMAP34XX_MUX_MODE2 2
146 #define OMAP34XX_MUX_MODE3 3
147 #define OMAP34XX_MUX_MODE4 4
148 #define OMAP34XX_MUX_MODE5 5
149 #define OMAP34XX_MUX_MODE6 6
150 #define OMAP34XX_MUX_MODE7 7
152 /* 34xx active pin states */
153 #define OMAP34XX_PIN_OUTPUT 0
154 #define OMAP34XX_PIN_INPUT OMAP3_INPUT_EN
155 #define OMAP34XX_PIN_INPUT_PULLUP (OMAP2_PULL_ENA | OMAP3_INPUT_EN \
157 #define OMAP34XX_PIN_INPUT_PULLDOWN (OMAP2_PULL_ENA | OMAP3_INPUT_EN)
159 /* 34xx off mode states */
160 #define OMAP34XX_PIN_OFF_NONE 0
161 #define OMAP34XX_PIN_OFF_OUTPUT_HIGH (OMAP3_OFF_EN | OMAP3_OFFOUT_EN \
163 #define OMAP34XX_PIN_OFF_OUTPUT_LOW (OMAP3_OFF_EN | OMAP3_OFFOUT_EN)
164 #define OMAP34XX_PIN_OFF_INPUT_PULLUP (OMAP3_OFF_EN | OMAP3_OFF_PULL_EN \
166 #define OMAP34XX_PIN_OFF_INPUT_PULLDOWN (OMAP3_OFF_EN | OMAP3_OFF_PULL_EN)
167 #define OMAP34XX_PIN_OFF_WAKEUPENABLE OMAP3_WAKEUP_EN
169 #define MUX_CFG_34XX(desc, reg_offset, mux_value) { \
172 .mux_reg = reg_offset, \
173 .mux_val = mux_value \
178 const unsigned int mux_reg
;
181 #if defined(CONFIG_ARCH_OMAP34XX)
182 u16 mux_val
; /* Wake-up, off mode, pull, mux mode */
185 #if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP24XX)
186 const unsigned char mask_offset
;
187 const unsigned char mask
;
189 const char *pull_name
;
190 const unsigned int pull_reg
;
191 const unsigned char pull_val
;
192 const unsigned char pull_bit
;
194 const char *pu_pd_name
;
195 const unsigned int pu_pd_reg
;
196 const unsigned char pu_pd_val
;
199 #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS)
200 const char *mux_reg_name
;
206 /* OMAP 730 keyboard */
224 enum omap1xxx_index
{
225 /* UART1 (BT_UART_GATING)*/
229 /* UART2 (COM_UART_GATING)*/
235 /* UART3 (GIGA_UART_GATING) */
241 UART3_BCLK
, /* 12MHz clock out */
248 /* USB master generic */
331 V5_1610_MMC2_DATDIR0
,
332 W19_1610_MMC2_DATDIR1
,
335 /* OMAP-1610 External Trace Interface */
358 /* OMAP-1610 uWire */
377 /* OMAP-1610 Flash */
378 L3_1610_FLASH_CS2B_OE
,
379 M8_1610_FLASH_CS2B_WE
,
389 /* OMAP-1710 MMC CMDDIR and DATDIR0 */
392 P20_1710_MMC_DATDIR0
,
394 /* OMAP-1610 USB0 alternate pin configuration */
437 /* Power management */
446 /* CompactFlash controller */
453 /* parallel camera */
477 enum omap24xx_index
{
484 /* 24xx Menelaus interrupt */
490 /* 24xx GPMC chipselects, wait pin monitoring */
499 Y15_24XX_MCBSP2_CLKX
,
537 /* 24xx external DMA requests */
556 F19_24XX_MMC_DAT_DIR0
,
557 E20_24XX_MMC_DAT_DIR1
,
558 F18_24XX_MMC_DAT_DIR2
,
559 E18_24XX_MMC_DAT_DIR3
,
560 G18_24XX_MMC_CMD_DIR
,
585 AA4_24XX_USB2_TLLSE0
,
602 /* 24xx Menelaus Keypad GPIO */
621 AD9_2430_USB0HS_DATA3
,
622 Y11_2430_USB0HS_DATA4
,
623 AD7_2430_USB0HS_DATA5
,
624 AE7_2430_USB0HS_DATA6
,
625 AD4_2430_USB0HS_DATA2
,
626 AF9_2430_USB0HS_DATA0
,
627 AE6_2430_USB0HS_DATA1
,
632 AC7_2430_USB0HS_DATA7
,
637 AB2_2430_MCBSP1_CLKR
,
644 AC10_2430_MCBSP2_FSX
,
645 AD16_2430_MCBSP2_CLX
,
648 AC10_2430_MCBSP2_FSX_OFF
,
649 AD16_2430_MCBSP2_CLX_OFF
,
650 AE13_2430_MCBSP2_DX_OFF
,
651 AD13_2430_MCBSP2_DR_OFF
,
653 AC9_2430_MCBSP3_CLKX
,
661 AC25_2430_MCBSP4_FSX
,
663 AE16_2430_MCBSP5_CLKX
,
664 AF12_2430_MCBSP5_FSX
,
670 AD15_2430_MCSPI1_SIMO
,
671 AE17_2430_MCSPI1_SOMI
,
674 /* Touchscreen GPIO */
679 enum omap34xx_index
{
690 /* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
691 Y8_3430_USB1HS_PHY_CLK
,
692 Y9_3430_USB1HS_PHY_STP
,
693 AA14_3430_USB1HS_PHY_DIR
,
694 AA11_3430_USB1HS_PHY_NXT
,
695 W13_3430_USB1HS_PHY_DATA0
,
696 W12_3430_USB1HS_PHY_DATA1
,
697 W11_3430_USB1HS_PHY_DATA2
,
698 Y11_3430_USB1HS_PHY_DATA3
,
699 W9_3430_USB1HS_PHY_DATA4
,
700 Y12_3430_USB1HS_PHY_DATA5
,
701 W8_3430_USB1HS_PHY_DATA6
,
702 Y13_3430_USB1HS_PHY_DATA7
,
704 /* PHY - HSUSB: 12-pin ULPI PHY: Port 2*/
705 AA8_3430_USB2HS_PHY_CLK
,
706 AA10_3430_USB2HS_PHY_STP
,
707 AA9_3430_USB2HS_PHY_DIR
,
708 AB11_3430_USB2HS_PHY_NXT
,
709 AB10_3430_USB2HS_PHY_DATA0
,
710 AB9_3430_USB2HS_PHY_DATA1
,
711 W3_3430_USB2HS_PHY_DATA2
,
712 T4_3430_USB2HS_PHY_DATA3
,
713 T3_3430_USB2HS_PHY_DATA4
,
714 R3_3430_USB2HS_PHY_DATA5
,
715 R4_3430_USB2HS_PHY_DATA6
,
716 T2_3430_USB2HS_PHY_DATA7
,
719 /* TLL - HSUSB: 12-pin TLL Port 1*/
720 Y8_3430_USB1HS_TLL_CLK
,
721 Y9_3430_USB1HS_TLL_STP
,
722 AA14_3430_USB1HS_TLL_DIR
,
723 AA11_3430_USB1HS_TLL_NXT
,
724 W13_3430_USB1HS_TLL_DATA0
,
725 W12_3430_USB1HS_TLL_DATA1
,
726 W11_3430_USB1HS_TLL_DATA2
,
727 Y11_3430_USB1HS_TLL_DATA3
,
728 W9_3430_USB1HS_TLL_DATA4
,
729 Y12_3430_USB1HS_TLL_DATA5
,
730 W8_3430_USB1HS_TLL_DATA6
,
731 Y13_3430_USB1HS_TLL_DATA7
,
733 /* TLL - HSUSB: 12-pin TLL Port 2*/
734 AA8_3430_USB2HS_TLL_CLK
,
735 AA10_3430_USB2HS_TLL_STP
,
736 AA9_3430_USB2HS_TLL_DIR
,
737 AB11_3430_USB2HS_TLL_NXT
,
738 AB10_3430_USB2HS_TLL_DATA0
,
739 AB9_3430_USB2HS_TLL_DATA1
,
740 W3_3430_USB2HS_TLL_DATA2
,
741 T4_3430_USB2HS_TLL_DATA3
,
742 T3_3430_USB2HS_TLL_DATA4
,
743 R3_3430_USB2HS_TLL_DATA5
,
744 R4_3430_USB2HS_TLL_DATA6
,
745 T2_3430_USB2HS_TLL_DATA7
,
747 /* TLL - HSUSB: 12-pin TLL Port 3*/
748 AA6_3430_USB3HS_TLL_CLK
,
749 AB3_3430_USB3HS_TLL_STP
,
750 AA3_3430_USB3HS_TLL_DIR
,
751 Y3_3430_USB3HS_TLL_NXT
,
752 AA5_3430_USB3HS_TLL_DATA0
,
753 Y4_3430_USB3HS_TLL_DATA1
,
754 Y5_3430_USB3HS_TLL_DATA2
,
755 W5_3430_USB3HS_TLL_DATA3
,
756 AB12_3430_USB3HS_TLL_DATA4
,
757 AB13_3430_USB3HS_TLL_DATA5
,
758 AA13_3430_USB3HS_TLL_DATA6
,
759 AA12_3430_USB3HS_TLL_DATA7
,
761 /* PHY FSUSB: FS Serial for Port 1 (multiple PHY modes supported) */
762 AF10_3430_USB1FS_PHY_MM1_RXDP
,
763 AG9_3430_USB1FS_PHY_MM1_RXDM
,
764 W13_3430_USB1FS_PHY_MM1_RXRCV
,
765 W12_3430_USB1FS_PHY_MM1_TXSE0
,
766 W11_3430_USB1FS_PHY_MM1_TXDAT
,
767 Y11_3430_USB1FS_PHY_MM1_TXEN_N
,
769 /* PHY FSUSB: FS Serial for Port 2 (multiple PHY modes supported) */
770 AF7_3430_USB2FS_PHY_MM2_RXDP
,
771 AH7_3430_USB2FS_PHY_MM2_RXDM
,
772 AB10_3430_USB2FS_PHY_MM2_RXRCV
,
773 AB9_3430_USB2FS_PHY_MM2_TXSE0
,
774 W3_3430_USB2FS_PHY_MM2_TXDAT
,
775 T4_3430_USB2FS_PHY_MM2_TXEN_N
,
777 /* PHY FSUSB: FS Serial for Port 3 (multiple PHY modes supported) */
778 AH3_3430_USB3FS_PHY_MM3_RXDP
,
779 AE3_3430_USB3FS_PHY_MM3_RXDM
,
780 AD1_3430_USB3FS_PHY_MM3_RXRCV
,
781 AE1_3430_USB3FS_PHY_MM3_TXSE0
,
782 AD2_3430_USB3FS_PHY_MM3_TXDAT
,
783 AC1_3430_USB3FS_PHY_MM3_TXEN_N
,
786 * - normally these are bidirectional, no internal pullup/pulldown
787 * - "_UP" suffix (GPIO3_UP) if internal pullup is configured
788 * - "_DOWN" suffix (GPIO3_DOWN) with internal pulldown
789 * - "_OUT" suffix (GPIO3_OUT) for output-only pins (unlike 24xx)
799 D25_34XX_GPIO126_OUT
,
800 AG4_34XX_GPIO134_OUT
,
801 AF4_34XX_GPIO135_OUT
,
802 AE4_34XX_GPIO136_OUT
,
807 H19_34XX_GPIO164_OUT
,
809 /* Video-Decoder/Camera/Exp Conn selection GPIO's */
816 /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
848 /* SYS_NIRQ T2 INT1 */
851 /* EHCI GPIO's for OMAP3EVM (Rev >= E) */
856 /* AM3517 OTG DRVVBUS */
857 E25_3517_USB0_DRVVBUS
,
858 /* AM3517 HSUSB port-1 phy reset */
861 /* GPIO175 (Touchscreen PEN_IRQ in OMAP3EVM) */
865 struct omap_mux_cfg
{
866 struct pin_config
*pins
;
868 int (*cfg_reg
)(const struct pin_config
*cfg
);
871 #ifdef CONFIG_OMAP_MUX
872 /* setup pin muxing in Linux */
873 extern int omap1_mux_init(void);
874 extern int omap2_mux_init(void);
875 extern int omap_mux_register(struct omap_mux_cfg
*);
876 extern int omap_cfg_reg(unsigned long reg_cfg
);
878 /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
879 static inline int omap1_mux_init(void) { return 0; }
880 static inline int omap2_mux_init(void) { return 0; }
881 static inline int omap_cfg_reg(unsigned long reg_cfg
) { return 0; }