From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v4 5/6] serial: 8250_em: Use pseudo offset for UART_FCR
Date: Fri, 17 Feb 2023 13:46:03 +0200 (EET) [thread overview]
Message-ID: <a893f031-b08a-638a-70e0-3e6e37e9954c@linux.intel.com> (raw)
In-Reply-To: <20230217114255.226517-6-biju.das.jz@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]
On Fri, 17 Feb 2023, Biju Das wrote:
> UART_FCR shares the same offset with UART_IIR. We cannot use
> UART_FCR in serial8250_em_serial_in() as it overlaps with
> UART_IIR.
>
> This patch introduces a macro UART_FCR_EM with a high value to
> avoid overlapping with existing UART_* register defines.
>
> This will help us to use UART_FCR_EM consistently in serial8250_em_
> serial{_in/_out} function to read/write FCR register.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> v4:
> * New patch. Used UART_FCR_EM for read/write of FCR register.
> ---
> drivers/tty/serial/8250/8250_em.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 499d7a8847ec..4165fd3bb17a 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -19,6 +19,13 @@
> #define UART_DLL_EM 9
> #define UART_DLM_EM 10
>
> +/*
> + * A high value for UART_FCR_EM avoids overlapping with existing UART_*
> + * register defines. UART_FCR_EM_HW is the real HW register offset.
> + */
> +#define UART_FCR_EM 0x10003
> +#define UART_FCR_EM_HW 3
> +
> struct serial8250_em_priv {
> int line;
> };
> @@ -29,12 +36,14 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
> case UART_TX: /* TX @ 0x00 */
> writeb(value, p->membase);
> break;
> - case UART_FCR: /* FCR @ 0x0c (+1) */
8250_port wants this to remain in place, I think. Otherwise it's attempts
to set UART_FCR will end up into wrong destination.
--
i.
> case UART_LCR: /* LCR @ 0x10 (+1) */
> case UART_MCR: /* MCR @ 0x14 (+1) */
> case UART_SCR: /* SCR @ 0x20 (+1) */
> writel(value, p->membase + ((offset + 1) << 2));
> break;
> + case UART_FCR_EM:
> + writel(value, p->membase + (UART_FCR_EM_HW << 2));
> + break;
> case UART_IER: /* IER @ 0x04 */
> value &= 0x0f; /* only 4 valid bits - not Xscale */
> fallthrough;
> @@ -54,6 +63,8 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
> case UART_MSR: /* MSR @ 0x1c (+1) */
> case UART_SCR: /* SCR @ 0x20 (+1) */
> return readl(p->membase + ((offset + 1) << 2));
> + case UART_FCR_EM:
> + return readl(p->membase + (UART_FCR_EM_HW << 2));
> case UART_IER: /* IER @ 0x04 */
> case UART_IIR: /* IIR @ 0x08 */
> case UART_DLL_EM: /* DLL @ 0x24 (+9) */
>
next prev parent reply other threads:[~2023-02-17 11:46 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 11:42 [PATCH v4 0/6] Update Renesas {EMMA mobile, RZ/V2M} UART Port type Biju Das
2023-02-17 11:42 ` [PATCH v4 1/6] serial: 8250_em: Use dev_err_probe() Biju Das
2023-02-17 14:03 ` Andy Shevchenko
2023-02-17 14:14 ` Biju Das
2023-02-17 11:42 ` [PATCH v4 2/6] serial: 8250_em: Drop slab.h Biju Das
2023-02-17 14:05 ` Andy Shevchenko
2023-02-17 14:30 ` Biju Das
2023-02-17 15:13 ` Andy Shevchenko
2023-02-17 15:17 ` Biju Das
2023-02-17 11:42 ` [PATCH v4 3/6] serial: 8250_em: Use devm_clk_get_enabled() Biju Das
2023-02-17 11:42 ` [PATCH v4 4/6] serial: 8250_em: Update port type as PORT_16750 Biju Das
2023-02-17 14:06 ` Andy Shevchenko
2023-02-17 14:53 ` Biju Das
2023-02-17 11:42 ` [PATCH v4 5/6] serial: 8250_em: Use pseudo offset for UART_FCR Biju Das
2023-02-17 11:46 ` Ilpo Järvinen [this message]
2023-02-17 11:56 ` Biju Das
2023-02-17 12:00 ` Ilpo Järvinen
2023-02-17 12:11 ` Biju Das
2023-02-17 12:42 ` Ilpo Järvinen
2023-02-17 12:58 ` Biju Das
2023-02-17 13:03 ` Ilpo Järvinen
2023-02-17 11:42 ` [PATCH v4 6/6] serial: 8250_em: Add serial8250_em_{reg_update(),out_helper()} Biju Das
2023-02-17 14:14 ` Andy Shevchenko
2023-02-17 14:35 ` Biju Das
2023-02-17 15:15 ` Andy Shevchenko
2023-02-17 15:24 ` Biju Das
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=a893f031-b08a-638a-70e0-3e6e37e9954c@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
/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;
as well as URLs for NNTP newsgroup(s).