From: James Chargin <jimccrown@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] serial: Move carriage return before line feed for some serial drivers
Date: Thu, 25 Feb 2016 06:19:23 -0800 [thread overview]
Message-ID: <56CF0D6B.6070307@gmail.com> (raw)
In-Reply-To: <1456368085-19979-1-git-send-email-b18965@freescale.com>
This is a request for more information.
On 02/24/2016 06:41 PM, Alison Wang wrote:
> In general, a carriage return needs to execute before a line feed.
> The patch is to change some serial drivers based on this rule, such
> as serial_mxc.c, serial_pxa.c, serial_s3c24x0.c and usbtty.c.
You write "In general, a carriage return needs to execute before a line
feed. The patch is to change some serial drivers based on this rule"
Please provide a reference. I'd probably benefit from deeper knowledge
of this subject. I had not heard this rule before.
Thank you,
Jim
>
> Signed-off-by: Alison Wang <alison.wang@nxp.com>
> ---
> drivers/serial/serial_mxc.c | 8 ++++----
> drivers/serial/serial_pxa.c | 8 ++++----
> drivers/serial/serial_s3c24x0.c | 8 ++++----
> drivers/serial/usbtty.c | 7 ++++---
> 4 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
> index 51485c0..1563bb3 100644
> --- a/drivers/serial/serial_mxc.c
> +++ b/drivers/serial/serial_mxc.c
> @@ -164,15 +164,15 @@ static int mxc_serial_getc(void)
>
> static void mxc_serial_putc(const char c)
> {
> + /* If \n, also do \r */
> + if (c == '\n')
> + serial_putc('\r');
> +
> __REG(UART_PHYS + UTXD) = c;
>
> /* wait for transmitter to be ready */
> while (!(__REG(UART_PHYS + UTS) & UTS_TXEMPTY))
> WATCHDOG_RESET();
> -
> - /* If \n, also do \r */
> - if (c == '\n')
> - serial_putc ('\r');
> }
>
> /*
> diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
> index 8fbcc10..1eb19ec 100644
> --- a/drivers/serial/serial_pxa.c
> +++ b/drivers/serial/serial_pxa.c
> @@ -156,6 +156,10 @@ void pxa_putc_dev(unsigned int uart_index, const char c)
> {
> struct pxa_uart_regs *uart_regs;
>
> + /* If \n, also do \r */
> + if (c == '\n')
> + pxa_putc_dev(uart_index, '\r');
> +
> uart_regs = pxa_uart_index_to_regs(uart_index);
> if (!uart_regs)
> hang();
> @@ -163,10 +167,6 @@ void pxa_putc_dev(unsigned int uart_index, const char c)
> while (!(readl(&uart_regs->lsr) & LSR_TEMT))
> WATCHDOG_RESET();
> writel(c, &uart_regs->thr);
> -
> - /* If \n, also do \r */
> - if (c == '\n')
> - pxa_putc_dev (uart_index,'\r');
> }
>
> /*
> diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
> index d4e7df2..0f0878a 100644
> --- a/drivers/serial/serial_s3c24x0.c
> +++ b/drivers/serial/serial_s3c24x0.c
> @@ -135,14 +135,14 @@ static void _serial_putc(const char c, const int dev_index)
> {
> struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
>
> + /* If \n, also do \r */
> + if (c == '\n')
> + serial_putc('\r');
> +
> while (!(readl(&uart->utrstat) & 0x2))
> /* wait for room in the tx FIFO */ ;
>
> writeb(c, &uart->utxh);
> -
> - /* If \n, also do \r */
> - if (c == '\n')
> - serial_putc('\r');
> }
>
> static inline void serial_putc_dev(unsigned int dev_index, const char c)
> diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
> index 75f0ec3..2e19813 100644
> --- a/drivers/serial/usbtty.c
> +++ b/drivers/serial/usbtty.c
> @@ -434,11 +434,12 @@ void usbtty_putc(struct stdio_dev *dev, const char c)
> if (!usbtty_configured ())
> return;
>
> - buf_push (&usbtty_output, &c, 1);
> /* If \n, also do \r */
> if (c == '\n')
> buf_push (&usbtty_output, "\r", 1);
>
> + buf_push(&usbtty_output, &c, 1);
> +
> /* Poll at end to handle new data... */
> if ((usbtty_output.size + 2) >= usbtty_output.totalsize) {
> usbtty_poll ();
> @@ -498,8 +499,8 @@ void usbtty_puts(struct stdio_dev *dev, const char *str)
> n = next_nl_pos (str);
>
> if (str[n] == '\n') {
> - __usbtty_puts (str, n + 1);
> - __usbtty_puts ("\r", 1);
> + __usbtty_puts("\r", 1);
> + __usbtty_puts(str, n + 1);
> str += (n + 1);
> len -= (n + 1);
> } else {
>
--
Jim Chargin
AJA Video Systems jimc at aja.com
(530) 271-3334 http://www.aja.com
next prev parent reply other threads:[~2016-02-25 14:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 2:41 [U-Boot] [PATCH] serial: Move carriage return before line feed for some serial drivers Alison Wang
2016-02-25 3:00 ` Bin Meng
2016-02-25 3:02 ` Huan Wang
2016-02-25 3:17 ` Bin Meng
2016-02-25 4:58 ` Huan Wang
2016-02-25 5:46 ` Bin Meng
2016-03-02 2:49 ` Huan Wang
2016-02-25 14:19 ` James Chargin [this message]
2016-03-02 4:41 ` Huan Wang
2016-02-25 17:55 ` Marek Vasut
2016-02-26 1:30 ` Bin Meng
2016-02-26 1:56 ` Simon Glass
2016-02-26 9:45 ` Marek Vasut
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=56CF0D6B.6070307@gmail.com \
--to=jimccrown@gmail.com \
--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