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> 26e712e545SSimon Glass #include <asm/arch/clock.h> 27e712e545SSimon Glass #include <asm/arch/funcmux.h> 28ae03661fSStephen Warren #include <asm/arch/pinmux.h> 29150c2493STom Warren #include <asm/arch/tegra.h> 30150c2493STom Warren #include <asm/arch-tegra/mmc.h> 319877841fSStephen Warren #include <asm/gpio.h> 323f82d89dSTom Warren #ifdef CONFIG_TEGRA_MMC 33ccf7988bSTom Warren #include <mmc.h> 34ccf7988bSTom Warren #endif 35f4ef6668STom Warren 36ccf7988bSTom Warren 373f82d89dSTom Warren #ifdef CONFIG_TEGRA_MMC 38ccf7988bSTom Warren /* 39ae03661fSStephen Warren * Routine: pin_mux_mmc 40ae03661fSStephen Warren * Description: setup the pin muxes/tristate values for the SDMMC(s) 41ae03661fSStephen Warren */ 42ae03661fSStephen Warren static void pin_mux_mmc(void) 43ae03661fSStephen Warren { 44e712e545SSimon Glass funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); 45e712e545SSimon Glass funcmux_select(PERIPH_ID_SDMMC2, FUNCMUX_SDMMC2_DTA_DTD_8BIT); 46ae03661fSStephen Warren 47ae03661fSStephen Warren /* For power GPIO PI6 */ 48ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_ATA); 49ae03661fSStephen Warren /* For CD GPIO PH2 */ 50ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_ATD); 51ae03661fSStephen Warren 52ae03661fSStephen Warren /* For power GPIO PT3 */ 53ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_DTB); 54ae03661fSStephen Warren /* For CD GPIO PI5 */ 55ae03661fSStephen Warren pinmux_tristate_disable(PINGRP_ATC); 56ae03661fSStephen Warren } 57ae03661fSStephen Warren 58ccf7988bSTom Warren /* this is a weak define that we are overriding */ 59ae03661fSStephen Warren int board_mmc_init(bd_t *bd) 60ae03661fSStephen Warren { 61ae03661fSStephen Warren debug("board_mmc_init called\n"); 62ae03661fSStephen Warren 63ae03661fSStephen Warren /* Enable muxes, etc. for SDMMC controllers */ 64ae03661fSStephen Warren pin_mux_mmc(); 65ae03661fSStephen Warren 66ae03661fSStephen Warren debug("board_mmc_init: init SD slot J26\n"); 67ae03661fSStephen Warren /* init dev 0, SD slot J26, with 4-bit bus */ 68ae03661fSStephen Warren /* The board has an 8-bit bus, but 8-bit doesn't work yet */ 6929f3e3f2STom Warren tegra_mmc_init(0, 4, GPIO_PI6, GPIO_PH2); 70ae03661fSStephen Warren 71ae03661fSStephen Warren debug("board_mmc_init: init SD slot J5\n"); 72ae03661fSStephen Warren /* init dev 2, SD slot J5, with 4-bit bus */ 7329f3e3f2STom Warren tegra_mmc_init(2, 4, GPIO_PT3, GPIO_PI5); 74ae03661fSStephen Warren 75ae03661fSStephen Warren return 0; 76ae03661fSStephen Warren } 77ccf7988bSTom Warren #endif 78*699c40e8SStephen Warren 79*699c40e8SStephen Warren void pin_mux_usb(void) 80*699c40e8SStephen Warren { 81*699c40e8SStephen Warren funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); 82*699c40e8SStephen Warren pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); 83*699c40e8SStephen Warren pinmux_tristate_disable(PINGRP_CDEV2); 84*699c40e8SStephen Warren /* USB2 PHY reset GPIO */ 85*699c40e8SStephen Warren pinmux_tristate_disable(PINGRP_UAC); 86*699c40e8SStephen Warren } 87