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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
|
/*
* Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
#include "iomux.h"
#include "mx50_pins.h"
/*!
* @file mach-mx5/mx50_arm2_gpio.c
*
* @brief This file contains all the GPIO setup functions for the board.
*
* @ingroup GPIO
*/
static struct mxc_iomux_pin_cfg __initdata mxc_iomux_pins[] = {
{ /* SD1 WP */
MX50_PIN_ECSPI2_SS0, IOMUX_CONFIG_GPIO,
},
{ /* SD1 CD */
MX50_PIN_EIM_CRE, IOMUX_CONFIG_GPIO,
},
{ /* SD1 CMD */
MX50_PIN_SD1_CMD, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD1 CLK */
MX50_PIN_SD1_CLK, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD1 D0 */
MX50_PIN_SD1_D0, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD1 D1 */
MX50_PIN_SD1_D1, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD1 D2 */
MX50_PIN_SD1_D2, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD1 D3 */
MX50_PIN_SD1_D3, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 CD */
MX50_PIN_SD2_CD, IOMUX_CONFIG_GPIO,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 WP */
MX50_PIN_SD2_WP, IOMUX_CONFIG_GPIO,
},
{ /* SD2 CMD */
MX50_PIN_SD2_CMD, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 CLK */
MX50_PIN_SD2_CLK, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D0 */
MX50_PIN_SD2_D0, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D1 */
MX50_PIN_SD2_D1, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D2 */
MX50_PIN_SD2_D2, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D3 */
MX50_PIN_SD2_D3, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D4 */
MX50_PIN_SD2_D4, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D5 */
MX50_PIN_SD2_D5, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D6 */
MX50_PIN_SD2_D6, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD2 D7 */
MX50_PIN_SD2_D7, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD3 CD */
MX50_PIN_KEY_COL2, IOMUX_CONFIG_GPIO,
(PAD_CTL_DRV_HIGH | PAD_CTL_75k_PU | PAD_CTL_SRE_FAST),
},
{ /* SD3 WP */
MX50_PIN_SD3_WP, IOMUX_CONFIG_GPIO,
},
{ /* SD3 CMD */
MX50_PIN_SD3_CMD, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 CLK */
MX50_PIN_SD3_CLK, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_47K_PU |
PAD_CTL_DRV_HIGH),
},
{ /* SD3 D0 */
MX50_PIN_SD3_D0, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D1 */
MX50_PIN_SD3_D1, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D2 */
MX50_PIN_SD3_D2, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D3 */
MX50_PIN_SD3_D3, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D4 */
MX50_PIN_SD3_D4, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D5 */
MX50_PIN_SD3_D5, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D6 */
MX50_PIN_SD3_D6, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{ /* SD3 D7 */
MX50_PIN_SD3_D7, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_47K_PU | PAD_CTL_DRV_HIGH),
},
{
MX50_PIN_SSI_TXD, IOMUX_CONFIG_ALT0,
},
{
MX50_PIN_SSI_RXD, IOMUX_CONFIG_ALT0,
},
{
MX50_PIN_SSI_TXC, IOMUX_CONFIG_ALT0,
},
{
MX50_PIN_SSI_TXFS, IOMUX_CONFIG_ALT0,
},
/* LINE1_DETECT (headphone detect) */
{
MX50_PIN_ECSPI1_SS0, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU,
},
{
MX50_PIN_ECSPI2_MISO, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU,
},
/* UART pad setting */
{
MX50_PIN_UART1_TXD, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
},
{
MX50_PIN_UART1_RXD, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
MUX_IN_UART1_IPP_UART_RXD_MUX_SELECT_INPUT,
INPUT_CTL_PATH1,
},
{
MX50_PIN_UART1_CTS, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
},
{
MX50_PIN_UART1_RTS, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
MUX_IN_UART1_IPP_UART_RTS_B_SELECT_INPUT,
INPUT_CTL_PATH1,
},
{
MX50_PIN_UART2_TXD, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
},
{
MX50_PIN_UART2_RXD, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
MUX_IN_UART2_IPP_UART_RXD_MUX_SELECT_INPUT,
INPUT_CTL_PATH1,
},
{
MX50_PIN_UART2_CTS, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
},
{
MX50_PIN_UART2_RTS, IOMUX_CONFIG_ALT0,
(PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
PAD_CTL_PKE_ENABLE | PAD_CTL_ODE_OPENDRAIN_NONE),
MUX_IN_UART2_IPP_UART_RTS_B_SELECT_INPUT,
INPUT_CTL_PATH1,
},
{ /* I2C1 SDA */
MX50_PIN_I2C1_SDA, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
{ /* I2C1 SCL */
MX50_PIN_I2C1_SCL, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
{ /* I2C2 SDA */
MX50_PIN_I2C2_SDA, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
{ /* I2C2 SCL */
MX50_PIN_I2C2_SCL, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
{ /* I2C3 SDA */
MX50_PIN_I2C3_SDA, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
{ /* I2C3 SCL */
MX50_PIN_I2C3_SCL, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION,
(PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE |
PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
PAD_CTL_HYS_ENABLE),
},
/* EPDC pins */
{ /* EPDC D0 */
MX50_PIN_EPDC_D0, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D1 */
MX50_PIN_EPDC_D1, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D2 */
MX50_PIN_EPDC_D2, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D3 */
MX50_PIN_EPDC_D3, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D4 */
MX50_PIN_EPDC_D4, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D5 */
MX50_PIN_EPDC_D5, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D6 */
MX50_PIN_EPDC_D6, IOMUX_CONFIG_ALT0,
},
{ /* EPDC D7 */
MX50_PIN_EPDC_D7, IOMUX_CONFIG_ALT0,
},
{ /* EPDC GDCLK */
MX50_PIN_EPDC_GDCLK, IOMUX_CONFIG_ALT0,
},
{ /* EPDC GDSP */
MX50_PIN_EPDC_GDSP, IOMUX_CONFIG_ALT0,
},
{ /* EPDC GDOE */
MX50_PIN_EPDC_GDOE, IOMUX_CONFIG_ALT0,
},
{ /* EPDC GDRL */
MX50_PIN_EPDC_GDRL, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDCLK */
MX50_PIN_EPDC_SDCLK, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDOE */
MX50_PIN_EPDC_SDOE, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDLE */
MX50_PIN_EPDC_SDLE, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDSHR */
MX50_PIN_EPDC_SDSHR, IOMUX_CONFIG_ALT0,
},
{ /* EPDC BDR0 */
MX50_PIN_EPDC_BDR0, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDCE0 */
MX50_PIN_EPDC_SDCE0, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDCE1 */
MX50_PIN_EPDC_SDCE1, IOMUX_CONFIG_ALT0,
},
{ /* EPDC SDCE2 */
MX50_PIN_EPDC_SDCE2, IOMUX_CONFIG_ALT0,
},
/* EPD PMIC pins */
{ /* EPDC PWRSTAT - GPIO3[28] for PWR_GOOD status */
MX50_PIN_EPDC_PWRSTAT, IOMUX_CONFIG_ALT1,
},
{ /* EPDC VCOM0 - GPIO4[21] for VCOM control */
MX50_PIN_EPDC_VCOM0, IOMUX_CONFIG_ALT1,
},
{ /* ELCDIF D8 */
MX50_PIN_DISP_D8, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D9 */
MX50_PIN_DISP_D9, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D10 */
MX50_PIN_DISP_D10, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D11 */
MX50_PIN_DISP_D11, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D12 */
MX50_PIN_DISP_D12, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D13 */
MX50_PIN_DISP_D13, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D14 */
MX50_PIN_DISP_D14, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF D15 */
MX50_PIN_DISP_D15, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF VSYNC */
MX50_PIN_DISP_RS, IOMUX_CONFIG_ALT2,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF contrast */
MX50_PIN_DISP_BUSY, IOMUX_CONFIG_ALT1,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF HSYNC */
MX50_PIN_DISP_CS, IOMUX_CONFIG_ALT2,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF DRDY */
MX50_PIN_DISP_RD, IOMUX_CONFIG_ALT2,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* ELCDIF PIXCLK */
MX50_PIN_DISP_WR, IOMUX_CONFIG_ALT2,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
PAD_CTL_ODE_OPENDRAIN_NONE | PAD_CTL_DRV_HIGH),
},
{ /* UART4 TXD - GPIO6[16] for EPD PMIC WAKEUP */
MX50_PIN_UART4_TXD, IOMUX_CONFIG_ALT1,
},
{ /* UART4 RXD - GPIO6[17] for EPD PMIC intr */
MX50_PIN_UART4_RXD, IOMUX_CONFIG_ALT1,
},
/* USB_H1_PWR */
{
MX50_PIN_EPITO, IOMUX_CONFIG_ALT2,
PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH,
},
/* FIXME: USB_H1_OC, need to comment below line if
* one needs to debug owire.
*/
{
MX50_PIN_OWIRE, IOMUX_CONFIG_ALT2,
PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU,
},
/* USB_OTG_PWR */
{
MX50_PIN_PWM2, IOMUX_CONFIG_ALT2,
PAD_CTL_PKE_ENABLE | PAD_CTL_DRV_HIGH,
},
/*
* Set USB_OTG_OC, the pad value is the default value
* according to IC suggestion.
*/
{
MX50_PIN_PWM1, IOMUX_CONFIG_ALT2,
PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU,
MUX_IN_USBOH1_IPP_IND_OTG_OC_SELECT_INPUT, INPUT_CTL_PATH1,
},
{ /* FEC_MDIO */
MX50_PIN_SSI_RXC, IOMUX_CONFIG_ALT6,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_22K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE | PAD_CTL_DRV_HIGH),
MUX_IN_FEC_FEC_MDI_SELECT_INPUT,
INPUT_CTL_PATH1,
},
{ /* FEC_TX_CLK */
MX50_PIN_DISP_D0, IOMUX_CONFIG_ALT2,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
},
{ /* FEC_RX_ER */
MX50_PIN_DISP_D1, IOMUX_CONFIG_ALT2,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
MUX_IN_FEC_FEC_RX_ER_SELECT_INPUT,
INPUT_CTL_PATH0,
},
{ /* FEC_CRS_DV */
MX50_PIN_DISP_D2, IOMUX_CONFIG_ALT2,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
MUX_IN_FEC_FEC_RX_DV_SELECT_INPUT,
INPUT_CTL_PATH0,
},
{ /* FEC_RXD1 */
MX50_PIN_DISP_D3, IOMUX_CONFIG_ALT2,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
MUX_IN_FEC_FEC_RDATA_1_SELECT_INPUT,
INPUT_CTL_PATH0,
},
{ /* FEC_RXD0 */
MX50_PIN_DISP_D4, IOMUX_CONFIG_ALT2,
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
MUX_IN_FEC_FEC_RDATA_0_SELECT_INPUT,
INPUT_CTL_PATH0,
},
{ /* FEC_TX_EN */
MX50_PIN_DISP_D5, IOMUX_CONFIG_ALT2,
PAD_CTL_DRV_HIGH,
},
{ /* FEC_TXD1 */
MX50_PIN_DISP_D6, IOMUX_CONFIG_ALT2,
PAD_CTL_DRV_HIGH,
},
{ /* FEC_TXD0 */
MX50_PIN_DISP_D7, IOMUX_CONFIG_ALT2,
PAD_CTL_DRV_HIGH,
},
{ /* FEC_MDC */
MX50_PIN_SSI_RXFS, IOMUX_CONFIG_ALT6,
PAD_CTL_DRV_HIGH,
},
{ /* CSPI SS0 */
MX50_PIN_CSPI_SS0, IOMUX_CONFIG_ALT0,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH),
},
{ /* CSPI SS1 */
MX50_PIN_ECSPI1_MOSI, IOMUX_CONFIG_ALT2,
(PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_PULL |
PAD_CTL_22K_PU | PAD_CTL_DRV_HIGH),
},
{
MX50_PIN_CSPI_MOSI, IOMUX_CONFIG_ALT0,
},
{
MX50_PIN_CSPI_MISO, IOMUX_CONFIG_ALT0,
},
{
MX50_PIN_CSPI_SCLK, IOMUX_CONFIG_ALT0,
},
};
void __init mx50_arm2_io_init(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(mxc_iomux_pins); i++) {
mxc_request_iomux(mxc_iomux_pins[i].pin,
mxc_iomux_pins[i].mux_mode);
if (mxc_iomux_pins[i].pad_cfg)
mxc_iomux_set_pad(mxc_iomux_pins[i].pin,
mxc_iomux_pins[i].pad_cfg);
if (mxc_iomux_pins[i].in_select)
mxc_iomux_set_input(mxc_iomux_pins[i].in_select,
mxc_iomux_pins[i].in_mode);
}
/* SD1 WP */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_ECSPI2_SS0), "ecspi2_ss0");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_ECSPI2_SS0));
/* SD1 CD */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_EIM_CRE), "eim_cre");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_EIM_CRE));
/* SD2 WP */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_SD2_WP), "sd2_wp");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_SD2_WP));
/* SD2 CD */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_SD2_CD), "sd2_cd");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_SD2_CD));
/* SD3 WP */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_SD3_WP), "sd3_wp");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_SD2_WP));
/* SD3 CD */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_KEY_COL2), "key_col2");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_KEY_COL2));
/* LINE1_DETECT (headphone detect) */
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_ECSPI1_SS0));
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_ECSPI2_MISO));
/* EPDC PMIC */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_UART4_TXD), "uart4_txd");
gpio_direction_output(IOMUX_TO_GPIO(MX50_PIN_UART4_TXD), 0);
gpio_request(IOMUX_TO_GPIO(MX50_PIN_EPDC_VCOM0), "epdc_vcom");
gpio_direction_output(IOMUX_TO_GPIO(MX50_PIN_EPDC_VCOM0), 0);
gpio_request(IOMUX_TO_GPIO(MX50_PIN_UART4_RXD), "uart4_rxd");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_UART4_RXD));
gpio_request(IOMUX_TO_GPIO(MX50_PIN_EPDC_PWRSTAT), "epdc_pwrstat");
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_EPDC_PWRSTAT));
/* ELCDIF backlight */
gpio_request(IOMUX_TO_GPIO(MX50_PIN_DISP_BUSY), "gp2_18");
gpio_direction_output(IOMUX_TO_GPIO(MX50_PIN_DISP_BUSY), 1);
}
/* workaround for cspi chipselect pin may not keep correct level when idle */
void mx50_arm2_gpio_spi_chipselect_active(int cspi_mode, int status,
int chipselect)
{
switch (cspi_mode) {
case 1:
break;
case 2:
break;
case 3:
switch (chipselect) {
case 0x1:
/* enable ss0 */
mxc_request_iomux(MX50_PIN_CSPI_SS0, IOMUX_CONFIG_ALT0);
/*disable other ss */
mxc_request_iomux(MX50_PIN_ECSPI1_MOSI, IOMUX_CONFIG_GPIO);
/* pull up/down deassert it */
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_ECSPI1_MOSI));
break;
case 0x2:
/* enable ss1 */
mxc_request_iomux(MX50_PIN_ECSPI1_MOSI, IOMUX_CONFIG_ALT2);
/*disable other ss */
mxc_request_iomux(MX50_PIN_CSPI_SS0, IOMUX_CONFIG_GPIO);
/* pull up/down deassert it */
gpio_direction_input(IOMUX_TO_GPIO(MX50_PIN_CSPI_SS0));
break;
default:
break;
}
break;
default:
break;
}
}
void mx50_arm2_gpio_spi_chipselect_inactive(int cspi_mode, int status,
int chipselect)
{
switch (cspi_mode) {
case 1:
break;
case 2:
break;
case 3:
switch (chipselect) {
case 0x1:
mxc_free_iomux(MX50_PIN_ECSPI1_MOSI, IOMUX_CONFIG_GPIO);
break;
case 0x2:
mxc_free_iomux(MX50_PIN_CSPI_SS0, IOMUX_CONFIG_GPIO);
break;
default:
break;
}
break;
default:
break;
}
}
|