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 <asm/io.h> 26150c2493STom Warren #include <asm/arch/tegra.h> 2739e37118SStephen Warren #include <asm/arch/clock.h> 2839e37118SStephen Warren #include <asm/arch/funcmux.h> 2939e37118SStephen Warren #include <asm/arch/pinmux.h> 30150c2493STom Warren #include <asm/arch-tegra/mmc.h> 3139e37118SStephen Warren #include <asm/gpio.h> 32150c2493STom Warren #include <i2c.h> 331e2d7859STom Warren #ifdef CONFIG_TEGRA_MMC 3439e37118SStephen Warren #include <mmc.h> 3539e37118SStephen Warren #endif 3639e37118SStephen Warren 37*7155dc97SStephen Warren void pin_mux_usb(void) 38*7155dc97SStephen Warren { 39*7155dc97SStephen Warren /* 40*7155dc97SStephen Warren * USB1 internal/external mux GPIO, which masquerades as a VBUS GPIO 41*7155dc97SStephen Warren * in the current device tree. 42*7155dc97SStephen Warren */ 43*7155dc97SStephen Warren pinmux_tristate_disable(PINGRP_UAC); 44*7155dc97SStephen Warren } 4539e37118SStephen Warren 462db7b952SStephen Warren void pin_mux_spi(void) 472db7b952SStephen Warren { 482db7b952SStephen Warren funcmux_select(PERIPH_ID_SPI1, FUNCMUX_SPI1_GMC_GMD); 492db7b952SStephen Warren } 502db7b952SStephen Warren 5139e37118SStephen Warren /* 5239e37118SStephen Warren * Routine: pin_mux_mmc 5339e37118SStephen Warren * Description: setup the pin muxes/tristate values for the SDMMC(s) 5439e37118SStephen Warren */ 5539e37118SStephen Warren static void pin_mux_mmc(void) 5639e37118SStephen Warren { 5739e37118SStephen Warren funcmux_select(PERIPH_ID_SDMMC1, FUNCMUX_SDMMC1_SDIO1_4BIT); 5839e37118SStephen Warren funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); 5939e37118SStephen Warren 6039e37118SStephen Warren /* For CD GPIO PP1 */ 6139e37118SStephen Warren pinmux_tristate_disable(PINGRP_DAP3); 6239e37118SStephen Warren } 6339e37118SStephen Warren 6439e37118SStephen Warren /* this is a weak define that we are overriding */ 6539e37118SStephen Warren int board_mmc_init(bd_t *bd) 6639e37118SStephen Warren { 6739e37118SStephen Warren debug("board_mmc_init called\n"); 6839e37118SStephen Warren 6939e37118SStephen Warren /* Enable muxes, etc. for SDMMC controllers */ 7039e37118SStephen Warren pin_mux_mmc(); 7139e37118SStephen Warren 7239e37118SStephen Warren /* init dev 0 (SDMMC4), (micro-SD slot) with 4-bit bus */ 7329f3e3f2STom Warren tegra_mmc_init(0, 4, -1, GPIO_PP1); 7439e37118SStephen Warren 7539e37118SStephen Warren /* init dev 3 (SDMMC1), (SD slot) with 4-bit bus */ 7629f3e3f2STom Warren tegra_mmc_init(3, 4, -1, -1); 7739e37118SStephen Warren 7839e37118SStephen Warren return 0; 7939e37118SStephen Warren } 80