Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4058619ybi; Mon, 27 May 2019 10:16:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKjogXrqk/d/jbMNA5McB9nnDcJz9VwA48V4sSHja/oVFSaqKIk957AaIbUgKs9Ol/TWbn X-Received: by 2002:a62:d205:: with SMTP id c5mr135330045pfg.219.1558977415297; Mon, 27 May 2019 10:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558977415; cv=none; d=google.com; s=arc-20160816; b=MHfMSv2ZKL/i2aNBhRQvuvFdwIjVX/4uUiD2/IL98cflvnMkkEymdQIkEgAFDpqLWM rjMSHzNZPjFJPFJkIFp6Xsl3ojHC08yP2nMXJWkb8bwWMPzK7tPDLyaj0OYz+aEds/ce x5gJPvnSRiVIbDx9dsUjrv/ydqwFXoszEnLphWHmm20PGOuHU9YAE7Zk/KeDlvnGm/4b Ok2hI1yTVFFo7Yah9D53lYzh0EkhFZtMvmXJc2Wx5BUNpLfmjI9phKzxpwdA4VNSveRe Rp5rVT/+srGTd0C5rnwb9m84nHvpzXKpfKKQ45Cwq6JIFb5dqlzyOrJZJJuaSzlBs/ou WdCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bQYcUfzJ2eNZWZPGMl/JEm3foS8Vd5oiqQcXqPz07kw=; b=wvMRInE7fETWX5vfZeDFP/03b0EG/TjiVtb1EDTz3PIw0kVLEEj+cRhSkwgeX/Y+Fo rCXdGkGwn0NqBuCwOXEgB5HOicFTOGEge0Uk3pe4CdONL1v511+tphiOX8tCeZj35CWp 7Ee0SIcxUq/085q5qu8lOmFvu919V9t6Qc4NPlc4xmiVb7hFaFLHLIk8G062O/R/heAz EN9vcD77X1Ewia2WsHnQ/LYV5e2Ttia2Zqsj+jx3GUqZ0by1RH0Nnj64DU/ZCbYfd3ma LLJoanX2j78nKrWh/GDdHg1QYNi2A3f+yapo8DAc9DD63BMDkw75aDBAS7RJGpOTvKxx xaqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IwyLnWMZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si17911615pgp.245.2019.05.27.10.16.39; Mon, 27 May 2019 10:16:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IwyLnWMZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726274AbfE0RP1 (ORCPT + 99 others); Mon, 27 May 2019 13:15:27 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38811 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbfE0RP1 (ORCPT ); Mon, 27 May 2019 13:15:27 -0400 Received: by mail-lf1-f66.google.com with SMTP id b11so6168222lfa.5 for ; Mon, 27 May 2019 10:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bQYcUfzJ2eNZWZPGMl/JEm3foS8Vd5oiqQcXqPz07kw=; b=IwyLnWMZV/lpbMMff8AmQ9B448MJe0hJfxwb0ybe6SaMC0lAuX1ECzmNaHNcN0Fa8/ TZkEKkQQbEF1yrnnVZ0455tihokSvF0U2ll4z1nsJYIk4r89GxDcO4BKABRGZ35FeOHa JRcgJyHcrufrWvWj/HC80jNc8vqhmNVdGzyDsLPxwjAu+UasKMS9VjdT7wc1ZuuQIQLJ KIUbeCkVLS1APL5fNmRXP+Ad1nqkwvGH4TYMMeAPTLudHITt/L/lOSWGK2+axIJeIH+p sbxzFZSFJr8mPrv4POl+WTkJJ2aQA8CUgilP6GATfXEHzDBhATBuQWF3UXVkj5mnqshm ACtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bQYcUfzJ2eNZWZPGMl/JEm3foS8Vd5oiqQcXqPz07kw=; b=YCCbsAguke1lbxUqb3ih7/abBxcYCbJD8iQwEKK+o4/uSsPIGt8N3zRJBI0iGnzulj Uu+oA4Rd5MakXk0bMqTLotBhy0ZrnMGktefcUY1wubNnDtm0QQBgQWZ+iQNZuB37xPrQ XDeELYeeZnxhe8wmzUJgd5MHolcoVgh1TcU7zEmUIivkxh4r0VvrER/dkt4yJVWQ0Tqb aZYFBz/JHFuk4+feKqp/tGYJROWo31BuPaYj+CUOdnQVImWGTe8YgosFKsnG8jZ7pxES kf6t2Max/9OiPPX0so7F97ut2wVj9CPzGrSRBI2qCb410nK5doYk6cf42QVxNHY2d8uB UtVg== X-Gm-Message-State: APjAAAW1UTXMQEUZyBct+0h/sUENXR2bmGYm2BfPrJOJqeBg6JBVbbEv dGCEo82EO4QSGTAFaTiS5Laluw== X-Received: by 2002:ac2:510b:: with SMTP id q11mr1072378lfb.11.1558977325355; Mon, 27 May 2019 10:15:25 -0700 (PDT) Received: from centauri (m83-185-80-163.cust.tele2.se. [83.185.80.163]) by smtp.gmail.com with ESMTPSA id t13sm2382792lji.47.2019.05.27.10.15.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 27 May 2019 10:15:24 -0700 (PDT) Date: Mon, 27 May 2019 19:15:21 +0200 From: Niklas Cassel To: Marc Gonzalez Cc: Stanimir Varbanov , Andy Gross , Lorenzo Pieralisi , Bjorn Helgaas , PCI , MSM , LKML Subject: Re: [PATCH] PCI: qcom: Ensure that PERST is asserted for at least 100 ms Message-ID: <20190527171521.GA7936@centauri> References: <20190523194409.17718-1-niklas.cassel@linaro.org> <5d743969-e763-95c5-6763-171a8ecf66d8@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5d743969-e763-95c5-6763-171a8ecf66d8@free.fr> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 24, 2019 at 02:43:00PM +0200, Marc Gonzalez wrote: > On 23/05/2019 21:44, Niklas Cassel wrote: > > > Currently, there is only a 1 ms sleep after asserting PERST. > > > > Reading the datasheets for different endpoints, some require PERST to be > > asserted for 10 ms in order for the endpoint to perform a reset, others > > require it to be asserted for 50 ms. > > > > Several SoCs using this driver uses PCIe Mini Card, where we don't know > > what endpoint will be plugged in. > > > > The PCI Express Card Electromechanical Specification specifies: > > "On power up, the deassertion of PERST# is delayed 100 ms (TPVPERL) from > > the power rails achieving specified operating limits." > > > > Add a sleep of 100 ms before deasserting PERST, in order to ensure that > > we are compliant with the spec. > > > > Signed-off-by: Niklas Cassel > > --- > > drivers/pci/controller/dwc/pcie-qcom.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > index 0ed235d560e3..cae24376237c 100644 > > --- a/drivers/pci/controller/dwc/pcie-qcom.c > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > @@ -1110,6 +1110,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp) > > if (IS_ENABLED(CONFIG_PCI_MSI)) > > dw_pcie_msi_init(pp); > > > > + /* Ensure that PERST has been asserted for at least 100 ms */ > > + msleep(100); > > qcom_ep_reset_deassert(pcie); > > > > ret = qcom_pcie_establish_link(pcie); > > Currently, qcom_ep_reset_assert() and qcom_ep_reset_deassert() both include > a call to usleep_range() of 1.0 to 1.5 ms > > Can we git rid of both if we sleep 100 ms before qcom_ep_reset_deassert? These two sleeps after asserting/deasserting reset in qcom_ep_reset_assert()/ qcom_ep_reset_deassert() matches the sleeps in: https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/pci/host/pci-msm.c?h=LA.UM.7.1.r1-14000-sm8150.0#n1942 and https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/pci/host/pci-msm.c?h=LA.UM.7.1.r1-14000-sm8150.0#n1949 I would rather not remove these since that might affect existing devices. This new sleep matches matches the sleep in: https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/pci/host/pci-msm.c?h=LA.UM.7.1.r1-14000-sm8150.0#n3926 > > Should the msleep() call be included in one of the two wrappers? This new sleep could be moved into qcom_ep_reset_deassert(), added before the gpiod_set_value_cansleep(pcie->reset, 0) call, if Stanimir prefers it to be placed there instead. Kind regards, Niklas