From: Dmitry Osipenko <digetx@gmail.com>
To: Patrik John <patrik.john@u-blox.com>, linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, ldewangan@nvidia.com,
thierry.reding@gmail.com, jonathan@nvidia.com,
linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH] serial: tegra: Fixes lower tolerance baud rate limit for older tegra chips introduced by d781ec21bae6
Date: Mon, 29 Nov 2021 15:32:46 +0300 [thread overview]
Message-ID: <0165046b-c8bc-ec8e-05c7-bf9aea14339b@gmail.com> (raw)
In-Reply-To: <sig.096060f39c.20211122124425.74031-1-patrik.john@u-blox.com>
22.11.2021 15:44, Patrik John пишет:
> The current implementation uses 0 as lower limit for the baud rate tolerance which contradicts the initial commit description (https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git/commit/drivers/tty/serial/serial-tegra.c?h=for-next&id=d781ec21bae6ff8f9e07682e8947a654484611f5) of +4/-4% tolerance for older tegra chips other than Tegra186 and Tegra194.
> This causes issues on UART initilization as soon as the actual baud rate clock is slightly lower than required which we have seen on the Tegra124-based Toradex Apalis TK1 which also uses tegra30-hsuart as compatible in the DT serial node (for reference line 1540ff https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git/tree/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi?h=for-next)
>
> The standard baud rate tolerance limits are also stated in the tegra20-hsuart driver description (https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/nvidia%2Ctegra20-hsuart.txt).
>
> The previously introduced check_rate_in_range() always fails due to the lower limit set to 0 even if the actual baud rate is within the required -4% tolerance.
>
> static int tegra_check_rate_in_range(struct tegra_uart_port *tup)
> {
> long diff;
> diff = ((long)(tup->configured_rate - tup->required_rate) * 10000)
> / tup->required_rate;
> if (diff < (tup->cdata->error_tolerance_low_range * 100) ||
> diff > (tup->cdata->error_tolerance_high_range * 100)) {
> dev_err(tup->uport.dev,
> "configured baud rate is out of range by %ld", diff);
> return -EIO;
> }
> return 0;
> }
>
> Changing the lower tolerance limit to the actual -4% resolved the issues for the Tegra124 and should resolve potential issues for other Tegra20/Tegra30 based platforms as well.
Hi,
1. The text of commit message should be wrapped around 75 chars. Please
run "./scripts/checkpatch.pl example.patch" and fix all reported
problems before sending out the patch.
2. This patch should have v2 in the title. Please use the "git
format-patch -v3" next time, it will generate patch with v3 in the title.
3. Use "Link" tag and put all http links here, before the Signed-off-by
tag, like this:
Link:
https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git/commit/drivers/tty/serial/serial-tegra.c?h=for-next&id=d781ec21bae6ff8f9e07682e8947a654484611f5
Link:
https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git/tree/arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi?h=for-next
Link:
https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/nvidia%2Ctegra20-hsuart.txt
> Signed-off-by: Patrik John <patrik.john@u-blox.com>
> ---
> drivers/tty/serial/serial-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
> index 45e2e4109acd..b6223fab0687 100644
> --- a/drivers/tty/serial/serial-tegra.c
> +++ b/drivers/tty/serial/serial-tegra.c
> @@ -1506,7 +1506,7 @@ static struct tegra_uart_chip_data tegra20_uart_chip_data = {
> .fifo_mode_enable_status = false,
> .uart_max_port = 5,
> .max_dma_burst_bytes = 4,
> - .error_tolerance_low_range = 0,
> + .error_tolerance_low_range = -4,
> .error_tolerance_high_range = 4,
> };
>
> @@ -1517,7 +1517,7 @@ static struct tegra_uart_chip_data tegra30_uart_chip_data = {
> .fifo_mode_enable_status = false,
> .uart_max_port = 5,
> .max_dma_burst_bytes = 4,
> - .error_tolerance_low_range = 0,
> + .error_tolerance_low_range = -4,
> .error_tolerance_high_range = 4,
> };
>
>
next prev parent reply other threads:[~2021-11-29 13:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 12:44 Patrik John
2021-11-22 13:01 ` Greg KH
2021-11-27 23:19 ` Michał Mirosław
2021-11-29 12:33 ` Dmitry Osipenko
2021-11-29 12:32 ` Dmitry Osipenko [this message]
2021-11-29 12:36 ` Dmitry Osipenko
2021-11-30 12:17 ` Dmitry Osipenko
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=0165046b-c8bc-ec8e-05c7-bf9aea14339b@gmail.com \
--to=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=patrik.john@u-blox.com \
--cc=thierry.reding@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®