xref: /rk3399_rockchip-uboot/board/avionic-design/common/tamonten.c (revision 1e2d7859758499a25fa392deb5cfda95372d97ae)
1b1c0c736SThierry Reding /*
2b1c0c736SThierry Reding  *  (C) Copyright 2010,2011
3b1c0c736SThierry Reding  *  NVIDIA Corporation <www.nvidia.com>
4ed900c55SThierry Reding  *  (C) Copyright 2011-2012
5b1c0c736SThierry Reding  *  Avionic Design GmbH <www.avionic-design.de>
6b1c0c736SThierry Reding  *
7b1c0c736SThierry Reding  * See file CREDITS for list of people who contributed to this
8b1c0c736SThierry Reding  * project.
9b1c0c736SThierry Reding  *
10b1c0c736SThierry Reding  * This program is free software; you can redistribute it and/or
11b1c0c736SThierry Reding  * modify it under the terms of the GNU General Public License as
12b1c0c736SThierry Reding  * published by the Free Software Foundation; either version 2 of
13b1c0c736SThierry Reding  * the License, or (at your option) any later version.
14b1c0c736SThierry Reding  *
15b1c0c736SThierry Reding  * This program is distributed in the hope that it will be useful,
16b1c0c736SThierry Reding  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17b1c0c736SThierry Reding  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18b1c0c736SThierry Reding  * GNU General Public License for more details.
19b1c0c736SThierry Reding  *
20b1c0c736SThierry Reding  * You should have received a copy of the GNU General Public License
21b1c0c736SThierry Reding  * along with this program; if not, write to the Free Software
22b1c0c736SThierry Reding  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23b1c0c736SThierry Reding  * MA 02111-1307 USA
24b1c0c736SThierry Reding  */
25b1c0c736SThierry Reding 
26b1c0c736SThierry Reding #include <common.h>
27b1c0c736SThierry Reding #include <ns16550.h>
28b1c0c736SThierry Reding #include <asm/io.h>
29b1c0c736SThierry Reding #include <asm/gpio.h>
30f46a9456SSimon Glass #include <asm/arch/board.h>
31b1c0c736SThierry Reding #include <asm/arch/tegra2.h>
32b1c0c736SThierry Reding #include <asm/arch/sys_proto.h>
33b1c0c736SThierry Reding #include <asm/arch/clk_rst.h>
34b1c0c736SThierry Reding #include <asm/arch/clock.h>
35f4483021SSimon Glass #include <asm/arch/funcmux.h>
36b1c0c736SThierry Reding #include <asm/arch/pinmux.h>
37b1c0c736SThierry Reding #include <asm/arch/uart.h>
38b1c0c736SThierry Reding #include <asm/arch/mmc.h>
39b1c0c736SThierry Reding 
40*1e2d7859STom Warren #ifdef CONFIG_TEGRA_MMC
41b1c0c736SThierry Reding #include <mmc.h>
42b1c0c736SThierry Reding #endif
43b1c0c736SThierry Reding 
44b1c0c736SThierry Reding /*
45ed900c55SThierry Reding  * Routine: gpio_config_uart
46ed900c55SThierry Reding  * Description: Does nothing on Tamonten - no conflict w/SPI.
47b1c0c736SThierry Reding  */
48ed900c55SThierry Reding void gpio_config_uart(void)
49b1c0c736SThierry Reding {
50b1c0c736SThierry Reding }
51b1c0c736SThierry Reding 
5222d58506SThierry Reding #ifdef CONFIG_BOARD_EARLY_INIT_F
5322d58506SThierry Reding void gpio_early_init(void)
5422d58506SThierry Reding {
5522d58506SThierry Reding 	gpio_request(GPIO_PI4, NULL);
5622d58506SThierry Reding 	gpio_direction_output(GPIO_PI4, 1);
5722d58506SThierry Reding }
5822d58506SThierry Reding #endif
5922d58506SThierry Reding 
60*1e2d7859STom Warren #ifdef CONFIG_TEGRA_MMC
61b1c0c736SThierry Reding /*
62b1c0c736SThierry Reding  * Routine: pin_mux_mmc
63b1c0c736SThierry Reding  * Description: setup the pin muxes/tristate values for the SDMMC(s)
64b1c0c736SThierry Reding  */
65b1c0c736SThierry Reding static void pin_mux_mmc(void)
66b1c0c736SThierry Reding {
67f4483021SSimon Glass 	funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT);
6879254543SThierry Reding 	/* for write-protect GPIO PI6 */
6979254543SThierry Reding 	pinmux_tristate_disable(PINGRP_ATA);
70ed900c55SThierry Reding 	/* for CD GPIO PH2 */
71ed900c55SThierry Reding 	pinmux_tristate_disable(PINGRP_ATD);
72b1c0c736SThierry Reding }
73b1c0c736SThierry Reding 
74b1c0c736SThierry Reding /* this is a weak define that we are overriding */
75b1c0c736SThierry Reding int board_mmc_init(bd_t *bd)
76b1c0c736SThierry Reding {
77b1c0c736SThierry Reding 	/* Enable muxes, etc. for SDMMC controllers */
78b1c0c736SThierry Reding 	pin_mux_mmc();
79b1c0c736SThierry Reding 
80ed900c55SThierry Reding 	/* init dev 0, SD slot, with 4-bit bus */
8179254543SThierry Reding 	tegra2_mmc_init(0, 4, GPIO_PI6, GPIO_PH2);
82b1c0c736SThierry Reding 
83b1c0c736SThierry Reding 	return 0;
84b1c0c736SThierry Reding }
85b1c0c736SThierry Reding #endif
86