From nobody Sun Feb 8 14:59:38 2026 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 78E33C77B7E for ; Thu, 25 May 2023 04:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238026AbjEYEFS (ORCPT ); Thu, 25 May 2023 00:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238290AbjEYEEK (ORCPT ); Thu, 25 May 2023 00:04:10 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67284199; Wed, 24 May 2023 21:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=K0/NQ2Lp/XTRzOV/EA3J1QX3fKqgngHY8xvfRZV0kl8=; b=L68A5MLlbCdpbeqaNHFpnMPoDK fHeRVPVMXs1Ev8WPx9B/q+0+AJNn3lZfh4mixOTjPdApH4EWuhEV/Ck1TgsErwwqyY4CPZ1lkX9Zh YSLp7Lb8nLHmpNnsGzigvxGQQEWdZilaixEOaPOmE/d4SXsPPpNJ7l9TvgLUBsVH5Z2g=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22Cn-0001dB-Aq; Thu, 25 May 2023 00:04:01 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:14 -0400 Message-Id: <20230525040324.3773741-2-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 01/11] serial: sc16is7xx: fix syntax error in comments X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve cotroller -> controller Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index abad091baeea..5bd98e4316f5 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1501,7 +1501,7 @@ static int sc16is7xx_probe(struct device *dev, =20 #ifdef CONFIG_GPIOLIB if (devtype->nr_gpio) { - /* Setup GPIO cotroller */ + /* Setup GPIO controller */ s->gpio.owner =3D THIS_MODULE; s->gpio.parent =3D dev; s->gpio.label =3D dev_name(dev); --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 3EB91C77B7A for ; Thu, 25 May 2023 04:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238589AbjEYEFn (ORCPT ); Thu, 25 May 2023 00:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236779AbjEYEEX (ORCPT ); Thu, 25 May 2023 00:04:23 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880D4194; Wed, 24 May 2023 21:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oMgj+tKoLcLXXYaEiSRJStVpk7eDMdwwfoe9DPEgx18=; b=X9qxZM6/mjAYrAUtIhVpFVUZtU ZP2C8+4WM6+f+SMqUNUkynegFudfpBSVMpV2rSaGSQPd/cn2fRJsOh16cnqjZxhAOGv2Ie1NniUyQ XZc5Q7YilD+PkyFbsk15qoZdNcCV+44MRHZb02N9995ydMOuyMu1KOz+yOCArb+koSXk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22Cx-0001dB-0S; Thu, 25 May 2023 00:04:11 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:15 -0400 Message-Id: <20230525040324.3773741-3-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 02/11] serial: sc16is7xx: improve comments about variants X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Replace 740/750/760 with generic terms like 74x/75x/76x to account for variants like 741, 752 and 762. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 5bd98e4316f5..00054bb49780 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -223,7 +223,7 @@ * trigger levels. Trigger levels from 4 characters to 60 characters are * available with a granularity of four. * - * When the trigger level setting in TLR is zero, the SC16IS740/750/760 us= es the + * When the trigger level setting in TLR is zero, the SC16IS74x/75x/76x us= es the * trigger level setting defined in FCR. If TLR has non-zero trigger level= value * the trigger level defined in FCR is discarded. This applies to both tra= nsmit * FIFO and receive FIFO trigger level setting. @@ -234,7 +234,7 @@ #define SC16IS7XX_TLR_TX_TRIGGER(words) ((((words) / 4) & 0x0f) << 0) #define SC16IS7XX_TLR_RX_TRIGGER(words) ((((words) / 4) & 0x0f) << 4) =20 -/* IOControl register bits (Only 750/760) */ +/* IOControl register bits (Only 75x/76x) */ #define SC16IS7XX_IOCONTROL_LATCH_BIT (1 << 0) /* Enable input latching */ #define SC16IS7XX_IOCONTROL_MODEM_BIT (1 << 1) /* Enable GPIO[7:4] as mode= m pins */ #define SC16IS7XX_IOCONTROL_SRESET_BIT (1 << 3) /* Software Reset */ @@ -248,9 +248,9 @@ #define SC16IS7XX_EFCR_RTS_INVERT_BIT (1 << 5) /* RTS output inversion */ #define SC16IS7XX_EFCR_IRDA_MODE_BIT (1 << 7) /* IrDA mode * 0 =3D rate upto 115.2 kbit/s - * - Only 750/760 + * - Only 75x/76x * 1 =3D rate upto 1.152 Mbit/s - * - Only 760 + * - Only 76x */ =20 /* EFR register bits */ --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 372C4C77B7E for ; Thu, 25 May 2023 04:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238672AbjEYEGC (ORCPT ); Thu, 25 May 2023 00:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbjEYEE1 (ORCPT ); Thu, 25 May 2023 00:04:27 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72BDDE5E; Wed, 24 May 2023 21:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8LddvSprDhEznGBMdyZoKgXbNv0SgICpMxxb43tkSPM=; b=m7PMsANWAUO9nbSCBaPZIxCehR cyTf07pJUC/PadELpwlnrFtfqKqTRII8+0k8bNnRjMr2CESvUrcixCZ1BN9Nvm9GTKyhwWcElVms1 nMLY7i9Ig+8lcQ5WJrbXkjFY7+wrtmeUB1mEImePpj0UXGh3NtC7zm7UApNObO0JS5ks=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22D0-0001dB-74; Thu, 25 May 2023 00:04:14 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:16 -0400 Message-Id: <20230525040324.3773741-4-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 03/11] serial: sc16is7xx: mark IOCONTROL register as volatile X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Bit SRESET (3) is cleared when a reset operation is completed. Having the IOCONTROL register as non-volatile will always read SRESET as 1. Therefore mark IOCONTROL register as a volatile register. Fixes: dfeae619d781 ("serial: sc16is7xx") Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 00054bb49780..a7c4da3cfd2b 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -488,6 +488,7 @@ static bool sc16is7xx_regmap_volatile(struct device *de= v, unsigned int reg) case SC16IS7XX_TXLVL_REG: case SC16IS7XX_RXLVL_REG: case SC16IS7XX_IOSTATE_REG: + case SC16IS7XX_IOCONTROL_REG: return true; default: break; --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 26029C77B7E for ; Thu, 25 May 2023 04:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238691AbjEYEGL (ORCPT ); Thu, 25 May 2023 00:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237734AbjEYEE3 (ORCPT ); Thu, 25 May 2023 00:04:29 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FAA91A6; Wed, 24 May 2023 21:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JzQwwWHfLn5GqJ+sUpssIPjhRdBj01gT2s8uoqlHWI4=; b=YJgReEa/vE2riAdBxkk5ViBMZs F8EVEKjd/h5NYSZ8FL+TWOdz/aaDrUNBHbuZ4qbjQ9HOx52QgkIeruEDteW69XE7Ji+nHcNL6TAJN RN2DHwkXn3+zgfWCLpQCBsLfxl+VX1cQLNtCDtL9DFAHcva5Vpdc6vAu9vRNQgtoXhWE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22D2-0001dB-Ii; Thu, 25 May 2023 00:04:17 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:17 -0400 Message-Id: <20230525040324.3773741-5-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 04/11] serial: sc16is7xx: add post reset delay X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Make sure we wait at least 3us before initiating communication with the device after reset. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index a7c4da3cfd2b..af7e66db54b4 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1428,6 +1428,12 @@ static int sc16is7xx_probe(struct device *dev, regmap_write(s->regmap, SC16IS7XX_IOCONTROL_REG << SC16IS7XX_REG_SHIFT, SC16IS7XX_IOCONTROL_SRESET_BIT); =20 + /* + * After reset, the host must wait at least 3us before initializing a + * communication with the device. + */ + usleep_range(3, 5); + for (i =3D 0; i < devtype->nr_uart; ++i) { s->p[i].line =3D i; /* Initialize port data */ --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 72926C7EE43 for ; Thu, 25 May 2023 04:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238796AbjEYEGX (ORCPT ); Thu, 25 May 2023 00:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238405AbjEYEEg (ORCPT ); Thu, 25 May 2023 00:04:36 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FCB8189; Wed, 24 May 2023 21:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4SFt1oa/H6OPqzJ3VF1wAZJc4jROpd4jbbyOx0NJPsU=; b=L46caBB85Fgkyuiy0LBjfk5OgM 5bgAmFCFhK7Ls5zDU10Iz0J6kzotyu61oy0ueYTsID13mgBwatF+TTVAwpws8dX5IZMXyD0s5cGBr ZFZDYwFmAVhCUR4YmWJGpvB2YoCqSO/CsLjGMW67pQzxGdQWftcTJYXUjCxCnm8IaaVI=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DB-0001dB-VP; Thu, 25 May 2023 00:04:26 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:19 -0400 Message-Id: <20230525040324.3773741-6-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 05/11] serial: sc16is7xx: fix broken port 0 uart init X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve While experimenting with rs485 configuration on a SC16IS752 dual UART, I found that the sc16is7xx_config_rs485() function was called only for the second port (index 1, channel B), causing initialization problems for the first port. For the sc16is7xx driver, port->membase and port->mapbase are not set, and their default values are 0. And we set port->iobase to the device index. This means that when the first device is registered using the uart_add_one_port() function, the following values will be in the port structure: port->membase =3D 0 port->mapbase =3D 0 port->iobase =3D 0 Therefore, the function uart_configure_port() in serial_core.c will exit early because of the following check: /* * If there isn't a port here, don't do anything further. */ if (!port->iobase && !port->mapbase && !port->membase) return; Typically, I2C and SPI drivers do not set port->membase and port->mapbase. But I found that the max310x driver sets port->membase to ~0 (all ones). By implementing the same change in our driver, uart_configure_port() is now correctly executed. Fixes: dfeae619d781 ("serial: sc16is7xx") Signed-off-by: Hugo Villeneuve Reviewed-by: Ilpo J=C3=A4rvinen --- I am not sure if this change is the best long-term solution to this problem, and maybe uart_configure_port() itself could be modified to take into account the fact that some devices have all three *base values set to zero? Also, many drivers use port->iobase as an index, is it the correct way to use it? For example, for our driver, there was commit 5da6b1c079e6 ("sc16is7xx: Set iobase to device index") with the following explanation: "Set the .iobase value to the relative index within the device to allow infering the order through sysfs." drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index af7e66db54b4..8a2fc6f89d36 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1443,6 +1443,7 @@ static int sc16is7xx_probe(struct device *dev, s->p[i].port.fifosize =3D SC16IS7XX_FIFO_SIZE; s->p[i].port.flags =3D UPF_FIXED_TYPE | UPF_LOW_LATENCY; s->p[i].port.iobase =3D i; + s->p[i].port.membase =3D (void __iomem *)~0; s->p[i].port.iotype =3D UPIO_PORT; s->p[i].port.uartclk =3D freq; s->p[i].port.rs485_config =3D sc16is7xx_config_rs485; --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 C717AC77B7E for ; Thu, 25 May 2023 04:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238821AbjEYEG1 (ORCPT ); Thu, 25 May 2023 00:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238125AbjEYEEh (ORCPT ); Thu, 25 May 2023 00:04:37 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB31A1B5; Wed, 24 May 2023 21:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oAW87YGFqDuCb1wMiNK8HhUC7h6jxZ7gmJadiuchbuo=; b=vzd6l2eDsrKJ2VXxs4taDBf9O4 Oc6N48Z1YTxaN2yl0G5InFPkYbU2KEuvAVEzFu++jEqX4jQkU+JNyeovO+Xs2OtA/uUn5I86gLMo9 2FguvfKwHawczsuTTkU5ddA7MzzVFzcfhbVrBWCIk9P430oYf6ei8yAT39I0RbcllF5I=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DE-0001dB-DC; Thu, 25 May 2023 00:04:28 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:20 -0400 Message-Id: <20230525040324.3773741-7-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 06/11] serial: sc16is7xx: fix bug when first setting GPIO direction X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve When we want to configure a pin as an output pin with a value of logic 0, we end up as having a value of logic 1 on the output pin. Setting a logic 0 a second time (or more) after that will correctly output a logic 0 on the output pin. By default, all GPIO pins are configured as inputs. When we enter c16is7xx_gpio_direction_output() for the first time, we first set the desired value in IOSTATE, and then we configure the pin as an output. The datasheet states that writing to IOSTATE register will trigger a transfer of the value to the I/O pin configured as output, so if the pin is configured as an input, nothing will be transferred. Therefore, set the direction first in IODIR, and then set the desired value in IOSTATE. This is what is done in NXP application note AN10587. Fixes: dfeae619d781 ("serial: sc16is7xx") Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 8a2fc6f89d36..a5d8af0f6da0 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1343,9 +1343,18 @@ static int sc16is7xx_gpio_direction_output(struct gp= io_chip *chip, state |=3D BIT(offset); else state &=3D ~BIT(offset); - sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state); + + /* + * If we write IOSTATE first, and then IODIR, the output value is not + * transferred to the corresponding I/O pin. + * The datasheet states that each register bit will be transferred to + * the corresponding I/O pin programmed as output when writing to + * IOSTATE. Therefore, configure direction first with IODIR, and then + * set value after with IOSTATE. + */ sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), BIT(offset)); + sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state); =20 return 0; } --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 10ECFC77B7A for ; Thu, 25 May 2023 04:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238850AbjEYEGc (ORCPT ); Thu, 25 May 2023 00:06:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238128AbjEYEEj (ORCPT ); Thu, 25 May 2023 00:04:39 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED1A1B9; Wed, 24 May 2023 21:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Rs2Mhd71JAcJq49FRqjICikz5CHJ00MgArsR2uJfUx4=; b=XelzIbRF3Xmw1UUzlUYpi6J0Wk Y4kLx4z02h5HTl6DMkCfMOLHLRJ/ciXr41mlcREvmetoDpvUGCaecOIjuw/JGvz+utekjakOXvs5F PY77DSZ39oA6Ypunb90jK64JjWarUgiLHntmizzRIpUS3TV9pfhZ2a2D0SGYDym1MltY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DF-0001dB-OC; Thu, 25 May 2023 00:04:30 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:21 -0400 Message-Id: <20230525040324.3773741-8-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 07/11] dt-bindings: sc16is7xx: Add property to change GPIO function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Some variants in this series of uart controllers have GPIO pins that are shared between GPIO and modem control lines. The pin mux mode (GPIO or modem control lines) can be set for each ports (channels) supported by the variant. This adds a property to the device tree to set the GPIO pin mux to modem control lines on selected ports if needed. Signed-off-by: Hugo Villeneuve --- .../bindings/serial/nxp,sc16is7xx.txt | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt b/D= ocumentation/devicetree/bindings/serial/nxp,sc16is7xx.txt index 0fa8e3e43bf8..74dfbbf7b2cb 100644 --- a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +++ b/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt @@ -23,6 +23,9 @@ Optional properties: 1 =3D active low. - irda-mode-ports: An array that lists the indices of the port that should operate in IrDA mode. +- nxp,modem-control-line-ports: An array that lists the indices of the por= t that + should have shared GPIO lines configured as + modem control lines. =20 Example: sc16is750: sc16is750@51 { @@ -35,6 +38,26 @@ Example: #gpio-cells =3D <2>; }; =20 + sc16is752: sc16is752@54 { + compatible =3D "nxp,sc16is752"; + reg =3D <0x54>; + clocks =3D <&clk20m>; + interrupt-parent =3D <&gpio3>; + interrupts =3D <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports =3D <1>; /* Port 1 as modem control lines */ + gpio-controller; /* Port 0 as GPIOs */ + #gpio-cells =3D <2>; + }; + + sc16is752: sc16is752@54 { + compatible =3D "nxp,sc16is752"; + reg =3D <0x54>; + clocks =3D <&clk20m>; + interrupt-parent =3D <&gpio3>; + interrupts =3D <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports =3D <0 1>; /* Ports 0 and 1 as modem contro= l lines */ + }; + * spi as bus =20 Required properties: @@ -59,6 +82,9 @@ Optional properties: 1 =3D active low. - irda-mode-ports: An array that lists the indices of the port that should operate in IrDA mode. +- nxp,modem-control-line-ports: An array that lists the indices of the por= t that + should have shared GPIO lines configured as + modem control lines. =20 Example: sc16is750: sc16is750@0 { @@ -70,3 +96,23 @@ Example: gpio-controller; #gpio-cells =3D <2>; }; + + sc16is752: sc16is752@0 { + compatible =3D "nxp,sc16is752"; + reg =3D <0>; + clocks =3D <&clk20m>; + interrupt-parent =3D <&gpio3>; + interrupts =3D <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports =3D <1>; /* Port 1 as modem control lines */ + gpio-controller; /* Port 0 as GPIOs */ + #gpio-cells =3D <2>; + }; + + sc16is752: sc16is752@0 { + compatible =3D "nxp,sc16is752"; + reg =3D <0>; + clocks =3D <&clk20m>; + interrupt-parent =3D <&gpio3>; + interrupts =3D <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports =3D <0 1>; /* Ports 0 and 1 as modem contro= l lines */ + }; --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 DDC20C7EE2D for ; Thu, 25 May 2023 04:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238873AbjEYEGg (ORCPT ); Thu, 25 May 2023 00:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238427AbjEYEEl (ORCPT ); Thu, 25 May 2023 00:04:41 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFDE51BD; Wed, 24 May 2023 21:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JiheQ8Q8tkLBdJvTWHP7zHAZ71XGjHsp7B6ulAHNFcA=; b=U4DBiBAJsgcGOFh9IbpqBjXOUv UnAAVx9ROJmWFNzrvAmmE/W9hORoX+16rWwrjZ/iZBAz7BeiY0X4YBdISLjpm6AbfzSXgzd0ysQFX 9bsS9sigwl4GbOEGFBIbOt0l7HfHbCelI791/m+N14c3JNM0VNGDBsvJEcugZ8N0XuAc=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DH-0001dB-9Z; Thu, 25 May 2023 00:04:32 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:22 -0400 Message-Id: <20230525040324.3773741-9-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 08/11] serial: sc16is7xx: fix regression with GPIO configuration X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Commit 679875d1d880 ("sc16is7xx: Separate GPIOs from modem control lines") and commit 21144bab4f11 ("sc16is7xx: Handle modem status lines") changed the function of the GPIOs pins to act as modem control lines without any possibility of selecting GPIO function. As a consequence, applications that depends on GPIO lines configured by default as GPIO pins no longer work as expected. Also, the change to select modem control lines function was done only for channel A of dual UART variants (752/762). This was not documented in the log message. This new patch allows to specify GPIO or modem control line function in the device tree, and for each of the ports (A or B). This is done by using the new device-tree property named "modem-control-line-ports" (property added in separate patch). We also now reduce the number of exported GPIOs according to the modem-status-line-port DT property. Boards that need to have GPIOS configured as modem control lines should add that property to their device tree. Here is a list of boards using the sc16is7xx driver in their device tree and that may need to be modified: arm64/boot/dts/freescale/fsl-ls1012a-frdm.dts mips/boot/dts/ingenic/cu1830-neo.dts mips/boot/dts/ingenic/cu1000-neo.dts Fixes: 679875d1d880 ("sc16is7xx: Separate GPIOs from modem control lines") Fixes: 21144bab4f11 ("sc16is7xx: Handle modem status lines") Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 65 +++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index a5d8af0f6da0..97ec532a0a19 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -236,7 +236,8 @@ =20 /* IOControl register bits (Only 75x/76x) */ #define SC16IS7XX_IOCONTROL_LATCH_BIT (1 << 0) /* Enable input latching */ -#define SC16IS7XX_IOCONTROL_MODEM_BIT (1 << 1) /* Enable GPIO[7:4] as mode= m pins */ +#define SC16IS7XX_IOCONTROL_MODEM_A_BIT (1 << 1) /* Enable GPIO[7:4] as mo= dem A pins */ +#define SC16IS7XX_IOCONTROL_MODEM_B_BIT (1 << 2) /* Enable GPIO[3:0] as mo= dem B pins */ #define SC16IS7XX_IOCONTROL_SRESET_BIT (1 << 3) /* Software Reset */ =20 /* EFCR register bits */ @@ -301,12 +302,12 @@ /* Misc definitions */ #define SC16IS7XX_FIFO_SIZE (64) #define SC16IS7XX_REG_SHIFT 2 +#define SC16IS7XX_GPIOS_PER_BANK 4 =20 struct sc16is7xx_devtype { char name[10]; int nr_gpio; int nr_uart; - int has_mctrl; }; =20 #define SC16IS7XX_RECONF_MD (1 << 0) @@ -336,6 +337,7 @@ struct sc16is7xx_port { struct clk *clk; #ifdef CONFIG_GPIOLIB struct gpio_chip gpio; + int gpio_configured; #endif unsigned char buf[SC16IS7XX_FIFO_SIZE]; struct kthread_worker kworker; @@ -447,35 +449,30 @@ static const struct sc16is7xx_devtype sc16is74x_devty= pe =3D { .name =3D "SC16IS74X", .nr_gpio =3D 0, .nr_uart =3D 1, - .has_mctrl =3D 0, }; =20 static const struct sc16is7xx_devtype sc16is750_devtype =3D { .name =3D "SC16IS750", - .nr_gpio =3D 4, + .nr_gpio =3D 8, .nr_uart =3D 1, - .has_mctrl =3D 1, }; =20 static const struct sc16is7xx_devtype sc16is752_devtype =3D { .name =3D "SC16IS752", - .nr_gpio =3D 0, + .nr_gpio =3D 8, .nr_uart =3D 2, - .has_mctrl =3D 1, }; =20 static const struct sc16is7xx_devtype sc16is760_devtype =3D { .name =3D "SC16IS760", - .nr_gpio =3D 4, + .nr_gpio =3D 8, .nr_uart =3D 1, - .has_mctrl =3D 1, }; =20 static const struct sc16is7xx_devtype sc16is762_devtype =3D { .name =3D "SC16IS762", - .nr_gpio =3D 0, + .nr_gpio =3D 8, .nr_uart =3D 2, - .has_mctrl =3D 1, }; =20 static bool sc16is7xx_regmap_volatile(struct device *dev, unsigned int reg) @@ -1396,6 +1393,10 @@ static int sc16is7xx_probe(struct device *dev, return -ENOMEM; } =20 +#ifdef CONFIG_GPIOLIB + s->gpio_configured =3D devtype->nr_gpio; +#endif /* CONFIG_GPIOLIB */ + /* Always ask for fixed clock rate from a property. */ device_property_read_u32(dev, "clock-frequency", &uartclk); =20 @@ -1473,12 +1474,6 @@ static int sc16is7xx_probe(struct device *dev, SC16IS7XX_EFCR_RXDISABLE_BIT | SC16IS7XX_EFCR_TXDISABLE_BIT); =20 - /* Use GPIO lines as modem status registers */ - if (devtype->has_mctrl) - sc16is7xx_port_write(&s->p[i].port, - SC16IS7XX_IOCONTROL_REG, - SC16IS7XX_IOCONTROL_MODEM_BIT); - /* Initialize kthread work structs */ kthread_init_work(&s->p[i].tx_work, sc16is7xx_tx_proc); kthread_init_work(&s->p[i].reg_work, sc16is7xx_reg_proc); @@ -1514,10 +1509,38 @@ static int sc16is7xx_probe(struct device *dev, prop, p, u) if (u < devtype->nr_uart) s->p[u].irda_mode =3D true; + + val =3D 0; + + of_property_for_each_u32(dev->of_node, "nxp,modem-control-line-ports", + prop, p, u) + if (u < devtype->nr_uart) { + /* Use GPIO lines as modem control lines */ + if (u =3D=3D 0) + val |=3D SC16IS7XX_IOCONTROL_MODEM_A_BIT; + else if (u =3D=3D 1) + val |=3D SC16IS7XX_IOCONTROL_MODEM_B_BIT; + +#ifdef CONFIG_GPIOLIB + if (s->gpio_configured >=3D + SC16IS7XX_GPIOS_PER_BANK) + s->gpio_configured -=3D + SC16IS7XX_GPIOS_PER_BANK; +#endif /* CONFIG_GPIOLIB */ + } + + if (val) + regmap_update_bits( + s->regmap, + SC16IS7XX_IOCONTROL_REG << SC16IS7XX_REG_SHIFT, + SC16IS7XX_IOCONTROL_MODEM_A_BIT | + SC16IS7XX_IOCONTROL_MODEM_B_BIT, val); } =20 #ifdef CONFIG_GPIOLIB - if (devtype->nr_gpio) { + dev_dbg(dev, "GPIOs to configure: %d\n", s->gpio_configured); + + if (s->gpio_configured) { /* Setup GPIO controller */ s->gpio.owner =3D THIS_MODULE; s->gpio.parent =3D dev; @@ -1527,7 +1550,7 @@ static int sc16is7xx_probe(struct device *dev, s->gpio.direction_output =3D sc16is7xx_gpio_direction_output; s->gpio.set =3D sc16is7xx_gpio_set; s->gpio.base =3D -1; - s->gpio.ngpio =3D devtype->nr_gpio; + s->gpio.ngpio =3D s->gpio_configured; s->gpio.can_sleep =3D 1; ret =3D gpiochip_add_data(&s->gpio, s); if (ret) @@ -1555,7 +1578,7 @@ static int sc16is7xx_probe(struct device *dev, return 0; =20 #ifdef CONFIG_GPIOLIB - if (devtype->nr_gpio) + if (s->gpio_configured) gpiochip_remove(&s->gpio); =20 out_thread: @@ -1581,7 +1604,7 @@ static void sc16is7xx_remove(struct device *dev) int i; =20 #ifdef CONFIG_GPIOLIB - if (s->devtype->nr_gpio) + if (s->gpio_configured) gpiochip_remove(&s->gpio); #endif =20 --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 096E2C77B7E for ; Thu, 25 May 2023 04:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238917AbjEYEGq (ORCPT ); Thu, 25 May 2023 00:06:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231764AbjEYEEv (ORCPT ); Thu, 25 May 2023 00:04:51 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD57E62; Wed, 24 May 2023 21:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9uFf80nuPq7IpOBCTtsrmsGYtNovsW/4uJuo42PakOo=; b=hZS8RhBGHMEWLID3br+gSAdS39 WNwEED5LXP+qFQrO0SMH4y60c3mBJasKvbCKoLvBfl7dcE1drHXktQSModQe0c9gXeMrMzRV8IVgR XTy5IQ0QncyR5VRTIM4p2KUUwtvNMtP35sRxeB6GinMfzzB5l+wz4CcO7mFLpQV2zIwY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DJ-0001dB-5g; Thu, 25 May 2023 00:04:34 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:23 -0400 Message-Id: <20230525040324.3773741-10-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 09/11] serial: sc16is7xx: add I/O register translation offset X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve If the shared GPIO pins on a dual port/channel variant like the SC16IS752 are configured as GPIOs for port A, and modem control lines on port A, we need to translate the Linux GPIO offset to an offset that is compatible with the I/O registers of the SC16IS7XX (IOState, IODir and IOIntEna). Add a new variable to store that offset and set it when we detect that special case. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 54 +++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 97ec532a0a19..c2cfd057ed9a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -338,6 +338,7 @@ struct sc16is7xx_port { #ifdef CONFIG_GPIOLIB struct gpio_chip gpio; int gpio_configured; + int gpio_offset; #endif unsigned char buf[SC16IS7XX_FIFO_SIZE]; struct kthread_worker kworker; @@ -1298,12 +1299,50 @@ static const struct uart_ops sc16is7xx_ops =3D { }; =20 #ifdef CONFIG_GPIOLIB + +/* + * We may need to translate the Linux GPIO offset to a SC16IS7XX offset. + * This is needed only for the case where a dual port variant is configure= d to + * have only port B as modem status lines. + * + * Example for SC16IS752/762 with upper bank (port A) set as GPIOs, and + * lower bank (port B) set as modem status lines (special case described a= bove): + * + * Pin GPIO pin Linux GPIO SC16IS7XX + * name function offset offset + * -------------------------------------------------- + * GPIO7/RIA GPIO7 3 7 + * GPIO6/CDA GPIO6 2 6 + * GPIO5/DTRA GPIO5 1 5 + * GPIO4/DSRA GPIO4 0 4 + * GPIO3/RIB RIB N/A N/A + * GPIO2/CDB CDB N/A N/A + * GPIO1/DTRB DTRB N/A N/A + * GPIO0/DSRB DSRB N/A N/A + * + * Example for SC16IS750/760 with upper bank (7..4) set as modem status l= ines, + * and lower bank (3..0) as GPIOs: + * + * Pin GPIO pin Linux GPIO SC16IS7XX + * name function offset offset + * -------------------------------------------------- + * GPIO7/RI RI N/A N/A + * GPIO6/CD CD N/A N/A + * GPIO5/DTR DTR N/A N/A + * GPIO4/DSR DSR N/A N/A + * GPIO3 GPIO3 3 3 + * GPIO2 GPIO2 2 2 + * GPIO1 GPIO1 1 1 + * GPIO0 GPIO0 0 0 + */ + static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset) { unsigned int val; struct sc16is7xx_port *s =3D gpiochip_get_data(chip); struct uart_port *port =3D &s->p[0].port; =20 + offset +=3D s->gpio_offset; val =3D sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); =20 return !!(val & BIT(offset)); @@ -1314,6 +1353,7 @@ static void sc16is7xx_gpio_set(struct gpio_chip *chip= , unsigned offset, int val) struct sc16is7xx_port *s =3D gpiochip_get_data(chip); struct uart_port *port =3D &s->p[0].port; =20 + offset +=3D s->gpio_offset; sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), val ? BIT(offset) : 0); } @@ -1324,6 +1364,7 @@ static int sc16is7xx_gpio_direction_input(struct gpio= _chip *chip, struct sc16is7xx_port *s =3D gpiochip_get_data(chip); struct uart_port *port =3D &s->p[0].port; =20 + offset +=3D s->gpio_offset; sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), 0); =20 return 0; @@ -1336,6 +1377,8 @@ static int sc16is7xx_gpio_direction_output(struct gpi= o_chip *chip, struct uart_port *port =3D &s->p[0].port; u8 state =3D sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); =20 + offset +=3D s->gpio_offset; + if (val) state |=3D BIT(offset); else @@ -1395,6 +1438,7 @@ static int sc16is7xx_probe(struct device *dev, =20 #ifdef CONFIG_GPIOLIB s->gpio_configured =3D devtype->nr_gpio; + s->gpio_offset =3D 0; #endif /* CONFIG_GPIOLIB */ =20 /* Always ask for fixed clock rate from a property. */ @@ -1529,16 +1573,24 @@ static int sc16is7xx_probe(struct device *dev, #endif /* CONFIG_GPIOLIB */ } =20 - if (val) + if (val) { +#ifdef CONFIG_GPIOLIB + /* Additional I/O regs offset. */ + if (val =3D=3D SC16IS7XX_IOCONTROL_MODEM_B_BIT) + s->gpio_offset =3D SC16IS7XX_GPIOS_PER_BANK; +#endif /* CONFIG_GPIOLIB */ + regmap_update_bits( s->regmap, SC16IS7XX_IOCONTROL_REG << SC16IS7XX_REG_SHIFT, SC16IS7XX_IOCONTROL_MODEM_A_BIT | SC16IS7XX_IOCONTROL_MODEM_B_BIT, val); + } } =20 #ifdef CONFIG_GPIOLIB dev_dbg(dev, "GPIOs to configure: %d\n", s->gpio_configured); + dev_dbg(dev, "GPIOs offset: %d\n", s->gpio_offset); =20 if (s->gpio_configured) { /* Setup GPIO controller */ --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 79C44C77B7E for ; Thu, 25 May 2023 04:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238887AbjEYEGk (ORCPT ); Thu, 25 May 2023 00:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238186AbjEYEEs (ORCPT ); Thu, 25 May 2023 00:04:48 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748EBE63; Wed, 24 May 2023 21:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LV4yVF96+pGyKU5GDE3DMI+qw5mDcTG0Pniv9EqAjvo=; b=SEIbyzJRydoKZqKwiMA5O/eRUN H4qD8ol7TlPZ4/fMnXeHQR93oOxJmPQxREWZOcYhcEmMttzKrk0pBYeq82G+aeEGg7a81p3F9edRD wU1gU95YztQ4BECjwr4/A3YZkR5pZNs4GKAEod8+2UoH5WPd9hbEuk7AyUms6uwX0qgk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DK-0001dB-Qz; Thu, 25 May 2023 00:04:35 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:24 -0400 Message-Id: <20230525040324.3773741-11-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 10/11] serial: sc16is7xx: add call to get rs485 DT flags and properties X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve Add call to uart_get_rs485_mode() to probe for RS485 flags and properties from device tree. Signed-off-by: Hugo Villeneuve Reviewed-by: Ilpo J=C3=A4rvinen --- drivers/tty/serial/sc16is7xx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index c2cfd057ed9a..03d00b144304 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1511,6 +1511,10 @@ static int sc16is7xx_probe(struct device *dev, goto out_ports; } =20 + ret =3D uart_get_rs485_mode(&s->p[i].port); + if (ret) + goto out_ports; + /* Disable all interrupts */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_IER_REG, 0); /* Disable TX/RX */ --=20 2.30.2 From nobody Sun Feb 8 14:59:38 2026 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 F332FC77B7A for ; Thu, 25 May 2023 04:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238949AbjEYEG4 (ORCPT ); Thu, 25 May 2023 00:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238226AbjEYEE7 (ORCPT ); Thu, 25 May 2023 00:04:59 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE62E65; Wed, 24 May 2023 21:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wtCZaz+ygLc5odu0jyJWVuukps/nAVPXx7PU+/vrFgM=; b=Qbt1LRs+4mv0pRnwxJYbf2ZAB6 2UDi3v8PyYf2TGyY8fXk0bcNmATMeSPqqpDWOeKnKRrd+gunR7FhgZ3OSqpe259puDiO1CUxPvgqJ N6+lJEE6ZXipwALuWFPgoMyCXTVOarP2sSNIay4QSLpWLlQzzciypsfiUEOAl8BOyoUE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52970 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1q22DM-0001dB-39; Thu, 25 May 2023 00:04:36 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jirislaby@kernel.org, jringle@gridpoint.com, tomasz.mon@camlingroup.com, l.perczak@camlintechnologies.com Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, hugo@hugovil.com, linux-gpio@vger.kernel.org, Hugo Villeneuve Date: Thu, 25 May 2023 00:03:25 -0400 Message-Id: <20230525040324.3773741-12-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525040324.3773741-1-hugo@hugovil.com> References: <20230525040324.3773741-1-hugo@hugovil.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH v3 11/11] serial: sc16is7xx: add dump registers function X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugo Villeneuve With this driver, it is very hard to debug the registers using the /sys/kernel/debug/regmap interface. The main reason is that bits 0 and 1 of the register address correspond to the channels bits, so the register address itself starts at bit 2, so we must 'mentally' shift each register address by 2 bits to get its offset. Also, only channels 0 and 1 are supported, so combinations of bits 0 and 1 being 10b and 11b are invalid, and the display of these registers is useless. For example: cat /sys/kernel/debug/regmap/spi0.0/registers 04: 10 -> Port 0, register offset 1 05: 10 -> Port 1, register offset 1 06: 00 -> Port 2, register offset 1 -> invalid 07: 00 -> port 3, register offset 1 -> invalid ... Add a debug module parameter to call a custom dump function for each port registers after the probe phase to help debug. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 03d00b144304..693b6cc371f8 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -347,6 +347,10 @@ struct sc16is7xx_port { struct sc16is7xx_one p[]; }; =20 +static bool debug; +module_param(debug, bool, 0644); +MODULE_PARM_DESC(debug, "enable/disable debug messages"); + static unsigned long sc16is7xx_lines; =20 static struct uart_driver sc16is7xx_uart =3D { @@ -387,6 +391,28 @@ static void sc16is7xx_port_write(struct uart_port *por= t, u8 reg, u8 val) regmap_write(s->regmap, (reg << SC16IS7XX_REG_SHIFT) | line, val); } =20 +static int sc16is7xx_port_dump(struct uart_port *port) +{ + int i; + unsigned char *buf; + char name[64]; + const int regs_count_per_port =3D 16; + + buf =3D devm_kzalloc(port->dev, regs_count_per_port, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + for (i =3D 0; i < regs_count_per_port; i++) + buf[i] =3D sc16is7xx_port_read(port, i); + + snprintf(name, sizeof(name), "sc16is7xx %s%i: dump ", + sc16is7xx_uart.dev_name, port->line); + print_hex_dump(KERN_ERR, name, DUMP_PREFIX_OFFSET, 16, 1, + &((u8 *)buf)[0], regs_count_per_port, 1); + + return 0; +} + static void sc16is7xx_fifo_read(struct uart_port *port, unsigned int rxlen) { struct sc16is7xx_port *s =3D dev_get_drvdata(port->dev); @@ -1614,6 +1640,10 @@ static int sc16is7xx_probe(struct device *dev, } #endif =20 + if (debug) + for (i =3D 0; i < devtype->nr_uart; ++i) + sc16is7xx_port_dump(&s->p[i].port); + /* * Setup interrupt. We first try to acquire the IRQ line as level IRQ. * If that succeeds, we can allow sharing the interrupt as well. --=20 2.30.2