From: Akash Asthana <akashast@codeaurora.org>
To: gregkh@linuxfoundation.org
Cc: swboyd@chromium.org, mgautam@codeaurora.org,
linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
Akash Asthana <akashast@codeaurora.org>
Subject: [PATCH v6 5/5] tty: serial: qcom_geni_serial: Move loopback support to TIOCM_LOOP
Date: Fri, 22 Nov 2019 14:18:24 +0000 [thread overview]
Message-ID: <0101016e937a6c00-b8cf45e5-aedf-4e03-bf23-47d7810a0b23-000000@us-west-2.amazonses.com> (raw)
In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org>
Remove code from the driver that create and maintain loopback sysfs node.
Instead use the ioctl TIOCMSET with TIOCM_LOOP argument to set HW to
loopback mode.
Signed-off-by: Akash Asthana <akashast@codeaurora.org>
---
Change in V6:
- As per stephen's comment corrected commit subject.
- As per stephen's comment defined new macros for different loopback mode.
drivers/tty/serial/qcom_geni_serial.c | 36 +++++++++--------------------------
1 file changed, 9 insertions(+), 27 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index b952509..3e84192 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -93,7 +93,11 @@
#define DEF_TX_WM 2
#define DEF_FIFO_WIDTH_BITS 32
#define UART_RX_WM 2
-#define MAX_LOOPBACK_CFG 3
+
+/* SE_UART_LOOPBACK_CFG */
+#define RX_TX_SORTED BIT(0)
+#define CTS_RTS_SORTED BIT(1)
+#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED)
#ifdef CONFIG_CONSOLE_POLL
#define CONSOLE_RX_BYTES_PW 1
@@ -165,30 +169,6 @@ static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = {
},
};
-static ssize_t loopback_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
-
- return snprintf(buf, sizeof(u32), "%d\n", port->loopback);
-}
-
-static ssize_t loopback_store(struct device *dev,
- struct device_attribute *attr, const char *buf,
- size_t size)
-{
- struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
- u32 loopback;
-
- if (kstrtoint(buf, 0, &loopback) || loopback > MAX_LOOPBACK_CFG) {
- dev_err(dev, "Invalid input\n");
- return -EINVAL;
- }
- port->loopback = loopback;
- return size;
-}
-static DEVICE_ATTR_RW(loopback);
-
static struct qcom_geni_serial_port qcom_geni_console_port = {
.uport = {
.iotype = UPIO_MEM,
@@ -238,10 +218,14 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport,
unsigned int mctrl)
{
u32 uart_manual_rfr = 0;
+ struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
if (uart_console(uport))
return;
+ if (mctrl & TIOCM_LOOP)
+ port->loopback = RX_TX_CTS_RTS_SORTED;
+
if (!(mctrl & TIOCM_RTS))
uart_manual_rfr = UART_MANUAL_RFR_EN | UART_RFR_NOT_READY;
writel(uart_manual_rfr, uport->membase + SE_UART_MANUAL_RFR);
@@ -1311,8 +1295,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
uport->private_data = drv;
platform_set_drvdata(pdev, port);
port->handle_rx = console ? handle_rx_console : handle_rx_uart;
- if (!console)
- device_create_file(uport->dev, &dev_attr_loopback);
ret = uart_add_one_port(drv, uport);
if (ret)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
next prev parent reply other threads:[~2019-11-22 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1574432266-20732-1-git-send-email-akashast@codeaurora.org>
2019-11-22 14:18 ` [PATCH v6 1/5] Revert "tty: serial: qcom_geni_serial: Wakeup over UART RX" Akash Asthana
2019-11-22 14:18 ` [PATCH v6 2/5] Revert "tty: serial: qcom_geni_serial: IRQ cleanup" Akash Asthana
2019-11-22 14:18 ` [PATCH v6 3/5] tty: serial: qcom_geni_serial: IRQ cleanup Akash Asthana
2019-11-22 18:46 ` Matthias Kaehlcke
2019-11-25 12:04 ` Akash Asthana
2019-11-22 14:18 ` [PATCH v6 4/5] tty: serial: qcom_geni_serial: Wakeup over UART RX Akash Asthana
2019-11-22 18:22 ` Stephen Boyd
2019-11-25 12:06 ` Akash Asthana
2019-11-22 19:11 ` Matthias Kaehlcke
2019-11-25 12:06 ` Akash Asthana
2019-11-22 14:18 ` Akash Asthana [this message]
2019-11-22 18:07 ` [PATCH v6 5/5] tty: serial: qcom_geni_serial: Move loopback support to TIOCM_LOOP Stephen Boyd
[not found] ` <0101016e937a3f78-11fa1469-8c73-4f56-a3de-3221dcf6f0e3-000000@us-west-2.amazonses.com>
2019-11-22 18:15 ` [PATCH v6 3/5] tty: serial: qcom_geni_serial: IRQ cleanup Stephen Boyd
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=0101016e937a6c00-b8cf45e5-aedf-4e03-bf23-47d7810a0b23-000000@us-west-2.amazonses.com \
--to=akashast@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mgautam@codeaurora.org \
--cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).