From: Johan Hovold <johan+linaro@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Jiri Slaby" <jirislaby@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Douglas Anderson" <dianders@chromium.org>,
"'Nícolas F . R . A . Prado'" <nfraprado@collabora.com>,
linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Johan Hovold" <johan+linaro@kernel.org>
Subject: [PATCH 5/8] serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield()
Date: Mon, 2 Sep 2024 17:24:48 +0200 [thread overview]
Message-ID: <20240902152451.862-6-johan+linaro@kernel.org> (raw)
In-Reply-To: <20240902152451.862-1-johan+linaro@kernel.org>
From: Douglas Anderson <dianders@chromium.org>
With a small modification the qcom_geni_serial_poll_bit() function
could be used to poll more than just a single bit. Let's generalize
it. We'll make the qcom_geni_serial_poll_bit() into just a wrapper of
the general function.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240610152420.v4.5.Ic6411eab8d9d37acc451705f583fb535cd6dadb2@changeid
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/tty/serial/qcom_geni_serial.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 4625a2e5ebfb..7029c39a9a21 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -265,8 +265,8 @@ static bool qcom_geni_serial_secondary_active(struct uart_port *uport)
return readl(uport->membase + SE_GENI_STATUS) & S_GENI_CMD_ACTIVE;
}
-static bool qcom_geni_serial_poll_bit(struct uart_port *uport,
- unsigned int offset, u32 field, bool set)
+static bool qcom_geni_serial_poll_bitfield(struct uart_port *uport,
+ unsigned int offset, u32 field, u32 val)
{
u32 reg;
struct qcom_geni_serial_port *port;
@@ -294,7 +294,7 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport,
timeout_us = DIV_ROUND_UP(timeout_us, 10) * 10;
while (timeout_us) {
reg = readl(uport->membase + offset);
- if ((bool)(reg & field) == set)
+ if ((reg & field) == val)
return true;
udelay(10);
timeout_us -= 10;
@@ -302,6 +302,12 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport,
return false;
}
+static bool qcom_geni_serial_poll_bit(struct uart_port *uport,
+ unsigned int offset, u32 field, bool set)
+{
+ return qcom_geni_serial_poll_bitfield(uport, offset, field, set ? field : 0);
+}
+
static void qcom_geni_serial_setup_tx(struct uart_port *uport, u32 xmit_size)
{
u32 m_cmd;
--
2.44.2
next prev parent reply other threads:[~2024-09-02 15:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 15:24 [PATCH 0/8] serial: qcom-geni: fix console corruption Johan Hovold
2024-09-02 15:24 ` [PATCH 1/8] serial: qcom-geni: fix fifo polling timeout Johan Hovold
2024-09-04 21:50 ` Doug Anderson
2024-09-05 8:48 ` Johan Hovold
2024-09-06 13:23 ` Johan Hovold
2024-09-02 15:24 ` [PATCH 2/8] serial: qcom-geni: fix false console tx restart Johan Hovold
2024-09-04 21:51 ` Doug Anderson
2024-09-02 15:24 ` [PATCH 3/8] soc: qcom: geni-se: add GP_LENGTH/IRQ_EN_SET/IRQ_EN_CLEAR registers Johan Hovold
2024-09-02 15:24 ` [PATCH 4/8] serial: qcom-geni: fix arg types for qcom_geni_serial_poll_bit() Johan Hovold
2024-09-02 15:24 ` Johan Hovold [this message]
2024-09-02 15:24 ` [PATCH 6/8] serial: qcom-geni: fix console corruption Johan Hovold
2024-09-03 8:33 ` kernel test robot
2024-09-04 21:51 ` Doug Anderson
2024-09-05 8:57 ` Johan Hovold
2024-09-02 15:24 ` [PATCH 7/8] serial: qcom-geni: disable interrupts during console writes Johan Hovold
2024-09-04 21:51 ` Doug Anderson
2024-09-02 15:24 ` [PATCH 8/8] serial: qcom-geni: fix polled console corruption Johan Hovold
2024-09-04 21:51 ` Doug Anderson
2024-09-04 18:08 ` [PATCH 0/8] serial: qcom-geni: fix " Nícolas F. R. A. Prado
2024-09-05 8:15 ` Johan Hovold
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=20240902152451.862-6-johan+linaro@kernel.org \
--to=johan+linaro@kernel.org \
--cc=andersson@kernel.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=nfraprado@collabora.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