diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/nvidia/common/board.c | 15 | ||||
-rw-r--r-- | board/nvidia/common/board.h | 4 | ||||
-rw-r--r-- | board/nvidia/common/uart-spi-fix.c | 29 |
3 files changed, 22 insertions, 26 deletions
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index e68dcfdfeba..679ac3ded32 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -145,14 +145,15 @@ static void pinmux_init(int uart_ids) pin_mux_uart(uart_ids); } -/* - * Routine: gpio_init - * Description: Do individual peripheral GPIO configs +/** + * Do individual peripheral GPIO configs + * + * @param blob FDT blob with configuration information */ -static void gpio_init(void) +static void gpio_init(const void *blob) { #ifdef CONFIG_SPI_UART_SWITCH - gpio_early_init_uart(); + gpio_early_init_uart(blob); #endif } @@ -168,7 +169,7 @@ int board_init(void) gd->bd->bi_arch_number = CONFIG_MACH_TYPE; #ifdef CONFIG_SPI_UART_SWITCH - gpio_config_uart(); + gpio_config_uart(gd->blob); #endif #ifdef CONFIG_USB_EHCI_TEGRA board_usb_init(); @@ -204,7 +205,7 @@ int board_early_init_f(void) pinmux_init(uart_ids); /* Initialize periph GPIOs */ - gpio_init(); + gpio_init(gd->blob); return 0; } diff --git a/board/nvidia/common/board.h b/board/nvidia/common/board.h index 5c23d41b10b..c406c892298 100644 --- a/board/nvidia/common/board.h +++ b/board/nvidia/common/board.h @@ -25,7 +25,7 @@ #define _BOARD_H_ void tegra2_start(void); -void gpio_config_uart(void); -void gpio_early_init_uart(void); +void gpio_config_uart(const void *blob); +void gpio_early_init_uart(const void *blob); #endif /* BOARD_H */ diff --git a/board/nvidia/common/uart-spi-fix.c b/board/nvidia/common/uart-spi-fix.c index 4f022158c4b..051f7492304 100644 --- a/board/nvidia/common/uart-spi-fix.c +++ b/board/nvidia/common/uart-spi-fix.c @@ -24,6 +24,7 @@ #include <asm/io.h> #include <ns16550.h> #include <libfdt.h> +#include <fdt_decode.h> #include <fdt_support.h> #include <asm/arch/bitfield.h> #include <asm/arch/gpio.h> @@ -41,20 +42,14 @@ enum spi_uart_switch { SWITCH_BOTH }; -/* Information about the spi/uart switch */ -struct spi_uart { - int gpio; /* GPIO to control switch */ - NS16550_t regs; /* Address of UART affected */ - u32 port; /* Port number of UART affected */ -}; - -static struct spi_uart local; +static struct fdt_spi_uart local; static enum spi_uart_switch switch_pos; /* Current switch position */ - -static void get_config(struct spi_uart *config) +static void get_config(const void *blob, struct fdt_spi_uart *config) { -#if defined CONFIG_SPI_CORRUPTS_UART +#ifdef CONFIG_OF_CONTROL + fdt_decode_get_spi_switch(blob, config); +#elif defined CONFIG_SPI_CORRUPTS_UART config->gpio = UART_DISABLE_GPIO; config->regs = (NS16550_t)CONFIG_SPI_CORRUPTS_UART; config->port = CONFIG_SPI_CORRUPTS_UART_NR; @@ -67,11 +62,11 @@ static void get_config(struct spi_uart *config) * Init the UART / SPI switch. This can be called before relocation so we must * not access BSS. */ -void gpio_early_init_uart(void) +void gpio_early_init_uart(const void *blob) { - struct spi_uart config; + struct fdt_spi_uart config; - get_config(&config); + get_config(blob, &config); if (config.gpio != -1) gpio_direction_output(config.gpio, 0); switch_pos = SWITCH_BOTH; @@ -80,9 +75,9 @@ void gpio_early_init_uart(void) /* * Configure the UART / SPI switch. */ -void gpio_config_uart(void) +void gpio_config_uart(const void *blob) { - get_config(&local); + get_config(blob, &local); switch_pos = SWITCH_BOTH; if (local.gpio != -1) { gpio_direction_output(local.gpio, 0); @@ -92,7 +87,7 @@ void gpio_config_uart(void) #ifdef CONFIG_SPI_UART_SWITCH -static void spi_uart_switch(struct spi_uart *config, +static void spi_uart_switch(struct fdt_spi_uart *config, enum spi_uart_switch new_pos) { if (switch_pos == SWITCH_BOTH || new_pos == switch_pos) |