Re: [U-Boot] [PATCH v7 3/4] tegra2: Modify MMC driver to handle power and cd GPIOs

2011-11-15 Thread Stephen Warren
On 11/02/2011 08:30 PM, Andy Fleming wrote:
 On Mon, Oct 31, 2011 at 11:51 AM, Stephen Warren swar...@nvidia.com wrote:
 Pass the GPIO numbers for power and card detect to tegra2_mmc_init(), and
 modify that function to perform all required GPIO initialization. This
 removes the need for board files to perform these operations.

 Move board_mmc_getcd() into tegra2_mmc.c now that the driver knows which
 GPIOs to use.

 Update affected call-sites in seaboard.c and harmony.c. Note that this
 change should make all SD ports work on Harmony, since the required GPIO
 setup is now being performed.

 v4: Fix prototype of tegra2_mmc_init() in board.h to match driver change.
Remove prototype of gpio_config_mmc() from board.h

 Signed-off-by: Stephen Warren swar...@nvidia.com
 Cc: Andy Fleming aflem...@gmail.com
 Tested-by: Simon Glass s...@chromium.org
 Acked-by: Simon Glass s...@chromium.org
 
 This patch depends heavily on patch #2 (ie, won't apply without it),
 which doesn't touch drivers/mmc.
 
 Lacking an ACK from Albert, I hesitate to just apply the whole series.
 I've applied patch #1, and I'll let Albert decide whether to apply the
 other 3:
 
 Acked-by: Andy Fleming aflem...@freescale.com
 
 I have also re-assigned this patch in patchworks to Albert.

Albert, Do the remaining 3 patches in this series look good?

Thanks.

-- 
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 3/4] tegra2: Modify MMC driver to handle power and cd GPIOs

2011-11-02 Thread Andy Fleming
On Mon, Oct 31, 2011 at 11:51 AM, Stephen Warren swar...@nvidia.com wrote:
 Pass the GPIO numbers for power and card detect to tegra2_mmc_init(), and
 modify that function to perform all required GPIO initialization. This
 removes the need for board files to perform these operations.

 Move board_mmc_getcd() into tegra2_mmc.c now that the driver knows which
 GPIOs to use.

 Update affected call-sites in seaboard.c and harmony.c. Note that this
 change should make all SD ports work on Harmony, since the required GPIO
 setup is now being performed.

 v4: Fix prototype of tegra2_mmc_init() in board.h to match driver change.
    Remove prototype of gpio_config_mmc() from board.h

 Signed-off-by: Stephen Warren swar...@nvidia.com
 Cc: Andy Fleming aflem...@gmail.com
 Tested-by: Simon Glass s...@chromium.org
 Acked-by: Simon Glass s...@chromium.org

This patch depends heavily on patch #2 (ie, won't apply without it),
which doesn't touch drivers/mmc.

Lacking an ACK from Albert, I hesitate to just apply the whole series.
I've applied patch #1, and I'll let Albert decide whether to apply the
other 3:

Acked-by: Andy Fleming aflem...@freescale.com

I have also re-assigned this patch in patchworks to Albert.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v7 3/4] tegra2: Modify MMC driver to handle power and cd GPIOs

2011-10-31 Thread Stephen Warren
Pass the GPIO numbers for power and card detect to tegra2_mmc_init(), and
modify that function to perform all required GPIO initialization. This
removes the need for board files to perform these operations.

Move board_mmc_getcd() into tegra2_mmc.c now that the driver knows which
GPIOs to use.

Update affected call-sites in seaboard.c and harmony.c. Note that this
change should make all SD ports work on Harmony, since the required GPIO
setup is now being performed.

v4: Fix prototype of tegra2_mmc_init() in board.h to match driver change.
Remove prototype of gpio_config_mmc() from board.h

Signed-off-by: Stephen Warren swar...@nvidia.com
Cc: Andy Fleming aflem...@gmail.com
Tested-by: Simon Glass s...@chromium.org
Acked-by: Simon Glass s...@chromium.org
---
 board/nvidia/common/board.h  |3 +-
 board/nvidia/harmony/harmony.c   |   27 ++-
 board/nvidia/seaboard/seaboard.c |   33 +
 drivers/mmc/tegra2_mmc.c |   42 -
 drivers/mmc/tegra2_mmc.h |4 ++-
 5 files changed, 45 insertions(+), 64 deletions(-)

diff --git a/board/nvidia/common/board.h b/board/nvidia/common/board.h
index 344e702..35acbca 100644
--- a/board/nvidia/common/board.h
+++ b/board/nvidia/common/board.h
@@ -26,7 +26,6 @@
 
 void tegra2_start(void);
 void gpio_config_uart(void);
-void gpio_config_mmc(void);
-int tegra2_mmc_init(int dev_index, int bus_width);
+int tegra2_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio);
 
 #endif /* BOARD_H */
diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c
index f2c3867..3cbe820 100644
--- a/board/nvidia/harmony/harmony.c
+++ b/board/nvidia/harmony/harmony.c
@@ -25,6 +25,7 @@
 #include asm/io.h
 #include asm/arch/tegra2.h
 #include asm/arch/pinmux.h
+#include asm/gpio.h
 #ifdef CONFIG_TEGRA2_MMC
 #include mmc.h
 #endif
@@ -72,15 +73,6 @@ static void pin_mux_mmc(void)
pinmux_tristate_disable(PINGRP_ATC);
 }
 
-/*
- * Routine: gpio_config_mmc
- * Description: Set GPIOs for SD card
- */
-void gpio_config_mmc(void)
-{
-   /* Not implemented for now */
-}
-
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
@@ -88,29 +80,16 @@ int board_mmc_init(bd_t *bd)
 
/* Enable muxes, etc. for SDMMC controllers */
pin_mux_mmc();
-   gpio_config_mmc();
 
debug(board_mmc_init: init SD slot J26\n);
/* init dev 0, SD slot J26, with 4-bit bus */
/* The board has an 8-bit bus, but 8-bit doesn't work yet */
-   tegra2_mmc_init(0, 4);
+   tegra2_mmc_init(0, 4, GPIO_PI6, GPIO_PH2);
 
debug(board_mmc_init: init SD slot J5\n);
/* init dev 2, SD slot J5, with 4-bit bus */
-   tegra2_mmc_init(2, 4);
+   tegra2_mmc_init(2, 4, GPIO_PT3, GPIO_PI5);
 
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);
-   /*
-* Hard-code CD presence for now. Need to add GPIO inputs
-* for Harmony
-*/
-   *cd = 1;
-   return 0;
-}
 #endif
diff --git a/board/nvidia/seaboard/seaboard.c b/board/nvidia/seaboard/seaboard.c
index 22a0e69..356d616 100644
--- a/board/nvidia/seaboard/seaboard.c
+++ b/board/nvidia/seaboard/seaboard.c
@@ -87,19 +87,6 @@ static void pin_mux_mmc(void)
pinmux_tristate_disable(PINGRP_ATC);
 }
 
-/*
- * Routine: gpio_config_mmc
- * Description: Set GPIOs for SDMMC3 SDIO slot.
- */
-void gpio_config_mmc(void)
-{
-   /* Set EN_VDDIO_SD (GPIO I6) */
-   gpio_direction_output(GPIO_PI6, 1);
-
-   /* Config pin as GPI for Card Detect (GPIO I5) */
-   gpio_direction_input(GPIO_PI5);
-}
-
 /* this is a weak define that we are overriding */
 int board_mmc_init(bd_t *bd)
 {
@@ -107,31 +94,15 @@ int board_mmc_init(bd_t *bd)
 
/* Enable muxes, etc. for SDMMC controllers */
pin_mux_mmc();
-   gpio_config_mmc();
 
debug(board_mmc_init: init eMMC\n);
/* init dev 0, eMMC chip, with 4-bit bus */
/* The board has an 8-bit bus, but 8-bit doesn't work yet */
-   tegra2_mmc_init(0, 4);
+   tegra2_mmc_init(0, 4, -1, -1);
 
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);
-   *cd = 1;/* Assume card is inserted, or eMMC */
-
-   if (IS_SD(mmc)) {
-   /* Seaboard SDMMC3 = SDIO3_CD = GPIO_PI5 */
-   if (gpio_get_value(GPIO_PI5))
-   *cd = 0;
-   }
+   tegra2_mmc_init(1, 4, GPIO_PI6, GPIO_PI5);
 
return 0;
 }
diff --git a/drivers/mmc/tegra2_mmc.c b/drivers/mmc/tegra2_mmc.c
index 78b1190..3de9c5d 100644
--- a/drivers/mmc/tegra2_mmc.c
+++