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