SAMA5 DBGU: Add logic to suppress DBGU reconfiguration when started from a bootloader

This commit is contained in:
Gregory Nutt 2014-04-01 14:13:00 -06:00
parent c6685c7f7d
commit df7429add0
2 changed files with 26 additions and 2 deletions

View File

@ -367,6 +367,19 @@ config SAMA5_DBGU_TXBUFSIZE
Characters are buffered before being sent. This specifies
the size of the transmit buffer.
config SAMA5_DBGU_NOCONFIG
bool "Suppress DBGU configuration"
default n
depends on SAMA5_BOOT_SDRAM && SAMA5_DBGU_CONSOLE
---help---
The DBGU is often used by bootloaders to provide the bootloader
interface. If the DBGU is also used as the NuttX console, then it
would be best to avoid reconfiguring the DBGU so that the user
experience is seamless going from the bootloader to the NuttX
console.
if !SAMA5_DBGU_NOCONFIG
config SAMA5_DBGU_BAUD
int "BAUD rate"
default 115200
@ -380,6 +393,7 @@ config SAMA5_DBGU_PARITY
---help---
0=no parity, 1=odd parity, 2=even parity
endif # !SAMA5_DBGU_NOCONFIG
endmenu #DBGU Configuration
if SAMA5_LCDC

View File

@ -164,9 +164,9 @@ static uart_dev_t g_dbgu_port =
*
****************************************************************************/
#if !defined(CONFIG_SUPPRESS_UART_CONFIG) && !defined(CONFIG_SAMA5_DBGU_NOCONFIG)
static void dbgu_configure(void)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
uint32_t regval;
/* Set up the mode register. Start with normal DBGU mode and the MCK
@ -200,9 +200,12 @@ static void dbgu_configure(void)
/* Enable receiver & transmitter */
putreg32((DBGU_CR_RXEN|DBGU_CR_TXEN), SAM_DBGU_CR);
#endif
}
#else
# define dbgu_configure()
#endif /* !CONFIG_SUPPRESS_UART_CONFIG && !CONFIG_SAMA5_DBGU_NOCONFIG */
/****************************************************************************
* Name: dbgu_setup
*
@ -237,6 +240,12 @@ static int dbgu_setup(struct uart_dev_s *dev)
static void dbgu_shutdown(struct uart_dev_s *dev)
{
#if !defined(CONFIG_SUPPRESS_UART_CONFIG) && !defined(CONFIG_SAMA5_DBGU_NOCONFIG)
/* Disable all interrupts */
putreg32(DBGU_INT_ALLINTS, SAM_DBGU_IDR);
#else
irqstate_t flags;
/* The following must be atomic */
@ -251,6 +260,7 @@ static void dbgu_shutdown(struct uart_dev_s *dev)
putreg32(DBGU_INT_ALLINTS, SAM_DBGU_IDR);
irqrestore(flags);
#endif
}
/****************************************************************************