diff --git a/arch/arm/src/sama5/Kconfig b/arch/arm/src/sama5/Kconfig index 899e8a6dce..e31197b4b6 100644 --- a/arch/arm/src/sama5/Kconfig +++ b/arch/arm/src/sama5/Kconfig @@ -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 diff --git a/arch/arm/src/sama5/sam_dbgu.c b/arch/arm/src/sama5/sam_dbgu.c index 4a86921c02..f86cd89a00 100644 --- a/arch/arm/src/sama5/sam_dbgu.c +++ b/arch/arm/src/sama5/sam_dbgu.c @@ -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 } /****************************************************************************