From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] serial: add UniPhier serial driver
Date: Fri, 4 Jul 2014 16:40:29 +0200 [thread overview]
Message-ID: <201407041640.29293.marex@denx.de> (raw)
In-Reply-To: <1404469158-22703-3-git-send-email-yamada.m@jp.panasonic.com>
On Friday, July 04, 2014 at 12:19:14 PM, Masahiro Yamada wrote:
> The driver for on-chip UART used on Panasonic UniPhier platform.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
[...]
> +static void uniphier_serial_init(struct uniphier_serial *port)
> +{
> + writeb(UART_LCR_WLS_8, &port->lcr);
> +
> +#define MODE_X_DIV 16
You can use just const unsigned here instead of #define.
> +
> + /* Compute divisor value. Normally, we should simply return:
> + * CONFIG_SYS_NS16550_CLK) / MODE_X_DIV / gd->baudrate
> + * but we need to round that value by adding 0.5.
> + * Rounding is especially important at high baud rates.
> + */
> + writew((CONFIG_SYS_UNIPHIER_UART_CLK + (gd->baudrate *
> + (MODE_X_DIV / 2))) / (MODE_X_DIV * gd->baudrate), &port->dlr);
> +}
> +
> +static void uniphier_serial_setbrg(struct uniphier_serial *port)
> +{
> + uniphier_serial_init(port);
> +}
> +
> +static int uniphier_serial_tstc(struct uniphier_serial *port)
> +{
> + return (readb(&port->lsr) & UART_LSR_DR) != 0;
> +}
> +
> +static int uniphier_serial_getc(struct uniphier_serial *port)
> +{
> + while (!uniphier_serial_tstc(port))
> + ;
> +
> + return readb(&port->rbr);
> +}
> +
> +static void uniphier_serial_putc(struct uniphier_serial *port, const char
> c) +{
> + if (c == '\n')
> + uniphier_serial_putc(port, '\r');
> +
> + while (!(readb(&port->lsr) & UART_LSR_THRE))
> + ;
I think in this function, you can avoid such completely unbounded loop.
[...]
Best regard,
Marek Vasut
next prev parent reply other threads:[~2014-07-04 14:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 10:19 [U-Boot] [PATCH 0/6] Add support for Panasonic UniPhier SoCs/boards Masahiro Yamada
2014-07-04 10:19 ` [U-Boot] [PATCH 1/6] nand: denali: add Denali NAND driver for SPL Masahiro Yamada
2014-07-04 14:34 ` Marek Vasut
2014-07-10 10:06 ` Masahiro Yamada
2014-07-10 10:10 ` Marek Vasut
2014-07-10 10:52 ` Masahiro Yamada
2014-07-10 11:30 ` Marek Vasut
2014-07-11 2:19 ` Masahiro Yamada
2014-07-04 10:19 ` [U-Boot] [PATCH 2/6] serial: add UniPhier serial driver Masahiro Yamada
2014-07-04 14:40 ` Marek Vasut [this message]
2014-07-10 10:06 ` Masahiro Yamada
2014-07-10 10:14 ` Marek Vasut
2014-07-10 11:31 ` Masahiro Yamada
2014-07-10 12:37 ` Marek Vasut
2014-07-11 5:37 ` Masahiro Yamada
2014-07-11 8:07 ` Marek Vasut
2014-07-04 10:19 ` [U-Boot] [PATCH 3/6] arm: uniphier: add UniPhier SoC suppurt code Masahiro Yamada
2014-08-20 9:31 ` Albert ARIBAUD
2014-08-21 11:27 ` Masahiro Yamada
2014-07-04 10:19 ` [U-Boot] [PATCH 4/6] arm: uniphier: add UniPhier config headers Masahiro Yamada
2014-07-04 10:19 ` [U-Boot] [PATCH 5/6] arm: uniphier: add board entries to boards.cfg Masahiro Yamada
2014-07-04 10:19 ` [U-Boot] [PATCH 6/6] git-mailrc: add me as the maintainer of UniPhier SoCs Masahiro Yamada
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=201407041640.29293.marex@denx.de \
--to=marex@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 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.