xref: /openbmc/u-boot/board/ti/ti814x/mux.c (revision 730d2544)
1 /*
2  * mux.c
3  *
4  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation version 2.
9  *
10  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11  * kind, whether express or implied; without even the implied warranty
12  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  */
15 
16 #include <common.h>
17 #include <asm/arch/sys_proto.h>
18 #include <asm/arch/hardware.h>
19 #include <asm/arch/mux.h>
20 #include <asm/io.h>
21 #include <i2c.h>
22 #include "evm.h"
23 
24 static struct module_pin_mux uart0_pin_mux[] = {
25 	{OFFSET(pincntl70), PULLUP_EN | MODE(0x01)},	/* UART0_RXD */
26 	{OFFSET(pincntl71), PULLUP_EN | MODE(0x01)},	/* UART0_TXD */
27 	{-1},
28 };
29 
30 static struct module_pin_mux mmc1_pin_mux[] = {
31 	{OFFSET(pincntl1), PULLUP_EN | MODE(0x01)},	/* SD1_CLK */
32 	{OFFSET(pincntl2), PULLUP_EN | MODE(0x01)},	/* SD1_CMD */
33 	{OFFSET(pincntl3), PULLUP_EN | MODE(0x01)},	/* SD1_DAT[0] */
34 	{OFFSET(pincntl4), PULLUP_EN | MODE(0x01)},	/* SD1_DAT[1] */
35 	{OFFSET(pincntl5), PULLUP_EN | MODE(0x01)},	/* SD1_DAT[2] */
36 	{OFFSET(pincntl6), PULLUP_EN | MODE(0x01)},	/* SD1_DAT[3] */
37 	{OFFSET(pincntl74), PULLUP_EN | MODE(0x40)},	/* SD1_POW */
38 	{OFFSET(pincntl75), MODE(0x40)},		/* SD1_SDWP */
39 	{OFFSET(pincntl80), PULLUP_EN | MODE(0x02)},	/* SD1_SDCD */
40 	{-1},
41 };
42 
43 static struct module_pin_mux enet_pin_mux[] = {
44 	{OFFSET(pincntl232), MODE(0x01)},		/* EMAC_RMREFCLK */
45 	{OFFSET(pincntl233), PULLUP_EN | MODE(0x01)},	/* MDCLK */
46 	{OFFSET(pincntl234), PULLUP_EN | MODE(0x01)},	/* MDIO */
47 	{OFFSET(pincntl235), MODE(0x01)},		/* EMAC[0]_MTCLK */
48 	{OFFSET(pincntl236), MODE(0x01)},		/* EMAC[0]_MCOL */
49 	{OFFSET(pincntl237), MODE(0x01)},		/* EMAC[0]_MCRS */
50 	{OFFSET(pincntl238), MODE(0x01)},		/* EMAC[0]_MRXER */
51 	{OFFSET(pincntl239), MODE(0x01)},		/* EMAC[0]_MRCLK */
52 	{OFFSET(pincntl240), MODE(0x01)},		/* EMAC[0]_MRXD[0] */
53 	{OFFSET(pincntl241), MODE(0x01)},		/* EMAC[0]_MRXD[1] */
54 	{OFFSET(pincntl242), MODE(0x01)},		/* EMAC[0]_MRXD[2] */
55 	{OFFSET(pincntl243), MODE(0x01)},		/* EMAC[0]_MRXD[3] */
56 	{OFFSET(pincntl244), MODE(0x01)},		/* EMAC[0]_MRXD[4] */
57 	{OFFSET(pincntl245), MODE(0x01)},		/* EMAC[0]_MRXD[5] */
58 	{OFFSET(pincntl246), MODE(0x01)},		/* EMAC[0]_MRXD[6] */
59 	{OFFSET(pincntl247), MODE(0x01)},		/* EMAC[0]_MRXD[7] */
60 	{OFFSET(pincntl248), MODE(0x01)},		/* EMAC[0]_MRXDV */
61 	{OFFSET(pincntl249), MODE(0x01)},		/* EMAC[0]_GMTCLK */
62 	{OFFSET(pincntl250), MODE(0x01)},		/* EMAC[0]_MTXD[0] */
63 	{OFFSET(pincntl251), MODE(0x01)},		/* EMAC[0]_MTXD[1] */
64 	{OFFSET(pincntl252), MODE(0x01)},		/* EMAC[0]_MTXD[2] */
65 	{OFFSET(pincntl253), MODE(0x01)},		/* EMAC[0]_MTXD[3] */
66 	{OFFSET(pincntl254), MODE(0x01)},		/* EMAC[0]_MTXD[4] */
67 	{OFFSET(pincntl255), MODE(0x01)},		/* EMAC[0]_MTXD[5] */
68 	{OFFSET(pincntl256), MODE(0x01)},		/* EMAC[0]_MTXD[6] */
69 	{OFFSET(pincntl257), MODE(0x01)},		/* EMAC[0]_MTXD[7] */
70 	{OFFSET(pincntl258), MODE(0x01)},		/* EMAC[0]_MTXEN */
71 };
72 
73 void enable_uart0_pin_mux(void)
74 {
75 	configure_module_pin_mux(uart0_pin_mux);
76 }
77 
78 void enable_mmc1_pin_mux(void)
79 {
80 	configure_module_pin_mux(mmc1_pin_mux);
81 }
82 
83 void enable_enet_pin_mux(void)
84 {
85 	configure_module_pin_mux(enet_pin_mux);
86 }
87