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: 26003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4004989wrr; Fri, 25 Nov 2022 05:11:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf7sIV3BZ91ELSY6xRpfMfO8lsJPt0t5r+9KpC/RTPGMVYtA2iBIkugj1RgxmGPB/sSVg0r4 X-Received: by 2002:a05:6602:220a:b0:6bb:a841:11fc with SMTP id n10-20020a056602220a00b006bba84111fcmr7953432ion.162.1669381867369; Fri, 25 Nov 2022 05:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381867; cv=none; d=google.com; s=arc-20160816; b=lU83C69cM5+UZW+qtjK/FCGOsI85kYB4BuJ9/9llw1bmA464eZA3vFkyOZPV5KO1VO AlOHoeH0yoGgakNhlVWNkVAM5FUH/f4nmSRdWNhDGePeAuvt83CTkaFtXYuofWhz7ylL QLkigkq/pgPsf28W6PFCJUmGbv9iFZCuN0gUU2MeZzf3u96XAnM/XAPNxdLS8vRMJbmY v1T59CnrgeZ+ry0RDZRZSwKSU3cYCSIcjYSmMsLSKvjcb0g3snMvQ2X/46eqx95xlYd1 OrENj2YoPVz7+5GknvyhVYHDJwT+G9gbIN0zAuDvxfgsArdI0wwQc/ZIUWD3UnlhVayh u5oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0LnMKra8WeWVshTbkZBoP+7Zak6xNMMnh/unmSdleOg=; b=I4h/Qz2Z2/yOLhLAI1tVghTBIYeqthCtudj2WmLJlbQUPfmX/4e6LsB9zkssNWCega d7+EJ9WZv/0lEsKyFCJKLR2AwSBtDTTcXUyfhGSpzdcdK5CcKZGmr7+D/k/vP3Bci+1z pc4q1TiKpwA99tKjgkoCnZ0zE48ybqbXh/XEYD7I4LVqq8OeGG9cmKSoWr0UjomkE+sg szyuqTVMHCuJFM2Eb5B6LsTQFxo+GrRYPMOGiJe9sZ5VhK1/BAYgjxEWSEOhJL/7wgwe zJ9Hi5mVEKH/nF3flDd5GTRlgC4x23MnF4ldz2QdLnkhJvaLx3sswpZ10wx1wyUCERkt 6W1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jzmKeMMV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a056402440300b0045d9ceae6d8si3648526eda.492.2022.11.25.05.10.42; Fri, 25 Nov 2022 05:11:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jzmKeMMV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbiKYNFf (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:35 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473760791760190?= X-GMAIL-MSGID: =?utf-8?q?1750473760791760190?= 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:05 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: 26009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4006693wrr; Fri, 25 Nov 2022 05:13:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5To4a1wHxQH6TpToNtvPNiMMZ8Lcun8p2BLsp+7HWU49c+mz71JurCfSbf+2T7LywNJfz+ X-Received: by 2002:a17:90a:bd17:b0:212:dac0:ce83 with SMTP id y23-20020a17090abd1700b00212dac0ce83mr31557272pjr.223.1669381995831; Fri, 25 Nov 2022 05:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381995; cv=none; d=google.com; s=arc-20160816; b=um6oLsT1aausK16uXU4QtzK/SWWN4KGvwSsTws9gJNNQ7ZvWvnAszL0bdQqeMtezS4 bKxGoEtULgq7oVgMPaKvKROqVseZIDXZAaJtThGvJkdHt/nRxjFk6K6pheXlAGIHNfs4 swdvApnuVDwxBlKm9l5nP7B4Uj4TitQ3yh6ql/N5Xj4Wxr06h0QDNQYirUsJ15aZ3mie 8p/Le6fDmUfZozCRvI8FPWx3RHHN9Ie25Hh1vaOA1gBRKOC5SZo7UKlXS0sK6tIhae8r znN3pgpyzoVvfqV+ORCqce6IOirt0TuMYs1EZzu4DG+m3G5qsNKropj6+KLL9pCrri/w LIHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PngZgIXql24Ts2T5c0Hc297+4xxd4GLoTOHD/4bYpx0=; b=oFkL64AUHzj11av89KovW12TD1iP++P8l7y0f8BDIVvwYOaTmXRegb5X4EqPJz3MWT N0loPbs+wP6tJP3H7UgSegXGDN45mK2tf6PDsYFR3KL58nf15ps4Gnao4JV9jmOt5SXS FQDgp0i1WURRLfEKP27KO6WOFQrOcYpIiIs2Q9psfnNWX4SwnjSMbL+9b8OHUh+PX43R 4tTTYCRiNmhOplc+2LjpwF8jSER081TAWRmC9rC+opHKU0bbNBah/eBaIfIu/lJLutoJ bfMakAvxBMP1Bj1Wlq/Y5r6y6iS/EzijAZ9pMzRWuLtBciIFYuN2hN2goNN5/yQzDt9D 7+Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NOPLbaZz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a170902db0700b0016d7639681dsi4506312plx.493.2022.11.25.05.13.00; Fri, 25 Nov 2022 05:13:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NOPLbaZz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiKYNFb (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbiKYNF2 (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 51E7C2B258; Fri, 25 Nov 2022 05:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381525; x=1700917525; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=382hEEQ4aybhmi7q6KqC+mBW2YH4NFBL19G2ZyJJaHk=; b=NOPLbaZzR+Ww3HAfqB+WvtMxLkrTlwz/1nVi/Ka6Z1yxBhI07USp8UMc XETxdLg4vfhEdyyCqqOVqpyzoLG1uL9pRPr78qNayXYfvu3APfPoH9OMW XOaRfpyrRT4SNPvdxHNhiOaWFG3ECSmWyRk2f1eNfDg7dHIRuLtDtOuC5 1l8FcdlROuJki6LuQa+w+8WYennjcL5wdm5ECXayFDENymBAmYplvNK97 TkdtoqNLX8PHVgi0eq0zxaZP7fkjTvAv+vEW4i460f6+5+L0rGy4Sc7L/ s+Iqh6NETjkySMp6/l67fIqMzf+/m8ZmuzUqwAoEO+Pq+OWrUgJnadjj0 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300773" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300773" 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:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064021" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064021" 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:23 -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 2/6] serial: 8250: Name MSR literals Date: Fri, 25 Nov 2022 15:05:05 +0200 Message-Id: <20221125130509.8482-3-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473895359376016?= X-GMAIL-MSGID: =?utf-8?q?1750473895359376016?= Add UART_MSR_STATUS_BITS for CD, RI, DSR & CTS. Use names for the literal. Don't make the define for combined flags part of UAPI. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 4 ++-- include/linux/serial.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 8676f8b7f2e3..c870ee8e80b6 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1268,9 +1268,9 @@ static void autoconfig(struct uart_8250_port *up) */ if (!(port->flags & UPF_SKIP_TEST)) { serial8250_out_MCR(up, UART_MCR_LOOP | 0x0A); - status1 = serial_in(up, UART_MSR) & 0xF0; + status1 = serial_in(up, UART_MSR) & UART_MSR_STATUS_BITS; serial8250_out_MCR(up, save_mcr); - if (status1 != 0x90) { + if (status1 != (UART_MSR_DCD | UART_MSR_CTS)) { spin_unlock_irqrestore(&port->lock, flags); DEBUG_AUTOCONF("LOOP test failed (%02x) ", status1); diff --git a/include/linux/serial.h b/include/linux/serial.h index ad6e1c37e2d5..bfda927dde15 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -28,6 +28,11 @@ static inline bool uart_lsr_tx_empty(u16 lsr) return (lsr & UART_LSR_BOTH_EMPTY) == UART_LSR_BOTH_EMPTY; } +#define UART_MSR_STATUS_BITS (UART_MSR_DCD | \ + UART_MSR_RI | \ + UART_MSR_DSR | \ + UART_MSR_CTS) + /* * Counters of the input lines (CTS, DSR, RI, CD) interrupts */ 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: 26004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4005108wrr; Fri, 25 Nov 2022 05:11:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tZAXrSBwTGNEP6TiLypeXIkw7embZzJAoHmjGM+rUOtFTfmR+QHYRtEWd4op9q15ZwrwU X-Received: by 2002:a17:902:b414:b0:186:7fda:4d4a with SMTP id x20-20020a170902b41400b001867fda4d4amr24345787plr.66.1669381873929; Fri, 25 Nov 2022 05:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381873; cv=none; d=google.com; s=arc-20160816; b=lOv5RtC3ow57J6XDAhXYNsSYeJAdBkt20oYn/MMFms/OrHkZcAFE6SpadBaat2wGCZ asX8vTOmyzSuV7tHxdCm9TfFfPEx1+10YBRK5MUA6gwtU62MzKqDz0MEFAZLejL/KKWI YzvA4s3DgnXw3ObdcMdnYOpJuxsykg45peMzoFa4cXHepkXxadqgsdHS8szVcdYVi0S1 RnKo84ZPDYdPlZuGV5SfvS+IK+YPVZYeLeYgvEBhpx0V4HyMM3XLM5bQfRFRsNdgP39k gC7Nhh/uKHsGd2kLuy5o8ImHnEMLsquqaTok3Hk4Zvd7DX5s8+PLWH7r57U1Qe1aqQd2 3ZGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sv0ZnpaZAimflX2T/RqAJqY7jfejcEYh5eD/icvBWcM=; b=DbwyYiz3l7DE7ft0ZpsgwAk5CjngIetepw+ErGLKCkganjGLBwwKeL59wVZpW6EB/c Bb9Eo9vMRFBt0H/xUg42QuXeTvcaw292ESf9QGv6+t0D1j4gllkuFUFwdFqabwP2KRWN 2P388bw9nfOp3/RSI37PKpT7n9bohIt+Lm+mzCc9EbwLvYtNrdKSOWf7fT7t8ZccMmjJ PwYaljL2diykrgVM7+YX8YNbExIso1s0ED32/bsqclWgXYP+E2z2XVGBxSjvaQaSev7A d1H/plBvEb0MCSe57wArAiTKnzlHNXNquvfojssnPiHFYCn4Q9dXk/F7n1knFNP2u2Ed q3EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C2VP7sqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020aa79716000000b005747a147929si3579235pfg.21.2022.11.25.05.10.53; Fri, 25 Nov 2022 05:11:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C2VP7sqw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbiKYNFr (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:47 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473767848357626?= X-GMAIL-MSGID: =?utf-8?q?1750473767848357626?= 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:07 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: 26007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4005979wrr; Fri, 25 Nov 2022 05:12:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf71aM3F3dDRbjg+/okFmgO4ab0dfU61IoZHoPTBzqgvPSk+v30PLIY2L70TNDJCNQpDLvN6 X-Received: by 2002:a05:6a00:1ad2:b0:56c:235:83a9 with SMTP id f18-20020a056a001ad200b0056c023583a9mr39868975pfv.6.1669381939611; Fri, 25 Nov 2022 05:12:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381939; cv=none; d=google.com; s=arc-20160816; b=YBFrtfO3tcDNBENT7XhYllPOTqGFpk6v5XeDbVL81RIrRq1qr4SiyTYICtrbZcdHjt AmYBT1rBpApN3TEB6XKJITqWQRBCyMKulUDWqQMCt9d2jrwIdDA5lyJRHcOEpvtFpZMt 968gGA42tPU40rrf1w5xBblLi8v/05RHsHw62HGw4dR2gIV2GF4uO/WX2wEO7Or+khPm C4cNFzHlCeN/LJkMJcAFvfs1/a4zh35HOHhVJUMUK26vuN0Tq4IFgsnRt1vQZVBkOcoY fCZtq4rLDofYtcH7W5NODtXCERmngKXc93Y8QwgZ9PCYqbWnk9wHGy+4GtZLTy4rbhIX 7Zww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/fsHfpHXBdi2dZ+0UJKpyBDW9C+xh+OBokPetq1/tUw=; b=k01C7t+7Wcz4QwmS3AX0dlTsDFxuLlHpjVBPNJGoGkFO48x4KGNAo3k8tgl3S12CkJ 9ZHZRZK582MJKxgv1KZ4OorDeNSShV3rbx4RMqeh70HHfySl1eyo5iAcU14nbcT+K4hE ddtGYS99jydychDHPYK9Ymt90PLLOBpeJiw8Y/+9x9j1GVENGgdie79KVsStDHSju+eY yWHn5wg9Sw2ZxSxND34Kh1aRdn4zLkurO5FxqOb3oECKV/E5s2AOLOz+5A2vlTP4K+j9 jCVWuuqpkOQ7i+KQFAT8vmIXVIcn99LYAhvUIjwNvuQiGTgLrA84idZLkxn3X+/kHHc6 XjDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mavMDgXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d89-20020a17090a6f6200b0021878aebd90si3922245pjk.168.2022.11.25.05.12.05; Fri, 25 Nov 2022 05:12:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mavMDgXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbiKYNFn (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbiKYNFb (ORCPT ); Fri, 25 Nov 2022 08:05:31 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9354C2A417; Fri, 25 Nov 2022 05:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381530; x=1700917530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JyK1IkOeQHocT9IrUkcXubj5M8zAIvA2Nbr+c5YEM98=; b=mavMDgXaSx1p8ckmtBJ3rnkX/8fX6hxgQIAyLAkD/o6tWoD8sL4ryVN7 raTnsf7se5Yak6u1E7dSUJE4gd6XjoQMYNKqljb1bZL0e7R4JGtqFvm4T FMu3idA2oct9Cj1l0GVTOhqCNA42HTIr2xe+At7x7UEcr9EFxt05gwRuI yeOAvsa1nYKrKSCx3ADX17Hdnkmpg3n8HFH/SOH8Hzb9Vf4mFenRkuInB JF8KaLu3UvukNPNFeK+3n/sCzRVHeiJUkF7ZOKgXSx3caZzt0gUug9yoD WKR5rQe55bNvBDT8ce5rUyw6eIsT75e1H0Hkp9c2ADz0kdrvDNwnvcf/+ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300785" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300785" 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:30 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064033" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064033" 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:28 -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 4/6] serial: 8250: Add IIR FIFOs enabled field properly Date: Fri, 25 Nov 2022 15:05:07 +0200 Message-Id: <20221125130509.8482-5-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473836304772254?= X-GMAIL-MSGID: =?utf-8?q?1750473836304772254?= Don't use magic literals & comments but define a real field instead for UART_IIR_FIFO_ENABLED and name also the values. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 17 +++++++---------- include/uapi/linux/serial_reg.h | 4 ++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index e79bf2afd9be..a47ce3e974a2 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1293,22 +1293,19 @@ static void autoconfig(struct uart_8250_port *up) serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); - /* Assign this as it is to truncate any bits above 7. */ - scratch = serial_in(up, UART_IIR); - - switch (scratch >> 6) { - case 0: + switch (serial_in(up, UART_IIR) & UART_IIR_FIFO_ENABLED) { + case UART_IIR_FIFO_ENABLED_8250: autoconfig_8250(up); break; - case 1: - port->type = PORT_UNKNOWN; - break; - case 2: + case UART_IIR_FIFO_ENABLED_16550: port->type = PORT_16550; break; - case 3: + case UART_IIR_FIFO_ENABLED_16550A: autoconfig_16550a(up); break; + default: + port->type = PORT_UNKNOWN; + break; } #ifdef CONFIG_SERIAL_8250_RSA diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h index bab3b39266cc..19aef5b0b049 100644 --- a/include/uapi/linux/serial_reg.h +++ b/include/uapi/linux/serial_reg.h @@ -44,6 +44,10 @@ #define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */ #define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */ #define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */ +#define UART_IIR_FIFO_ENABLED 0xc0 /* FIFOs enabled / port type identification */ +#define UART_IIR_FIFO_ENABLED_8250 0x00 /* 8250: no FIFO */ +#define UART_IIR_FIFO_ENABLED_16550 0x80 /* 16550: (broken/unusable) FIFO */ +#define UART_IIR_FIFO_ENABLED_16550A 0xc0 /* 16550A: FIFO enabled */ #define UART_FCR 2 /* Out: FIFO Control Register */ #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ From patchwork Fri Nov 25 13:05:08 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: 26005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4005605wrr; Fri, 25 Nov 2022 05:11:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5cgg5oU7KuIdEdnxfCniiurQYA+G5owKqMAyZUKXJ9roqyqKIwFEslfht1xYwdZCnl7KyN X-Received: by 2002:a05:6402:4311:b0:458:c66a:3664 with SMTP id m17-20020a056402431100b00458c66a3664mr20966228edc.79.1669381913321; Fri, 25 Nov 2022 05:11:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381913; cv=none; d=google.com; s=arc-20160816; b=bumSxh8OwLhQHRgPZgbDqmqyyENIIdoZw8yLXtnfTMiya6J6HBbQZHKbTndw7hdiQZ efxgX9Q8DQGbDi/tvGKGtncCPz/hXPc+LP5BCdqqs5KEZAjicI7OiiRBuMynVPdVr4zE 54e+5O6Rv6omRIJZZHPMiZuY5Hakqiu4Cg2/0lM1Jfkj2LFpzSyh/zW2HeBdZVcN/VNE C1vXowI2bXY7RYDa/4zR0x4My3iJf+MI9krwh6f/fSAd4fWw1t/ND0u+OUjHfMAGMVz4 kssjAEvO0M6fARPwfRA/AP6oobny/D+phhSk/aZJt92Hw3i0yqwMnft6f6+sHQkaCdmw d6MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=npxecdTM0jQYr42qCKGxeebF6pFoUKsXkX83k9jpIIE=; b=YM0RigrZPb4I2oCrr1Luo3CypRinGvEeoENqL6wLnmKmF05gdtxjlJQn+EUzTqOHWX KQIP+1ve89izw0ST2PIZ+7fNxmDfVCsZEVrvRRm8hlcA2Gf6TASoZv0it37JQoZFhJBb wCpuwgi33haTR88x5OkdMRPJHUvId7Mi6ZbhIPyFdvPic6qjlPqAb1bYEUZPE+ZACw4R MzzVeUvjgHw+6NY9ybu/UVIh4jJE1s4RCA7/whFhTn/lxdX8fbx/kXTOGbRlGdmI6PvJ Cdxcmk6DSTiKQn0M71CUWiCIReQ+3et8c88qrsSZcB3G9iHGG8NZgkfZC4oGil5G+wGD TQvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dtMGVOI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg42-20020a170907972a00b007879bb73291si2890566ejc.807.2022.11.25.05.11.29; Fri, 25 Nov 2022 05:11:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dtMGVOI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbiKYNFt (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiKYNFk (ORCPT ); Fri, 25 Nov 2022 08:05:40 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3B82B61C; Fri, 25 Nov 2022 05:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669381533; x=1700917533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ic5NGKUd2TkcSnwEZPif9UrSF9XQfkvW0X1TSU5714E=; b=dtMGVOI9xXqLjnOvuHeihT/rhmwoHmLtWL9EoNPys7uhvmjrD1y6NfLJ IliVoyY7s1PqppB47/IMII7X0nIoOiY1asERWj49Bsb2mqhmahgH+m/vc fCQ2UTnxXSp36X/1+Sk9ZS1NFEpFWdtjc77utLlBKzvCrRfWaSCkuvUic VgH3P9yPqZis/o64I+y3nX7Z18l0SbeI6cpuM+8dY1Y/bPyQIx9jEexMW C3zJVq61CTuIzrmXGH30+hxGrSe3CAUQm+uSsVy2Oyu3zFJvkVnKZ2+Oo 3dQ8GCizmbJDOg9r+1cC2Pdi7+sVdFW7nJCKiXnh0P68elCvcshQV/xav w==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316300796" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="316300796" 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:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="706064040" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="706064040" 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:31 -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 5/6] serial: 8250: Define IIR 64 byte bit & cleanup related code Date: Fri, 25 Nov 2022 15:05:08 +0200 Message-Id: <20221125130509.8482-6-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473809407999805?= X-GMAIL-MSGID: =?utf-8?q?1750473809407999805?= 16750 indicates 64 bytes FIFO with a IIR bit. Add define for it and make related code more obvious. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 14 +++++++++----- include/uapi/linux/serial_reg.h | 1 + 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 a47ce3e974a2..33be7aad11ef 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1050,11 +1050,12 @@ static void autoconfig_16550a(struct uart_8250_port *up) serial_out(up, UART_LCR, 0); serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); - status1 = serial_in(up, UART_IIR) >> 5; + status1 = serial_in(up, UART_IIR) & (UART_IIR_64BYTE_FIFO | + UART_IIR_FIFO_ENABLED); serial_out(up, UART_FCR, 0); serial_out(up, UART_LCR, 0); - if (status1 == 7) + if (status1 == (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED)) up->port.type = PORT_16550A_FSL64; else DEBUG_AUTOCONF("Motorola 8xxx DUART "); @@ -1122,17 +1123,20 @@ static void autoconfig_16550a(struct uart_8250_port *up) */ serial_out(up, UART_LCR, 0); serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); - status1 = serial_in(up, UART_IIR) >> 5; + status1 = serial_in(up, UART_IIR) & (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED); serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE); - status2 = serial_in(up, UART_IIR) >> 5; + status2 = serial_in(up, UART_IIR) & (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED); serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); + serial_out(up, UART_LCR, 0); DEBUG_AUTOCONF("iir1=%d iir2=%d ", status1, status2); - if (status1 == 6 && status2 == 7) { + if (status1 == UART_IIR_FIFO_ENABLED_16550A && + status2 == (UART_IIR_64BYTE_FIFO | UART_IIR_FIFO_ENABLED_16550A)) { up->port.type = PORT_16750; up->capabilities |= UART_CAP_AFE | UART_CAP_SLEEP; return; diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h index 19aef5b0b049..08b3527e1b93 100644 --- a/include/uapi/linux/serial_reg.h +++ b/include/uapi/linux/serial_reg.h @@ -44,6 +44,7 @@ #define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */ #define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */ #define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */ +#define UART_IIR_64BYTE_FIFO 0x20 /* 16750 64 bytes FIFO */ #define UART_IIR_FIFO_ENABLED 0xc0 /* FIFOs enabled / port type identification */ #define UART_IIR_FIFO_ENABLED_8250 0x00 /* 8250: no FIFO */ #define UART_IIR_FIFO_ENABLED_16550 0x80 /* 16550: (broken/unusable) FIFO */ 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: 26006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4005763wrr; Fri, 25 Nov 2022 05:12:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf50sQyennxr5qnMOYNpHMCralp8wtYtR/O1CoLylgvv3zjIc70m/3G71afGjCDV3qR0CXFg X-Received: by 2002:a19:ca02:0:b0:4a4:434e:1e07 with SMTP id a2-20020a19ca02000000b004a4434e1e07mr12118516lfg.172.1669381923835; Fri, 25 Nov 2022 05:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669381923; cv=none; d=google.com; s=arc-20160816; b=l1LnJKIWRvi4OV8NvFcRGfD53Z4a1+PjcRpEiPqfHoy191X7tWIr5ngySPDpuEUGeO 7DZDoNS993D8wx9Tzx164LrCB1Z1EWfCToJ8CBpId4T7c8ZMvkfjRpzpIYvyqYtc9vvo AzP6Rw1MLgGq1OE/DmZeiwSk7qDMbJc1isAEk1OQIJ4D2b8/C/61v/IOYongKkUxW1ty lO9WwMhMzfwP05ILGLKyI6J7eOw+SwmOPabaKTqhdv1bBW47syjpjDf/7BYaeKJB7dQs oKWJ1t39gk7e6i55VVkAqs5HPrfDUIo5O3NdVOPTXdalOfGr/PVi1a30uLcACb/Uloun KjjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6fnj3UVmGEOXYNuUqSX0MGfy/RJO0YzOh/+/SROXoVI=; b=hrRL9SXfvLR0hW6N6kDONngXqxVwZuXnECvzqXFYjfuNAQSRGjFGSYbORfO3kyGqtW 2lZ0buI3pIhUaPTkCcvejKWFHyw28reENNZKd2TUScbothBctjqxahNur5izRGNp/Y6u tjCvWIVuSk4+M6N4o8f7wEgnHvi2NCN+Z9gKFLpocfLnVHmdeDXHCANfK6/rxLC/xnl2 FyrXnd9e7QFgoTvxaZzWc2jec4ETWLdHtzqLS3aFVrUrGa6+9FYinF5vsDltpxZL22Ak j6u8vd7uL9L709fQuYYD9FpmM2byxw2WM7H1B1bXnAo3q/CECXZmLX6X8GQODrS+MJCj rqZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SjocPMA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg31-20020a170907a41f00b0078d2a84f2f8si3345088ejc.645.2022.11.25.05.11.39; Fri, 25 Nov 2022 05:12:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SjocPMA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbiKYNFx (ORCPT + 99 others); Fri, 25 Nov 2022 08:05:53 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750473819943170918?= X-GMAIL-MSGID: =?utf-8?q?1750473819943170918?= 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);