blob: f2c3867251f48322dfb9f98c5058b30db272bef0 [file] [log] [blame]
Tom Warrene1495582011-04-14 12:09:41 +00001/*
2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#include <common.h>
25#include <asm/io.h>
26#include <asm/arch/tegra2.h>
Stephen Warrenf8eac0d2011-10-31 06:51:35 +000027#include <asm/arch/pinmux.h>
Tom Warren97bf58f2011-09-21 12:40:07 +000028#ifdef CONFIG_TEGRA2_MMC
29#include <mmc.h>
30#endif
Stephen Warrenf8eac0d2011-10-31 06:51:35 +000031#include "../common/board.h"
Tom Warrene1495582011-04-14 12:09:41 +000032
33/*
34 * Routine: gpio_config_uart
35 * Description: Does nothing on Harmony - no conflict w/SPI.
36 */
37void gpio_config_uart(void)
38{
39}
Tom Warren97bf58f2011-09-21 12:40:07 +000040
41#ifdef CONFIG_TEGRA2_MMC
42/*
Stephen Warrenf8eac0d2011-10-31 06:51:35 +000043 * Routine: pin_mux_mmc
44 * Description: setup the pin muxes/tristate values for the SDMMC(s)
45 */
46static void pin_mux_mmc(void)
47{
48 /* SDMMC4: config 3, x8 on 2nd set of pins */
49 pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
50 pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
51 pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
52
53 pinmux_tristate_disable(PINGRP_ATB);
54 pinmux_tristate_disable(PINGRP_GMA);
55 pinmux_tristate_disable(PINGRP_GME);
56
57 /* For power GPIO PI6 */
58 pinmux_tristate_disable(PINGRP_ATA);
59 /* For CD GPIO PH2 */
60 pinmux_tristate_disable(PINGRP_ATD);
61
62 /* SDMMC2: SDIO2_CLK, SDIO2_CMD, SDIO2_DAT[7:0] */
63 pinmux_set_func(PINGRP_DTA, PMUX_FUNC_SDIO2);
64 pinmux_set_func(PINGRP_DTD, PMUX_FUNC_SDIO2);
65
66 pinmux_tristate_disable(PINGRP_DTA);
67 pinmux_tristate_disable(PINGRP_DTD);
68
69 /* For power GPIO PT3 */
70 pinmux_tristate_disable(PINGRP_DTB);
71 /* For CD GPIO PI5 */
72 pinmux_tristate_disable(PINGRP_ATC);
73}
74
75/*
Tom Warren97bf58f2011-09-21 12:40:07 +000076 * Routine: gpio_config_mmc
77 * Description: Set GPIOs for SD card
78 */
79void gpio_config_mmc(void)
80{
81 /* Not implemented for now */
82}
83
84/* this is a weak define that we are overriding */
Stephen Warrenf8eac0d2011-10-31 06:51:35 +000085int board_mmc_init(bd_t *bd)
86{
87 debug("board_mmc_init called\n");
88
89 /* Enable muxes, etc. for SDMMC controllers */
90 pin_mux_mmc();
91 gpio_config_mmc();
92
93 debug("board_mmc_init: init SD slot J26\n");
94 /* init dev 0, SD slot J26, with 4-bit bus */
95 /* The board has an 8-bit bus, but 8-bit doesn't work yet */
96 tegra2_mmc_init(0, 4);
97
98 debug("board_mmc_init: init SD slot J5\n");
99 /* init dev 2, SD slot J5, with 4-bit bus */
100 tegra2_mmc_init(2, 4);
101
102 return 0;
103}
104
105/* this is a weak define that we are overriding */
Tom Warren97bf58f2011-09-21 12:40:07 +0000106int board_mmc_getcd(u8 *cd, struct mmc *mmc)
107{
108 debug("board_mmc_getcd called\n");
109 /*
110 * Hard-code CD presence for now. Need to add GPIO inputs
111 * for Harmony
112 */
113 *cd = 1;
114 return 0;
115}
116#endif