blob: 1a40c0077627560daa5a4fb97df2c0be4be0712c [file] [log] [blame]
Enric Balletbo i Serra9b96f462013-04-04 22:27:58 +00001/*
2 * Copyright (C) 2013, ISEE 2007 SL - http://www.isee.biz/
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
Enric Balletbo i Serra9b96f462013-04-04 22:27:58 +000014#include <asm/arch/sys_proto.h>
15#include <asm/arch/hardware.h>
16#include <asm/arch/mux.h>
17#include <asm/io.h>
18#include <i2c.h>
19#include "board.h"
20
21static struct module_pin_mux uart0_pin_mux[] = {
22 {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */
23 {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, /* UART0_TXD */
24 {-1},
25};
26
27static struct module_pin_mux mmc0_pin_mux[] = {
28 {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */
29 {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */
30 {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */
31 {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */
32 {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */
33 {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */
Pau Pajuelob2310f12017-04-01 17:18:40 +020034 {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)}, /* MMC0_CD */
Enric Balletbo i Serra9b96f462013-04-04 22:27:58 +000035 {-1},
36};
37
38static struct module_pin_mux nand_pin_mux[] = {
39 {OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD0 */
40 {OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD1 */
41 {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD2 */
42 {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD3 */
43 {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD4 */
44 {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */
45 {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */
46 {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */
47 {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */
48 {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */
49 {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */
50 {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */
51 {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)}, /* NAND_OE */
52 {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)}, /* NAND_WEN */
53 {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)}, /* NAND_BE_CLE */
54 {-1},
55};
56
57static struct module_pin_mux rmii1_pin_mux[] = {
58 {OFFSET(mii1_txen), MODE(1)}, /* RMII1_TXEN */
59 {OFFSET(mii1_rxerr), MODE(1) | RXACTIVE}, /* RMII1_RXERR */
60 {OFFSET(mii1_crs), MODE(1) | RXACTIVE}, /* RMII1_CRS_DV */
61 {OFFSET(mii1_rxd0), MODE(1) | RXACTIVE}, /* RMII1_RXD0 */
62 {OFFSET(mii1_rxd1), MODE(1) | RXACTIVE}, /* RMII1_RXD1 */
63 {OFFSET(mii1_txd0), MODE(1)}, /* RMII1_TXD0 */
64 {OFFSET(mii1_txd1), MODE(1)}, /* RMII1_TXD1 */
65 {OFFSET(rmii1_refclk), MODE(0) | RXACTIVE}, /* RMII1_REF_CLK */
66 {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
67 {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
68 {-1},
69};
70
Pau Pajuelob2310f12017-04-01 17:18:40 +020071static struct module_pin_mux gpio_pin_mux[] = {
72 {OFFSET(gpmc_ad10), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* GPIO0_26 */
73 {OFFSET(gpmc_ad11), (MODE(7) | RXACTIVE | PULLUP_EN)}, /* GPIO0_27 */
74 {-1},
75};
76
Enric Balletbo i Serra9b96f462013-04-04 22:27:58 +000077void enable_uart0_pin_mux(void)
78{
79 configure_module_pin_mux(uart0_pin_mux);
80}
81
82/*
83 * Do board-specific muxes.
84 */
85void enable_board_pin_mux(void)
86{
87 /* NAND Flash */
88 configure_module_pin_mux(nand_pin_mux);
89 /* SD Card */
90 configure_module_pin_mux(mmc0_pin_mux);
91 /* Ethernet pinmux. */
92 configure_module_pin_mux(rmii1_pin_mux);
Pau Pajuelob2310f12017-04-01 17:18:40 +020093 /* GPIO pinmux. */
94 configure_module_pin_mux(gpio_pin_mux);
Enric Balletbo i Serra9b96f462013-04-04 22:27:58 +000095}