From patchwork Thu Dec 29 15:50:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F74C4167B for ; Thu, 29 Dec 2022 15:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233514AbiL2Puj (ORCPT ); Thu, 29 Dec 2022 10:50:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233403AbiL2Pui (ORCPT ); Thu, 29 Dec 2022 10:50:38 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73FF313F76 for ; Thu, 29 Dec 2022 07:50:36 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so11169761wms.0 for ; Thu, 29 Dec 2022 07:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uRwdQu5MiMvipA/jHJnFPhBPMARfFwJxa4aVOmTfNpg=; b=67dGg5+xjqMX/D0bD3SWdlDwwwKvCXeIzJHQBdkaJpKhIJbCAF9GRz8iR3gW6bF0D7 NKPeaP7a2AO+JKD+fbkHNekVmKtcGtnDoPQLtTY6qbHDYEumqhvpyAHtny7YwwHDcCSG JD5dE5eXKHxaXuhLP6YyqKF4yyJwS3o3NA5p3W7u1kZTr+ZJT4lrGs5hEMuS5iO6o/vt GIev6LVyYiORGCHre9xtjmsbINYF2OIMHCj3FBc/Im2zuoeLK4zPBQZ+7lkoDno0SLRf +ZsWFnbYamxsv/ym6lHs1QUs+N/4s5JTc/4l7U4Oi+X8PKQjWSN3ZEootpSnirmRktvn OccQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uRwdQu5MiMvipA/jHJnFPhBPMARfFwJxa4aVOmTfNpg=; b=ISWAO2jdYIDkLj358g8O3fStF3BNEUU5QSVqUQ8OAKtSCqo+JM4dMS1fhIU1mUWqcr x1rXkACNSToHRMX3dXePMTgC1SnMa9+pFh2CcEiPxUf2B3ZZr1LFJYtrZg+hib7NxwTQ KHE+KZWglIEJqWj5vWVg+026JUjLyHq4p280Flf5txYuECH+cAlDYTt5f9fCa+45gPVj RmYACOIfmeoHV2MdlfOCRUMMXxLfEJWi1bLbtLB6XQ/rMTZYRR4PllzcH8mzI5btAX0s 2EI0LWDnNhOUQHuI9kqbB4520XWEpMAOk1PpOYBNOPAT/Z8xBiNQERuAvKG69DCFBcWV UeJA== X-Gm-Message-State: AFqh2kqYhzfb5GbR5jRjFeQD8UJA5pb0mtpAzivI5+53ZBbFKnMrDY7C TkVOQneCfBVg8qX7scvvjcf4Sw== X-Google-Smtp-Source: AMrXdXvKIcEvg6Q7DVBAgfIR7uBHoLavWetAfhN1MjNJPUD9lLXqeIpajYo8Gr9zTKhTqluW2fKxLg== X-Received: by 2002:a05:600c:600a:b0:3d1:ed41:57c0 with SMTP id az10-20020a05600c600a00b003d1ed4157c0mr23663168wmb.30.1672329034988; Thu, 29 Dec 2022 07:50:34 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:34 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 01/14] tty: serial: qcom-geni-serial: stop operations in progress at shutdown Date: Thu, 29 Dec 2022 16:50:17 +0100 Message-Id: <20221229155030.418800-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski We don't stop transmissions in progress at shutdown. This is fine with FIFO SE mode but with DMA (support for which we'll introduce later) it causes trouble so fix it now. Fixes: e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown") Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index b487823f0e61..4f4c12f3c433 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -880,6 +880,8 @@ static void get_tx_fifo_size(struct qcom_geni_serial_port *port) static void qcom_geni_serial_shutdown(struct uart_port *uport) { disable_irq(uport->irq); + qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_rx(uport); } static int qcom_geni_serial_port_setup(struct uart_port *uport) From patchwork Thu Dec 29 15:50:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38934C4708D for ; Thu, 29 Dec 2022 15:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233403AbiL2Puk (ORCPT ); Thu, 29 Dec 2022 10:50:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233496AbiL2Pui (ORCPT ); Thu, 29 Dec 2022 10:50:38 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75CE213F96 for ; Thu, 29 Dec 2022 07:50:37 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so10974417wmb.2 for ; Thu, 29 Dec 2022 07:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l16P3Tz2y+nugpkt7mRQCRUw70VUrSOE7TcjuQJSFbU=; b=NQvEW5kBBBA5F9hm0a4wpWiGJoW/JaGcLszVI+f3sgRIHfdTlkRR4NirlyL/VuYQ4r 3TwLxLAd8zfJJmUYNkCybr2eht0dLGdviZ5tUmJ6Y9MDy+U5m/0e9Fzp5lg1sO7eZjkq VHSNB4wiwpkd+bC83jGDzzQsHwoQn/kqQSTVGAq5jaO7yX7eOBcvNsyDtFoa7ArFUdg5 Bcw4jO33phTGIOHszk/Bj+8kUVzE280fS6Las+pHIrwGOLG7/xXmwa94Nesvsqh8q6uE RdEpGBWIknQOPx0ZPQeIbX7fS5BaQofYelWGZF7if5dRiuRx5pwr9C3bd7dTpKa9Y/Iy 5k7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l16P3Tz2y+nugpkt7mRQCRUw70VUrSOE7TcjuQJSFbU=; b=uiaVUbQqecZxCS0vjVnylTX1AwVme5sIK06OMuLIs7nv1WvA0GV8j8LqwiFsDJodqV A2mhcKYj+y0meLG7TzycQDreyri28tDEzJYsTqBSQW/eoe4LHk6iYDYmFKAg3AHkOxT9 YljBvIukhX1j8pwmzvsmGYsnECla5n4+0DlF1FYh/3lYX3ZoeyQjEBeYOEHhsjJg6YIR UP1FrNZgKIX6T5CPMZNTeizIqTQXFH3d/OPeGez+U6U7EEtiNULASYzTcZobPWEG9FhY qV8j6zwAeP54clEKYnUc+V3ZGS4qL2BTeEuHl9pXy6e2sGic2uo9RNDPamxHjrwrkXaa Jh7A== X-Gm-Message-State: AFqh2krtyncqsXs8rfz/1ngjlZ/RmLbfQWzAfH0dWTguQVlQHr0jwKPp 4q3NjrZGUgEY18cLQ9TntWVlqA== X-Google-Smtp-Source: AMrXdXv49hd8c4QJSOvJlzqfJl3/lA/m89biejJYnkqhYdy+1YkfHjxbMWkkYJaHQ6TxAwIHcZGdaQ== X-Received: by 2002:a05:600c:254:b0:3d2:2c86:d2b2 with SMTP id 20-20020a05600c025400b003d22c86d2b2mr26204124wmj.24.1672329036024; Thu, 29 Dec 2022 07:50:36 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:35 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 02/14] tty: serial: qcom-geni-serial: drop unneeded forward definitions Date: Thu, 29 Dec 2022 16:50:18 +0100 Message-Id: <20221229155030.418800-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski If we shuffle the code a bit, we can drop all forward definitions of various static functions. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 79 +++++++++++++-------------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 4f4c12f3c433..31e0faf702a3 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -147,11 +147,6 @@ static const struct uart_ops qcom_geni_console_pops; static const struct uart_ops qcom_geni_uart_pops; static struct uart_driver qcom_geni_console_driver; static struct uart_driver qcom_geni_uart_driver; -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop); -static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop); -static unsigned int qcom_geni_serial_tx_empty(struct uart_port *port); -static void qcom_geni_serial_stop_rx(struct uart_port *uport); -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop); #define to_dev_port(ptr, member) \ container_of(ptr, struct qcom_geni_serial_port, member) @@ -590,6 +585,11 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) return ret; } +static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) +{ + return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); +} + static void qcom_geni_serial_start_tx(struct uart_port *uport) { u32 irq_en; @@ -635,25 +635,29 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); } -static void qcom_geni_serial_start_rx(struct uart_port *uport) +static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) { - u32 irq_en; u32 status; + u32 word_cnt; + u32 last_word_byte_cnt; + u32 last_word_partial; + u32 total_bytes; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); - status = readl(uport->membase + SE_GENI_STATUS); - if (status & S_GENI_CMD_ACTIVE) - qcom_geni_serial_stop_rx(uport); - - geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); - - irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); - irq_en |= S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN; - writel(irq_en, uport->membase + SE_GENI_S_IRQ_EN); + status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); + word_cnt = status & RX_FIFO_WC_MSK; + last_word_partial = status & RX_LAST; + last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> + RX_LAST_BYTE_VALID_SHFT; - irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); - irq_en |= M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN; - writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); + if (!word_cnt) + return; + total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); + if (last_word_partial && last_word_byte_cnt) + total_bytes += last_word_byte_cnt; + else + total_bytes += BYTES_PER_FIFO_WORD; + port->handle_rx(uport, total_bytes, drop); } static void qcom_geni_serial_stop_rx(struct uart_port *uport) @@ -694,29 +698,25 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) qcom_geni_serial_abort_rx(uport); } -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) +static void qcom_geni_serial_start_rx(struct uart_port *uport) { + u32 irq_en; u32 status; - u32 word_cnt; - u32 last_word_byte_cnt; - u32 last_word_partial; - u32 total_bytes; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); - status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); - word_cnt = status & RX_FIFO_WC_MSK; - last_word_partial = status & RX_LAST; - last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> - RX_LAST_BYTE_VALID_SHFT; + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + qcom_geni_serial_stop_rx(uport); - if (!word_cnt) - return; - total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); - if (last_word_partial && last_word_byte_cnt) - total_bytes += last_word_byte_cnt; - else - total_bytes += BYTES_PER_FIFO_WORD; - port->handle_rx(uport, total_bytes, drop); + geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); + + irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); + irq_en |= S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN; + writel(irq_en, uport->membase + SE_GENI_S_IRQ_EN); + + irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); + irq_en |= M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN; + writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, @@ -1125,11 +1125,6 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, qcom_geni_serial_start_rx(uport); } -static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) -{ - return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); -} - #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE static int qcom_geni_console_setup(struct console *co, char *options) { From patchwork Thu Dec 29 15:50:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FDF9C4332F for ; Thu, 29 Dec 2022 15:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233562AbiL2Pup (ORCPT ); Thu, 29 Dec 2022 10:50:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiL2Puj (ORCPT ); Thu, 29 Dec 2022 10:50:39 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6061413F9B for ; Thu, 29 Dec 2022 07:50:38 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id c65-20020a1c3544000000b003cfffd00fc0so16615618wma.1 for ; Thu, 29 Dec 2022 07:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yVGwSRNkV++8e1tKlPyV6LZX61uuumwYr0Qkw5f5jMg=; b=qdeIeDaYP+b+841I6BjiqZzY5PImnho+txhmq4D6ic7R9So491Uvy8ikcrCzHFbjGS w6t/yirz4+Bj2W3LRI+3g6ctsmi46P1nr4My7ZGj9gfSWHUQeZNMN+D6GWzVW0/LVWc6 uPhhVR+rzaCv6cc/+1l4nDsPAN4akFMsPwpHU//iejl9jKhWn5P94WffCcp3Xypar0hH 0fYoKqiPzmvQqaoVJOPjUZas2PCpaX5xFyBzlHLDlqVnDwV89jwmwyCgogm0qLQ6CE+Y uKGQcs/oBk21gA2jStWMbMY+0b8+0Fc6tpp6iSj8+FFtFLUXrjX/FRLL08ZE0BKyWPbP 2Org== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yVGwSRNkV++8e1tKlPyV6LZX61uuumwYr0Qkw5f5jMg=; b=ed5+vtR1fz9y0XJdTx+qJ90wrVwlYwvtejk4X0IxxSGZtYUrBqf/NRy75V8ev63/Ms RH/6CUMYpoL4ohdasK+bC3tCG/XnCQBcfPRLc4rtdU50h0zKO2eH9laOh6p8j0IF39oe lDrhXemtTonDGrMrAoZDNGtiXYTPDN4s+c8J/fAGvQN+LamFwIYtEaUcM0tQaqWMHiz0 MmteXteaJUjSq1hZgEb7d9SZxbZSlKp6r7lKcqL9QhhvFdwVdQYS2B99lgVG1VxwKN3G C1YX5OwjvpoIPuQGF0GZEiDnN+6miR7jiu2ljJRdblxnx7oHWFx2mjPJ/41KXr0wCYZx SxOg== X-Gm-Message-State: AFqh2kpvqtNZBGugnRcVKMXGnYUkXs2A1Sdky2cGcJdhKDjZGTLA/QvA EJSWpkxqmNOWN538h75zSkbHmQ== X-Google-Smtp-Source: AMrXdXs8bMflY8UieNb+w9TOC6QrlrG5buh/R+qN1lJfk3+bpQVgte3LGsFnxtTjKbnbKtlyScEzJQ== X-Received: by 2002:a05:600c:2183:b0:3d2:17db:d6e7 with SMTP id e3-20020a05600c218300b003d217dbd6e7mr23575377wme.20.1672329036989; Thu, 29 Dec 2022 07:50:36 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:36 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 03/14] tty: serial: qcom-geni-serial: remove unused symbols Date: Thu, 29 Dec 2022 16:50:19 +0100 Message-Id: <20221229155030.418800-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Drop all unused symbols from the driver. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 31e0faf702a3..359d9f0ba6ee 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -42,20 +42,11 @@ #define UART_TX_PAR_EN BIT(0) #define UART_CTS_MASK BIT(1) -/* SE_UART_TX_WORD_LEN */ -#define TX_WORD_LEN_MSK GENMASK(9, 0) - /* SE_UART_TX_STOP_BIT_LEN */ -#define TX_STOP_BIT_LEN_MSK GENMASK(23, 0) #define TX_STOP_BIT_LEN_1 0 -#define TX_STOP_BIT_LEN_1_5 1 #define TX_STOP_BIT_LEN_2 2 -/* SE_UART_TX_TRANS_LEN */ -#define TX_TRANS_LEN_MSK GENMASK(23, 0) - /* SE_UART_RX_TRANS_CFG */ -#define UART_RX_INS_STATUS_BIT BIT(2) #define UART_RX_PAR_EN BIT(3) /* SE_UART_RX_WORD_LEN */ @@ -66,12 +57,9 @@ /* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ #define PAR_CALC_EN BIT(0) -#define PAR_MODE_MSK GENMASK(2, 1) -#define PAR_MODE_SHFT 1 #define PAR_EVEN 0x00 #define PAR_ODD 0x01 #define PAR_SPACE 0x10 -#define PAR_MARK 0x11 /* SE_UART_MANUAL_RFR register fields */ #define UART_MANUAL_RFR_EN BIT(31) @@ -80,11 +68,8 @@ /* UART M_CMD OP codes */ #define UART_START_TX 0x1 -#define UART_START_BREAK 0x4 -#define UART_STOP_BREAK 0x5 /* UART S_CMD OP codes */ #define UART_START_READ 0x1 -#define UART_PARAM 0x1 #define UART_OVERSAMPLING 32 #define STALE_TIMEOUT 16 From patchwork Thu Dec 29 15:50:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F442C4167B for ; Thu, 29 Dec 2022 15:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbiL2Pur (ORCPT ); Thu, 29 Dec 2022 10:50:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbiL2Puk (ORCPT ); Thu, 29 Dec 2022 10:50:40 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64DE013F6E for ; Thu, 29 Dec 2022 07:50:39 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso6913549wms.5 for ; Thu, 29 Dec 2022 07:50:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pEdVYIDCyjQIozVI4BE2BvXtfHehdibvZ1uOyQg9tFw=; b=rBl5gV8tfSZs0wx8/3BCDl745B08pVzPfhtErDJtxzQwRSKqtP7V5t0N0QEJZas1HS SJLB2D7A4qv4+cpSR0A+XzRAzPlLULVRiH/XToUExR9lv0XtVzJhhvxxfyx24M7gHyFZ Y3O52tWSpFXdl/K1MgQBc4yq5+ruYA/DLvHJ9MuK4w7yAdq/j59H+1kcI2CBvPa5HQ9X YMVSJcJpcRn4LROWnLQzPqr/lWPZHVHoaBtf8vxA8jn/oI3ZMYxY0kkF2iP3H/y0Gnm+ LnL/X+JRgil9Ha/Wj8effJfxoeiLZ3M9MBY75EYNrsfwRs5BCRm++WbH/47aUN7pte05 EXVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pEdVYIDCyjQIozVI4BE2BvXtfHehdibvZ1uOyQg9tFw=; b=BapJ+yUx5qtywDAuKSYWMZ8nWICsq1u9RiswfwckOSAQtLyzV9K67VSRiJ8Ge1U37C 9rOi7ntRZTFZByTj38vG5Ode0a2E2YXP5+B84EUQZMFTgazNGZhRF22TqwbmMFxTf3Tk I3ECjRBvou3+pnJvfxWjsxMahdlPk0xKXDnAF03o6Ew7CuI/DuK+k0T38uZFf7Pcqg1Y XzFsDpFzLLcm9Dt6HPByHdahgKgP4jbHsIPl8aNYBroUe1BVlCfQvRY3p+tMxjx1X0nI Gm5RhEGFscIV/B1m4GrYATNoBCJNIXMH8Z5mCXGatFQKwjsfjKMgLF/easwqv7Is+aTN CaKQ== X-Gm-Message-State: AFqh2kpVtHcBc4A0W4cwDO3yAswRjEuXXe4+oiFllsHeITOChy8bqzV7 sIuGhRoU2KgfEEmcNqkYeLTlJA== X-Google-Smtp-Source: AMrXdXurWx7jopuz9KB4ZATRrdqs70MzxtWmuYNMxsjo46bv4aXdd8GMkbcoU6hNh+9QGB2Tu2KnsQ== X-Received: by 2002:a05:600c:b4d:b0:3d3:49db:d84 with SMTP id k13-20020a05600c0b4d00b003d349db0d84mr20148669wmr.20.1672329037892; Thu, 29 Dec 2022 07:50:37 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:37 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 04/14] tty: serial: qcom-geni-serial: align #define values Date: Thu, 29 Dec 2022 16:50:20 +0100 Message-Id: <20221229155030.418800-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Keep the #define symbols aligned for better readability. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 359d9f0ba6ee..a4a50f2a6554 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -39,57 +39,57 @@ #define SE_UART_MANUAL_RFR 0x2ac /* SE_UART_TRANS_CFG */ -#define UART_TX_PAR_EN BIT(0) -#define UART_CTS_MASK BIT(1) +#define UART_TX_PAR_EN BIT(0) +#define UART_CTS_MASK BIT(1) /* SE_UART_TX_STOP_BIT_LEN */ -#define TX_STOP_BIT_LEN_1 0 -#define TX_STOP_BIT_LEN_2 2 +#define TX_STOP_BIT_LEN_1 0 +#define TX_STOP_BIT_LEN_2 2 /* SE_UART_RX_TRANS_CFG */ -#define UART_RX_PAR_EN BIT(3) +#define UART_RX_PAR_EN BIT(3) /* SE_UART_RX_WORD_LEN */ -#define RX_WORD_LEN_MASK GENMASK(9, 0) +#define RX_WORD_LEN_MASK GENMASK(9, 0) /* SE_UART_RX_STALE_CNT */ -#define RX_STALE_CNT GENMASK(23, 0) +#define RX_STALE_CNT GENMASK(23, 0) /* SE_UART_TX_PARITY_CFG/RX_PARITY_CFG */ -#define PAR_CALC_EN BIT(0) -#define PAR_EVEN 0x00 -#define PAR_ODD 0x01 -#define PAR_SPACE 0x10 +#define PAR_CALC_EN BIT(0) +#define PAR_EVEN 0x00 +#define PAR_ODD 0x01 +#define PAR_SPACE 0x10 /* SE_UART_MANUAL_RFR register fields */ -#define UART_MANUAL_RFR_EN BIT(31) -#define UART_RFR_NOT_READY BIT(1) -#define UART_RFR_READY BIT(0) +#define UART_MANUAL_RFR_EN BIT(31) +#define UART_RFR_NOT_READY BIT(1) +#define UART_RFR_READY BIT(0) /* UART M_CMD OP codes */ -#define UART_START_TX 0x1 +#define UART_START_TX 0x1 /* UART S_CMD OP codes */ -#define UART_START_READ 0x1 - -#define UART_OVERSAMPLING 32 -#define STALE_TIMEOUT 16 -#define DEFAULT_BITS_PER_CHAR 10 -#define GENI_UART_CONS_PORTS 1 -#define GENI_UART_PORTS 3 -#define DEF_FIFO_DEPTH_WORDS 16 -#define DEF_TX_WM 2 -#define DEF_FIFO_WIDTH_BITS 32 -#define UART_RX_WM 2 +#define UART_START_READ 0x1 + +#define UART_OVERSAMPLING 32 +#define STALE_TIMEOUT 16 +#define DEFAULT_BITS_PER_CHAR 10 +#define GENI_UART_CONS_PORTS 1 +#define GENI_UART_PORTS 3 +#define DEF_FIFO_DEPTH_WORDS 16 +#define DEF_TX_WM 2 +#define DEF_FIFO_WIDTH_BITS 32 +#define UART_RX_WM 2 /* 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) +#define RX_TX_SORTED BIT(0) +#define CTS_RTS_SORTED BIT(1) +#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED) /* UART pin swap value */ -#define DEFAULT_IO_MACRO_IO0_IO1_MASK GENMASK(3, 0) +#define DEFAULT_IO_MACRO_IO0_IO1_MASK GENMASK(3, 0) #define IO_MACRO_IO0_SEL 0x3 -#define DEFAULT_IO_MACRO_IO2_IO3_MASK GENMASK(15, 4) +#define DEFAULT_IO_MACRO_IO2_IO3_MASK GENMASK(15, 4) #define IO_MACRO_IO2_IO3_SWAP 0x4640 /* We always configure 4 bytes per FIFO word */ From patchwork Thu Dec 29 15:50:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637956 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A544C4332F for ; Thu, 29 Dec 2022 15:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbiL2PvO (ORCPT ); Thu, 29 Dec 2022 10:51:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233545AbiL2Pul (ORCPT ); Thu, 29 Dec 2022 10:50:41 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A57A13F8C for ; Thu, 29 Dec 2022 07:50:40 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso6913588wms.5 for ; Thu, 29 Dec 2022 07:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oTBjJnbC2jcK/U6kcPP63swBkiUWRZWtVNKlNlvxvdA=; b=rnJLV6jDgxvrOimj+97Y/JoPHeT2PyG9CgZ0J1458YFn1neIkvZxPvnuz6+RkVb8sN YfQYgRmrvRLxddDMUkhM+wWq+fnlT6sGpKZfhnb/k3RZTBo/zGBlFtngaoP0aaVKUMRn nlL2ajXaYDl333kbdMFE6qZv0Cy7BRQ7tH+LzO29PfQkAEaLo+/0QOqwhOjyW9YB0bQ/ Qjyj70j5x+kkEs0IbwAthpNcYPHlD0bu4l6D00ecbN4f//N+Ocb96VyJXD6YLROhE7jf vtUhlv7LvFZYwbV+tnJcy46NSrufoHe+5PYcZzsSGExuw7MOhNWKcE0OBf8JU0w8v+B1 xF0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oTBjJnbC2jcK/U6kcPP63swBkiUWRZWtVNKlNlvxvdA=; b=uB0RzvA/enxeK1OQMRVp7F5qWqTYHEvrqUdlOeIFuQoON0koPcEaktIz+k05ohDusM n/W1jPsqjagJv3ZmShwcgS6bXeXbDpR9L6lKg1RHlDyba/+tUzYupK74ge8ZYPW87Ig5 JbPyByV7Ar3CIaYMLLqgomDZzw/IRfo/TwXvSMuIToA3vJWvzVKA8L0KSez0NCRz23cd bKtUy6gEgbfynfX1ydQKCjHEyVV2wEjwc7GT49mnRjCqt3uUsHov+j9XlKeY5+eVuG2D e1dL9nCinTWkRxiEw5AA+w4yhdYA/LFprOuK2aiI6Qkb9Z0nJ4n994yPT/+ZLQ/HEF3j 41LQ== X-Gm-Message-State: AFqh2koTWnVaL99wue8BwIp6STIGazr2hOOv8eVWcrbW+JAfbM/rw7UU gBDhp0B7ICG03SzT1llGU74xJw== X-Google-Smtp-Source: AMrXdXuNsTn+hIZcSw2u0mTZWw+OrvRI963yf3H80jldX7PZ0QPLNIYHDlWbY3VC3btSjdGnXFeYyg== X-Received: by 2002:a05:600c:b92:b0:3d9:779e:9788 with SMTP id fl18-20020a05600c0b9200b003d9779e9788mr11404075wmb.37.1672329038812; Thu, 29 Dec 2022 07:50:38 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:38 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 05/14] tty: serial: qcom-geni-serial: improve the to_dev_port() macro Date: Thu, 29 Dec 2022 16:50:21 +0100 Message-Id: <20221229155030.418800-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski The member we want to resolve in struct qcom_geni_serial_port is called uport so we don't need an additional redundant parameter in this macro. While at it: turn the macro into a static inline function. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 36 ++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index a4a50f2a6554..803a46ce4179 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -133,8 +133,10 @@ static const struct uart_ops qcom_geni_uart_pops; static struct uart_driver qcom_geni_console_driver; static struct uart_driver qcom_geni_uart_driver; -#define to_dev_port(ptr, member) \ - container_of(ptr, struct qcom_geni_serial_port, member) +static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) +{ + return container_of(uport, struct qcom_geni_serial_port, uport); +} static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { @@ -175,7 +177,7 @@ static struct qcom_geni_serial_port qcom_geni_console_port = { static int qcom_geni_serial_request_port(struct uart_port *uport) { struct platform_device *pdev = to_platform_device(uport->dev); - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); uport->membase = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(uport->membase)) @@ -212,7 +214,7 @@ 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); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (uart_console(uport)) return; @@ -253,7 +255,7 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, struct qcom_geni_private_data *private_data = uport->private_data; if (private_data->drv) { - port = to_dev_port(uport, uport); + port = to_dev_port(uport); baud = port->baud; if (!baud) baud = 115200; @@ -506,7 +508,7 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) u32 i; unsigned char buf[sizeof(u32)]; struct tty_port *tport; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); tport = &uport->state->port; for (i = 0; i < bytes; ) { @@ -549,7 +551,7 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { struct tty_port *tport; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 num_bytes_pw = port->tx_fifo_width / BITS_PER_BYTE; u32 words = ALIGN(bytes, num_bytes_pw) / num_bytes_pw; int ret; @@ -598,7 +600,7 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); irq_en &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); @@ -627,7 +629,7 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) u32 last_word_byte_cnt; u32 last_word_partial; u32 total_bytes; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); word_cnt = status & RX_FIFO_WC_MSK; @@ -649,7 +651,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 s_irq_status; irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN); @@ -687,7 +689,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) { u32 irq_en; u32 status; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_STATUS); if (status & S_GENI_CMD_ACTIVE) @@ -707,7 +709,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, bool active) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; size_t avail; size_t remaining; @@ -803,7 +805,7 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) struct uart_port *uport = dev; bool drop_rx = false; struct tty_port *tport = &uport->state->port; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (uport->suspended) return IRQ_NONE; @@ -871,7 +873,7 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport) static int qcom_geni_serial_port_setup(struct uart_port *uport) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); u32 rxstale = DEFAULT_BITS_PER_CHAR * STALE_TIMEOUT; u32 proto; u32 pin_swap; @@ -920,7 +922,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) static int qcom_geni_serial_startup(struct uart_port *uport) { int ret; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); if (!port->setup) { ret = qcom_geni_serial_port_setup(uport); @@ -1006,7 +1008,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, u32 stop_bit_len; unsigned int clk_div; u32 ser_clk_cfg; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); unsigned long clk_rate; u32 ver, sampling_rate; unsigned int avg_bw_core; @@ -1291,7 +1293,7 @@ static struct uart_driver qcom_geni_uart_driver = { static void qcom_geni_serial_pm(struct uart_port *uport, unsigned int new_state, unsigned int old_state) { - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + struct qcom_geni_serial_port *port = to_dev_port(uport); /* If we've never been called, treat it as off */ if (old_state == UART_PM_STATE_UNDEFINED) From patchwork Thu Dec 29 15:50:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5556C4708D for ; Thu, 29 Dec 2022 15:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233491AbiL2Puu (ORCPT ); Thu, 29 Dec 2022 10:50:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233537AbiL2Pul (ORCPT ); Thu, 29 Dec 2022 10:50:41 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41E1813E26 for ; Thu, 29 Dec 2022 07:50:40 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id o15so13397787wmr.4 for ; Thu, 29 Dec 2022 07:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DkB27LPR1wcJc7taGvEiK7AOVm/t2Nr5dcxakfWBn9k=; b=LEH6TFS3yo9QeOtdYvcsnaqBkKSh+uPUsa1dokWOiMyJAoALyxlxz2Haou9BOOx3LR dqBUCKcYJbrhmjY+CWhwZW6+zLpiGKsuFjy7LsqPOe0SwxCqSvBN4kXfJRLR40Qo017x LOmbHZ8d6R5R29SqxD6Tn+CeyIPT+UxLEHMwfcvCOQjbLd90j91FP8D6YAUp+tkOrDOz 3huBNH4ko659EKNzQ8Wk+fl6BBoWFDodYEq410F2eKpYVL/AUNXb4hMcYeqiHNTx7YsD 0PFwwA3FaIR1oyTdGFBreJ1Dc6TPcMcxv6CNRxjNe+rRMNgnt0bvbNGuIcQv3FDDhFwO w1sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DkB27LPR1wcJc7taGvEiK7AOVm/t2Nr5dcxakfWBn9k=; b=73E3IMx/LP6sPwWSeifGIz6a4+ITZSCxNfFMOMfiAMbkmTTgJ3LbWPYXOHlAJbgrU/ 2wTTaz1Rs1ckAv31diqHNdVqz663TxEevwslDiEtBSrXdFcPz9UJ6eeynOpbPbkzOWiQ EicP34eW9QNUWPm6nwbWf08CEsWKGy/OBJK+MnpT+9F+ex9qFoxTHly87Mk0SHKX30nm S2TYVnKwZYGauRqfAHGb7Nc3I4NQzrJJKRwznPx+/WmuqmSWirGr3awMJWTZ9Ie6Sn7V pnXSZHt/OSdn+KtbIyLNaFxOOnldAkSFA6ekaoMh78o3o41fSqDsSrYd+lpyaSdddam+ 10qg== X-Gm-Message-State: AFqh2kqRP6YrmAJPxgKWT2/1bqLyQtge/NbhNH/rDuwzv3LUKoHorAI8 L7uZsxcgslbhD52xsKEES7iPNA== X-Google-Smtp-Source: AMrXdXsKJDwO6zphv2uoFJnwJftPC07LYIDOtOdUdl7MRjiySXtYbWUWWA6VqMZHRPvJDsx6GTvI4A== X-Received: by 2002:a05:600c:22c4:b0:3cf:8ed7:712d with SMTP id 4-20020a05600c22c400b003cf8ed7712dmr23773442wmg.14.1672329039860; Thu, 29 Dec 2022 07:50:39 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:39 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 06/14] tty: serial: qcom-geni-serial: remove stray newlines Date: Thu, 29 Dec 2022 16:50:22 +0100 Message-Id: <20221229155030.418800-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Remove stray newlines around #ifdefs for consistency with the rest of the driver code. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 803a46ce4179..f4e2486b2115 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -320,7 +320,6 @@ static void qcom_geni_serial_abort_rx(struct uart_port *uport) } #ifdef CONFIG_CONSOLE_POLL - static int qcom_geni_serial_get_char(struct uart_port *uport) { struct qcom_geni_private_data *private_data = uport->private_data; @@ -545,7 +544,6 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { return -EPERM; } - #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) From patchwork Thu Dec 29 15:50:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C152FC4708D for ; Thu, 29 Dec 2022 15:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbiL2Pv2 (ORCPT ); Thu, 29 Dec 2022 10:51:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233418AbiL2Pup (ORCPT ); Thu, 29 Dec 2022 10:50:45 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A68185 for ; Thu, 29 Dec 2022 07:50:42 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id t15so8898420wro.9 for ; Thu, 29 Dec 2022 07:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lb0vU9ZSHO5r+oQcoBj4FnTeT47p74OitaDWVpDY66s=; b=gn0PqKEDVwLS6qBr3pmBW87z/OJoS2PNkLt64lbjK6Nxa/8tXhL1R9OyzI9Zbz6Oq2 A0tfCA/nXyS2iNmM2u1F5MAYvIe3VJArlgMbRamIjnCwHDb4uyqULqYh13vWDDnodTZ2 9xamHppbjlLKf7kA8i6j+rad3yluIUnu2qJaJKnBceUiixmZtZLVEuzjeaHlolllmRgr IZC1IKUzW1hGmOZTUdzR38vNxNN0REML789/w3e+20XkAjEJW8U9xHaeKGAfc/iBb4Ci baaarDRd6Jv1ugxZ2BqtXvf6dmrDJ1ugoon4HRdxKYQfOqzWB6OT/5nzTnKNOIeyY5Th zxUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lb0vU9ZSHO5r+oQcoBj4FnTeT47p74OitaDWVpDY66s=; b=xRJgBTnENmXztCDF/SMy7zZGMLCeHdfmJLyAta5uR6wbg7RK4vHzf/r9Up/j7m5lAV 2er5+sAVrvxzs0FQgeoPeBFds542gP57DOiPXf/txdJ+27IOtXN3X/alXTuOd7ck+Yak eMbWItzhxv/Yr2Wn5mCkexCVYzBTmCFfPlw9VmAf04dczh5KUWTLKRKqL/3Ueo+rxMkx JHLrkYXN1jSw6lnA2gLwWJHzsSXQFBjRK3/SQpzZN3CCeBOLOPBXCi+gKyyw/rDQ80Pr iCT0zRD3y52mfwVJ8leFjaDuTRXFeBZcF72UGJ5ax5R8cpaMGeivr/1K0Xmubv6OuncU ongA== X-Gm-Message-State: AFqh2krVOiMvJ2UAhp1VWBl2Te4vLdIPKVqPcvaHUddDG4Ja8YnBMol8 HmW4F6thQm77gyj9VQL2trQDng== X-Google-Smtp-Source: AMrXdXuMwy3U4WcaXrx/yBwFi2f8h1TvwwsB8sikW66om9SJvxMkB7+tLhTlNPL3H0MO7rlqfGTNPA== X-Received: by 2002:a5d:65c4:0:b0:281:24c5:a533 with SMTP id e4-20020a5d65c4000000b0028124c5a533mr7550899wrw.23.1672329040793; Thu, 29 Dec 2022 07:50:40 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:40 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 07/14] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr() Date: Thu, 29 Dec 2022 16:50:23 +0100 Message-Id: <20221229155030.418800-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Simplify the conditions in qcom_geni_serial_isr() and fix indentation. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/qcom_geni_serial.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index f4e2486b2115..92aefd4f8527 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -827,20 +827,18 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) if (m_irq_status & m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) qcom_geni_serial_handle_tx(uport, m_irq_status & M_CMD_DONE_EN, - geni_status & M_GENI_CMD_ACTIVE); + geni_status & M_GENI_CMD_ACTIVE); - if (s_irq_status & S_GP_IRQ_0_EN || s_irq_status & S_GP_IRQ_1_EN) { + if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { if (s_irq_status & S_GP_IRQ_0_EN) uport->icount.parity++; drop_rx = true; - } else if (s_irq_status & S_GP_IRQ_2_EN || - s_irq_status & S_GP_IRQ_3_EN) { + } else if (s_irq_status & (S_GP_IRQ_2_EN | S_GP_IRQ_3_EN)) { uport->icount.brk++; port->brk = true; } - if (s_irq_status & S_RX_FIFO_WATERMARK_EN || - s_irq_status & S_RX_FIFO_LAST_EN) + if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) qcom_geni_serial_handle_rx(uport, drop_rx); out_unlock: From patchwork Thu Dec 29 15:50:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58AE2C4332F for ; Thu, 29 Dec 2022 15:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233672AbiL2Pvl (ORCPT ); Thu, 29 Dec 2022 10:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233555AbiL2Pup (ORCPT ); Thu, 29 Dec 2022 10:50:45 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F69C3A6 for ; Thu, 29 Dec 2022 07:50:43 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id ay40so13429121wmb.2 for ; Thu, 29 Dec 2022 07:50:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F2MzVRg5qsZeZ18MD/OVh4kRzP+Ug6N74PqvU/3Swas=; b=Y5922RWr1l5HBO0JbK7W3Yjs7ASUaSdffFGQQEtjLvvPIEIvPMl8831AoB0e4ATkTn 6srnJDvyVx2vCYObMMJwu7Ok/5lBuhdxdlf2ucF18O2Xzt/jkCBiSyg/sMDbRM3ZBfIb PyTGmtPihb1Xvd8QhM2KhNK1UmojfHGha+kcLYu7xer8H0Y/PbrMCcLSXTiShyhl7zbs J+rOnMyw/ITsQE0l3Zg/HcmhcGwznCvl8bKx4UGEGl09jt46KxwrX59JRW5XM6a7FhIc arF5yHwcWHqKDF4d1ZCrAd+ZRF8i5Z55YG+IsQh3My0iQJ+JfXM/pzhPCCA+VN3psBr5 IMpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F2MzVRg5qsZeZ18MD/OVh4kRzP+Ug6N74PqvU/3Swas=; b=DuRnB48Vv1RHi7FNxdA25Aq7w1LyOqPV20ahn8h+VaqzApG4GpguWLRuMMznlcFCLW P8k6Jr7tRocUYMzKIb0zsjtjZU2mmPiE2dV0VCZPFGUTcqCDT/CvMx7LKyWAvS4CV9rw qiuMN35w5QgG8MJN6WUgx244k0wCjRsOTPQM6vlBZyZwZeobA1baO2+769VAYRMsjr6e XoI2J/U7cCuvZtwkcp9vvXehCADJCSsKQpK9/NoSpM9QnSd5EbO5tYnzPJUeZm7RIr7+ Ru2FIYleNCETARlma16WMNxX7UrWqoFXRNgZXsuhXTFgrFVx+n9AqUF5lTD4ZB6biKHV pKMg== X-Gm-Message-State: AFqh2ko7H+5L4b7oM+YHDeowqeD5SCuma51rXp4W6ti3jh40I1CIDtz1 lM2nwhvs3yG0VbamsCsXbS7/XA== X-Google-Smtp-Source: AMrXdXtAkLnVo2ai/aPmHEOE8d9cd2QOOnUgDCzL++zMq+TxIIn/2285ryyO5APeXNQ7SkrNT1EWjg== X-Received: by 2002:a7b:c4c8:0:b0:3d3:5a4a:9101 with SMTP id g8-20020a7bc4c8000000b003d35a4a9101mr23683301wmk.23.1672329041742; Thu, 29 Dec 2022 07:50:41 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:41 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 08/14] tty: serial: qcom-geni-serial: remove unneeded tabs Date: Thu, 29 Dec 2022 16:50:24 +0100 Message-Id: <20221229155030.418800-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Remove redundant indentation in struct member assignment. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 92aefd4f8527..e34fe56247d9 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -141,26 +141,26 @@ static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 0, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 0, }, }, [1] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 1, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 1, }, }, [2] = { .uport = { - .iotype = UPIO_MEM, - .ops = &qcom_geni_uart_pops, - .flags = UPF_BOOT_AUTOCONF, - .line = 2, + .iotype = UPIO_MEM, + .ops = &qcom_geni_uart_pops, + .flags = UPF_BOOT_AUTOCONF, + .line = 2, }, }, }; From patchwork Thu Dec 29 15:50:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA3FC4708D for ; Thu, 29 Dec 2022 15:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233692AbiL2Pvm (ORCPT ); Thu, 29 Dec 2022 10:51:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiL2Put (ORCPT ); Thu, 29 Dec 2022 10:50:49 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A159C07 for ; Thu, 29 Dec 2022 07:50:44 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id bg10so13419531wmb.1 for ; Thu, 29 Dec 2022 07:50:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WMVKrwdZWEXr4SpaY5rZECUzCmLZAbyQFJGjBVIK3cY=; b=M4K3oPLWC8XPeEjHXcBiEU120Ik7Q3MhxDOxbT6QisHcUgbXhyMnIIQVhzuXEhsnKi SOi42g9ylj8TQdeq9kuF52sBvj/8mx24DLAuRrYSbyKGnkur/8B6w/X2TeAj6t+pGK84 fR1fum/WpBxE150PCiI6gJ0nWLFaA4FMnMCcEpmU1vPfmGwwne0Rq1a32gC56qAe8Eay DJQg6pSrnYTQEKnHbwHsICnQBp4yUC3p7afEZrl2+8ptdG9i3ClZW/dstgJkOuzEr6+o fieZ1VtpPl7Obr/riPpG6Sxd6d/1q1F1zWOAqwRni9GGn+sxzDF1JW0ihLCuVnlb4JT5 IXqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WMVKrwdZWEXr4SpaY5rZECUzCmLZAbyQFJGjBVIK3cY=; b=z8id2w6Co7VKrV0IN4neveAKznoc/QEtyE/qgNUUlJ2f6yZvybxH8JdXM34Tc1XNkS ILooCgt+8446z21il4v8+xeG6fWZu2K6dXQi+GJOoNzLChvQ/4tFjBkihcClWHxBsHyf 0sYJMnuGhie7QzGRcUJXZWb4qfP/WkwaGgz6mp9rhxoDr0GXCCCmvblrf+oj+W67dhja iabW0hCuExUTled1VmU6o45znd31c2l0aNyHQZKBteJftlcfcFSumQyo7ZMqmttro27D joR4ei4bCVU5CclwjVNgKQWRRpD9HE3hHsdUOOScyAZzSf8loI/nA0jX+gNogDPedknx oi+A== X-Gm-Message-State: AFqh2krQjZgXQcYD9oe6UAgkDI4e5ojD8Ba7HAg3SXrhoQZnd4uL5HyI pqDxQBOV2CXadL5Mn76WGsk/nw== X-Google-Smtp-Source: AMrXdXt2KvdOsGmdgCgY2p4lN7SOGTNM5pDZhTjrxi31uhL0bxEl8B0zOb6NWjynO+iUA0avgVVXdg== X-Received: by 2002:a05:600c:1e10:b0:3d1:f496:e25f with SMTP id ay16-20020a05600c1e1000b003d1f496e25fmr21640763wmb.16.1672329042697; Thu, 29 Dec 2022 07:50:42 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:42 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v6 09/14] tty: serial: qcom-geni-serial: split out the FIFO tx code Date: Thu, 29 Dec 2022 16:50:25 +0100 Message-Id: <20221229155030.418800-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski qcom_geni_serial_handle_tx() is pretty big, let's move the code that handles the actual writing of data to a separate function which makes sense in preparation for introducing a dma variant of handle_tx(). Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 60 +++++++++++++++------------ 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index e34fe56247d9..bd91a6a5ad37 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -704,19 +704,48 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } +static int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, + unsigned int chunk) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + size_t remaining = chunk; + int i, tail = xmit->tail; + + for (i = 0; i < chunk; ) { + unsigned int tx_bytes; + u8 buf[sizeof(u32)]; + int c; + + memset(buf, 0, sizeof(buf)); + tx_bytes = min_t(size_t, remaining, BYTES_PER_FIFO_WORD); + + for (c = 0; c < tx_bytes ; c++) { + buf[c] = xmit->buf[tail++]; + tail &= UART_XMIT_SIZE - 1; + } + + iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); + + i += tx_bytes; + uport->icount.tx += tx_bytes; + remaining -= tx_bytes; + port->tx_remaining -= tx_bytes; + } + + return tail; +} + static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, bool active) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; size_t avail; - size_t remaining; size_t pending; - int i; u32 status; u32 irq_en; unsigned int chunk; - int tail; status = readl(uport->membase + SE_GENI_TX_FIFO_STATUS); @@ -735,7 +764,6 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, avail = port->tx_fifo_depth - (status & TX_FIFO_WC); avail *= BYTES_PER_FIFO_WORD; - tail = xmit->tail; chunk = min(avail, pending); if (!chunk) goto out_write_wakeup; @@ -750,29 +778,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uport->membase + SE_GENI_M_IRQ_EN); } - remaining = chunk; - for (i = 0; i < chunk; ) { - unsigned int tx_bytes; - u8 buf[sizeof(u32)]; - int c; - - memset(buf, 0, sizeof(buf)); - tx_bytes = min_t(size_t, remaining, BYTES_PER_FIFO_WORD); - - for (c = 0; c < tx_bytes ; c++) { - buf[c] = xmit->buf[tail++]; - tail &= UART_XMIT_SIZE - 1; - } - - iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); - - i += tx_bytes; - uport->icount.tx += tx_bytes; - remaining -= tx_bytes; - port->tx_remaining -= tx_bytes; - } - - xmit->tail = tail; + xmit->tail = qcom_geni_serial_send_chunk_fifo(uport, chunk); /* * The tx fifo watermark is level triggered and latched. Though we had From patchwork Thu Dec 29 15:50:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFEDFC4167B for ; Thu, 29 Dec 2022 15:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbiL2Pvo (ORCPT ); Thu, 29 Dec 2022 10:51:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233576AbiL2Puu (ORCPT ); Thu, 29 Dec 2022 10:50:50 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84371100B for ; Thu, 29 Dec 2022 07:50:45 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id b24-20020a05600c4a9800b003d21efdd61dso13451549wmp.3 for ; Thu, 29 Dec 2022 07:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NwBCercycDWxENvRn7oc2eoBsxPaVeGT4GXBPNhdJ8g=; b=Jzvdpkw/XzdpFAkG+Z+tcJ4DUdRteMl63kgHVvLleVIbz2q6VSIsuZayKGtEVN0xp/ Ru551p224IYpbyFIMcdWCLKGhQih//bMO5DN+c6F/sL/dC7qYetI1p0NTiwdoi0hWN2p m0ZSJHghLw6YmhNw5aHDYrN7rkC/+bC18/Y8vjyBO40kXtykn9XJenjYYrIQHGBB5OPn 5VQS1P2lRNLd87W4KzSa7Gt5rTvsPzjwmjd8D1xX+t7sQCR1NINYMuT7EWl7jXHfS3/L 8UzfyHug9AiglBcNocuqmBOrcQw9jnrG90cR7yabT7kCSrRKkIahDirX9kRwfXyH6kTi ACoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NwBCercycDWxENvRn7oc2eoBsxPaVeGT4GXBPNhdJ8g=; b=ba0wc0bQDVd4DcZSCAXkdcOvBwpgJAlLjKGKt1RRMpa3OezhRSbc1byTGnZrJWGVcx 22Oh9sGa+aU482uWXJPKMfCgIhd3ncmiI9xta/ihRc3mlBbkZ6kL/dU441kRHdd6tXtG ChQSLDfOw/ahh7SQ6O94mgi+2Ky0P5jowWl3w8N8hcR8IUKPJGCtoSzhuOk6MphMFAnv g97kO/aLqnNnfyj9RUmgDpHQ0QgVRhxw71Y4O5CXxaHAdF+qThjNMA76gBlGDdvTk2IA Nlb3EW1zChEoYJGbzEM59Rb5wVjdOccPHYg/IDgvsGTHNNSs1VPuw7zCWWZut89HTE6l 2aDw== X-Gm-Message-State: AFqh2kqBaTzJqR1LR1OtO5mwJnjumkA1buQ3VIs84/6/zDYh9kVoB/qH PgzVCPg/SL32v/77X0HxAVju0Q== X-Google-Smtp-Source: AMrXdXvOC32xwrMXSpTwy25RHomedm9W00SV+mnmjOkX6+N08DbgALpCWo/PzROMAO42429U4u2CyQ== X-Received: by 2002:a05:600c:1d89:b0:3d3:5cd6:781 with SMTP id p9-20020a05600c1d8900b003d35cd60781mr20126386wms.37.1672329043665; Thu, 29 Dec 2022 07:50:43 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:43 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v6 10/14] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_send_chunk_fifo() Date: Thu, 29 Dec 2022 16:50:26 +0100 Message-Id: <20221229155030.418800-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Shuffle the code a bit, drop unneeded variables, make types of others more consistent and use uart_xmit_advance() instead of handling tail->xmit manually. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 28 ++++++++++----------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index bd91a6a5ad37..3705c0f893a4 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -93,7 +93,7 @@ #define IO_MACRO_IO2_IO3_SWAP 0x4640 /* We always configure 4 bytes per FIFO word */ -#define BYTES_PER_FIFO_WORD 4 +#define BYTES_PER_FIFO_WORD 4U struct qcom_geni_private_data { /* NOTE: earlycon port will have NULL here */ @@ -704,36 +704,28 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } -static int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, - unsigned int chunk) +static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, + unsigned int chunk) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; - size_t remaining = chunk; - int i, tail = xmit->tail; - - for (i = 0; i < chunk; ) { - unsigned int tx_bytes; - u8 buf[sizeof(u32)]; - int c; + unsigned int tx_bytes, c, remaining = chunk; + u8 buf[BYTES_PER_FIFO_WORD]; + while (remaining) { memset(buf, 0, sizeof(buf)); - tx_bytes = min_t(size_t, remaining, BYTES_PER_FIFO_WORD); + tx_bytes = min(remaining, BYTES_PER_FIFO_WORD); for (c = 0; c < tx_bytes ; c++) { - buf[c] = xmit->buf[tail++]; - tail &= UART_XMIT_SIZE - 1; + buf[c] = xmit->buf[xmit->tail]; + uart_xmit_advance(uport, 1); } iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); - i += tx_bytes; - uport->icount.tx += tx_bytes; remaining -= tx_bytes; port->tx_remaining -= tx_bytes; } - - return tail; } static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, @@ -778,7 +770,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uport->membase + SE_GENI_M_IRQ_EN); } - xmit->tail = qcom_geni_serial_send_chunk_fifo(uport, chunk); + qcom_geni_serial_send_chunk_fifo(uport, chunk); /* * The tx fifo watermark is level triggered and latched. Though we had From patchwork Thu Dec 29 15:50:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637954 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59070C4708E for ; Thu, 29 Dec 2022 15:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233526AbiL2Pvn (ORCPT ); Thu, 29 Dec 2022 10:51:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233574AbiL2Puu (ORCPT ); Thu, 29 Dec 2022 10:50:50 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 842BFF0E for ; Thu, 29 Dec 2022 07:50:45 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id g25-20020a7bc4d9000000b003d97c8d4941so7943394wmk.4 for ; Thu, 29 Dec 2022 07:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nKmGeFAtCyk6wBb7MKS50ERYhoSBE5l1Jj0s77qCt2Y=; b=qnqdNb4kxb1jxs1Spj/pvbWBW66ZYoSxr6UxXULQWtfkOqAV51A+ul4xRGmbCBYx3F 75Jo/Kq6YKjb8ax4Y+mB9hJdRfPoDXrl/MQUruQnz6XdeyMPOKl3tLF0NcMwPODcnYLc zhnEmbuSPfq1svTG/yEm69tkznGpVk3F1WvLi4lknvoxNArcUYEOCXgNc9MhXo5tyXRr xkhkSLwUJODNH0CBp2+hD5IrvCqUeRlECBRc3Tijj+JXPQbexfX4ZP2mILJrKN+kRRhA D7zpAqASHqdRD0eh6JuZmRhIFrxMm7TaBrbVg5I66wqjfFnXXvP5hUhHN4pFc0JyZN04 E4PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nKmGeFAtCyk6wBb7MKS50ERYhoSBE5l1Jj0s77qCt2Y=; b=t7V/WPs8w1olfNJuK00KptbmkLyLUYk3jvmZLTrPwvG0ud/h0E4kMWYUTqoaYYpQYI PjAiTfbaPtJ/Hm3iO1WSB0z+UP/RvMrhqH9iRFxRHP8VuC318TfXZes2N5GZS4t0mhVn /b9YsT1CCoQPwQeV79SNqCNIIv5Rnh59v411fdEjFK97Fy3AhtUbsHF0GbAXVKF6G048 w7oS9CUEtwG/GpnUYZcyXb1ng0zHPBJz5uUq5qoTnn61qSp8IDG9fTP8+lTj5l8UZ0DL bAllu/lzRwkZ0K3r44qp30N7gd+TDtOZJTHVu3B/x+IWW6ex61+Q1j6/EOw4JF3BDCIY 9Eqw== X-Gm-Message-State: AFqh2koiPLHxRmwMdfLtSF60hXQJW5JvgT2XmWuKjNn3FMBIpERWfecA zXLpS37BW2+q6DyN6FLKpY0ZUQ== X-Google-Smtp-Source: AMrXdXtQRjHIeu0CRFLWb7kAQQMmQafohWQiZ+H9Q682c3hewHyO6M7UsBf0Fa8pxhZ++QBR8N8lUg== X-Received: by 2002:a1c:6a14:0:b0:3d1:f302:1975 with SMTP id f20-20020a1c6a14000000b003d1f3021975mr20473918wmc.33.1672329044677; Thu, 29 Dec 2022 07:50:44 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:44 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 11/14] tty: serial: qcom-geni-serial: drop the return value from handle_rx Date: Thu, 29 Dec 2022 16:50:27 +0100 Message-Id: <20221229155030.418800-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski The return value of the handle_rx() callback is never checked. Drop it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 3705c0f893a4..6daa3e205fc9 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -114,7 +114,7 @@ struct qcom_geni_serial_port { u32 tx_fifo_width; u32 rx_fifo_depth; bool setup; - int (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); + void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); unsigned int baud; void *rx_fifo; u32 loopback; @@ -502,7 +502,7 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s, spin_unlock_irqrestore(&uport->lock, flags); } -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { u32 i; unsigned char buf[sizeof(u32)]; @@ -537,16 +537,15 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) } if (!drop) tty_flip_buffer_push(tport); - return 0; } #else -static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) { - return -EPERM; + } #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ -static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) +static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { struct tty_port *tport; struct qcom_geni_serial_port *port = to_dev_port(uport); @@ -557,7 +556,7 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) tport = &uport->state->port; ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, port->rx_fifo, words); if (drop) - return 0; + return; ret = tty_insert_flip_string(tport, port->rx_fifo, bytes); if (ret != bytes) { @@ -567,7 +566,6 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) } uport->icount.rx += ret; tty_flip_buffer_push(tport); - return ret; } static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) From patchwork Thu Dec 29 15:50:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3384C4332F for ; Thu, 29 Dec 2022 15:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233576AbiL2Pvp (ORCPT ); Thu, 29 Dec 2022 10:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233577AbiL2Puu (ORCPT ); Thu, 29 Dec 2022 10:50:50 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D61116E for ; Thu, 29 Dec 2022 07:50:46 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id o15so13397984wmr.4 for ; Thu, 29 Dec 2022 07:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uBv8zHTOOLxZy2RrVYyB+getwbO3vReNF6vfPrfTbok=; b=MWfcjKD0Jfk0DPzARtgBKo9MCzAqpWQbsPxJpwmPJa8Cbqv4lBhQF4rna9DKu8oj9/ 55sPiqdse7RyR1pE99U+ZoNYJ7vke7LL4agedG+0UoTCJIZ2Ovc1ayJUuhe31STItRhn VS+/Z0Xp/fmfKcTu+ufsT9FU5Y7ZrRWgSfcIwmLwSkmSRx2C6Lqs+n1q8s+0tJMs8akW k+z+OOehqll+QKY7t1pxwDpYvK4/twBRb9dzsO+6L0GVUjZESgj+IlXgYjNXQEXwK6dh qD+eN1ZT/J1wO1ssaLZxAWWbFmOzHbwqGvTlZLSkf11TXEwwnda80OgguU9jrqLrZDFC v6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uBv8zHTOOLxZy2RrVYyB+getwbO3vReNF6vfPrfTbok=; b=U2l3MOLV1+8hKnPY5De21AooVYMf2bgrjZV1rEkgvmTZKeaMZRMts9/9U+pDkXwMgP kjlJPB+6aVj+lsCw30Q2tQQ5TFHCP5g1NJX7/Ejx8clpR8RACabIuS3OBnDPLOFebC8r 6orYrlbSJ5gj8/s6Jg4sEQaEavLHys9tulLwO+/zZKz4RQ7E8vQL7ub3Yz7dliTh8eBz 8Gz2xrBGksbdkckUbo9yDwBz1CK78qVoH6oeegy5R1nHUyrxoHfoQ2+oWgI0tgz8SVlx fyZ2yzsyi9WZL2SfVe391PN2PSHzRZoM3xM1dmAGgCQLKT6KaoVHSVzEEHao2hA69jpg ynhg== X-Gm-Message-State: AFqh2krkt7bgy6t88G/NEOJV+v3EjuGm+rd53WTRBrqT2Vvff/Y/650K Fl3MVouca4luAsAsHHlkwFZDvQ== X-Google-Smtp-Source: AMrXdXuN12YDWaVW5BV/Kt9Vm4Z13l01wSqvmdr5l7KNl6nGg4MUTTVZ7DzF1PUZc+RzBLKLP68vGg== X-Received: by 2002:a1c:4c12:0:b0:3c6:e63e:89a6 with SMTP id z18-20020a1c4c12000000b003c6e63e89a6mr20354994wmf.2.1672329045627; Thu, 29 Dec 2022 07:50:45 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:45 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 12/14] tty: serial: qcom-geni-serial: use of_device_id data Date: Thu, 29 Dec 2022 16:50:28 +0100 Message-Id: <20221229155030.418800-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Instead of checking the device compatible in probe(), assign the device-specific data to struct of_device_id. We'll use it later when providing SE DMA support. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 46 ++++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 6daa3e205fc9..0b3786040bfb 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -95,6 +95,11 @@ /* We always configure 4 bytes per FIFO word */ #define BYTES_PER_FIFO_WORD 4U +struct qcom_geni_device_data { + bool console; + void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); +}; + struct qcom_geni_private_data { /* NOTE: earlycon port will have NULL here */ struct uart_driver *drv; @@ -114,7 +119,6 @@ struct qcom_geni_serial_port { u32 tx_fifo_width; u32 rx_fifo_depth; bool setup; - void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); unsigned int baud; void *rx_fifo; u32 loopback; @@ -126,6 +130,7 @@ struct qcom_geni_serial_port { bool cts_rts_swap; struct qcom_geni_private_data private_data; + const struct qcom_geni_device_data *dev_data; }; static const struct uart_ops qcom_geni_console_pops; @@ -640,7 +645,7 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) total_bytes += last_word_byte_cnt; else total_bytes += BYTES_PER_FIFO_WORD; - port->handle_rx(uport, total_bytes, drop); + port->dev_data->handle_rx(uport, total_bytes, drop); } static void qcom_geni_serial_stop_rx(struct uart_port *uport) @@ -1346,13 +1351,14 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) struct uart_port *uport; struct resource *res; int irq; - bool console = false; struct uart_driver *drv; + const struct qcom_geni_device_data *data; - if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart")) - console = true; + data = of_device_get_match_data(&pdev->dev); + if (!data) + return -EINVAL; - if (console) { + if (data->console) { drv = &qcom_geni_console_driver; line = of_alias_get_id(pdev->dev.of_node, "serial"); } else { @@ -1362,7 +1368,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) line = of_alias_get_id(pdev->dev.of_node, "hsuart"); } - port = get_port_from_line(line, console); + port = get_port_from_line(line, data->console); if (IS_ERR(port)) { dev_err(&pdev->dev, "Invalid line %d\n", line); return PTR_ERR(port); @@ -1374,6 +1380,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return -ENODEV; uport->dev = &pdev->dev; + port->dev_data = data; port->se.dev = &pdev->dev; port->se.wrapper = dev_get_drvdata(pdev->dev.parent); port->se.clk = devm_clk_get(&pdev->dev, "se"); @@ -1392,7 +1399,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; - if (!console) { + if (!data->console) { port->rx_fifo = devm_kcalloc(uport->dev, port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); if (!port->rx_fifo) @@ -1422,7 +1429,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->irq = irq; uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE); - if (!console) + if (!data->console) port->wakeup_irq = platform_get_irq_optional(pdev, 1); if (of_property_read_bool(pdev->dev.of_node, "rx-tx-swap")) @@ -1444,7 +1451,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->private_data.drv = drv; uport->private_data = &port->private_data; platform_set_drvdata(pdev, port); - port->handle_rx = console ? handle_rx_console : handle_rx_uart; ret = uart_add_one_port(drv, uport); if (ret) @@ -1556,6 +1562,16 @@ static int qcom_geni_serial_sys_hib_resume(struct device *dev) return ret; } +static const struct qcom_geni_device_data qcom_geni_console_data = { + .console = true, + .handle_rx = handle_rx_console, +}; + +static const struct qcom_geni_device_data qcom_geni_uart_data = { + .console = false, + .handle_rx = handle_rx_uart, +}; + static const struct dev_pm_ops qcom_geni_serial_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, qcom_geni_serial_sys_resume) @@ -1564,8 +1580,14 @@ static const struct dev_pm_ops qcom_geni_serial_pm_ops = { }; static const struct of_device_id qcom_geni_serial_match_table[] = { - { .compatible = "qcom,geni-debug-uart", }, - { .compatible = "qcom,geni-uart", }, + { + .compatible = "qcom,geni-debug-uart", + .data = &qcom_geni_console_data, + }, + { + .compatible = "qcom,geni-uart", + .data = &qcom_geni_uart_data, + }, {} }; MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table); From patchwork Thu Dec 29 15:50:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7084C4167B for ; Thu, 29 Dec 2022 15:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbiL2PwA (ORCPT ); Thu, 29 Dec 2022 10:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233597AbiL2Pu5 (ORCPT ); Thu, 29 Dec 2022 10:50:57 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC78C195 for ; Thu, 29 Dec 2022 07:50:46 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id bg10so13419661wmb.1 for ; Thu, 29 Dec 2022 07:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LuwEN90AtgG+bvIlYhOJ4Y3TdxahsORXGOntfwKDvGM=; b=4kzrZQmNW5u/l4/1vb9iBZY0YVFfU2bOnHmtPuVdGbScyFaLWhKbgRrlhxtDjssfYe R7MNm+xzvPgFEyUktzm6RREID7GIjuIbqVd9h6aiB1pTwAbItO4bTjlMWru0Y97Qpk9n uMD/omxP3gOIyQScd+F25tHMNadcbCrQg1qnUVPugSBp7e5wAywlvRYJwGAcM7SGjIxt 7yZnqgJtBYb46Hy9F8CUXUwgQ+o4lnEvuMbSHAb9mHvObhlmpXFk1TDNfdjEyt+5qWg+ HQqS+NzY4O4245fiHiCHvaXsOVZGxYTssijiGTe+KICDuWgz0+ZOcNVJcPVu0uBBZ4Wf hK6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LuwEN90AtgG+bvIlYhOJ4Y3TdxahsORXGOntfwKDvGM=; b=iKwlX6JkkUVBWd0ZDur+9Ks51C/OyjrKg+xteG/9R0z0to+AFvagqWtwvXKMiIKlsE Ypv4c488j4yUiXBAi7xKXTjvW3uOEt8LWPh4Ezl2pnyLRgciG7zvswAmjgzK8yvmMrLt mkbMzT4G/s1an20oULHFcvhhmeFH1rn2EojGL+pdQdKjSjnv9bi3KiAE4Dylt/GqoSQq JgxWXWHhT/SOD2aeVzHBVr58oRPXocj+k/sS/BUikk2ELZ+fhZvgbiyojgY45kncGuao ljt56g5eHXCD0eqVssBsLoOs5jIFCKRqj2ZisfLCKd6CgnKLjIvnKvZmzy/n6ZHeJxAI wJoQ== X-Gm-Message-State: AFqh2krtbeIS4VvFK3KO/ipc3p0x+/DsjZoWbuCypDrD4jBz4XIkSrfQ 2BC1wYd8dVDgrqZcN8cGvOzaLw== X-Google-Smtp-Source: AMrXdXv/VSEhNbI3QagWbDm4m7zmgaLffIGnwbBoZ6BqvGbUS/wDYVUhT45sEgxHuItqffNN/ZwuZA== X-Received: by 2002:a05:600c:d1:b0:3d3:4d21:704d with SMTP id u17-20020a05600c00d100b003d34d21704dmr20349196wmm.14.1672329046542; Thu, 29 Dec 2022 07:50:46 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:46 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: [PATCH v6 13/14] soc: qcom-geni-se: add more symbol definitions Date: Thu, 29 Dec 2022 16:50:29 +0100 Message-Id: <20221229155030.418800-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski The following symbols will be used when adding support for SE DMA in the qcom geni serial driver. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- include/linux/qcom-geni-se.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h index f5672785c0c4..400213daa461 100644 --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -103,6 +103,7 @@ struct geni_se { #define SE_DMA_TX_FSM_RST 0xc58 #define SE_DMA_RX_IRQ_STAT 0xd40 #define SE_DMA_RX_IRQ_CLR 0xd44 +#define SE_DMA_RX_LEN_IN 0xd54 #define SE_DMA_RX_FSM_RST 0xd58 #define SE_HW_PARAM_0 0xe24 #define SE_HW_PARAM_1 0xe28 @@ -235,6 +236,8 @@ struct geni_se { #define RX_SBE BIT(2) #define RX_RESET_DONE BIT(3) #define RX_FLUSH_DONE BIT(4) +#define RX_DMA_PARITY_ERR BIT(5) +#define RX_DMA_BREAK GENMASK(8, 7) #define RX_GENI_GP_IRQ GENMASK(10, 5) #define RX_GENI_CANCEL_IRQ BIT(11) #define RX_GENI_GP_IRQ_EXT GENMASK(13, 12) From patchwork Thu Dec 29 15:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 637952 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94DDCC4332F for ; Thu, 29 Dec 2022 15:52:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233751AbiL2PwH (ORCPT ); Thu, 29 Dec 2022 10:52:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbiL2Pv1 (ORCPT ); Thu, 29 Dec 2022 10:51:27 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 040CEA3 for ; Thu, 29 Dec 2022 07:50:49 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id bg10so13419692wmb.1 for ; Thu, 29 Dec 2022 07:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xPo5nVt0Kpgd5EbSH8dlxDqDerGDGDTF8SgFZvR4FcE=; b=a0tRJHg/m6eGmTtv+MwfxFWmYta87WnxiQP0HjPqexrT+cOQICdHPPquM33MoJ7Gcq kHYOcH7RuCn9tSpgP/ryl6VV3QQfKF1S8WHUb0Ga/0tZxnBds1i9T/2tuYQbOExdZdlY /qEZctAwNqDsaFiq8LRNmSmAYSAXvKXU/THf4UgPI5giuLzJe26wIYjqcGKvS30F929F 14pyxnIkFQ+ViOOT9+7CyaiIPyxdnyQUgPjg5Bi5lxiZj0D+ilaT+BsKi5uToZYiLqzh dhdcjNt8kSa4POctMqW4aCFY24LxBNLhmAE1DV0lF/gaSPYdry6AwmEgLzHzAJ/369Xb aw8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xPo5nVt0Kpgd5EbSH8dlxDqDerGDGDTF8SgFZvR4FcE=; b=q6ix5LWc+eDx97x4/daeS9C4EuHLV2ecpy4rfFqaO5eZsMmyQTABETxGQC+v+5Pwob iFs25D8nzz2L7kO51yGN8aB/tu7mqkWx1yChgfH3zdoo2A2CJE1tdEtjVqB2hpfMEdh8 9Cx0R4MOThlBU/aDNlaPCsAUqKsKQ/8Zq57elCberuKhDoRsn9ZpiqDbuF1hfdJCyzZY rvTsrqOCnunrb5zaZ2YXw3mOI5qTTj1MmARU/dy1Qm65PEqCUT9om5NNz7yH69gqaWoN OCjKX8UlmcUHuuMtQVjAhPYM1FWi3rZfXw3QNkgMzsXqmv9xnmG0Ujf0IV4iaWzl6A9R e0gg== X-Gm-Message-State: AFqh2kq/6cuj15FGa8L6AlIpp8mciKHJKmsXDiH9y3r/OCnijrY++yhA aQghA5JghCixUSfNJWV6C8xTiQ== X-Google-Smtp-Source: AMrXdXu9fJL0PfViWmOkUMZS8SdmdtmcB9MTmicIkWTq1zjJIp6RUmuwEWOjg9epco8KJP5axgwvgg== X-Received: by 2002:a05:600c:c07:b0:3d9:73fe:96f8 with SMTP id fm7-20020a05600c0c0700b003d973fe96f8mr12625796wmb.32.1672329047454; Thu, 29 Dec 2022 07:50:47 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:8f7a:98d8:9d8d:ced8]) by smtp.gmail.com with ESMTPSA id bh12-20020a05600c3d0c00b003cfa81e2eb4sm25251647wmb.38.2022.12.29.07.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 07:50:47 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v6 14/14] tty: serial: qcom-geni-serial: add support for serial engine DMA Date: Thu, 29 Dec 2022 16:50:30 +0100 Message-Id: <20221229155030.418800-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221229155030.418800-1-brgl@bgdev.pl> References: <20221229155030.418800-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski The qcom-geni-serial driver currently only works in SE FIFO mode. This limits the UART speed to around 180 kB/s. In order to achieve higher speeds we need to use SE DMA mode. Keep the console port working in FIFO mode but extend the code to use DMA for the high-speed port. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 314 +++++++++++++++++++++----- 1 file changed, 255 insertions(+), 59 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 0b3786040bfb..c1aea9d1dc16 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -70,6 +70,8 @@ #define UART_START_TX 0x1 /* UART S_CMD OP codes */ #define UART_START_READ 0x1 +#define UART_PARAM 0x1 +#define UART_PARAM_RFR_OPEN BIT(7) #define UART_OVERSAMPLING 32 #define STALE_TIMEOUT 16 @@ -95,9 +97,11 @@ /* We always configure 4 bytes per FIFO word */ #define BYTES_PER_FIFO_WORD 4U +#define DMA_RX_BUF_SIZE 2048 + struct qcom_geni_device_data { bool console; - void (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); + enum geni_se_xfer_mode mode; }; struct qcom_geni_private_data { @@ -118,9 +122,11 @@ struct qcom_geni_serial_port { u32 tx_fifo_depth; u32 tx_fifo_width; u32 rx_fifo_depth; + dma_addr_t tx_dma_addr; + dma_addr_t rx_dma_addr; bool setup; unsigned int baud; - void *rx_fifo; + void *rx_buf; u32 loopback; bool brk; @@ -249,6 +255,16 @@ static struct qcom_geni_serial_port *get_port_from_line(int line, bool console) return port; } +static bool qcom_geni_serial_main_active(struct uart_port *uport) +{ + return readl(uport->membase + SE_GENI_STATUS) & M_GENI_CMD_ACTIVE; +} + +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, int offset, int field, bool set) { @@ -552,18 +568,11 @@ static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) static void handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) { - struct tty_port *tport; struct qcom_geni_serial_port *port = to_dev_port(uport); - u32 num_bytes_pw = port->tx_fifo_width / BITS_PER_BYTE; - u32 words = ALIGN(bytes, num_bytes_pw) / num_bytes_pw; + struct tty_port *tport = &uport->state->port; int ret; - tport = &uport->state->port; - ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, port->rx_fifo, words); - if (drop) - return; - - ret = tty_insert_flip_string(tport, port->rx_fifo, bytes); + ret = tty_insert_flip_string(tport, port->rx_buf, bytes); if (ret != bytes) { dev_err(uport->dev, "%s:Unable to push data ret %d_bytes %d\n", __func__, ret, bytes); @@ -578,16 +587,75 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport) return !readl(uport->membase + SE_GENI_TX_FIFO_STATUS); } -static void qcom_geni_serial_start_tx(struct uart_port *uport) +static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) { - u32 irq_en; - u32 status; + struct qcom_geni_serial_port *port = to_dev_port(uport); + bool done; + u32 m_irq_en; + + if (!qcom_geni_serial_main_active(uport)) + return; + + if (port->rx_dma_addr) { + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, + port->tx_remaining); + port->tx_dma_addr = 0; + port->tx_remaining = 0; + } + + m_irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); + writel(m_irq_en, uport->membase + SE_GENI_M_IRQ_EN); + geni_se_cancel_m_cmd(&port->se); + + done = qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, + S_CMD_CANCEL_EN, true); + if (!done) { + geni_se_abort_m_cmd(&port->se); + done = qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS, + M_CMD_ABORT_EN, true); + if (!done) + dev_err_ratelimited(uport->dev, "M_CMD_ABORT_EN not set"); + writel(M_CMD_ABORT_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); + } + + writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); +} + +static void qcom_geni_serial_start_tx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + unsigned int xmit_size; + int ret; + + if (port->tx_dma_addr) + return; + + xmit_size = uart_circ_chars_pending(xmit); + if (xmit_size < WAKEUP_CHARS) + uart_write_wakeup(uport); - status = readl(uport->membase + SE_GENI_STATUS); - if (status & M_GENI_CMD_ACTIVE) + xmit_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); + + qcom_geni_serial_setup_tx(uport, xmit_size); + + ret = geni_se_tx_dma_prep(&port->se, &xmit->buf[xmit->tail], + xmit_size, &port->tx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start TX SE DMA: %d\n", ret); + qcom_geni_serial_stop_tx_dma(uport); return; + } + + port->tx_remaining = xmit_size; +} + +static void qcom_geni_serial_start_tx_fifo(struct uart_port *uport) +{ + u32 irq_en; - if (!qcom_geni_serial_tx_empty(uport)) + if (qcom_geni_serial_main_active(uport) || + !qcom_geni_serial_tx_empty(uport)) return; irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); @@ -597,19 +665,17 @@ static void qcom_geni_serial_start_tx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } -static void qcom_geni_serial_stop_tx(struct uart_port *uport) +static void qcom_geni_serial_stop_tx_fifo(struct uart_port *uport) { u32 irq_en; - u32 status; struct qcom_geni_serial_port *port = to_dev_port(uport); irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); irq_en &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); writel(0, uport->membase + SE_GENI_TX_WATERMARK_REG); writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); - status = readl(uport->membase + SE_GENI_STATUS); /* Possible stop tx is called multiple times. */ - if (!(status & M_GENI_CMD_ACTIVE)) + if (!qcom_geni_serial_main_active(uport)) return; geni_se_cancel_m_cmd(&port->se); @@ -623,14 +689,13 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) writel(M_CMD_CANCEL_EN, uport->membase + SE_GENI_M_IRQ_CLEAR); } -static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) +static void qcom_geni_serial_handle_rx_fifo(struct uart_port *uport, bool drop) { u32 status; u32 word_cnt; u32 last_word_byte_cnt; u32 last_word_partial; u32 total_bytes; - struct qcom_geni_serial_port *port = to_dev_port(uport); status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); word_cnt = status & RX_FIFO_WC_MSK; @@ -645,13 +710,12 @@ static void qcom_geni_serial_handle_rx(struct uart_port *uport, bool drop) total_bytes += last_word_byte_cnt; else total_bytes += BYTES_PER_FIFO_WORD; - port->dev_data->handle_rx(uport, total_bytes, drop); + handle_rx_console(uport, total_bytes, drop); } -static void qcom_geni_serial_stop_rx(struct uart_port *uport) +static void qcom_geni_serial_stop_rx_fifo(struct uart_port *uport) { u32 irq_en; - u32 status; struct qcom_geni_serial_port *port = to_dev_port(uport); u32 s_irq_status; @@ -663,9 +727,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) irq_en &= ~(M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN); writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); - status = readl(uport->membase + SE_GENI_STATUS); - /* Possible stop rx is called multiple times. */ - if (!(status & S_GENI_CMD_ACTIVE)) + if (!qcom_geni_serial_secondary_active(uport)) return; geni_se_cancel_s_cmd(&port->se); @@ -678,23 +740,20 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); /* Flush the Rx buffer */ if (s_irq_status & S_RX_FIFO_LAST_EN) - qcom_geni_serial_handle_rx(uport, true); + qcom_geni_serial_handle_rx_fifo(uport, true); writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); - status = readl(uport->membase + SE_GENI_STATUS); - if (status & S_GENI_CMD_ACTIVE) + if (qcom_geni_serial_secondary_active(uport)) qcom_geni_serial_abort_rx(uport); } -static void qcom_geni_serial_start_rx(struct uart_port *uport) +static void qcom_geni_serial_start_rx_fifo(struct uart_port *uport) { u32 irq_en; - u32 status; struct qcom_geni_serial_port *port = to_dev_port(uport); - status = readl(uport->membase + SE_GENI_STATUS); - if (status & S_GENI_CMD_ACTIVE) - qcom_geni_serial_stop_rx(uport); + if (qcom_geni_serial_secondary_active(uport)) + qcom_geni_serial_stop_rx_fifo(uport); geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); @@ -707,6 +766,94 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } +static void qcom_geni_serial_stop_rx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + + if (!qcom_geni_serial_secondary_active(uport)) + return; + + geni_se_cancel_s_cmd(&port->se); + qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, + S_CMD_CANCEL_EN, true); + + if (qcom_geni_serial_secondary_active(uport)) + qcom_geni_serial_abort_rx(uport); + + if (port->rx_dma_addr) { + geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr, + DMA_RX_BUF_SIZE); + port->rx_dma_addr = 0; + } +} + +static void qcom_geni_serial_start_rx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + int ret; + + if (qcom_geni_serial_secondary_active(uport)) + qcom_geni_serial_stop_rx_dma(uport); + + geni_se_setup_s_cmd(&port->se, UART_START_READ, UART_PARAM_RFR_OPEN); + + ret = geni_se_rx_dma_prep(&port->se, port->rx_buf, + DMA_RX_BUF_SIZE, + &port->rx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start RX SE DMA: %d\n", ret); + qcom_geni_serial_stop_rx_dma(uport); + } +} + +static void qcom_geni_serial_handle_rx_dma(struct uart_port *uport, bool drop) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + u32 rx_in; + int ret; + + if (!qcom_geni_serial_secondary_active(uport)) + return; + + if (!port->rx_dma_addr) + return; + + geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr, DMA_RX_BUF_SIZE); + port->rx_dma_addr = 0; + + rx_in = readl(uport->membase + SE_DMA_RX_LEN_IN); + if (!rx_in) { + dev_warn(uport->dev, "serial engine reports 0 RX bytes in!\n"); + return; + } + + if (!drop) + handle_rx_uart(uport, rx_in, drop); + + ret = geni_se_rx_dma_prep(&port->se, port->rx_buf, + DMA_RX_BUF_SIZE, + &port->rx_dma_addr); + if (ret) { + dev_err(uport->dev, "unable to start RX SE DMA: %d\n", ret); + qcom_geni_serial_stop_rx_dma(uport); + } +} + +static void qcom_geni_serial_start_rx(struct uart_port *uport) +{ + uport->ops->start_rx(uport); +} + +static void qcom_geni_serial_stop_rx(struct uart_port *uport) +{ + uport->ops->stop_rx(uport); +} + +static void qcom_geni_serial_stop_tx(struct uart_port *uport) +{ + uport->ops->stop_tx(uport); +} + static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, unsigned int chunk) { @@ -731,8 +878,8 @@ static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, } } -static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, - bool active) +static void qcom_geni_serial_handle_tx_fifo(struct uart_port *uport, + bool done, bool active) { struct qcom_geni_serial_port *port = to_dev_port(uport); struct circ_buf *xmit = &uport->state->xmit; @@ -752,7 +899,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, /* All data has been transmitted and acknowledged as received */ if (!pending && !status && done) { - qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_tx_fifo(uport); goto out_write_wakeup; } @@ -795,12 +942,32 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uart_write_wakeup(uport); } +static void qcom_geni_serial_handle_tx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + struct circ_buf *xmit = &uport->state->xmit; + + uart_xmit_advance(uport, port->tx_remaining); + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); + port->tx_dma_addr = 0; + port->tx_remaining = 0; + + if (!uart_circ_empty(xmit)) + qcom_geni_serial_start_tx_dma(uport); + + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(uport); +} + static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) { u32 m_irq_en; u32 m_irq_status; u32 s_irq_status; u32 geni_status; + u32 dma; + u32 dma_tx_status; + u32 dma_rx_status; struct uart_port *uport = dev; bool drop_rx = false; struct tty_port *tport = &uport->state->port; @@ -813,10 +980,15 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) m_irq_status = readl(uport->membase + SE_GENI_M_IRQ_STATUS); s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); + dma_tx_status = readl(uport->membase + SE_DMA_TX_IRQ_STAT); + dma_rx_status = readl(uport->membase + SE_DMA_RX_IRQ_STAT); geni_status = readl(uport->membase + SE_GENI_STATUS); + dma = readl(uport->membase + SE_GENI_DMA_MODE_EN); m_irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); writel(m_irq_status, uport->membase + SE_GENI_M_IRQ_CLEAR); writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); + writel(dma_tx_status, uport->membase + SE_DMA_TX_IRQ_CLR); + writel(dma_rx_status, uport->membase + SE_DMA_RX_IRQ_CLR); if (WARN_ON(m_irq_status & M_ILLEGAL_CMD_EN)) goto out_unlock; @@ -826,10 +998,6 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) tty_insert_flip_char(tport, 0, TTY_OVERRUN); } - if (m_irq_status & m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) - qcom_geni_serial_handle_tx(uport, m_irq_status & M_CMD_DONE_EN, - geni_status & M_GENI_CMD_ACTIVE); - if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { if (s_irq_status & S_GP_IRQ_0_EN) uport->icount.parity++; @@ -839,8 +1007,35 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) port->brk = true; } - if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) - qcom_geni_serial_handle_rx(uport, drop_rx); + if (dma) { + if (dma_tx_status & TX_DMA_DONE) + qcom_geni_serial_handle_tx_dma(uport); + + if (dma_rx_status) { + if (dma_rx_status & RX_RESET_DONE) + goto out_unlock; + + if (dma_rx_status & RX_DMA_PARITY_ERR) { + uport->icount.parity++; + drop_rx = true; + } + + if (dma_rx_status & RX_DMA_BREAK) + uport->icount.brk++; + + if (dma_rx_status & (RX_DMA_DONE | RX_EOT)) + qcom_geni_serial_handle_rx_dma(uport, drop_rx); + } + } else { + if (m_irq_status & m_irq_en & + (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) + qcom_geni_serial_handle_tx_fifo(uport, + m_irq_status & M_CMD_DONE_EN, + geni_status & M_GENI_CMD_ACTIVE); + + if (s_irq_status & (S_RX_FIFO_WATERMARK_EN | S_RX_FIFO_LAST_EN)) + qcom_geni_serial_handle_rx_fifo(uport, drop_rx); + } out_unlock: uart_unlock_and_check_sysrq(uport); @@ -909,7 +1104,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) geni_se_config_packing(&port->se, BITS_PER_BYTE, BYTES_PER_FIFO_WORD, false, true, true); geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2); - geni_se_select_mode(&port->se, GENI_SE_FIFO); + geni_se_select_mode(&port->se, port->dev_data->mode); qcom_geni_serial_start_rx(uport); port->setup = true; @@ -1308,10 +1503,10 @@ static void qcom_geni_serial_pm(struct uart_port *uport, static const struct uart_ops qcom_geni_console_pops = { .tx_empty = qcom_geni_serial_tx_empty, - .stop_tx = qcom_geni_serial_stop_tx, - .start_tx = qcom_geni_serial_start_tx, - .stop_rx = qcom_geni_serial_stop_rx, - .start_rx = qcom_geni_serial_start_rx, + .stop_tx = qcom_geni_serial_stop_tx_fifo, + .start_tx = qcom_geni_serial_start_tx_fifo, + .stop_rx = qcom_geni_serial_stop_rx_fifo, + .start_rx = qcom_geni_serial_start_rx_fifo, .set_termios = qcom_geni_serial_set_termios, .startup = qcom_geni_serial_startup, .request_port = qcom_geni_serial_request_port, @@ -1329,9 +1524,10 @@ static const struct uart_ops qcom_geni_console_pops = { static const struct uart_ops qcom_geni_uart_pops = { .tx_empty = qcom_geni_serial_tx_empty, - .stop_tx = qcom_geni_serial_stop_tx, - .start_tx = qcom_geni_serial_start_tx, - .stop_rx = qcom_geni_serial_stop_rx, + .stop_tx = qcom_geni_serial_stop_tx_dma, + .start_tx = qcom_geni_serial_start_tx_dma, + .start_rx = qcom_geni_serial_start_rx_dma, + .stop_rx = qcom_geni_serial_stop_rx_dma, .set_termios = qcom_geni_serial_set_termios, .startup = qcom_geni_serial_startup, .request_port = qcom_geni_serial_request_port, @@ -1400,9 +1596,9 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; if (!data->console) { - port->rx_fifo = devm_kcalloc(uport->dev, - port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); - if (!port->rx_fifo) + port->rx_buf = devm_kzalloc(uport->dev, + DMA_RX_BUF_SIZE, GFP_KERNEL); + if (!port->rx_buf) return -ENOMEM; } @@ -1564,12 +1760,12 @@ static int qcom_geni_serial_sys_hib_resume(struct device *dev) static const struct qcom_geni_device_data qcom_geni_console_data = { .console = true, - .handle_rx = handle_rx_console, + .mode = GENI_SE_FIFO, }; static const struct qcom_geni_device_data qcom_geni_uart_data = { .console = false, - .handle_rx = handle_rx_uart, + .mode = GENI_SE_DMA, }; static const struct dev_pm_ops qcom_geni_serial_pm_ops = {