blob: e2e8ec57678f5280d2e15f76c319a83aeaf35232 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Hannes Petermaier94360592014-02-07 14:06:50 +01002/*
3 * mux.c
4 *
5 * Pinmux Setting for B&R LEIT Board(s)
6 *
Hannes Schmelzer7935f032015-05-28 15:41:12 +02007 * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at>
Hannes Petermaier94360592014-02-07 14:06:50 +01008 * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
Hannes Petermaier94360592014-02-07 14:06:50 +01009 */
10
Hannes Petermaier94360592014-02-07 14:06:50 +010011#include <asm/arch/sys_proto.h>
12#include <asm/arch/hardware.h>
13#include <asm/arch/mux.h>
14#include <asm/io.h>
15#include <i2c.h>
16
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010017static struct module_pin_mux spi0_pin_mux[] = {
Hannes Petermaier94360592014-02-07 14:06:50 +010018 /* SPI1_SCLK */
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010019 {OFFSET(spi0_sclk), MODE(0) | PULLUDEN | RXACTIVE},
Hannes Petermaier94360592014-02-07 14:06:50 +010020 /* SPI1_D0 */
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010021 {OFFSET(spi0_d0), MODE(0) | PULLUDEN | RXACTIVE},
Hannes Petermaier94360592014-02-07 14:06:50 +010022 /* SPI1_D1 */
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010023 {OFFSET(spi0_d1), MODE(0) | PULLUDEN | RXACTIVE},
Hannes Petermaier94360592014-02-07 14:06:50 +010024 /* SPI1_CS0 */
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010025 {OFFSET(spi0_cs0), MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE},
26 /* SPI1_CS1 */
27 {OFFSET(spi0_cs1), MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE},
Hannes Petermaier94360592014-02-07 14:06:50 +010028 {-1},
29};
30
31static struct module_pin_mux dcan0_pin_mux[] = {
32 /* DCAN0 TX */
33 {OFFSET(uart1_ctsn), MODE(2) | PULLUDEN | PULLUP_EN},
34 /* DCAN0 RX */
35 {OFFSET(uart1_rtsn), MODE(2) | RXACTIVE},
36 {-1},
37};
38
39static struct module_pin_mux dcan1_pin_mux[] = {
40 /* DCAN1 TX */
41 {OFFSET(uart1_rxd), MODE(2) | PULLUDEN | PULLUP_EN},
42 /* DCAN1 RX */
43 {OFFSET(uart1_txd), MODE(2) | RXACTIVE},
44 {-1},
45};
46
47static struct module_pin_mux gpios[] = {
Hannes Petermaier94360592014-02-07 14:06:50 +010048 /* GPIO0_7 (PWW0 OUT) - CAN TERM */
49 {OFFSET(ecap0_in_pwm0_out), (MODE(7) | PULLUDDIS | RXACTIVE)},
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010050 /* GPIO0_19 (DMA_INTR0) - TA602 */
51 {OFFSET(xdma_event_intr0), (MODE(7) | PULLUDDIS | RXACTIVE)},
52 /* GPIO0_20 (DMA_INTR1) - SPI0 nCS1 */
53 {OFFSET(xdma_event_intr1), (MODE(7) | PULLUDDIS | RXACTIVE)},
54 /* GPIO0_29 (RMII1_REFCLK) - eMMC nRST */
55 {OFFSET(rmii1_refclk), (MODE(7) | PULLUDDIS)},
Hannes Petermaier94360592014-02-07 14:06:50 +010056 /* GPIO0_30 (GPMC_WAIT0) - TA601 */
57 {OFFSET(gpmc_wait0), (MODE(7) | PULLUDDIS | RXACTIVE)},
58 /* GPIO0_31 (GPMC_nWP) - SW601 PushButton */
59 {OFFSET(gpmc_wpn), (MODE(7) | PULLUDDIS | RXACTIVE)},
60 /* GPIO1_28 (GPMC_nWE) - FRAM_nWP */
61 {OFFSET(gpmc_be1n), (MODE(7) | PULLUDDIS)},
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010062 /* GPIO1_29 (gpmc_csn0) - MMC nRST */
63 {OFFSET(gpmc_csn0), (MODE(7) | PULLUDDIS)},
Hannes Petermaier94360592014-02-07 14:06:50 +010064 /* GPIO2_0 (GPMC_nCS3) - VBAT_OK */
65 {OFFSET(gpmc_csn3), (MODE(7) | PULLUDDIS | RXACTIVE) },
66 /* GPIO2_2 (GPMC_nADV_ALE) - DCOK */
67 {OFFSET(gpmc_advn_ale), (MODE(7) | PULLUDDIS | RXACTIVE)},
68 /* GPIO2_4 (GPMC_nWE) - TST_BAST */
69 {OFFSET(gpmc_wen), (MODE(7) | PULLUDDIS)},
Hannes Petermaierc96a9b12015-02-03 13:22:39 +010070 /* GPIO2_5 (gpmc_be0n_cle) - DISPLAY_ON_OFF */
71 {OFFSET(gpmc_be0n_cle), (MODE(7) | PULLUDDIS)},
72 /* GPIO3_16 (mcasp0_axr0) - ETH-LED green */
73 {OFFSET(mcasp0_axr0), (MODE(7) | PULLUDDIS | RXACTIVE)},
74 /* GPIO3_17 (mcasp0_ahclkr) - CAN_STB */
75 {OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUDDIS | RXACTIVE)},
Hannes Petermaier94360592014-02-07 14:06:50 +010076 /* GPIO3_18 (MCASP0_ACLKR) - SW601 CNTup, mapped to Counter eQEB0A_in */
77 {OFFSET(mcasp0_aclkr), (MODE(1) | PULLUDDIS | RXACTIVE)},
78 /* GPIO3_19 (MCASP0_FSR) - SW601 CNTdown, mapped to Counter eQEB0B_in */
79 {OFFSET(mcasp0_fsr), (MODE(1) | PULLUDDIS | RXACTIVE)},
80 /* GPIO3_20 (MCASP0_AXR1) - SW601 CNTdown, map to Counter eQEB0_index */
81 {OFFSET(mcasp0_axr1), (MODE(1) | PULLUDDIS | RXACTIVE)},
82 {-1},
83};
84
85static struct module_pin_mux uart0_pin_mux[] = {
86 /* UART0_CTS */
87 {OFFSET(uart0_ctsn), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},
88 /* UART0_RXD */
89 {OFFSET(uart0_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)},
90 /* UART0_TXD */
91 {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)},
92 {-1},
93};
94
95static struct module_pin_mux i2c0_pin_mux[] = {
96 /* I2C_DATA */
97 {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
98 /* I2C_SCLK */
99 {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
100 {-1},
101};
102
103static struct module_pin_mux mii1_pin_mux[] = {
Hannes Petermaierc61633c2014-10-03 07:30:15 +0200104 {OFFSET(mii1_crs), MODE(0) | RXACTIVE}, /* MII1_CRS */
105 {OFFSET(mii1_col), MODE(0) | RXACTIVE}, /* MII1_COL */
Hannes Petermaier94360592014-02-07 14:06:50 +0100106 {OFFSET(mii1_rxerr), MODE(0) | RXACTIVE}, /* MII1_RXERR */
107 {OFFSET(mii1_txen), MODE(0)}, /* MII1_TXEN */
108 {OFFSET(mii1_rxdv), MODE(0) | RXACTIVE}, /* MII1_RXDV */
109 {OFFSET(mii1_txd3), MODE(0)}, /* MII1_TXD3 */
110 {OFFSET(mii1_txd2), MODE(0)}, /* MII1_TXD2 */
111 {OFFSET(mii1_txd1), MODE(0)}, /* MII1_TXD1 */
112 {OFFSET(mii1_txd0), MODE(0)}, /* MII1_TXD0 */
113 {OFFSET(mii1_txclk), MODE(0) | RXACTIVE}, /* MII1_TXCLK */
114 {OFFSET(mii1_rxclk), MODE(0) | RXACTIVE}, /* MII1_RXCLK */
115 {OFFSET(mii1_rxd3), MODE(0) | RXACTIVE}, /* MII1_RXD3 */
116 {OFFSET(mii1_rxd2), MODE(0) | RXACTIVE}, /* MII1_RXD2 */
117 {OFFSET(mii1_rxd1), MODE(0) | RXACTIVE}, /* MII1_RXD1 */
118 {OFFSET(mii1_rxd0), MODE(0) | RXACTIVE}, /* MII1_RXD0 */
119 {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
120 {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
121 {-1},
122};
123
124static struct module_pin_mux mmc1_pin_mux[] = {
Hannes Petermaierc96a9b12015-02-03 13:22:39 +0100125 {OFFSET(gpmc_ad7), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT7 */
126 {OFFSET(gpmc_ad6), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT6 */
127 {OFFSET(gpmc_ad5), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT5 */
128 {OFFSET(gpmc_ad4), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT4 */
Hannes Petermaier94360592014-02-07 14:06:50 +0100129 {OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT3 */
130 {OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT2 */
131 {OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT1 */
132 {OFFSET(gpmc_ad0), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT0 */
133 {OFFSET(gpmc_csn1), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CLK */
134 {OFFSET(gpmc_csn2), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CMD */
135 {OFFSET(gpmc_csn0), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC1_WP */
136 {OFFSET(gpmc_advn_ale), (MODE(7) | RXACTIVE | PULLUP_EN)},/* MMC1_CD */
137
138 {-1},
139};
140
141static struct module_pin_mux lcd_pin_mux[] = {
142 {OFFSET(lcd_data0), (MODE(0) | PULLUDDIS)}, /* LCD-Data(0) */
143 {OFFSET(lcd_data1), (MODE(0) | PULLUDDIS)}, /* LCD-Data(1) */
144 {OFFSET(lcd_data2), (MODE(0) | PULLUDDIS)}, /* LCD-Data(2) */
145 {OFFSET(lcd_data3), (MODE(0) | PULLUDDIS)}, /* LCD-Data(3) */
146 {OFFSET(lcd_data4), (MODE(0) | PULLUDDIS)}, /* LCD-Data(4) */
147 {OFFSET(lcd_data5), (MODE(0) | PULLUDDIS)}, /* LCD-Data(5) */
148 {OFFSET(lcd_data6), (MODE(0) | PULLUDDIS)}, /* LCD-Data(6) */
149 {OFFSET(lcd_data7), (MODE(0) | PULLUDDIS)}, /* LCD-Data(7) */
150 {OFFSET(lcd_data8), (MODE(0) | PULLUDDIS)}, /* LCD-Data(8) */
151 {OFFSET(lcd_data9), (MODE(0) | PULLUDDIS)}, /* LCD-Data(9) */
152 {OFFSET(lcd_data10), (MODE(0) | PULLUDDIS)}, /* LCD-Data(10) */
153 {OFFSET(lcd_data11), (MODE(0) | PULLUDDIS)}, /* LCD-Data(11) */
154 {OFFSET(lcd_data12), (MODE(0) | PULLUDDIS)}, /* LCD-Data(12) */
155 {OFFSET(lcd_data13), (MODE(0) | PULLUDDIS)}, /* LCD-Data(13) */
156 {OFFSET(lcd_data14), (MODE(0) | PULLUDDIS)}, /* LCD-Data(14) */
157 {OFFSET(lcd_data15), (MODE(0) | PULLUDDIS)}, /* LCD-Data(15) */
158
159 {OFFSET(gpmc_ad8), (MODE(1) | PULLUDDIS)}, /* LCD-Data(16) */
160 {OFFSET(gpmc_ad9), (MODE(1) | PULLUDDIS)}, /* LCD-Data(17) */
161 {OFFSET(gpmc_ad10), (MODE(1) | PULLUDDIS)}, /* LCD-Data(18) */
162 {OFFSET(gpmc_ad11), (MODE(1) | PULLUDDIS)}, /* LCD-Data(19) */
163 {OFFSET(gpmc_ad12), (MODE(1) | PULLUDDIS)}, /* LCD-Data(20) */
164 {OFFSET(gpmc_ad13), (MODE(1) | PULLUDDIS)}, /* LCD-Data(21) */
165 {OFFSET(gpmc_ad14), (MODE(1) | PULLUDDIS)}, /* LCD-Data(22) */
166 {OFFSET(gpmc_ad15), (MODE(1) | PULLUDDIS)}, /* LCD-Data(23) */
167
168 {OFFSET(lcd_vsync), (MODE(0) | PULLUDDIS)}, /* LCD-VSync */
169 {OFFSET(lcd_hsync), (MODE(0) | PULLUDDIS)}, /* LCD-HSync */
170 {OFFSET(lcd_ac_bias_en), (MODE(0) | PULLUDDIS)},/* LCD-DE */
171 {OFFSET(lcd_pclk), (MODE(0) | PULLUDDIS)}, /* LCD-CLK */
172
173 {-1},
174};
175
176void enable_uart0_pin_mux(void)
177{
178 configure_module_pin_mux(uart0_pin_mux);
179}
180
Hannes Petermaier2e68d2b2015-03-19 10:43:15 +0100181void enable_i2c_pin_mux(void)
Hannes Petermaier94360592014-02-07 14:06:50 +0100182{
183 configure_module_pin_mux(i2c0_pin_mux);
184}
185
186void enable_board_pin_mux(void)
187{
188 configure_module_pin_mux(i2c0_pin_mux);
189 configure_module_pin_mux(mii1_pin_mux);
Hannes Petermaierc96a9b12015-02-03 13:22:39 +0100190 configure_module_pin_mux(spi0_pin_mux);
Hannes Petermaier94360592014-02-07 14:06:50 +0100191 configure_module_pin_mux(dcan0_pin_mux);
192 configure_module_pin_mux(dcan1_pin_mux);
193 configure_module_pin_mux(mmc1_pin_mux);
194 configure_module_pin_mux(lcd_pin_mux);
195 configure_module_pin_mux(gpios);
196}