public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] Serial: Add UART support for Marvell ARMADA 100 SoCs.
Date: Wed, 27 Oct 2010 11:53:34 +0200	[thread overview]
Message-ID: <201010271153.35291.sr@denx.de> (raw)
In-Reply-To: <1288187604-3371-3-git-send-email-prafulla@marvell.com>

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@marvell.com>
> Signed-off-by: Prafulla WADASKAR <prafulla@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

  reply	other threads:[~2010-10-27  9:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 13:53 [U-Boot] [PATCH 0/5] Add Marvell New Soc Support ARMADA100 Prafulla Wadaskar
2010-10-27 13:53 ` [U-Boot] [PATCH 1/5] arm: Add Support for Marvell ARMADA 100 Familiy SoCs Prafulla Wadaskar
2010-10-27 13:53   ` [U-Boot] [PATCH 2/5] Serial: Add UART support for Marvell ARMADA 100 SoCs Prafulla Wadaskar
2010-10-27  9:53     ` Stefan Roese [this message]
2010-10-27 10:40       ` Prafulla Wadaskar
2010-10-27 13:53     ` [U-Boot] [PATCH 3/5] gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs Prafulla Wadaskar
2010-10-27 13:53       ` [U-Boot] [PATCH 4/5] add Multi Fnction Pin configuration support for ARMADA100 Prafulla Wadaskar
2010-10-27 13:53         ` [U-Boot] [PATCH 5/5] Armada100: Add Board Support for Marvell Aspenite-DB Prafulla Wadaskar
2010-10-27 18:29           ` Wolfgang Denk
2010-10-28  3:28             ` Prafulla Wadaskar
2010-10-27 18:25         ` [U-Boot] [PATCH 4/5] add Multi Fnction Pin configuration support for ARMADA100 Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201010271153.35291.sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox