1f4ef6668STom Warren /* 2f4ef6668STom Warren * (C) Copyright 2010,2011 3f4ef6668STom Warren * NVIDIA Corporation <www.nvidia.com> 4f4ef6668STom Warren * 5f4ef6668STom Warren * See file CREDITS for list of people who contributed to this 6f4ef6668STom Warren * project. 7f4ef6668STom Warren * 8f4ef6668STom Warren * This program is free software; you can redistribute it and/or 9f4ef6668STom Warren * modify it under the terms of the GNU General Public License as 10f4ef6668STom Warren * published by the Free Software Foundation; either version 2 of 11f4ef6668STom Warren * the License, or (at your option) any later version. 12f4ef6668STom Warren * 13f4ef6668STom Warren * This program is distributed in the hope that it will be useful, 14f4ef6668STom Warren * but WITHOUT ANY WARRANTY; without even the implied warranty of 15f4ef6668STom Warren * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16f4ef6668STom Warren * GNU General Public License for more details. 17f4ef6668STom Warren * 18f4ef6668STom Warren * You should have received a copy of the GNU General Public License 19f4ef6668STom Warren * along with this program; if not, write to the Free Software 20f4ef6668STom Warren * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21f4ef6668STom Warren * MA 02111-1307 USA 22f4ef6668STom Warren */ 23f4ef6668STom Warren 24f4ef6668STom Warren #include <common.h> 25f4ef6668STom Warren #include <asm/io.h> 26150c2493STom Warren #include <asm/arch/tegra.h> 27ca28090dSSimon Glass #include <asm/arch/clock.h> 28ca28090dSSimon Glass #include <asm/arch/funcmux.h> 29a2ab6b7dSStephen Warren #include <asm/arch/gpio.h> 30ae03661fSStephen Warren #include <asm/arch/pinmux.h> 31ccf7988bSTom Warren #include <asm/gpio.h> 32f4ef6668STom Warren 33a04eba99SSimon Glass /* TODO: Remove this code when the SPI switch is working */ 34da1f7352SStephen Warren #if !defined(CONFIG_SPI_UART_SWITCH) && (CONFIG_MACH_TYPE != MACH_TYPE_VENTANA) 350cd10c7aSLucas Stach void gpio_early_init_uart(void) 36d5ef19b9SStephen Warren { 37a2ab6b7dSStephen Warren /* Enable UART via GPIO_PI3 (port 8, bit 3) so serial console works */ 38a2ab6b7dSStephen Warren #ifndef CONFIG_SPL_BUILD 39a2ab6b7dSStephen Warren gpio_request(GPIO_PI3, NULL); 40a2ab6b7dSStephen Warren #endif 41a2ab6b7dSStephen Warren gpio_direction_output(GPIO_PI3, 0); 42d5ef19b9SStephen Warren } 43a04eba99SSimon Glass #endif 44d5ef19b9SStephen Warren 453f82d89dSTom Warren #ifdef CONFIG_TEGRA_MMC 46ccf7988bSTom Warren /* 47ae03661fSStephen Warren * Routine: pin_mux_mmc 48ae03661fSStephen Warren * Description: setup the pin muxes/tristate values for the SDMMC(s) 49ae03661fSStephen Warren */ 50*c9aa831eSTom Warren void pin_mux_mmc(void) 51ae03661fSStephen Warren { 52ca28090dSSimon Glass funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); 53ca28090dSSimon Glass funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_4BIT); 54ae03661fSStephen Warren 55ae03661fSStephen Warren /* For power GPIO PI6 */ 56ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_ATA); 57ae03661fSStephen Warren /* For CD GPIO PI5 */ 58ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_ATC); 59ae03661fSStephen Warren } 60ccf7988bSTom Warren #endif 61f10393e5SSimon Glass 62f10393e5SSimon Glass void pin_mux_usb(void) 63f10393e5SSimon Glass { 64f10393e5SSimon Glass /* For USB's GPIO PD0. For now, since we have no pinmux in fdt */ 65f10393e5SSimon Glass pinmux_tristate_disable(PINGRP_SLXK); 66f10393e5SSimon Glass } 67