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
|
/*
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/hardware.h>
#include <asm/arch/gpio.h>
#include "board-mx35evb.h"
#include "iomux.h"
/*!
* @file mach-mx35/mx35evb_gpio.c
*
* @brief This file contains all the GPIO setup functions for the board.
*
* @ingroup GPIO_MX35
*/
/*!
* This system-wise GPIO function initializes the pins during system startup.
* All the statically linked device drivers should put the proper GPIO
* initialization code inside this function. It is called by \b fixup_mx31ads()
* during system startup. This function is board specific.
*/
void mx35evb_gpio_init(void)
{
/* config CS4 */
mxc_request_iomux(MX35_PIN_CS4, MUX_CONFIG_FUNC);
}
/*!
* Setup GPIO for a UART port to be active
*
* @param port a UART port
* @param no_irda indicates if the port is used for SIR
*/
void gpio_uart_active(int port, int no_irda)
{
/*
* Configure the IOMUX control registers for the UART signals
*/
switch (port) {
/* UART 1 IOMUX Configs */
case 0:
mxc_request_iomux(MX35_PIN_RXD1, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_TXD1, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_RTS1, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_CTS1, MUX_CONFIG_FUNC);
mxc_iomux_set_pad(MX35_PIN_RXD1,
PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE |
PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
mxc_iomux_set_pad(MX35_PIN_TXD1,
PAD_CTL_PUE_PUD | PAD_CTL_100K_PD);
mxc_iomux_set_pad(MX35_PIN_RTS1,
PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE |
PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
mxc_iomux_set_pad(MX35_PIN_CTS1,
PAD_CTL_PUE_PUD | PAD_CTL_100K_PD);
break;
/* UART 2 IOMUX Configs */
case 1:
mxc_request_iomux(MX35_PIN_TXD2, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_RXD2, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_RTS2, MUX_CONFIG_FUNC);
mxc_request_iomux(MX35_PIN_CTS2, MUX_CONFIG_FUNC);
mxc_iomux_set_pad(MX35_PIN_RXD2,
PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE |
PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
mxc_iomux_set_pad(MX35_PIN_TXD2,
PAD_CTL_PUE_PUD | PAD_CTL_100K_PD);
mxc_iomux_set_pad(MX35_PIN_RTS2,
PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE |
PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
mxc_iomux_set_pad(MX35_PIN_CTS2,
PAD_CTL_PUE_PUD | PAD_CTL_100K_PD);
break;
/* UART 3 IOMUX Configs */
case 2:
mxc_request_iomux(MX35_PIN_FEC_TX_CLK, MUX_CONFIG_ALT2);
mxc_request_iomux(MX35_PIN_FEC_RX_CLK, MUX_CONFIG_ALT2);
mxc_request_iomux(MX35_PIN_FEC_COL, MUX_CONFIG_ALT2);
mxc_request_iomux(MX35_PIN_FEC_RX_DV, MUX_CONFIG_ALT2);
mxc_iomux_set_input(MUX_IN_UART3_UART_RTS_B, INPUT_CTL_PATH2);
mxc_iomux_set_input(MUX_IN_UART3_UART_RXD_MUX, INPUT_CTL_PATH3);
break;
default:
break;
}
}
EXPORT_SYMBOL(gpio_uart_active);
/*!
* Setup GPIO for a UART port to be inactive
*
* @param port a UART port
* @param no_irda indicates if the port is used for SIR
*/
void gpio_uart_inactive(int port, int no_irda)
{
switch (port) {
case 0:
mxc_request_gpio(MX35_PIN_RXD1);
mxc_request_gpio(MX35_PIN_TXD1);
mxc_request_gpio(MX35_PIN_RTS1);
mxc_request_gpio(MX35_PIN_CTS1);
mxc_free_iomux(MX35_PIN_RXD1, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_TXD1, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_RTS1, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_CTS1, MUX_CONFIG_GPIO);
break;
case 1:
mxc_request_gpio(MX35_PIN_RXD2);
mxc_request_gpio(MX35_PIN_TXD2);
mxc_request_gpio(MX35_PIN_RTS2);
mxc_request_gpio(MX35_PIN_CTS2);
mxc_free_iomux(MX35_PIN_RXD2, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_TXD2, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_RTS2, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_CTS2, MUX_CONFIG_GPIO);
break;
case 2:
mxc_request_gpio(MX35_PIN_FEC_TX_CLK);
mxc_request_gpio(MX35_PIN_FEC_RX_CLK);
mxc_request_gpio(MX35_PIN_FEC_COL);
mxc_request_gpio(MX35_PIN_FEC_RX_DV);
mxc_free_iomux(MX35_PIN_FEC_TX_CLK, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_FEC_RX_CLK, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_FEC_COL, MUX_CONFIG_GPIO);
mxc_free_iomux(MX35_PIN_FEC_RX_DV, MUX_CONFIG_GPIO);
mxc_iomux_set_input(MUX_IN_UART3_UART_RTS_B, INPUT_CTL_PATH0);
mxc_iomux_set_input(MUX_IN_UART3_UART_RXD_MUX, INPUT_CTL_PATH0);
break;
default:
break;
}
}
EXPORT_SYMBOL(gpio_uart_inactive);
/*!
* Configure the IOMUX GPR register to receive shared SDMA UART events
*
* @param port a UART port
*/
void config_uartdma_event(int port)
{
}
EXPORT_SYMBOL(config_uartdma_event);
void gpio_fec_active(void)
{
/*TODO:require the pins related with FEC */
}
EXPORT_SYMBOL(gpio_fec_active);
void gpio_fec_inactive(void)
{
/*TODO:release the pins related with FEC */
}
EXPORT_SYMBOL(gpio_fec_inactive);
|