From patchwork Wed Nov 16 14:48:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626040 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 5EBE8C43219 for ; Wed, 16 Nov 2022 14:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbiKPOtV (ORCPT ); Wed, 16 Nov 2022 09:49:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiKPOtT (ORCPT ); Wed, 16 Nov 2022 09:49:19 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D7FB1839A; Wed, 16 Nov 2022 06:49:18 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id h24so10778389qta.9; Wed, 16 Nov 2022 06:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=XsrpgSLIetjSSjQsdPnxAm+guc7zGDde8lk1A/5OW7U=; b=a8l5Of2Om1feIWNCKzQH67SgP3fBhHzdklPrgX75i7Id2LsWRr78OydLo5MG2dNerv aFlGof0i7l0Sv0tPuEDe3VdkvN1qzI87+mz+yfuhotVsQApuJHz1cHTSorBnUVeGy74p lDJOj5v1kzjejl9JsWAN/kBPQEBXvDA4Jigf7hAha+W1laHl2nsDkUwHta4Qphg6qswi KZ6dpaXZjXjPkG9jXwrCQDnnPVeJRpuVosrom6NN9Q3QjNpgChjpMtMPCapbm1pEOcAM gw5ns7q9mZwHzMljLuXY7jL3ryU9Hg/hAIgCcDJVRcS3/lFMU+8/wPzSxCWtcyW+axaw EXFA== 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=XsrpgSLIetjSSjQsdPnxAm+guc7zGDde8lk1A/5OW7U=; b=e3VZjnIonbe88pBizd9vLriqaq5Wubq4mC8l26O6rQc1NQdgpVpbzXq9JydNGLShJN VXdx8FW5zyKi1MVZTTZyCCysXByJnjQrovAcRwnsvKgGN5zdZcCKsFM/PVAirEeZYIyI IbkmJIFLe8TV8lyAyhVeqzt/IIwTUeCseTqCeMgcUDaa1kzDv0RXfAVffZZWi0cv9cWB /93TmB1qIz/YxqxVjJ72o0G8nSOQP3vitrE8dtIYP7N/yXZvjV6ej4unpb68X0AqHrjI oQUCCOyBZH0LJ8FlHHgwqyH0mQ5VyAp9DfSgtcSUgt/kXl788jftge76upZ+06t9IHxO kr4Q== X-Gm-Message-State: ANoB5pnMpk/AQQDtgs70utxsTGhlkaFFMMPCKX81UqCuZpV2oRyntpjW RpBg5ZzN6EBRoUm5Wy6URpodtA9hEJP5HA== X-Google-Smtp-Source: AA0mqf53ZeXKburKgJDbQhMWEaXf6mHr24jCuB1k7jYMyRgPjxyWbupdeB4Tj46w5baZaj0lTc8TFg== X-Received: by 2002:ac8:6b12:0:b0:39c:c865:2f79 with SMTP id w18-20020ac86b12000000b0039cc8652f79mr21165191qts.360.1668610157026; Wed, 16 Nov 2022 06:49:17 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:16 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 01/14] serial: liteuart: use KBUILD_MODNAME as driver name Date: Wed, 16 Nov 2022 09:48:55 -0500 Message-Id: <20221116144908.234154-2-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Replace hard-coded instances of "liteuart" with KBUILD_MODNAME. Signed-off-by: Gabriel Somlo --- drivers/tty/serial/liteuart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 062812fe1b09..db898751ffe3 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -57,7 +57,7 @@ static struct console liteuart_console; static struct uart_driver liteuart_driver = { .owner = THIS_MODULE, - .driver_name = "liteuart", + .driver_name = KBUILD_MODNAME, .dev_name = "ttyLXU", .major = 0, .minor = 0, @@ -321,7 +321,7 @@ static struct platform_driver liteuart_platform_driver = { .probe = liteuart_probe, .remove = liteuart_remove, .driver = { - .name = "liteuart", + .name = KBUILD_MODNAME, .of_match_table = liteuart_of_match, }, }; @@ -367,7 +367,7 @@ static int liteuart_console_setup(struct console *co, char *options) } static struct console liteuart_console = { - .name = "liteuart", + .name = KBUILD_MODNAME, .write = liteuart_console_write, .device = uart_console_device, .setup = liteuart_console_setup, From patchwork Wed Nov 16 14:48:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626041 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 6CD91C433FE for ; Wed, 16 Nov 2022 14:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiKPOtU (ORCPT ); Wed, 16 Nov 2022 09:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233311AbiKPOtT (ORCPT ); Wed, 16 Nov 2022 09:49:19 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD651A218; Wed, 16 Nov 2022 06:49:19 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id i9so11718925qki.10; Wed, 16 Nov 2022 06:49:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=xhR7eY/FHUNkamlu87P06c2sFlG0j+sFMpgEhxSGbjE=; b=Z8AEhLrjv453G4hwPs1L5mhG7GbIvre6FObGi8TKYbrjzVV0Z/cPvFGjtqKKIVjFEZ WenvBmMN9WZ691aONBMHBR7YVW25qnB50D6vBJedMXs8MY3WcZpjbp/f4X67hEdltbp7 7q475laYXvWLLcpqU0oW04fbwSbxK74DBNUwjO5aLRsj7xPfCguq3E54WtVXWk5AvrWL Lq124W/b7eAUDNibkkl6kN5LWVU2TZ8dgTyzs0s1f7YPHBW7bIUPGyax+RxHo0rUqLhE t5spOsmpxSx4YQYwHb1hhtwjRmEiPvTo2JR0+SyS14qiFjthfwpy5ZwQuCy83bOFl0vL u4yA== 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=xhR7eY/FHUNkamlu87P06c2sFlG0j+sFMpgEhxSGbjE=; b=465dlKJ6EM/iFllbjhs37nW2AR9wt38MYhq6rIfRm0u2P0wIdS4Nv9CZGTiWxkj3XD 6E6nL9f+YYq3w4JTwv7Usq6fWG4XvfcnQNhTwKeCZh3mJ8vCwqs6lSxjYZFCSyNc0K8A JcCULrRC7JNBL3XwhORaESr1ujjplEHPfXAJ/pYFwJ7CaXvZLl9L8J/i/LZP+YOHORrx sDJ9lfM0V7q6XXRhY448KqhF8FujAlxSTuAD7FkLJWRTiB+AQLNLj8AAQe1u/0J5X3i2 0+4y8Fc0R3aoP7F10YzoVDMdi/hswrweNV1EQ3jJRMee8CrZgieoFGmDtFBjpcQsoC7H ia0w== X-Gm-Message-State: ANoB5plUBxqr3WhH1Y1jdgqZX7hHjhGpynU0fUTR/KWQ9V78SipApplj 5YjSVulnvlaZt12cEFwyrwnyCVEdKp8Few== X-Google-Smtp-Source: AA0mqf4Szr2A4jFj3lfVSAI5qD4/n9TvM+CrDDB3Yov4qxKVCNXziZNirxyFL+Jv9+fG8VBpt2dzvA== X-Received: by 2002:a05:620a:20cb:b0:6f9:26a0:53af with SMTP id f11-20020a05620a20cb00b006f926a053afmr19127501qka.768.1668610158036; Wed, 16 Nov 2022 06:49:18 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:17 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 02/14] serial: liteuart: use bit number macros Date: Wed, 16 Nov 2022 09:48:56 -0500 Message-Id: <20221116144908.234154-3-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Replace magic bit constants (e.g., 1, 2, 4) with BIT(x) expressions. Signed-off-by: Gabriel Somlo --- New in v4: - explicitly include drivers/tty/serial/liteuart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index db898751ffe3..18c1eb315ee9 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -5,6 +5,7 @@ * Copyright (C) 2019-2020 Antmicro */ +#include #include #include #include @@ -38,8 +39,8 @@ #define OFF_EV_ENABLE 0x14 /* events */ -#define EV_TX 0x1 -#define EV_RX 0x2 +#define EV_TX BIT(0) +#define EV_RX BIT(1) struct liteuart_port { struct uart_port port; From patchwork Wed Nov 16 14:48:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625417 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 A4DFAC433FE for ; Wed, 16 Nov 2022 14:49:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbiKPOtZ (ORCPT ); Wed, 16 Nov 2022 09:49:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233423AbiKPOtV (ORCPT ); Wed, 16 Nov 2022 09:49:21 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADFF17591; Wed, 16 Nov 2022 06:49:20 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id l2so10778276qtq.11; Wed, 16 Nov 2022 06:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=h8oSxODvpRIImTN9WHVpow16OveWT9zKoAdC7TS4/4Y=; b=Z/dN35ea+TIYbEA+K48zz3U7DxsC/uAXx0Ruizd5Ilc247/2QqRuu1uFgJLcUoTjQ3 bbK0cR187nnwQ+ynN52KiR4plFCNl2M4EQRdzaw+8FZDec7GfI96xXtiGxfSWWyDIVeI UJamh4pZ9ZJQ4w8Kbt9gVElJMmFe1Srkbn+v6ZMhauJdrdxsJ15YGeMHDAWG7jBZACo/ WfsaknvZ+/DWOZGR+OV9mERYM6R/79Jkc7UCZ4kV5yFGuTPmeZF51mkiASDshOakoRuf 4mCi6I26hdtLYF13O1zdBhzlPJbZPraf95XPXQ0DSqkCblkDd6RlVw8nRwvbYmrXEU8u eFuA== 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=h8oSxODvpRIImTN9WHVpow16OveWT9zKoAdC7TS4/4Y=; b=Pfq287c7BcvP3pBn98d+Mu453GxFSXT8eLnSl3UWhbwLx3uAoxYU3KiIjyjrSFBv5T i/y5qXg1T0Vnwr8sNfeR3fKhJ42eV9zSDPSBL/JqViINxU3GfXX4fw8O73m9ZKVJnNqp 0qFRkc0vjdqBX0cKqjSwaVrFcDd/oV9CQhM504++Ia1uhljMCL3y0Axh/zkOmC8Zx1lD jdpeMYIOkCzjBDrH3/t/p4nsYf0dvNSuyCQKkQsCjlK+ZYiuvHEZyAHGDDqj9f8Ldwhp YMRxYOw/sAPUbFPLN2sEEmoTSIfUlmSN/al04d8YK9UAQnQIVs3WwBTYB96P3pQ/Cmwp w7CQ== X-Gm-Message-State: ANoB5pk5lfV/RHXldJ4oS1IAyXYOJqdqKjtwsyUrJr2dshnPkjwWAf29 6Vi/bnewn6R+cetZIEMVhYi/kpZb+OUJAw== X-Google-Smtp-Source: AA0mqf5KEKBsMJtKTeY6BGNgK+mKAmegil/eoNd/1TQxn2HprDs+OKOP7zMepUh7WRpxFdxkpukyLw== X-Received: by 2002:ac8:1411:0:b0:3a5:4a19:c543 with SMTP id k17-20020ac81411000000b003a54a19c543mr20576044qtj.126.1668610159040; Wed, 16 Nov 2022 06:49:19 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:18 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 03/14] serial: liteuart: remove unused uart_ops stubs Date: Wed, 16 Nov 2022 09:48:57 -0500 Message-Id: <20221116144908.234154-4-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Remove stub uart_ops methods that are not called unconditionally from serial_core. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- Changes since v3: - no longer adding gratuitous comment to liteuart_stop_tx, removed later on in the series drivers/tty/serial/liteuart.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 18c1eb315ee9..989a4f8d5bd4 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -154,11 +154,6 @@ static void liteuart_stop_rx(struct uart_port *port) del_timer(&uart->timer); } -static void liteuart_break_ctl(struct uart_port *port, int break_state) -{ - /* LiteUART doesn't support sending break signal */ -} - static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart = to_liteuart_port(port); @@ -197,15 +192,6 @@ static const char *liteuart_type(struct uart_port *port) return "liteuart"; } -static void liteuart_release_port(struct uart_port *port) -{ -} - -static int liteuart_request_port(struct uart_port *port) -{ - return 0; -} - static void liteuart_config_port(struct uart_port *port, int flags) { /* @@ -232,13 +218,10 @@ static const struct uart_ops liteuart_ops = { .stop_tx = liteuart_stop_tx, .start_tx = liteuart_start_tx, .stop_rx = liteuart_stop_rx, - .break_ctl = liteuart_break_ctl, .startup = liteuart_startup, .shutdown = liteuart_shutdown, .set_termios = liteuart_set_termios, .type = liteuart_type, - .release_port = liteuart_release_port, - .request_port = liteuart_request_port, .config_port = liteuart_config_port, .verify_port = liteuart_verify_port, }; From patchwork Wed Nov 16 14:48:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626039 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 51836C4332F for ; Wed, 16 Nov 2022 14:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbiKPOt0 (ORCPT ); Wed, 16 Nov 2022 09:49:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233430AbiKPOtV (ORCPT ); Wed, 16 Nov 2022 09:49:21 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C69417A9E; Wed, 16 Nov 2022 06:49:21 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id x21so11768785qkj.0; Wed, 16 Nov 2022 06:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=QYR5NsE6sy8TKuNQHq0fl0E+u87DDSloXcW16PVAy78=; b=KFZjEdCF9CSmeIEcZe3xg8TnfR8mwCMghzzJIOyPI0pb9AnQvsZniKUNSpSIZttKP+ YnsXySbsYtu/5Px/nZd/AdT02IaXnxWsL2xKNNHHGIjfUokwJ0n3+GyOcx5nQGzI8Pdj JN+cmxfnWngMD7qpqEPwENiAjBTof6/I0f3Zv/1XEqrqaD9RzpwE0BJlSecyAfk+2Jau IQAhj9qwGVOqT1QKEcNFzyoPmKToL9cdmQdYAI1lIFqTPndC46tRXtJKkOzSXiFt8qJZ K6Dzu3PvBrZOPxGBvgS1jUKi3Tg5u93ygIYJS2CQDwhIjQrKoBU8ZZwshtTEnjgtUiuR 1i8g== 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=QYR5NsE6sy8TKuNQHq0fl0E+u87DDSloXcW16PVAy78=; b=5AIB3e3cg3oVXzr1eN77t9fQJ2vwuZIApg0wzDp4BkJo6Befq3Aeeu7qg876YhglRS s+4DdcZ6Dqo4qsJi4Qj/tFRJJ76QWiGYVyc+C2nuOzraV01AG8Bt5siYjMN69GVGsjJF xgaJ6MaFgRNiCCDWC30MD2UBj12UvVYK0Ttz9v0k2usqEVvwtNn/nzHnl5YHdAv46dfs 0Yu5JMBAcDVdyQ1EX2kXDe8mnMzc+Biq6IiP2vQFalKOxKbqrJ926c/kmghZtFAqtX91 j51wF8qSANOGaGvqm+lClsLb+VQwI7BKU8+Las0W7Izj4xMWXj9xE5/759kVjTjTIWav XTOQ== X-Gm-Message-State: ANoB5pmLrx/1VmVWmtbsQHoltX8iV06bBqxUkgrA7nfFv3hcYQqgI2lc OfgoNT9eI8FrucCbQm+tRo/9rl+ihy86pQ== X-Google-Smtp-Source: AA0mqf7VoTWqFbtlbXGZ1EJhSl8ENgZHEzzdBA5/F0rXVUC9T8Lrn1X3UGTdeobro+GX4K772zp5SA== X-Received: by 2002:a05:620a:2044:b0:6fa:89:6642 with SMTP id d4-20020a05620a204400b006fa00896642mr19607031qka.284.1668610160080; Wed, 16 Nov 2022 06:49:20 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:19 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 04/14] serial: liteuart: don't set unused port fields Date: Wed, 16 Nov 2022 09:48:58 -0500 Message-Id: <20221116144908.234154-5-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Remove regshift and iobase port fields, since they are unused by the driver. Signed-off-by: Gabriel Somlo --- drivers/tty/serial/liteuart.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 989a4f8d5bd4..c6eb7eba5af8 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -263,9 +263,7 @@ static int liteuart_probe(struct platform_device *pdev) port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF; port->ops = &liteuart_ops; - port->regshift = 2; port->fifosize = 16; - port->iobase = 1; port->type = PORT_UNKNOWN; port->line = dev_id; spin_lock_init(&port->lock); From patchwork Wed Nov 16 14:48:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625416 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 02B1EC43217 for ; Wed, 16 Nov 2022 14:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233588AbiKPOt3 (ORCPT ); Wed, 16 Nov 2022 09:49:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231806AbiKPOtX (ORCPT ); Wed, 16 Nov 2022 09:49:23 -0500 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6911D1CB2A; Wed, 16 Nov 2022 06:49:22 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id z1so11723202qkl.9; Wed, 16 Nov 2022 06:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=zatoQ8/a+60T2AmPXnfE9c4vLIYDpN6MzKVzyD4F9Ww=; b=LrbuARdq6SFzMwJAQQC0f/+7AU6V4HH0DWEhvf24Odg7fYKrq07HsMHcSZWyFXZgn6 srh6Ys0opE9worUgikHmBph2tdgAEC74sryJOixXQ0nnGLr2jLyZ8oTre2i9b3uEkyL0 5Zu+woROpu3r3tUwnvwY2vWDZ8RYjCtOvcrUrXqDhudskSLEF6bxBgI7tx0HU7kjPD+7 E/JoMxf6bH9A7WFBcdFU92Ix6hWUQeEVaE5AzCO6o/ax9/9WlCQKr+dgtLn52oVlIcmq NGob1zMzoU3OnlT+9JZ8yinkCEAOGJpJzbH4smXKoVmzye5N9lo/IzxG2dCjBCyfSE6P KfWw== 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=zatoQ8/a+60T2AmPXnfE9c4vLIYDpN6MzKVzyD4F9Ww=; b=5RGcPGIuA8UOjCG8iJWxlYBp3kh2WghNvoxrcO8Hdkq6zEDBEgn6HE7MBYCWLjaoPi Ji9+kJDBPwVnnoPqWfBTZIcjNTRg3L0x+wVqXTAkQWhQicEwSjmKMx6x9z9twhJyIb4g Ig3pJhegLVt8mNK2VP0LsMJorEQ5ATF20ihDmvo1ymYEWRXtZmQauoLj28LKMslPXpdZ xLxTzmheN7cJDjr6bGTTkkIQ5lO5SRgPPo7wqs2MPXB/1dhMYXYfXLwd1YI1gBF22qlG wxJiv8YOGmnbJ6TheR0sc+a9AHPqO0gYXGATjI13WrFRmqgW8fwVsEBku64Qxnr4S8dx kaPw== X-Gm-Message-State: ANoB5pnZmH0KtIYZIXUWjm2/vsUUSqzjutSzB/7WK4dBz9Wx85YhozhX h0GHVuDhkkoGS6DeWZ7OOvYMPP9DLn6lDg== X-Google-Smtp-Source: AA0mqf7tqDWFNci9vaPK2mIsCnn/fu7b+2VRhfFHAzaZMmze2QKGLJqR8wLOrfjijzq8tCrj5i+QEQ== X-Received: by 2002:a05:620a:68e:b0:6fa:124e:d8aa with SMTP id f14-20020a05620a068e00b006fa124ed8aamr19945966qkh.604.1668610161101; Wed, 16 Nov 2022 06:49:21 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:20 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 05/14] serial: liteuart: minor style fix in liteuart_init() Date: Wed, 16 Nov 2022 09:48:59 -0500 Message-Id: <20221116144908.234154-6-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index c6eb7eba5af8..1e3429bcc2ad 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -397,12 +397,10 @@ static int __init liteuart_init(void) return res; res = platform_driver_register(&liteuart_platform_driver); - if (res) { + if (res) uart_unregister_driver(&liteuart_driver); - return res; - } - return 0; + return res; } static void __exit liteuart_exit(void) From patchwork Wed Nov 16 14:49:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626038 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 2E272C43219 for ; Wed, 16 Nov 2022 14:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233309AbiKPOt3 (ORCPT ); Wed, 16 Nov 2022 09:49:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233459AbiKPOtY (ORCPT ); Wed, 16 Nov 2022 09:49:24 -0500 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D8A2D1C7; Wed, 16 Nov 2022 06:49:23 -0800 (PST) Received: by mail-qk1-x733.google.com with SMTP id v8so11715355qkg.12; Wed, 16 Nov 2022 06:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=D1hUB1CG0ZAd5p0bPUclNpK4BZ15p3GlgtAxgJ6lCak=; b=WbrkarbYRAipvYkcAzjHvEMKaXGegCTc2uv+unvZycfM2jKpbqhhxtEoo3npceJIgy iaZ+ccJlQNGyWtx22hVeX3ljjW2T5ygfoWpGYwBMDsnYAIVJQM1Gbl4k2CyEqbBp534S 3+v6EtLyVmWy3FLsN5Jtw/oBpelIlJgtRWf7cthl17gH9s4cGb6ZpC+u1K8GFvzi/Q3Y QVkvBW+pEjskqdsaO+X4x4L6ZTiTICAK58tVq33t1KNew1nZcIma5dAGjiTP9pcvuolS cEn0ZOAK4Xiq/cZAPG7KhWf0jPOqsrcRc2vr13WIeZ076Z1VPebixf4aJxvwF7+1k6Dl qimw== 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=D1hUB1CG0ZAd5p0bPUclNpK4BZ15p3GlgtAxgJ6lCak=; b=AFBQWJ78A1CrxWPo6/gh6GKiUDfMjWt7F6ddbJqKf4A2DgRCx3Jd99nmQNB6RCwgqm i/amFgjs0FInxF6+vmJrrfyQBqzNrfLvPhQm611S8dAlSzYOLTF6m56ByPPLXWSI3gpg v2Io3KB3cMKgDgoVQc0ql9W63Qyw/wIVFpK90Hwvgl7dmLIyPHnmvT2zuwZpNx+TphE1 ckxDR2TkjCccqgLyrOhZkqCDhjdYhCK8AMyeocPfoBNFRrwDa9aYGKuaOaVeefjgl+6w 5uVnsVG6xKVqiTXFwCFlM/Zoru1tFMCQdo7zDi5mSvkRrtTj11OhF7Z+4gUEBbk1nZ7f yY/w== X-Gm-Message-State: ANoB5pkBT8jvo+hNntSfwtmT2HKwBCccNJqgN2II/hNVtdkDGJsxB6sB WoPe7zBH2rs3FnM1mgZKtKYLuAfhcp73uw== X-Google-Smtp-Source: AA0mqf4PUu1pfZAjTRzZ3fOghb2DCSzQiUgjzsQtawSyorZiUtKh8dPoupxHrtcUh8A5CeT7Bqmd8g== X-Received: by 2002:a37:92c6:0:b0:6fb:5561:40a8 with SMTP id u189-20020a3792c6000000b006fb556140a8mr16479070qkd.669.1668610162272; Wed, 16 Nov 2022 06:49:22 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:21 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop Date: Wed, 16 Nov 2022 09:49:00 -0500 Message-Id: <20221116144908.234154-7-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Calling tty_flip_buffer_push() for each individual received character is overkill. Move it out of the rx loop, and only call it once per set of characters received together. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 1e3429bcc2ad..81a86c5eb393 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -87,10 +87,10 @@ static void liteuart_timer(struct timer_list *t) /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) uart_insert_char(port, status, 0, ch, flg); - - tty_flip_buffer_push(&port->state->port); } + tty_flip_buffer_push(&port->state->port); + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } From patchwork Wed Nov 16 14:49:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625415 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 52B02C4332F for ; Wed, 16 Nov 2022 14:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233675AbiKPOtd (ORCPT ); Wed, 16 Nov 2022 09:49:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233545AbiKPOt0 (ORCPT ); Wed, 16 Nov 2022 09:49:26 -0500 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698372E9DE; Wed, 16 Nov 2022 06:49:24 -0800 (PST) Received: by mail-qv1-xf36.google.com with SMTP id ml12so12068039qvb.0; Wed, 16 Nov 2022 06:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=b0pSt1+sCUSY6i1VSOZXSpAW8agas2OEhVBqCQWzkeE=; b=BWmkADy+pa4FoNb6SR2sVqHODzqe/raSSVOBjqVntv9+B75MvCutUtPgQLlxjYQ2tD jkHfi2ZdCZQ9bWASl5dg3ea+PNon+WClGeIDWlNAFxwOYn1wU43S508gaIqCDD/4r+sM y7DIk/d6ucGoXCm+jHYnfuNOhY7t3BgUs8Ja51saTD6gm7Liez/1LnlX5OkK0D0/TYZb a5yJe1DBE1OGniPw7uutN/w4afmjaKlWwDsdn0vk840ODL4AXm+HzL0zTpaYmlEY5UuR OIitmDV3E38KjlY40QC/BSGZ3PZK/DZ7I06ML6ZYzZihHueyRYAlnu9VvkD8zzGa/EKq SAPw== 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=b0pSt1+sCUSY6i1VSOZXSpAW8agas2OEhVBqCQWzkeE=; b=NqDiWDW3RWDQWm8Umm1C9A65363GJ4FybnQcJUEsBFHmn9W8p1ukzc3xZjoEaE+eRY fciCj3jubCSP6A61LYgujCSZNctVPzvcivEh4ws+CsmKbqxHqTKGxES79HKLeJpYKv5i //O9FMuj2iFyI8NHNwY9P6q4EOpKkRJKhIapa9iTTc2qEVUDeQxfcgIEdJs+myb+M4P9 K6f8Ya6QyCF9JgG9xCOzb+N6y1t71y4XjST0Xl1XsDHihPEghi1fUZMd3bTc7yRH/GBX vz1XGl6bGuADr23g+Ko+Pl46bLCogN9lPSUZwws/eQTITV3LNPdYD7zJlwWoYXTuFawU OgUQ== X-Gm-Message-State: ANoB5pldyZXaUu88ymFPwfX9hg/JVqb27mVLQZT05IIS1XeZT3XqORy1 VlVBCT0rSpvZ+NxzjS4aCYC6fXvodvyylQ== X-Google-Smtp-Source: AA0mqf5qOBjFdAixbyShURlAgcZ8nNWfDbCPG7kSqX6TVljbXTfXF43OUmq2gutGHbPfq07eWjtr7A== X-Received: by 2002:ad4:450d:0:b0:4c6:5a5f:3063 with SMTP id k13-20020ad4450d000000b004c65a5f3063mr6790531qvu.4.1668610163228; Wed, 16 Nov 2022 06:49:23 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:22 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 07/14] serial: liteuart: rx loop should only ack rx events Date: Wed, 16 Nov 2022 09:49:01 -0500 Message-Id: <20221116144908.234154-8-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org While receiving characters, it is necessary to acknowledge each one by writing to the EV_PENDING register's EV_RX bit. Ensure we do not also gratuitously set the EV_TX bit in the process. Signed-off-by: Gabriel Somlo --- drivers/tty/serial/liteuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 81a86c5eb393..c90ab65fbdcf 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -82,7 +82,7 @@ static void liteuart_timer(struct timer_list *t) port->icount.rx++; /* necessary for RXEMPTY to refresh its value */ - litex_write8(membase + OFF_EV_PENDING, EV_TX | EV_RX); + litex_write8(membase + OFF_EV_PENDING, EV_RX); /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) From patchwork Wed Nov 16 14:49:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626037 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 4484DC4332F for ; Wed, 16 Nov 2022 14:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233576AbiKPOti (ORCPT ); Wed, 16 Nov 2022 09:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233561AbiKPOt0 (ORCPT ); Wed, 16 Nov 2022 09:49:26 -0500 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB7A432B8B; Wed, 16 Nov 2022 06:49:24 -0800 (PST) Received: by mail-qk1-x733.google.com with SMTP id v8so11715408qkg.12; Wed, 16 Nov 2022 06:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=zbM5jPqWMW+ZSl/JSR0+XTeoHUgjIND5CEiOvEuQtSk=; b=PRWc0U7J5pAZNRoK7CPP+L+WKOUezRC7GcfZGc/EkY9Oecm/u4DIcjZYj+Yyipg6sS 178IvYFnqI1hnjr/OrvAoAgqOBmL306RkNSmdyhFWym+EKqXfwgmN8am4I/DLZs5ARpB ZR2CQnaskTci2KGFuk0gA+s+cRzngvkBJ2WLuV9NVelmKprPuPXee18Mfm3Z0Js4bUG/ ZHVKd7Bunhvg7VWT8AHzqaHXUr9pk20jfFbuAxE8YNwWtNMT+INF3yo8Eh06RjJFm/xC RelO8ogc5Ndh7K/jqMYrTZdw2KmBzec5b2xnrUdCxa+hOczfCkyZ3pxmhCdaYeMh60je GaMA== 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=zbM5jPqWMW+ZSl/JSR0+XTeoHUgjIND5CEiOvEuQtSk=; b=1yFuP4mU42pRTTV3En9kpHndyNms2ZAqkUZNeNG7JJfUK4JLD7HijLMdIgIM5YOUT6 liT+8aNn+6kT7w9pjNue4nfzGhaIjjrOQ3Y20ScEsEtcSdXSRFwJ+ZbD8Ke863s3rJr1 +ryslLXg5oMOV2eOMuAbCEcFcbCPu7dkkm30tRfOJp46LC+Drswc84VADKDZBgNPTwpA I1Y6+DpuDDluPDcPoJUUH4niopXhMg7FyvIC97M8PCnR8jjAWkWNuiToM/svMQ+Zt6g6 8fX3ejbcU7Dw10MDkjbpjJ82OTKW3n3qhCsMzxR/hC+wx2SV6qxuWL+G1IAL4YMNUd1Y x+1w== X-Gm-Message-State: ANoB5pmzFTFDYkaYvQNXhUl4TpPi13vumlMXzG1MorVGXJpc/GdTsV9i c9a+j9wafbAfwgQTnAJ9n7BWwwEE+vf6Mg== X-Google-Smtp-Source: AA0mqf6p2uq0pZRkd8/l6mb/PcvGZco83vJ7V5lzW2+57TlRJ0WnQO+welWA5FPATcUIc84zDS6S2Q== X-Received: by 2002:a05:620a:3708:b0:6fa:88c:50e5 with SMTP id de8-20020a05620a370800b006fa088c50e5mr19318464qkb.186.1668610164217; Wed, 16 Nov 2022 06:49:24 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:23 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 08/14] serial: liteuart: simplify passing of uart_insert_char() flag Date: Wed, 16 Nov 2022 09:49:02 -0500 Message-Id: <20221116144908.234154-9-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Simply provide the hard-coded TTY_NORMAL flag to uart_insert_char() directly -- no need to dedicate a variable for that exclusive purpose. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index c90ab65fbdcf..81aa7c1da73c 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -73,7 +73,6 @@ static void liteuart_timer(struct timer_list *t) struct liteuart_port *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; - unsigned int flg = TTY_NORMAL; int ch; unsigned long status; @@ -86,7 +85,7 @@ static void liteuart_timer(struct timer_list *t) /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) - uart_insert_char(port, status, 0, ch, flg); + uart_insert_char(port, status, 0, ch, TTY_NORMAL); } tty_flip_buffer_push(&port->state->port); From patchwork Wed Nov 16 14:49:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625414 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 91388C43219 for ; Wed, 16 Nov 2022 14:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233755AbiKPOtk (ORCPT ); Wed, 16 Nov 2022 09:49:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233643AbiKPOtc (ORCPT ); Wed, 16 Nov 2022 09:49:32 -0500 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A79F52D1C7; Wed, 16 Nov 2022 06:49:26 -0800 (PST) Received: by mail-qt1-x829.google.com with SMTP id jr19so10777826qtb.7; Wed, 16 Nov 2022 06:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=AUJ4wmyHldmie0gv1i5ed1iRJzoHABMpIHKKor6rIMU=; b=UK+4W/tZnQ3nJx2fg8CxMw5okEpDI1+RbjMzW+k0vTeDQzjRo9kFVFA4+y6qMvjtjk ofKKesMCD7H6VOpH0acPm19dlRhPC0R29sj6VmzG/PmKmXnBd2Rl88FJmCVAREDXjhIF 8NBXQSMpXWWwv867j3rKzigzm655q6iMz626SZR0unzDlRNVqTKqfZKVqEXR2HhJZzls UU0EwSg4Hm4GPdyXXhIMwGUM34MAeWowo+usiruyHxW9gIDNENxtFhiwJRhY6RUUif3d pZ37m7EtqH4qKSUDDk03ccF7u0899nB7ZucmDbgDonMPOnzFU5cW+REeNSCWfnF3FIpI ptpg== 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=AUJ4wmyHldmie0gv1i5ed1iRJzoHABMpIHKKor6rIMU=; b=ZrWBauAjb8NzP/5urQqGrZ9fyj60LVlEdQMcnn+MCBwTRSL25B3YVDumpn5EJx/hRr jBGmJsijXpIgb+WPaYC1Ay0IWG2XVGS1enj+BZe0ryP9szRfc6upxTclvGukKNzrCNtH n011HY1jXVcMBrfEuqkjK19gdEoPPRI4/iORBYPt1VpopjnWOGW8zma0Caf7kkLXFb+X 81nms98sWDRwR9Dd3VfbMc30e7xP0/K2tzz7RcG5Vh0eWOdTSZpF0J3dcmlf9JLH4/zC oJACveWivyczUK/+05RbrxDvxdXf/3RfxapBzYJdA4Ng9QXVGkb3gbvBAate9JckFd87 H12A== X-Gm-Message-State: ANoB5pmnwE24RBI6bcmQBA47ZM0Bk3yg982ZAHBHMPdl32eAoFkiuj2f zXhvg7Hde/BPCBQkH+mxt9i/YqHR/ATddA== X-Google-Smtp-Source: AA0mqf5AWisHXZFcMr7VRZI1b4RNxrtCidTJ3ZlM8685E46b/XAUGpx+nLWoiCjTE5dwq6sS09ai0g== X-Received: by 2002:a05:622a:a0b:b0:3a5:4fdb:ac40 with SMTP id bv11-20020a05622a0a0b00b003a54fdbac40mr21241113qtb.268.1668610165509; Wed, 16 Nov 2022 06:49:25 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:25 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 09/14] serial: liteuart: fix rx loop variable types Date: Wed, 16 Nov 2022 09:49:03 -0500 Message-Id: <20221116144908.234154-10-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Update variable types to match the signature of uart_insert_char() which consumes them. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 81aa7c1da73c..42ac9aee050a 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -73,8 +73,7 @@ static void liteuart_timer(struct timer_list *t) struct liteuart_port *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; - int ch; - unsigned long status; + unsigned int status, ch; while ((status = !litex_read8(membase + OFF_RXEMPTY)) == 1) { ch = litex_read8(membase + OFF_RXTX); From patchwork Wed Nov 16 14:49:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626036 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 38991C43217 for ; Wed, 16 Nov 2022 14:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233788AbiKPOtl (ORCPT ); Wed, 16 Nov 2022 09:49:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233646AbiKPOtc (ORCPT ); Wed, 16 Nov 2022 09:49:32 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2675F391C2; Wed, 16 Nov 2022 06:49:27 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id x21so11769008qkj.0; Wed, 16 Nov 2022 06:49:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=I7E1AL+Zmws98336Eqgx5BGd+1bmMfsNL2UgCg2pcHE=; b=ZKwMXYAsBcmAgWdCUpSDxHcOrSAXlYOV7PAff/y6tTwJgXKL2kko/HH+3zquX9d+Sw FaHlyQZJgCf41nMo5DShHj+ZzRrxgnmlwpaCfxRqos7D8hyJRt7P9zmZb85iwTa6+6ja 6+4ofDmcoy8y6nBB+AFYXGTmnF8tqgbYlGPGKQhT2iqEHqvvT++4xBdSPe0xvGfWUra5 +y0mwVPtBQ5efqDQHPeTf+IU8/m+5bNruvn0r/1xmn0ZvRDvShe2mZT0H5by3tHOcjzw jMIKUH3jj9CrJ7IH+aqQUuCdKABzCp97neG+Hq/FQk7KEZkHUVek3a1yfDsMwcGvnJli a6Iw== 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=I7E1AL+Zmws98336Eqgx5BGd+1bmMfsNL2UgCg2pcHE=; b=kHTK6MLSurpldSe2I4UKe7DzZMLB5qTb37Yzw1Z+RO825tgcYCnbNl93U8dOBrCIkx 4AckTxQ9aFQYNaLo5EnlZPK8mtAcQad9mM8bvfX3YBlYd/ptfs3C81HEn3nG3BBe6O0+ JHNoAE4BiZrL/bOZOphi57ZdZlwOCbNrxIKN1yipFcq0cUAf/2U0uYkIjAWgWqkgE3xo 0OZy4xevvoLthIqVMD9msBQ6nD6wlRaRLDs6/NZLpOApDLWGzHgHWzkhXe90hDWkBxis Tl3N9Ocj29Do2lnTRi739FV1j4NJ0Owf6EbMw3Vk0kK9ZqSyPYdjYrk5cHHwcqvQKZ5u ZVzQ== X-Gm-Message-State: ANoB5pl5M6oBth7bkySlJP8GjEhcCzGqZcd6GF2ziaIOAmDz97MNK19P 8n3xUU+tlKGVNde84N4CqqECd4yES8Ds0Q== X-Google-Smtp-Source: AA0mqf6yroafD6MBCF8u1LTokPl+RPZSCcP5FyT6dyv/clcgiTUFHWjC1bhLTHuM003S3RCkLzaboQ== X-Received: by 2002:a37:63d0:0:b0:6cf:5fa1:15f8 with SMTP id x199-20020a3763d0000000b006cf5fa115f8mr19666482qkb.748.1668610166484; Wed, 16 Nov 2022 06:49:26 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:26 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 10/14] serial: liteuart: separate rx loop from poll timer Date: Wed, 16 Nov 2022 09:49:04 -0500 Message-Id: <20221116144908.234154-11-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Convert the rx loop into its own dedicated function, and (for now) call it from the poll timer. This is in preparation for adding irq support to the receive path. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 42ac9aee050a..76f8a09b82cd 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -68,10 +68,8 @@ static struct uart_driver liteuart_driver = { #endif }; -static void liteuart_timer(struct timer_list *t) +static void liteuart_rx_chars(struct uart_port *port) { - struct liteuart_port *uart = from_timer(uart, t, timer); - struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; unsigned int status, ch; @@ -88,6 +86,14 @@ static void liteuart_timer(struct timer_list *t) } tty_flip_buffer_push(&port->state->port); +} + +static void liteuart_timer(struct timer_list *t) +{ + struct liteuart_port *uart = from_timer(uart, t, timer); + struct uart_port *port = &uart->port; + + liteuart_rx_chars(port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } From patchwork Wed Nov 16 14:49:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625413 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 2A4DCC4332F for ; Wed, 16 Nov 2022 14:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbiKPOtm (ORCPT ); Wed, 16 Nov 2022 09:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233707AbiKPOth (ORCPT ); Wed, 16 Nov 2022 09:49:37 -0500 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98003F051; Wed, 16 Nov 2022 06:49:28 -0800 (PST) Received: by mail-qk1-x736.google.com with SMTP id d8so8516338qki.13; Wed, 16 Nov 2022 06:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=21klUdbfGDRjcluKPkIVpLANgI2deNdmI4jgyQps/O0=; b=EYgqspdiucuTWsvjn5S6eUubn/RonJlGGr6XQH9udQo5oPwaxVDlPnph7Uqr9uT43c jnddqrU9VZOGOAvSZCyhXOjg0QLntF8hRsx5fPxddi2x3KtN0sXQJi6ephoD/4pBAjQJ R13YdcKGMhbNobLjaC6zy7shjKf7dNtCVNfcDhopeGbavJ+HgFHOHpJhtQNe2Ko+/HEu rINoCnFKpAjrZ3Ns3uEcRh1RdJ0Ymm3JWkqNHhsPhmxdNahffUIYzkRkf81MWH0IImOW FtHKeabx8H3RisP0G/FMgfj+3rqCq6P3JL+RpTMeKzjPR6/D3Y26xOfNZ8FoOn92epsS a1OQ== 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=21klUdbfGDRjcluKPkIVpLANgI2deNdmI4jgyQps/O0=; b=xfN/h+t9kz2QwqNC/JM3g9XYNG0rRbEvJyy+1n/2lM7PmbvCx3+iPhhqOsj7ku7zHf fn/caGdddmbdLA8QjFSTnx3r8T7N8ggMXhLF/t58DqaqWbczhXL7A2Oved8XIcmF6lDU 6McgvC4MhWxXTWZ7/sBzlGRP115m1PL/9kGDjU8DTPAvsIP6Aibmq5ZZrM4fhQ6HcTPP dN3atEznWZ1oDFyW4hekQJULXLABjLLOJ7p9jil/w0vqjiFU4BSemF5UAHmFScExTvnq DE0o0bndVB4lhaZsVXVpl57Wwl64WuImHY+TwvYFOrIzPiAKDCkYPkVny1OAURAhCG6s 1wgw== X-Gm-Message-State: ANoB5plTejUeEQ7IrRCvqmNuFFuSu9cAkH7Vl+JSr6kCuypQ7NVQWOfS WKxyAHBLJ43oP+zL+VtXvqdiQiO+E21Qdg== X-Google-Smtp-Source: AA0mqf7jEQ6KqNUud3f9kU3ikIi1jHJPAI4w9x+VlydXU0a3WgHtXg2UsUW2AEaxGj7kcNNmv7xRmw== X-Received: by 2002:a37:a9c6:0:b0:6fa:752a:496 with SMTP id s189-20020a37a9c6000000b006fa752a0496mr19217958qke.428.1668610167537; Wed, 16 Nov 2022 06:49:27 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:27 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 11/14] serial: liteuart: move function definitions Date: Wed, 16 Nov 2022 09:49:05 -0500 Message-Id: <20221116144908.234154-12-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Move definitions for liteuart_[stop|start]_tx(), liteuart_stop_rx(), and liteuart_putchar() to a more convenient location in preparation for adding IRQ support. This patch contains no functional changes. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 82 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 76f8a09b82cd..8a6e176be08e 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -68,6 +68,47 @@ static struct uart_driver liteuart_driver = { #endif }; +static void liteuart_putchar(struct uart_port *port, unsigned char ch) +{ + while (litex_read8(port->membase + OFF_TXFULL)) + cpu_relax(); + + litex_write8(port->membase + OFF_RXTX, ch); +} + +static void liteuart_stop_tx(struct uart_port *port) +{ +} + +static void liteuart_start_tx(struct uart_port *port) +{ + struct circ_buf *xmit = &port->state->xmit; + unsigned char ch; + + if (unlikely(port->x_char)) { + litex_write8(port->membase + OFF_RXTX, port->x_char); + port->icount.tx++; + port->x_char = 0; + } else if (!uart_circ_empty(xmit)) { + while (xmit->head != xmit->tail) { + ch = xmit->buf[xmit->tail]; + uart_xmit_advance(port, 1); + liteuart_putchar(port, ch); + } + } + + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(port); +} + +static void liteuart_stop_rx(struct uart_port *port) +{ + struct liteuart_port *uart = to_liteuart_port(port); + + /* just delete timer */ + del_timer(&uart->timer); +} + static void liteuart_rx_chars(struct uart_port *port) { unsigned char __iomem *membase = port->membase; @@ -98,14 +139,6 @@ static void liteuart_timer(struct timer_list *t) mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } -static void liteuart_putchar(struct uart_port *port, unsigned char ch) -{ - while (litex_read8(port->membase + OFF_TXFULL)) - cpu_relax(); - - litex_write8(port->membase + OFF_RXTX, ch); -} - static unsigned int liteuart_tx_empty(struct uart_port *port) { /* not really tx empty, just checking if tx is not full */ @@ -125,39 +158,6 @@ static unsigned int liteuart_get_mctrl(struct uart_port *port) return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; } -static void liteuart_stop_tx(struct uart_port *port) -{ -} - -static void liteuart_start_tx(struct uart_port *port) -{ - struct circ_buf *xmit = &port->state->xmit; - unsigned char ch; - - if (unlikely(port->x_char)) { - litex_write8(port->membase + OFF_RXTX, port->x_char); - port->icount.tx++; - port->x_char = 0; - } else if (!uart_circ_empty(xmit)) { - while (xmit->head != xmit->tail) { - ch = xmit->buf[xmit->tail]; - uart_xmit_advance(port, 1); - liteuart_putchar(port, ch); - } - } - - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(port); -} - -static void liteuart_stop_rx(struct uart_port *port) -{ - struct liteuart_port *uart = to_liteuart_port(port); - - /* just delete timer */ - del_timer(&uart->timer); -} - static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart = to_liteuart_port(port); From patchwork Wed Nov 16 14:49:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626035 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 E9532C433FE for ; Wed, 16 Nov 2022 14:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233207AbiKPOt7 (ORCPT ); Wed, 16 Nov 2022 09:49:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233536AbiKPOth (ORCPT ); Wed, 16 Nov 2022 09:49:37 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B16E4326F4; Wed, 16 Nov 2022 06:49:29 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id d8so8516381qki.13; Wed, 16 Nov 2022 06:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=Q079jILUgJW/NMjEmrvfvn4MUn8PyV68OVRL5iIezGU=; b=IS+KjccqnuPoIzcQEkomczag9QgHfGynGlUwJ2nIhaMz4Vdg/WgUqo3cc5tCAVoqr8 TpD7lEv4IQmTALgSSRiE+IPITTJ4yQ/c20a2EsgvjN6sTDDEmsRIHGAYhDFA8gTHPRnZ 8MN4B2iX7ah9wp9/FnPfN9dL0NLD0O0+hV64fkBPIpLltf2J3mdyKYqWWP5M39371em9 4MGauV5FkwJ711919tCxjA38fiPDve4XVxX97yhrGg3/oU/+hB49FLHHUUGPURIX12ZN UMnc8P1/uJZ5V+SOugeSfzJjQfzG6lo8LJdLhsXAB0EWKzrbdYYom1xS5FuGZS1Hqntv dXGw== 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=Q079jILUgJW/NMjEmrvfvn4MUn8PyV68OVRL5iIezGU=; b=bpqWrzHgn9z6unctevWJJNZVeS0f+m1XZsMIKE60xq1Na++2Izp8Dc13s+cR7B9T/A 7GuORt0+lXv0cIE4jJ598L62qnUZKB0XIOI10ymxjpUtvYCQ2+vjGlF2Nm487NSFNvvn kiL65RjjYU3ax/IQNczv1MNYYDtsi037xiXdzQ6PxnSWDo2F33qjJGF3OMUoMUTswhFC gslkG6ov9sq/loiCwrJv7AdAXGmbNZRscLfCTtLDD6GPGAZhviEUgYUTZX0dgjQCv1WY 22Y90BtSbKC6dwoU6aPytZiLbDHr6RC7BMTQi8syo/jSPkn9Ai6hdtSwOrT9bdsvYtiV fYcw== X-Gm-Message-State: ANoB5plBROUM9OdpuTZvk9JDPLVPV6GOBMRacys6R3vaU3HLxLj1XF4J KeGwpfnQbYkb9y5bLo20W0N1b1CSR/8LXg== X-Google-Smtp-Source: AA0mqf6qSMQiNTTQ7t8aZNss59ZlfbH7b1WPHGr7w43cpwRaAHxUBQgbWcphe+TqOBH35/UCSX9Gjw== X-Received: by 2002:ae9:f718:0:b0:6f9:7535:dedd with SMTP id s24-20020ae9f718000000b006f97535deddmr15549922qkg.635.1668610168518; Wed, 16 Nov 2022 06:49:28 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:28 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 12/14] serial: liteuart: add IRQ support for the RX path Date: Wed, 16 Nov 2022 09:49:06 -0500 Message-Id: <20221116144908.234154-13-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Add support for IRQ-driven RX. Support for the TX path will be added in a separate commit. Signed-off-by: Gabriel Somlo --- Changes from v3: - add shadow irq register to support polling mode and avoid reading hardware mmio irq register to learn which irq flags are enabled - this also simplifies both liteuart_interrupt() and liteuart_startup() drivers/tty/serial/liteuart.c | 76 +++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 8a6e176be08e..fad778578986 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,7 @@ struct liteuart_port { struct uart_port port; struct timer_list timer; u32 id; + u8 irq_reg; }; #define to_liteuart_port(port) container_of(port, struct liteuart_port, port) @@ -76,6 +78,19 @@ static void liteuart_putchar(struct uart_port *port, unsigned char ch) litex_write8(port->membase + OFF_RXTX, ch); } +static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 mask) +{ + struct liteuart_port *uart = to_liteuart_port(port); + + if (set) + uart->irq_reg |= mask; + else + uart->irq_reg &= ~mask; + + if (port->irq) + litex_write8(port->membase + OFF_EV_ENABLE, uart->irq_reg); +} + static void liteuart_stop_tx(struct uart_port *port) { } @@ -129,13 +144,27 @@ static void liteuart_rx_chars(struct uart_port *port) tty_flip_buffer_push(&port->state->port); } +static irqreturn_t liteuart_interrupt(int irq, void *data) +{ + struct liteuart_port *uart = data; + struct uart_port *port = &uart->port; + u8 isr; + + spin_lock(&port->lock); + isr = litex_read8(port->membase + OFF_EV_PENDING) & uart->irq_reg; + if (isr & EV_RX) + liteuart_rx_chars(port); + spin_unlock(&port->lock); + + return IRQ_RETVAL(isr); +} + static void liteuart_timer(struct timer_list *t) { struct liteuart_port *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; - liteuart_rx_chars(port); - + liteuart_interrupt(0, port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } @@ -161,19 +190,45 @@ static unsigned int liteuart_get_mctrl(struct uart_port *port) static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart = to_liteuart_port(port); + unsigned long flags; + int ret; - /* disable events */ - litex_write8(port->membase + OFF_EV_ENABLE, 0); + if (port->irq) { + ret = request_irq(port->irq, liteuart_interrupt, 0, + KBUILD_MODNAME, uart); + if (ret) { + pr_err(pr_fmt("line %d irq %d failed: using polling\n"), + port->line, port->irq); + port->irq = 0; + } + } - /* prepare timer for polling */ - timer_setup(&uart->timer, liteuart_timer, 0); - mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); + spin_lock_irqsave(&port->lock, flags); + /* only enabling rx irqs during startup */ + liteuart_update_irq_reg(port, true, EV_RX); + spin_unlock_irqrestore(&port->lock, flags); + + if (!port->irq) { + timer_setup(&uart->timer, liteuart_timer, 0); + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); + } return 0; } static void liteuart_shutdown(struct uart_port *port) { + struct liteuart_port *uart = to_liteuart_port(port); + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + liteuart_update_irq_reg(port, false, EV_RX | EV_TX); + spin_unlock_irqrestore(&port->lock, flags); + + if (port->irq) + free_irq(port->irq, port); + else + del_timer_sync(&uart->timer); } static void liteuart_set_termios(struct uart_port *port, struct ktermios *new, @@ -262,6 +317,13 @@ static int liteuart_probe(struct platform_device *pdev) goto err_erase_id; } + /* get irq */ + ret = platform_get_irq_optional(pdev, 0); + if (ret < 0 && ret != -ENXIO) + return ret; + if (ret > 0) + port->irq = ret; + /* values not from device tree */ port->dev = &pdev->dev; port->iotype = UPIO_MEM; From patchwork Wed Nov 16 14:49:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 625412 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 03643C4321E for ; Wed, 16 Nov 2022 14:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233746AbiKPOuA (ORCPT ); Wed, 16 Nov 2022 09:50:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbiKPOtk (ORCPT ); Wed, 16 Nov 2022 09:49:40 -0500 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8CF83FBBE; Wed, 16 Nov 2022 06:49:30 -0800 (PST) Received: by mail-qk1-x72b.google.com with SMTP id i9so11719332qki.10; Wed, 16 Nov 2022 06:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=bD7MdS5vDL9626kuFaCs08bkmWREVcZginG5UxkUB7M=; b=pH88cF+6+fCCO8t2vnymPV45Mzm/I5WpC0TiRTmOrXy6ff5gi3fXdgDC00/f1djz04 4dPmABNZYkvNQeXWUYlliMOAjk2McGALqtk4OoGencURYqCgybr9OEYHlzHrYDsfQuSe ZVaO8K06t5cmk58K3RFmwSIS8ZX6G7arXO5QIMRBo9kt83YVOPkgca63u72Yxwg7T49e 6vGzaTkxp9CAUnDFA930tf/U8YRbbWXK1pLikdt7XzpfgSLbxBlEVYS2g6zAD9wbuZUE rObMeo1H0R5ttDPPKkiTVPHjWlZT1gSfpz++BT+e/UW3UMMbjKE/pjn8gQoNYwRhEFpm ejuA== 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=bD7MdS5vDL9626kuFaCs08bkmWREVcZginG5UxkUB7M=; b=tS1hllbGLbuynRYs3mDlUxLfcra6QlZYoSS0XDRZnRjFC2+fqXwh7C/jATLXrhuKZ6 IbTbHOlsJgO+ts+LYQpkz/1bzcqU8QatsoJZgfur/JXnMsAXsoecfSk1DC3sIO8Cj+mo OQD4rRwHvpauveVpTquVnfy8LqWtixpglRHJJnmg7cKG1q5tGG7OBMuUQ/b5EcnUAzan Xbg66NGkYoTPVazOv1CxsKq2tR/VB9mgpJQqeBzYCIDCNDbuR/9ogH/vHX+8bRlAfmKv HCselrj4t0alFfIf1vHGB9Xv8Ks2ZywuzdAmnQqIyltpyKw8v+iD3bwRuiurCuBjWsWq YPqA== X-Gm-Message-State: ANoB5pmQa3K1MFRODqw/ztjM4ZzBCt6CT0khw8qKYNU+HvGkB43HHYYB yTq+Q2XO19F3jP6OnpX03mUk6kxwbX7vfQ== X-Google-Smtp-Source: AA0mqf46bEGiaBCY5KTx158m40sy8VkOnE7ZMH1L7L75HcN6X7Js2CH1vv07o952Q+UegHfvzXLaOw== X-Received: by 2002:a05:620a:c43:b0:6fa:6423:65b6 with SMTP id u3-20020a05620a0c4300b006fa642365b6mr12498013qki.324.1668610169549; Wed, 16 Nov 2022 06:49:29 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:29 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 13/14] serial: liteuart: add IRQ support for the TX path Date: Wed, 16 Nov 2022 09:49:07 -0500 Message-Id: <20221116144908.234154-14-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Switch the TX path to IRQ-driven operation, while maintaining support for polling mode via the poll timer. Signed-off-by: Gabriel Somlo --- Changes from v3: - remove superfluous curly braces from liteuart_interrupt() - simplified [start|stop]_tx() by using shadow irq register from patch 12/14 - simplified liteuart_tx_chars() by rebasing on top of tty-next tree drivers/tty/serial/liteuart.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index fad778578986..977fc4349b47 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -93,27 +93,12 @@ static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 mask) static void liteuart_stop_tx(struct uart_port *port) { + liteuart_update_irq_reg(port, false, EV_TX); } static void liteuart_start_tx(struct uart_port *port) { - struct circ_buf *xmit = &port->state->xmit; - unsigned char ch; - - if (unlikely(port->x_char)) { - litex_write8(port->membase + OFF_RXTX, port->x_char); - port->icount.tx++; - port->x_char = 0; - } else if (!uart_circ_empty(xmit)) { - while (xmit->head != xmit->tail) { - ch = xmit->buf[xmit->tail]; - uart_xmit_advance(port, 1); - liteuart_putchar(port, ch); - } - } - - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(port); + liteuart_update_irq_reg(port, true, EV_TX); } static void liteuart_stop_rx(struct uart_port *port) @@ -144,6 +129,15 @@ static void liteuart_rx_chars(struct uart_port *port) tty_flip_buffer_push(&port->state->port); } +static void liteuart_tx_chars(struct uart_port *port) +{ + u8 ch; + + uart_port_tx(port, ch, + !litex_read8(port->membase + OFF_TXFULL), + litex_write8(port->membase + OFF_RXTX, ch)); +} + static irqreturn_t liteuart_interrupt(int irq, void *data) { struct liteuart_port *uart = data; @@ -154,6 +148,8 @@ static irqreturn_t liteuart_interrupt(int irq, void *data) isr = litex_read8(port->membase + OFF_EV_PENDING) & uart->irq_reg; if (isr & EV_RX) liteuart_rx_chars(port); + if (isr & EV_TX) + liteuart_tx_chars(port); spin_unlock(&port->lock); return IRQ_RETVAL(isr); From patchwork Wed Nov 16 14:49:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 626034 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 59241C4332F for ; Wed, 16 Nov 2022 14:50:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233866AbiKPOuC (ORCPT ); Wed, 16 Nov 2022 09:50:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233770AbiKPOtl (ORCPT ); Wed, 16 Nov 2022 09:49:41 -0500 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBB9E17A9E; Wed, 16 Nov 2022 06:49:31 -0800 (PST) Received: by mail-qv1-xf29.google.com with SMTP id u7so12003003qvn.13; Wed, 16 Nov 2022 06:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=GsRGGaIiBoJlwl/45zB6BAECaPWQUSVeGqaE9kAVQrI=; b=CqrrIl3uMqf9NCB5q4CLw/Pa8BCbWfgMrW1s9jDsDO0IemRCQGuS1bWJnczyJEz4yv sSzpnT2kKzIrTl4xHRy6MuaGNn4SYXg5fPxuSXtaZvP4CPLvgFmhMtqi5ouDKYYD1Kyl 2QKrrtN/XU1QXctfCpfvsqxQxigLLro4miqSM0JVDHd5YDAlc5+DGPZUW96wJ1s85mE4 VjHj/3V8++CJPw5A3x660GYei74pQ8yyorgP79WHClIW00NWC3RH0on+zHo/JrT3nN/o qaojdX1Rbi+azeYmSoA0e1fqTfQjq7Yd62hTSyTbb8yFapevogH9pQgQKjyXdK0NXWVA leLg== 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=GsRGGaIiBoJlwl/45zB6BAECaPWQUSVeGqaE9kAVQrI=; b=tLrRNeCt9UajBy8AfNxCHY+kloSy50SQNXGINjpPnM1yyN0H9raTMATDkCAFgHSifQ awGBs/WVIBRz768Tbd7CpUPTLpa2Me17Q6C+3MWd62lQ9Gls55iNO9Vx2tEWv1Ft9JCx HrB19qufbgLyXLdhNTo9q+YWom1fdkjTNpGO9AqponmeQ1Kn1HbiOhz0xA32F7b/zH8m 3p02kt3HYoQ5LPvvHlFyHajPJcWcmaX+XH8Us0zISm9vYvdlLFbFDkNoNIghePGn9Yvf vpocaDvxh3xOZdLj/Ij3BRevF+7E15xKD6p2aTKPigBKxRCBROJksRxK55k0XiTwakVV VbEg== X-Gm-Message-State: ANoB5pk6zD7N1PLLHBaLnuegO/YRNDTBrx8dEFZZTbJI61tRi60MV4v8 fdaJtaNEisBzah7o704uxrKN0N5LKOZXtA== X-Google-Smtp-Source: AA0mqf7GNSwZZJNcB+oms94DY8nCWtNvbQUHc7BMFnPcrIxoh8m0VYjlpfke324iahugsfe/I0dNTQ== X-Received: by 2002:a05:6214:370c:b0:4bb:64f7:dce5 with SMTP id np12-20020a056214370c00b004bb64f7dce5mr20740663qvb.15.1668610170609; Wed, 16 Nov 2022 06:49:30 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id g5-20020ac84805000000b0039a55f78792sm8729624qtq.89.2022.11.16.06.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 06:49:30 -0800 (PST) From: Gabriel Somlo To: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, kgugala@antmicro.com, mholenko@antmicro.com, joel@jms.id.au, david.abdurachmanov@gmail.com, florent@enjoy-digital.fr, geert@linux-m68k.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 14/14] serial: liteuart: move polling putchar() function Date: Wed, 16 Nov 2022 09:49:08 -0500 Message-Id: <20221116144908.234154-15-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116144908.234154-1-gsomlo@gmail.com> References: <20221116144908.234154-1-gsomlo@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The polling liteuart_putchar() function is only called from methods conditionally enabled by CONFIG_SERIAL_LITEUART_CONSOLE. Move its definition closer to the console code where it is dependent on the same config option. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 977fc4349b47..238f615cb80e 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -70,14 +70,6 @@ static struct uart_driver liteuart_driver = { #endif }; -static void liteuart_putchar(struct uart_port *port, unsigned char ch) -{ - while (litex_read8(port->membase + OFF_TXFULL)) - cpu_relax(); - - litex_write8(port->membase + OFF_RXTX, ch); -} - static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 mask) { struct liteuart_port *uart = to_liteuart_port(port); @@ -372,6 +364,14 @@ static struct platform_driver liteuart_platform_driver = { #ifdef CONFIG_SERIAL_LITEUART_CONSOLE +static void liteuart_putchar(struct uart_port *port, unsigned char ch) +{ + while (litex_read8(port->membase + OFF_TXFULL)) + cpu_relax(); + + litex_write8(port->membase + OFF_RXTX, ch); +} + static void liteuart_console_write(struct console *co, const char *s, unsigned int count) {