tegra: init MMC from common board init
PATCH 1/2 tegra: init MMC from common board init
--- board/nvidia/common/board.c | 4 ++++
1 Datei ge?ndert, 4 Zeilen hinzugef?gt(+)
board/nvidia/common/board.c +4 -0
@@ -132,6 +132,10 @@ int board_init(void)board_usb_init (gd->fdt_blob);#endif +#ifdef CONFIG_TEGRA_MMC +board_mmc_init (gd->fdt_blob); +#endif +#ifdef CONFIG_TEGRA20_LP0 /* save Sdram params to PMC 2, 4, and 24 for WB0 */ warmboot_save_sdram_params ();
Signature · 1 line
1.7.11.2
PATCH 2/2 tegra: convert gpio_config_uart to weak symbol
Most boards don't need this fixup hook. To avoid a lot of empty implementations in board files convert it to a weak symbol.
--- board/avionic-design/common/tamonten.c | 7 ------- board/compal/paz00/paz00.c | 7 ------- board/compulab/trimslice/trimslice.c | 7 ------- board/nvidia/common/board.c | 5 +++++ board/nvidia/harmony/harmony.c | 7 ------- board/nvidia/whistler/whistler.c | 7 -------
6 Dateien ge?ndert, 5 Zeilen hinzugef?gt(+), 35 Zeilen entfernt(-)
board/avionic-design/common/tamonten.c +0 -7
@@ -41,13 +41,6 @@#include <mmc.h> #endif -/* -* Routine: gpio_config_uart -* Description: Does nothing on Tamonten - no conflict w/SPI. -*/ -void gpio_config_uart (void ) -{ -}#ifdef CONFIG_BOARD_EARLY_INIT_F void gpio_early_init (void )
board/compal/paz00/paz00.c +0 -7
@@ -24,13 +24,6 @@#include <mmc.h> #endif -/* -* Routine: gpio_config_uart -* Description: Does nothing on Paz00 - no conflict w/SPI. -*/ -void gpio_config_uart (void ) -{ -}#ifdef CONFIG_TEGRA_MMC /*
board/compulab/trimslice/trimslice.c +0 -7
@@ -34,13 +34,6 @@#include <mmc.h> #endif -/* -* Routine: gpio_config_uart -* Description: Does nothing on TrimSlice - no UART-related GPIOs. -*/ -void gpio_config_uart (void ) -{ -}void pin_mux_spi (void ) {
board/nvidia/common/board.c +5 -0
@@ -72,6 +72,11 @@ void __pin_mux_spi(void)void pin_mux_spi (void ) __attribute__((weak,alias ("__pin_mux_spi" ))); +void __gpio_config_uart (void ) +{ +} + +void gpio_config_uart (void ) __attribute__((weak,alias ("__gpio_config_uart" )));/* * Routine: power_det_init * Description: turn off power detects
board/nvidia/harmony/harmony.c +0 -7
@@ -33,13 +33,6 @@#include <mmc.h> #endif -/* -* Routine: gpio_config_uart -* Description: Does nothing on Harmony - no conflict w/SPI. -*/ -void gpio_config_uart (void ) -{ -}#ifdef CONFIG_TEGRA_MMC /*
board/nvidia/whistler/whistler.c +0 -7
@@ -34,13 +34,6 @@#include <mmc.h> #endif -/* -* Routine: gpio_config_uart -* Description: Does nothing on Whistler - no UART-related GPIOs. -*/ -void gpio_config_uart (void ) -{ -}/* * Routine: pin_mux_mmc
Signature · 1 line
1.7.11.2
PATCH 2/2 tegra: convert gpio_config_uart to weak symbol
Quoted 2 lines · Lucas Stach
Most boards don't need this fixup hook. To avoid a lot of empty implementations in board files convert it to a weak symbol.
This seems OK on the surface, but I think there may be more opportunity for cleanup here.
In board/nvidia/common/board.c, I see both of the following:
board_init:
#ifdef CONFIG_SPI_UART_SWITCH
gpio_config_uart();#endif
board_early_init_f:
/* Initialize periph GPIOs */
gpio_early_init();
#ifdef CONFIG_SPI_UART_SWITCH
gpio_early_init_uart();
#else
gpio_config_uart();#endif
and in arch/arm/cpu/arm720t/tegra20/spl.c:
board_init_f:
#ifdef CONFIG_SPI_UART_SWITCH
gpio_early_init_uart();
#else
gpio_config_uart();#endif
It sure seems like we don't need to call those two init function all those times. Perhaps we can clarify which of the functions are actually needed at all, and when they should be called.
PATCH 2/2 tegra: convert gpio_config_uart to weak symbol
Hi Stephen,
Am Dienstag, den 07.08.2012, 11:09 -0600 schrieb Stephen Warren:
Quoted 7 lines · Lucas Stach
Quoted 2 lines
Most boards don't need this fixup hook. To avoid a lot of empty implementations in board files convert it to a weak symbol.
This seems OK on the surface, but I think there may be more opportunity for cleanup here.
I looked a bit deeper into this and it seems that in fact the logic of all those calls are correct and none them could be removed.
To clarify what's going on:
if we are building without CONFIG_SPI_UART_SWITCH the board file has to provide a function gpio_config_uart() to ensure correct GPIO setting and it's correct to call this in early_init.
Now, if we build with CONFIG_SPI_UART_SWITCH set, the board file stops providing the gpio_config_uart() and the UART switch provides a gpio_early_init_uart() function which does essentially the same, so we call this instead in early init.
The confusing part is that the UART switch now provides a function also named gpio_config_uart(), which redoes the GPIO setting after relocation and does some internal state setting.
Now while explaining all this in this email I see how we should make this more clear with some reasonable renaming, but we won't get around the weak symbol if we want to keep the possibility for boards to build without CONFIG_SPI_UART_SWITCH. I'll spin a new patch to untangle this mess a bit.
Thanks,
Lucas
Quoted 33 lines
In
board/nvidia/common/board.c, I see both of the following:
board_init:#ifdef CONFIG_SPI_UART_SWITCH gpio_config_uart();#endif
board_early_init_f:/* Initialize periph GPIOs */ gpio_early_init(); #ifdef CONFIG_SPI_UART_SWITCH gpio_early_init_uart(); #else gpio_config_uart();#endif
and in
arch/arm/cpu/arm720t/tegra20/spl.c:
board_init_f:#ifdef CONFIG_SPI_UART_SWITCH gpio_early_init_uart(); #else gpio_config_uart();#endif
It sure seems like we don't need to call those two init function all those times. Perhaps we can clarify which of the functions are actually needed at all, and when they should be called.
PATCH 1/2 tegra: init MMC from common board init
In reply to Lucas StachOn 08/06/2012 07:18 PM, Lucas Stach wrote:
There's no description here justifying why you want this change.
I don't think the change is correct; in arch/arm/lib/board.c, board_init_r() calls drivers/mmc/mmc.c:mmc_initialize() which calls board_mmc_init(). With this patch, won't this function get called twice?
PATCH 1/2 tegra: init MMC from common board init
Am Dienstag, den 07.08.2012, 11:04 -0600 schrieb Stephen Warren:
Quoted 8 lines · Lucas Stach
There's no description here justifying why you want this change.
I don't think the change is correct; in
arch/arm/lib/board.c,board_init_r()calls drivers/mmc/mmc.c:mmc_initialize() which callsboard_mmc_init(). With this patch, won't this function get called twice?
Please disregard this patch. It was only needed because of an error on my side.
Sorry for the inconvenience.