From patchwork Fri Nov 18 12:25: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: 13048177 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 772B8C4321E for ; Fri, 18 Nov 2022 12:26:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241626AbiKRM0G (ORCPT ); Fri, 18 Nov 2022 07:26:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241474AbiKRM0G (ORCPT ); Fri, 18 Nov 2022 07:26:06 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6B23976C1 for ; Fri, 18 Nov 2022 04:26:04 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id a14so9048797wru.5 for ; Fri, 18 Nov 2022 04:26:04 -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=NW75qAvpRVogQL0T7QAGtVl+SEYpXGObCi3yPFwvGso=; b=EqyvRD3fnkEs58HS1MMX5qKFpQrHn13x7ClAlbDNa0KboEO7GCK0S4b7nS7OAhLKeT d5pA1JlHIqA5uDZ5453AtnwgFjEy25mt04/RlMfEixLcMyq/8tefIWEaQs7Qfo7Gmcp1 s3X0MHBEdJ+EGYDP/9P7hQLRWqTV4nezFH/AzwzA9BAQW34JZuz7YZYA/kCnrs+TiFvx FqefR5rly249zxebdONWx4i+S+5fCU8uG8XdhkveuD9oNtoQBkACJAFaYs3OJ35DeL55 MWgPs/47rcLpZEWszfJTbRMLi93GOPdUQgcHBaoThC0j5l4a1iWx8q+Y4GFnLg6PsgM9 50Nw== 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=NW75qAvpRVogQL0T7QAGtVl+SEYpXGObCi3yPFwvGso=; b=bkhGo/3Wt/MpaYgGXV2if7BhEcjAYPruDv0+2I4hIRbrv3y1Asd2lSu+vfll837Xnc et5vhw/0Czag2bvYXBPFjwBNwvgXcrYNWGrDVWA4zBDq/HlnN+PMiBxMj7XeDc+oGygx mdzR+ledk9I6mbadQFNw5uKcidvQYHar3zdDjK5hyoM3GsICb4oLWJUCBwYngkrQ3wd3 YTS7ANOOhBNouKuW2ocu/TZUGopiHvWsN2vUYWChFL39ZgYHFNTwaSjZm89nT3kKQ/PT vCtb8JI/1ynbMG+RnvCiTguF8niPEE7QUdu6QRsV3eTnLtMHh7auxmz1LzP7565u5qQd jujg== X-Gm-Message-State: ANoB5pldJpMtSiJD3sF9kC9FpsLdKrqHa4BqK5QZBNQlHlYmHu53+a31 xiNo+Rcvox5NvO3s9zoZ7nlEw61bWR5B0A== X-Google-Smtp-Source: AA0mqf5gwSln0Qe4LaacO8yLD4GGoADA7DHRk2d/vZu5FcHfF7IDeTUrhaVrDTj+csJFbAxgCr6Fqg== X-Received: by 2002:a05:6000:78d:b0:22e:3d63:80bc with SMTP id bu13-20020a056000078d00b0022e3d6380bcmr4390469wrb.30.1668774363188; Fri, 18 Nov 2022 04:26:03 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:02 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 01/15] tty: serial: qcom-geni-serial: drop unneeded forward definitions Date: Fri, 18 Nov 2022 13:25:25 +0100 Message-Id: <20221118122539.384993-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 83b66b73303a..9f2212e7b5ec 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, @@ -1122,11 +1122,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 Fri Nov 18 12:25: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: 13048178 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 578D8C4167B for ; Fri, 18 Nov 2022 12:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241716AbiKRM0I (ORCPT ); Fri, 18 Nov 2022 07:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241571AbiKRM0G (ORCPT ); Fri, 18 Nov 2022 07:26:06 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC132976CB for ; Fri, 18 Nov 2022 04:26:05 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id g2so5342628wrv.6 for ; Fri, 18 Nov 2022 04:26:05 -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=XOBbY723QPvtzFt4pwa0mpU0HWVBeuJRMHbL1UtjHyM=; b=gQHNmX9HawS79JfeWPLjvmVeWSkxrESjRcvkQVaP6nQPzkyEUQq67QRguT7YByBaU+ lxZNjUJpiSCTS7S4bLBL+EGQjhi4wHgGb3lGzwgEUp/Hzq1IkfdyXa+7uedgIHDJXnZi tDnkzhAm1GxRuVWQFq4Jyh1cvbyTKIi2hLF5vN5qxNLtzJgTw1vp7cKiBUDNy82S6Wsi 2uHaNc6aOL4Qzf2m+UPQjXjoF6LYd5Bh4vxMrNYMjARRHiGb3F2RXxtXmSVkwsEO2sQc SeNSRSck4Sn3FGXPNw5SSSYCSPKnD2AVBGHd8N6saFOkvwDTz4ig9kVUzBEhWMDIfF6t 5wHg== 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=XOBbY723QPvtzFt4pwa0mpU0HWVBeuJRMHbL1UtjHyM=; b=rKeRW5am+5vMKrhB96DqNv7wDoJcGBx9RulcyFoR5/n1JbRtShlePi/T+MaPoA5bk7 89V34ubPj/6Y1X00zIznc+cgvvcB/Qy+a+exIccTuB0wIx4oYN7SQLtmTgF5Fjr10BXD PJF5VlXIfUQ46z+L0nBTmyW/S5YAFctd/itlv7RQgSeD9CHSaarv7UEihdln3xu+p4fL b2N18VWYGIRyJ0OvrwPNAC8gmOZION2p3VGFG2YfzY5VbljrsdZuR2NGIinTaKIuE5VT NQN59JhZd00sScoJyb/osJzDQxnAXMyAi94Ald7LegKZq9Zbr9mueLGnuMc8M8v3Z7Ol B6Pg== X-Gm-Message-State: ANoB5pnkffKehcCy0E8Daf3n3dYjJ7Vh1sR6/7S4hKJkIcJcxhmuZVKM +UExWqNhEYWgqndFZ/LBHgl8AA== X-Google-Smtp-Source: AA0mqf5CXPmfXFowF4YDMQ48wXu2gpCMtYE8nN1WpQzQaxvXUuZHyjNSLGYTeHaT50harnsxkQymRg== X-Received: by 2002:a5d:4b82:0:b0:236:84b5:2d30 with SMTP id b2-20020a5d4b82000000b0023684b52d30mr4316250wrt.591.1668774364247; Fri, 18 Nov 2022 04:26:04 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:03 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 02/15] tty: serial: qcom-geni-serial: remove unused symbols Date: Fri, 18 Nov 2022 13:25:26 +0100 Message-Id: <20221118122539.384993-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 9f2212e7b5ec..7af5df6833c7 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 Fri Nov 18 12:25: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: 13048179 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 02CBEC4332F for ; Fri, 18 Nov 2022 12:26:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241571AbiKRM0I (ORCPT ); Fri, 18 Nov 2022 07:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241437AbiKRM0H (ORCPT ); Fri, 18 Nov 2022 07:26:07 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D0F9737D for ; Fri, 18 Nov 2022 04:26:06 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id y16so8983014wrt.12 for ; Fri, 18 Nov 2022 04:26:06 -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=Ix98Buqrm8hc4zZgibw2ROra30KJmpCLaRPoOVSax6U=; b=fr2y+fgpu7yMtDfL/F6WHS15il9rZPexAjvuSgluGk58Q50xnOVM6u6jOY/KO/1xsY z0h4BK4SSg7EJEYSkG0kxrjxd1rgA+X6ACOkAllPjRlzpLsrQq0hvwHKvHKHJuOR5xU2 cZzLi6EJWcv5J0IkgWUjzxMJMKjT9OYRPIs5OE0izDQEyfjW1RzYl6QriSImMbbaYz+a 5+TVTTdxVl8vu0gTd84Is720pu7ojdK4DjYoPZxYWz3YB9KwsD0iT8Jt7cPDjEnwXfE1 /8UwXwEItbZYJxEGYmqU+eTGqdPED/DcOQ5nZ/yf6Zi90pQJuD7R8aumxus6kn1JyLm4 MnKg== 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=Ix98Buqrm8hc4zZgibw2ROra30KJmpCLaRPoOVSax6U=; b=RIk/fpZDxWDsDzFCcrZEeOP7LSw9hlaunhRamQxoS+L1UqwirsTqkZkuJ7B5e0X4DI r4h6RPfFUNIlssbuXuHh1bvKoO5XA70o9PxucGspHXHjJ7BiD93puFjgMLn2WlXi6+Um bVH6l3JI73gprBrEFUIzQfaK4gL+nl1bQE7bxtKUgn/fDpkJGys7Nv/vW7n4JGUANYL5 xETEG4FUZV7wTc5td/i+ZmHqztf2t0AQSpyMGH2cfcElrxP1Thkf+d/18r/icUgUjx/D wSo1LAIlKgn7gPvaBRn+fFMLieAN8PwgZODgejPpyGf6F8bkPdmxjuF3Wk6QJvxYthAn r9gg== X-Gm-Message-State: ANoB5plBt29694OtclnnxfNR7Tl0eaKWx5ZG1PYoiqUyuXi+74tP+YWf ZMDsYDXVDi+fsuTLmJWccISjBg== X-Google-Smtp-Source: AA0mqf4w0Sogr6egE1uHzDv9Nl0SENIbQJhiBOjTBFjUjGbvkSUShCyBnX0yw4Jf9SDeOD3OxkfGuw== X-Received: by 2002:a05:6000:1d94:b0:238:3d85:8e2c with SMTP id bk20-20020a0560001d9400b002383d858e2cmr4248475wrb.650.1668774365147; Fri, 18 Nov 2022 04:26:05 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:04 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 03/15] tty: serial: qcom-geni-serial: align #define values Date: Fri, 18 Nov 2022 13:25:27 +0100 Message-Id: <20221118122539.384993-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 7af5df6833c7..97ee7c074b79 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 Fri Nov 18 12:25: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: 13048180 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 29FAAC4332F for ; Fri, 18 Nov 2022 12:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241795AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241780AbiKRM0I (ORCPT ); Fri, 18 Nov 2022 07:26:08 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E98976CC for ; Fri, 18 Nov 2022 04:26:07 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id l14so9073576wrw.2 for ; Fri, 18 Nov 2022 04:26:07 -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=2IDPXLtOOkutc4YEs1kDSCA4Awj/+cxV2z/RqKgbcLA=; b=0yEPHWXGMIEMGGm7qbNRpxy7F8zvbYlplpNguPP1mvqn0Y3iakwqTO/ONs0OOqBU1t 1xq65nIWNlstgwiLav/4VWXp87OaKYpvUL2IX3bcKV95HZjx2E4O4RY2Zcfmi4GzevnG 1Erd0AXYTmcHA9DFiccDrBL2xca99UA+XUKoxpNDY1BKtP73Mti62zqukZZS32HoLc+G odIggvMNA/nafiS8LdxkJ8rD8rmDZWk6z6SAsig9kQaOVI+lTUZymgEw+A5VImNxe0QQ GlFwnZiU2zmULfJ/l5uyqDM6tmYA5WAiM5kl9xWA67RkOOw8svTDGESvjc6lNc0WO+yg kdXQ== 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=2IDPXLtOOkutc4YEs1kDSCA4Awj/+cxV2z/RqKgbcLA=; b=MDUOc5/hPbNBV6Q3FlpO+mvRDFg+EJX4Pitv6oSRjSjQjfePR640jnid2g6MEmM+HE yCTaJP893ruEybsVyoqhazilmJdcar6biWoMMeGDEs99bDkJSlguavGrPcgUcPt+SFnp 1j+jFfihnnEONcXPbWkhzPDeGG7JKySvUFqgkzrFSwwKxxrXbV0ZOrzmdSv30loBkeo4 pLIIH+GkSjSX8TH2gl1zRZKMbtW0smQieQp8BHlFEolc9CRYfWrbgGdVN5jL+shncyvI CtalvA2eDitWsgm7+Hs5HwqLnZhsJ4AF0m7alyHYq+chztxfzSYlo4BI/Af9nEfpaLdD qkzw== X-Gm-Message-State: ANoB5pn6B1v4zPTAOLOevUuoFRpZV8Kn1D5sH5GMmcGHrdxsK+RAVWBU 0FpM/DufrirycvoRM64YR72vvQ== X-Google-Smtp-Source: AA0mqf7WtT968SjgINAg+MszHXn+705VzNKEPW0VTe1tuS5JdYb4lXC75ijc689oRJJ/8ieaX3L/DA== X-Received: by 2002:a5d:5049:0:b0:241:bd33:4e17 with SMTP id h9-20020a5d5049000000b00241bd334e17mr2690828wrt.174.1668774366132; Fri, 18 Nov 2022 04:26:06 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:05 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 04/15] tty: serial: qcom-geni-serial: simplify the to_dev_port() macro Date: Fri, 18 Nov 2022 13:25:28 +0100 Message-Id: <20221118122539.384993-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 33 +++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 97ee7c074b79..1db2795804e9 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -133,8 +133,7 @@ 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) +#define to_dev_port(ptr) container_of(ptr, struct qcom_geni_serial_port, uport) static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { [0] = { @@ -175,7 +174,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 +211,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 +252,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 +505,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 +548,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 +597,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 +626,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 +648,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 +686,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 +706,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 +802,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; @@ -869,7 +868,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; @@ -917,7 +916,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); @@ -1003,7 +1002,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; @@ -1288,7 +1287,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 Fri Nov 18 12:25: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: 13048181 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 9BD3DC43219 for ; Fri, 18 Nov 2022 12:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241835AbiKRM0a (ORCPT ); Fri, 18 Nov 2022 07:26:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240866AbiKRM01 (ORCPT ); Fri, 18 Nov 2022 07:26:27 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A6197362 for ; Fri, 18 Nov 2022 04:26:08 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id cl5so9003266wrb.9 for ; Fri, 18 Nov 2022 04:26:08 -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=lTVRxd5tZFYcvUoBnJpH34+lxjijlQ63axYU+EIhaXk=; b=BhYh54GUE+xzT/TMuZWnyrjmyv/UsQhZctMlScPYOoyvy4C/TGMOlYbyvWZLzt/xos lOWqQqfNM+T8o3IfIe/9N0HpoFMnPdF38KUpr4N/Sg7SW74bskjcgO7Buo/9wpNgZho3 FO7NnEic/tkdb+wEC89PNJaSNh7hACaj4jHPwRb4dqWfhBS8Lju/+5HDiN7mxRi8FYq/ DtkHmNbWUux+9CD70LNDEYtuEMlg2gQSts9D2qFRkcO7pnf0V2SRcALAG1HtAYVFojO2 Lb3v8sws7nnhiZRGFRPRHD5pQ3bzj1pYbIHAhwosIPDJJ/Lm673SaRAZkQ2tz2JIZov7 tcaw== 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=lTVRxd5tZFYcvUoBnJpH34+lxjijlQ63axYU+EIhaXk=; b=Vn9l/soW4Ji60FZ1WKPmzrRAjAnz6r7D0BYNXWe+bm9ywJevYlAJNg1e6YRFgVluA3 T3ogVSccVDkVAOIBRQU5TY22K2Udfw8ehnPatXHaWkTfVvbzaphYUm6K9+lOkmWLmV0E Jtze3cTny8BbgQ65NPZD8+ZaSvVeaRnI1u8P27pC7OZ+cGS1FuNLkpdK+Vs+Lpg8oSO8 ycD/U/Q8hMlWDfoE+2p/yOnTQp7llUpPKDz6Js/RWAC88XJMNhMWFYTC4p/NnEsXyMQN u1bhHYyybQmhcQE0pvhIB8HHgMfxfpbYUmT71Z8Pw4Df0YyIyt1Y8NDdB1mdXO+v+FZg F0/g== X-Gm-Message-State: ANoB5pkDtqUvku5Rti9KE9/kuUkJyJSCdHrmI/Wkxsn8Dn4co+C3mpEY jgS/mc+wAp0dkZcd7oA2zIkmdA== X-Google-Smtp-Source: AA0mqf5iPYk7yKUwfRVq+d+rtQIV3SwGoqAMEmt0k4jMrvuEN+ublImMTsgO0pTl5epO8aXVn66pCg== X-Received: by 2002:adf:f54e:0:b0:241:c68b:6b41 with SMTP id j14-20020adff54e000000b00241c68b6b41mr223529wrp.95.1668774367058; Fri, 18 Nov 2022 04:26:07 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:06 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 05/15] tty: serial: qcom-geni-serial: remove stray newlines Date: Fri, 18 Nov 2022 13:25:29 +0100 Message-Id: <20221118122539.384993-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 1db2795804e9..dd1491a72deb 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -317,7 +317,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; @@ -542,7 +541,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 Fri Nov 18 12:25:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048184 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 627C2C433FE for ; Fri, 18 Nov 2022 12:26:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235313AbiKRM0n (ORCPT ); Fri, 18 Nov 2022 07:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241653AbiKRM01 (ORCPT ); Fri, 18 Nov 2022 07:26:27 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C49C976E4 for ; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id cl5so9003338wrb.9 for ; Fri, 18 Nov 2022 04:26:09 -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=zJiQI08Pb3pmpY28T3+Fd6ggBQFLoumFh4Lv/NyHmzg=; b=NTwSgH/pPCy0rx9k8+4HSIGh4YIOeNP51I2+IQZNCer+bRZZJMrHL4W8MOAZaSlcHa CQ3/fD/YOF7RVGFCC9csekJzz7aov9U4qd78L338s5sACCKRMpjk7BFjGdD7JViUsqKE Nc4YU02rLOIRMxsypwq3fAN7CJWgOTIE/AZHR110qhWm5SWYkZgOL2ghf/y9GdG5oQ6Z e7OYrK88Uok9baa7uaJTzMVwDpfgce8jdDZi8QKiBjpOCuNJ7x1L+2Si/dUbc1pHN2ol erzGM6k83Pov8QlyGvBpFXV3Xm6xzcPIICPjbeblWIjZRX7mbUVasH1o5J3PV/xC9OlN CS4A== 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=zJiQI08Pb3pmpY28T3+Fd6ggBQFLoumFh4Lv/NyHmzg=; b=gLZciI3V1zYTunDYGu+6oacWM02xCZjM9QbMK5pj2LHEhpNrses+HCgnMQwKX8Lk1U NY2e9dPKYoOUd8tXIvlq3fiBVhhRRHqCPgmwQpJBMr17dfcbTsBXYwGapbJK7Bv4f+eW 8zpKYkXnQf/qr7L0FBEQUZ8IbelHFNTvoDgpZ/jLhO8sC+rLL9O9AbcTBBsSN0B/LXM/ bsj8YDwVs2UO6bYp+OHEoxBLTyzmh6uvrVAY6etyGB0jnmMijmzu9igPmCMbsotwmp5q vwpUqP5bfh0hBGnknZF4LxRlpfScNzfJe5dQ217+LssS180YsrhFtkzic6UYih+1XJiR UJhw== X-Gm-Message-State: ANoB5pkWk23mLEdkzsPcVrFvCehnSrhkAyQWt3mAj/QVS2NSKFnwZLR4 /pJ1sLx1BUWiXSxnGXpuQuR5DA== X-Google-Smtp-Source: AA0mqf59q2fvpqJa3HC7aoMwXyiWX2TtLzh14/FzlTwnW6Ry65yk2a7Yc0oPWE4Kjt69fFUtNKh4dA== X-Received: by 2002:a5d:678c:0:b0:235:14dc:5e14 with SMTP id v12-20020a5d678c000000b0023514dc5e14mr4302820wru.252.1668774368100; Fri, 18 Nov 2022 04:26:08 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:07 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 06/15] tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr() Date: Fri, 18 Nov 2022 13:25:30 +0100 Message-Id: <20221118122539.384993-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 dd1491a72deb..22c1869c60f4 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -824,20 +824,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 Fri Nov 18 12:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048185 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 8CE3DC433FE for ; Fri, 18 Nov 2022 12:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241793AbiKRM0o (ORCPT ); Fri, 18 Nov 2022 07:26:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241595AbiKRM01 (ORCPT ); Fri, 18 Nov 2022 07:26:27 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE38976DB for ; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id v1so8963356wrt.11 for ; Fri, 18 Nov 2022 04:26:09 -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=vMYlxBECUyROeU2qoZzKEqhzlBfoiS2AeDouftWiN14=; b=h3ylSwylTpt/gTd5gxjRVlnohrLzxyaHkKxHSNdsMOgFdjULJkYTK9ag3H5B7bZGNF xpg0lzKa/Kdgi+wwNxNugBCVUxhRzAeEO0K9bZo5r+rixRV2dZT8E1XYBNEu5gFMBPMk u3QrTixzNo2+yRMl1tCa5RS9oH4RsO/lSqL1j8ZDZ+J1rahMob66xdS+/rt/GuPB8Fa0 /MnLjQYgrfLogwNpXSQwcE4A3zNxtyujkrgVt9k5TS5qYNyuHkGAJQeOPW+XFCv5Erio Cw+8ATnanhtooLYJuYJCabSEaLbnbmt3/ey5xxHhjF+06VG3BizN8UcivtyLeLRJEKaH BL9g== 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=vMYlxBECUyROeU2qoZzKEqhzlBfoiS2AeDouftWiN14=; b=r1ZEybUrfAiQ/yc8Inuj1qh0TJRm4KwMJYHoJ+KzPg/RIuzhp0gDbqRx+Ux5FSJJhX KxnsD9WVaEZ5Odtm6tydl0lYjYLSdswlY6L/fyGcRkpUNi4d5yUveZHmnhR1RLXsvy5B B2nL1lBkFTnjXrRVvC/IsiSTbza6pvL2yXIUY1dZxR53XF1RQOhCpft0U43OGCAwBgwb WUKCzyHxI8oBubUXAygIhclySTF/CXMQ9D+dCbXwCh24DsXwvpinpGxYe7dTVgfpyvzw 5R+6cYpXVe3bnjYrEEFImwYwvobVNV2NdBDKn4ajrdkh1gMP/v/VgibM5ziG5WjsrJn8 m9BA== X-Gm-Message-State: ANoB5pnNRg1RRd6ixsvY7kt3hqtu65I/owBk4fIvgPZmc+Kp9VyO3+Mv foZXP0MNoSuBzK/IW6J5Y6N64g== X-Google-Smtp-Source: AA0mqf6XQpZNIv4JSPh2Iy9S4x4cMT6r1bE9lJXiqxSKL5yWDvqbOxuNaKATf/tjq89JAK0wQcExfA== X-Received: by 2002:a5d:408b:0:b0:236:53d2:1668 with SMTP id o11-20020a5d408b000000b0023653d21668mr4185721wrp.694.1668774369037; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:08 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 07/15] tty: serial: qcom-geni-serial: remove unneeded tabs Date: Fri, 18 Nov 2022 13:25:31 +0100 Message-Id: <20221118122539.384993-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 22c1869c60f4..39041538e5d2 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -138,26 +138,26 @@ static struct uart_driver qcom_geni_uart_driver; 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 Fri Nov 18 12:25:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048182 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 7FB14C4332F for ; Fri, 18 Nov 2022 12:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241115AbiKRM0d (ORCPT ); Fri, 18 Nov 2022 07:26:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241789AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660D9976C6 for ; Fri, 18 Nov 2022 04:26:10 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id j15so8354683wrq.3 for ; Fri, 18 Nov 2022 04:26:10 -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=TjRlvG98zfN2Bv4vCWR93fi5oSZzdVfhIH1TmLO20G0=; b=36jVyEZd8EBGn2gTFQTK9zvR7p60sA28fQEhTDPQkMGJJHXxRHDUQMpVvb0zR13FV2 LlhDzZc2eq4elS+3dSlFJhPCsYMO4ysrInRywPesrz74OhM1fKA/UR8xP1zchHCEtmf9 z7TAkuZMQmwtONuwkRfaNivre/GuU5iAD1wVXTTKHOODkNQ7bUvQtgNR8NEVjwffK2L9 dCQ71ySN60tAvZdJ64b91DGXG+Nsr1ur9E+5BzZWzJDZrior1vYifXlXv+YGF9IlO0xu ZICuIwAgfWie1nj2tZtVG7tTtbDfB7uwNLt8ebWFJITia3CYwIkBYDRPXSvFkEM2hHNY HRpw== 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=TjRlvG98zfN2Bv4vCWR93fi5oSZzdVfhIH1TmLO20G0=; b=cNTnFGrgelY0wmC9clm2ilN0WnHAB/ULkKO5C4EBxDnM8iAjfWLhijCnfz96+pIAdt O8vC/4yL0yXmEQkNCXOnRqFH+j6vKza2swSkE2/Vuey2R8buW+5nXOqFQlNeMCxrPva4 U5Dggrwhj5uh7mi2zrdRRA8XrR8FAoKHrchNELpTtD7VJ6lqfvzz7NcVp100kzH8LkQj 0BESjIIQkqSwFXnMsLPr8bCqR2A4BssIRwQZwcZv7yUth/DbORJNOSoEveJ6eTFR62aG +FAt1d9L4wEnxCeLRaiu3RQsJKmjup0tpn+hb85y0UvwhCAqh924eDCpH9QtkD5gaLIh oa/g== X-Gm-Message-State: ANoB5pkt0pTMoPI0CofEfFLcqcDfZtnmVof4SM1bodvU+y0O60PZwlg0 +viWNRSKvVlJZc3uYCKOY3Vqgw== X-Google-Smtp-Source: AA0mqf57fnDTjxB5aWudsk/YGYhkImBz+5yBS/ycBe5HGZj/d3SfUBQlOu3aU5zXKQbj9Ju5Ob5Pkw== X-Received: by 2002:adf:f805:0:b0:236:ef0b:68c5 with SMTP id s5-20020adff805000000b00236ef0b68c5mr4316797wrp.373.1668774369979; Fri, 18 Nov 2022 04:26:09 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:09 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 08/15] tty: serial: qcom-geni-serial: split out the FIFO tx code Date: Fri, 18 Nov 2022 13:25:32 +0100 Message-Id: <20221118122539.384993-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 Reviewed-by: Konrad Dybcio --- 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 39041538e5d2..4b155ca0ac74 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -701,19 +701,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); @@ -732,7 +761,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; @@ -747,29 +775,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 Fri Nov 18 12:25:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048183 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 C6ECDC4332F for ; Fri, 18 Nov 2022 12:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235268AbiKRM0l (ORCPT ); Fri, 18 Nov 2022 07:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241793AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59E5B976FE for ; Fri, 18 Nov 2022 04:26:11 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id a14so9049286wru.5 for ; Fri, 18 Nov 2022 04:26:11 -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=pF1K9Osvm2bfxV7B3KPTmbXBc6bO2Z5qPB/LIZda4KU=; b=CxzI5e9N5IVV6UCsvmfkxAyhT/XdAotthqZtvueaQdC/kcNGJNscZX+6tGcAM4V6Pe EAhGgvhwvKRispf0xbrhrVd3lWFN8luWYVNjQ33vNr/niFWXQ0vdS4SGgjAp37f0goIY 3h1A/JAIJH9o46Sfq4OoIcTZCzWJ7or2/TjzXCWh7I0wLqFfw8JQQhwTpqbIBlhRT8mW lyHA6uue5Kvf3hlOZW7hSn1zgP7ZHq0dQCeFAl4OCxkLm6RhbpGWhZZ5J0+Crm8PlA5J 8luF2weu1CWp8n0yyZ/n/5tSas/gLib7hteSOR7EEtfTUw77XE2GtH6HMnjj4dnourDh RxgA== 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=pF1K9Osvm2bfxV7B3KPTmbXBc6bO2Z5qPB/LIZda4KU=; b=JuzIC7C8fxjyM7Jx5fZCIih/Op0f2z4ZG1KSiMLnP6THTDRKFWRg0bXgFt4ybXfxaq F75L701Lg+mvmov3BjDW5qpaesHxgl/E5lMPgftHInlIlBKREVBgTT1P8lLeFTewEoXm hBDV2FY4YmV3+FUSJ5/hXXJ/2668QTaSiQ/mYsSNYQY++FQmwx1VkjIXq6kuUHWK+o8U AoWEYz8vGHwjyC1ZC4Kj/T673M0xb8gpLsJHq4eunR7IFfQ4IUM73SWAa/Y63Xe3CQOZ cUoOheiFFF7R7KoctmLx2zrv+oNOGLlOO4Gj9042Iq8KicY3qZYTDPLpHR3q2zKHKQNu w2NQ== X-Gm-Message-State: ANoB5pn1ev1vryQVmkXOvvcRAxKjF1K63mGwwI4qa1YWsJkTsHdWPR86 nwyEAQ1gZrSVvWK1KsF1Ph8KHQ== X-Google-Smtp-Source: AA0mqf62NToJtguB/effj1ssvAbUmdtDlXIOSFaU/pbCO/XUA3+Wm0tCpH6C0v/sBB6nX0Gt77n5Lw== X-Received: by 2002:adf:f6cb:0:b0:236:7a11:b061 with SMTP id y11-20020adff6cb000000b002367a11b061mr4394865wrp.292.1668774370893; Fri, 18 Nov 2022 04:26:10 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:10 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 09/15] tty: serial: qcom-geni-serial: drop the return value from handle_rx Date: Fri, 18 Nov 2022 13:25:33 +0100 Message-Id: <20221118122539.384993-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 4b155ca0ac74..72d0e7b91080 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; @@ -499,7 +499,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)]; @@ -534,16 +534,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); @@ -554,7 +553,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) { @@ -564,7 +563,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 Fri Nov 18 12:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048186 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 9DF09C43219 for ; Fri, 18 Nov 2022 12:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239958AbiKRM0o (ORCPT ); Fri, 18 Nov 2022 07:26:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241802AbiKRM03 (ORCPT ); Fri, 18 Nov 2022 07:26:29 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40FFE97AA9 for ; Fri, 18 Nov 2022 04:26:12 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id d9so8986140wrm.13 for ; Fri, 18 Nov 2022 04:26:12 -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=+vWdaRfhODAgXHbciwp5dedPQgtHL42vE9HPN7sV7Xo=; b=A3I9ebSn8MP5IHCkR+JU5No+kasmCPdQLMoUahVY7mTEMzWGkac6JsvBdCbC1srPAV PgzWDHNYqpDHW2tSapQU8V6Q65C7xcYlcP7Ft4Da6Xin20coIt6uEEvxJjibMd0+UA1+ esO+UwnxJTpphcJBdMD/4TzOn+6br3VLlg7CGm5QEO9OvSX/A2Jio5wq3iJXD8/9A7QF MdDtuKQUwEu7AV5W77SShOuhPh61NRsDoFsxB4pWpjX6y54U/IjeBENl2SPhz3nsNFU0 gL4A3Pa6nN/wOEFFhJ6lVTdTjyAJOrjhpQeAiVoJYVJPmSMopMyxq/jM1fhiCQH3a3po XIHw== 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=+vWdaRfhODAgXHbciwp5dedPQgtHL42vE9HPN7sV7Xo=; b=Pwi0kVmKnXxwBOgKm7Nj10NY6PYejNvG6tEMK+JzcNcccH/cUPzc7UpGmoSHOTy0ML WMI95FPHXVPwA+jZHhAgYJRtamzlZJRbbF8nn1rvJgdiuvlPJuTAl5W0sY6EQk4HRq5U HiM+mOtTQMk1XXURY0fVpHbLu9gYOb+QN5eVb/YMn8uuJypIp5lT+aGDsA690RC3N7q8 9a+ELGY9lWO9gdDu2ZXwwU0/JhRs+3ceLHKosl5VPMJ2AjFhlw2pwoacXYyngwfV5jb1 G/3jmqaW9jFbtfbH0GLr1XrN4rou84Jv1Oq2LGtSzeLXbPbC84bqiaQxExrsEVy/oB6b y4QQ== X-Gm-Message-State: ANoB5pluI7SWsJz7mujksigDMYYdDVCXMmRnztRYW0QgsnrydcCooZWN Vd477w8r+kNst3q+f8jaANRQXg== X-Google-Smtp-Source: AA0mqf7l4ohCXSbvIrJEfqskYR10y/kYOB+EHCDQFgKeyVGUxpV5cEBI4E5PXAKVzSL0bR9M6qsU/g== X-Received: by 2002:a5d:6107:0:b0:241:9a7d:32d7 with SMTP id v7-20020a5d6107000000b002419a7d32d7mr4224230wrt.197.1668774371837; Fri, 18 Nov 2022 04:26:11 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:11 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 10/15] tty: serial: qcom-geni-serial: use of_device_id data Date: Fri, 18 Nov 2022 13:25:34 +0100 Message-Id: <20221118122539.384993-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 72d0e7b91080..6a9f3f937f29 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 4 +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; @@ -637,7 +642,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) @@ -1348,13 +1353,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 { @@ -1364,7 +1370,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); @@ -1376,6 +1382,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"); @@ -1394,7 +1401,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) @@ -1424,7 +1431,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")) @@ -1446,7 +1453,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) @@ -1526,14 +1532,30 @@ static int __maybe_unused qcom_geni_serial_sys_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) }; 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 Fri Nov 18 12:25:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048188 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 4A99FC4167E for ; Fri, 18 Nov 2022 12:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241817AbiKRM1P (ORCPT ); Fri, 18 Nov 2022 07:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241820AbiKRM0a (ORCPT ); Fri, 18 Nov 2022 07:26:30 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A259825A for ; Fri, 18 Nov 2022 04:26:14 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id t25-20020a1c7719000000b003cfa34ea516so6157069wmi.1 for ; Fri, 18 Nov 2022 04:26:14 -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=kA0mRGqH1AuIV+a1MO05ETt4x66olQAeBj4vK+Kxqj8=; b=hkM7abkKGR4X3yahLkJH73KCQSaV68CGuVTJlrk2TkbNfZYOmVJ7x5d/hmfeRVUw2W bMJz3Cd3zkdJzfKbE0IsupzbOrHa9Hf5Vt9tnebhKw8SGEExrrH3ReA9zMoULFmgZhRU gID8QLVEX1dQcEB3sEHWFqUNAAEH44wROl1xrg8FyQp6c3uyCsajOuW0ENscAF0EhYbo 9WLVuTAS0xAzUPIAtt6Ao5E5a2uolP+G9WfZsmcMqoigK+o1Z03FyYBjEpfec8HeLf/i pkx4tG/oe1/eipwem9b9l7nV01FDqWtyr+JaEpSAVlyC9BNcWglA7jfYEcxUJ8KAuLPk nZ6g== 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=kA0mRGqH1AuIV+a1MO05ETt4x66olQAeBj4vK+Kxqj8=; b=H9Ht4RLmwXiv0n4LgT7ZfyAZRgfxwhdKVkjIplEZ0E3sxY03UTVzR6VjT1F7u3lb8b sLojb6/4CJ/iceTx6cWzN8rd29AOWE7w37KrY3hnC5i869cRflKOY8G9CyYwCE/4+Rc7 dXfstB8JE0A834RkvdZ/lrjSKmy0ttHi5SxLXKODkziAnxN4s//+J1/Y0qWcmIaWwtOU iQrgVFdMmdG9Xj08mqyZUmxLTs5VyRG6xNvUtL4eOuG/pNA11M6HGWxdYRBgDjVTwTQg K7dvSpNeyfY6c0pXbJRdtIkUHtPARosTYTw2rmDjbzhyj64hdUt8WCDDEVgKANPKMBlI 2opQ== X-Gm-Message-State: ANoB5pkU67NFT39xU/59bwGj8cq/4Si7vXwOm+7V6KkIoJwG2MUthfk4 HmOABGIBws5wpf/a1kDaJeCSOA== X-Google-Smtp-Source: AA0mqf7/NAKsEaus8X2OQBW7pJQghogKEDuQQk/ij0P0+nagbr8tCVzFcW3Le+NyQbMM5+Zb+69fwQ== X-Received: by 2002:a05:600c:18a1:b0:3cf:a9d5:36c7 with SMTP id x33-20020a05600c18a100b003cfa9d536c7mr8256862wmp.13.1668774372729; Fri, 18 Nov 2022 04:26:12 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:12 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 11/15] tty: serial: qcom-geni-serial: stop operations in progress at shutdown Date: Fri, 18 Nov 2022 13:25:35 +0100 Message-Id: <20221118122539.384993-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 it causes trouble so fix it now. Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio --- drivers/tty/serial/qcom_geni_serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 6a9f3f937f29..091b8f277a04 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -868,6 +868,9 @@ static void get_tx_fifo_size(struct qcom_geni_serial_port *port) static void qcom_geni_serial_shutdown(struct uart_port *uport) { + qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_rx(uport); + disable_irq(uport->irq); } From patchwork Fri Nov 18 12:25:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048187 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 1AF74C4321E for ; Fri, 18 Nov 2022 12:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241828AbiKRM1R (ORCPT ); Fri, 18 Nov 2022 07:27:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241846AbiKRM0c (ORCPT ); Fri, 18 Nov 2022 07:26:32 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F1609AC83 for ; Fri, 18 Nov 2022 04:26:15 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id t4so3509593wmj.5 for ; Fri, 18 Nov 2022 04:26:15 -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=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=XgxLUl8pt1XNL0iLDiU427YWuA+WEaiaCkEvGhMxKvHS7AzO0WGlJgFy/efbY2ozcc DOQb1IEBoBtO3VW7x+t4MJQYkrfiPsUkhRvFkGp9UAoID4XLDZR8DnoIwBtbmXRAHpOc 1oAXfiRsZyf4XuQMoOBnck65CaxmocuvADWKoZ3v+xS5uJMkpxOVxStEib7omyU7FG7X C0XU2f6TZgVvuoiBIgwqpOGHZ+qbVlVWTpDgUyO2oTqQxS4y7gMJWOMZmlX9oupLSzvj V5IED7b3gL8JPqwwin/Vx0dh/ewtVRM8QWnjapPvxRs6gVqFpNBCjdSiH9oBrQFTwi9T vmSw== 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=j23hZnphv0jcgZfiOY9qWXNDpMCFFj9PRM3bEUKGmc4=; b=AtKspoOXSobFULYrIbrUEUl7NVv0g30kJ25IFC+p7WM+wIVEY1jte5RRALEsMRJmYd ARB/mMetWTh+Nor0ecCzMhizifqVAxDt0iV7eC9wJiijlUK1q0rcplSFSKP/azS+R1n6 o29xUBX2cMUCVWB+2z64MaJOgolTLk6sufA44WkzO6Ma67va0hzbYe/nUKEuszdzFj8d uLI7N6a9SfKdU8atI1RlsKG8e4xSjGmRXHeNhrl9UxCi4Ma4K93xaSYFS4VFcT9uSFmk V9ueGcUouFkIzADFMOJlO/3vcP3qb1DqT1donszxZyJChtb0AvY4oV6KaTej4CiZsS8E 7JMg== X-Gm-Message-State: ANoB5pmxhQ59l9cCTqQHtct8WHsQL3wrO3T14qz9Bt+kVp/uavnaoDyE BBHgaSL8hvxHoLIqfuxnGqs5oA== X-Google-Smtp-Source: AA0mqf6r1UopoD85mncIUva/+dvusTt3tcZCpOD8lLQGcqCaB9WfI6v27mi+Pj5NXkUPSpwj0H1JlQ== X-Received: by 2002:a05:600c:19d0:b0:3cf:e7b7:d87d with SMTP id u16-20020a05600c19d000b003cfe7b7d87dmr7852582wmq.95.1668774373630; Fri, 18 Nov 2022 04:26:13 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:13 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 12/15] tty: serial: provide devm_uart_add_one_port() Date: Fri, 18 Nov 2022 13:25:36 +0100 Message-Id: <20221118122539.384993-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Provide a devres variant of uart_add_one_port() that removes the managed port at device detach. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 3 ++ drivers/tty/serial/serial_core.c | 36 +++++++++++++++++++ include/linux/serial_core.h | 6 ++++ 3 files changed, 45 insertions(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index 56082265e8e5..5d07a8c1eadb 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -436,6 +436,9 @@ RTC SERDEV devm_serdev_device_open() +SERIAL + devm_uart_add_one_port() + SLAVE DMA ENGINE devm_acpi_dma_controller_register() diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 179ee199df34..005190b279b3 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3217,6 +3217,42 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) } EXPORT_SYMBOL(uart_remove_one_port); +struct uart_port_devres { + struct uart_driver *drv; + struct uart_port *port; +}; + +static void devm_uart_remove_one_port(struct device *dev, void *data) +{ + struct uart_port_devres *res = data; + + uart_remove_one_port(res->drv, res->port); +} + +int devm_uart_add_one_port(struct device *dev, + struct uart_driver *drv, struct uart_port *port) +{ + struct uart_port_devres *res; + int ret; + + res = devres_alloc(devm_uart_remove_one_port, sizeof(*res), GFP_KERNEL); + if (!res) + return -1; + + ret = uart_add_one_port(drv, port); + if (ret) { + devres_free(res); + return -1; + } + + res->drv = drv; + res->port = port; + devres_add(dev, res); + + return 0; +} +EXPORT_SYMBOL(devm_uart_add_one_port); + /** * uart_match_port - are the two ports equivalent? * @port1: first port diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d657f2a42a7b..d0911f04706e 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -771,6 +771,12 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); bool uart_match_port(const struct uart_port *port1, const struct uart_port *port2); +/* + * UART devres + */ +int devm_uart_add_one_port(struct device *dev, + struct uart_driver *drv, struct uart_port *port); + /* * Power Management */ From patchwork Fri Nov 18 12:25:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048191 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 A00E1C46467 for ; Fri, 18 Nov 2022 12:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235357AbiKRM1T (ORCPT ); Fri, 18 Nov 2022 07:27:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241422AbiKRM0c (ORCPT ); Fri, 18 Nov 2022 07:26:32 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 249419AC84 for ; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id w14so9026345wru.8 for ; Fri, 18 Nov 2022 04:26:16 -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=Ko+jjIDfILZRTvWmBV6W3WbxjLYlDDq9YeO4lkVcz7M=; b=wG6BBClFrP2ZpUq0SJaBVD26AkZ5G8xLeHuWRnkPNUG3LlK+lWfYOfpgG0tc92N1uK bUTXlgbeYtc5LiKT1YUb/h911q40aey2mzMn78dr2JFvwzletg79ZcqvbOqrXqsNPsLm G2G20KJ/8PP5178vDp02V87OlmQrRXPFUZ0X4zuCszl2nNuRrM7r5jfaJ+MCW4Yr+03y NYHlmAhr7aIddmXYZzez/xrD5V2fac10Sn4OTaFyEWP1LkUWHxMAyJDb92U7QmoxelwL UXB9oa4sFaWx8nqZScC9nLt2IRbGlSv/rrH8gH+Jcb34jmw9LvrWuqIiIPgmzi0KhhBH W9Og== 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=Ko+jjIDfILZRTvWmBV6W3WbxjLYlDDq9YeO4lkVcz7M=; b=mC9utxDAwusAFF7dtO7fj38SpvcLFRUsGXGOzw8a2kv57U+nx+fChdkcoGv1tx90sW LdljfI5yPkuzavJtE8S5zUJ+tTd9no638qR2NynDTToNkaexSU2u+Q6IpZo39vjfR84n AIO2YTx7qyjT01IXOBYR0keiIZp0lpaY84ifROV2OfKUtdocyS40yoy+qpdcg9hNL3C/ FVljUBIId2T+4EN/k573DOZ82AxXFuEz8jB7qEBFGBI2qwyhVVelnOr5LgvHh8wvDEXl wZDLXhCS2vZFJm2mpb+2PwR1AyTmUfJ1mlcJ6iCesJq4/yTVxdABkRJ0/mEcmWnSK+bp 1Sjw== X-Gm-Message-State: ANoB5pmyLf1PcgJqM257BDquY1HbQpKHufrBNdNUxcIDVW8+i3b8gb5J WOAmsiDSIqE1TDenHgWA2snjXQ== X-Google-Smtp-Source: AA0mqf7Q8YXDa6glOlpsZy8Ib6F5FK6TZn0OFn0WyHhGik6nIMe0ij6UF+WYSrTLepeQhB0pHEU/Rg== X-Received: by 2002:a5d:5685:0:b0:235:f0a6:fafd with SMTP id f5-20020a5d5685000000b00235f0a6fafdmr4232376wrv.75.1668774374613; Fri, 18 Nov 2022 04:26:14 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:14 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 13/15] tty: serial: qcom-geni-serial: use devres for uart port management Date: Fri, 18 Nov 2022 13:25:37 +0100 Message-Id: <20221118122539.384993-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski Shrink and simplify the probe() and remove() code by using the managed variant of uart_add_one_port. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 091b8f277a04..cdd476d504da 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1457,7 +1457,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->private_data = &port->private_data; platform_set_drvdata(pdev, port); - ret = uart_add_one_port(drv, uport); + ret = devm_uart_add_one_port(&pdev->dev, drv, uport); if (ret) return ret; @@ -1466,7 +1466,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) IRQF_TRIGGER_HIGH, port->name, uport); if (ret) { dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); - uart_remove_one_port(drv, uport); return ret; } @@ -1483,7 +1482,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->wakeup_irq); if (ret) { device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, uport); return ret; } } @@ -1493,12 +1491,8 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) static int qcom_geni_serial_remove(struct platform_device *pdev) { - struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); - struct uart_driver *drv = port->private_data.drv; - dev_pm_clear_wake_irq(&pdev->dev); device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, &port->uport); return 0; } From patchwork Fri Nov 18 12:25:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048189 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 5A2D7C4167D for ; Fri, 18 Nov 2022 12:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241829AbiKRM1S (ORCPT ); Fri, 18 Nov 2022 07:27:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241857AbiKRM0c (ORCPT ); Fri, 18 Nov 2022 07:26:32 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 053D59AC8F for ; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id y16so8983642wrt.12 for ; Fri, 18 Nov 2022 04:26:15 -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=WB27jhF4DCx/Ah98HAn4Zt+8vZMKTVFmQpCWXcHg7GM=; b=Hv4j2/dPaM9EBDU7n724L6eQsr4DNXdBQjGvzrtzZDn429adWSeIfWvr+e7+Mjbgfp 3NqMO0rr+HQIQsWTe0RTQiVILKK9vcb549WGRP+cGKonal19zGGv1Alpm8bIh/5R+0Qx cmEgAbVp47aUAPBQ9KyV+jYDb8GBGDTlHuhjGoG2bCMdjDAQPThWMPAsyiNiQKPsXH1e ViA7Y5Os/+LZ5VG6GxXLwsooznyMtBZ6aUVhvCJkYCiN+ehm1J0ehhTMxdBOyeIUV+yE uTUeMjURKolrFZr6a24URF5pNbnymttJUzfMWu0gmdhKQndYGm2GqegJmBr9Nb+ks9/J +cvg== 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=WB27jhF4DCx/Ah98HAn4Zt+8vZMKTVFmQpCWXcHg7GM=; b=eNSoBiLScFZVwcpv23EIcShvruPVxMrsoV11oBIEjge1HGtiaXB6hzbWTVxCpFLAWp e+sRFQrlKToz/FpwK+mqEimXupBiGN/Qn0Be2RwO4JX+TyDhNQcaxoDNud2U/5nj2/GP pgipbX3/fJWd/aew9rpgn982j+Op63Cm5J2MRf8SXcMUBHNUZEZ0/8Jc0LpiWkPWfvxZ bvMNfwBgATjON0Gb2sZDrMZHjH3Jo0lUDXMnQRrbEoWqR3F2Mrj2uEA/JoLomRGKBcjh lcHbM4jYIywnokbrhfOdsJ42aIdF9+0itxl4GCp876/2zrGy5Gn3HJAEO/8+1nVzBonl EEPw== X-Gm-Message-State: ANoB5pleGkjgh+nAOAmd4CbCkVWLJ715X0xtFsgHhqfi5w3O19Iw8ve0 2bzEuYB3/F5PSB/HivAj+7DFZw== X-Google-Smtp-Source: AA0mqf5RPSNmKNYUH2/qrCXqX9bGdjEIkUCG//ScGngr0QgwxAVFX2JzCF6xdpSKvgMJWLHkf5jG+A== X-Received: by 2002:a5d:6a46:0:b0:241:c2d5:7407 with SMTP id t6-20020a5d6a46000000b00241c2d57407mr1285401wrw.623.1668774375543; Fri, 18 Nov 2022 04:26:15 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:15 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 14/15] soc: qcom-geni-se: add more symbol definitions Date: Fri, 18 Nov 2022 13:25:38 +0100 Message-Id: <20221118122539.384993-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 Fri Nov 18 12:25:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13048190 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 F0319C43217 for ; Fri, 18 Nov 2022 12:27:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241750AbiKRM1O (ORCPT ); Fri, 18 Nov 2022 07:27:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241873AbiKRM0q (ORCPT ); Fri, 18 Nov 2022 07:26:46 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A9799AC95 for ; Fri, 18 Nov 2022 04:26:17 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id l39-20020a05600c1d2700b003cf93c8156dso3910993wms.4 for ; Fri, 18 Nov 2022 04:26:17 -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=1orAtl1REjTAzqj2djLLnWo1y+H+0MlMU6NANawZJ1g=; b=eIwEM+xYrWlEW5eEK2bF4g6HOnVDA99M2iQTRSGU2AenkQzfcXr4HNSbPZhbfoldv3 Cg6nmeWe1/ni5+JAuHzEMfRa5Xnhrpo86fJlu0U4iIk3dx1e6slTqpfsmEgLv2hUZyZl 199bs9WC/fWK4jf+oZH6NMZVA6kVzMzAMhZvcJ9mLigtMMTNO40zbecX7PAfeeqDezRT ZyejbcwYgas/DE6WUbJ/HNooN/GtnPMGtjocwE4CBDuw95CvNXlbtcQXMkEZWLI0DVD7 3o7eyq2LggIFasM74yXHev8L9Xq5LFoOovlWxv6Howc0jHveHQA0ZUBDFR1y2JuK4/LX oWPg== 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=1orAtl1REjTAzqj2djLLnWo1y+H+0MlMU6NANawZJ1g=; b=FUaUdQPfawFaIOEpx4Wv65YwetMHPPjgzeiF51iCFKKYyZ668wd5ODTrVuIo33rGRd 3wn9TYZ/C0KPOc+BodWs/WmFnXDNlUlNU7YKcLxDUiFNhRzP1zYzaAtFrQPXUk1sRZ8u dDtK/mBhs4slgNKBZyBhvLAqynSjCYDbauCFpCuw/n4K6eNvg8/r3RwgOpz1M1fmeqmJ nkcjphx4cvOf7tbsZqyZNb/wmAVraPo39wiA+ShXS9+CtwYOUvUA1VL+7JdrSufFcHv8 qOZEIk/dqUu5AVCkOrIGhhpPWfmzyzhmCQr9aLsYQYKa//uVjgkK5XxewgeHHCcJ2JnU lDyg== X-Gm-Message-State: ANoB5pm/tzg8sOMTFPwP4xyVmOKzcz/Pbkn5hm125IJTitpMe2mSnyCw KknEl5+NoBf35hKTfJoQjqEMzQ== X-Google-Smtp-Source: AA0mqf6n+HWO2kDDrcQLiXsZ3/RVVnEHQLszeAbmrsVumChy3W7Vq034xAxO9C4FXFz7dUtOqSccnA== X-Received: by 2002:a05:600c:1e1a:b0:3cf:7959:d8be with SMTP id ay26-20020a05600c1e1a00b003cf7959d8bemr5005668wmb.85.1668774376541; Fri, 18 Nov 2022 04:26:16 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:b10c:1279:a704:75d4]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003c6f3e5ba42sm9873958wmg.46.2022.11.18.04.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 04:26:16 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 15/15] tty: serial: qcom-geni-serial: add support for serial engine DMA Date: Fri, 18 Nov 2022 13:25:39 +0100 Message-Id: <20221118122539.384993-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221118122539.384993-1-brgl@bgdev.pl> References: <20221118122539.384993-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 | 288 ++++++++++++++++++++++---- 1 file changed, 246 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index cdd476d504da..700e20860af0 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 4 +#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; @@ -549,18 +555,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); @@ -575,7 +574,69 @@ 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) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + bool done; + u32 status; + u32 m_irq_en; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & M_GENI_CMD_ACTIVE)) + return; + + if (port->rx_dma_addr) { + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, + port->tx_remaining); + port->tx_dma_addr = (dma_addr_t)NULL; + 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); + qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS, + M_CMD_ABORT_EN, true); + 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); + + xmit_size = min_t(unsigned int, xmit_size, UART_XMIT_SIZE - xmit->tail); + + 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; u32 status; @@ -594,7 +655,7 @@ 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; @@ -620,14 +681,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; @@ -642,10 +702,10 @@ 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; @@ -675,7 +735,7 @@ 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); @@ -683,7 +743,7 @@ static void qcom_geni_serial_stop_rx(struct uart_port *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; @@ -691,7 +751,7 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) status = readl(uport->membase + SE_GENI_STATUS); if (status & S_GENI_CMD_ACTIVE) - qcom_geni_serial_stop_rx(uport); + qcom_geni_serial_stop_rx_fifo(uport); geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); @@ -704,6 +764,101 @@ 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); + u32 status; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & S_GENI_CMD_ACTIVE)) + return; + + geni_se_cancel_s_cmd(&port->se); + qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS, + S_CMD_CANCEL_EN, true); + + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + 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 = (dma_addr_t)NULL; + } +} + +static void qcom_geni_serial_start_rx_dma(struct uart_port *uport) +{ + struct qcom_geni_serial_port *port = to_dev_port(uport); + u32 status; + int ret; + + status = readl(uport->membase + SE_GENI_STATUS); + if (status & S_GENI_CMD_ACTIVE) + 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 status; + u32 rx_in; + int ret; + + status = readl(uport->membase + SE_GENI_STATUS); + if (!(status & S_GENI_CMD_ACTIVE)) + 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 = (dma_addr_t)NULL; + + 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 int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, unsigned int chunk) { @@ -736,8 +891,8 @@ static int qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, return tail; } -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; @@ -757,7 +912,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; } @@ -800,12 +955,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; + + xmit->tail = (xmit->tail + port->tx_remaining) & (UART_XMIT_SIZE - 1); + geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); + uport->icount.tx += port->tx_remaining; + port->tx_dma_addr = (dma_addr_t)NULL; + port->tx_remaining = 0; + + if (!uart_circ_empty(xmit)) + qcom_geni_serial_start_tx_dma(uport); + else + 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; @@ -818,10 +993,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; @@ -831,10 +1011,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++; @@ -844,8 +1020,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); @@ -915,7 +1118,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); port->setup = true; return 0; @@ -1313,10 +1516,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, @@ -1334,9 +1537,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, @@ -1405,9 +1609,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; } @@ -1531,12 +1735,12 @@ static int __maybe_unused qcom_geni_serial_sys_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 = {