From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: geert+renesas@glider.be, magnus.damm@gmail.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, mturquette@baylibre.com,
sboyd@kernel.org, jirislaby@kernel.org, p.zabel@pengutronix.de,
lethal@linux-sh.org, g.liakhovetski@gmx.de,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
linux-serial@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v3 2/8] serial: sh-sci: Check if TX data was written to device in .tx_empty()
Date: Fri, 22 Nov 2024 10:17:46 +0200 [thread overview]
Message-ID: <bf8aa2ca-8a5e-4484-8f93-c74b7c6e0db9@tuxon.dev> (raw)
In-Reply-To: <2024112128-faceted-moonstone-027f@gregkh>
Hi, Greg,
On 21.11.2024 23:32, Greg KH wrote:
> On Fri, Nov 15, 2024 at 03:43:55PM +0200, Claudiu wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> On the Renesas RZ/G3S, when doing suspend to RAM, the uart_suspend_port()
>> is called. The uart_suspend_port() calls 3 times the
>> struct uart_port::ops::tx_empty() before shutting down the port.
>>
>> According to the documentation, the struct uart_port::ops::tx_empty()
>> API tests whether the transmitter FIFO and shifter for the port is
>> empty.
>>
>> The Renesas RZ/G3S SCIFA IP reports the number of data units stored in the
>> transmit FIFO through the FDR (FIFO Data Count Register). The data units
>> in the FIFOs are written in the shift register and transmitted from there.
>> The TEND bit in the Serial Status Register reports if the data was
>> transmitted from the shift register.
>>
>> In the previous code, in the tx_empty() API implemented by the sh-sci
>> driver, it is considered that the TX is empty if the hardware reports the
>> TEND bit set and the number of data units in the FIFO is zero.
>>
>> According to the HW manual, the TEND bit has the following meaning:
>>
>> 0: Transmission is in the waiting state or in progress.
>> 1: Transmission is completed.
>>
>> It has been noticed that when opening the serial device w/o using it and
>> then switch to a power saving mode, the tx_empty() call in the
>> uart_port_suspend() function fails, leading to the "Unable to drain
>> transmitter" message being printed on the console. This is because the
>> TEND=0 if nothing has been transmitted and the FIFOs are empty. As the
>> TEND=0 has double meaning (waiting state, in progress) we can't
>> determined the scenario described above.
>>
>> Add a software workaround for this. This sets a variable if any data has
>> been sent on the serial console (when using PIO) or if the DMA callback has
>> been called (meaning something has been transmitted). In the tx_empty()
>> API the status of the DMA transaction is also checked and if it is
>> completed or in progress the code falls back in checking the hardware
>> registers instead of relying on the software variable.
>>
>> Fixes: 73a19e4c0301 ("serial: sh-sci: Add DMA support.")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Why is this bug/regression fix burried in a long series? It should be
> sent individually so that it could be applied on its own as it is not
> related to the other ones, right?
It is related to the suspend to RAM support added in this series.
>
> Or are you ok with waiting for this to show up in 6.14-rc1?
I'll resend it individually.
Thank you,
Claudiu Beznea
>
> thanks,
>
> greg k-h
next prev parent reply other threads:[~2024-11-22 8:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 13:43 [PATCH v3 0/8] Add support for the rest of Renesas RZ/G3S serial interfaces Claudiu
2024-11-15 13:43 ` [PATCH v3 1/8] clk: renesas: r9a08g045: Add clock, reset and power domain for the remaining SCIFs Claudiu
2024-11-27 14:48 ` Geert Uytterhoeven
2024-11-15 13:43 ` [PATCH v3 2/8] serial: sh-sci: Check if TX data was written to device in .tx_empty() Claudiu
2024-11-21 21:32 ` Greg KH
2024-11-22 8:17 ` Claudiu Beznea [this message]
2024-11-27 13:47 ` Geert Uytterhoeven
2024-11-27 13:52 ` Claudiu Beznea
2024-11-15 13:43 ` [PATCH v3 3/8] serial: sh-sci: Update the suspend/resume support Claudiu
2024-11-15 15:40 ` Philipp Zabel
2024-11-18 9:47 ` Claudiu Beznea
2024-11-18 11:51 ` Philipp Zabel
2024-11-15 13:43 ` [PATCH v3 4/8] arm64: dts: renesas: r9a08g045: Add the remaining SCIF interfaces Claudiu
2024-12-06 14:30 ` Geert Uytterhoeven
2024-11-15 13:43 ` [PATCH v3 5/8] arm64: dts: renesas: rzg3s-smarc: Fix the debug serial alias Claudiu
2024-12-06 14:57 ` Geert Uytterhoeven
2024-11-15 13:43 ` [PATCH v3 6/8] arm64: dts: renesas: rzg3s-smarc-switches: Add a header to describe different switches Claudiu
2024-11-19 16:23 ` Rob Herring
2024-12-09 10:09 ` Geert Uytterhoeven
2024-12-09 12:10 ` Claudiu Beznea
2024-11-15 13:44 ` [PATCH v3 7/8] arm64: dts: renesas: rzg3s-smarc: Enable SCIF3 Claudiu
2024-12-09 10:13 ` Geert Uytterhoeven
2024-11-15 13:44 ` [PATCH v3 8/8] arm64: dts: renesas: r9a08g045s33-smarc-pmod: Add overlay for SCIF1 Claudiu
2024-12-09 10:44 ` Geert Uytterhoeven
2024-12-09 12:19 ` Claudiu Beznea
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=bf8aa2ca-8a5e-4484-8f93-c74b7c6e0db9@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=g.liakhovetski@gmx.de \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lethal@linux-sh.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
/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