[U-Boot] [PATCH 2/5] Serial: Add UART support for Marvell ARMADA 100 SoCs.

Stefan Roese sr at denx.de
Wed Oct 27 11:53:34 CEST 2010


Hi Prafulla,

On Wednesday 27 October 2010 15:53:21 Prafulla Wadaskar wrote:
> ARMADA 100 SoCs has NS16550 compatible UART peripheral
> This patch enables the same for ARMADA100 platforms
> 
> Signed-off-by: Mahavir Jain <mjain at marvell.com>
> Signed-off-by: Prafulla WADASKAR <prafulla at marvell.com>
> ---
>  drivers/serial/ns16550.c |   16 ++++++++++++++++
>  drivers/serial/serial.c  |    3 +++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 32f24de..e57ed1f 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -26,7 +26,15 @@
> 
>  void NS16550_init (NS16550_t com_port, int baud_divisor)
>  {
> +#ifdef CONFIG_ARMADA100
> +	/*
> +	 * For ARMADA 100 Based Processors bit 6 in IER register
> +	 * represents UART Unit Enable bit.
> +	 */
> +	serial_out((1 << 6), &com_port->ier);
> +#else
>  	serial_out(0x00, &com_port->ier);
> +#endif

These board/platform specific driver additions are really ugly. A better way 
to do this would be something like this:

Add this to your board/platform header:

#define CONFIG_SYS_NS16550_IER	(1 << 6)

And then to ns16550.c or even ns16550.h:

#ifndef CONFIG_SYS_NS16550_IER
#define CONFIG_SYS_NS16550_IER	0x00
#endif

This macro can now be used unconditionally when initializing this "ier" 
register:

  	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de


More information about the U-Boot mailing list