1 /** @file
2 
3   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #include <PiPei.h>
16 #include <Library/IoLib.h>
17 #include <Library/DebugLib.h>
18 #include <Omap3530/Omap3530.h>
19 #include <BeagleBoard.h>
20 
21 #define NUM_PINS_SHARED 232
22 #define NUM_PINS_ABC 6
23 #define NUM_PINS_XM 12
24 
25 PAD_CONFIGURATION PadConfigurationTableShared[] = {
26   //Pin,           MuxMode,    PullConfig,                      InputEnable
27   { SDRC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },
28   { SDRC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },
29   { SDRC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },
30   { SDRC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },
31   { SDRC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },
32   { SDRC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },
33   { SDRC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },
34   { SDRC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },
35   { SDRC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },
36   { SDRC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },
37   { SDRC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },
38   { SDRC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },
39   { SDRC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },
40   { SDRC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },
41   { SDRC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },
42   { SDRC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },
43   { SDRC_D16,      MUXMODE0,   PULL_DISABLED,                INPUT  },
44   { SDRC_D17,      MUXMODE0,   PULL_DISABLED,                INPUT  },
45   { SDRC_D18,      MUXMODE0,   PULL_DISABLED,                INPUT  },
46   { SDRC_D19,      MUXMODE0,   PULL_DISABLED,                INPUT  },
47   { SDRC_D20,      MUXMODE0,   PULL_DISABLED,                INPUT  },
48   { SDRC_D21,      MUXMODE0,   PULL_DISABLED,                INPUT  },
49   { SDRC_D22,      MUXMODE0,   PULL_DISABLED,                INPUT  },
50   { SDRC_D23,      MUXMODE0,   PULL_DISABLED,                INPUT  },
51   { SDRC_D24,      MUXMODE0,   PULL_DISABLED,                INPUT  },
52   { SDRC_D25,      MUXMODE0,   PULL_DISABLED,                INPUT  },
53   { SDRC_D26,      MUXMODE0,   PULL_DISABLED,                INPUT  },
54   { SDRC_D27,      MUXMODE0,   PULL_DISABLED,                INPUT  },
55   { SDRC_D28,      MUXMODE0,   PULL_DISABLED,                INPUT  },
56   { SDRC_D29,      MUXMODE0,   PULL_DISABLED,                INPUT  },
57   { SDRC_D30,      MUXMODE0,   PULL_DISABLED,                INPUT  },
58   { SDRC_D31,      MUXMODE0,   PULL_DISABLED,                INPUT  },
59   { SDRC_CLK,      MUXMODE0,   PULL_DISABLED,                INPUT  },
60   { SDRC_DQS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },
61   { SDRC_CKE0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
62   { SDRC_CKE1,     MUXMODE7,   PULL_DISABLED,                INPUT  },
63   { SDRC_DQS1,     MUXMODE0,   PULL_DISABLED,                INPUT  },
64   { SDRC_DQS2,     MUXMODE0,   PULL_DISABLED,                INPUT  },
65   { SDRC_DQS3,     MUXMODE0,   PULL_DISABLED,                INPUT  },
66   { GPMC_A1,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
67   { GPMC_A2,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
68   { GPMC_A3,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
69   { GPMC_A4,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
70   { GPMC_A5,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
71   { GPMC_A6,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
72   { GPMC_A7,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
73   { GPMC_A8,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
74   { GPMC_A9,       MUXMODE0,   PULL_DISABLED,                OUTPUT },
75   { GPMC_A10,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
76   { GPMC_D0,       MUXMODE0,   PULL_DISABLED,                INPUT  },
77   { GPMC_D1,       MUXMODE0,   PULL_DISABLED,                INPUT  },
78   { GPMC_D2,       MUXMODE0,   PULL_DISABLED,                INPUT  },
79   { GPMC_D3,       MUXMODE0,   PULL_DISABLED,                INPUT  },
80   { GPMC_D4,       MUXMODE0,   PULL_DISABLED,                INPUT  },
81   { GPMC_D5,       MUXMODE0,   PULL_DISABLED,                INPUT  },
82   { GPMC_D6,       MUXMODE0,   PULL_DISABLED,                INPUT  },
83   { GPMC_D7,       MUXMODE0,   PULL_DISABLED,                INPUT  },
84   { GPMC_D8,       MUXMODE0,   PULL_DISABLED,                INPUT  },
85   { GPMC_D9,       MUXMODE0,   PULL_DISABLED,                INPUT  },
86   { GPMC_D10,      MUXMODE0,   PULL_DISABLED,                INPUT  },
87   { GPMC_D11,      MUXMODE0,   PULL_DISABLED,                INPUT  },
88   { GPMC_D12,      MUXMODE0,   PULL_DISABLED,                INPUT  },
89   { GPMC_D13,      MUXMODE0,   PULL_DISABLED,                INPUT  },
90   { GPMC_D14,      MUXMODE0,   PULL_DISABLED,                INPUT  },
91   { GPMC_D15,      MUXMODE0,   PULL_DISABLED,                INPUT  },
92   { GPMC_NCS0,     MUXMODE0,   PULL_DISABLED,                INPUT  },
93   { GPMC_NCS1,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
94   { GPMC_NCS2,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
95   { GPMC_NCS3,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
96   { GPMC_NCS4,     MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
97   { GPMC_NCS5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
98   { GPMC_NCS6,     MUXMODE1,   PULL_DISABLED,                INPUT  },
99   { GPMC_NCS7,     MUXMODE1,   PULL_UP_SELECTED,             INPUT  },
100   { GPMC_CLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
101   { GPMC_NADV_ALE, MUXMODE0,   PULL_DISABLED,                INPUT  },
102   { GPMC_NOE,      MUXMODE0,   PULL_DISABLED,                INPUT  },
103   { GPMC_NWE,      MUXMODE0,   PULL_DISABLED,                INPUT  },
104   { GPMC_NBE0_CLE, MUXMODE0,   PULL_DISABLED,                OUTPUT },
105   { GPMC_NBE1,     MUXMODE0,   PULL_DISABLED,                INPUT  },
106   { GPMC_NWP,      MUXMODE0,   PULL_DISABLED,                INPUT  },
107   { GPMC_WAIT0,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
108   { GPMC_WAIT1,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
109   { GPMC_WAIT2,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
110   { GPMC_WAIT3,    MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
111   { DSS_PCLK,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
112   { DSS_HSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
113   { DSS_PSYNC,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
114   { DSS_ACBIAS,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
115   { DSS_DATA0,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
116   { DSS_DATA1,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
117   { DSS_DATA2,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
118   { DSS_DATA3,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
119   { DSS_DATA4,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
120   { DSS_DATA5,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
121   { DSS_DATA6,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
122   { DSS_DATA7,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
123   { DSS_DATA8,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
124   { DSS_DATA9,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
125   { DSS_DATA10,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
126   { DSS_DATA11,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
127   { DSS_DATA12,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
128   { DSS_DATA13,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
129   { DSS_DATA14,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
130   { DSS_DATA15,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
131   { DSS_DATA16,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
132   { DSS_DATA17,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
133   { CAM_HS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },
134   { CAM_VS,        MUXMODE0,   PULL_UP_SELECTED,             INPUT },
135   { CAM_XCLKA,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
136   { CAM_PCLK,      MUXMODE0,   PULL_UP_SELECTED,             INPUT },
137   { CAM_FLD,       MUXMODE4,   PULL_DISABLED,                OUTPUT },
138   { CAM_D0,        MUXMODE0,   PULL_DISABLED,                INPUT  },
139   { CAM_D1,        MUXMODE0,   PULL_DISABLED,                INPUT  },
140   { CAM_D2,        MUXMODE0,   PULL_DISABLED,                INPUT  },
141   { CAM_D3,        MUXMODE0,   PULL_DISABLED,                INPUT  },
142   { CAM_D4,        MUXMODE0,   PULL_DISABLED,                INPUT  },
143   { CAM_D5,        MUXMODE0,   PULL_DISABLED,                INPUT  },
144   { CAM_D6,        MUXMODE0,   PULL_DISABLED,                INPUT  },
145   { CAM_D7,        MUXMODE0,   PULL_DISABLED,                INPUT  },
146   { CAM_D8,        MUXMODE0,   PULL_DISABLED,                INPUT  },
147   { CAM_D9,        MUXMODE0,   PULL_DISABLED,                INPUT  },
148   { CAM_D10,       MUXMODE0,   PULL_DISABLED,                INPUT  },
149   { CAM_D11,       MUXMODE0,   PULL_DISABLED,                INPUT  },
150   { CAM_XCLKB,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
151   { CAM_WEN,       MUXMODE4,   PULL_DISABLED,                INPUT  },
152   { CAM_STROBE,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
153   { CSI2_DX0,      MUXMODE0,   PULL_DISABLED,                INPUT  },
154   { CSI2_DY0,      MUXMODE0,   PULL_DISABLED,                INPUT  },
155   { CSI2_DX1,      MUXMODE0,   PULL_DISABLED,                INPUT  },
156   { CSI2_DY1,      MUXMODE0,   PULL_DISABLED,                INPUT  },
157   { MCBSP2_FSX,    MUXMODE0,   PULL_DISABLED,                INPUT  },
158   { MCBSP2_CLKX,   MUXMODE0,   PULL_DISABLED,                INPUT  },
159   { MCBSP2_DR,     MUXMODE0,   PULL_DISABLED,                INPUT  },
160   { MCBSP2_DX,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
161   { MMC1_CLK,      MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
162   { MMC1_CMD,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
163   { MMC1_DAT0,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
164   { MMC1_DAT1,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
165   { MMC1_DAT2,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
166   { MMC1_DAT3,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
167   { MMC1_DAT4,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
168   { MMC1_DAT5,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
169   { MMC1_DAT6,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
170   { MMC1_DAT7,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
171   { MMC2_CLK,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
172   { MMC2_CMD,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
173   { MMC2_DAT0,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
174   { MMC2_DAT1,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
175   { MMC2_DAT2,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
176   { MMC2_DAT3,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
177   { MMC2_DAT4,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
178   { MMC2_DAT5,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
179   { MMC2_DAT6,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
180   { MMC2_DAT7,     MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
181   { MCBSP3_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
182   { MCBSP3_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
183   { MCBSP3_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
184   { MCBSP3_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
185   { UART2_CTS,     MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
186   { UART2_RTS,     MUXMODE0,   PULL_DISABLED,                OUTPUT },
187   { UART2_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
188   { UART2_RX,      MUXMODE4,   PULL_DISABLED,                OUTPUT },
189   { UART1_TX,      MUXMODE0,   PULL_DISABLED,                OUTPUT },
190   { UART1_RTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
191   { UART1_CTS,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
192   { UART1_RX,      MUXMODE0,   PULL_DISABLED,                INPUT  },
193   { MCBSP4_CLKX,   MUXMODE1,   PULL_DISABLED,                INPUT  },
194   { MCBSP4_DR,     MUXMODE1,   PULL_DISABLED,                INPUT  },
195   { MCBSP4_DX,     MUXMODE1,   PULL_DISABLED,                INPUT  },
196   { MCBSP4_FSX,    MUXMODE1,   PULL_DISABLED,                INPUT  },
197   { MCBSP1_CLKR,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
198   { MCBSP1_FSR,    MUXMODE4,   PULL_UP_SELECTED,             OUTPUT },
199   { MCBSP1_DX,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
200   { MCBSP1_DR,     MUXMODE4,   PULL_DISABLED,                OUTPUT },
201   { MCBSP1_CLKS,   MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
202   { MCBSP1_FSX,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
203   { MCBSP1_CLKX,   MUXMODE4,   PULL_DISABLED,                OUTPUT },
204   { UART3_CTS_RCTX,MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },
205   { UART3_RTS_SD,  MUXMODE0,   PULL_DISABLED,                OUTPUT },
206   { UART3_RX_IRRX, MUXMODE0,   PULL_DISABLED,                INPUT  },
207   { UART3_TX_IRTX, MUXMODE0,   PULL_DISABLED,                OUTPUT },
208   { HSUSB0_CLK,    MUXMODE0,   PULL_DISABLED,                INPUT  },
209   { HSUSB0_STP,    MUXMODE0,   PULL_UP_SELECTED,             OUTPUT },
210   { HSUSB0_DIR,    MUXMODE0,   PULL_DISABLED,                INPUT  },
211   { HSUSB0_NXT,    MUXMODE0,   PULL_DISABLED,                INPUT  },
212   { HSUSB0_DATA0,  MUXMODE0,   PULL_DISABLED,                INPUT  },
213   { HSUSB0_DATA1,  MUXMODE0,   PULL_DISABLED,                INPUT  },
214   { HSUSB0_DATA2,  MUXMODE0,   PULL_DISABLED,                INPUT  },
215   { HSUSB0_DATA3,  MUXMODE0,   PULL_DISABLED,                INPUT  },
216   { HSUSB0_DATA4,  MUXMODE0,   PULL_DISABLED,                INPUT  },
217   { HSUSB0_DATA5,  MUXMODE0,   PULL_DISABLED,                INPUT  },
218   { HSUSB0_DATA6,  MUXMODE0,   PULL_DISABLED,                INPUT  },
219   { HSUSB0_DATA7,  MUXMODE0,   PULL_DISABLED,                INPUT  },
220   { I2C1_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
221   { I2C1_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
222   { I2C2_SCL,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
223   { I2C2_SDA,      MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
224   { I2C3_SCL,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
225   { I2C3_SDA,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
226   { HDQ_SIO,       MUXMODE4,   PULL_DISABLED,                OUTPUT },
227   { MCSPI1_CLK,    MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
228   { MCSPI1_SIMO,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
229   { MCSPI1_SOMI,   MUXMODE0,   PULL_DISABLED,                INPUT  },
230   { MCSPI1_CS0,    MUXMODE0,   PULL_UP_SELECTED,                 INPUT  },
231   { MCSPI1_CS1,    MUXMODE0,   PULL_UP_SELECTED,                 OUTPUT },
232   { MCSPI1_CS2,    MUXMODE4,   PULL_DISABLED,                OUTPUT },
233   { MCSPI1_CS3,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
234   { MCSPI2_CLK,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
235   { MCSPI2_SIMO,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
236   { MCSPI2_SOMI,   MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
237   { MCSPI2_CS0,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
238   { MCSPI2_CS1,    MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
239   { SYS_NIRQ,      MUXMODE0,   PULL_UP_SELECTED,             INPUT  },
240   { SYS_CLKOUT2,   MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
241   { ETK_CLK,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
242   { ETK_CTL,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
243   { ETK_D0,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
244   { ETK_D1,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
245   { ETK_D2,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
246   { ETK_D3,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
247   { ETK_D4,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
248   { ETK_D5,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
249   { ETK_D6,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
250   { ETK_D7,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
251   { ETK_D8,        MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
252   { ETK_D9,        MUXMODE4,   PULL_UP_SELECTED,             INPUT  },
253   { ETK_D10,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
254   { ETK_D11,       MUXMODE3,   PULL_UP_SELECTED,             OUTPUT },
255   { ETK_D12,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
256   { ETK_D13,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
257   { ETK_D14,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  },
258   { ETK_D15,       MUXMODE3,   PULL_UP_SELECTED,             INPUT  }
259 };
260 
261 PAD_CONFIGURATION PadConfigurationTableAbc[] = {
262   { DSS_DATA18,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
263   { DSS_DATA19,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
264   { DSS_DATA20,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
265   { DSS_DATA21,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
266   { DSS_DATA22,    MUXMODE0,   PULL_DISABLED,                OUTPUT },
267   { DSS_DATA23,    MUXMODE0,   PULL_DISABLED,                OUTPUT }
268 };
269 
270 PAD_CONFIGURATION PadConfigurationTableXm[] = {
271   { DSS_DATA18,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
272   { DSS_DATA19,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
273   { DSS_DATA20,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
274   { DSS_DATA21,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
275   { DSS_DATA22,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
276   { DSS_DATA23,    MUXMODE3,   PULL_DISABLED,                OUTPUT },
277   { SYS_BOOT0,     MUXMODE3,   PULL_DISABLED,                OUTPUT },
278   { SYS_BOOT1,     MUXMODE3,   PULL_DISABLED,                OUTPUT },
279   { SYS_BOOT3,     MUXMODE3,   PULL_DISABLED,                OUTPUT },
280   { SYS_BOOT4,     MUXMODE3,   PULL_DISABLED,                OUTPUT },
281   { SYS_BOOT5,     MUXMODE3,   PULL_DISABLED,                OUTPUT },
282   { SYS_BOOT6,     MUXMODE3,   PULL_DISABLED,                OUTPUT }
283 };
284 
285 VOID
PadConfiguration(BEAGLEBOARD_REVISION Revision)286 PadConfiguration (
287   BEAGLEBOARD_REVISION Revision
288   )
289 {
290   UINTN             Index;
291   UINT16            PadConfiguration;
292   PAD_CONFIGURATION *BoardConfiguration;
293   UINTN             NumPinsToConfigure;
294 
295   for (Index = 0; Index < NUM_PINS_SHARED; Index++) {
296     // Set up Pad configuration for particular pin.
297     PadConfiguration =  (PadConfigurationTableShared[Index].MuxMode << MUXMODE_OFFSET);
298     PadConfiguration |= (PadConfigurationTableShared[Index].PullConfig << PULL_CONFIG_OFFSET);
299     PadConfiguration |= (PadConfigurationTableShared[Index].InputEnable << INPUTENABLE_OFFSET);
300 
301     // Configure the pin with specific Pad configuration.
302     MmioWrite16(PadConfigurationTableShared[Index].Pin, PadConfiguration);
303   }
304 
305   if (Revision == REVISION_XM) {
306     BoardConfiguration = PadConfigurationTableXm;
307     NumPinsToConfigure = NUM_PINS_XM;
308   } else {
309     BoardConfiguration = PadConfigurationTableAbc;
310     NumPinsToConfigure = NUM_PINS_ABC;
311   }
312 
313   for (Index = 0; Index < NumPinsToConfigure; Index++) {
314     //Set up Pad configuration for particular pin.
315     PadConfiguration =  (BoardConfiguration[Index].MuxMode << MUXMODE_OFFSET);
316     PadConfiguration |= (BoardConfiguration[Index].PullConfig << PULL_CONFIG_OFFSET);
317     PadConfiguration |= (BoardConfiguration[Index].InputEnable << INPUTENABLE_OFFSET);
318 
319     //Configure the pin with specific Pad configuration.
320     MmioWrite16(BoardConfiguration[Index].Pin, PadConfiguration);
321   }
322 }
323