From patchwork Thu May 25 04:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102159vqr; Wed, 24 May 2023 21:19:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7j5VLWljseGp8zo/PGN+od0uZFUUvqGzw6oSS97jz1E4oqMSnhLUVcC1jiE408MLKiQUMn X-Received: by 2002:a17:90a:bf8c:b0:24d:ea7f:9ea2 with SMTP id d12-20020a17090abf8c00b0024dea7f9ea2mr286882pjs.15.1684988385521; Wed, 24 May 2023 21:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988385; cv=none; d=google.com; s=arc-20160816; b=nR6HtcrSGItpW6jQkgB7lqDI1k6MtsSQQcv0Sbk9uTNFGSUUMw/Tcpme3CRW2Sr+sU 2klY3qQGwG4Ako9dvDq6pOkvpCVub+0FosW9bgfnhrGCDe2uc/8u7z+QxRGc3RdSdDXb 2XG7AxIUF9TOxr+uud3EBthmIihloJpXAuc4Ky5Ox03ySr0ggQXZByyShti5BEUR1Ry6 kLuLoYDolgyHvo78sGnRhiICbxp6hE4yy/yeZ2OLYqBf2s4EUuJF/ezQz2axunlFALEK Fjr6HDypvBvCWk6xmmmBUjzNXzGW4GaAclnY0iowk1CjEP/zGqiaqT6SiGIzSqNYv+ZL gpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=K0/NQ2Lp/XTRzOV/EA3J1QX3fKqgngHY8xvfRZV0kl8=; b=ICmjj6WJ1qu2j0ab1pUMsLQSUQRWaTB/he6DQSXwA6y3R1gGM17xjdLhbvOHWeZhvp mZlyd5KJTWV2lrSJlLEEp1CfSUiWepG+QeYaBO/kYzxnk+pvqMCZHQVc6kBmktb9UMXW Ytg2admmEpmlrvvqFjPENaJfLL5yRy8aS+LoJtNSnFSolow64Q5A9oAvUgcD9JtPm7zu /NwiI6RKQo4l2o4ENwN5pIVBnO3R5yqCO/P1XJd/p6X1CL4RQnBl6yBII3V0vFrnrUTW BxetuxXzso2btuME1ZS9zXerCSAURQLtIMX01Yoi3BM3juhjH69EkhdbSWQJZ52U7qZQ pBJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=L68A5MLl; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a17090ab38400b0025014cb905esi588583pjr.126.2023.05.24.21.19.31; Wed, 24 May 2023 21:19:45 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=L68A5MLl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238018AbjEYEFQ (ORCPT + 99 others); Thu, 25 May 2023 00:05:16 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838381307315045?= X-GMAIL-MSGID: =?utf-8?q?1766838381307315045?= 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, #ifdef CONFIG_GPIOLIB if (devtype->nr_gpio) { - /* Setup GPIO cotroller */ + /* Setup GPIO controller */ s->gpio.owner = THIS_MODULE; s->gpio.parent = dev; s->gpio.label = dev_name(dev); From patchwork Thu May 25 04:03:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101603vqr; Wed, 24 May 2023 21:18:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5lfUxh1LON9bJTe2DtfOjIFLmIxX9DAf0tPZ1fe3zXNEPBdjkroFwxsE/Q+3HsgB7LV3gO X-Received: by 2002:a17:903:2281:b0:1ae:62a6:fe61 with SMTP id b1-20020a170903228100b001ae62a6fe61mr303651plh.54.1684988295319; Wed, 24 May 2023 21:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988295; cv=none; d=google.com; s=arc-20160816; b=Xv5Z97z4oA3AC8c197mQR02cGg+okvTI9cNwXKoGl6Hn4YNpwTENErF6DujLVjcc1D A4yC7aqnAMj7BEJUjD6Mkdzz3J/xHYf+3JrAieGBat6CVH35/rCgLJFa/cRWXQCfD729 a0mkH0JFbYS67w1V8RRulD1QiPEtRkaf5U85RcCySvdJttthqhCpp0b/5cAnVgQgmY5H PoDgVIGe0jucA3RsyCL5JqKVdp2+ZzaidYMHK6edvj3zZw0D4awwI0Fr5xo2hVpy90iJ xi6o1qXRZrPtalU8rN8Kw/qG5A51zQv4It0EXwfIttysbyVwU18IO7gYmkKhzvQTSfFM cbPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=oMgj+tKoLcLXXYaEiSRJStVpk7eDMdwwfoe9DPEgx18=; b=N3KT1NBG/1OsthqOi5fTAmzWN4j6EdgMa2V6rIfPcb0YWLt9hM1VkgeQvitOxX0FC5 T87OZtA8klfe0Ed5msAZrYEp9wc9QvM+/JrO7DMDk7sJ2IjMJjlThpC+1Kmo+WIQQGHS 90L1fACTNwKO/lbzR3LDAiyEAOSPlvv5V3LbfU+xAZGlwuLQ79trh/nmY8ji8t753ZTw LNdaQg/xP6USKEvQ0dnoEbbQleacVrNo8g1b4bq9+Q6vHdzucN7M8A8uHW4381rFGcTV 1TnFPQJPNN2JemYdieJcrNey+UA7vQDE2SOcJ5VF/FAKqrr6T1GrHZMgD/EWQDrj4SRZ UNRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b="X9qxZM6/"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a170903024c00b001a99b9d767csi556419plh.166.2023.05.24.21.18.01; Wed, 24 May 2023 21:18:15 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b="X9qxZM6/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238376AbjEYEFm (ORCPT + 99 others); Thu, 25 May 2023 00:05:42 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838287023842203?= X-GMAIL-MSGID: =?utf-8?q?1766838287023842203?= 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 uses the + * When the trigger level setting in TLR is zero, the SC16IS74x/75x/76x uses 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 transmit * 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) -/* 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 modem 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 = rate upto 115.2 kbit/s - * - Only 750/760 + * - Only 75x/76x * 1 = rate upto 1.152 Mbit/s - * - Only 760 + * - Only 76x */ /* EFR register bits */ From patchwork Thu May 25 04:03:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102943vqr; Wed, 24 May 2023 21:22:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mqW4IPoXDpJrnAtDHznnElgJUOJlSMY4lJgI+twcqwAIFIncLFFmG4Fml6P6oMycd7tsf X-Received: by 2002:a17:902:d4c4:b0:1ae:35b8:d5ae with SMTP id o4-20020a170902d4c400b001ae35b8d5aemr116349plg.19.1684988525517; Wed, 24 May 2023 21:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988525; cv=none; d=google.com; s=arc-20160816; b=YOLKb/V0LMrliCltW3z+AQ5gs44gXaG8yXSWuYz0j/AOSidzxUi7gDsJOykjxaax6v 5kmr2xLmNI9nwGloDCkq3IzZ9ZI8cR/ZhrCBQlnhi2mO2Fao6axG8mRNjq6CG5ZY9rXf F0QO9QSSNxsraE1L+1KJXCgXEFjVM2Gcjrrokz1+f1JR/CXSojLIh5jo4IPuarRwQ52a fiCFpZeWw3v2mHzzWzYY7iIHZERHIKKWJJxq6z2YK5xmSMF1TDwdp6uTY1dWUjlGxrmf 8eZE8ql46UsowfQLsUmPF3AErYOava4C9mzZyU8Fguna/Sfg+Bicfihu10WrJhBW0hGa vSVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=8LddvSprDhEznGBMdyZoKgXbNv0SgICpMxxb43tkSPM=; b=0rDQ1fzU2j2KQ9gxmgL56F0W30HZXhmYuekkQx2tswNCCC+FfrIK3xc+8NfGMh/WsH JkhefYMEf0KSlhpXQz4gDltkkOH+40BXQ6VndX/iWOETYhR5K3r8dQJ7KET8IS+O28qK Has8wPjwWpMGbKMMyDMB/f3WVCbmumItL3h71H4akNicH/EY7nWyRC2XFqZz7agJtwU2 9DP7vcIovXkSOw2YZlK+evJfuQpJY11ufCzm6FUhG90pLj4AFVPMlfhDS0nhWrCPlYof R0qbKnZinnSUH3VLaPapHVVBkTsSk/WXMeK1eP7Az2epBZXreSadrwZ3gbtoWP3d26pi c67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=m7PMsANW; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz5-20020a170902ef8500b001a216fddd03si461893plb.649.2023.05.24.21.21.49; Wed, 24 May 2023 21:22:05 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=m7PMsANW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238660AbjEYEF7 (ORCPT + 99 others); Thu, 25 May 2023 00:05:59 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838528013928267?= X-GMAIL-MSGID: =?utf-8?q?1766838528013928267?= 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 *dev, unsigned int reg) case SC16IS7XX_TXLVL_REG: case SC16IS7XX_RXLVL_REG: case SC16IS7XX_IOSTATE_REG: + case SC16IS7XX_IOCONTROL_REG: return true; default: break; From patchwork Thu May 25 04:03:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp100312vqr; Wed, 24 May 2023 21:14:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rdKyVEuWdwd4YG1pss2DGsybCz6gu4vDLHa1/vsSXvnf9W3+BdkY15pdiWm2uN8k14ZfC X-Received: by 2002:a05:6a00:2343:b0:64c:a554:f577 with SMTP id j3-20020a056a00234300b0064ca554f577mr6271012pfj.11.1684988085034; Wed, 24 May 2023 21:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988085; cv=none; d=google.com; s=arc-20160816; b=0qiZVTsnpAfHjKUwVuRS+rhshPPq2i/rfDDh9cmxxQQRCbSdhyJTN7B6ACr1Jdt+2T 6d957UX+oN+Wod8i5S7Mkti/K3b/h3Ab7W3aILdDyw5C8skI3QKMFFlEALJGE/bWZqMT NoJq3Q4hBi/PPXUR7/LAM+jXRP7+gQaZrFIeGyk4D6LuXhFjSD7bU2CoqMrbxBmwv0KN vcmRm+tMNAoCTXrFRaakEsas3IUHYBexbf1MwYxjxJ46IOUJSLeil/qMScvGOEEc97EL cXMIe0f/cB5PXixPX/r0dlu4h055URgYgBQytPDztRkZ+NBBKRcxiuvUZ+OXkFYQ82BZ wJHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=JzQwwWHfLn5GqJ+sUpssIPjhRdBj01gT2s8uoqlHWI4=; b=VLDiV3Srt+nhJJzU8a8VIKdAyzqhnQR3Skav0WjEnzcM531ZKTT7URYQmm/oyLqSH7 Z8Zkp1VCAhxbi7RvQyJu0a7AuTWsYnqLB+Blk6nPouCWAGEY/4CV0HG1dh5E2jrS/czo NIXLzYN25XdLoNORByXA/9b/FGjzSNAdYFqQ0evjOlytY8tlR407dIX+BrXw4gU1uq4+ 3m/ze3Oa5nXq+zKXy3hH3c4LSpBdwCZplsUQtLlL6IScFKj2npLhk9t4rCaHzDPW8Eh2 mqZHk2FmkSyJ/VCYqqEbl3nDrAv4OUDMVHKBQ6eEihU4KN1k6mZegLzYBmyOukfKBQHb iD6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b="YJgReEa/"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k127-20020a633d85000000b0053eedcc5049si219773pga.105.2023.05.24.21.14.31; Wed, 24 May 2023 21:14:45 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b="YJgReEa/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238662AbjEYEGK (ORCPT + 99 others); Thu, 25 May 2023 00:06:10 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838065966581878?= X-GMAIL-MSGID: =?utf-8?q?1766838065966581878?= 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); + /* + * After reset, the host must wait at least 3us before initializing a + * communication with the device. + */ + usleep_range(3, 5); + for (i = 0; i < devtype->nr_uart; ++i) { s->p[i].line = i; /* Initialize port data */ From patchwork Thu May 25 04:03:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp97428vqr; Wed, 24 May 2023 21:07:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vcMzevLOFAZDq89aeftdhRPR6b8MCtyDzBkccAH5hiH0ei9fik5Lb6laSAnY6ri9eDGlx X-Received: by 2002:a05:6a20:840a:b0:10b:5347:304 with SMTP id c10-20020a056a20840a00b0010b53470304mr14197185pzd.7.1684987626306; Wed, 24 May 2023 21:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684987626; cv=none; d=google.com; s=arc-20160816; b=ZOr2RRCa21/ck0+ORwaQVMVE13ZGacJ+edc0hbKCsuEk2LzpplLOy+OGuGbiz+OGIp X90WMnE0dC68vHJeUXkBf3Qkw4WFewAXsa0iC1CpGFHC4gIxu9Ok+9ozbVKc/006SGEv LTR1Oa52wJ4EXjO3e6sP8DeANb5HJWkfwrF5XzlPSORKTe89NS1ZSGSZmK5v0rmk86X6 muxTj0B9hk0Jrsw+n8OIWR0mEuntt4P+n1N473jx4uNT5T94HxKKYXkvnuyoukugoINq dtVDtiMyANvQEM1NMyOGVon6AXKcKkUNkKA8n9kdM5AXf4A/A8vAKE9vAN+ngOdfIihB Zdzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=4SFt1oa/H6OPqzJ3VF1wAZJc4jROpd4jbbyOx0NJPsU=; b=qq/qJUvaY368MZVBGo1fgxZeMdUC/dwNJ3hbkuCCHcdIIo6eAq8C/OfUqdzHDhcNxk 7/wYxuUH4dOlSJ60gH5TCo0cgTknsXYgNBRnNfheRiCgS8t+0YUjcUvLADxKTPYcGNzo Y3r0JBFxuXuDZqLAwSXYX2l0ma0TKdq8hyYb2AEuioJkgSeotpQW0yb9guzliqzZvmZ3 +OTrSmWzuviSBbAS/G2SrRDZjUV4dtZ0zvgfoLxD/zroguMjhwsG3ShkpGP/JcHjfQwd Q8Q+sPua7EUeAosZaAIRkmtcuw+LuxeGHx2PocugCb/ISiAkQjIX9Q/+bsILkfEV1rmU NGzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=L46caBB8; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu15-20020a17090b1b0f00b00255bc974374si621904pjb.167.2023.05.24.21.06.50; Wed, 24 May 2023 21:07:06 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=L46caBB8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238760AbjEYEGW (ORCPT + 99 others); Thu, 25 May 2023 00:06:22 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766837585417952549?= X-GMAIL-MSGID: =?utf-8?q?1766837585417952549?= 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 = 0 port->mapbase = 0 port->iobase = 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ärvinen --- 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 = SC16IS7XX_FIFO_SIZE; s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY; s->p[i].port.iobase = i; + s->p[i].port.membase = (void __iomem *)~0; s->p[i].port.iotype = UPIO_PORT; s->p[i].port.uartclk = freq; s->p[i].port.rs485_config = sc16is7xx_config_rs485; From patchwork Thu May 25 04:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp100188vqr; Wed, 24 May 2023 21:14:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62Iruwltq++Pmm9YA/ISEY5CA4P6ngFg6y9F4zp/qKfNKhEyNGpQURIVKm1dhT3RUMhcg0 X-Received: by 2002:a17:90a:5894:b0:252:8698:d03b with SMTP id j20-20020a17090a589400b002528698d03bmr286358pji.14.1684988062211; Wed, 24 May 2023 21:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988062; cv=none; d=google.com; s=arc-20160816; b=T/NC4IC9IdImkB4p3BjhrWZBaHdymTf+Ct66SES+rJ5vvI3BSuLg0Zu8VurSQFZ8p4 vQ8Ut2tlSicEqKHGCaDf6JZp7YwICZnXAqnD/QNyMgVFnY74/YouGYR9fxgmo0EMNfeQ JibDsxyjdpFDZrh4SJDoIK6pIvkwYvbgF1VeDwIrXJbBFjyU8WZDVOm+lsd1AMbnl0Q4 EAzzfioByp2Qlbrqku67cMDgDSe6dC2zuMpSt8nhlExbasUdpW5kthzDtHw8DFwMnedw +RdrwnrrqVr078+mhEjmi50ijpX2tNuAl+/cJIpCaTOkjnwGH1hoN+VBDH8f1Y/oavBs HL9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=oAW87YGFqDuCb1wMiNK8HhUC7h6jxZ7gmJadiuchbuo=; b=cZ+1YE6l9mQwVPT2E7AteSzo3vP5Jnm11vUox/w7npL+CD+MLUp/8NRh6Kd3oyRyqk wuH/NBAZLbsn3CBVNN2S/rBt6wpDTmKSoXoGid+JSGxEWbsrzFjLrZRKAlSHXAmg5SkR 3ktPqg1kRJ+HgpiiXqwTGq/hjzE6FtVhFx0H5OZyFfe/PLHb18pSSDskXfPSnqjIgTDl yh9Dxa73/iwsgfC5sAGzsfCV5zBjyWjscWWVMsFcIz5C7AFOO/61GlECp6KOCoBGNKWd UhlXIMLFtjalqg3txVMeacinYMhDgq+SjMonnJicXLlgUAfEoLikt8xyjetHonpZ4Ucv gQTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=vzd6l2eD; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a637455000000b005347d73e09csi142327pgn.837.2023.05.24.21.14.10; Wed, 24 May 2023 21:14:22 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=vzd6l2eD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238811AbjEYEG0 (ORCPT + 99 others); Thu, 25 May 2023 00:06:26 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838041897013209?= X-GMAIL-MSGID: =?utf-8?q?1766838041897013209?= 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 gpio_chip *chip, state |= BIT(offset); else state &= ~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); return 0; } From patchwork Thu May 25 04:03:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp97469vqr; Wed, 24 May 2023 21:07:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45+D6j7ryiRCKLx8oSq3Kx1vA/YOXkIyKRj2O2Gsdil+XJCEECTYzxuH5dBn64whnMsgJr X-Received: by 2002:a05:6a00:2d1a:b0:64f:3fc8:5d16 with SMTP id fa26-20020a056a002d1a00b0064f3fc85d16mr6334764pfb.8.1684987632403; Wed, 24 May 2023 21:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684987632; cv=none; d=google.com; s=arc-20160816; b=wefEqu8dizdX5bJAkUorebSqQ9kZ1KXrf/rgWabOKDz6KmG6hGkccO+2SzSLDMrJK9 GmMf3jTmPhq/7GpdhUBtCwGBIQrMSX7YnpElM3ZtwX/+RRyg/0CYzNWzpceG0qsoIHni tuwfYEUGUd/FFYTeWPARZA/xnZKnxjmCmFRB+udreQQQMCW4oCUQvHTxXBqROdSn63fJ /THwbjJiNtnEO+91v3FV1PnO4bYs/sB+KFbMELDasKG2kuZp3lkmQBl66ohmuFmhJnE4 2LTrI5xK7HVBSNmJHdxITZsrxW0xJo4tjwcO1UbRSZH0W8cp6NXzNqUpLPGQL9BzB/tE cUSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=Rs2Mhd71JAcJq49FRqjICikz5CHJ00MgArsR2uJfUx4=; b=Qky0yIQ6MzBKZS81ziZg0tX9D0syL+7ZaArZpz8aZ040KLJJOtAldF7048xC6wcfO1 //xYSIxW0VWtt77egUG7Q1JzF/DLmvJhPe+gTS2ZqCcKAgj8zwDQI2M6D8pSlFYCvp31 hp/ZHkj9qIy48bCNoWNu+Wa2mlgRIzrJobBXrUhPOQluDFlkTTDHQBJYvwBRR+VgZ42c ilKkg9iSOOihXnBOwBhsQw2/rakBXEK/nyBVQjxOzId69gQxlYGVZivFhHrMXzoK3pRY mJtpeL7akrS8eUh2bfd4ZGB162nhP9WWThoutJgnZaXW7QxLoKFCbHJ7qbbBao8tqtbn lqcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=XelzIbRF; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a63f114000000b0053ef469282bsi142949pgi.645.2023.05.24.21.06.58; Wed, 24 May 2023 21:07:12 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=XelzIbRF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237531AbjEYEGa (ORCPT + 99 others); Thu, 25 May 2023 00:06:30 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766837591664462404?= X-GMAIL-MSGID: =?utf-8?q?1766837591664462404?= 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/Documentation/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 = 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 port that + should have shared GPIO lines configured as + modem control lines. Example: sc16is750: sc16is750@51 { @@ -35,6 +38,26 @@ Example: #gpio-cells = <2>; }; + sc16is752: sc16is752@54 { + compatible = "nxp,sc16is752"; + reg = <0x54>; + clocks = <&clk20m>; + interrupt-parent = <&gpio3>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */ + gpio-controller; /* Port 0 as GPIOs */ + #gpio-cells = <2>; + }; + + sc16is752: sc16is752@54 { + compatible = "nxp,sc16is752"; + reg = <0x54>; + clocks = <&clk20m>; + interrupt-parent = <&gpio3>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */ + }; + * spi as bus Required properties: @@ -59,6 +82,9 @@ Optional properties: 1 = 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 port that + should have shared GPIO lines configured as + modem control lines. Example: sc16is750: sc16is750@0 { @@ -70,3 +96,23 @@ Example: gpio-controller; #gpio-cells = <2>; }; + + sc16is752: sc16is752@0 { + compatible = "nxp,sc16is752"; + reg = <0>; + clocks = <&clk20m>; + interrupt-parent = <&gpio3>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */ + gpio-controller; /* Port 0 as GPIOs */ + #gpio-cells = <2>; + }; + + sc16is752: sc16is752@0 { + compatible = "nxp,sc16is752"; + reg = <0>; + clocks = <&clk20m>; + interrupt-parent = <&gpio3>; + interrupts = <7 IRQ_TYPE_EDGE_FALLING>; + nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */ + }; From patchwork Thu May 25 04:03:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102167vqr; Wed, 24 May 2023 21:19:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BzeCNZfQP8psUfgTsOrmP7pSXCuiSwfjGy4BY8Mjezlg23nArfoMMQlu/Mxm/4KIuXcOp X-Received: by 2002:a05:6a20:6a26:b0:10c:e60d:537a with SMTP id p38-20020a056a206a2600b0010ce60d537amr6139413pzk.21.1684988385945; Wed, 24 May 2023 21:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988385; cv=none; d=google.com; s=arc-20160816; b=XDQnKIfAFIUf/ngXhw5aBjmqdo/9qkREXVIRE6B6Wct2rBmZUOAJuzPwTRquFriMKE +SzrzJfxhcsfQDCKOV9gHlcPqLrfWOmoJo/9Bg1gRJvg+Ct3CTqfuqj8L8Eyemias918 CXozMZk5CTAyu74UYZw6C1+lXsptkikDQjTLTljhXf6PWRpHMLlw2UFu0LoMvCjLAqQi OhG+hHKF/mm7P/etydSRLoi5kbe0pX4V8IRIrCrb5f6gwrz0BiMRPc20zM983orzn3mT nmTmmxszRcXNuqBHvVhsKEQyVOb3+eBbAKx71KLRk0yPHiAPgOIA1oLDbSlvtatDaYcz X69Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=JiheQ8Q8tkLBdJvTWHP7zHAZ71XGjHsp7B6ulAHNFcA=; b=SJyPzRUYOL3EGargvU19NKhpVNv4dk86y3iqevFpOteHxMEbN2QReoMJmYpzBgfIrt IGdM9TjEetsxkgQaFLnlgnDy/q6/9WUJuuK2o01Ly8Kn+RCJda8wcfymTObl2mfNbalZ SN8VfGDQ0MeKbWEn4m7Iz0Q8j4R8/jd9RB8eJw0J8FKF/a/QJQf5XCoFCqX3RPB40NyS 7ZwU6cBSYBetSnRNc4b73J4r+hFXOUD+owmNpBg5VbaWmijbOP2eMHnWEQWWlTBBCWZY mS9rhS+V7ADa10PAyQj2rpDaxopymye53Ha6oRTZaq4SQZq7f0TFHS83wv5R+YA2Iqfa aGcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=U4DBiBAJ; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a6552cb000000b0053ef158b0c2si202776pgp.185.2023.05.24.21.19.31; Wed, 24 May 2023 21:19:45 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=U4DBiBAJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238469AbjEYEGf (ORCPT + 99 others); Thu, 25 May 2023 00:06:35 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838381948250160?= X-GMAIL-MSGID: =?utf-8?q?1766838381948250160?= 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 @@ /* 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 modem pins */ +#define SC16IS7XX_IOCONTROL_MODEM_A_BIT (1 << 1) /* Enable GPIO[7:4] as modem A pins */ +#define SC16IS7XX_IOCONTROL_MODEM_B_BIT (1 << 2) /* Enable GPIO[3:0] as modem B pins */ #define SC16IS7XX_IOCONTROL_SRESET_BIT (1 << 3) /* Software Reset */ /* 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 struct sc16is7xx_devtype { char name[10]; int nr_gpio; int nr_uart; - int has_mctrl; }; #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_devtype = { .name = "SC16IS74X", .nr_gpio = 0, .nr_uart = 1, - .has_mctrl = 0, }; static const struct sc16is7xx_devtype sc16is750_devtype = { .name = "SC16IS750", - .nr_gpio = 4, + .nr_gpio = 8, .nr_uart = 1, - .has_mctrl = 1, }; static const struct sc16is7xx_devtype sc16is752_devtype = { .name = "SC16IS752", - .nr_gpio = 0, + .nr_gpio = 8, .nr_uart = 2, - .has_mctrl = 1, }; static const struct sc16is7xx_devtype sc16is760_devtype = { .name = "SC16IS760", - .nr_gpio = 4, + .nr_gpio = 8, .nr_uart = 1, - .has_mctrl = 1, }; static const struct sc16is7xx_devtype sc16is762_devtype = { .name = "SC16IS762", - .nr_gpio = 0, + .nr_gpio = 8, .nr_uart = 2, - .has_mctrl = 1, }; static bool sc16is7xx_regmap_volatile(struct device *dev, unsigned int reg) @@ -1396,6 +1393,10 @@ static int sc16is7xx_probe(struct device *dev, return -ENOMEM; } +#ifdef CONFIG_GPIOLIB + s->gpio_configured = devtype->nr_gpio; +#endif /* CONFIG_GPIOLIB */ + /* Always ask for fixed clock rate from a property. */ device_property_read_u32(dev, "clock-frequency", &uartclk); @@ -1473,12 +1474,6 @@ static int sc16is7xx_probe(struct device *dev, SC16IS7XX_EFCR_RXDISABLE_BIT | SC16IS7XX_EFCR_TXDISABLE_BIT); - /* 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 = true; + + val = 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 == 0) + val |= SC16IS7XX_IOCONTROL_MODEM_A_BIT; + else if (u == 1) + val |= SC16IS7XX_IOCONTROL_MODEM_B_BIT; + +#ifdef CONFIG_GPIOLIB + if (s->gpio_configured >= + SC16IS7XX_GPIOS_PER_BANK) + s->gpio_configured -= + 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); } #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 = THIS_MODULE; s->gpio.parent = dev; @@ -1527,7 +1550,7 @@ static int sc16is7xx_probe(struct device *dev, s->gpio.direction_output = sc16is7xx_gpio_direction_output; s->gpio.set = sc16is7xx_gpio_set; s->gpio.base = -1; - s->gpio.ngpio = devtype->nr_gpio; + s->gpio.ngpio = s->gpio_configured; s->gpio.can_sleep = 1; ret = gpiochip_add_data(&s->gpio, s); if (ret) @@ -1555,7 +1578,7 @@ static int sc16is7xx_probe(struct device *dev, return 0; #ifdef CONFIG_GPIOLIB - if (devtype->nr_gpio) + if (s->gpio_configured) gpiochip_remove(&s->gpio); out_thread: @@ -1581,7 +1604,7 @@ static void sc16is7xx_remove(struct device *dev) int i; #ifdef CONFIG_GPIOLIB - if (s->devtype->nr_gpio) + if (s->gpio_configured) gpiochip_remove(&s->gpio); #endif From patchwork Thu May 25 04:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp112665vqr; Wed, 24 May 2023 21:51:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vFsLRISbrxjSDN3S3Qvkye5mxUhsmWYBP1AuWDP7NvtgPZ6M7H1en91F1p1m7VhDt0mSq X-Received: by 2002:a17:90a:bc97:b0:255:e301:7b01 with SMTP id x23-20020a17090abc9700b00255e3017b01mr277194pjr.35.1684990290207; Wed, 24 May 2023 21:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684990290; cv=none; d=google.com; s=arc-20160816; b=O/mjVn/OEJvFJNm7cbJ3+XLU0RgGUKy/TBTIFUGg5M5LD1OZvsmaOQB8gCreBj5KIh LFHdwtmFRFYKDalSOzer7iKorX87xOlcbV80iB3Tj4cSrYDX4eDlqr+vStZRiCoWsB8B 1cPDgWBIXnp22uaazjTJfvApI3oOqDzAAQzjifWEsj33/wsApy5ao8/PYSGHKIFrtMi1 bnX4az9WwgTovkVEof8mblF40wmEMQy49LlwRvOg4h9e1jaengcmjbZnP1+Lgwv602Uh py0KpHUl2RVOHHIZyfwuonLq3Xe5XTa4hesetARGtwuQG4K/ZMIS7/lGbHJCNoDZ3weU mJcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=9uFf80nuPq7IpOBCTtsrmsGYtNovsW/4uJuo42PakOo=; b=d4938meVO7oNA5OvgmVjhEfPVgp+6e7oW60cRwSyrILLxds8C1WsyR0CvmEhf+Iq3x 1KXeitw5tLKVR6COtP3PWxsk5y/HVdy3MBF6sZspYq1G0kS4Ll38pa6BIZLQRKQae7+e ydyGrz1AgWfGcFXsq5bRtK0KkXauH+Cs2WCNwBnVm5hoT6uRSLaqPT07WzSxBgj1qRda yF9r+TYv+x7m6l1MKzSB4+MvBg29l0oVp73IDJev3vNiT+exEgZC2p0OxgGZts5ewLCn GR/okenYI0IMTfVXyJfKfcJINHIZFmE240AfIbdYEqS2eiFZsYG2qYiiNY7mG9q5eJgV xwTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=hZS8RhBG; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a654601000000b00528d30e6990si252517pgq.509.2023.05.24.21.51.15; Wed, 24 May 2023 21:51:30 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=hZS8RhBG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238910AbjEYEGo (ORCPT + 99 others); Thu, 25 May 2023 00:06:44 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766840378625611528?= X-GMAIL-MSGID: =?utf-8?q?1766840378625611528?= 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 = { }; #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 configured 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 above): + * + * 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 lines, + * 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 = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; + offset += s->gpio_offset; val = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); 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 = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; + offset += 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 = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; + offset += s->gpio_offset; sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), 0); return 0; @@ -1336,6 +1377,8 @@ static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip, struct uart_port *port = &s->p[0].port; u8 state = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); + offset += s->gpio_offset; + if (val) state |= BIT(offset); else @@ -1395,6 +1438,7 @@ static int sc16is7xx_probe(struct device *dev, #ifdef CONFIG_GPIOLIB s->gpio_configured = devtype->nr_gpio; + s->gpio_offset = 0; #endif /* CONFIG_GPIOLIB */ /* Always ask for fixed clock rate from a property. */ @@ -1529,16 +1573,24 @@ static int sc16is7xx_probe(struct device *dev, #endif /* CONFIG_GPIOLIB */ } - if (val) + if (val) { +#ifdef CONFIG_GPIOLIB + /* Additional I/O regs offset. */ + if (val == SC16IS7XX_IOCONTROL_MODEM_B_BIT) + s->gpio_offset = 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); + } } #ifdef CONFIG_GPIOLIB dev_dbg(dev, "GPIOs to configure: %d\n", s->gpio_configured); + dev_dbg(dev, "GPIOs offset: %d\n", s->gpio_offset); if (s->gpio_configured) { /* Setup GPIO controller */ From patchwork Thu May 25 04:03:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp100608vqr; Wed, 24 May 2023 21:15:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6q8To17wYR4nio6LoPcEs6kxaOpA7LqFyrk+Ek7UX4C4IppN90MlIimk83QC0NoKQaAT9d X-Received: by 2002:a05:6a20:7f8d:b0:10a:cb95:5aa3 with SMTP id d13-20020a056a207f8d00b0010acb955aa3mr18315851pzj.7.1684988130185; Wed, 24 May 2023 21:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988130; cv=none; d=google.com; s=arc-20160816; b=szPb3NJfqwbjcBX5IJ8veurcYF9qdlOE5D50MI6vnhmGP4lXRH8jRgoV54yOqZgEJj puueZw7XU9FL356ClMsbrRSnacL7LPUxQo+3HDkL1J0OpfTmKObmMZsv4df5SIPYGW8d 8cRm5UwaWqCphQOa9RlGhqtpV0n39A570jBxw0Ut5s7wf9qtEknfcL9ysDSCmor8xpUL ts1nDLMiavKUcgpQWvY1rCACSMRMlYMjDdlVcJhFkq1MwxtSKeO6NyChbjhtS24I0fbg /YKni54OAcZ07f7HrX83HDmFnesb29K8FzJCJRaytCCIJvdyBKMHBY0L0S9NkD68ahMB D/zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=LV4yVF96+pGyKU5GDE3DMI+qw5mDcTG0Pniv9EqAjvo=; b=LGaO/IXF0qqJBzWiAxA+CdqsgHtJiWjgCKpacxb65YY9/bf2bGu5jLwOZsSzy1M+1U XoFHe8goCYDXeqV2BH6nBjPlqdzIe42makspJBQFGWFb8ilC+Cw+Cn5esQo1yvIqif9J /gdDYb+oP86PTCCVKFPY5+4l4T4Rk1w5BrAynVFLp+EU80Hw9sgglcvJ3rlhJwFs+1YP P6A8+TQ0ODLTaJrEQ1TWphifkHR5Or+Rmn1Bw1alWqeYYBXlMR2WHEH87XNTmj3YqmPi b/91YJSmsukckuYbyvaSVm65YW+/1uvdI263bZHYclDdDrl4xEiEJFV/MIztIsQP04nw dbNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=SEIbyzJR; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0053ef09db573si217376pgd.247.2023.05.24.21.15.16; Wed, 24 May 2023 21:15:30 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=SEIbyzJR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238882AbjEYEGj (ORCPT + 99 others); Thu, 25 May 2023 00:06:39 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838113632809266?= X-GMAIL-MSGID: =?utf-8?q?1766838113632809266?= 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ärvinen --- 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; } + ret = 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 */ From patchwork Thu May 25 04:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 98771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101866vqr; Wed, 24 May 2023 21:18:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61925y+V4NE1mANbuALrwnkOZcEzR1B6F7swExmy0xjms+4Z66fmdC+PJkmIItjVX5gnb9 X-Received: by 2002:a17:903:48e:b0:1ae:4248:c7f with SMTP id jj14-20020a170903048e00b001ae42480c7fmr245084plb.48.1684988334439; Wed, 24 May 2023 21:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988334; cv=none; d=google.com; s=arc-20160816; b=fhBcMDaayqvWOaGw+mbTuY/MVMFNAQrqteyjmqi4/Q4aDbohY0UoBE3hwFd1xHnxUk qaWEQRe/vGZ8V8uZWIrMKc27TO/v8kmPWNnHBGcfsfpWn1fQyl9WvctzmP+XK32GO8/K 81DW2dTc5UQdFeKjJfLK8Q+1o2KC/20NiIdDAf8aP+FvCY/gLMLgS80eylXWEGCuK7ot uHk4lC/n9AvhO/o9vibrW70XpxfGdWnh8n1AiMJgIdDBy6Ghkc/y5gQ8WMZPcCVx3CZx ASqrwvPvfi0Zu2iCRvJCSbMIwm9iGMAMqtgF1QicFg+dQ3ThqGL+fzvazp089aKekQuY Nf0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=wtCZaz+ygLc5odu0jyJWVuukps/nAVPXx7PU+/vrFgM=; b=Yft1I8ab9EaaI7iGAOVRuNyENbgGJ+2rDb3Z1uXGfMpAp7CMkg9EslXw2RB32mv5Hn zrLrA4e7QWdIgaROZ4cYKVtpEVppbFJu2saNLpBas10HNwUPVkwgTOWDXRIYSyDVipea s69CC2ZTd5j4LpnvGnMrVHqg4i+uYYql30T5Pj4prihg00nyNV47Ayy8PYFuBu5/Xj/N DBsvLXjuILjDCad1CXWCijSb7MzpkfCJpiQHStxzSZ2U6kTt0GlPNINAgJ7fIIN48kRv rXut4jldZUQf4K3DSWXCA4E0wT7zHIGUR0ImVz/a1SQ9wDO5cdEAfBlq4oQawmaxtUzs ztpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=Qbt1LRs+; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a1709028bc300b001a92f0f46fbsi497854plo.436.2023.05.24.21.18.40; Wed, 24 May 2023 21:18:54 -0700 (PDT) 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=fail header.i=@hugovil.com header.s=x header.b=Qbt1LRs+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238271AbjEYEGz (ORCPT + 99 others); Thu, 25 May 2023 00:06:55 -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 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838327670044184?= X-GMAIL-MSGID: =?utf-8?q?1766838327670044184?= 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[]; }; +static bool debug; +module_param(debug, bool, 0644); +MODULE_PARM_DESC(debug, "enable/disable debug messages"); + static unsigned long sc16is7xx_lines; static struct uart_driver sc16is7xx_uart = { @@ -387,6 +391,28 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) regmap_write(s->regmap, (reg << SC16IS7XX_REG_SHIFT) | line, val); } +static int sc16is7xx_port_dump(struct uart_port *port) +{ + int i; + unsigned char *buf; + char name[64]; + const int regs_count_per_port = 16; + + buf = devm_kzalloc(port->dev, regs_count_per_port, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + for (i = 0; i < regs_count_per_port; i++) + buf[i] = 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 = dev_get_drvdata(port->dev); @@ -1614,6 +1640,10 @@ static int sc16is7xx_probe(struct device *dev, } #endif + if (debug) + for (i = 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.