From patchwork Thu Nov 24 12:59:43 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: 25521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3380467wrr; Thu, 24 Nov 2022 05:00:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf46Q1SgWpvk0PEVpL+UQbmcuAYAD4RSpBCXpf0rmkvYqBtOX6SwYOQC/rvnAb/HQ9TVafM5 X-Received: by 2002:a62:5e41:0:b0:56b:db09:a235 with SMTP id s62-20020a625e41000000b0056bdb09a235mr15255168pfb.20.1669294840111; Thu, 24 Nov 2022 05:00:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294840; cv=none; d=google.com; s=arc-20160816; b=AEgdLHFumS8vROfPv2ESDKkXReMoC3wk0ZJO0QLu2khKQ47LvUuo3jjyQMEGbzxnEL IZUecJJzPZrAbuaF1jizxBj82GQjdDc8l364zaxXvVTnTi2BZ11rtAZ0od9jh5OuV7JE zJbX5i7rJPSjzedQZUWy7YzfSTG94SB6Hi0SeIsTvZXpEBKb4DDv0y2okyO41bFEWYSP nvChOZxoi9A9T9hJQqbrdIFRyWSvz4Sn0Y3Z/mxpRDwLgx0hLq+vg/RawoHBPIyf/dZ+ mhMdKXxkPgUJ7gjr/L8JbBEo5W1PsIQFoCOljvJWFjXGdZxVJuoiwIdMgqGLU2AndNFA 3jAg== 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=aMhE07QodWLSBMzJC/3W7J+Fpz0G+tW8VPZ+v/j0xpt8EgNszWBk0XQu1xBxPdAnnb 4cgqwZjcchwvvm7e4c10uwC0tUvSycwzIJIn60vF2FRaC8N1FEr+1latK54nCnFQLtvz 8snwaOeZ5EbklS6U2j7G+/P6Gb8xhqvg3VH+jwGTqW2TpLddC++lIFsxIBvOAjIw71Sb geMpWwVPhMKrvLabFtTj2kpUukcx17XjjbZQaZyfLoI6BhjI3XlSej97dI+kc/YWylD1 bdm4yBAuf3ueNe9WM2XUh7uYFgExX+6QNjVo2Wh7HtMKLUduVx50fbaKATJqrAl8Dq0Y dtnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ElF5mXaV; 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 bj16-20020a17090b089000b00214292112a6si206321pjb.82.2022.11.24.05.00.26; Thu, 24 Nov 2022 05:00:40 -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=ElF5mXaV; 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 S229967AbiKXNAI (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiKXNAE (ORCPT ); Thu, 24 Nov 2022 08:00:04 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 091387CB94; Thu, 24 Nov 2022 05:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294804; x=1700830804; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4vgVjpU9TM3c0NS17ZVh5x8n1rUnhEw0wd9aDkvz4nk=; b=ElF5mXaVEII5eQpqvBFK7ngxtzQz+sFTqitXBzC1NHahOvRQGMaZ1St4 Ul3wOMazCK4n+L1D8TNm5xSl9LLA/mY2Tl2gp01AMIyJEJbKLDOzBc/2F fNeWrEYhHXCPBk3Z9aoot+8jbUi0jAE6R8fcem+UDvKwjHOvL3K0ngzot m4i7DK33XQOZKCpz8hEZvN14mYZYQs1GVxsslsmhwl+oCFHZQwVMHiL1R oPHQekIByKuR1g8EJOi+YGT/7N8btN6dymA75nPFE3bPZd39U8W/eV1f2 E8dkL2pFqj5RHiGAWV6w5IHcKqSj+0977Xd+HEEFsfs+J6VD+tB/niWT0 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932043" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932043" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:03 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367555" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367555" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:02 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 1/6] serial: 8250: Use defined IER bits Date: Thu, 24 Nov 2022 14:59:43 +0200 Message-Id: <20221124125948.23432-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750382506186361548?= X-GMAIL-MSGID: =?utf-8?q?1750382506186361548?= 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 Thu Nov 24 12:59:44 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: 25523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3380721wrr; Thu, 24 Nov 2022 05:01:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf6wmuC4yoaUaZCf4P+mND3INIx2uxzvioxhwgj7/GVlcXC9F72uxC0pabgxMneZISZuMePZ X-Received: by 2002:a65:6753:0:b0:477:91c5:f9ff with SMTP id c19-20020a656753000000b0047791c5f9ffmr11417957pgu.403.1669294864266; Thu, 24 Nov 2022 05:01:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294864; cv=none; d=google.com; s=arc-20160816; b=G8ddSHS4w08okwzSIpj/qly/oLCJb1X1tpOiiogD3UqTDYWGqxQnePM3dZFoLnN9v8 NQvWxuo6kLgUOH11YHwM6CW1xHpBPHgOu3VjUfhicm6kOBBZNrRHWp+0JvIR/I72CPnM TZvhVTMtFkBChIrFp9XvQpb0TWwYeb0ugIC427BAxkArXYIIWFM2Mj5/Zo8QaVNDr+c+ HciaMIREDaiWki2PbRIEC2wyYE6/zMwl/Eulqhp1ulQcTgoeaJn95UXkt3YkLAaEF/ez W1+cOJytFMMxZyY7SCbZSlnYN3P64TxZ2n3/JEd59k7NEoRzqCdQH9vE2bSFMCAjVYpN 5lfw== 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=w0X1CZ0KC+dVE8S7wcMUrm1VzI+lNHTehuIIlAL7rDG0CXMcSNXpLYH69lxiMRiknl zZWZfiG5QSKbRHKJe5lhSMvfJKEPSddyfyhwOgkIDWkPbhIXzxDbZbOqWrUnga0A2hvG 60RGeIDBtYQb7GQVtGcTxPQFbUnlKtzD4q0frUCVgwgLiJH2U2hECwdUnB95p0Z4m+q2 47muu6Fo9Sz4jovvN6QieIktTMaIXJs6FBPpwia0G/JiJpiFxlS2/QuTII8irUl7QAS8 AoY9AZgi3Sea3gjoyP3acfTGWAo6QBlX+VjlF91Vlyq2pfuL+Y4LSalxGKteJYRigZEE 5OQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gojuiluK; 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 d11-20020a056a0010cb00b00572f79a30f7si1066494pfu.280.2022.11.24.05.00.50; Thu, 24 Nov 2022 05:01:04 -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=gojuiluK; 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 S229964AbiKXNAL (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbiKXNAH (ORCPT ); Thu, 24 Nov 2022 08:00:07 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC542D1E1; Thu, 24 Nov 2022 05:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294807; x=1700830807; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=382hEEQ4aybhmi7q6KqC+mBW2YH4NFBL19G2ZyJJaHk=; b=gojuiluKuAJxwCejmuHZPdRvRm7Zyl7Qr8iMYePXD3DXFtBip/+O2HQf wckOhHoSTrSap7uqfD5N1hlOal7t7r+W5Aa0DBemEjrYI2I0wLsz+RKGO TQvTFASaqTe7kQ45cixQPdfhBHuAcfwtlZ+HFjWbhlaMQvfmo5oxSUesm 68CDEECvCrO0JlcybnX/urDnhLbUl+1iDBHoO3+0Dj2j8RHzQ2Uqh/KSb i3eCyUk4y/NRTScnZjVW34s8JLELuf+K3VZdLDiNYenfv5jY4mrk0YgQF /0M+cOSvomlWGrUdC3vY+ZJoX8a5rhZ4OJxy/3HgtasLp7wlwKRpnNMjU g==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932055" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932055" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:06 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367592" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367592" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:04 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 2/6] serial: 8250: Name MSR literals Date: Thu, 24 Nov 2022 14:59:44 +0200 Message-Id: <20221124125948.23432-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750382531627325796?= X-GMAIL-MSGID: =?utf-8?q?1750382531627325796?= 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 Thu Nov 24 12:59:45 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: 25522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3380587wrr; Thu, 24 Nov 2022 05:00:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf6C+2ZSUvL6RKBpUIdCs1VQN8mcuCsLOED3MiX3qz3GldwLX4HCBE4P+eb0Sn4FG1Yol0df X-Received: by 2002:aa7:8487:0:b0:56c:3bb4:28a8 with SMTP id u7-20020aa78487000000b0056c3bb428a8mr13827871pfn.83.1669294853509; Thu, 24 Nov 2022 05:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294853; cv=none; d=google.com; s=arc-20160816; b=i6mzGrcQ9nXNniqk5YznFG0L96A8NNEb4vyf/8Ou1C5/j87U9R++IRENrJ5IfqM8rx gb4mJwpkb1YS1WnCbynYtxpeVVOPfkPdU8yVb2hkqX0/6//u675ryXc2NEPbBntvXoVm NYJuYH91p3MUOd7XcNU/+Y4TFokYKI3RNaQ/K+JAsN4AaK6Y1NpCjGGTnUJWirLzThW9 qWfNbVE3ldY2LEQHECOC8os+17AryZWgVeK355fUzzzOgBc0xwSDzoyDbeR5Sffu8rQh 3aFqoziVeFtxKWgEniJMH8UyJAABd+antG2uF9312jmCOBGT4Z8kOYA7kpEVpv7brcXx Lruw== 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=Qg5uQGJt1TpRuyBZUQWeTQb/3f8b003Us5k+fiRpahTHW3wSYVqWNkeFDEgVYhx3lp bEIGFXdBxfSlGDN+P/I6G/X2VQrkhzHzixapXPKy0N9gCRn5vpUZKTvdi3jIHZqr+k70 3uDQN15byouqyEw7Gej8rKV+W7g8BnByPv5M8tOnOoxNq6W5JTpGGvo8ZbkZU+3L/Ja+ 2YsRA6HjDadoWO/MS0aYZ1ad4XITU9D47oR8R+lFyPzSn10szhtF/MAHBK0N7qN4D13Z 8A8es+AH8lyYGOqiQHFVBx+/amVn3uMZwjlZd4NJxAEnqsb4GnmxrVQ4mFEQRqjdS95i t14g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i01mvkmh; 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 v11-20020a17090a458b00b00212cae10683si4010056pjg.69.2022.11.24.05.00.40; Thu, 24 Nov 2022 05:00: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=i01mvkmh; 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 S229981AbiKXNAX (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbiKXNAR (ORCPT ); Thu, 24 Nov 2022 08:00:17 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983499E966; Thu, 24 Nov 2022 05:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294809; x=1700830809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0HfKkgykKh/w7L9JZtBdMwCI7ryGACxBBLi2kGimSAk=; b=i01mvkmhRq0kSMs62yczCpLBXefEhY4MD446cCJv/mlOELiyNHVCNvej 8Z3lvoNI0FP2f4UuL0tFb2B3lR87ASxe2sHTr8JB9ztYhV93F2+4cHXOi UVq25ydeL8yNRW4K7zrT0oSDUVihEvXQEq9Bv2pRqyTbE7j0l+USTs+2I Vm59LqGDeMJqqb1kYSpWa88OfDTj0aDTKTqMYZvJTSIEbe+kVSmmqnF5c nVPFWZBEj4GKNqIalwFCd9KE/KZ+pXFTt/eiV/h4wCIWAPw19HdhekxN5 T4Nj5nLegNs5zJhPak4WCczneDkvZUe3gnS1sLoKHXhll+lGJcnAIqTq6 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932073" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932073" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:09 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367616" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367616" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:07 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 3/6] serial: 8250: Cleanup MCR literals Date: Thu, 24 Nov 2022 14:59:45 +0200 Message-Id: <20221124125948.23432-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750382520077450543?= X-GMAIL-MSGID: =?utf-8?q?1750382520077450543?= 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 Thu Nov 24 12:59:46 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: 25524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3381096wrr; Thu, 24 Nov 2022 05:01:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zb2U294s18VKOUNwFlEQuucpgi6EGpiGPAufC3u+Q3QI9/1fwSh5ZJR3JLXzdxiOfPcTA X-Received: by 2002:aa7:9ed0:0:b0:571:8549:89c3 with SMTP id r16-20020aa79ed0000000b00571854989c3mr13603567pfq.26.1669294893288; Thu, 24 Nov 2022 05:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294893; cv=none; d=google.com; s=arc-20160816; b=UTBNBfkXGPwAomsuD6EFbqNJQHRNdFnNU7ZmzkSSO432oZCBFnuvvOlpQrWq7XC5vN AeVOKcpg6eG98FrTJlCJ0VOj/nmFuNLcs9uH2RK0FpkJUORu90qWMt7xksIxyeuwzMS2 BdSa6HSCauZosmmJeozH/yZIu7OciG14+PmsxxCQgJaLOHNN8NZl4Chl3HLdeUo72SFy sw1ai4RijjFzBZByab++jPXnJPHXpOXRLW95ef0mEOv3zTnDC+/2t9CbTDqcvluCAMqb l6WQRZ4o+xRmmj1eG5gpNY0dDs0hb1ECPgNjO+b0c1HdI19E2vA+sZueBw+V/rhvmaWa CzZg== 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=jxzcTiTurXhNEoVFOHlgP4qatTGLxYWBgx6Mfdo0Onw=; b=wc/Obkh/dbURg2NaRwf8hPGZaN02OGvB+Js3bXsNao3YA8qGUFUER1nanIYhIxIY3b JzfSGizsztBoA6+ecix8iFIZBG0gLlwR/80t5m9I3iuppd1w1LzuR5QqchcJbl9zB8gK Fp2X9mKo+UjblNizqwD8ZruQ6Fj2G0J0gjPH30feWB9duvtJd1opyT4ieDJ4BmIShSYQ 5JEJriFSVYQMIoERd418TpYE5wb3hdJdDKlniylrLUzLlaI896ljtaumG+Ruo8yxgbW+ mCc5jRiD6MvvDJlZrVlgQkgdMWRdYIRti4sbaAlP9vDf1YJcnXhmpw/8jrAq8trZ3RB0 J/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mtr+cXMq; 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 k6-20020a17090a39c600b0021812e71e68si1196070pjf.84.2022.11.24.05.01.18; Thu, 24 Nov 2022 05:01:33 -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=Mtr+cXMq; 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 S230015AbiKXNAZ (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiKXNAU (ORCPT ); Thu, 24 Nov 2022 08:00:20 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F5C0A467D; Thu, 24 Nov 2022 05:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294812; x=1700830812; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ahe4RtT6QiA9G79DW5IcLGvzzQC2AlbVwYDb40hS8ks=; b=Mtr+cXMqTWvV9Z1cDW3fTyCC31qs6d1dh7xsn5sFH7SPqIGwF1S6Uzmo dNerxukGUFTDWT/byQVN+dmY3YXy17ezkdalZXaOPWVeJCMW5SoRf6DdH MDAdZC3FlliYmEKAFTJN5f001mJzz4LWYoUv3iPa7qfc3dcNgUCfpEycb dtkuaV7Vi/U4wwyrz+hKp6gPMnzDAkqLOxnJYm9ln8mc8MIZksC85vO+z KSXJJdZ9v4rEjU56737XeeD01fvz0ZtGuq2cl87/sLujYkBBSagixlM7+ 0nVv7AoTEltdVUWHVeF9S4ICehU6pfLEBU1koQn090vFs2PAQC9fZTK45 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932085" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932085" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:12 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367672" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367672" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:10 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 4/6] serial: 8250: Add IIR FIFOs enabled field properly Date: Thu, 24 Nov 2022 14:59:46 +0200 Message-Id: <20221124125948.23432-5-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750382561948838774?= X-GMAIL-MSGID: =?utf-8?q?1750382561948838774?= 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..6d343b15bc58 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_EAABLED_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..a63c124b7fdc 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_EAABLED_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 Thu Nov 24 12:59:47 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: 25527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3393734wrr; Thu, 24 Nov 2022 05:22:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf47AKWooK0oZxx0uulYv3kwQz/PoomYS487wQg2XQkO8852Cx3NibBvX955238LUb/rzZu+ X-Received: by 2002:a17:902:e849:b0:186:dd96:ce45 with SMTP id t9-20020a170902e84900b00186dd96ce45mr13670786plg.73.1669296139023; Thu, 24 Nov 2022 05:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669296139; cv=none; d=google.com; s=arc-20160816; b=H8R/19hQjYsedcSSFANmEvGMSD6oBS/0m/eD5JyPjlh2YC/Tm9ZBZAvvjuOO7jvvuc sZu5aj1ytXGIEgbClOYz0mkETSVKrtT35Fx7Fw8YsimhIPXfuqmpBmc064RsjC6uiH4+ zb6XiBWvmBPXcDGDuBWgxPmDsWnIiR9ZOGO0X7hq/F7WvgRDlQ6T3pPYJTiiTTBoPO3W mitstL3IDA2Q4vLz4LBKMnUgFIKdz7P/09lj1x0aRJkM82T1DH3iW+T+SMIoAETzaOif lXi5LwQaUxFU8rMbZr2IT5H/i4l3Y1y3/5dmcCj+AmG/FLslOVnewaqsNf8wCcGgoe4E oOSw== 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=Wqep1q07dmGJJ8JJFL2GnokS7TGL/P7HjZgeNidP0rg=; b=atMSWkw7RR8z1X4jRdtGh682VGqordGG2CDfF3MgoNVfWfjFWsRn9G/RXxKKEwfnWV Vgje3gadx1B5hVpRMpxj+bPP8ECJwDU4dJsx+tVrf93RsPdB8txbr/ySK7IAbTMDXj2v ZWLOp0rAziqjFtc9pDe4Ywc6AKUHOKN33UJsNnopOerrwVMO7rxvudWuo78eD3mVnjEz ZMdhjDoT35KcVHSdBlwaH0zOgez6LCbT+1q1fPhV9C7L3TIwU25rbl1c/ZxCVYfylgXb 4aQb7ox3LuoEZyYnUNPvnCHjlsypL8YFggZKHLYK5RHL2sQFN1RGDska1z1rLPjixDyW qIow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e5W07xu9; 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 i5-20020a63e445000000b0046fc9e82c99si1241359pgk.206.2022.11.24.05.22.06; Thu, 24 Nov 2022 05:22: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=e5W07xu9; 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 S230099AbiKXNAf (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiKXNAV (ORCPT ); Thu, 24 Nov 2022 08:00:21 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25844B4815; Thu, 24 Nov 2022 05:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294815; x=1700830815; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VutGYxx4X5h3Re6dYoyp+VWTCDAcQnLjx3PAe8fAJyU=; b=e5W07xu9djo0dlXVSZ+OU4YId69ILWV0VaQ2uUUsbt7zuL7seue15/Ai rvs9TLp1wDgGqfvOQS15QRU8xGH1jW+54lwcIgJZw4w520nXtI0EBF08h 3yioaZ2L6QgCz2WIqjmkiFvEbvDada610JIcDXQ7mpQvy529O9loc7cyo t2cIhsx00zIVcbMjg0UDHkbRCGq7edhzyVx2xLUxnJtZTtzI3A7Mml500 At+ITSuvH/tnUwL4wEFOrHSxy+ffj5BQRW5HmJhfV4o9cMHjHF+fPY5OT tBSqBfu+N2zUX+J1Hdl26vtDksnOx/kOgjXUEJ3Rg8BDNBSCTcPfR2HEP Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932102" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932102" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:15 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367695" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367695" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:13 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 5/6] serial: 8250: Define IIR 64 byte bit & cleanup related code Date: Thu, 24 Nov 2022 14:59:47 +0200 Message-Id: <20221124125948.23432-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750383868125083991?= X-GMAIL-MSGID: =?utf-8?q?1750383868125083991?= 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 6d343b15bc58..764043931a99 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 a63c124b7fdc..21ae5b930c7b 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_EAABLED_16550 0x80 /* 16550: (broken/unusable) FIFO */ From patchwork Thu Nov 24 12:59:48 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: 25526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3391463wrr; Thu, 24 Nov 2022 05:17:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4F4yUAos20Ab/3xv7iBpwo2Pk0mAmXine4434WwtzQf3NBTfrqggWXxeMQfZSoDQ5XGdIf X-Received: by 2002:a17:906:19d2:b0:78e:11ea:8528 with SMTP id h18-20020a17090619d200b0078e11ea8528mr14418432ejd.190.1669295872348; Thu, 24 Nov 2022 05:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669295872; cv=none; d=google.com; s=arc-20160816; b=FxUsF8XbRRVyyFSxpizgNcpr7HohDBQsEXXrd2c7J2SJru17NfgrcKnTPpD/x0I4mS ZdIMObGJIiBCFukfRsxiri2vhFXP/GJLHWaF165tvDaHwgDSEqACn90N7JvXS4Qb2RyE vjs7EMqBZJI8fb+15H5Wtn5wdjLRMLchP8V1NmlZgFgNhxPVDp6etbHFS/ShwZGpmTF9 UQ9BORpNMjJOcpn1DkaE1A0Hs7rcNsf/2b5zU9AZpA5UkfanE0Ua5+Vopw8SA93jg2G4 KOjUqai8AsDqGnwaLwgxJ+Z/uFu9RhBY4bykdyzO6Y1ymLLZIW+hyQH8i1OnMBCLAYHS AgUQ== 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=ZFLVVfaNKOojVSNBN5Eet+tq6xJLKVp67Q9VQEfCB3HT/3pF4J5wQ+bdGDu2lmcZLn ytSsmJmJq1Uk7Y7jjt0L7tort4+YhRmnBeA3X52fsn2xGdQBI3GtMChTL9C9X7RaqDsV xyr/5EaHvsi4tFcMzrG8MKHWL32bYUJ/2F2JTZ+MPaIRaaql10AHgW4rX5t52CYSaslQ a/BWDQilzqCtdbc1UvvMu9QKfnIwuwHVLqy7FjM156CfSubxQ67V7WVp+SJrCk/Z91gH yAs5BTnK18qnCF01HrdYYYJjwbBA0lUnbA6TYBjWf8J0fPqpc0w24a2Vvp0U/MsNl7K1 p0Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="L8aF/+Cs"; 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 xf4-20020a17090731c400b0078b96722000si850859ejb.608.2022.11.24.05.17.25; Thu, 24 Nov 2022 05:17:52 -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="L8aF/+Cs"; 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 S230107AbiKXNAh (ORCPT + 99 others); Thu, 24 Nov 2022 08:00:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiKXNAV (ORCPT ); Thu, 24 Nov 2022 08:00:21 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE35DBE852; Thu, 24 Nov 2022 05:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669294817; x=1700830817; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3xoDJ24ls7xPY5orIQfBql47gNQpE19TZHADmQ5loEY=; b=L8aF/+CskeiJXn+vtG4SarKq/GIC0uST8E8YhW8Dm4OMvrH/1tWMt8d7 yhGg1npnt+Mk6DOUVaKHeFM0A0sL25D7hZCFwGXqM497dLkFU72WIw2Uj KOUcqMJW4epFbQS0o7sp1MbSbjpdofImfDtNcuptzEoVFbmc75130Xa+N zMF6lk2Pjmi7cw7LHp3FR1vFUy9/VwO9n0KjwfK+Ou4FBxHe4PUw/mTMz LtCOt2ZOl4dmOXZj7Se4EPgmBD+Jh6wFqKif44+YMCWzh7xo3Slew1W0g Z1mH9sS0LSCG7iifEab+kPpYIImuI3+Kr83hVfcgfaKaMx96zDQANJbav Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="311932121" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="311932121" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="887367724" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="887367724" Received: from msharawy-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 05:00:16 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 6/6] serial: 8250_early: Convert literals to use defines Date: Thu, 24 Nov 2022 14:59:48 +0200 Message-Id: <20221124125948.23432-7-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> References: <20221124125948.23432-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1750383588298937176?= X-GMAIL-MSGID: =?utf-8?q?1750383588298937176?= 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);