All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions
@ 2010-06-29 18:32 Reinhard Meyer
  2010-06-29 19:17 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Reinhard Meyer @ 2010-06-29 18:32 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions
  2010-06-29 18:32 [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions Reinhard Meyer
@ 2010-06-29 19:17 ` Wolfgang Denk
  2010-06-29 20:46   ` Reinhard Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2010-06-29 19:17 UTC (permalink / raw)
  To: u-boot

Dear Reinhard Meyer,

In message <4C2A3C42.7050602@emk-elektronik.de> you wrote:
> 
> I propose to make the following changes:

Please go on and submit a patch.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
                - Mark Twain

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions
  2010-06-29 19:17 ` Wolfgang Denk
@ 2010-06-29 20:46   ` Reinhard Meyer
  2010-06-29 21:03     ` Reinhard Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Reinhard Meyer @ 2010-06-29 20:46 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Reinhard Meyer,
>
> In message <4C2A3C42.7050602@emk-elektronik.de> you wrote:
>   
>> I propose to make the following changes:
>>     
>
> Please go on and submit a patch.
>   
Hello Wolfgang,

I just became aware that this patch will involve changes to ALL 
include/configs/*.h files for AT91 AND AVR32 boards using atmel_usart.c. 
If thats OK I will do that.

Reinhard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions
  2010-06-29 20:46   ` Reinhard Meyer
@ 2010-06-29 21:03     ` Reinhard Meyer
  0 siblings, 0 replies; 4+ messages in thread
From: Reinhard Meyer @ 2010-06-29 21:03 UTC (permalink / raw)
  To: u-boot

Reinhard Meyer wrote:
> Hello Wolfgang,
>
> I just became aware that this patch will involve changes to ALL 
> include/configs/*.h files for AT91 AND AVR32 boards using 
> atmel_usart.c. If thats OK I will do that.
>
Reason:

#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

in atmel_usart.c would have to be blown up for each "new" USART 
incarnation Atmel invents on new SoCs.
USART_ID is effectively not used
and USART_BASE might as well defined directly in the 
include/configs/<board>.h file either by:

#define CONFIG_ATMEL_USART    1
#define CONFIG_ATMEL_USART_BASE AT91_UARTDEB /* USART used is DBGU */

OR directly by:

#define CONFIG_ATMEL_USART AT91_UARTDEB /* USART used is DBGU */

or is the 2nd solution bad because Makefiles might choke on it?

Greetings, Reinhard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-29 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 18:32 [U-Boot] [RFC] AT91SAM9 series - cleanup USART definitions Reinhard Meyer
2010-06-29 19:17 ` Wolfgang Denk
2010-06-29 20:46   ` Reinhard Meyer
2010-06-29 21:03     ` Reinhard Meyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.