Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp180225lqb; Thu, 14 Mar 2024 08:27:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCHC36AY6VubD6KfLuqOF4REFFVCCB79QxVFkdzZTDrSL/eD/CIGOz+0rDJkFfH71FiNK76brVFVfzR6YC7kncIjYUGOOMcxi8xgcwrw== X-Google-Smtp-Source: AGHT+IF3U+hRa5web0oliWSDJjikPwfYcNZnylsB8xwducq4lsQC5mZrJ588/zr1UU9hYj/+VDoR X-Received: by 2002:a05:6a20:bc93:b0:1a3:109e:1b03 with SMTP id fx19-20020a056a20bc9300b001a3109e1b03mr1877743pzb.22.1710430019397; Thu, 14 Mar 2024 08:26:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710430019; cv=pass; d=google.com; s=arc-20160816; b=miSwfsG1yXjDIG3c+NpYR2bH3gQlKeWONorGA3Q9oc3RmXUmCcle2iENlYObuzO5eg UPPZjh1U521ESRqxNjq8e07+I6ohaKTTE7eoqRG50vbOnu06K1Oo/Mt2J1OJH0aOIYox MUz4i1fPQRxgHC/7rTZsXA/g1eQcfVWSYTvJoysOMLctDN47+2xYv4v2+kQeUWjM2ny/ 3plfbr4yUjHRybH4oBr+L/0/9S8LbeBQo16JKNAKD/taYEcRWFVlBA2Uo6oPmKriOmDA thAkRVBuf03Kud5Thobz4u0WCXJwOs2+bRrQ5uGG5HCxAj7ayy6qqZLvetyyLoswtksy JNZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=eAPCqDad3eib+irwWdn4c3jB6WrUBpvIqANM1/Xo8ds=; fh=+f7yQqUjTpEo4SoJZ7TwppYvEFVMXtL8uqvcJYbnGWQ=; b=pPivOVZiZbMetiw3xsDrzjBYi/AIFjAsUKdj6JN5mMO7e6BZgxHvJtOWDaIkvcFwL4 DL/SMQVktifWcDJQONQltDz9oi6ezC3SicjZfFzu5fVnTdMF0ajeoxfcTGCXSiYokVLT rX2mMFWKRdiWm9BYPb2a4BfNyliq3ZLGDOzF1yFF1L23sZkPjWVvMMmVeOsqXPRmGOEJ PfN/GaaCeCPil1tHFq86wn9L6oKRVAkY4I75DRJERdFej0a+HjvMTUqoRFUMMpgHwElh vyLKhJyPFXzpn65gqJKzlfmmvJj1PEf64q0zZownAseq+hfs0Trpq1OCiHotXxHbxnRO 1DKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pSTQvwDE; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-103485-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id it23-20020a056a00459700b006e6a13dee2dsi1612370pfb.116.2024.03.14.08.26.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 08:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103485-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pSTQvwDE; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-103485-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4030B283E93 for ; Thu, 14 Mar 2024 15:26:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4E4674E37; Thu, 14 Mar 2024 15:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pSTQvwDE" Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2702A74C1B for ; Thu, 14 Mar 2024 15:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710429893; cv=none; b=pGn8ctpVSx+lr2LD0mq2LEtsl69W/OLOjuO6q3uKvOvoU1izQ7MCqhL1nMA9WhJGj9//i81FQwqhYw8Aaznbs0euYEv2+By7VY+jzPie9qQE9ofNswCZmr8PcVJJ2GcUavSna1gUtH0CmRFyrMxDDhYr7031HQDIal/GwiEG9KQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710429893; c=relaxed/simple; bh=hHeQESdb2n2JfoPbQGhczuNq7aes0p4VCwzYiQEpxZY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MGMGif9DEvwGzYbmdsQ0wXG0VE8i57RuTsxPZoKjFbY9bUYVBn2FR7oCM6Vx2yN3o/gencLrK3bMPcxvY5FYlTNLJGaQLrVDppCm5j+DOYRFGb+wYh5o/ZFvCcKuilTO1c8SBe1ULjgHYlbPJ8Axq0FcBFnFksy5PrwKTgn8n7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pSTQvwDE; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-221a37a29f5so488547fac.3 for ; Thu, 14 Mar 2024 08:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710429891; x=1711034691; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eAPCqDad3eib+irwWdn4c3jB6WrUBpvIqANM1/Xo8ds=; b=pSTQvwDESdYVRTDMINy4anraTmpdArHxuraiOMTwiou3GEuFPUjbxgW/aCG65vQks6 0X4kmqu9kMHL9Eo1Do77T9HRG7tbtc1v1x50zK26302MFxnRGSZjdjyo6lk3awCp/hs7 Ej/K/CRmyblvPuKOdyILgVbcyiTLbe0GU+UC9ukRZz0YTNMcrEpRsgQLiUVIng2EsdfW xFr/zQG0CXjciJ62oXIdUJjtNux6dc4RxhWoWpwdfP5sIuHoPRFv/D6pmX6wFE16AE7S KhJ38Nu7m2Zkg9SPz45se66uHytNP94fFwSR/yG7dGY/Md6vdeSqvu+mXAzDfhF+jPdc ck8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710429891; x=1711034691; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eAPCqDad3eib+irwWdn4c3jB6WrUBpvIqANM1/Xo8ds=; b=IHBNUiAe7Iq106x9WzDQiBTaWb+pL2HjRn7Z9XWoEeHK5qOEFrHNHsEFeARiacjlRM AKDvDKgORGexyOuOvWL5WP2aJgtzc0rwAHf6/GJH20+KDrUsutAWT9hnfsZKSeTiZ4Qx FxA3OGhwKJ4qHncPFV6Elz3fZi+yU/eFtst0K+p2sXGqEYU3idfv4AzBQEuJ5Dep1cHC cX5yXoblE47ZlhZjdzuzCEWM3+O+yjv+GMAAAFT3HzrLahEzNTomwFBkyj0qAOhUb1tY +Pp+1NcM5g4Xgm73SKlKsdqZJ2pK0q9954+ZHmsNPUzNM3bMS8SY+I9zF4uifPzep8lj kDcQ== X-Forwarded-Encrypted: i=1; AJvYcCWg//uR/V9sGfR6JORJg2Dpj5CeZAe+Gdl9p3x7qxhCepeLc83+4hIjZmu+c8We5x4urzCTHgUaz9ii6+im8SkTM50aBCde+Kcdxgli X-Gm-Message-State: AOJu0YxGw+S6mCDJMQkx+dRFInvGmM2NbGAYUYoD5OYecLSDQp5wQEqN qN4DEEYik0wpyO2kHPMRU0ZqXrD/GFWTYEahVh9ecFV61pQEhKuWkea3qaU92g== X-Received: by 2002:a05:6870:64a5:b0:21f:d173:4f19 with SMTP id cz37-20020a05687064a500b0021fd1734f19mr2087318oab.40.1710429891056; Thu, 14 Mar 2024 08:24:51 -0700 (PDT) Received: from [127.0.1.1] ([117.207.30.211]) by smtp.gmail.com with ESMTPSA id m4-20020a63ed44000000b005e438ea2a5asm824021pgk.53.2024.03.14.08.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 08:24:50 -0700 (PDT) From: Manivannan Sadhasivam Date: Thu, 14 Mar 2024 20:53:49 +0530 Subject: [PATCH 10/11] PCI: qcom-ep: Rework {start/stop}_link() callbacks implementation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240314-pci-epf-rework-v1-10-6134e6c1d491@linaro.org> References: <20240314-pci-epf-rework-v1-0-6134e6c1d491@linaro.org> In-Reply-To: <20240314-pci-epf-rework-v1-0-6134e6c1d491@linaro.org> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter , Jingoo Han , Gustavo Pimentel Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, mhi@lists.linux.dev, linux-tegra@vger.kernel.org, Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2908; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=hHeQESdb2n2JfoPbQGhczuNq7aes0p4VCwzYiQEpxZY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl8xaQfg97viBuOIgmUL62KebaBZQIQNgdeCdUj aCgxk36waWJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZfMWkAAKCRBVnxHm/pHO 9dH/B/93GdKJANpOSa22x4XiYazPXmYMSF7FXM0F0/rb0MhOjtc62toq2EEl6mi3yPtj3T/Gz5j ea1MwxgLD8daifKkQZmj1ZyR6luJ4Xar+fQFq3jcSvB+S2TDdgPmHA/dMtCYUBnO415ZZlEgxyi kn5bs1s2wkckx37TU65QJHX+Hffu/kuodZSw+zYUvnLwSEfkbw4xXUjuySbTnVVoR1pa6TuQT4M eLFMtcYj4maR+1bcv7bSGm9KXeJWHl3j7igzlknj4moBwRwE4UBQlVAxbhSIlsh9ObXdfhE12c0 tZAkWrM06kPRlEbBYazKyTQ6wbkB+Vfid8ikgvuzgVrcUsdR X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 DWC specific start_link() and stop_link() callbacks are supposed to start and stop the link training of the PCIe bus. But the current implementation of this driver enables/disables the PERST# IRQ. Even though this is not causing any issues, this creates inconsistency among the controller drivers. So for the sake of consistency, let's just start/stop the link training in these callbacks. Also, PERST# IRQ is now enabled from the start itself, thus allowing the controller driver to initialize the registers when PERST# gets deasserted without waiting for the user intervention though configfs. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-qcom-ep.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c index 811f250e967a..653e4ace0a07 100644 --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c @@ -122,6 +122,9 @@ /* PARF_CFG_BITS register fields */ #define PARF_CFG_BITS_REQ_EXIT_L1SS_MSI_LTR_EN BIT(1) +/* PARF_LTSSM register fields */ +#define LTSSM_EN BIT(8) + /* ELBI registers */ #define ELBI_SYS_STTS 0x08 #define ELBI_CS2_ENABLE 0xa4 @@ -250,8 +253,12 @@ static int qcom_pcie_dw_link_up(struct dw_pcie *pci) static int qcom_pcie_dw_start_link(struct dw_pcie *pci) { struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci); + u32 val; - enable_irq(pcie_ep->perst_irq); + /* Enable LTSSM */ + val = readl_relaxed(pcie_ep->parf + PARF_LTSSM); + val |= LTSSM_EN; + writel_relaxed(val, pcie_ep->parf + PARF_LTSSM); return 0; } @@ -259,8 +266,12 @@ static int qcom_pcie_dw_start_link(struct dw_pcie *pci) static void qcom_pcie_dw_stop_link(struct dw_pcie *pci) { struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci); + u32 val; - disable_irq(pcie_ep->perst_irq); + /* Disable LTSSM */ + val = readl_relaxed(pcie_ep->parf + PARF_LTSSM); + val &= ~LTSSM_EN; + writel_relaxed(val, pcie_ep->parf + PARF_LTSSM); } static void qcom_pcie_dw_write_dbi2(struct dw_pcie *pci, void __iomem *base, @@ -484,11 +495,6 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci) dw_pcie_ep_init_notify(&pcie_ep->pci.ep); - /* Enable LTSSM */ - val = readl_relaxed(pcie_ep->parf + PARF_LTSSM); - val |= BIT(8); - writel_relaxed(val, pcie_ep->parf + PARF_LTSSM); - return 0; err_disable_resources: @@ -707,7 +713,6 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev, } pcie_ep->perst_irq = gpiod_to_irq(pcie_ep->reset); - irq_set_status_flags(pcie_ep->perst_irq, IRQ_NOAUTOEN); ret = devm_request_threaded_irq(&pdev->dev, pcie_ep->perst_irq, NULL, qcom_pcie_ep_perst_irq_thread, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, -- 2.25.1