From: Andre Przywara <andre.przywara@arm.com>
To: Jun Nie <jun.nie@linaro.org>,
"peter@hurleysoftware.com" <peter@hurleysoftware.com>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
Andrew Jackson <Andrew.Jackson@arm.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"shawn.guo@linaro.org" <shawn.guo@linaro.org>
Cc: "jason.liu@linaro.org" <jason.liu@linaro.org>,
"wan.zhijun@zte.com.cn" <wan.zhijun@zte.com.cn>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v13 4/5] uart: pl011: Improve LCRH register access decision
Date: Fri, 18 Sep 2015 11:58:56 +0100 [thread overview]
Message-ID: <55FBEE70.9090004@arm.com> (raw)
In-Reply-To: <1438328959-16177-5-git-send-email-jun.nie@linaro.org>
Hi Jun,
On 31/07/15 08:49, Jun Nie wrote:
> Improve LCRH register access decision as ARM PL011 lcrh
> register serve as both TX and RX, while other SOC may
> implement TX and RX function with separated register.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
> drivers/tty/serial/amba-pl011.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index e1f3bd5..017443d 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -249,6 +249,11 @@ struct uart_amba_port {
> #endif
> };
>
> +static bool is_implemented(struct uart_amba_port *uap, unsigned int reg)
> +{
> + return uap->reg_lut[reg] != (u16)~0;
> +}
> +
Just a nit: is_implemented sounds a bit too generic for me, could this
be more specific like reg_is_implemented or the like?
Other than that the patch looks good to me.
Cheers,
Andre.
> static unsigned int pl011_readw(struct uart_amba_port *uap, int index)
> {
> WARN_ON(index > REG_NR);
> @@ -1649,7 +1654,7 @@ static int pl011_hwinit(struct uart_port *port)
> static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h)
> {
> pl011_writew(uap, lcr_h, uap->lcrh_rx);
> - if (uap->lcrh_rx != uap->lcrh_tx) {
> + if (is_implemented(uap, REG_ST_LCRH_RX)) {
> int i;
> /*
> * Wait 10 PCLKs before writing LCRH_TX register,
> @@ -1784,7 +1789,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap)
> * disable break condition and fifos
> */
> pl011_shutdown_channel(uap, uap->lcrh_rx);
> - if (uap->lcrh_rx != uap->lcrh_tx)
> + if (is_implemented(uap, REG_ST_LCRH_RX))
> pl011_shutdown_channel(uap, uap->lcrh_tx);
> }
>
>
WARNING: multiple messages have this Message-ID (diff)
From: andre.przywara@arm.com (Andre Przywara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v13 4/5] uart: pl011: Improve LCRH register access decision
Date: Fri, 18 Sep 2015 11:58:56 +0100 [thread overview]
Message-ID: <55FBEE70.9090004@arm.com> (raw)
In-Reply-To: <1438328959-16177-5-git-send-email-jun.nie@linaro.org>
Hi Jun,
On 31/07/15 08:49, Jun Nie wrote:
> Improve LCRH register access decision as ARM PL011 lcrh
> register serve as both TX and RX, while other SOC may
> implement TX and RX function with separated register.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
> drivers/tty/serial/amba-pl011.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index e1f3bd5..017443d 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -249,6 +249,11 @@ struct uart_amba_port {
> #endif
> };
>
> +static bool is_implemented(struct uart_amba_port *uap, unsigned int reg)
> +{
> + return uap->reg_lut[reg] != (u16)~0;
> +}
> +
Just a nit: is_implemented sounds a bit too generic for me, could this
be more specific like reg_is_implemented or the like?
Other than that the patch looks good to me.
Cheers,
Andre.
> static unsigned int pl011_readw(struct uart_amba_port *uap, int index)
> {
> WARN_ON(index > REG_NR);
> @@ -1649,7 +1654,7 @@ static int pl011_hwinit(struct uart_port *port)
> static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h)
> {
> pl011_writew(uap, lcr_h, uap->lcrh_rx);
> - if (uap->lcrh_rx != uap->lcrh_tx) {
> + if (is_implemented(uap, REG_ST_LCRH_RX)) {
> int i;
> /*
> * Wait 10 PCLKs before writing LCRH_TX register,
> @@ -1784,7 +1789,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap)
> * disable break condition and fifos
> */
> pl011_shutdown_channel(uap, uap->lcrh_rx);
> - if (uap->lcrh_rx != uap->lcrh_tx)
> + if (is_implemented(uap, REG_ST_LCRH_RX))
> pl011_shutdown_channel(uap, uap->lcrh_tx);
> }
>
>
next prev parent reply other threads:[~2015-09-18 10:58 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1438328959-16177-1-git-send-email-jun.nie@linaro.org>
[not found] ` <1438328959-16177-3-git-send-email-jun.nie@linaro.org>
2015-09-18 10:51 ` [PATCH v13 2/5] uart: pl011: Introduce register accessor Andre Przywara
2015-09-18 10:51 ` Andre Przywara
2015-09-19 6:46 ` Jun Nie
2015-09-19 6:46 ` Jun Nie
2015-09-19 21:45 ` Andre Przywara
2015-09-19 21:45 ` Andre Przywara
2015-10-22 23:36 ` Timur Tabi
2015-10-22 23:36 ` Timur Tabi
2015-10-28 14:22 ` Peter Hurley
2015-10-28 14:22 ` Peter Hurley
2015-10-28 14:51 ` Timur Tabi
2015-10-28 14:51 ` Timur Tabi
2015-10-28 15:08 ` Peter Hurley
2015-10-28 15:08 ` Peter Hurley
[not found] ` <1438328959-16177-5-git-send-email-jun.nie@linaro.org>
2015-09-18 10:58 ` Andre Przywara [this message]
2015-09-18 10:58 ` [PATCH v13 4/5] uart: pl011: Improve LCRH register access decision Andre Przywara
[not found] ` <1438328959-16177-6-git-send-email-jun.nie@linaro.org>
2015-09-18 13:50 ` [PATCH v13 5/5] uart: pl011: Add support to ZTE ZX296702 uart Andre Przywara
2015-09-18 13:50 ` Andre Przywara
2015-09-18 13:59 ` Russell King - ARM Linux
2015-09-18 13:59 ` Russell King - ARM Linux
2015-09-19 6:47 ` Jun Nie
2015-09-19 6:47 ` Jun Nie
2015-09-19 6:54 ` Jun Nie
2015-09-19 6:54 ` Jun Nie
2015-10-23 21:54 ` Timur Tabi
2015-10-23 21:54 ` Timur Tabi
2015-10-24 3:23 ` Jun Nie
2015-10-24 3:23 ` Jun Nie
2015-10-24 3:32 ` Timur Tabi
2015-10-24 3:32 ` Timur Tabi
2015-10-26 1:27 ` Jun Nie
2015-10-26 1:27 ` Jun Nie
2015-10-27 13:31 ` Peter Hurley
2015-10-27 13:31 ` Peter Hurley
2015-10-26 9:59 ` Andre Przywara
2015-10-26 9:59 ` Andre Przywara
2015-10-26 12:46 ` Timur Tabi
2015-10-26 12:46 ` Timur Tabi
2015-10-26 14:00 ` Andre Przywara
2015-10-26 14:00 ` Andre Przywara
2015-10-26 14:07 ` Timur Tabi
2015-10-26 14:07 ` Timur Tabi
2015-10-26 14:42 ` Andre Przywara
2015-10-26 14:42 ` Andre Przywara
2015-10-26 14:47 ` Timur Tabi
2015-10-26 14:47 ` Timur Tabi
2015-10-26 15:19 ` Andre Przywara
2015-10-26 15:19 ` Andre Przywara
2015-10-26 15:31 ` Timur Tabi
2015-10-26 15:31 ` Timur Tabi
2015-10-27 22:54 ` Timur Tabi
2015-10-27 22:54 ` Timur Tabi
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=55FBEE70.9090004@arm.com \
--to=andre.przywara@arm.com \
--cc=Andrew.Jackson@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jason.liu@linaro.org \
--cc=jun.nie@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=peter@hurleysoftware.com \
--cc=shawn.guo@linaro.org \
--cc=wan.zhijun@zte.com.cn \
/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.