From patchwork Fri Nov 25 13:05:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 628780 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 942D5C4167B for ; Fri, 25 Nov 2022 13:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbiKYNFa (ORCPT ); Fri, 25 Nov 2022 08:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbiKYNFY (ORCPT ); Fri, 25 Nov 2022 08:05:24 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1473E2A253; Fri, 25 Nov 2022 05:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381523; x=1700917523; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4vgVjpU9TM3c0NS17ZVh5x8n1rUnhEw0wd9aDkvz4nk=; b=jzmKeMMV0bFmDJAgLoCn50PQY3tQc2Yw0LddmwEt16ooYYi7B+N3wIOb TDjU1ikC/NJJiSYgFKo2sNU/ucwcc1hfPtv/5/5qEfSe4boKUIyCFfnQP xk92YnUvbWcLZcUQ/kZaXrao55bLRzl16ZlEN+4qAtoL7ZQigzKRDadrB IEW5CQ7uGTS0LgjsREtN8pd6eBmZNwK5w/gQSyxGXrVoISUD6yaGreBJo EXFFpBLqTk+hz/AAGu/+RQDWqSrCkm2fysvM/NA7+BusKZAPlAti2EIrp 0iWFVNQkzcxrn1xD/dXc9dyp1AgZNVQB/JHOeWETZ0n6T9wjn222CaGP5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300766" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300766" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:22 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064018" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064018" Received: from dpotapen-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.50.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:20 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 1/6] serial: 8250: Use defined IER bits Date: Fri, 25 Nov 2022 15:05:04 +0200 Message-Id: <20221125130509.8482-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> References: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Instead of literal 0x0f, add a define for enabling all IER bits the 8250 driver is interested in. Don't make the define for combined flags part of UAPI. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 10 +++++----- include/linux/serial.h | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index beba8f38b3dc..8676f8b7f2e3 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1236,14 +1236,14 @@ static void autoconfig(struct uart_8250_port *up) * Mask out IER[7:4] bits for test as some UARTs (e.g. TL * 16C754B) allow only to modify them if an EFR bit is set. */ - scratch2 = serial_in(up, UART_IER) & 0x0f; - serial_out(up, UART_IER, 0x0F); + scratch2 = serial_in(up, UART_IER) & UART_IER_ALL_INTR; + serial_out(up, UART_IER, UART_IER_ALL_INTR); #ifdef __i386__ outb(0, 0x080); #endif - scratch3 = serial_in(up, UART_IER) & 0x0f; + scratch3 = serial_in(up, UART_IER) & UART_IER_ALL_INTR; serial_out(up, UART_IER, scratch); - if (scratch2 != 0 || scratch3 != 0x0F) { + if (scratch2 != 0 || scratch3 != UART_IER_ALL_INTR) { /* * We failed; there's nothing here */ @@ -1394,7 +1394,7 @@ static void autoconfig_irq(struct uart_8250_port *up) serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2); } - serial_out(up, UART_IER, 0x0f); /* enable all intrs */ + serial_out(up, UART_IER, UART_IER_ALL_INTR); serial_in(up, UART_LSR); serial_in(up, UART_RX); serial_in(up, UART_IIR); diff --git a/include/linux/serial.h b/include/linux/serial.h index 3d6fe3ef92cf..ad6e1c37e2d5 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -12,6 +12,11 @@ #include #include +#define UART_IER_ALL_INTR (UART_IER_MSI | \ + UART_IER_RLSI | \ + UART_IER_THRI | \ + UART_IER_RDI) + /* Helper for dealing with UART_LCR_WLEN* defines */ #define UART_LCR_WLEN(x) ((x) - 5) From patchwork Fri Nov 25 13:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 628779 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 80DB2C4167B for ; Fri, 25 Nov 2022 13:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbiKYNFn (ORCPT ); Fri, 25 Nov 2022 08:05:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbiKYNF2 (ORCPT ); Fri, 25 Nov 2022 08:05:28 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6262A95A; Fri, 25 Nov 2022 05:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381528; x=1700917528; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0HfKkgykKh/w7L9JZtBdMwCI7ryGACxBBLi2kGimSAk=; b=C2VP7sqw9puitksVBdsz1CMT3lpGmx6frpeROSbUDcfTgvRE+cuCLC7G 3V0w7+FRqgHm1iVEnWgmYZFLBLihxipep/hRs7swN8z/s972lkzeKT4L8 h2jFJS6+EG9q0GVQUMPRf69afqDt5YXEC66kB00sB1I6a62a6J4uY6csB jR/vGj7Epx1lO2IV4d06C8zyMmVmKl4p3g1ZRNaDueE4X3qWLjvL/Fxut 1RuSS6qEdzt8SRpBdQKiVsofQBf06Mc7r8ldm+v1I5dV25F+HfW9lQ7jK vjsPi33bGnaSjFxY6vFirTjss+zZrMYmScgneIKTMw83zMUG/0RVwWkwd A==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300781" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300781" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064030" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064030" Received: from dpotapen-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.50.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:26 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 3/6] serial: 8250: Cleanup MCR literals Date: Fri, 25 Nov 2022 15:05:06 +0200 Message-Id: <20221125130509.8482-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> References: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Use proper names from MCR bits. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index c870ee8e80b6..e79bf2afd9be 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1267,7 +1267,7 @@ static void autoconfig(struct uart_8250_port *up) * that conflicts with COM 1-4 --- we hope! */ if (!(port->flags & UPF_SKIP_TEST)) { - serial8250_out_MCR(up, UART_MCR_LOOP | 0x0A); + serial8250_out_MCR(up, UART_MCR_LOOP | UART_MCR_OUT2 | UART_MCR_RTS); status1 = serial_in(up, UART_MSR) & UART_MSR_STATUS_BITS; serial8250_out_MCR(up, save_mcr); if (status1 != (UART_MSR_DCD | UART_MSR_CTS)) { From patchwork Fri Nov 25 13:05:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 628778 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 0E7B7C43217 for ; Fri, 25 Nov 2022 13:05:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbiKYNFu (ORCPT ); Fri, 25 Nov 2022 08:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiKYNFm (ORCPT ); Fri, 25 Nov 2022 08:05:42 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869DB4C275; Fri, 25 Nov 2022 05:05:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381535; x=1700917535; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3xoDJ24ls7xPY5orIQfBql47gNQpE19TZHADmQ5loEY=; b=SjocPMA3y6CguntltyOhfQ+2lxLcKLnh2YCDOAE5gREOyDVddsyUnp5w qB30+JVxErLRppIiAPDv8Ua+TGQMkVy4UfHca5kGV0V8sFvrQVfJbNjfx lWe+jQzh0fXh8YM1LtNKGcG3OdSsBFE35gSXRNKgR6Cd2pHHa4nuWgccG M8OolNua5xKaMJ1DLt2LPkwqB6VrVEDoa9c3Nu/XWzWKyS7mjIAPanYEL H59ETrWNk7FkwpIx+d8PJrWoCj9mtQ1Imj9pJoSfvqK4hcsYjHFTT7AiH wLDYscSq0u9KZqYbcGSisstJ1WBZpiDYc/S9CpzworezDIJDMGA8dyxcA g==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300802" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300802" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:35 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064050" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064050" Received: from dpotapen-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.50.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 05:05:33 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 6/6] serial: 8250_early: Convert literals to use defines Date: Fri, 25 Nov 2022 15:05:09 +0200 Message-Id: <20221125130509.8482-7-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> References: <20221125130509.8482-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Use existing defines for the serial register values in 8250_early. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_early.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index f271becfc46c..0ebde0ab8167 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -136,11 +136,11 @@ static void __init init_port(struct earlycon_device *device) unsigned char c; unsigned int ier; - serial8250_early_out(port, UART_LCR, 0x3); /* 8n1 */ + serial8250_early_out(port, UART_LCR, UART_LCR_WLEN8); /* 8n1 */ ier = serial8250_early_in(port, UART_IER); serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); /* no interrupt */ serial8250_early_out(port, UART_FCR, 0); /* no fifo */ - serial8250_early_out(port, UART_MCR, 0x3); /* DTR + RTS */ + serial8250_early_out(port, UART_MCR, UART_MCR_DTR | UART_MCR_RTS); if (port->uartclk) { divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);