From nobody Mon Apr 13 13:26:11 2026 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 48574C4332F for ; Wed, 23 Nov 2022 13:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238019AbiKWNZL (ORCPT ); Wed, 23 Nov 2022 08:25:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237105AbiKWNYZ (ORCPT ); Wed, 23 Nov 2022 08:24:25 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413A8742CA; Wed, 23 Nov 2022 05:05:10 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id l15so11135793qtv.4; Wed, 23 Nov 2022 05:05:10 -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=yT54MJUH8hXwVTeBLM7UDa2q//81cRvBtk4+Tr+w4wU=; b=OrS640M1kZVAfPr1Tkxs7MkXbXxZBpyfICSz8cyGXbu5hKVFm4jqALHrRPoYSu1mDb Pe+XxNe/jnB/XWJoNcz0Nvw7R5gvvexqhR/rmIRQTZY7abIs4/BgIuCZXaJqJVhBExmi NY/qW0fXWszaXTZ089EkolGhWVoXrh18DoSLU/tRwJS2mLLH+9b90/hBXkr3KtQpFg63 yutEfY4IZk0TJg7ODdndUaTGStYYy+g/epDl2E6kNnrNbYIOzO5TrmJxNX+y5/TQTxRc hjg3aUEbXw/HehYwvnajoBhvAYukj0zVORnHtSsUm+FF+XwnCSf3vAmwMrcZZI72MJEV BnVQ== 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=yT54MJUH8hXwVTeBLM7UDa2q//81cRvBtk4+Tr+w4wU=; b=zX8aqV6V98MZ5KVbehrsJiyyB8OgfiWuUBW7bNeopO+ANPuf4UQ6OR4Og52f6PEzXL 68jQzMDaz7w1HDe4Bt/OJRd1ABCZdxbcfXekDenORAqR6SFWigK/fJYoBDNyQkCh247X tghjmIOTe/WkeiNcluI/RswrmEqw27dAnA37xirCNAgzgW6nfId2FQeX8E2dS4BjrOFJ GRusHdfaDtTVQnn4ZYCyoQVm9B30u56rQJMxSgG3pDW7Yl36D+yJgHmmzcFMMr5c4G14 ODZTowvWePvSTermfItmCXMTdcV8h5WZa7zICSmCbH0f8twve0pNvSGE2YE1uBnei2wZ 9S6g== X-Gm-Message-State: ANoB5pmMlvcIe+mtome+lQGVwhKPsWSuoTtnSe4grO1Dg45DgA88scKq 4CKZSHE+MajLW96nOt9MquIrVs7fJ6njrw== X-Google-Smtp-Source: AA0mqf6pLiwCCpkEiKr8jlCwnBC9uwE0eCQOg6ibYFpJVsN56xL9dT7FT/2awtdO0/Jw6pRwQgY+hg== X-Received: by 2002:ac8:4e47:0:b0:3a5:c306:324 with SMTP id e7-20020ac84e47000000b003a5c3060324mr10053895qtw.116.1669208708590; Wed, 23 Nov 2022 05:05:08 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:07 -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 v6 01/14] serial: liteuart: use KBUILD_MODNAME as driver name Date: Wed, 23 Nov 2022 08:04:47 -0500 Message-Id: <20221123130500.1030189-2-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace hard-coded instances of "liteuart" with KBUILD_MODNAME. Signed-off-by: Gabriel Somlo Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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; =20 static struct uart_driver liteuart_driver =3D { .owner =3D THIS_MODULE, - .driver_name =3D "liteuart", + .driver_name =3D KBUILD_MODNAME, .dev_name =3D "ttyLXU", .major =3D 0, .minor =3D 0, @@ -321,7 +321,7 @@ static struct platform_driver liteuart_platform_driver = =3D { .probe =3D liteuart_probe, .remove =3D liteuart_remove, .driver =3D { - .name =3D "liteuart", + .name =3D KBUILD_MODNAME, .of_match_table =3D liteuart_of_match, }, }; @@ -367,7 +367,7 @@ static int liteuart_console_setup(struct console *co, c= har *options) } =20 static struct console liteuart_console =3D { - .name =3D "liteuart", + .name =3D KBUILD_MODNAME, .write =3D liteuart_console_write, .device =3D uart_console_device, .setup =3D liteuart_console_setup, --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 8517FC4332F for ; Wed, 23 Nov 2022 13:25:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235606AbiKWNZR (ORCPT ); Wed, 23 Nov 2022 08:25:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238266AbiKWNY1 (ORCPT ); Wed, 23 Nov 2022 08:24:27 -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 221F974A82; Wed, 23 Nov 2022 05:05:11 -0800 (PST) Received: by mail-qv1-xf29.google.com with SMTP id n12so6018203qvr.11; Wed, 23 Nov 2022 05:05:11 -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=kK3JqJNT1I4j3gkX/C8zdj1X4u6J0EiKkU/hbVHbrx0=; b=bEquYI4pYdgUZm/tUjpiXKrZMvQdc3GYF3xl4vhVZLv5yLR5iTr8raOMfb89s+vbHq 7P7uevp6iJYAiCWebyIT6vGh8HawknY6I6O7IOLdv3rDmPpnTdVcEgZgn5eRzfxYfOUo eaFUjmZ5Qs0XtnO99CI5I4JHTKdLPSEWtwjoleKpPmZyWqyyJv3hiwU5rIgVzmqpkf9T w12AiVNrpltc46c8FPTyba84dWNTrSQQ2bbihzs+kta2teqPghl2l6fJdzts2G75jn45 Hakq1lHENj4TzBH4iO4/65GMqWjXF8B6boyRxy5yMPvkl8/RwvVWdc5im0OjPjLL3FdD auGQ== 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=kK3JqJNT1I4j3gkX/C8zdj1X4u6J0EiKkU/hbVHbrx0=; b=xuou+rzRoP78Ch8feNUyVDVGkIHSyZMBvAlZXONyoG9yi0co1q2SiOj+/vGgKn7EGD sNFLd5ctYcu+2uT7406yrznoxkSGOOCjZUtDmMEVaaIclSJhb82rxDmgCotA5jK0iipt MA2vaXJl8Orv5FhULvi4cxRxZbdddWmzYZ5xMuONsQ/oVxn0kpQeyzQLSzzJV8WbVnvw n0BWH5lBpjt7JINWW6qNvVxmIbcBpGVJeV8kt9qE6JyfSWIt594zBqprDiffXI8CSLCv ajp6bxsyE1MTzWEJb8uu+K2GCzoO3qI/4jARJFwlHHOoe0IIv5hx5twBpKu7vAIZ0K71 1MVQ== X-Gm-Message-State: ANoB5pmDA1B0tyOVUsbXnjwbLnssS4ywT9+cHyvDApOTKAreqQbZkeAN ZCToMfC3AkKQ19zsJDFiYmJ3dnQX+0kWKQ== X-Google-Smtp-Source: AA0mqf6IRO4TgUF8T0Xk+YL/cCQPdh4DF5+3L/BNGdALphrUzwsRNvPnRHYn5GJGFi6jeFLxIgxZ4A== X-Received: by 2002:a0c:edcf:0:b0:4b3:fe67:349d with SMTP id i15-20020a0cedcf000000b004b3fe67349dmr26126307qvr.60.1669208709841; Wed, 23 Nov 2022 05:05:09 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:09 -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 v6 02/14] serial: liteuart: use bit number macros Date: Wed, 23 Nov 2022 08:04:48 -0500 Message-Id: <20221123130500.1030189-3-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Replace magic bit constants (e.g., 1, 2, 4) with BIT(x) expressions. Signed-off-by: Gabriel Somlo Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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 */ =20 +#include #include #include #include @@ -38,8 +39,8 @@ #define OFF_EV_ENABLE 0x14 =20 /* events */ -#define EV_TX 0x1 -#define EV_RX 0x2 +#define EV_TX BIT(0) +#define EV_RX BIT(1) =20 struct liteuart_port { struct uart_port port; --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 14537C4332F for ; Wed, 23 Nov 2022 13:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238215AbiKWNZW (ORCPT ); Wed, 23 Nov 2022 08:25:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236616AbiKWNY2 (ORCPT ); Wed, 23 Nov 2022 08:24:28 -0500 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 778C39A272; Wed, 23 Nov 2022 05:05:12 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id j6so12041867qvn.12; Wed, 23 Nov 2022 05:05:12 -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=KVdo78SFIsBBZHYvKL7zL+YA2gnLBYhFIgwyV15stUU=; b=JFb5n8WtR8tW1eEYyeIAty8AVAAVJhoPuFzUIMQxTR5RBg+cKEFtGRrdAvocnLTjkg sWtd8N+Xncg+XJQAWEjmRDKhx7tdOYJHV9jwKSD+NdD1rMGFqO3j1U9H5wVCtx832QZW y9LL6/9x60rTlxiqlSA0VbrigTPXpSsPUD5Bg9Vn4gc4buYAlzNPjkHqkflPQQ2XGkfN cpD1dsYbe0HnZvAlKU3jg5/YiUdftbJVbR054w6EEPgM8Uy/EcvVjdyiQfNiW7ZOkPKB 6dr0d+va+lVDmOYi2IBQVHxrgKTZamwZYDesohoeilqA4VICVxxet7PXz5Dppm36adBC 13BQ== 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=KVdo78SFIsBBZHYvKL7zL+YA2gnLBYhFIgwyV15stUU=; b=2N8NyFRlX72ShhI2NXA+UCk4NHkogYlhWGH6gMMhTshXwVxtx14iGyByO8R5heOfrZ jt+8eyGbxOfCLBJGFdyYCPeSeS8iByIRWC61Pa4UokBq9mUI95aqSIgRIuiNM6WVwuj6 YrALfYdTSo/1xTIoNnNGvOyV1dh71ef8SU8OR7TDMwJCjniDsKmRfEQhKN78lfMfNEE7 iHNUx63VTLwuY84Zdl5rWyG2P3t643tA1U4N/gajVNykX2+iSjIAr29vVB1Syh1v6/gN cHY4e6lY+Mnz9vZz0zPZnGBZtEek3OTUzXq3LvhCx0jdnYV6wdkwtc8SK3Rr57bMCezL yaNw== X-Gm-Message-State: ANoB5plKMyy2Qbe/WukpUMg0IeHUcHDhNpjhAX0yW5L4TvWESapRZFRy ZPz4NyYf+Okf0io68B0qRaw5bceD4S9Omg== X-Google-Smtp-Source: AA0mqf7ZPIVNk9RGAuPoUFe1AqGdB/C52nEfQzac7bRu/nvnfgecxkVLS6zGu/0bDK0a7cZIP+9xPg== X-Received: by 2002:a05:6214:514a:b0:4bb:9279:57cb with SMTP id kh10-20020a056214514a00b004bb927957cbmr7303721qvb.35.1669208710972; Wed, 23 Nov 2022 05:05:10 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:10 -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 v6 03/14] serial: liteuart: remove unused uart_ops stubs Date: Wed, 23 Nov 2022 08:04:49 -0500 Message-Id: <20221123130500.1030189-4-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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); } =20 -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 =3D to_liteuart_port(port); @@ -197,15 +192,6 @@ static const char *liteuart_type(struct uart_port *por= t) return "liteuart"; } =20 -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 =3D { .stop_tx =3D liteuart_stop_tx, .start_tx =3D liteuart_start_tx, .stop_rx =3D liteuart_stop_rx, - .break_ctl =3D liteuart_break_ctl, .startup =3D liteuart_startup, .shutdown =3D liteuart_shutdown, .set_termios =3D liteuart_set_termios, .type =3D liteuart_type, - .release_port =3D liteuart_release_port, - .request_port =3D liteuart_request_port, .config_port =3D liteuart_config_port, .verify_port =3D liteuart_verify_port, }; --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 AEB11C4167D for ; Wed, 23 Nov 2022 13:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238600AbiKWNZ1 (ORCPT ); Wed, 23 Nov 2022 08:25:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238392AbiKWNY2 (ORCPT ); Wed, 23 Nov 2022 08:24:28 -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 EDAD4B7396; Wed, 23 Nov 2022 05:05:12 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id c2so416307qko.1; Wed, 23 Nov 2022 05:05:12 -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=xrcGx075bBAUt5Jsu4MjR56u5yyB0ACS0/ryRhT/vi0=; b=Sd6WRAlMOF0RMw0SWShDWnZYt/cfx2EmgXW9Fpi/V/mDXL5A6I4LIxQXZYICLEJoXX RkcfLs7db/C5oyAVuXS4vhHjJu8nqC2NCAC1CrqSbMnG2BxwfYbAsWBjMD2Y6DqPKdU2 /9KyDeHQu0fVyjpBkeiiL95WdYmm9F+ufpFmaN7fiYSMbT3ljkNifH7+vUOa6zVYUIAV tMWtAVCp5wuSmPrmy2mQaB7JX8H/KOTri1f1FWh5miBM6x18DfyfaZRUv8jSniY0huNE IVKlR4RkWyTBISGwleNNal2wOwqAV6MIZPb348tvmOyeOqj6SWc2tp84R4PeaVrZYvL+ td3w== 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=xrcGx075bBAUt5Jsu4MjR56u5yyB0ACS0/ryRhT/vi0=; b=Q824KUwANIP+fObuP1PXqQBVcyVeGhIbaZ95q3Uqjz++1Z9CJJQ7eOacfSjgBdwV4Y 3pHcSvoVgX0e+kIRCKgXYkEp3kqTyjg1YZpZrY8FauZZWOkSu1JcyTmP5JzUnI/XMbdV ZxU2zRSN6QVnpJkq+blMhbTMF9SB9A84rKudQuQ2UxYyoVtvLfN/JRn8q+LuP1R0aJop BWbE+Os43UstJ1nsyHliQYJoODT4TjVQWFxqlh/I+9aWU25l5BaoxdrWAdVgV+tA069q xIEa2Y3vjYQopZxQFFLEExSAFT1eKb8VhhOKca65olFWXsatw8DDB+IhVTaGw4gVMWFt Jfcg== X-Gm-Message-State: ANoB5pkISjV+lD8tfY949lhgP74AaQAU9wcTqjm3PGGQFsf9BDgwfS5E wC9FZiFs0Q3AEWQ8XDwVg8xZ1pOBpZNELQ== X-Google-Smtp-Source: AA0mqf5f60U5GEKDKKFMIQNNdpOkbTbrRpBk+DRpnmAtLNq34cql/9PtaDIcdYURl7/qpAoTqdNr0w== X-Received: by 2002:ae9:e513:0:b0:6fa:7d46:33ad with SMTP id w19-20020ae9e513000000b006fa7d4633admr24792185qkf.278.1669208712178; Wed, 23 Nov 2022 05:05:12 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:11 -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 v6 04/14] serial: liteuart: don't set unused port fields Date: Wed, 23 Nov 2022 08:04:50 -0500 Message-Id: <20221123130500.1030189-5-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove regshift and iobase port fields, since they are unused by the driver. Signed-off-by: Gabriel Somlo Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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 =3D UPIO_MEM; port->flags =3D UPF_BOOT_AUTOCONF; port->ops =3D &liteuart_ops; - port->regshift =3D 2; port->fifosize =3D 16; - port->iobase =3D 1; port->type =3D PORT_UNKNOWN; port->line =3D dev_id; spin_lock_init(&port->lock); --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 65A33C4332F for ; Wed, 23 Nov 2022 13:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238703AbiKWNZ3 (ORCPT ); Wed, 23 Nov 2022 08:25:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237617AbiKWNY2 (ORCPT ); Wed, 23 Nov 2022 08:24:28 -0500 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90A88B97F3; Wed, 23 Nov 2022 05:05:14 -0800 (PST) Received: by mail-qk1-x731.google.com with SMTP id z17so12305501qki.11; Wed, 23 Nov 2022 05:05:14 -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=vuQh98BScLRl+hXuzBmCggACRaMdE/rFjTb3x6luZmQ=; b=oJh2o/nVDuGM724o1HdMD2bxnZHPNOVzeR1cbXZY8oD+rzPrb2sVNnd5HlHUEKlYSY GSbjTHufYXZDQImUGaQzH3LGylae9P1VRIczJKxDRvXV4rBQM4NRk6mpQ0vU3Cix2pwD +dnbn1HYYqKgQo/VQtjvb5k7XScswhdG9ny0Rdc3ezL2/Tw7hIdUW2zzoTw+b74rzejC G98YnXD1iktshDyP/FS95s2UjNzMp85oG1cZuzIY5F3C1bj99fXzkje/WU8VkQcCcPcG xATXsuo6qSxayZTW9tb7Nt4fhx2++lQIxiBOGOnULP+AQwHe8lbzbYYAGw9orpmN13sV NEHA== 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=vuQh98BScLRl+hXuzBmCggACRaMdE/rFjTb3x6luZmQ=; b=lBLL11K1uFcrP7QpkJZTOa+rb9+P5nNsc+xAZwoCEKwXOEYLK23b/kNKI8/saIxJLa ew4itAkem+yLdXFzzBEUXftHbe6LiNtAvRyDJ1yyJgyTfmcdo7/K55peWSpL7I7Xn/2t 5ShwGFNuuwZREdSTAV9KL8X9KVY8amfjUfh/FQhhp6bxQExc5ZxZDDqIqkbvjN+NPYyb icTy0qfkj3VZBoOF3ih8pIhO7ixwAn22y5Hd+i6DWkj0CvTQO0Uxi8gMzG+8gScyuKxc pory+Yw0ssm92gSgg3YIhAvJfWEfMn/jTZf5t5otSzic6lXGW31Cp4qL1XoRhrzZlt+P C39A== X-Gm-Message-State: ANoB5plEsNgL5ZnMGvtKFXhwbGsdPmxZ8tqUNEw4i9eTtRrfGlOqfLhQ nCjhiCYjK/q2r1WacO6fTM/WO4hnTWXcJQ== X-Google-Smtp-Source: AA0mqf7/sh4CNVjh5kFJr7hLPNC/7ZHlJuf29ATTgwBRW0deVApmo10Qpb6UZp6Wb3jKyP199T8+sA== X-Received: by 2002:a05:620a:2f2:b0:6f9:9833:1e21 with SMTP id a18-20020a05620a02f200b006f998331e21mr24586422qko.715.1669208713354; Wed, 23 Nov 2022 05:05:13 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:12 -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 v6 05/14] serial: liteuart: minor style fix in liteuart_init() Date: Wed, 23 Nov 2022 08:04:51 -0500 Message-Id: <20221123130500.1030189-6-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo J=C3=A4rvinen Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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; =20 res =3D platform_driver_register(&liteuart_platform_driver); - if (res) { + if (res) uart_unregister_driver(&liteuart_driver); - return res; - } =20 - return 0; + return res; } =20 static void __exit liteuart_exit(void) --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 7E06FC4332F for ; Wed, 23 Nov 2022 13:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236915AbiKWNZd (ORCPT ); Wed, 23 Nov 2022 08:25:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236956AbiKWNY3 (ORCPT ); Wed, 23 Nov 2022 08:24:29 -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 BD19B9A5DE; Wed, 23 Nov 2022 05:05:15 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id k2so12295163qkk.7; Wed, 23 Nov 2022 05:05:15 -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=GHMcgVVLHSCbEuvVFdiKP9FgRZ42FtfzD1n98ex5KfA=; b=B99Re7VWdUz5fCMscSfwQQBcIa5cZrCVF3WBup0O/mFR8plWAjAfUloXizc4Io/mek 1Uden+X0L+Rc2geTjabuyPjQ3QhRLVgVnjLNUt4Cu3zNuaott3LuLuOtualZ23t7ttdB ITNQmr70YnRmnbBAXjx43lkgCLPTEiVM2aND0HvGHYUJXGFzK0jzUYZIT1IOCZ02b4Lm w03Ahs9W+9mmDh7/cb4v5RPALhRDzJw9lgEuc3sPTiWg8qJfIHqVyQXHSKRVTbz/DwCW 1VD1KWHrTxHH7IHaqkmJH6XD2t0yoU9yZy2OquJtk/c7fwlnROb8Xxa55+ZS21gwWqNA KP4Q== 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=GHMcgVVLHSCbEuvVFdiKP9FgRZ42FtfzD1n98ex5KfA=; b=wooVCAk7uiHhC0EzrqkVcUnYYE4RHt5Gm/zT2zbDboPYow/OZLHBx2TzBXHiBNbBCV P4v2dS9T6AHuGzFK7C1rSj4m1Hu6XFgN95vcnLXtz45nTD1OC/yDuMJhNskYdbPIr7gf wILZ7uyI76LfSGwCMzfuohhN0h4D8Js44N58oV4e1DGM7GFKjhieRoxM38A1t0orBx4G bS7izi42v8Fuz8QSwRp7MvUZzCLnSxear51oo97IT6KvbJu+hhnipZcZsSUCe8mYa6JU E4CT3+kIXi4w2qKl79FaaYyhSbOkbJwR4xwbdKjRD3JqoYOg8IrEme0x2ump+CcurlwL JauQ== X-Gm-Message-State: ANoB5pliLENm0bp/yFbGpL0Mibu83s9sFgoWK9SIBI8V2wU+1Foq38gK xWtN9wa8aYPaUx6M9ifmTpDGGgBDpsxkUA== X-Google-Smtp-Source: AA0mqf6yb+wfYnjySuQKRM4lx5rs/UhaMTpb+Kj4jhVHVoo/vfWA3jPPFATlksk5k1RWmU3akOHTeA== X-Received: by 2002:a37:5ec7:0:b0:6fa:27fa:45d6 with SMTP id s190-20020a375ec7000000b006fa27fa45d6mr25124923qkb.177.1669208714465; Wed, 23 Nov 2022 05:05:14 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:14 -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 v6 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop Date: Wed, 23 Nov 2022 08:04:52 -0500 Message-Id: <20221123130500.1030189-7-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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); } =20 + tty_flip_buffer_push(&port->state->port); + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } =20 --=20 2.38.1 From nobody Mon Apr 13 13:26:11 2026 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 51828C4167D for ; Wed, 23 Nov 2022 13:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237123AbiKWNZo (ORCPT ); Wed, 23 Nov 2022 08:25:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237117AbiKWNYa (ORCPT ); Wed, 23 Nov 2022 08:24:30 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0724997EDB; Wed, 23 Nov 2022 05:05:16 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id d8so12285757qki.13; Wed, 23 Nov 2022 05:05:16 -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=i2QdbtAZ9LbCFHYeYbRIso5E5EOnoY1faYGA4L3aq/Pvv/VFbEZSQa2MQaGqUiWFYX JzaOAvY6Z4VUBJsFQzQbwrJe6ZkfKnNXiha3SD97q3yOTjkOYDwnAgViD4pOv3ZbMY8y jnKl3Mb9ZesSQa3PpAPnOGKX1Jfhzjl4iJllcz0TJxfv4BdrKhJ7LN5KGy02WYmEnxw3 nSCGntHxiBgtv5q7kssQq1fGPcDNPjq92S/ZUMemWrJqVcpEpAj6LihIqAR0DQRUqftf 4hNeTInSkRV2UFCZPHe3TCKcVqs0UifcYhGmHE3FY6jv119150YUE+Yk7NK6G7TNqJXQ QLHA== 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=BdzH9qUCS0K0I2zAx9QP1iozZ0mzvEeYX45hziC5qSpTKvXl6BCnspHQa0UlTdi6XC 8KS2wAC7IN4OElC6O8NqNR5PxY89XT4mK3FWJgWDuLKu8do1jrlTkRpH1b8DlkLTdzxG KlDZebY7iNKwLudF33qO3Gyax5B8d6BrFFQ0Ut3foPGvWC0u6Hsyl5it7TPRYvEfk2Oc MUsFzjARYrbL9JteJkn2Z2PkcpyV20575hh/0FD617e77aKRWQ3fUzCttJfLDvow+ZBP pCM5PQr7nH8uR3Yxbq6fh6JY1QC2kj0w63EH3Fp03wWt5lKZej8K5U2uh2vwXsKvKglo LYqw== X-Gm-Message-State: ANoB5pmjv4NQAJwTr8cYcsygdzzfJLyY5n/JeL5kpOljmEn4XSa5I8uh 6vBZc/MJM2rPo5U6p16R4Xnzy50T9CQwkA== X-Google-Smtp-Source: AA0mqf4UDArZTgPrgQN2V6SCtxvP8t1r07ayWl5MPGXD0Tvc8yhAtRhB9wB2UQ3Cgo7wIWg7mK5mag== X-Received: by 2002:ae9:eb54:0:b0:6fa:1e59:4b67 with SMTP id b81-20020ae9eb54000000b006fa1e594b67mr24262875qkg.255.1669208715557; Wed, 23 Nov 2022 05:05:15 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05:15 -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 v6 07/14] serial: liteuart: rx loop should only ack rx events Date: Wed, 23 Nov 2022 08:04:53 -0500 Message-Id: <20221123130500.1030189-8-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Jiri Slaby --- 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++; =20 /* 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); =20 /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 1F8DAC433FE for ; Wed, 23 Nov 2022 13:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238607AbiKWNZq (ORCPT ); Wed, 23 Nov 2022 08:25:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237298AbiKWNYa (ORCPT ); Wed, 23 Nov 2022 08:24:30 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB12472108; Wed, 23 Nov 2022 05:05:17 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id fz10so11143739qtb.3; Wed, 23 Nov 2022 05:05:17 -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=r1Tl0HGYmBQgunxqIx5qBf7AmLCZ0WuUkgihwlDEofA=; b=D4BkXz76qCExjjZYdj2ikQCU5ZuLT8HL2oP+1XE5XFphzoMUfFrkDWxKQ1s9mRcFVi RHAjr87y2Q8wjWdqSGE4dmx1Ll9WhwUAFXJmyaVwswgxHclpX00FooVPY+IUilw/hTx4 8rN78ufFPPyTYtKtylmEMCcDNJ0qr46MVOA8qQwXj/ry3n0w9waTeo0Y8wwlmf4WXzyi ymrppKDFftCOVFHopIjmNwq5N53HiG0wD/5IObt6XpG6u8y53zEO+GeKhqLOrNIRBuva EaQMpRi7NUsbYO1unenkuicewhOZ5w7uOuc5i0HcNZ/thKCdU0xeGAfTOFYB803B/1bH GcZg== 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=r1Tl0HGYmBQgunxqIx5qBf7AmLCZ0WuUkgihwlDEofA=; b=GSu7bRtZI6QJdLaU0cwBoL/94atk3DQddRZSLLzG3k4crBVU4GLX3UFldYWoh7vKzE C4NlDKnWPcDNFmcj4+jXPgI0d0cUGzJvvtZszGLyV11MZl1XW7fYtYnnVjyvntvYEzTa SvdcicH/Dn42w3Ns2cSW+XmpBYfWVKM8V8rKaeSDIVhWZrPUmqYzlwdXOZZmX9Za5KpJ eyUud8PHSKW0bc97f+f+HsBIcN0EnXlackETCJUki308kwy8VPP9rZpiG89Gis6De83Y aoySO0gZeCmPopeMrKraL8SeoDDxNBS3SM03B9bZdIomH9rA7NUu7pds5qaxvFBHVTDo J8bQ== X-Gm-Message-State: ANoB5pmkPQnhMm1n9HOatVNuzsXnRF27Jmvy8bsxkMzb+1NPIj/+rZ0X EMRR7xi+H6KwPHhcqXouMGotAnblocH0ag== X-Google-Smtp-Source: AA0mqf403sy2smtjSXqo4YbW+70Uxwg/WEbeTXEDTmS+fpDrX/APNzTByfBTSuwaf1sEMSrSS2cwzQ== X-Received: by 2002:ac8:4745:0:b0:35c:ecf9:dd49 with SMTP id k5-20020ac84745000000b0035cecf9dd49mr8381530qtp.333.1669208716545; Wed, 23 Nov 2022 05:05:16 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 08/14] serial: liteuart: simplify passing of uart_insert_char() flag Date: Wed, 23 Nov 2022 08:04:54 -0500 Message-Id: <20221123130500.1030189-9-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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 =3D from_timer(uart, t, timer); struct uart_port *port =3D &uart->port; unsigned char __iomem *membase =3D port->membase; - unsigned int flg =3D TTY_NORMAL; int ch; unsigned long status; =20 @@ -86,7 +85,7 @@ static void liteuart_timer(struct timer_list *t) =20 /* 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); } =20 tty_flip_buffer_push(&port->state->port); --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 A47F3C433FE for ; Wed, 23 Nov 2022 13:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237078AbiKWNZ6 (ORCPT ); Wed, 23 Nov 2022 08:25:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238746AbiKWNYb (ORCPT ); Wed, 23 Nov 2022 08:24:31 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBD526D481; Wed, 23 Nov 2022 05:05:18 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id d18so8546398qvs.6; Wed, 23 Nov 2022 05:05: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=LTRRaT6zB1Vc4HlqkEDiGAACW7hoe/56Dvqt+DM/eCE=; b=Qbr4KqFhqpjQh7UgEn30bWcQeFohY7x1t+H1qx+KqZLKnkmfCV79AiZuf0pQJBf0lv XKRrAFhsSgxtew9uB7TZA1jvP4uGEoDFlY+YpqDFqARtP0aVs9XJA809aa+GmodzbeWD Q9AOvMnGc2YDdki76WTzu8lXalUC2UJNesCgCDTALd5C7/1iBE6akOw0Wx9uJJ3NiSeN +4XHvQckhHhjvWIlB/pK0Zt5A8qnTFAdjWJWXhk6YMgpYeNJutpw3v2lErkCoO1jFW8R cDMi97tUn/tNNvSO4MNTz+0E8ClgYV3mKqtQ/FxZRHQ7jd2tnFzKv8qwiJgpM+Uuc1xi nXPQ== 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=LTRRaT6zB1Vc4HlqkEDiGAACW7hoe/56Dvqt+DM/eCE=; b=SXKOmKsu8Q/d5DjN3ZFoCuDL6zFN2gIwS/5aazEfVQ1Z914N1R9m0apZmUl+Hkw9pQ X+ep5PXf+QbIQn55XbWA5xE/+EeyPBgrMoJSvAr5OUM89GJaB3+w6jn62WzpIVoZC/dK S0lmOU+CGihyvuylt8z5atNkrczaacDxu8F6qcvBzvGQdPYapY2m2iBvEHaBcWqe0J8z y77JLPY01xwFjkZMlPy2hxCEwkWBbCxqr49HMxkgdDtXsH3W7XfCF1Q6wWWTvPoNd/4H srwqKrMX7skZayZjSou9JB6tQf7crLzIznqfKm26TQ8qw6TN8ccfilo9FR0hqrVTzECX t1HQ== X-Gm-Message-State: ANoB5plD6MOfbBMafgemk6cXc7SnPG2s8Pmmf3x9bBBGqIWdSz3Q28sD cZf5Gu6jziUw8RVpzccEvXl8zr5lUq1bOw== X-Google-Smtp-Source: AA0mqf7CC8p5ZhDBRHBE4fOXBYzjcIBPmTnBak6/NBv8c0j4Uliy1HuCPkRFTgA0HRB1u3eHSWCuSw== X-Received: by 2002:ad4:438d:0:b0:4c6:c6c3:9209 with SMTP id s13-20020ad4438d000000b004c6c6c39209mr2503519qvr.87.1669208717641; Wed, 23 Nov 2022 05:05:17 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 09/14] serial: liteuart: clean up rx loop variables Date: Wed, 23 Nov 2022 08:04:55 -0500 Message-Id: <20221123130500.1030189-10-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The `status` variable will always be `1` when passed into the call to `uart_insert_char()`, so it can be eliminated altogether. Use `u8` as the type for `ch`, as it matches the return type of the `litex_read8()` call which produces its value. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo J=C3=A4rvinen Reviewed-by: Jiri Slaby --- Changes from v5: - removing `status` variable altogether - using `u8` for `ch`, matching the type of the call producing it rather than that of the calls that consume its value drivers/tty/serial/liteuart.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 81aa7c1da73c..62bfd2ed9051 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -73,10 +73,9 @@ static void liteuart_timer(struct timer_list *t) struct liteuart_port *uart =3D from_timer(uart, t, timer); struct uart_port *port =3D &uart->port; unsigned char __iomem *membase =3D port->membase; - int ch; - unsigned long status; + u8 ch; =20 - while ((status =3D !litex_read8(membase + OFF_RXEMPTY)) =3D=3D 1) { + while (!litex_read8(membase + OFF_RXEMPTY)) { ch =3D litex_read8(membase + OFF_RXTX); port->icount.rx++; =20 @@ -85,7 +84,7 @@ static void liteuart_timer(struct timer_list *t) =20 /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) - uart_insert_char(port, status, 0, ch, TTY_NORMAL); + uart_insert_char(port, 1, 0, ch, TTY_NORMAL); } =20 tty_flip_buffer_push(&port->state->port); --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 F0660C4332F for ; Wed, 23 Nov 2022 13:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236508AbiKWN0D (ORCPT ); Wed, 23 Nov 2022 08:26:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237333AbiKWNYf (ORCPT ); Wed, 23 Nov 2022 08:24:35 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EAFCB7EB0; Wed, 23 Nov 2022 05:05:19 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id d8so12285861qki.13; Wed, 23 Nov 2022 05:05: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=qoMIkJU7RvbZZuqzplaT4bBXFPZMXchGTRlt2jCO+kI=; b=I+QzPRYCpOeZh/2+ywxlPc/2XDtmrdlAzbocluylrcg7fu31+yAzdvskXCyfskDn6s 51QCg8Na8xgIQaw0irNIOto8HoK4LCL0vVx7fwODVDzNByYBS/mWWAy3nks+XLEyJ/62 2f28zTORjWh4XNJHyBTduP2Zgux2aYnsdjOUOa3wmQHSfaMa+17lFLnVPeAYkN5E0sH/ met4D8CUHTpttDuZNFaTnFfTL2Mx0o/Fl9mNr2QAUeSBiGWt80cBwLc/PSs22yWd2ycT /vAVAgyvuixmABgBob/4vifIWMoDQJ82WfboIfbpmIsLXWr0sOQBHTrMYPDPUbECQLH8 68Fw== 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=qoMIkJU7RvbZZuqzplaT4bBXFPZMXchGTRlt2jCO+kI=; b=oOKUASGeT5gUN0XO+CBH1GcGnyfl3p9F9P+zrG3/6e9irCBmTkRCWKhTb53+kbloOw TaftU14KabVtJIZ8oKZhxteQHIpu5K9qkt9JPm5gLttrqI/EhHwNhypkorpBezhiwgBm JqYm9GgeMlbWd+EEA470Z7sKeOqfRE3AIHawjKvNTIDNV3UjweLWZKScTCCSq0PHgHiP maKOcma2C0XvaWYK2fN6VvGGWh2/TB5sAqPcMULRB1StYtIJ+gLUJWKFVPS2TDK9uL9a /KACq6g8G6A03kJcb8Od+aHy2sQbDBc7LKkhDzeym22URQzUSemwaHpGzrDhYadH7rpF PvVQ== X-Gm-Message-State: ANoB5plur2lnPN5Chs/Ta9QMC4z3kz3SkZFS3qhLvWVmmxVUUGjkJAPT MIXhefTTkjeFvpEEnxfO7TyuWVeOs3WQvQ== X-Google-Smtp-Source: AA0mqf5fh0yIyZpUY26kyg+Uqg3h/JxhiRa4TPpaFW6Jqu3Nq3hr7oIqmEB5vehFTr4XiWz8WMvJVA== X-Received: by 2002:a05:620a:15b7:b0:6fa:3f37:5af with SMTP id f23-20020a05620a15b700b006fa3f3705afmr25311630qkk.572.1669208718684; Wed, 23 Nov 2022 05:05:18 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 10/14] serial: liteuart: separate rx loop from poll timer Date: Wed, 23 Nov 2022 08:04:56 -0500 Message-Id: <20221123130500.1030189-11-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Jiri Slaby --- 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 62bfd2ed9051..ab6837f3e40d 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -68,10 +68,8 @@ static struct uart_driver liteuart_driver =3D { #endif }; =20 -static void liteuart_timer(struct timer_list *t) +static void liteuart_rx_chars(struct uart_port *port) { - struct liteuart_port *uart =3D from_timer(uart, t, timer); - struct uart_port *port =3D &uart->port; unsigned char __iomem *membase =3D port->membase; u8 ch; =20 @@ -88,6 +86,14 @@ static void liteuart_timer(struct timer_list *t) } =20 tty_flip_buffer_push(&port->state->port); +} + +static void liteuart_timer(struct timer_list *t) +{ + struct liteuart_port *uart =3D from_timer(uart, t, timer); + struct uart_port *port =3D &uart->port; + + liteuart_rx_chars(port); =20 mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 823F6C4332F for ; Wed, 23 Nov 2022 13:26:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235505AbiKWN0G (ORCPT ); Wed, 23 Nov 2022 08:26:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238748AbiKWNYf (ORCPT ); Wed, 23 Nov 2022 08:24:35 -0500 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76047B9610; Wed, 23 Nov 2022 05:05:21 -0800 (PST) Received: by mail-qt1-x832.google.com with SMTP id z6so11127974qtv.5; Wed, 23 Nov 2022 05:05: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=QeOhv8hm5IPcwehIrO8OEVXHvIMgFvCAfRcrJ3iovRc=; b=KyOlItduxSvhcwnnNngGtReEVVXLPcKBmPmYUIMUa0aiRKfBKzRomcjdgewp/bw3rC T7REI/3dMw7C+fT/rlScKCvN0PITQnlABE1lLCeDHaJuGc1AmNw/oOkfEKXLbR6lv/kj Z9VnAl3sU52mb7yBk9cq7qc2k4j4oCsyyQQsnaJsYfzJekLT9JvK0b36MoeuEqY8UVqg sVDZNUZH59Fmai3uEvOPxNaF1on764nE3Q4ZR2dc+2KxjULl44Sufl57w7FDgnb3O93c gbHT1OY683ghWDGk1rP0NDopT7HxR1jofAPBJ/859+OIpzfzI0ByVlpOUgJwm6C47d7Z riKA== 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=QeOhv8hm5IPcwehIrO8OEVXHvIMgFvCAfRcrJ3iovRc=; b=SjXn23ZmiTJjfDx+UYQnTrqXw454kIxiJRnWBjch+CPUIgvJkHSARqH5y+EugxLgj6 FgFrrwxGHTZS7iOYG0KIqnBCl5BhzcyNtZSar308wgf5KKlGo+/l6lW/8V+uQr6f5YA2 DuJ0g+AnoX82eS6JBn0N59SJL/5hmDXB/mma4zCa/TQipDk2s2OrnIaUc/tMV3elN0Yk PbMQEJ1t6G2ewC+MKxMCzugOYYdfOOwh7OupY3emffjFtMmGusGAeXAYPPUZhCyQfvOB huv2UI1bgOHXuSrfjfYRyNsukZVOcer4dd0vXrY3H9pNjdOSEWZd73FSt1z1eIeuUkrq XYkg== X-Gm-Message-State: ANoB5pnxZ0SUQ6wv5t9DfdaCdM8wJadpCvgLi/ObQvBto3Jw5gmPfjff gl8G9aKaFQk8oGCUl9eWyha6HMPzxeYaXg== X-Google-Smtp-Source: AA0mqf73BdO0+MBcMhLCYO6sdc1tEwtSlR3zi5fhWM9dgqh9ArfdbNFP1p9lN/Y9TCFFVth5RRPtkg== X-Received: by 2002:a05:622a:2283:b0:3a5:943b:8441 with SMTP id ay3-20020a05622a228300b003a5943b8441mr26669333qtb.90.1669208719687; Wed, 23 Nov 2022 05:05:19 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 11/14] serial: liteuart: move function definitions Date: Wed, 23 Nov 2022 08:04:57 -0500 Message-Id: <20221123130500.1030189-12-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Geert Uytterhoeven Reviewed-by: Jiri Slaby --- 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 ab6837f3e40d..0b9d96e5efcf 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -68,6 +68,47 @@ static struct uart_driver liteuart_driver =3D { #endif }; =20 +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 =3D &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 =3D 0; + } else if (!uart_circ_empty(xmit)) { + while (xmit->head !=3D xmit->tail) { + ch =3D 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 =3D to_liteuart_port(port); + + /* just delete timer */ + del_timer(&uart->timer); +} + static void liteuart_rx_chars(struct uart_port *port) { unsigned char __iomem *membase =3D port->membase; @@ -98,14 +139,6 @@ static void liteuart_timer(struct timer_list *t) mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } =20 -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_por= t *port) return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; } =20 -static void liteuart_stop_tx(struct uart_port *port) -{ -} - -static void liteuart_start_tx(struct uart_port *port) -{ - struct circ_buf *xmit =3D &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 =3D 0; - } else if (!uart_circ_empty(xmit)) { - while (xmit->head !=3D xmit->tail) { - ch =3D 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 =3D to_liteuart_port(port); - - /* just delete timer */ - del_timer(&uart->timer); -} - static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart =3D to_liteuart_port(port); --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 36346C4332F for ; Wed, 23 Nov 2022 13:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237208AbiKWN0i (ORCPT ); Wed, 23 Nov 2022 08:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236527AbiKWNYx (ORCPT ); Wed, 23 Nov 2022 08:24:53 -0500 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8028EB972B; Wed, 23 Nov 2022 05:05:22 -0800 (PST) Received: by mail-qv1-xf2c.google.com with SMTP id cz18so5738931qvb.13; Wed, 23 Nov 2022 05:05: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=jeLqQhbAqImPFUjNyp0HTT203vje4doUIz/ij4dp/k4=; b=BmcMyxX1XsZJVgbAiyoUS45DFQunc48rd4w7X7n4tVK88XpUVG2SdboR9qvUepv3xP mJHxGqqbwIbgYNcuS7JgrJU/RkPRUrQ+yof/YmTsN5OQ6OkXMJ7nXZLQDs3Bo6opEjiC ZRKxgkg35llv2PbS2/zVpo9LKwL+3xNBC+FIbF6fGuI4atSMcSWxEDcaYrYpNppuJxM9 QV6vqf6ENM/MOtmb4C+FFlsMD1qj5rl6ZJMRQdwoPMLXTXDBkWEs0zk092HDTBrLh/gi AQ8vOrmLITXOGZUL8xai5vUn1MgRNME+n5DjqS5TUj9NhZtG5kLuMZaOIPHR1T6gJr8b m+2w== 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=jeLqQhbAqImPFUjNyp0HTT203vje4doUIz/ij4dp/k4=; b=BlFUQkKeQSDJwTjR47SyU3C2CiNJj+7Q9dFGEAcCUqasKi86laiebnXCf8I+W594bP mAfDkOYomcopAkRcrYIBi/dTBOPDKuemJirJvb1T3SuVd6639cuVhmNppZeHJG18ogIQ HDXDO+CowsuiNTYcKnpSmsNfBK5ExbrUVPOrfchI2NgNeI5zqNyQlJQR0d05OhPpTWmu 8of4jhH3jynizPr4geh+rEqX5lNwl+AvzcI2mTnc4bCdzo1H9T88O/9R6xDMpPnUQn2t YKsFFExgZnjJN9crSBi6KQLrcsykwHEe0/ESu4tY2l1amoVGf5dK0xCbLNU4rzA26joo HQ9Q== X-Gm-Message-State: ANoB5pngChtrDKDjyLZl/kWnynMwq+tKHg5/CV8LUs4ZywbXnIGmpU+n iXoqFAav4zKJyTt2oDGyQw7J8lSmS1RLdw== X-Google-Smtp-Source: AA0mqf7nBKdWEEYOVL6qOw9Mx16GKX7N/lz6EUDOJR2C4sW1Q7s0uQBCXVs8KoXAHlcaxY8cui+ueg== X-Received: by 2002:a05:6214:3d85:b0:4c6:b19a:10f8 with SMTP id om5-20020a0562143d8500b004c6b19a10f8mr8770988qvb.45.1669208720841; Wed, 23 Nov 2022 05:05:20 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 12/14] serial: liteuart: add IRQ support for the RX path Date: Wed, 23 Nov 2022 08:04:58 -0500 Message-Id: <20221123130500.1030189-13-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Reviewed-by: Ilpo J=C3=A4rvinen Reviewed-by: Jiri Slaby --- Changes from v5: - s/dev_err/dev_warn/ when falling back to polling in `liteuart_startup()` - use `spin_[lock_irqsave|unlock_irqrestore]()` in the interrupt handler, since the same code may also be called in "serving_softirq" context when using a poll timer instead of hardware interrupts > Changes from v4: > - using dev_err() instead of a combo of pr_err() and pr_fmt() > - dropped "get irq" comment in probe() > > 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 | 81 ++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 0b9d96e5efcf..8685c97d391e 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -7,6 +7,7 @@ =20 #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; }; =20 #define to_liteuart_port(port) container_of(port, struct liteuart_port, po= rt) @@ -76,6 +78,19 @@ static void liteuart_putchar(struct uart_port *port, uns= igned char ch) litex_write8(port->membase + OFF_RXTX, ch); } =20 +static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 m= ask) +{ + struct liteuart_port *uart =3D to_liteuart_port(port); + + if (set) + uart->irq_reg |=3D mask; + else + uart->irq_reg &=3D ~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,32 @@ static void liteuart_rx_chars(struct uart_port *port) tty_flip_buffer_push(&port->state->port); } =20 +static irqreturn_t liteuart_interrupt(int irq, void *data) +{ + struct liteuart_port *uart =3D data; + struct uart_port *port =3D &uart->port; + unsigned long flags; + u8 isr; + + /* + * if polling, the context would be "in_serving_softirq", so use + * irq[save|restore] spin_lock variants to cover all possibilities + */ + spin_lock_irqsave(&port->lock, flags); + isr =3D litex_read8(port->membase + OFF_EV_PENDING) & uart->irq_reg; + if (isr & EV_RX) + liteuart_rx_chars(port); + spin_unlock_irqrestore(&port->lock, flags); + + return IRQ_RETVAL(isr); +} + static void liteuart_timer(struct timer_list *t) { struct liteuart_port *uart =3D from_timer(uart, t, timer); struct uart_port *port =3D &uart->port; =20 - liteuart_rx_chars(port); - + liteuart_interrupt(0, port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } =20 @@ -161,19 +195,46 @@ static unsigned int liteuart_get_mctrl(struct uart_po= rt *port) static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart =3D to_liteuart_port(port); + unsigned long flags; + int ret; =20 - /* disable events */ - litex_write8(port->membase + OFF_EV_ENABLE, 0); + if (port->irq) { + ret =3D request_irq(port->irq, liteuart_interrupt, 0, + KBUILD_MODNAME, uart); + if (ret) { + dev_warn(port->dev, + "line %d irq %d failed: switch to polling\n", + port->line, port->irq); + port->irq =3D 0; + } + } =20 - /* 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)); + } =20 return 0; } =20 static void liteuart_shutdown(struct uart_port *port) { + struct liteuart_port *uart =3D 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); } =20 static void liteuart_set_termios(struct uart_port *port, struct ktermios *= new, @@ -262,6 +323,12 @@ static int liteuart_probe(struct platform_device *pdev) goto err_erase_id; } =20 + ret =3D platform_get_irq_optional(pdev, 0); + if (ret < 0 && ret !=3D -ENXIO) + return ret; + if (ret > 0) + port->irq =3D ret; + /* values not from device tree */ port->dev =3D &pdev->dev; port->iotype =3D UPIO_MEM; --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 56ACDC433FE for ; Wed, 23 Nov 2022 13:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237638AbiKWN0n (ORCPT ); Wed, 23 Nov 2022 08:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236848AbiKWNYy (ORCPT ); Wed, 23 Nov 2022 08:24:54 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436B5BA59B; Wed, 23 Nov 2022 05:05:23 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id a27so11109010qtw.10; Wed, 23 Nov 2022 05:05: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=3vOBwE8D1dAFgjAlie4wwP6R5GhWvJqKGsjcfV0A8tA=; b=TD7WPG1byXGcxR56YaJkS7kt+jTZ+gi5rHxZD/VbYHR8k7nKOdCtOnVdBXHo2xG1k8 FKKgwgtOZM3sWsX2B1MAd25g8QUyaSt40fgFfiNnpVglviWO9ZN+0cHerHmNnVsVT8uo oHvYDFEdvfJcu3vn6GJijSqhnCTJs5jpNPKJqIxH+wLZDe/K7/TwZ5HZ2ZPt4ORRqVuq C99Pl8usQlXGnBXKUz6XJBHJu8xnbskBoAzwr7GxADTJ/55t86yVo2iisIG3Qk/DgB6E 0hbbJ+NUIqJvth+8l93V+24KVdxzjcWnRNlqdNcwf/FxrzhJfo/ppN4xwRl0NXMkfJK5 n3gw== 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=3vOBwE8D1dAFgjAlie4wwP6R5GhWvJqKGsjcfV0A8tA=; b=bHUQ2LO9B9pCmKkl28IsbJCKXMvsrgwaYbPFPk92gGNOvBWc7Qa6rpyqMGzEbk9R9K FE0uUDe7jSl0Fm7GRBc+1WCy36EuE0JjIh6XpOyNXwfFTXgpgQb3R9itgbCD0BXyaOGC tyEhYgrp82Xqa4LVMlI1agBjw4V0d3R6g25IypPI6O0LZpAYvaV9W8ckBfwbj+t/ULXt dZdjTS0keH9Dd7CET+gHAtSXWSYtSlWE/ZrZ2cG54JakEx2b+OEBNSypubDrAsYPl8bi uzysa2qKSbJOytP8VnjIWsiepqKuZBfny/bZToytfh9q8LDNC2PI22mdgzQjzFrTkU3G MkZw== X-Gm-Message-State: ANoB5pmMF7X6kkoeZGyeiC7VONSZhtXhp54uJ//V6IIpRVYo/lbvQ5jx NnctYlBR5rqYKhDkoQrL//ErmNlvTNZKPQ== X-Google-Smtp-Source: AA0mqf6GWr9xhUbyY1VpwVuIQ+uhEZI30MBz22sqHhZArmHnwTlXiPxXOCzM6/OZyduC1jkKBaqYag== X-Received: by 2002:ac8:7415:0:b0:3a4:a229:b974 with SMTP id p21-20020ac87415000000b003a4a229b974mr8107388qtq.255.1669208721911; Wed, 23 Nov 2022 05:05:21 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 13/14] serial: liteuart: add IRQ support for the TX path Date: Wed, 23 Nov 2022 08:04:59 -0500 Message-Id: <20221123130500.1030189-14-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Reviewed-by: Ilpo J=C3=A4rvinen Reviewed-by: Jiri Slaby --- 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 8685c97d391e..6e9f58d3957c 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 *p= ort, bool set, u8 mask) =20 static void liteuart_stop_tx(struct uart_port *port) { + liteuart_update_irq_reg(port, false, EV_TX); } =20 static void liteuart_start_tx(struct uart_port *port) { - struct circ_buf *xmit =3D &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 =3D 0; - } else if (!uart_circ_empty(xmit)) { - while (xmit->head !=3D xmit->tail) { - ch =3D 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); } =20 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); } =20 +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 =3D data; @@ -159,6 +153,8 @@ static irqreturn_t liteuart_interrupt(int irq, void *da= ta) isr =3D 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_irqrestore(&port->lock, flags); =20 return IRQ_RETVAL(isr); --=20 2.38.1 From nobody Mon Apr 13 13:26:12 2026 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 77B04C4332F for ; Wed, 23 Nov 2022 13:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237410AbiKWN0q (ORCPT ); Wed, 23 Nov 2022 08:26:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236428AbiKWNYz (ORCPT ); Wed, 23 Nov 2022 08:24:55 -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 5C35FBA694; Wed, 23 Nov 2022 05:05:24 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id a27so11109061qtw.10; Wed, 23 Nov 2022 05:05: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=uv4LkMStxbJeRiqSaeHzPlYy/gMVyjTWm665eb9apXw=; b=ft6BQtCT+XEtii9ajj64/wqVo1iR91TOXtD/jeajiJJHi6GzAhIUUEbOAddeYe57xr bBJStbSMjxVYpLgz9snXoztA2uwAJj9Skvgera5pGs1VrCpklGMr6i0bHlNtza5WR91N bF7RcTnrcxJT3YmLRBL6F7LgITnq9m7D4SjlnqkY4Ozk8jNXpzv2+MXwVCZVmN1D2DCW tfSg3g+RHyPQt3D6DVYN57QkM2PsfJg6t1onoGhBjM3QEpGNXETxPoQHhxIwCt6/b8cb Uls/A3e+zHtMhNl/0Lw+QKMYFi9jW2yCji7jf3fb1iRzOjSvd6yLROry3OvNg1KLIqsD 883g== 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=uv4LkMStxbJeRiqSaeHzPlYy/gMVyjTWm665eb9apXw=; b=W9dHcPfsPHQeiBPLWskBWGLrqA3y1pRYZaXYJoZB/G9FZ8RRByd0rB1s21i7I0qSA2 EvfmWuthR2V0/2X55ocGiE/SA1mtMGyy7JDJxthontVDPUQAv3rGRflc/N14tohiezrS p7bS+hr56Au17uZAKWAOYH09T9wZ2Y2dX0exXfGlCGmadkzRja+DSuHORyR/+nUgAJM/ lqnkATxv0rucIAFNCT3b+4b6bRWMyVt6qxCCg/eG4JGt3J3+BBrIKhaE1xQ0e2BR8f3c vyCGQ/Tl9Dc11whHC3ct2x8Eh7VCm+IfNn76vNldWnp1BRzdD055N9lVW9YBGn6HXIIQ mmxA== X-Gm-Message-State: ANoB5pnjKVR8t8yXBP/uUsq5RPUP1k8XFrA7RkHr3w3z7W5rz9ENAc59 q7vWB45bCAaF28CMR3QB1a8iVnkeRS47JQ== X-Google-Smtp-Source: AA0mqf6/kEW4ykinuJ/KxsZ0HJs6DQq1Dj3B4mYQDn9IaVajINYKBHPG192vVFM3BW+d108NUVDrUg== X-Received: by 2002:a05:622a:509d:b0:3a5:b69:5015 with SMTP id fp29-20020a05622a509d00b003a50b695015mr26223730qtb.211.1669208722999; Wed, 23 Nov 2022 05:05:22 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id f13-20020a05620a408d00b006bb78d095c5sm12188520qko.79.2022.11.23.05.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 05:05: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 v6 14/14] serial: liteuart: move polling putchar() function Date: Wed, 23 Nov 2022 08:05:00 -0500 Message-Id: <20221123130500.1030189-15-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123130500.1030189-1-gsomlo@gmail.com> References: <20221123130500.1030189-1-gsomlo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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=C3=A4rvinen Reviewed-by: Jiri Slaby --- 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 6e9f58d3957c..ef557d59e4c8 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -70,14 +70,6 @@ static struct uart_driver liteuart_driver =3D { #endif }; =20 -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 m= ask) { struct liteuart_port *uart =3D to_liteuart_port(port); @@ -377,6 +369,14 @@ static struct platform_driver liteuart_platform_driver= =3D { =20 #ifdef CONFIG_SERIAL_LITEUART_CONSOLE =20 +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) { --=20 2.38.1