Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2010,2011 |
| 3 | * NVIDIA Corporation <www.nvidia.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 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, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef _PINMUX_H_ |
| 25 | #define _PINMUX_H_ |
| 26 | |
Simon Glass | fa516f6 | 2011-08-30 06:23:14 +0000 | [diff] [blame] | 27 | /* Pins which we can set to tristate or normal */ |
| 28 | enum pmux_pin { |
| 29 | /* APB_MISC_PP_TRISTATE_REG_A_0 */ |
| 30 | PIN_ATA, |
| 31 | PIN_ATB, |
| 32 | PIN_ATC, |
| 33 | PIN_ATD, |
| 34 | PIN_CDEV1, |
| 35 | PIN_CDEV2, |
| 36 | PIN_CSUS, |
| 37 | PIN_DAP1, |
| 38 | |
| 39 | PIN_DAP2, |
| 40 | PIN_DAP3, |
| 41 | PIN_DAP4, |
| 42 | PIN_DTA, |
| 43 | PIN_DTB, |
| 44 | PIN_DTC, |
| 45 | PIN_DTD, |
| 46 | PIN_DTE, |
| 47 | |
| 48 | PIN_GPU, |
| 49 | PIN_GPV, |
| 50 | PIN_I2CP, |
| 51 | PIN_IRTX, |
| 52 | PIN_IRRX, |
| 53 | PIN_KBCB, |
| 54 | PIN_KBCA, |
| 55 | PIN_PMC, |
| 56 | |
| 57 | PIN_PTA, |
| 58 | PIN_RM, |
| 59 | PIN_KBCE, |
| 60 | PIN_KBCF, |
| 61 | PIN_GMA, |
| 62 | PIN_GMC, |
| 63 | PIN_SDMMC1, |
| 64 | PIN_OWC, |
| 65 | |
| 66 | /* 32: APB_MISC_PP_TRISTATE_REG_B_0 */ |
| 67 | PIN_GME, |
| 68 | PIN_SDC, |
| 69 | PIN_SDD, |
| 70 | PIN_RESERVED0, |
| 71 | PIN_SLXA, |
| 72 | PIN_SLXC, |
| 73 | PIN_SLXD, |
| 74 | PIN_SLXK, |
| 75 | |
| 76 | PIN_SPDI, |
| 77 | PIN_SPDO, |
| 78 | PIN_SPIA, |
| 79 | PIN_SPIB, |
| 80 | PIN_SPIC, |
| 81 | PIN_SPID, |
| 82 | PIN_SPIE, |
| 83 | PIN_SPIF, |
| 84 | |
| 85 | PIN_SPIG, |
| 86 | PIN_SPIH, |
| 87 | PIN_UAA, |
| 88 | PIN_UAB, |
| 89 | PIN_UAC, |
| 90 | PIN_UAD, |
| 91 | PIN_UCA, |
| 92 | PIN_UCB, |
| 93 | |
| 94 | PIN_RESERVED1, |
| 95 | PIN_ATE, |
| 96 | PIN_KBCC, |
| 97 | PIN_RESERVED2, |
| 98 | PIN_RESERVED3, |
| 99 | PIN_GMB, |
| 100 | PIN_GMD, |
| 101 | PIN_DDC, |
| 102 | |
| 103 | /* 64: APB_MISC_PP_TRISTATE_REG_C_0 */ |
| 104 | PIN_LD0, |
| 105 | PIN_LD1, |
| 106 | PIN_LD2, |
| 107 | PIN_LD3, |
| 108 | PIN_LD4, |
| 109 | PIN_LD5, |
| 110 | PIN_LD6, |
| 111 | PIN_LD7, |
| 112 | |
| 113 | PIN_LD8, |
| 114 | PIN_LD9, |
| 115 | PIN_LD10, |
| 116 | PIN_LD11, |
| 117 | PIN_LD12, |
| 118 | PIN_LD13, |
| 119 | PIN_LD14, |
| 120 | PIN_LD15, |
| 121 | |
| 122 | PIN_LD16, |
| 123 | PIN_LD17, |
| 124 | PIN_LHP0, |
| 125 | PIN_LHP1, |
| 126 | PIN_LHP2, |
| 127 | PIN_LVP0, |
| 128 | PIN_LVP1, |
| 129 | PIN_HDINT, |
| 130 | |
| 131 | PIN_LM0, |
| 132 | PIN_LM1, |
| 133 | PIN_LVS, |
| 134 | PIN_LSC0, |
| 135 | PIN_LSC1, |
| 136 | PIN_LSCK, |
| 137 | PIN_LDC, |
| 138 | PIN_LCSN, |
| 139 | |
| 140 | /* 96: APB_MISC_PP_TRISTATE_REG_D_0 */ |
| 141 | PIN_LSPI, |
| 142 | PIN_LSDA, |
| 143 | PIN_LSDI, |
| 144 | PIN_LPW0, |
| 145 | PIN_LPW1, |
| 146 | PIN_LPW2, |
| 147 | PIN_LDI, |
| 148 | PIN_LHS, |
| 149 | |
| 150 | PIN_LPP, |
| 151 | PIN_RESERVED4, |
| 152 | PIN_KBCD, |
| 153 | PIN_GPU7, |
| 154 | PIN_DTF, |
| 155 | PIN_UDA, |
| 156 | PIN_CRTP, |
| 157 | PIN_SDB, |
| 158 | }; |
| 159 | |
| 160 | |
| 161 | #define TEGRA_TRISTATE_REGS 4 |
| 162 | |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 163 | /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */ |
| 164 | struct pmux_tri_ctlr { |
| 165 | uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */ |
| 166 | uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */ |
| 167 | uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */ |
| 168 | uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */ |
| 169 | uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */ |
Simon Glass | fa516f6 | 2011-08-30 06:23:14 +0000 | [diff] [blame] | 170 | uint pmt_tri[TEGRA_TRISTATE_REGS]; /* _TRI_STATE_REG_A/B/C/D_0 14-20 */ |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 171 | uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */ |
| 172 | |
| 173 | uint pmt_reserved[22]; /* ABP_MISC_PP_ reserved offs 28-7C */ |
| 174 | |
| 175 | uint pmt_ctl_a; /* _PIN_MUX_CTL_A_0, offset 80 */ |
| 176 | uint pmt_ctl_b; /* _PIN_MUX_CTL_B_0, offset 84 */ |
| 177 | uint pmt_ctl_c; /* _PIN_MUX_CTL_C_0, offset 88 */ |
| 178 | uint pmt_ctl_d; /* _PIN_MUX_CTL_D_0, offset 8C */ |
| 179 | uint pmt_ctl_e; /* _PIN_MUX_CTL_E_0, offset 90 */ |
| 180 | uint pmt_ctl_f; /* _PIN_MUX_CTL_F_0, offset 94 */ |
| 181 | uint pmt_ctl_g; /* _PIN_MUX_CTL_G_0, offset 98 */ |
| 182 | }; |
| 183 | |
Simon Glass | fa516f6 | 2011-08-30 06:23:14 +0000 | [diff] [blame] | 184 | /* Converts a pin number to a tristate register: 0=A, 1=B, 2=C, 3=D */ |
| 185 | #define TRISTATE_REG(id) ((id) >> 5) |
| 186 | |
| 187 | /* Mask value for a tristate (within TRISTATE_REG(id)) */ |
| 188 | #define TRISTATE_MASK(id) (1 << ((id) & 0x1f)) |
| 189 | |
| 190 | /* Set a pin to tristate */ |
| 191 | void pinmux_tristate_enable(enum pmux_pin pin); |
| 192 | |
| 193 | /* Set a pin to normal (non tristate) */ |
| 194 | void pinmux_tristate_disable(enum pmux_pin pin); |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 195 | |
| 196 | #endif /* PINMUX_H */ |