Heiko Schocher | 499c498 | 2013-08-19 16:39:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * pinmux setup for siemens dxr2 board |
| 3 | * |
| 4 | * (C) Copyright 2013 Siemens Schweiz AG |
| 5 | * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 6 | * |
| 7 | * Based on: |
| 8 | * u-boot:/board/ti/am335x/mux.c |
| 9 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
| 10 | * |
| 11 | * SPDX-License-Identifier: GPL-2.0+ |
| 12 | */ |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <asm/arch/sys_proto.h> |
| 16 | #include <asm/arch/hardware.h> |
| 17 | #include <asm/arch/mux.h> |
| 18 | #include <asm/io.h> |
| 19 | #include <i2c.h> |
| 20 | #include "board.h" |
| 21 | |
| 22 | static struct module_pin_mux uart0_pin_mux[] = { |
| 23 | {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */ |
| 24 | {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, /* UART0_TXD */ |
| 25 | {-1}, |
| 26 | }; |
| 27 | |
| 28 | static struct module_pin_mux uart3_pin_mux[] = { |
| 29 | {OFFSET(spi0_cs1), (MODE(1) | PULLUP_EN | RXACTIVE)}, /* UART3_RXD */ |
| 30 | {OFFSET(ecap0_in_pwm0_out), (MODE(1) | PULLUDEN)}, /* UART3_TXD */ |
| 31 | {-1}, |
| 32 | }; |
| 33 | |
| 34 | static struct module_pin_mux i2c0_pin_mux[] = { |
| 35 | {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | |
| 36 | PULLUDEN | SLEWCTRL)}, /* I2C_DATA */ |
| 37 | {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | |
| 38 | PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */ |
| 39 | {-1}, |
| 40 | }; |
| 41 | |
| 42 | static struct module_pin_mux nand_pin_mux[] = { |
| 43 | {OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD0 */ |
| 44 | {OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD1 */ |
| 45 | {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD2 */ |
| 46 | {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD3 */ |
| 47 | {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD4 */ |
| 48 | {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */ |
| 49 | {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */ |
| 50 | {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */ |
| 51 | {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */ |
| 52 | {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */ |
| 53 | {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */ |
| 54 | {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */ |
| 55 | {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)}, /* NAND_OE */ |
| 56 | {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)}, /* NAND_WEN */ |
| 57 | {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)}, /* NAND_BE_CLE */ |
| 58 | {-1}, |
| 59 | }; |
| 60 | |
| 61 | static struct module_pin_mux gpios_pin_mux[] = { |
| 62 | /* DFU button GPIO0_27*/ |
| 63 | {OFFSET(gpmc_ad11), (MODE(7) | PULLUDEN | RXACTIVE)}, |
| 64 | {OFFSET(gpmc_csn3), MODE(7) }, /* LED0 GPIO2_0 */ |
| 65 | {OFFSET(emu0), MODE(7)}, /* LED1 GPIO3_7 */ |
| 66 | {-1}, |
| 67 | }; |
| 68 | |
| 69 | static struct module_pin_mux ethernet_pin_mux[] = { |
| 70 | {OFFSET(mii1_col), (MODE(3) | RXACTIVE)}, |
| 71 | {OFFSET(mii1_crs), (MODE(1) | RXACTIVE)}, |
| 72 | {OFFSET(mii1_rxerr), (MODE(1) | RXACTIVE)}, |
| 73 | {OFFSET(mii1_txen), (MODE(1))}, |
| 74 | {OFFSET(mii1_rxdv), (MODE(3) | RXACTIVE)}, |
| 75 | {OFFSET(mii1_txd3), (MODE(7) | RXACTIVE)}, |
| 76 | {OFFSET(mii1_txd2), (MODE(7) | RXACTIVE)}, |
| 77 | {OFFSET(mii1_txd1), (MODE(1))}, |
| 78 | {OFFSET(mii1_txd0), (MODE(1))}, |
| 79 | {OFFSET(mii1_txclk), (MODE(1) | RXACTIVE)}, |
| 80 | {OFFSET(mii1_rxclk), (MODE(1) | RXACTIVE)}, |
| 81 | {OFFSET(mii1_rxd3), (MODE(1) | RXACTIVE)}, |
| 82 | {OFFSET(mii1_rxd2), (MODE(1))}, |
| 83 | {OFFSET(mii1_rxd1), (MODE(1) | RXACTIVE)}, |
| 84 | {OFFSET(mii1_rxd0), (MODE(1) | RXACTIVE)}, |
| 85 | {OFFSET(rmii1_refclk), (MODE(0) | RXACTIVE)}, |
| 86 | {OFFSET(mdio_data), (MODE(0) | RXACTIVE | PULLUP_EN)}, |
| 87 | {OFFSET(mdio_clk), (MODE(0) | PULLUP_EN)}, |
| 88 | {-1}, |
| 89 | }; |
| 90 | |
| 91 | void enable_uart0_pin_mux(void) |
| 92 | { |
| 93 | configure_module_pin_mux(uart0_pin_mux); |
| 94 | } |
| 95 | |
| 96 | void enable_uart3_pin_mux(void) |
| 97 | { |
| 98 | configure_module_pin_mux(uart3_pin_mux); |
| 99 | } |
| 100 | |
| 101 | void enable_i2c0_pin_mux(void) |
| 102 | { |
| 103 | configure_module_pin_mux(i2c0_pin_mux); |
| 104 | } |
| 105 | |
| 106 | void enable_board_pin_mux(void) |
| 107 | { |
| 108 | enable_uart3_pin_mux(); |
| 109 | configure_module_pin_mux(nand_pin_mux); |
| 110 | configure_module_pin_mux(ethernet_pin_mux); |
| 111 | configure_module_pin_mux(gpios_pin_mux); |
| 112 | } |