tegra2: Seaboard's MMC has an 8-bit bus
Subsystems (2)
PATCH 1/4 tegra2: Seaboard's MMC has an 8-bit bus
Modify board_mmc_init to configure SDMMC4 for an 8-bit bus, since that's what is wired up on the board.
---
Note: These patches build on various Tegra2-related patches recently posted by Simon Glass; see v2 of the 6-entry patchset shown at:
http://patchwork.ozlabs.org/project/uboot/list/?submitter=6170&state=1&q=tegra2
board/nvidia/common/board.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
board/nvidia/common/board.c +2 -2
@@ -163,8 +163,8 @@ int board_mmc_init(bd_t *bd)gpio_config_mmc ();debug ("board_mmc_init: init eMMC\n" ); -/* init dev 0, eMMC chip, with 4-bit bus */ -tegra2_mmc_init (0 ,4 ); +/* init dev 0, eMMC chip, with 8-bit bus */ +tegra2_mmc_init (0 ,8 );debug ("board_mmc_init: init SD slot\n" );/* init dev 1, SD slot, with 4-bit bus */
Signature · 1 line
1.7.0.4
PATCH 2/4 tegra2: Call gpio_request for SDMMC GPIOs
Without this, the GPIO_CNF register will not be programmed, and hence the GPIO signals will not reach the pins; the pinmux's configured function will be routed to the pins instead.
--- board/nvidia/seaboard/seaboard.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
board/nvidia/seaboard/seaboard.c +2 -0
@@ -62,9 +62,11 @@ void gpio_config_uart(void)void gpio_config_mmc (void ) {/* Set EN_VDDIO_SD (GPIO I6) */ +gpio_request (GPIO_PI6 ,"SDMMC4 power" );gpio_direction_output (GPIO_PI6 ,1 );/* Config pin as GPI for Card Detect (GPIO I5) */ +gpio_request (GPIO_PI5 ,"SDMMC4 card detect" );gpio_direction_input (GPIO_PI5 ); }
Signature · 1 line
1.7.0.4
PATCH 2/4 tegra2: Call gpio_request for SDMMC GPIOs
Stephen Warren wrote at Friday, September 30, 2011 1:40 PM:
...
board/nvidia/seaboard/seaboard.c void gpio_config_uart(void) · line 71
Quoted 10 lines
void
gpio_config_mmc(void)
{board/nvidia/seaboard/seaboard.c +2
-0/* Set EN_VDDIO_SD (GPIO I6) */ +gpio_request (GPIO_PI6 ,"SDMMC4 power" );gpio_direction_output (GPIO_PI6 ,1 );/* Config pin as GPI for Card Detect (GPIO I5) */ +gpio_request (GPIO_PI5 ,"SDMMC4 card detect" );gpio_direction_input (GPIO_PI5 ); }
Tom pointed out that the strings here should say "SDMMC3" not "SDMMC4". I'll wait until Tuesday for any other comments, then repost an updated patchset including that fix.
Signature · 1 line
nvpublic
PATCH 3/4 tegra2: Enable second SD port (J5) on Harmony
In reply to Stephen WarrenSeaboard uses SDMMC4, SDMMC3. Harmony uses SDMMC4, SDMMC2. Move board_init_mmc and gpio_config_mmc into board-specific files, so boards can choose which ports to set up. Split clock_init_mmc and pin_mux_mmc into per-port functions, and export them for use by boards.
--- board/nvidia/common/board.c | 77 ++++++++++++++++++++++++-------------- board/nvidia/common/board.h | 8 +++- board/nvidia/harmony/harmony.c | 56 +++++++++++++++++++++++++-- board/nvidia/seaboard/seaboard.c | 23 +++++++++++ drivers/mmc/tegra2_mmc.c | 18 +++++++++ 5 files changed, 148 insertions(+), 34 deletions(-)
board/nvidia/common/board.c +49 -28
@@ -102,20 +102,37 @@ static void pin_mux_uart(void)#ifdef CONFIG_TEGRA2_MMC /* -* Routine: clock_init_mmc -* Description: init the PLL and clocks for the SDMMC controllers +* Routine: clock_init_mmc4 +* Description: init the PLL and clocks for SDMMC4 controller */ -static void clock_init_mmc (void ) +void clock_init_mmc4 (void ) {clock_start_periph_pll (PERIPH_ID_SDMMC4 ,CLOCK_ID_PERIPH ,20000000 ); +} + +/* +* Routine: clock_init_mmc3 +* Description: init the PLL and clocks for SDMMC3 controller +*/ +void clock_init_mmc3 (void ) +{clock_start_periph_pll (PERIPH_ID_SDMMC3 ,CLOCK_ID_PERIPH ,20000000 ); }/* -* Routine: pin_mux_mmc -* Description: setup the pin muxes/tristate values for the SDMMC(s) +* Routine: clock_init_mmc2 +* Description: init the PLL and clocks for SDMMC2 controller */ -static void pin_mux_mmc (void ) +void clock_init_mmc2 (void ) +{ +clock_start_periph_pll (PERIPH_ID_SDMMC2 ,CLOCK_ID_PERIPH ,20000000 ); +} + +/* +* Routine: pin_mux_mmc4 +* Description: setup the pin muxes/tristate values for SDMMC4 +*/ +void pin_mux_mmc4 (void ) {/* SDMMC4: config 3, x8 on 2nd set of pins */ pinmux_set_func (PINGRP_ATB ,PMUX_FUNC_SDIO4 );
@@ -125,7 +142,14 @@ static void pin_mux_mmc(void)pinmux_tristate_disable (PINGRP_ATB );pinmux_tristate_disable (PINGRP_GMA );pinmux_tristate_disable (PINGRP_GME ); +} +/* +* Routine: pin_mux_mmc3 +* Description: setup the pin muxes/tristate values for SDMMC3 +*/ +void pin_mux_mmc3 (void ) +{/* SDMMC3: SDIO3_CLK, SDIO3_CMD, SDIO3_DAT[3:0] */ pinmux_set_func (PINGRP_SDB ,PMUX_FUNC_SDIO3 );pinmux_set_func (PINGRP_SDC ,PMUX_FUNC_SDIO3 );
@@ -135,6 +159,25 @@ static void pin_mux_mmc(void)pinmux_tristate_disable (PINGRP_SDD ); pinmux_tristate_disable(PINGRP_SDB); } + +/* +* Routine: pin_mux_mmc2 +* Description: setup the pin muxes/tristate values for SDMMC2 +*/ +void pin_mux_mmc2 (void ) +{ +/* SDMMC2: SDIO2_CLK, SDIO2_CMD, SDIO2_DAT[7:0] */ +pinmux_set_func (PINGRP_DTA ,PMUX_FUNC_SDIO2 ); +pinmux_set_func (PINGRP_DTD ,PMUX_FUNC_SDIO2 ); + +pinmux_tristate_disable (PINGRP_DTA ); +pinmux_tristate_disable (PINGRP_DTD ); + +/* For power GPIO PI6 */ +pinmux_tristate_disable (PINGRP_ATA ); +/* For power GPIO PT3 */ +pinmux_tristate_disable (PINGRP_DTB ); +}#endif /*
@@ -152,28 +195,6 @@ int board_init(void)return 0 ; } -#ifdef CONFIG_TEGRA2_MMC -/* this is a weak define that we are overriding */ -int board_mmc_init (bd_t *bd) -{ -debug ("board_mmc_init called\n" ); -/* Enable clocks, muxes, etc. for SDMMC controllers */ -clock_init_mmc (); -pin_mux_mmc (); -gpio_config_mmc (); - -debug ("board_mmc_init: init eMMC\n" ); -/* init dev 0, eMMC chip, with 8-bit bus */ -tegra2_mmc_init (0 ,8 ); - -debug ("board_mmc_init: init SD slot\n" ); -/* init dev 1, SD slot, with 4-bit bus */ -tegra2_mmc_init (1 ,4 ); - -return 0 ; -} -#endif -#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f (void ) {
board/nvidia/common/board.h +7 -1
@@ -26,7 +26,13 @@void tegra2_start (void );void gpio_config_uart (void ); -void gpio_config_mmc (void ); +void clock_init_mmc4 (void ); +void clock_init_mmc3 (void ); +void clock_init_mmc2 (void ); +void pin_mux_mmc4 (void ); +void pin_mux_mmc3 (void ); +void pin_mux_mmc2 (void );int tegra2_mmc_init (int dev_index,int bus_width); +int tegra2_mmc_index (struct mmc *mmc);#endif /* BOARD_H */
board/nvidia/harmony/harmony.c +51 -5
79 lines not on this page · raw message
board/nvidia/seaboard/seaboard.c +23 -0
@@ -28,6 +28,7 @@#ifdef CONFIG_TEGRA2_MMC #include <mmc.h> #endif +#include "../common/board.h" /* * Routine: gpio_config_uart
@@ -71,6 +72,28 @@ void gpio_config_mmc(void) }/* this is a weak define that we are overriding */ +int board_mmc_init (bd_t *bd) +{ +debug ("board_mmc_init called\n" ); +/* Enable clocks, muxes, etc. for SDMMC controllers */ +clock_init_mmc4 (); +clock_init_mmc3 (); +pin_mux_mmc4 (); +pin_mux_mmc3 (); +gpio_config_mmc (); + +debug ("board_mmc_init: init eMMC\n" ); +/* init dev 0, eMMC chip, with 8-bit bus */ +tegra2_mmc_init (0 ,8 ); + +debug ("board_mmc_init: init SD slot\n" ); +/* init dev 1, SD slot, with 4-bit bus */ +tegra2_mmc_init (1 ,4 ); + +return 0 ; +} + +/* this is a weak define that we are overriding */ int board_mmc_getcd (u8 *cd,struct mmc *mmc) {debug ("board_mmc_getcd called\n" );
drivers/mmc/tegra2_mmc.c +18 -0
@@ -478,3 +478,21 @@ int tegra2_mmc_init(int dev_index, int bus_width) dev_index, bus_width);return tegra2_mmc_initialize (dev_index, bus_width); } + +int tegra2_mmc_index (struct mmc *mmc) +{ +struct mmc_host *host = (struct mmc_host *)mmc->priv; + +switch (host->base) { +case TEGRA2_SDMMC3_BASE : +return 1 ; +case TEGRA2_SDMMC2_BASE : +return 2 ; +case TEGRA2_SDMMC1_BASE : +return 3 ; +case TEGRA2_SDMMC4_BASE : +default : +return 0 ; + } +} +
Signature · 1 line
1.7.0.4
PATCH 4/4 tegra2: Add support for Ventana
In reply to Stephen WarrenVentana is a board which is very similar to Seaboard. Support it by re-using board/nvidia/seaboard/seaboard.c with minor run-time conditionals.
--- board/nvidia/seaboard/seaboard.c | 11 ++++++- board/nvidia/ventana/Makefile | 55 ++++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/ventana.h | 55 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 board/nvidia/ventana/Makefile create mode 100644 include/configs/ventana.h
board/nvidia/seaboard/seaboard.c +9 -2
@@ -31,10 +31,10 @@#include "../common/board.h" /* -* Routine: gpio_config_uart +* Routine: gpio_config_uart_seaboard * Description: Force GPIO_PI3 low on Seaboard so UART4 works. */ -void gpio_config_uart (void ) +void gpio_config_uart_seaboard (void ) {int gp =GPIO_PI3 ;struct gpio_ctlr *gpio = (struct gpio_ctlr *)NV_PA_GPIO_BASE ;
@@ -55,6 +55,13 @@ void gpio_config_uart(void)writel (val, &bank->gpio_dir_out[GPIO_PORT (gp)]); } +void gpio_config_uart (void ) +{ +if (machine_is_ventana ()) +return ; +gpio_config_uart_seaboard (); +} +#ifdef CONFIG_TEGRA2_MMC /* * Routine: gpio_config_mmc
board/nvidia/ventana/Makefile new file +55 -0
55 lines not on this page · raw message
boards.cfg +1 -0
@@ -185,6 +185,7 @@ s5pc210_universal arm armv7 universal_c210 samsung smdkv310 arm armv7 smdkv310 samsung s5pc2xx harmony arm armv7 harmony nvidia tegra2 seaboard arm armv7 seaboard nvidia tegra2 +ventana arm armv7 ventana nvidia tegra2 u8500_href arm armv7 u8500 st-ericsson u8500 actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2 actux1_8_16 arm ixp actux1 - - actux1:FLASH1X8
include/configs/ventana.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.0.4