Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4204082imu; Mon, 7 Jan 2019 18:02:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ENhFpv66ve2zhidLMZAeUKQu1wrVumPZWBx2aU/L13XPMjWsGm+/ljgKOrn7gX3l1lsRV X-Received: by 2002:a17:902:2a0a:: with SMTP id i10mr62536963plb.323.1546912954516; Mon, 07 Jan 2019 18:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546912954; cv=none; d=google.com; s=arc-20160816; b=b1lTZRWKXEMakKCua9RQ3I2ydyzkRhAEZl+bUnJ214a+A8CAjylHsCmOCtGaBx02no cloBjNGdH4m1bzI0KvZvCPm74tsCADRJ4IF6r3sL0+ZGYPQrnfec9BsrYDirKsN91WAH 32KVJN3/rX045GqMuwL5BaTrNagxinVXGuWd+FrQc7BzsasQjwPY8fz64zcwD8wn2hCH QfJNBWF8XvPYJhb8lfMOl2RjXASqO7ycYIcEEePloYstnn1uo7o0aZAEVK10G1C9yP+s BR+1kwQMME5exdU/wmEu2LNB7e4klQ/DJxyeiWBI/LTHGGDCTs6pBg+fkGtIHOp7JahJ RpVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UA+1hpLGIyRtNpWzZ3z1GOHv2MYLMjhrcWwr2rl6CeM=; b=IykoJ78B2TigPHOGOqA9LfxdbZT21+7WduVKAm9UNaMpq9+yYbE2u0rto9TFvVUAyX 1Ckq887ZMwk3tIYVpHe0b9P8gTzAYH/xKdg4cyYZwb11SWdwtyx+p25tyhHJa+Y8Un23 uqASp5siUa6aFsaYkAqm3Lllf6cIUKhFykIWG5JUREtX2uDYXsXrOsQEh5ExkqAWZyyf YfIzblqw/T8sPgjh8MtkAdo6NVVHn4L6j0EWWbsAcR6VnM1I/YSDKBL5uWGkZQvPZScM 5JyyfbT+VIg1lPZQaf3cI+21GJ1ZReowTgOUgp6y4EGjpyKfQGPI9/++5CLcckgeoXhL EDuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O9BmoOms; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20si9696807pgk.323.2019.01.07.18.02.19; Mon, 07 Jan 2019 18:02:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O9BmoOms; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727463AbfAHB7h (ORCPT + 99 others); Mon, 7 Jan 2019 20:59:37 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45892 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbfAHB7X (ORCPT ); Mon, 7 Jan 2019 20:59:23 -0500 Received: by mail-pf1-f196.google.com with SMTP id g62so1081074pfd.12 for ; Mon, 07 Jan 2019 17:59:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UA+1hpLGIyRtNpWzZ3z1GOHv2MYLMjhrcWwr2rl6CeM=; b=O9BmoOmspftCi3rk9syy9eT3z+IqxSW3SXWQnIm1NuHvWqq8xqXD+BkSfVTC3mv3+H ohF1dHLDtT4pK00oKtgnPdQ9ZFXD127qJURry2gRtsxAohirKvWGFbPPFVIUS9TthO+q o+gCBcjzXhr29Sahm9DqLhUdpAVKxKXFoZ8rs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UA+1hpLGIyRtNpWzZ3z1GOHv2MYLMjhrcWwr2rl6CeM=; b=m+uOkIHh/sADJGrIsjwUmd9+r8SBvfuKzJ5HGREiVpQ/jSHCQ00BeNf3cZ+Y4OO30/ 1wROfsKbBDDsrvrCBJb0y2pz4FNo2N+605Kq9dSmUwJQS1ydvIi7t9X/1eJak9q7eit1 aAtjs0Nybx9WRIRheGVXRrJjxWog2POAtTsiVYjQ58I9E0pl1HxY4mhH3At0lJgcRLqK tNnn0Q40+OYj2R0ukLB6IsEjOlx1D165Q/VWpdUn6LOaspjBvSiLS5w0ccfslI9QGYrf /iEg9C0gctWqqiAtAgiYKi6/rqqclV2LsOsoyGqUQNIom5iD8mbaXRdZ2x8IWRdAmRGC v+DA== X-Gm-Message-State: AA+aEWb//0GiKAAhIQa8MF1D0C7BHzKEj0KVIRyvGJNg+XH9qvTMSxV9 zwiBQD/DGMkAxVhzpUwR5B7jfA== X-Received: by 2002:a62:2082:: with SMTP id m2mr63985571pfj.163.1546912763031; Mon, 07 Jan 2019 17:59:23 -0800 (PST) Received: from ryandcase.mtv.corp.google.com ([2620:15c:202:201:ed1c:3d1c:9d92:99cb]) by smtp.gmail.com with ESMTPSA id p2sm93942693pfb.28.2019.01.07.17.59.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jan 2019 17:59:22 -0800 (PST) From: Ryan Case To: Greg Kroah-Hartman , Jiri Slaby Cc: Evan Green , Doug Anderson , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Stephen Boyd , Ryan Case Subject: [PATCH v2 3/4] tty: serial: qcom_geni_serial: Remove xfer_mode variable Date: Mon, 7 Jan 2019 17:58:37 -0800 Message-Id: <20190108015838.166271-4-ryandcase@chromium.org> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190108015838.166271-1-ryandcase@chromium.org> References: <20190108015838.166271-1-ryandcase@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver only supports FIFO mode so setting and checking this variable is unnecessary. If DMA support is ever added then such checks can be introduced. Signed-off-by: Ryan Case Reviewed-by: Evan Green --- Changes in v2: - Fixed commit message typo - Coalesced lines where possible drivers/tty/serial/qcom_geni_serial.c | 67 ++++++++++----------------- 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 22d3cb4b3b39..626bf7d399aa 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -105,7 +105,6 @@ struct qcom_geni_serial_port { u32 tx_fifo_depth; u32 tx_fifo_width; u32 rx_fifo_depth; - enum geni_se_xfer_mode xfer_mode; bool setup; int (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); unsigned int baud; @@ -552,29 +551,20 @@ static int handle_rx_uart(struct uart_port *uport, u32 bytes, bool drop) static void qcom_geni_serial_start_tx(struct uart_port *uport) { u32 irq_en; - struct qcom_geni_serial_port *port = to_dev_port(uport, uport); u32 status; - if (port->xfer_mode == GENI_SE_FIFO) { - /* - * readl ensures reading & writing of IRQ_EN register - * is not re-ordered before checking the status of the - * Serial Engine. - */ - status = readl(uport->membase + SE_GENI_STATUS); - if (status & M_GENI_CMD_ACTIVE) - return; + status = readl(uport->membase + SE_GENI_STATUS); + if (status & M_GENI_CMD_ACTIVE) + return; - if (!qcom_geni_serial_tx_empty(uport)) - return; + if (!qcom_geni_serial_tx_empty(uport)) + return; - irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); - irq_en |= M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN; + irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); + irq_en |= M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN; - writel(DEF_TX_WM, uport->membase + - SE_GENI_TX_WATERMARK_REG); - writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); - } + writel(DEF_TX_WM, uport->membase + SE_GENI_TX_WATERMARK_REG); + writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } static void qcom_geni_serial_stop_tx(struct uart_port *uport) @@ -584,12 +574,8 @@ static void qcom_geni_serial_stop_tx(struct uart_port *uport) struct qcom_geni_serial_port *port = to_dev_port(uport, uport); irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN); - irq_en &= ~M_CMD_DONE_EN; - if (port->xfer_mode == GENI_SE_FIFO) { - irq_en &= ~M_TX_FIFO_WATERMARK_EN; - writel(0, uport->membase + - SE_GENI_TX_WATERMARK_REG); - } + irq_en &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN); + writel(0, uport->membase + SE_GENI_TX_WATERMARK_REG); writel(irq_en, uport->membase + SE_GENI_M_IRQ_EN); status = readl(uport->membase + SE_GENI_STATUS); /* Possible stop tx is called multiple times. */ @@ -619,15 +605,13 @@ static void qcom_geni_serial_start_rx(struct uart_port *uport) geni_se_setup_s_cmd(&port->se, UART_START_READ, 0); - if (port->xfer_mode == GENI_SE_FIFO) { - 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_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); - } + 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_stop_rx(struct uart_port *uport) @@ -637,15 +621,13 @@ static void qcom_geni_serial_stop_rx(struct uart_port *uport) struct qcom_geni_serial_port *port = to_dev_port(uport, uport); u32 irq_clear = S_CMD_DONE_EN; - if (port->xfer_mode == GENI_SE_FIFO) { - 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_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); - } + 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); status = readl(uport->membase + SE_GENI_STATUS); /* Possible stop rx is called multiple times. */ @@ -888,7 +870,6 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) * Make an unconditional cancel on the main sequencer to reset * it else we could end up in data loss scenarios. */ - port->xfer_mode = GENI_SE_FIFO; if (uart_console(uport)) qcom_geni_serial_poll_tx_done(uport); geni_se_config_packing(&port->se, BITS_PER_BYTE, port->tx_bytes_pw, @@ -896,7 +877,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport) geni_se_config_packing(&port->se, BITS_PER_BYTE, port->rx_bytes_pw, false, false, true); geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2); - geni_se_select_mode(&port->se, port->xfer_mode); + geni_se_select_mode(&port->se, GENI_SE_FIFO); if (!uart_console(uport)) { port->rx_fifo = devm_kcalloc(uport->dev, port->rx_fifo_depth, sizeof(u32), GFP_KERNEL); -- 2.20.1.97.g81188d93c3-goog