Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp806228rwd; Thu, 25 May 2023 04:22:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61His92lXDiipwe2HLhtAcCxryRcLkd5z7kj4O2ihmfdLCRl6yfxssVzi1SyO/sHtpxx+o X-Received: by 2002:a17:902:d714:b0:1ac:4d01:dfec with SMTP id w20-20020a170902d71400b001ac4d01dfecmr1212972ply.54.1685013720563; Thu, 25 May 2023 04:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685013720; cv=none; d=google.com; s=arc-20160816; b=qlhkBYz77NtFaO3SgGVCOcXe1CEQxuDluwmlGS2pfpwlnUOeNpXUZvfVO987pZ3Jdm fdQM/1JS8vIvKRM0/6DUxzmffn8WcC+/iAQveeKuLrq702wc/DMHxEOD2bm56Ls7lcCJ E02IDoj10QoPVesFty0Z/MWAso3seR/y3QMm/8xaC9VFC158I+HPcrKjgNDU9nlN4JQJ /CyjSibeH0NVieX5l9XrgjA3H5nmXiSvMFuFi840hQTVizm+3gYXWIjtSbCXacLTYLtg I0A3l9+oF8rbAVD+WSCVkO50l8pAHzRQUpsBAW0/fFG5WhFFVWjJo08rzmHvt3oOvE5K TlJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=Cn1wM/K/1Vqj1aPUIX72u6Oex0hOE9IV4hhGc5VZ00I=; b=p0P6ndxP+rOkxUFr4YhV5zmFhYIZgOS/Aw7jmpkBkPCv6r7arthDaO2dc/DH1NnBBy IteRA0dmY7MUskHoCBaEOM2i/k8F4lkcQfvPFU7dA1EnLNVQZwqnMIeWOXBRCcDG5odb baeem+CW+Q5jiSwkHWLvU1eKbXFHjCJJBlYWaGac4COvmvHSCpJdt5bdQK6fCAcykdvl MR/+IIdPHFuWWqpGKPVzwHe9RQajBEBra529N3gIAp/Y+UO5xlucqaH5EjsiItneI6It sJee5NDQx/7XGMh724KQlj+jVP54JqYGRl5gUXxbNa9DpvyAsZNdcvkQ74F84RNQycIP j01g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj5-20020a170903048500b001ae4026d82bsi1262458plb.12.2023.05.25.04.21.47; Thu, 25 May 2023 04:22:00 -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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240576AbjEYLKo (ORCPT + 99 others); Thu, 25 May 2023 07:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240294AbjEYLKm (ORCPT ); Thu, 25 May 2023 07:10:42 -0400 Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A362819C for ; Thu, 25 May 2023 04:10:30 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id c0ee11ec-faec-11ed-b3cf-005056bd6ce9; Thu, 25 May 2023 14:10:28 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Thu, 25 May 2023 14:10:27 +0300 To: Hugo Villeneuve Cc: 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, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Hugo Villeneuve Subject: Re: [PATCH v3 06/11] serial: sc16is7xx: fix bug when first setting GPIO direction Message-ID: References: <20230525040324.3773741-1-hugo@hugovil.com> <20230525040324.3773741-7-hugo@hugovil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230525040324.3773741-7-hugo@hugovil.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thu, May 25, 2023 at 12:03:20AM -0400, Hugo Villeneuve kirjoitti: > 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 Missing 's'. > 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. -- With Best Regards, Andy Shevchenko