From patchwork Wed Nov 23 13:04:48 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: 628230 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 C9DE6C433FE for ; Wed, 23 Nov 2022 13:25:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237951AbiKWNZK (ORCPT ); Wed, 23 Nov 2022 08:25:10 -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 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 Reviewed-by: Geert Uytterhoeven --- drivers/tty/serial/liteuart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index db898751ffe3..18c1eb315ee9 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -5,6 +5,7 @@ * Copyright (C) 2019-2020 Antmicro */ +#include #include #include #include @@ -38,8 +39,8 @@ #define OFF_EV_ENABLE 0x14 /* events */ -#define EV_TX 0x1 -#define EV_RX 0x2 +#define EV_TX BIT(0) +#define EV_RX BIT(1) struct liteuart_port { struct uart_port port; From patchwork Wed Nov 23 13:04:50 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: 628229 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 868F3C4332F for ; Wed, 23 Nov 2022 13:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238234AbiKWNZO (ORCPT ); Wed, 23 Nov 2022 08:25:14 -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 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 Reviewed-by: Geert Uytterhoeven --- drivers/tty/serial/liteuart.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 989a4f8d5bd4..c6eb7eba5af8 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -263,9 +263,7 @@ static int liteuart_probe(struct platform_device *pdev) port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF; port->ops = &liteuart_ops; - port->regshift = 2; port->fifosize = 16; - port->iobase = 1; port->type = PORT_UNKNOWN; port->line = dev_id; spin_lock_init(&port->lock); From patchwork Wed Nov 23 13:04:52 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: 628228 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 2D621C4332F for ; Wed, 23 Nov 2022 13:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238395AbiKWNZ0 (ORCPT ); Wed, 23 Nov 2022 08:25:26 -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 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 Reviewed-by: Geert Uytterhoeven --- drivers/tty/serial/liteuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 1e3429bcc2ad..81a86c5eb393 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -87,10 +87,10 @@ static void liteuart_timer(struct timer_list *t) /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) uart_insert_char(port, status, 0, ch, flg); - - tty_flip_buffer_push(&port->state->port); } + tty_flip_buffer_push(&port->state->port); + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } From patchwork Wed Nov 23 13:04:54 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: 628227 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 25DBDC433FE for ; Wed, 23 Nov 2022 13:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238712AbiKWNZl (ORCPT ); Wed, 23 Nov 2022 08:25:41 -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 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 Reviewed-by: Geert Uytterhoeven --- drivers/tty/serial/liteuart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index c90ab65fbdcf..81aa7c1da73c 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -73,7 +73,6 @@ static void liteuart_timer(struct timer_list *t) struct liteuart_port *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; unsigned char __iomem *membase = port->membase; - unsigned int flg = TTY_NORMAL; int ch; unsigned long status; @@ -86,7 +85,7 @@ static void liteuart_timer(struct timer_list *t) /* no overflow bits in status */ if (!(uart_handle_sysrq_char(port, ch))) - uart_insert_char(port, status, 0, ch, flg); + uart_insert_char(port, status, 0, ch, TTY_NORMAL); } tty_flip_buffer_push(&port->state->port); From patchwork Wed Nov 23 13:04:56 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: 628226 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 B228EC4167D for ; Wed, 23 Nov 2022 13:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238732AbiKWNZy (ORCPT ); Wed, 23 Nov 2022 08:25:54 -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 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 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 = { #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; u8 ch; @@ -88,6 +86,14 @@ static void liteuart_timer(struct timer_list *t) } tty_flip_buffer_push(&port->state->port); +} + +static void liteuart_timer(struct timer_list *t) +{ + struct liteuart_port *uart = from_timer(uart, t, timer); + struct uart_port *port = &uart->port; + + liteuart_rx_chars(port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } From patchwork Wed Nov 23 13:04:58 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: 628225 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 02E97C433FE for ; Wed, 23 Nov 2022 13:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236860AbiKWN0f (ORCPT ); Wed, 23 Nov 2022 08:26:35 -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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Add support for IRQ-driven RX. Support for the TX path will be added in a separate commit. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- 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 @@ #include #include +#include #include #include #include @@ -46,6 +47,7 @@ struct liteuart_port { struct uart_port port; struct timer_list timer; u32 id; + u8 irq_reg; }; #define to_liteuart_port(port) container_of(port, struct liteuart_port, port) @@ -76,6 +78,19 @@ static void liteuart_putchar(struct uart_port *port, unsigned char ch) litex_write8(port->membase + OFF_RXTX, ch); } +static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 mask) +{ + struct liteuart_port *uart = to_liteuart_port(port); + + if (set) + uart->irq_reg |= mask; + else + uart->irq_reg &= ~mask; + + if (port->irq) + litex_write8(port->membase + OFF_EV_ENABLE, uart->irq_reg); +} + static void liteuart_stop_tx(struct uart_port *port) { } @@ -129,13 +144,32 @@ static void liteuart_rx_chars(struct uart_port *port) tty_flip_buffer_push(&port->state->port); } +static irqreturn_t liteuart_interrupt(int irq, void *data) +{ + struct liteuart_port *uart = data; + struct uart_port *port = &uart->port; + 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 = 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 = from_timer(uart, t, timer); struct uart_port *port = &uart->port; - liteuart_rx_chars(port); - + liteuart_interrupt(0, port); mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } @@ -161,19 +195,46 @@ static unsigned int liteuart_get_mctrl(struct uart_port *port) static int liteuart_startup(struct uart_port *port) { struct liteuart_port *uart = to_liteuart_port(port); + unsigned long flags; + int ret; - /* disable events */ - litex_write8(port->membase + OFF_EV_ENABLE, 0); + if (port->irq) { + ret = request_irq(port->irq, liteuart_interrupt, 0, + KBUILD_MODNAME, uart); + if (ret) { + dev_warn(port->dev, + "line %d irq %d failed: switch to polling\n", + port->line, port->irq); + port->irq = 0; + } + } - /* prepare timer for polling */ - timer_setup(&uart->timer, liteuart_timer, 0); - mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); + spin_lock_irqsave(&port->lock, flags); + /* only enabling rx irqs during startup */ + liteuart_update_irq_reg(port, true, EV_RX); + spin_unlock_irqrestore(&port->lock, flags); + + if (!port->irq) { + timer_setup(&uart->timer, liteuart_timer, 0); + mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); + } return 0; } static void liteuart_shutdown(struct uart_port *port) { + struct liteuart_port *uart = to_liteuart_port(port); + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + liteuart_update_irq_reg(port, false, EV_RX | EV_TX); + spin_unlock_irqrestore(&port->lock, flags); + + if (port->irq) + free_irq(port->irq, port); + else + del_timer_sync(&uart->timer); } static void liteuart_set_termios(struct uart_port *port, struct ktermios *new, @@ -262,6 +323,12 @@ static int liteuart_probe(struct platform_device *pdev) goto err_erase_id; } + ret = platform_get_irq_optional(pdev, 0); + if (ret < 0 && ret != -ENXIO) + return ret; + if (ret > 0) + port->irq = ret; + /* values not from device tree */ port->dev = &pdev->dev; port->iotype = UPIO_MEM; From patchwork Wed Nov 23 13:05:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 628224 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 EC048C3A59F for ; Wed, 23 Nov 2022 13:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236527AbiKWN0i (ORCPT ); Wed, 23 Nov 2022 08:26:38 -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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The polling liteuart_putchar() function is only called from methods conditionally enabled by CONFIG_SERIAL_LITEUART_CONSOLE. Move its definition closer to the console code where it is dependent on the same config option. Signed-off-by: Gabriel Somlo Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/liteuart.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index 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 = { #endif }; -static void liteuart_putchar(struct uart_port *port, unsigned char ch) -{ - while (litex_read8(port->membase + OFF_TXFULL)) - cpu_relax(); - - litex_write8(port->membase + OFF_RXTX, ch); -} - static void liteuart_update_irq_reg(struct uart_port *port, bool set, u8 mask) { struct liteuart_port *uart = to_liteuart_port(port); @@ -377,6 +369,14 @@ static struct platform_driver liteuart_platform_driver = { #ifdef CONFIG_SERIAL_LITEUART_CONSOLE +static void liteuart_putchar(struct uart_port *port, unsigned char ch) +{ + while (litex_read8(port->membase + OFF_TXFULL)) + cpu_relax(); + + litex_write8(port->membase + OFF_RXTX, ch); +} + static void liteuart_console_write(struct console *co, const char *s, unsigned int count) {