xref: /rk3399_rockchip-uboot/board/compulab/trimslice/trimslice.c (revision 2db7b952844f95c8299bb84bc3b2d38e8f48f5cd)
139e37118SStephen Warren /*
239e37118SStephen Warren  *  (C) Copyright 2010-2012
339e37118SStephen Warren  *  NVIDIA Corporation <www.nvidia.com>
439e37118SStephen Warren  *
539e37118SStephen Warren  * See file CREDITS for list of people who contributed to this
639e37118SStephen Warren  * project.
739e37118SStephen Warren  *
839e37118SStephen Warren  * This program is free software; you can redistribute it and/or
939e37118SStephen Warren  * modify it under the terms of the GNU General Public License as
1039e37118SStephen Warren  * published by the Free Software Foundation; either version 2 of
1139e37118SStephen Warren  * the License, or (at your option) any later version.
1239e37118SStephen Warren  *
1339e37118SStephen Warren  * This program is distributed in the hope that it will be useful,
1439e37118SStephen Warren  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1539e37118SStephen Warren  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1639e37118SStephen Warren  * GNU General Public License for more details.
1739e37118SStephen Warren  *
1839e37118SStephen Warren  * You should have received a copy of the GNU General Public License
1939e37118SStephen Warren  * along with this program; if not, write to the Free Software
2039e37118SStephen Warren  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2139e37118SStephen Warren  * MA 02111-1307 USA
2239e37118SStephen Warren  */
2339e37118SStephen Warren 
2439e37118SStephen Warren #include <common.h>
2539e37118SStephen Warren #include <i2c.h>
2639e37118SStephen Warren #include <asm/io.h>
2739e37118SStephen Warren #include <asm/arch/tegra2.h>
2839e37118SStephen Warren #include <asm/arch/clock.h>
2939e37118SStephen Warren #include <asm/arch/funcmux.h>
3039e37118SStephen Warren #include <asm/arch/pinmux.h>
3139e37118SStephen Warren #include <asm/arch/mmc.h>
3239e37118SStephen Warren #include <asm/gpio.h>
331e2d7859STom Warren #ifdef CONFIG_TEGRA_MMC
3439e37118SStephen Warren #include <mmc.h>
3539e37118SStephen Warren #endif
3639e37118SStephen Warren 
3739e37118SStephen Warren /*
3839e37118SStephen Warren  * Routine: gpio_config_uart
3939e37118SStephen Warren  * Description: Does nothing on TrimSlice - no UART-related GPIOs.
4039e37118SStephen Warren  */
4139e37118SStephen Warren void gpio_config_uart(void)
4239e37118SStephen Warren {
4339e37118SStephen Warren }
4439e37118SStephen Warren 
45*2db7b952SStephen Warren void pin_mux_spi(void)
46*2db7b952SStephen Warren {
47*2db7b952SStephen Warren 	funcmux_select(PERIPH_ID_SPI1, FUNCMUX_SPI1_GMC_GMD);
48*2db7b952SStephen Warren }
49*2db7b952SStephen Warren 
5039e37118SStephen Warren /*
5139e37118SStephen Warren  * Routine: pin_mux_mmc
5239e37118SStephen Warren  * Description: setup the pin muxes/tristate values for the SDMMC(s)
5339e37118SStephen Warren  */
5439e37118SStephen Warren static void pin_mux_mmc(void)
5539e37118SStephen Warren {
5639e37118SStephen Warren 	funcmux_select(PERIPH_ID_SDMMC1, FUNCMUX_SDMMC1_SDIO1_4BIT);
5739e37118SStephen Warren 	funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT);
5839e37118SStephen Warren 
5939e37118SStephen Warren 	/* For CD GPIO PP1 */
6039e37118SStephen Warren 	pinmux_tristate_disable(PINGRP_DAP3);
6139e37118SStephen Warren }
6239e37118SStephen Warren 
6339e37118SStephen Warren /* this is a weak define that we are overriding */
6439e37118SStephen Warren int board_mmc_init(bd_t *bd)
6539e37118SStephen Warren {
6639e37118SStephen Warren 	debug("board_mmc_init called\n");
6739e37118SStephen Warren 
6839e37118SStephen Warren 	/* Enable muxes, etc. for SDMMC controllers */
6939e37118SStephen Warren 	pin_mux_mmc();
7039e37118SStephen Warren 
7139e37118SStephen Warren 	/* init dev 0 (SDMMC4), (micro-SD slot) with 4-bit bus */
7239e37118SStephen Warren 	tegra2_mmc_init(0, 4, -1, GPIO_PP1);
7339e37118SStephen Warren 
7439e37118SStephen Warren 	/* init dev 3 (SDMMC1), (SD slot) with 4-bit bus */
7539e37118SStephen Warren 	tegra2_mmc_init(3, 4, -1, -1);
7639e37118SStephen Warren 
7739e37118SStephen Warren 	return 0;
7839e37118SStephen Warren }
79