1
|
/*
|
2
|
* mux.c
|
3
|
*
|
4
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
5
|
*
|
6
|
* This program is free software; you can redistribute it and/or
|
7
|
* modify it under the terms of the GNU General Public License as
|
8
|
* published by the Free Software Foundation version 2.
|
9
|
*
|
10
|
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
11
|
* kind, whether express or implied; without even the implied warranty
|
12
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
* GNU General Public License for more details.
|
14
|
*/
|
15
|
#include <common.h>
|
16
|
#include <config.h>
|
17
|
#include <asm/io.h>
|
18
|
#include "common_def.h"
|
19
|
#include <asm/arch/hardware.h>
|
20
|
|
21
|
#define MUX_CFG(value, offset) \
|
22
|
__raw_writel(value, (CTRL_BASE + offset));
|
23
|
|
24
|
/* PAD Control Fields */
|
25
|
#define SLEWCTRL (0x1 << 6)
|
26
|
#define RXACTIVE (0x1 << 5)
|
27
|
#define PULLUP_EN (0x1 << 4) /* Pull UP Selection */
|
28
|
#define PULLUDEN (0x0 << 3) /* Pull up enabled */
|
29
|
#define PULLUDDIS (0x1 << 3) /* Pull up disabled */
|
30
|
#define MODE(val) val
|
31
|
|
32
|
#define DEV_ON_BASEBOARD 0
|
33
|
#define DEV_ON_DGHTR_BRD 1
|
34
|
|
35
|
/*
|
36
|
* PAD CONTROL OFFSETS
|
37
|
* Field names corresponds to the pad signal name
|
38
|
*/
|
39
|
struct pad_signals {
|
40
|
int gpmc_ad0;
|
41
|
int gpmc_ad1;
|
42
|
int gpmc_ad2;
|
43
|
int gpmc_ad3;
|
44
|
int gpmc_ad4;
|
45
|
int gpmc_ad5;
|
46
|
int gpmc_ad6;
|
47
|
int gpmc_ad7;
|
48
|
int gpmc_ad8;
|
49
|
int gpmc_ad9;
|
50
|
int gpmc_ad10;
|
51
|
int gpmc_ad11;
|
52
|
int gpmc_ad12;
|
53
|
int gpmc_ad13;
|
54
|
int gpmc_ad14;
|
55
|
int gpmc_ad15;
|
56
|
int gpmc_a0;
|
57
|
int gpmc_a1;
|
58
|
int gpmc_a2;
|
59
|
int gpmc_a3;
|
60
|
int gpmc_a4;
|
61
|
int gpmc_a5;
|
62
|
int gpmc_a6;
|
63
|
int gpmc_a7;
|
64
|
int gpmc_a8;
|
65
|
int gpmc_a9;
|
66
|
int gpmc_a10;
|
67
|
int gpmc_a11;
|
68
|
int gpmc_wait0;
|
69
|
int gpmc_wpn;
|
70
|
int gpmc_be1n;
|
71
|
int gpmc_csn0;
|
72
|
int gpmc_csn1;
|
73
|
int gpmc_csn2;
|
74
|
int gpmc_csn3;
|
75
|
int gpmc_clk;
|
76
|
int gpmc_advn_ale;
|
77
|
int gpmc_oen_ren;
|
78
|
int gpmc_wen;
|
79
|
int gpmc_be0n_cle;
|
80
|
int lcd_data0;
|
81
|
int lcd_data1;
|
82
|
int lcd_data2;
|
83
|
int lcd_data3;
|
84
|
int lcd_data4;
|
85
|
int lcd_data5;
|
86
|
int lcd_data6;
|
87
|
int lcd_data7;
|
88
|
int lcd_data8;
|
89
|
int lcd_data9;
|
90
|
int lcd_data10;
|
91
|
int lcd_data11;
|
92
|
int lcd_data12;
|
93
|
int lcd_data13;
|
94
|
int lcd_data14;
|
95
|
int lcd_data15;
|
96
|
int lcd_vsync;
|
97
|
int lcd_hsync;
|
98
|
int lcd_pclk;
|
99
|
int lcd_ac_bias_en;
|
100
|
int mmc0_dat3;
|
101
|
int mmc0_dat2;
|
102
|
int mmc0_dat1;
|
103
|
int mmc0_dat0;
|
104
|
int mmc0_clk;
|
105
|
int mmc0_cmd;
|
106
|
int mii1_col;
|
107
|
int mii1_crs;
|
108
|
int mii1_rxerr;
|
109
|
int mii1_txen;
|
110
|
int mii1_rxdv;
|
111
|
int mii1_txd3;
|
112
|
int mii1_txd2;
|
113
|
int mii1_txd1;
|
114
|
int mii1_txd0;
|
115
|
int mii1_txclk;
|
116
|
int mii1_rxclk;
|
117
|
int mii1_rxd3;
|
118
|
int mii1_rxd2;
|
119
|
int mii1_rxd1;
|
120
|
int mii1_rxd0;
|
121
|
int rmii1_refclk;
|
122
|
int mdio_data;
|
123
|
int mdio_clk;
|
124
|
int spi0_sclk;
|
125
|
int spi0_d0;
|
126
|
int spi0_d1;
|
127
|
int spi0_cs0;
|
128
|
int spi0_cs1;
|
129
|
int ecap0_in_pwm0_out;
|
130
|
int uart0_ctsn;
|
131
|
int uart0_rtsn;
|
132
|
int uart0_rxd;
|
133
|
int uart0_txd;
|
134
|
int uart1_ctsn;
|
135
|
int uart1_rtsn;
|
136
|
int uart1_rxd;
|
137
|
int uart1_txd;
|
138
|
int i2c0_sda;
|
139
|
int i2c0_scl;
|
140
|
int mcasp0_aclkx;
|
141
|
int mcasp0_fsx;
|
142
|
int mcasp0_axr0;
|
143
|
int mcasp0_ahclkr;
|
144
|
int mcasp0_aclkr;
|
145
|
int mcasp0_fsr;
|
146
|
int mcasp0_axr1;
|
147
|
int mcasp0_ahclkx;
|
148
|
int xdma_event_intr0;
|
149
|
int xdma_event_intr1;
|
150
|
int nresetin_out;
|
151
|
int porz;
|
152
|
int nnmi;
|
153
|
int osc0_in;
|
154
|
int osc0_out;
|
155
|
int rsvd1;
|
156
|
int tms;
|
157
|
int tdi;
|
158
|
int tdo;
|
159
|
int tck;
|
160
|
int ntrst;
|
161
|
int emu0;
|
162
|
int emu1;
|
163
|
int osc1_in;
|
164
|
int osc1_out;
|
165
|
int pmic_power_en;
|
166
|
int rtc_porz;
|
167
|
int rsvd2;
|
168
|
int ext_wakeup;
|
169
|
int enz_kaldo_1p8v;
|
170
|
int usb0_dm;
|
171
|
int usb0_dp;
|
172
|
int usb0_ce;
|
173
|
int usb0_id;
|
174
|
int usb0_vbus;
|
175
|
int usb0_drvvbus;
|
176
|
int usb1_dm;
|
177
|
int usb1_dp;
|
178
|
int usb1_ce;
|
179
|
int usb1_id;
|
180
|
int usb1_vbus;
|
181
|
int usb1_drvvbus;
|
182
|
int ddr_resetn;
|
183
|
int ddr_csn0;
|
184
|
int ddr_cke;
|
185
|
int ddr_ck;
|
186
|
int ddr_nck;
|
187
|
int ddr_casn;
|
188
|
int ddr_rasn;
|
189
|
int ddr_wen;
|
190
|
int ddr_ba0;
|
191
|
int ddr_ba1;
|
192
|
int ddr_ba2;
|
193
|
int ddr_a0;
|
194
|
int ddr_a1;
|
195
|
int ddr_a2;
|
196
|
int ddr_a3;
|
197
|
int ddr_a4;
|
198
|
int ddr_a5;
|
199
|
int ddr_a6;
|
200
|
int ddr_a7;
|
201
|
int ddr_a8;
|
202
|
int ddr_a9;
|
203
|
int ddr_a10;
|
204
|
int ddr_a11;
|
205
|
int ddr_a12;
|
206
|
int ddr_a13;
|
207
|
int ddr_a14;
|
208
|
int ddr_a15;
|
209
|
int ddr_odt;
|
210
|
int ddr_d0;
|
211
|
int ddr_d1;
|
212
|
int ddr_d2;
|
213
|
int ddr_d3;
|
214
|
int ddr_d4;
|
215
|
int ddr_d5;
|
216
|
int ddr_d6;
|
217
|
int ddr_d7;
|
218
|
int ddr_d8;
|
219
|
int ddr_d9;
|
220
|
int ddr_d10;
|
221
|
int ddr_d11;
|
222
|
int ddr_d12;
|
223
|
int ddr_d13;
|
224
|
int ddr_d14;
|
225
|
int ddr_d15;
|
226
|
int ddr_dqm0;
|
227
|
int ddr_dqm1;
|
228
|
int ddr_dqs0;
|
229
|
int ddr_dqsn0;
|
230
|
int ddr_dqs1;
|
231
|
int ddr_dqsn1;
|
232
|
int ddr_vref;
|
233
|
int ddr_vtp;
|
234
|
int ddr_strben0;
|
235
|
int ddr_strben1;
|
236
|
int ain7;
|
237
|
int ain6;
|
238
|
int ain5;
|
239
|
int ain4;
|
240
|
int ain3;
|
241
|
int ain2;
|
242
|
int ain1;
|
243
|
int ain0;
|
244
|
int vrefp;
|
245
|
int vrefn;
|
246
|
};
|
247
|
|
248
|
struct module_pin_mux {
|
249
|
short reg_offset;
|
250
|
unsigned char val;
|
251
|
};
|
252
|
|
253
|
struct evm_pin_mux {
|
254
|
struct module_pin_mux *mod_pin_mux;
|
255
|
unsigned short profile;
|
256
|
};
|
257
|
|
258
|
|
259
|
#define PAD_CTRL_BASE 0x800
|
260
|
#define OFFSET(x) (unsigned int) (&((struct pad_signals *) \
|
261
|
(PAD_CTRL_BASE))->x)
|
262
|
|
263
|
static struct module_pin_mux uart0_pin_mux[] = {
|
264
|
{OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */
|
265
|
{OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, /* UART0_TXD */
|
266
|
{-1},
|
267
|
};
|
268
|
|
269
|
#ifdef CONFIG_NAND
|
270
|
static struct module_pin_mux nand_pin_mux[] = {
|
271
|
{OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD0 */
|
272
|
{OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD1 */
|
273
|
{OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD2 */
|
274
|
{OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD3 */
|
275
|
{OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD4 */
|
276
|
{OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */
|
277
|
{OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */
|
278
|
{OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */
|
279
|
{OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */
|
280
|
{OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */
|
281
|
{OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */
|
282
|
{OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */
|
283
|
{OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)}, /* NAND_OE */
|
284
|
{OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)}, /* NAND_WEN */
|
285
|
{OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)}, /* NAND_BE_CLE */
|
286
|
{-1},
|
287
|
};
|
288
|
#endif
|
289
|
//{sandia_pin_mux, PROFILE_ALL},
|
290
|
static struct module_pin_mux sandia_pin_mux[] = {
|
291
|
{OFFSET(gpmc_a4), MODE(7)}, /* lcd enable */
|
292
|
{OFFSET(gpmc_a5), MODE(7)}, /* USRLED0 */
|
293
|
{OFFSET(gpmc_a6), MODE(7)}, /* USRLED1 */
|
294
|
{OFFSET(gpmc_a9), (MODE(7) | RXACTIVE)}, /* touchscreen interrupt */
|
295
|
//{OFFSET(mcasp0_aclkx), MODE(1)}, /* LCD PWM,ehrpwm0A_mux0, check in other files */
|
296
|
/* {OFFSET(gpmc_a9), (MODE(7))}; */
|
297
|
{-1},
|
298
|
};
|
299
|
|
300
|
static struct module_pin_mux i2c0_pin_mux[] = {
|
301
|
{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
|
302
|
{OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
|
303
|
{-1},
|
304
|
};
|
305
|
|
306
|
static struct module_pin_mux i2c1_pin_mux[] = {
|
307
|
{OFFSET(mii1_crs), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
|
308
|
{OFFSET(mii1_rxerr), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
|
309
|
{-1},
|
310
|
};
|
311
|
|
312
|
|
313
|
static struct module_pin_mux i2c2_pin_mux[] = {
|
314
|
{OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
|
315
|
{OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE | PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
|
316
|
{-1},
|
317
|
};
|
318
|
|
319
|
#ifndef CONFIG_NO_ETH
|
320
|
static struct module_pin_mux rgmii1_pin_mux[] = {
|
321
|
{OFFSET(mii1_txen), MODE(2)}, /* RGMII1_TCTL */
|
322
|
{OFFSET(mii1_rxdv), MODE(2) | RXACTIVE}, /* RGMII1_RCTL */
|
323
|
{OFFSET(mii1_txd3), MODE(2)}, /* RGMII1_TD3 */
|
324
|
{OFFSET(mii1_txd2), MODE(2)}, /* RGMII1_TD2 */
|
325
|
{OFFSET(mii1_txd1), MODE(2)}, /* RGMII1_TD1 */
|
326
|
{OFFSET(mii1_txd0), MODE(2)}, /* RGMII1_TD0 */
|
327
|
{OFFSET(mii1_txclk), MODE(2)}, /* RGMII1_TCLK */
|
328
|
{OFFSET(mii1_rxclk), MODE(2) | RXACTIVE}, /* RGMII1_RCLK */
|
329
|
{OFFSET(mii1_rxd3), MODE(2) | RXACTIVE}, /* RGMII1_RD3 */
|
330
|
{OFFSET(mii1_rxd2), MODE(2) | RXACTIVE}, /* RGMII1_RD2 */
|
331
|
{OFFSET(mii1_rxd1), MODE(2) | RXACTIVE}, /* RGMII1_RD1 */
|
332
|
{OFFSET(mii1_rxd0), MODE(2) | RXACTIVE}, /* RGMII1_RD0 */
|
333
|
{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
|
334
|
{OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
|
335
|
{-1},
|
336
|
};
|
337
|
|
338
|
|
339
|
|
340
|
static struct module_pin_mux rgmii2_pin_mux[] = {
|
341
|
{OFFSET(gpmc_a0), MODE(2)}, /* RGMII2_TCTL */
|
342
|
{OFFSET(gpmc_a1), MODE(2) | RXACTIVE}, /* RGMII2_RCTL */
|
343
|
{OFFSET(gpmc_a2), MODE(2)}, /* RGMII2_TD3 */
|
344
|
{OFFSET(gpmc_a3), MODE(2)}, /* RGMII2_TD2 */
|
345
|
{OFFSET(gpmc_a4), MODE(2)}, /* RGMII2_TD1 */
|
346
|
{OFFSET(gpmc_a5), MODE(2)}, /* RGMII2_TD0 */
|
347
|
{OFFSET(gpmc_a6), MODE(2)}, /* RGMII2_TCLK */
|
348
|
{OFFSET(gpmc_a7), MODE(2) | RXACTIVE}, /* RGMII2_RCLK */
|
349
|
{OFFSET(gpmc_a8), MODE(2) | RXACTIVE}, /* RGMII2_RD3 */
|
350
|
{OFFSET(gpmc_a9), MODE(2) | RXACTIVE}, /* RGMII2_RD2 */
|
351
|
{OFFSET(gpmc_a10), MODE(2) | RXACTIVE}, /* RGMII2_RD1 */
|
352
|
{OFFSET(gpmc_a11), MODE(2) | RXACTIVE}, /* RGMII2_RD0 */
|
353
|
{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
|
354
|
{OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
|
355
|
{OFFSET(mii1_rxclk), MODE(7) | PULLUP_EN | PULLUDEN}, /* PHY RESET N on MITYARM3359 EVM */
|
356
|
{-1},
|
357
|
};
|
358
|
|
359
|
static struct module_pin_mux mii1_pin_mux[] = {
|
360
|
{OFFSET(mii1_rxerr), MODE(0) | RXACTIVE}, /* MII1_RXERR */
|
361
|
{OFFSET(mii1_txen), MODE(0)}, /* MII1_TXEN */
|
362
|
{OFFSET(mii1_rxdv), MODE(0) | RXACTIVE}, /* MII1_RXDV */
|
363
|
{OFFSET(mii1_txd3), MODE(0)}, /* MII1_TXD3 */
|
364
|
{OFFSET(mii1_txd2), MODE(0)}, /* MII1_TXD2 */
|
365
|
{OFFSET(mii1_txd1), MODE(0)}, /* MII1_TXD1 */
|
366
|
{OFFSET(mii1_txd0), MODE(0)}, /* MII1_TXD0 */
|
367
|
{OFFSET(mii1_txclk), MODE(0) | RXACTIVE}, /* MII1_TXCLK */
|
368
|
{OFFSET(mii1_rxclk), MODE(0) | RXACTIVE}, /* MII1_RXCLK */
|
369
|
{OFFSET(mii1_rxd3), MODE(0) | RXACTIVE}, /* MII1_RXD3 */
|
370
|
{OFFSET(mii1_rxd2), MODE(0) | RXACTIVE}, /* MII1_RXD2 */
|
371
|
{OFFSET(mii1_rxd1), MODE(0) | RXACTIVE}, /* MII1_RXD1 */
|
372
|
{OFFSET(mii1_rxd0), MODE(0) | RXACTIVE}, /* MII1_RXD0 */
|
373
|
{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
|
374
|
{OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
|
375
|
{-1},
|
376
|
};
|
377
|
|
378
|
static struct module_pin_mux rmii1_pin_mux[] = {
|
379
|
{OFFSET(mii1_crs), MODE(1) | RXACTIVE}, /* RMII1_CRS */
|
380
|
{OFFSET(mii1_rxerr), MODE(1) | RXACTIVE}, /* RMII1_RXERR */
|
381
|
{OFFSET(mii1_txen), MODE(1)}, /* RMII1_TXEN */
|
382
|
{OFFSET(mii1_txd1), MODE(1)}, /* RMII1_TXD1 */
|
383
|
{OFFSET(mii1_txd0), MODE(1)}, /* RMII1_TXD0 */
|
384
|
{OFFSET(mii1_rxd1), MODE(1) | RXACTIVE}, /* RMII1_RXD1 */
|
385
|
{OFFSET(mii1_rxd0), MODE(1) | RXACTIVE}, /* RMII1_RXD0 */
|
386
|
{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
|
387
|
{OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
|
388
|
{OFFSET(rmii1_refclk), MODE(0) | RXACTIVE}, /* RMII1_REFCLK */
|
389
|
{-1},
|
390
|
};
|
391
|
#endif
|
392
|
|
393
|
#ifdef CONFIG_MMC
|
394
|
static struct module_pin_mux mmc0_pin_mux[] = {
|
395
|
{OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */
|
396
|
{OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */
|
397
|
{OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */
|
398
|
{OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */
|
399
|
{OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */
|
400
|
{OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */
|
401
|
#ifndef CONFIG_AM335X_TF
|
402
|
//dmckinley moved wp and cd to new pins for sandia
|
403
|
{OFFSET(gpmc_a3), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC0_WP, 0 = NO WRITE PROTECT */
|
404
|
{OFFSET(gpmc_a1), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC0_CD, 0 = CARD DETECT */
|
405
|
|
406
|
// {OFFSET(mii1_col), (MODE(7) | RXACTIVE)}, /* MMC0_WP */
|
407
|
//{OFFSET(mii1_txen), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC0_CD */
|
408
|
#endif /* CONFIG_AM335X_TF */
|
409
|
{-1},
|
410
|
};
|
411
|
|
412
|
static struct module_pin_mux mmc1_pin_mux[] = {
|
413
|
{OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE)}, /* MMC1_DAT3 */
|
414
|
{OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE)}, /* MMC1_DAT2 */
|
415
|
{OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE)}, /* MMC1_DAT1 */
|
416
|
{OFFSET(gpmc_ad0), (MODE(1) | RXACTIVE)}, /* MMC1_DAT0 */
|
417
|
{OFFSET(gpmc_csn1), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CLK */
|
418
|
{OFFSET(gpmc_csn2), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CMD */
|
419
|
{OFFSET(uart1_rxd), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_WP */
|
420
|
{OFFSET(mcasp0_fsx), (MODE(4) | RXACTIVE)}, /* MMC1_CD */
|
421
|
{-1},
|
422
|
};
|
423
|
#endif
|
424
|
|
425
|
#ifdef CONFIG_SPI
|
426
|
static struct module_pin_mux spi0_pin_mux[] = {
|
427
|
{OFFSET(spi0_sclk), MODE(0) | PULLUDEN | RXACTIVE}, /*SPI0_SCLK */
|
428
|
{OFFSET(spi0_d0), MODE(0) | PULLUDEN | PULLUP_EN |
|
429
|
RXACTIVE}, /*SPI0_D0 */
|
430
|
{OFFSET(spi0_d1), MODE(0) | PULLUDEN |
|
431
|
RXACTIVE}, /*SPI0_D1 */
|
432
|
{OFFSET(spi0_cs0), MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE}, /*SPI0_CS0 */
|
433
|
{-1},
|
434
|
};
|
435
|
|
436
|
static struct module_pin_mux spi1_pin_mux[] = {
|
437
|
{OFFSET(ecap0_in_pwm0_out), MODE(4) | PULLUDEN | RXACTIVE}, /*SPI1_SCLK */
|
438
|
{OFFSET(mcasp0_fsx), MODE(3) | PULLUDEN | PULLUP_EN |
|
439
|
RXACTIVE}, /*SPI1_D0 */
|
440
|
{OFFSET(mcasp0_axr0), MODE(3) | PULLUDEN | RXACTIVE}, /*SPI1_D1 */
|
441
|
{OFFSET(mcasp0_ahclkr), MODE(3) | PULLUDEN | PULLUP_EN |
|
442
|
RXACTIVE}, /*SPI1_CS0 */
|
443
|
{-1},
|
444
|
};
|
445
|
#endif
|
446
|
|
447
|
/*
|
448
|
* Update the structure with the modules present in the general purpose
|
449
|
* board and the profiles in which the modules are present.
|
450
|
* If the module is physically present but if it is not available
|
451
|
* in any of the profile, then do not update it.
|
452
|
* For eg, nand is avialable only in the profiles 0 and 1, whereas
|
453
|
* UART0 is available in all the profiles.
|
454
|
*/
|
455
|
static struct evm_pin_mux general_purpose_evm_pin_mux[] = {
|
456
|
{uart0_pin_mux, PROFILE_ALL},
|
457
|
{i2c1_pin_mux, PROFILE_ALL},
|
458
|
{i2c2_pin_mux, PROFILE_ALL},
|
459
|
#ifdef CONFIG_NAND
|
460
|
{nand_pin_mux, PROFILE_ALL},
|
461
|
#endif
|
462
|
#ifndef CONFIG_NO_ETH
|
463
|
{rgmii1_pin_mux, PROFILE_ALL},
|
464
|
//{rgmii1_pin_mux, PROFILE_1},
|
465
|
//{rgmii2_pin_mux, PROFILE_0},
|
466
|
#endif
|
467
|
|
468
|
#ifdef CONFIG_MMC
|
469
|
{mmc0_pin_mux, PROFILE_ALL},
|
470
|
// {mmc1_pin_mux, PROFILE_2},
|
471
|
#endif
|
472
|
#ifdef CONFIG_SPI
|
473
|
{spi0_pin_mux, PROFILE_0},
|
474
|
{spi1_pin_mux, PROFILE_0},
|
475
|
#endif
|
476
|
// new io pins
|
477
|
{sandia_pin_mux, PROFILE_ALL},
|
478
|
{0},
|
479
|
};
|
480
|
|
481
|
|
482
|
static struct evm_pin_mux *am335x_pin_mux[] = {
|
483
|
general_purpose_evm_pin_mux,
|
484
|
};
|
485
|
|
486
|
/*
|
487
|
* Configure the pin mux for the module
|
488
|
*/
|
489
|
static void configure_module_pin_mux(struct module_pin_mux *mod_pin_mux)
|
490
|
{
|
491
|
int i;
|
492
|
|
493
|
for (i = 0; mod_pin_mux[i].reg_offset != -1; i++)
|
494
|
{
|
495
|
/* #define DEBUG_PINMUX */
|
496
|
#ifdef DEBUG_PINMUX
|
497
|
printf("PINMUX[%d]:%04x - 0x%08x\n",i,mod_pin_mux[i].reg_offset, mod_pin_mux[i].val);
|
498
|
#endif // DEBUG_PINMUX
|
499
|
MUX_CFG(mod_pin_mux[i].val, mod_pin_mux[i].reg_offset);
|
500
|
}
|
501
|
}
|
502
|
|
503
|
|
504
|
/*
|
505
|
* Check each module in the daughter board(first argument) whether it is
|
506
|
* available in the selected profile(second argument). If the module is not
|
507
|
* available in the selected profile, skip the corresponding configuration.
|
508
|
*/
|
509
|
static void set_evm_pin_mux(struct evm_pin_mux *pin_mux,
|
510
|
int prof)
|
511
|
{
|
512
|
int i;
|
513
|
|
514
|
if (!pin_mux)
|
515
|
return;
|
516
|
|
517
|
/*
|
518
|
* Only General Purpose & Industrial Auto Motro Control
|
519
|
* EVM has profiles. So check if this evm has profile.
|
520
|
* If not, ignore the profile comparison
|
521
|
*/
|
522
|
|
523
|
/*
|
524
|
* If the device is on baseboard, directly configure it. Else (device on
|
525
|
* Daughter board), check if the daughter card is detected.
|
526
|
*/
|
527
|
|
528
|
for (i = 0; pin_mux[i].mod_pin_mux != 0; i++) {
|
529
|
if ((pin_mux[i].profile & prof) ||
|
530
|
(prof == PROFILE_NONE)) {
|
531
|
configure_module_pin_mux(pin_mux[i].
|
532
|
mod_pin_mux);
|
533
|
}
|
534
|
}
|
535
|
}
|
536
|
|
537
|
void configure_evm_pin_mux(unsigned char profile)
|
538
|
{
|
539
|
set_evm_pin_mux(am335x_pin_mux[0], profile);
|
540
|
}
|
541
|
|
542
|
void enable_mmc0_pin_mux(void)
|
543
|
{
|
544
|
#ifdef CONFIG_MMC
|
545
|
configure_module_pin_mux(mmc0_pin_mux);
|
546
|
#endif
|
547
|
}
|
548
|
void enable_i2c0_pin_mux(void)
|
549
|
{
|
550
|
configure_module_pin_mux(i2c0_pin_mux);
|
551
|
}
|
552
|
|
553
|
void enable_i2c1_pin_mux(void)
|
554
|
{
|
555
|
configure_module_pin_mux(i2c1_pin_mux);
|
556
|
}
|
557
|
void enable_i2c2_pin_mux(void)
|
558
|
{
|
559
|
configure_module_pin_mux(i2c2_pin_mux);
|
560
|
}
|
561
|
|
562
|
void enable_sandia_pin_mux(void)
|
563
|
{
|
564
|
configure_module_pin_mux(sandia_pin_mux);
|
565
|
}
|
566
|
|
567
|
void enable_uart0_pin_mux(void)
|
568
|
{
|
569
|
configure_module_pin_mux(uart0_pin_mux);
|
570
|
}
|