From patchwork Fri Nov 18 14:55:00 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: 626810 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 D50BAC4332F for ; Fri, 18 Nov 2022 14:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241697AbiKROz0 (ORCPT ); Fri, 18 Nov 2022 09:55:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235204AbiKROzY (ORCPT ); Fri, 18 Nov 2022 09:55:24 -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 6FFDA240AA; Fri, 18 Nov 2022 06:55:23 -0800 (PST) Received: by mail-qv1-xf36.google.com with SMTP id h10so3468997qvq.7; Fri, 18 Nov 2022 06:55: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=Tc4HY0VxnkrPwWL9SQWES+FDxkDFOlvOrzE7fQZCEi0=; b=k/WRK8g2SEfJ5O9BGJ55V/tUDmsRuk+S0Tth9ZspZbygnYVlV+bGlt/eujeVr1Wibj WprtDDRss0y3sZJb4vvnelUeql8LflbUiV8JjpaLp6j16iC2/Lx3q5AeYo5z6bJfylNN a+QtDK5fgo06thjzayOKfUPE7efXXC9Ibk8C0ucY8xzzj4a7B326HhG1fhehDuJKSaPz 3a0/5g1Xz6ibqVg3y269dVeBrDD1CK9T4Xxs8//u7w3WvNu7Dnu4ftTmvNziA+SeRCzj cC+aB2R+shxZ6yCbS2aZP/W6+Al/ApayA2fdGEGUlfZlqJ4PGVBs+2FdwZIpifkM+JDq fq6g== 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=Tc4HY0VxnkrPwWL9SQWES+FDxkDFOlvOrzE7fQZCEi0=; b=ocfyJTSENHXUwb/kj76tE5J1hkn3M3lfKv9XPCUpYJ+aA9OeDxH5oEdh7x867dvMTj a9Odb1AGcBWinjUGAJ1AOXpsPB4/uvD+2XEoUoFN4bKa8f/fP0xIix3xN5FUKbC0kzEf dkj+Gp++I0aje+PmX6HfvzY/vSBqW7Z9muCUMOiE6UpQOh72jI4SWZtmEvmN21uTLmif lIjDaEHoueejTNgHGb6mere32hA3f5HCRb2I+XwddR9EUKRp5stBRQt6RE0LBvFBnlf+ qTNh8qDvj3ivgFptXzeGpHqWAbgEC6cxEWfo6NGk2qx0IZ/v6Z5oSL2QQNHFjykLOVaR zTLg== X-Gm-Message-State: ANoB5pltDe2So82EJ2yH6JV9CTAato1jE1BXxpURs2Wq5qCGGBs7oIZG +9gI2p7I2yUwKCIk1e0dKWyJX+Ql/yW+FQ== X-Google-Smtp-Source: AA0mqf78sohrskn4Ln43QRBtHN0nz00ubfu2v/uIFSq/zmCrtpZI0VC/85WY80x+IFmGlaKB5dQSLA== X-Received: by 2002:a05:6214:328f:b0:4c6:82cd:92d1 with SMTP id mu15-20020a056214328f00b004c682cd92d1mr6940562qvb.82.1668783322306; Fri, 18 Nov 2022 06:55:22 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55: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 v5 02/14] serial: liteuart: use bit number macros Date: Fri, 18 Nov 2022 09:55:00 -0500 Message-Id: <20221118145512.509950-3-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 --- 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 Fri Nov 18 14:55:02 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: 626809 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 DA8D9C4332F for ; Fri, 18 Nov 2022 14:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242005AbiKROzy (ORCPT ); Fri, 18 Nov 2022 09:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241758AbiKROz0 (ORCPT ); Fri, 18 Nov 2022 09:55:26 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E510D8FE7B; Fri, 18 Nov 2022 06:55:25 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id s18so1875993qvo.9; Fri, 18 Nov 2022 06:55:25 -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=G9tTwOupRAJgQot7o/e3aZbJ2VlrhFzVvSQJqfH5Xr3X3zIYmwia13I6H5GzRQnefQ TuSpAuBcT2U8k7sA7YEGEH4w9eGmqkt3imQWrMvxHxjPT3W0zlEFLOnGbYWOy9P6GD9h VDsq6xfyShlnmr1YnPvDZQxTSEFTaUYwnkEGoL7qQeEhtKEylRBwvY+MLd1gD1zmxitj yKjG0ePTf7T2vvlHl0jiD3tSRGr4ugdqgprzwkTj2n0tdPUHHcKNcNaE63h6+nAKsdLX sx31au5oly+kwHDCfPDSKqRTRSth7HtIlgUhlQcyK5IqYTXLPPXotQnWH8xc019aVGqu NC8Q== 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=36xi7fgtUtLKs86iT55nizMa+K5ULXmEbDaRdkTVS6etRvnikAPF2PWv3lYnms3w7w 6ZzPQdhf0q9FkQLv7OfEbPFgdRQ2kjU08YA24vd97Y7ntEIcc6ILU4dw39OEJawZqUll cKbMxYsTlihGj5Vi1uaAR4QAOO5XjeMTlyd6z5Lpq1CXSNiCi2zzcHO7swRkc3yCVDtA Ld6SefbE9RrTjlbTUvhkZ7EpOL3sxId1ow0N0jpDuFB5oJsRXygk9OgHp453UMxwS2Bb CbIn0tcTy4RcaikWy25MP9uv/SO27Kt8kLt5lFTM9nEiGnZynjCYRZ8Hae5oGI2HJntg 5vCw== X-Gm-Message-State: ANoB5pl0XF1FVxpthUf2U8UIK7+tZRqnm6KZ++kXznTnDCPKIwwS8c7J g/jZy+iDhuC47FVF9NJyc6o/VqauV3dp3w== X-Google-Smtp-Source: AA0mqf6D5aiuwLmpCua5WQg7pPXYim+HcVMJ+HCr/SS7TMCuMhYlJ7mlJVkf5lzEKb9eKCiOZyiJ7A== X-Received: by 2002:a0c:e70d:0:b0:496:6092:9f0f with SMTP id d13-20020a0ce70d000000b0049660929f0fmr7059215qvn.32.1668783324777; Fri, 18 Nov 2022 06:55:24 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55:24 -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 v5 04/14] serial: liteuart: don't set unused port fields Date: Fri, 18 Nov 2022 09:55:02 -0500 Message-Id: <20221118145512.509950-5-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Fri Nov 18 14:55: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: 626808 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 A7255C4167D for ; Fri, 18 Nov 2022 14:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235327AbiKROz4 (ORCPT ); Fri, 18 Nov 2022 09:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241701AbiKROzx (ORCPT ); Fri, 18 Nov 2022 09:55:53 -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 7DD19240AA; Fri, 18 Nov 2022 06:55:28 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id h21so3250419qtu.2; Fri, 18 Nov 2022 06:55: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=D1hUB1CG0ZAd5p0bPUclNpK4BZ15p3GlgtAxgJ6lCak=; b=WJCV8JBRN9CY1n6C0ycMywErBCrs4UW7PhljBaHhnABbcN77s6DiHy+ieq3Keho7Fh hSgxsXpdiJ9p56AI0ZoSlrwIglziuz2OmnZO2q5bsguwe0BZQ4bqjWye+Sg7QVj0lSbd IkT+Ha+UMXXek3ykGxm8M83Ku7RtnypSxoWWcKGb8RWfEeAPWEkvfErWltE1yRtvdVUE yLe5C80j6OPHRGuuUPEYZa6F1evdUzBlB4FcHvQ5PiuyNOdsRwvpCrFOZ4gsqOqpfzh5 EdL45pH2raanZZHr6hZ+tf3fjqeKCFbujSCD45yVttWd0YHLyiR850GGyhThMYkn3K50 PGmw== 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=6wn1DMpZ/WeIvx+K/BvRyhg4f14iE9qaQYZ+d8SlgT+WpJ/ICW4L6sK+rKuB1kj7nP GeuKKlZfgjp9Cx9pulF87BpYbQ8J+dpLpzKtfHLPCMYROcJ57666jSQFZxybk31hDOFJ YSgYqmGIHPEo9ftJAbAKdye/VcfknyhPBpZAqE/d3cvVgPUg47LFFJjBHeDF7EjgeJUZ OTR0XdL+Pzidab0rX7Bgk7p2ASq5+yLXMX2xZH7nRMoARgt3CHfRJEdYzR3sF+en3b35 Zkd+WLJpzZc1FNOSl/KebnAaBii7c+GpprYKVurF775JWHtdkMBFgMYOHx7ttYITx/e1 yVag== X-Gm-Message-State: ANoB5pkMiNBqOWHGUvyuJrc/0pBAJx2jr+bWfDYyKygblrAawISAbalu UYiO+mQjZbG/PkSzXudIqv86jR3tmaAhDQ== X-Google-Smtp-Source: AA0mqf5RVLDQhr3kEvYa4VddEuglS7PJJX6YF6W751EnoKOEWxrPN15p7dW1Bcphmdzya6dyVtVh1w== X-Received: by 2002:ac8:498a:0:b0:3a5:1c61:230c with SMTP id f10-20020ac8498a000000b003a51c61230cmr6965266qtq.29.1668783327307; Fri, 18 Nov 2022 06:55:27 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55: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 v5 06/14] serial: liteuart: move tty_flip_buffer_push() out of rx loop Date: Fri, 18 Nov 2022 09:55:04 -0500 Message-Id: <20221118145512.509950-7-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Fri Nov 18 14:55:06 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: 626807 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 E8292C433FE for ; Fri, 18 Nov 2022 14:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242164AbiKRO4e (ORCPT ); Fri, 18 Nov 2022 09:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242014AbiKROzz (ORCPT ); Fri, 18 Nov 2022 09:55:55 -0500 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CE5F9039B; Fri, 18 Nov 2022 06:55:31 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id z6so3234573qtv.5; Fri, 18 Nov 2022 06:55: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=zbM5jPqWMW+ZSl/JSR0+XTeoHUgjIND5CEiOvEuQtSk=; b=GO5XIRVY3x9RdL55NnA8PngWVaDXsqI9T1T/b11sfZgpJngu5v08iloaPW19QQeifV yxem8RM3oI0zCrOGX9rFOWu9Rw64mCx6XzV2hpXwuB/dNbm9JiaVlU/xIlXM0ldWMKpw eZCIG0JOBIx36PAdMVGBTvP9zNAUI8KevkTuedMV7aP1fJxZAxv4HSj/GnRyQfwSmVgi cQFaCgmqjNxRmOQXUXwJt7WGZNEtVDNa7/mDDwUKXfXsakhnEe631N8iVeBcUKHIX0K+ QucWCFxoABT8BP1MXrZC1tZrM4Jlts9uCRGp+U1IFgpGduehWI7OElSTClEJOlVZUPE6 lh/w== 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=WUGgyzkP+tRuHaVHEKs8iom24OW+k4AemT2MAI6Rpd3PuMyeXnN49IXzFpJKZ/KGo0 UlhdIeQz8bPZkNsSproZMPb/ok2Xjx+IFL/LfgsKU8NN1GaAV/TSsMuEYSnH8aUDplo0 XXNTe5+w7fULpfxmiPKzhiNEZstUYlqsOftNAdrOZSGGnwMgP4GqC/X3Nfvx+vjTCNoC TUEETtqx43KGLXvbaDbHKWx/vbvfd9FQCvyj1QRbvVEOTUe7MIasxM7mJAO9cel4y2gK /RpqUjSQLXRYniNU7nPz095eMid6NPM3W0pk7etuOKzPpNVCpNk4faeOjiAD2V/prujq +tAA== X-Gm-Message-State: ANoB5pkufEEhBnhbAiZTqjbyUVMIrs3xNRUVeBfNGupQGEFPRIN2qGyr 9f378oGhIXcAe4P1Ph6FCwEz2r/vUOZl6g== X-Google-Smtp-Source: AA0mqf6qFHB/S0QNgRixez0SkUNC7WBwWxkKrFo5b2ojSC0K9hwGP84M6zKK6LcqZBliWkhsHq9L2w== X-Received: by 2002:ac8:43ca:0:b0:3a5:4c53:8923 with SMTP id w10-20020ac843ca000000b003a54c538923mr6891308qtn.267.1668783330005; Fri, 18 Nov 2022 06:55:30 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55: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 v5 08/14] serial: liteuart: simplify passing of uart_insert_char() flag Date: Fri, 18 Nov 2022 09:55:06 -0500 Message-Id: <20221118145512.509950-9-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Fri Nov 18 14:55:07 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: 626806 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 33A13C433FE for ; Fri, 18 Nov 2022 14:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242208AbiKRO4h (ORCPT ); Fri, 18 Nov 2022 09:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242049AbiKROzz (ORCPT ); Fri, 18 Nov 2022 09:55:55 -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 64A508FF87; Fri, 18 Nov 2022 06:55:32 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id w4so3275473qts.0; Fri, 18 Nov 2022 06:55:32 -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=RVtZ+axm8f/78K4x9m6u9WdDEV/snwwvJz9dYQG56lAmbBWPx8E4OQHsw/xQfItmKZ WCdx3EAm1/TT9laCmVqYWGZv5dx7k0lYgww8spab9/GZeVMoiJf0Fn0csTzulhP16PHI WSppyPBpE1gAy0xNBzEMkJQ4mHU7tUn0qVfNfkbq3yE0c/uqDJYdLUdScMzNijAG+ttS AXaliMknQ+wUHZrtE2ABhkI5zqHhwRdFXUy9sOOpN/4Xv/kQgpFpbTu24xWfzULaMJmY J0Xd92IBfQeBdRYW+iLb1C/lpL516CHqqsE9iNLb9RbmoPjPR5yZhAUT7gZoazlgM167 wC0A== 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=RpSSbugdosshtImb8DhvbLYyKmcJFgVGn4Iek1LWPiCvpb2FzLUro4npvD/L6o0Hnw E5D85VnDbJEs+nV1W/Uw6v7YndP3D04IYWUqgNSQrFKq5HXJieoNfqNDdbkwpSFpdQzr WAvjN1A0PXkQhhzW7m/h8HHfOdkpyyyCcG49mxKYJr+7aGONrzw3+Jo9fCufsTgmyqFi Oyo6+4x3GodM7PxY0BRuW5e5Z38gx5GtjZqEDBzW8++YTKV986TOEXdgBt1yFPo0GMfv bdQVVMob5GF1zA4Z/4mx82Ee79JKLzZVXuJIgvTyj6XwTmWHTYgeTWRsGGv4/rKxDE1h Fzww== X-Gm-Message-State: ANoB5pmxTsj308MWLIFABheZTD7l3+JQC9XlnY5J3W94nSpDT6DJGklV y6HN04J2/jFgbrU5gmHvqdnAdyjKK1w9fg== X-Google-Smtp-Source: AA0mqf4mAxZoaz5XgUyhod9OTeWR6R06A0Irkl4Z4SoxJ4NChv0llsPfqW7ef35GTXcPub1Uqg5pNQ== X-Received: by 2002:ac8:6701:0:b0:3a5:280a:3c9b with SMTP id e1-20020ac86701000000b003a5280a3c9bmr6922441qtp.8.1668783331173; Fri, 18 Nov 2022 06:55:31 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55: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 v5 09/14] serial: liteuart: fix rx loop variable types Date: Fri, 18 Nov 2022 09:55:07 -0500 Message-Id: <20221118145512.509950-10-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Fri Nov 18 14:55: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: 626805 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 F2E07C433FE for ; Fri, 18 Nov 2022 14:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242119AbiKRO4m (ORCPT ); Fri, 18 Nov 2022 09:56:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242083AbiKRO4N (ORCPT ); Fri, 18 Nov 2022 09:56:13 -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 DF47D2B260; Fri, 18 Nov 2022 06:55:33 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id fz10so3243378qtb.3; Fri, 18 Nov 2022 06:55:33 -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=pJItifKORV0QiH4EedBo3e0jCaeBPHJknDLFUbBzxThnTSLNfvepzwhfg1Wgsx5HW6 9zxRC2H5EyiP3t6BzbQQ7TxSAMisT7TFc8IUfHyRpoecD2oJcBVGm0LlsJYkkRf8op/Q 1nLB4ELIBqhJBxd+iq863TcAQTgjMZHDkIkX4r21nmjrjMv/GfmsTD8ziOwvc1/pxRdi bN7qYIpubW9hsKDnm2Fuz/n8MRkWpTRtKBQNuMk+LmyrFkfczdkZCJJI8NBumCaQmgrm f/93Lg99z7fA5ourQ4DrJlGs2dUBw+442MDZM/V/w2c3kfX0Mree3UCXRNtxOTmF3Zu6 gRtg== 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=nlRX3GAyWkzBuamVrkJN+iO9d/9ObpZ6dTzOe7X/HfYkb9ktrPXndSlf09PRnQX0To TrljS/gTlq+V8qiG2RxcF5YRJPF680nGI5AJZsgeEfRoyAxAcwRWj4ER9UHj14FgMJBV 9onfZIhPuF2Qi5sfcgaVKbzxKSLTlb3U5ZHP2L4gW7+2oG4tDJRpE4Avw4cam9TES+fx MzxZKpSgop2nCskZmVEQSNk6rEqmedLiDs1f/TsPdDuDLjT+wA986Jpzx5NPu6lG2x8V gJvRj1INnsLBb++ZXaeVjSChpnef36miani/eGquXVBtsaNY4TqXpesjIWYhXaBfnBY9 emOw== X-Gm-Message-State: ANoB5pkXoqzitzWXsBxb6WG1GJRxsjKDRBWUAmUulzHQMYoHYdZgPOQH TgRVqPbD01IMTR7J5BXp7/dPPzOZeXmqVg== X-Google-Smtp-Source: AA0mqf773FaQzqCQVAeuujfyhBorMoO6bjk0T4a61NtOD02BNQTEIp3KPlMF87jK8RGD2j0NauEcBw== X-Received: by 2002:ac8:4906:0:b0:399:7cda:9ad2 with SMTP id e6-20020ac84906000000b003997cda9ad2mr6895973qtq.485.1668783332610; Fri, 18 Nov 2022 06:55:32 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55:32 -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 v5 10/14] serial: liteuart: separate rx loop from poll timer Date: Fri, 18 Nov 2022 09:55:08 -0500 Message-Id: <20221118145512.509950-11-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Fri Nov 18 14:55:11 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: 626804 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 4B3F8C43219 for ; Fri, 18 Nov 2022 14:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242150AbiKRO5K (ORCPT ); Fri, 18 Nov 2022 09:57:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242160AbiKRO4e (ORCPT ); Fri, 18 Nov 2022 09:56:34 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57D209150E; Fri, 18 Nov 2022 06:55:38 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id x18so3543901qki.4; Fri, 18 Nov 2022 06:55:38 -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=H85ZBilTG0+9LONYH8WQbu/RytIoy2zs4o7WBsneFmU=; b=LhhyMUdVDLul1ydHHrS6RZygPfgsb9WLi8RzPvcrcuEFUHygkpO7cPiUTwe0kNowqO 6nEygirPATdptLzsTN3KSUmnvFS8xfFcpbjN8tgit+65xbSMko3dgNEXHSLUsL896Fqr /IU0W9jv0vBQluLZYX36TRLdbsNRkcTf6pbGShO3TWOW1IFJqDXSFiQLv7xk9sSxVPDA FY0JDoTULWHJGzmtmoxoYL6HVkDgu4HFu2NyuMIsHm45LZLPEmhCxcCtLWLvorM5bMID lCm0eekLEWH0+moRRJaxSDLabpHiqNltQ5UGYnGHIjX0Fjk2qDaK2z0cGxvrcJ4PCxeP ZxpQ== 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=H85ZBilTG0+9LONYH8WQbu/RytIoy2zs4o7WBsneFmU=; b=6qwEa0cVFlTvNabvHXzA4HPXhzLiG2QCq9qDgTOHWnBth0bvCWWnNOZ8XNie0zkqJy CUQlLucDs/BYPDqb73gNGaVeyqDPgzyGm3T2lRF25M3Z5X2bdkDmz31JN10MMgd4gJuw fU4Z5Fdm/tUI4b1CyeVyRrq+cX//phVZtEcTDB57ua1DzXMdg+xHoT23xe3qomPGGm+c KW99QRYC2jy9rKXtVvpBHHEO1Yxo4k06iXrkqYEhc9boN1FMQya1qbwT+iVr3YJ1iFXQ 3z72Mu+oSkJfLbgXxaztgKwUFSgulosLyYKfLu+OWhVcQ09gsg6K+gdJfEXtUpwDHFcM TJHA== X-Gm-Message-State: ANoB5pngzgJamhnQAwuTYCOgPLx0k2c5s61LAT3xkg0/7uFbjJv5WCii +2p+TzUCfyuXt9fbbzJaCV/WFg5tm6VnVg== X-Google-Smtp-Source: AA0mqf5Vy4Ub03FXWWAc6fYXJR6NsDw2lzDHauufkGa3awmps9hzkb8CsY0EiZnT8S/DnpxDrlrqRg== X-Received: by 2002:ae9:ef92:0:b0:6fa:11fd:5861 with SMTP id d140-20020ae9ef92000000b006fa11fd5861mr6110181qkg.726.1668783337181; Fri, 18 Nov 2022 06:55:37 -0800 (PST) Received: from glsvmlin.ini.cmu.edu (GLSVMLIN.INI.CMU.EDU. [128.2.16.9]) by smtp.gmail.com with ESMTPSA id m125-20020a378a83000000b006cbc6e1478csm2397269qkd.57.2022.11.18.06.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 06:55:36 -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 v5 13/14] serial: liteuart: add IRQ support for the TX path Date: Fri, 18 Nov 2022 09:55:11 -0500 Message-Id: <20221118145512.509950-14-gsomlo@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118145512.509950-1-gsomlo@gmail.com> References: <20221118145512.509950-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 Reviewed-by: Ilpo Järvinen --- 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 678c37c952cf..850125870efb 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);