Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2658630pxj; Mon, 31 May 2021 07:35:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjvduVXtTqWrUqSxhgK3S2kx/jDcQ98TAC4i4KfTbMuipnVweEVinSgHnt6Kc41Bligtdh X-Received: by 2002:aa7:c542:: with SMTP id s2mr25076920edr.288.1622471759045; Mon, 31 May 2021 07:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471759; cv=none; d=google.com; s=arc-20160816; b=CgYVYzlKdmHLo+VxmauZN2HwTLH0S8iy+nFjNqxCg7YzjhsE6ENRdBjZV6uPdtg6ID g0R57NmCFO9D8t5waB7VyEZmTOEyyc2b7hnCeN7Zp3DfcvtOpj4ZNUw1TmwPV3ogfxFb ZOcxhN2QaF64lEMaJ1FlD6DQEVhsG+nk+rM+HGS9GOYSoWaYvcbbhQQuXxUK/O+ejdZQ ZBTrqxBAr2h8iV8G4sVk/e3wdIyVz+9g4Ieqccw99ZdPffdOfbwYNrF1+/yaT8xv0NKM Ls8wtEcGvvdqrFWjWASAr3+Qk8SfHBbZ0I3z2nSaubc0qkjlGmKKktETlzBEwCTUqIiV LZ+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=uPJ1h44gN9efb66h2d6sOLiMBPnkNUiCL4WrZlcvKtI=; b=wR0N1UH6JCUJcZp6eZB3Qv7cBdaRMAiul7PCazalR6dKqXPZm6y9JlMeZFQi03nrFZ fdfdFTn4tiePmcSYNxbedp5RXgXpKOWmhZdat69bCtD/1OeQS99HAFoldU6lfQg3Y1YA ipIZEO68KgRqt/7qqlDb7RB0SN9EEZLbxCjibKIsgrHbcpueCaEUsRTjCbfXmtAUu9ZJ KG3z7Z4nPeMhTbKgdx1CUbg/S3/ngxmj+mz+hmdsImXOPvUCTF7v9EpYQ1rv6x9hx+UV NuhM1Dptba2d5hOazTMWzfLsNSTz3EY7J47dGcrfp2C8eq6Sc0+NsLF2SvwK/AUd+8D0 OlfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si15538800ejd.643.2021.05.31.07.35.36; Mon, 31 May 2021 07:35:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbhEaOfo convert rfc822-to-8bit (ORCPT + 99 others); Mon, 31 May 2021 10:35:44 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:40113 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbhEaNzv (ORCPT ); Mon, 31 May 2021 09:55:51 -0400 Received: from [77.244.183.192] (port=64432 helo=[192.168.178.41]) by hostingweb31.netsons.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1lniMp-00018T-UP; Mon, 31 May 2021 15:54:08 +0200 Subject: Re: [PATCH v2] PCI: dra7xx: Fix reset behaviour To: =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: linux-pci@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas References: <20210531090540.2663171-1-luca@lucaceresoli.net> <20210531133211.llyiq3jcfy25tmz4@pali> From: Luca Ceresoli Message-ID: <8ff1c54f-bb29-1e40-8342-905e34361e1c@lucaceresoli.net> Date: Mon, 31 May 2021 15:54:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210531133211.llyiq3jcfy25tmz4@pali> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8BIT X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca@lucaceresoli.net X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pali, On 31/05/21 15:32, Pali Rohár wrote: > On Monday 31 May 2021 11:05:40 Luca Ceresoli wrote: >> The PCIe PERSTn reset pin is active low and should be asserted, then >> deasserted. >> >> The current implementation only drives the pin once in "HIGH" position, >> thus presumably it was intended to deassert the pin. This has two problems: >> >> 1) it assumes the pin was asserted by other means before loading the >> driver >> 2) it has the wrong polarity, since "HIGH" means "active", and the pin is >> presumably configured as active low coherently with the PCIe >> convention, thus it is driven physically to 0, keeping the device >> under reset unless the pin is configured as active high. >> >> Fix both problems by: >> >> 1) keeping devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH) as is, but >> assuming the pin is correctly configured as "active low" this now >> becomes a reset assertion >> 2) adding gpiod_set_value(reset, 0) after a delay to deassert reset >> >> Fixes: 78bdcad05ea1 ("PCI: dra7xx: Add support to make GPIO drive PERST# line") >> Signed-off-by: Luca Ceresoli >> >> --- >> >> Changes v1 -> v2: >> - No changes to the patch >> - Reword commit message according to suggestions from Bjorn Helgaas (from >> another patchset) >> - Add Fixes: tag >> --- >> drivers/pci/controller/dwc/pci-dra7xx.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c >> index cb5d4c245ff6..11f392b7a9a2 100644 >> --- a/drivers/pci/controller/dwc/pci-dra7xx.c >> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c >> @@ -801,6 +801,8 @@ static int dra7xx_pcie_probe(struct platform_device *pdev) >> dev_err(&pdev->dev, "gpio request failed, ret %d\n", ret); >> goto err_gpio; >> } >> + usleep_range(1000, 2000); > > Hello! Just a note that this is again a new code pattern in another > driver for different wait value of PCIe Warm Reset timeout. I sent email > about these issues: > https://lore.kernel.org/linux-pci/20210310110535.zh4pnn4vpmvzwl5q@pali/ > > Luca, how did you choose value 1000-2000 us? Do you have some reference > or specification which says that this value needs to be used? Sadly I haven't access to the PCIe specification. I'd be very happy to know what a correct value should be and update my patch. -- Luca