From: Jiri Slaby <jirislaby@kernel.org>
To: Konstantin Pugin <rilian.la.te@ya.ru>
Cc: krzk@kernel.org, conor@kernel.org, lkp@intel.com, vz@mleia.com,
robh@kernel.org, jcmvbkbc@gmail.com, nicolas.ferre@microchip.com,
manikanta.guntupalli@amd.com, corbet@lwn.net,
ychuang3@nuvoton.com, u.kleine-koenig@pengutronix.de,
Maarten.Brock@sttls.nl,
"Konstantin Pugin" <ria.freelander@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Herve Codina" <herve.codina@bootlin.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Hugo Villeneuve" <hvilleneuve@dimonoff.com>,
"Lech Perczak" <lech.perczak@camlingroup.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v5 3/3] serial: sc16is7xx: add support for EXAR XR20M1172 UART
Date: Mon, 22 Apr 2024 08:30:50 +0200 [thread overview]
Message-ID: <7cf31245-b2a1-419c-add6-a6a50a3f3cf1@kernel.org> (raw)
In-Reply-To: <20240420182223.1153195-4-rilian.la.te@ya.ru>
On 20. 04. 24, 20:22, Konstantin Pugin wrote:
> From: Konstantin Pugin <ria.freelander@gmail.com>
>
> XR20M1172 register set is mostly compatible with SC16IS762, but it has
> a support for additional division rates of UART with special DLD register.
> So, add handling this register by appropriate devicetree bindings.
...
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
...
> @@ -555,18 +578,43 @@ static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg)
> return reg == SC16IS7XX_RHR_REG;
> }
>
> +static bool sc16is7xx_has_dld(struct device *dev)
> +{
> + struct sc16is7xx_port *s = dev_get_drvdata(dev);
> +
> + if (s->devtype == &xr20m1172_devtype)
> + return true;
> + return false;
:) so this should simply be:
return s->devtype == &xr20m1172_devtype;
...
> @@ -1002,6 +1052,7 @@ static void sc16is7xx_set_termios(struct uart_port *port,
> const struct ktermios *old)
> {
> struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
> + bool has_dld = sc16is7xx_has_dld(port->dev);
> unsigned int lcr, flow = 0;
> int baud;
> unsigned long flags;
> @@ -1084,7 +1135,7 @@ static void sc16is7xx_set_termios(struct uart_port *port,
> /* Get baud rate generator configuration */
> baud = uart_get_baud_rate(port, termios, old,
> port->uartclk / 16 / 4 / 0xffff,
> - port->uartclk / 16);
> + port->uartclk / (has_dld ? 4 : 16));
Could you do this instead:
unsigned int divisor = sc16is7xx_has_dld(port->dev) ? 4 : 16;
...
uart_get_baud_rate(..., port->uartclk / divisor);
I am not sure the above warrants for a new version. Just in case you are
sending one.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2024-04-22 6:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 18:22 [PATCH v5 0/3] add support for EXAR XR20M1172 UAR Konstantin Pugin
2024-04-20 18:22 ` [PATCH v5 1/3] serial: sc16is7xx: announce support of SER_RS485_RTS_ON_SEND Konstantin Pugin
2024-04-20 18:22 ` [PATCH v5 2/3] dt-bindings: sc16is7xx: Add compatible line for XR20M1172 UART Konstantin Pugin
2024-04-22 11:14 ` Andy Shevchenko
2024-04-20 18:22 ` [PATCH v5 3/3] serial: sc16is7xx: add support for EXAR " Konstantin Pugin
2024-04-22 6:30 ` Jiri Slaby [this message]
2024-04-22 8:35 ` Konstantin P.
2024-04-22 11:16 ` Andy Shevchenko
2024-04-22 12:00 ` Konstantin P.
2024-04-22 17:28 ` Jiri Slaby
[not found] ` <CAF1WSuxQJ9RF-s_gdkE3W933rzXrVn6ZmHbFCawwdWufie3BZA@mail.gmail.com>
2024-04-22 20:45 ` Krzysztof Kozlowski
2024-04-22 11:25 ` Andy Shevchenko
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=7cf31245-b2a1-419c-add6-a6a50a3f3cf1@kernel.org \
--to=jirislaby@kernel.org \
--cc=Maarten.Brock@sttls.nl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor@kernel.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=herve.codina@bootlin.com \
--cc=hvilleneuve@dimonoff.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jcmvbkbc@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=krzk@kernel.org \
--cc=lech.perczak@camlingroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lkp@intel.com \
--cc=manikanta.guntupalli@amd.com \
--cc=nicolas.ferre@microchip.com \
--cc=ria.freelander@gmail.com \
--cc=rilian.la.te@ya.ru \
--cc=robh@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vz@mleia.com \
--cc=ychuang3@nuvoton.com \
/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.