blob: 6d89c4a3998dea322ec0600df699fccd7916ba76 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Enric Balletbò i Serra9d89b082015-09-07 07:43:20 +02002/*
3 * mux.c
4 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -05005 * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/
Enric Balletbò i Serra9d89b082015-09-07 07:43:20 +02006 */
7
Enric Balletbò i Serra9d89b082015-09-07 07:43:20 +02008#include <asm/arch/sys_proto.h>
9#include <asm/arch/hardware.h>
10#include <asm/arch/mux.h>
11#include <asm/io.h>
12#include <i2c.h>
13#include "board.h"
14
15static struct module_pin_mux uart0_pin_mux[] = {
16 {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */
17 {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, /* UART0_TXD */
18 {-1},
19};
20
21static struct module_pin_mux uart1_pin_mux[] = {
22 {OFFSET(uart1_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART1_RXD */
23 {OFFSET(uart1_txd), (MODE(0) | PULLUDEN)}, /* UART1_TXD */
24 {-1},
25};
26
27static struct module_pin_mux uart2_pin_mux[] = {
28 {OFFSET(spi0_sclk), (MODE(1) | PULLUP_EN | RXACTIVE)}, /* UART2_RXD */
29 {OFFSET(spi0_d0), (MODE(1) | PULLUDEN)}, /* UART2_TXD */
30 {-1},
31};
32
33static struct module_pin_mux uart3_pin_mux[] = {
34 {OFFSET(spi0_cs1), (MODE(1) | PULLUP_EN | RXACTIVE)}, /* UART3_RXD */
35 {OFFSET(ecap0_in_pwm0_out), (MODE(1) | PULLUDEN)}, /* UART3_TXD */
36 {-1},
37};
38
39static struct module_pin_mux uart4_pin_mux[] = {
40 {OFFSET(gpmc_wait0), (MODE(6) | PULLUP_EN | RXACTIVE)}, /* UART4_RXD */
41 {OFFSET(gpmc_wpn), (MODE(6) | PULLUDEN)}, /* UART4_TXD */
42 {-1},
43};
44
45static struct module_pin_mux uart5_pin_mux[] = {
46 {OFFSET(lcd_data9), (MODE(4) | PULLUP_EN | RXACTIVE)}, /* UART5_RXD */
47 {OFFSET(lcd_data8), (MODE(4) | PULLUDEN)}, /* UART5_TXD */
48 {-1},
49};
50
51static struct module_pin_mux mmc0_pin_mux[] = {
52 {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */
53 {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */
54 {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */
55 {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */
56 {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */
57 {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */
58 {OFFSET(mcasp0_aclkr), (MODE(4) | RXACTIVE)}, /* MMC0_WP */
59 {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)}, /* MMC0_CD */
60 {-1},
61};
62
63static struct module_pin_mux mmc1_pin_mux[] = {
64 {OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT3 */
65 {OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT2 */
66 {OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT1 */
67 {OFFSET(gpmc_ad0), (MODE(1) | RXACTIVE | PULLUP_EN)}, /* MMC1_DAT0 */
68 {OFFSET(gpmc_csn1), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CLK */
69 {OFFSET(gpmc_csn2), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* MMC1_CMD */
70 {OFFSET(gpmc_csn0), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC1_WP */
71 {OFFSET(gpmc_advn_ale), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* MMC1_CD */
72 {-1},
73};
74
75static struct module_pin_mux i2c0_pin_mux[] = {
76 {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE |
77 PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
78 {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE |
79 PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
80 {-1},
81};
82
83static struct module_pin_mux i2c1_pin_mux[] = {
84 {OFFSET(spi0_d1), (MODE(2) | RXACTIVE |
85 PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
86 {OFFSET(spi0_cs0), (MODE(2) | RXACTIVE |
87 PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
88 {-1},
89};
90
91static struct module_pin_mux mii1_pin_mux[] = {
92 {OFFSET(mii1_rxerr), MODE(0) | RXACTIVE}, /* MII1_RXERR */
93 {OFFSET(mii1_txen), MODE(0)}, /* MII1_TXEN */
94 {OFFSET(mii1_rxdv), MODE(0) | RXACTIVE}, /* MII1_RXDV */
95 {OFFSET(mii1_txd3), MODE(0)}, /* MII1_TXD3 */
96 {OFFSET(mii1_txd2), MODE(0)}, /* MII1_TXD2 */
97 {OFFSET(mii1_txd1), MODE(0)}, /* MII1_TXD1 */
98 {OFFSET(mii1_txd0), MODE(0)}, /* MII1_TXD0 */
99 {OFFSET(mii1_txclk), MODE(0) | RXACTIVE}, /* MII1_TXCLK */
100 {OFFSET(mii1_rxclk), MODE(0) | RXACTIVE}, /* MII1_RXCLK */
101 {OFFSET(mii1_rxd3), MODE(0) | RXACTIVE}, /* MII1_RXD3 */
102 {OFFSET(mii1_rxd2), MODE(0) | RXACTIVE}, /* MII1_RXD2 */
103 {OFFSET(mii1_rxd1), MODE(0) | RXACTIVE}, /* MII1_RXD1 */
104 {OFFSET(mii1_rxd0), MODE(0) | RXACTIVE}, /* MII1_RXD0 */
105 {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
106 {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
107 {-1},
108};
109
110
111void enable_uart0_pin_mux(void)
112{
113 configure_module_pin_mux(uart0_pin_mux);
114}
115
116void enable_uart1_pin_mux(void)
117{
118 configure_module_pin_mux(uart1_pin_mux);
119}
120
121void enable_uart2_pin_mux(void)
122{
123 configure_module_pin_mux(uart2_pin_mux);
124}
125
126void enable_uart3_pin_mux(void)
127{
128 configure_module_pin_mux(uart3_pin_mux);
129}
130
131void enable_uart4_pin_mux(void)
132{
133 configure_module_pin_mux(uart4_pin_mux);
134}
135
136void enable_uart5_pin_mux(void)
137{
138 configure_module_pin_mux(uart5_pin_mux);
139}
140
141void enable_i2c0_pin_mux(void)
142{
143 configure_module_pin_mux(i2c0_pin_mux);
144}
145
146void enable_board_pin_mux(void)
147{
148 configure_module_pin_mux(i2c1_pin_mux);
149 configure_module_pin_mux(mii1_pin_mux);
150 configure_module_pin_mux(mmc0_pin_mux);
151 configure_module_pin_mux(mmc1_pin_mux);
152}