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
|
/*
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
* Copyright (C) 2013 Google Inc.
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include "pinmux.h"
#include <arch/io.h>
#include <config.h>
static struct am335x_pinmux_regs *regs =
(struct am335x_pinmux_regs *)(uintptr_t)AM335X_PINMUX_REG_ADDR;
void am335x_pinmux_uart0(void)
{
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->uart0_rxd);
writel(MODE(0) | PULLUDEN, ®s->uart0_txd);
}
void am335x_pinmux_uart1(void)
{
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->uart1_rxd);
writel(MODE(0) | PULLUDEN, ®s->uart1_txd);
}
void am335x_pinmux_uart2(void)
{
// UART2_RXD
writel(MODE(1) | PULLUP_EN | RXACTIVE, ®s->spi0_sclk);
// UART2_TXD
writel(MODE(1) | PULLUDEN, ®s->spi0_d0);
}
void am335x_pinmux_uart3(void)
{
// UART3_RXD
writel(MODE(1) | PULLUP_EN | RXACTIVE, ®s->spi0_cs1);
// UART3_TXD
writel(MODE(1) | PULLUDEN, ®s->ecap0_in_pwm0_out);
}
void am335x_pinmux_uart4(void)
{
// UART4_RXD
writel(MODE(6) | PULLUP_EN | RXACTIVE, ®s->gpmc_wait0);
// UART4_TXD
writel(MODE(6) | PULLUDEN, ®s->gpmc_wpn);
}
void am335x_pinmux_uart5(void)
{
// UART5_RXD
writel(MODE(4) | PULLUP_EN | RXACTIVE, ®s->lcd_data9);
// UART5_TXD
writel(MODE(4) | PULLUDEN, ®s->lcd_data8);
}
void am335x_pinmux_mmc0(int cd, int sk_evm)
{
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_dat0);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_dat1);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_dat2);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_dat3);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_clk);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mmc0_cmd);
if (!sk_evm) {
// MMC0_WP
writel(MODE(4) | RXACTIVE, ®s->mcasp0_aclkr);
}
if (cd) {
// MMC0_CD
writel(MODE(5) | RXACTIVE | PULLUP_EN, ®s->spi0_cs1);
}
}
void am335x_pinmux_mmc1(void)
{
// MMC1_DAT0
writel(MODE(1) | RXACTIVE | PULLUP_EN, ®s->gpmc_ad0);
// MMC1_DAT1
writel(MODE(1) | RXACTIVE | PULLUP_EN, ®s->gpmc_ad1);
// MMC1_DAT2
writel(MODE(1) | RXACTIVE | PULLUP_EN, ®s->gpmc_ad2);
// MMC1_DAT3
writel(MODE(1) | RXACTIVE | PULLUP_EN, ®s->gpmc_ad3);
// MMC1_CLK
writel(MODE(2) | RXACTIVE | PULLUP_EN, ®s->gpmc_csn1);
// MMC1_CMD
writel(MODE(2) | RXACTIVE | PULLUP_EN, ®s->gpmc_csn2);
// MMC1_WP
writel(MODE(7) | RXACTIVE | PULLUP_EN, ®s->gpmc_csn0);
// MMC1_CD
writel(MODE(7) | RXACTIVE | PULLUP_EN, ®s->gpmc_advn_ale);
}
void am335x_pinmux_i2c0(void)
{
writel(MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL, ®s->i2c0_sda);
writel(MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL, ®s->i2c0_scl);
}
void am335x_pinmux_i2c1(void)
{
// I2C_DATA
writel(MODE(2) | RXACTIVE | PULLUDEN | SLEWCTRL, ®s->spi0_d1);
// I2C_SCLK
writel(MODE(2) | RXACTIVE | PULLUDEN | SLEWCTRL, ®s->spi0_cs0);
}
void am335x_pinmux_spi0(void)
{
writel(MODE(0) | RXACTIVE | PULLUDEN, ®s->spi0_sclk);
writel(MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN, ®s->spi0_d0);
writel(MODE(0) | RXACTIVE | PULLUDEN, ®s->spi0_d1);
writel(MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN, ®s->spi0_cs0);
}
void am335x_pinmux_gpio0_7(void)
{
writel(MODE(7) | PULLUDEN, ®s->ecap0_in_pwm0_out);
}
void am335x_pinmux_rgmii1(void)
{
writel(MODE(2), ®s->mii1_txen);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxdv);
writel(MODE(2), ®s->mii1_txd0);
writel(MODE(2), ®s->mii1_txd1);
writel(MODE(2), ®s->mii1_txd2);
writel(MODE(2), ®s->mii1_txd3);
writel(MODE(2), ®s->mii1_txclk);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxclk);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxd0);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxd1);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxd2);
writel(MODE(2) | RXACTIVE, ®s->mii1_rxd3);
}
void am335x_pinmux_mii1(void)
{
writel(MODE(0) | RXACTIVE, ®s->mii1_rxerr);
writel(MODE(0), ®s->mii1_txen);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxdv);
writel(MODE(0), ®s->mii1_txd0);
writel(MODE(0), ®s->mii1_txd1);
writel(MODE(0), ®s->mii1_txd2);
writel(MODE(0), ®s->mii1_txd3);
writel(MODE(0) | RXACTIVE, ®s->mii1_txclk);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxclk);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxd0);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxd1);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxd2);
writel(MODE(0) | RXACTIVE, ®s->mii1_rxd3);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->mdio_data);
writel(MODE(0) | PULLUP_EN, ®s->mdio_clk);
}
void am335x_pinmux_nand(void)
{
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad0);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad1);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad2);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad3);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad4);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad5);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad6);
writel(MODE(0) | PULLUP_EN | RXACTIVE, ®s->gpmc_ad7);
writel(MODE(0) | RXACTIVE | PULLUP_EN, ®s->gpmc_wait0);
writel(MODE(7) | PULLUP_EN | RXACTIVE, ®s->gpmc_wpn);
writel(MODE(0) | PULLUDEN, ®s->gpmc_csn0);
writel(MODE(0) | PULLUDEN, ®s->gpmc_advn_ale);
writel(MODE(0) | PULLUDEN, ®s->gpmc_oen_ren);
writel(MODE(0) | PULLUDEN, ®s->gpmc_wen);
writel(MODE(0) | PULLUDEN, ®s->gpmc_be0n_cle);
}
|