From mboxrd@z Thu Jan 1 00:00:00 1970 From: Reinhard Meyer Date: Tue, 29 Jun 2010 20:32:34 +0200 Subject: [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions Message-ID: <4C2A3C42.7050602@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, AT91SAM9 based boards have something like this in their include/configs file: #define CONFIG_ATMEL_USART 1 #undef CONFIG_USART0 #undef CONFIG_USART1 #undef CONFIG_USART2 #define CONFIG_USART3 1 /* USART 3 is DBGU */ these defines are used in drivers/serial/atmel_usart.c: #if defined(CONFIG_USART0) # define USART_ID 0 # define USART_BASE USART0_BASE #elif defined(CONFIG_USART1) # define USART_ID 1 # define USART_BASE USART1_BASE #elif defined(CONFIG_USART2) # define USART_ID 2 # define USART_BASE USART2_BASE #elif defined(CONFIG_USART3) # define USART_ID 3 # define USART_BASE USART3_BASE #endif USARTx_BASE is defined in arch/arm/include/asm/arch-at91/memory_map.h: #define USART0_BASE AT91_USART0 #define USART1_BASE AT91_USART1 #define USART2_BASE AT91_USART2 #define USART3_BASE (AT91_BASE_SYS + AT91_DBGU) #define SPI0_BASE AT91_BASE_SPI (note that nothing else is defined in that file!) AT91_USARTx finally comes from arch/arm/include/asm/arch-at91/at91sam*.h: #define AT91_USART0 AT91SAM9260_BASE_US0 #define AT91_USART1 AT91SAM9260_BASE_US1 #define AT91_USART2 AT91SAM9260_BASE_US2 #define AT91_USART3 AT91SAM9260_BASE_US3 #define AT91_USART4 AT91SAM9260_BASE_US4 #define AT91_USART5 AT91SAM9260_BASE_US5 1. memory_map.h is misleading, it just defines a few USARTs and one SPI 2. equalling CONFIG_USART3 with the debug UART is plain wrong, the 9260 for example has 6 'regular' USARTs (0..5) plus the debug UART I propose to make the following changes: 1. get rid of memory_map.h and the references to it, move the USART definitions to the respective at91sam*.h files 2. use DBU_BASE for the debug UART, leaving USART[0-5]_BASE to adress the 'regular' USARTs 3. use CONFIG_UARTDEBUG to indicate use of the debug UART for console output Note for those that don't want to dig the datasheets: the debug UART is software compatible to the 'regular' USARTs as long as only asynchronous features are used (true for the atmel_usart.c driver) Reinhard