Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp224210lqk; Thu, 14 Mar 2024 00:48:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4fiKqXxjwYlzhwQJDMulJQOvFPLaVbxD7ikjC1yfmT7409m69PX5Yl+X8GdhHlDC4ZQVBLP1TQ9ut3EvZLdjzuVy1cZqPajvYn0vtZQ== X-Google-Smtp-Source: AGHT+IEPkIFpdU0PQuxgnx+SwgN2YEomkYDjF+MwwyOwbFQY1LElVw1XZMoxnExzy/6jAWPs6GJg X-Received: by 2002:a05:651c:620:b0:2d2:7781:3842 with SMTP id k32-20020a05651c062000b002d277813842mr524263lje.38.1710402526516; Thu, 14 Mar 2024 00:48:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710402526; cv=pass; d=google.com; s=arc-20160816; b=QUOt5GfY+5S6BNd8rAV3Q9uWAligRXthwgFVR+OKhKtiEIfuW/3CFEiOONe2HOCo1n t2rryVVx/kpiXx69JwTd5CZSreDZa75JmR+G29tKUgQSebt09KlyENxkg0izRXvsyb6O bKAOAZ5jXYclj/Vxa3TPeUGND3WiChQMPY6k9dFn0f9ugSScuzafPl6x3KoV/lZt4Rsm xydV3+fT6CDC8Q64xP8znsbaN9dFgXJY73xLPmZ2OYLAnWIAEz6QW4K81IiYooFdE9rA 70129gYGrvWp5eT1v7JmfRG3Vdk6xXAb0sm4NGecM/0PS8kwSeBjd19OqaUBhdCi84Qx Ec4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=oyf14pBAhDhhFGrYWiT4/jCBlK7mnjlUhjZRxVjfPSE=; fh=msy9qfefdD6ueh2hffhccqW6YWFpZcig7K2kMya0S+w=; b=JndcQaCLbSDMrlDVmY5anYSRrI6QFLXpgXeAAwyJS7OrBIvo+//ySvwptJ08SjQOsF ve79fQXp/yoz3TetTGhqlZGl4kslzEHonNrSida21GLTm2LlX8oDsplkHJaR5txg8DVU oe2VquJh4C/4+04rtc2e14x/6QTykwP4TGGKrp9umuhoisGTWwV9A6ml8VxH3YCC6Bhk T35WlxKGo0eIzxBkTxQjhWjkvQDUXv6Z4GeI+UWokRUxQuzO+fiB2XAp5iZnG3qnEXIo cvtiRAYS8xRDiNn8Z4XgT+xUj0iZInOehSlLdUIRez0A0pIjKApjDIj3SFKlHoLYZknh 37bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aZNrEm+n; 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-102939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r7-20020a056402234700b0056783334ba7si483003eda.18.2024.03.14.00.48.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 00:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aZNrEm+n; 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-102939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102939-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 092211F244D9 for ; Thu, 14 Mar 2024 07:48:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72A715D477; Thu, 14 Mar 2024 07:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aZNrEm+n" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 68BF05CDD0 for ; Thu, 14 Mar 2024 07:48:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710402513; cv=none; b=fkXb/NLyxn7F4xokKuQP1bGWE7tOuh1GUUkugLfxxygU3PyFz+kzwkDswZoD4V5BliPJFpEmaroLwhh7pe+ydqktmigYCHa1m7O0pB3dFhN+yVH3E+8phtMdPkLBVHZJ3sAf/aEJBl2X/pujbeE6bQJisQ+ckcgoV9k5e8IoUkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710402513; c=relaxed/simple; bh=CggBA8aNWTDzfwGQGM+X6nkpKcrObdtq1F7g5VVbJk4=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=nqa04GBSV3EdVJpSz36gNwQNSUPgyQxUZc8udJ3zQlZQkF9zIexw4MoLgHk4QBXrMl/lMDIyryU9G82Q5WMMvSQJ9Y6ggglbCSkT1Cb5VYsM94pb8rGahog5pMFwf1T6wZ1dgrGEt56Ujw0Vy3dd9YTNaPIdJHqz67Od3h7tKds= 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=aZNrEm+n; arc=none smtp.client-ip=209.85.214.181 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-pl1-f181.google.com with SMTP id d9443c01a7336-1dd81aee2b4so6564665ad.0 for ; Thu, 14 Mar 2024 00:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710402510; x=1711007310; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=oyf14pBAhDhhFGrYWiT4/jCBlK7mnjlUhjZRxVjfPSE=; b=aZNrEm+njgLaf46bSubmYf7zVZQVcbIpoG3t49yaxqFhXbR4DJu4YOc0Hr++V7XYVv ct52MUrZaAlT4XqikqxIg7j6uH+z2NSJq2D8wW373xU3q2BDlwGXfZCPWgUxAZLUL90x eu5BltD3u8x+CVqJP1p/UF2WzVC/huBuuGSGBuc3BAFEC5zYjY/OtHC/+BVWtNUoF/St Jx+d7Nfln5nE++PNeGephPLo1CzSG2WvGlBY2NlXqgeLrrbyc+DGqRKC/uJ8N0p8q66z pB7RWcdLFo3221tkNGUbIcmy92SNV3Ukc/0KzRkdKAHc4aKAlP+TijQfuByvT0g5Ho3h jIPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710402510; x=1711007310; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oyf14pBAhDhhFGrYWiT4/jCBlK7mnjlUhjZRxVjfPSE=; b=BQaWaJh3dWTJaIHfnastnDtOIDzwxEqMkPlk/koWVZouQ5ok5l/DCjwVPyzVqfZOwx NylpcjeK8eQjhkWz+mi3b2FQ6mGXJ1fDQ58sRM33WmE4cxVtoYCpLKMnCnvefL5j5qGY uwwCuepCGPxdaX7YsFnEXFbvGgngXZUHmwPOxNV5SkDSMpWdodpo8BmN4yRrEqdl0T3U sQPDRt3zMGu9KQWoiFwQ1SyOtympOARWWalNgClesGkDnhtQKjaHiO9NaV5cPsHzNAAA 7KaKyLWa7bXRcm3vyoGjXPFg3F23iZ/ZZFZ7diD1/acGg+ArPTZQcw9LLY3Z7+i5r3Sq rhmA== X-Forwarded-Encrypted: i=1; AJvYcCXP86UkRrsLrR2Z/FJCXpfE2AFDOMmcrboc0Bu2IjQgrVntsGZ0T8TCZfTK0hYkVR5HNK/e8/jfW6oCcw4uH2z85L8F98GhYhmxOFMe X-Gm-Message-State: AOJu0YxAFoGcjbluAQ/b99Y+V7VbY6akOeZNZBkDAHjJ5FQZfXTkGo89 1CvfN301sQS2Kh6p3v9RxLhCxYXm3DNfmZLICDdk41F/uo/bxdugq8zau66/QQ== X-Received: by 2002:a17:902:ea11:b0:1dc:b003:ed7a with SMTP id s17-20020a170902ea1100b001dcb003ed7amr1318928plg.5.1710402509983; Thu, 14 Mar 2024 00:48:29 -0700 (PDT) Received: from [127.0.1.1] ([117.207.30.211]) by smtp.gmail.com with ESMTPSA id l9-20020a170903120900b001dd4fabf695sm946321plh.38.2024.03.14.00.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 00:48:29 -0700 (PDT) From: Manivannan Sadhasivam Subject: [PATCH v10 0/8] PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host Date: Thu, 14 Mar 2024 13:17:58 +0530 Message-Id: <20240314-pci-dbi-rework-v10-0-14a45c5a938e@linaro.org> 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 X-B4-Tracking: v=1; b=H4sIAK+r8mUC/3WNQQrCMBBFryJZG4lJqB1X3kNcpMm0HZSmTCQqp Xc37UZEXL4P7/1JJGTCJI6bSTBmShSHAnu13Qjfu6FDSaEMQittldZWjp5kaEgyPiJfZaMRwFU ajPKiSCNjS8+1eL4U7indI7/Wg1wv699UrqWSlfWHNijfYmVPNxocx13kTiytDB/fqF8fiq8hW GMCgA/uy5/n+Q1fJbfg7gAAAA== To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Niklas Cassel , linux-arm-kernel@axis.com, Manivannan Sadhasivam , Frank Li X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5493; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=CggBA8aNWTDzfwGQGM+X6nkpKcrObdtq1F7g5VVbJk4=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl8qvCA+hbuErSsdUxYM/Lde4n06sZJbHaIBKNC 8nJfIS8fkmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZfKrwgAKCRBVnxHm/pHO 9VwoB/4/YSDH0OxycdTz+m+zTBwOkP9kDksqJ7fTZ8ohVBh+E6wqWXDKMNYO+ayZ8bcRM5gwWqO xVhFD/94EoJokvdBK00d5aAyiOh1MrIqbQrp8rZXXPKP5E50A3ldvsjpOsTrSEwM6l+xMhXXEDf Y57gm8cAqrLQaGwORGULOljxnq/C5MA+fvbaNms7Ta68l7azhsVM0DGHv22dJ1ScdDjLimyf0Pk Q5SNSDdLgKWRPY5ZgFuI49uJrQbXt1fnD5ieYR6nRx3lj8q2kyjjTa1gxTLRPyeEUyRaowCaCHY AV21rFKLO+7V3TlJtv+kWd8A+0dXYJyecRtGRp2UYwxTZPpx X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 Hello, This series is the continuation of previous work by Vidya Sagar [1] to fix the issues related to accessing DBI register space before completing the core initialization in some EP platforms like Tegra194/234 and Qcom EP. Since Vidya is busy, I took over the series based on his consent (off-list discussion). NOTE ==== Based on the comments received in v7 [2], I've heavily modified the series to fix several other issues reported by Bjorn and Niklas. One noticeable change is getting rid of the 'core_init_notifer' flag added to differentiate between glue drivers requiring refclk from host and drivers getting refclk locally. By getting rid of this flag, now both the DWC EP driver and the EPF drivers can use a single flow and need not distinguish between the glue drivers. We can also get rid of the 'link_up_notifier' flag in the future by following the same convention. Testing ======= I've tested the series on Qcom SM8450 based dev board that depends on refclk from host with EPF_MHI driver. It'd be good to test this series on platforms that generate refclk locally and also with EPF_TEST driver. - Mani [1] https://lore.kernel.org/linux-pci/20221013175712.7539-1-vidyas@nvidia.com/ [2] https://lore.kernel.org/linux-pci/20231120084014.108274-1-manivannan.sadhasivam@linaro.org/ Changes in v10: - Reordered the commits by moving the independent fixes/cleanups first (Niklas) - Addressed several comments from Niklas - Moved PTM register setting out of dw_pcie_ep_init_non_sticky_registers() (Niklas) - Addressed the issue that EPF drivers were missing init notification after the removal of core_init_notifier (Niklas) - Dropped a few cleanup patches to be clubbed with the follow up series - Collected review tags - Dropped the review tags for patch 8/8 as it got changed - Link to v9: https://lore.kernel.org/r/20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org Changes in v9: - Incorporated changes for missing drivers (Niklas) - Reworded the dw_pcie_ep_cleanup() API kdoc (Niklas) - Reworded the description of patch 6/10 (Frank) - Collected reviews - Link to v8: https://lore.kernel.org/r/20240224-pci-dbi-rework-v8-0-64c7fd0cfe64@linaro.org Changes in v8: - Rebased on top of v6.8-rc1 - Removed the deinit callback from struct dw_pcie_ep_ops - Renamed dw_pcie_ep_exit() to dw_pcie_ep_deinit() - Introduced dw_pcie_ep_cleanup() API for drivers supporting PERST# - Renamed dw_pcie_ep_init_complete() to dw_pcie_ep_init_registers() - Called dw_pcie_ep_init_registers() API directly from all glue drivers - Removed "core_init_notifier" flag - Added a generic dw_pcie_ep_linkdown() API to handle LINK_DOWN event and used it in qcom driver - Added Kernel-doc comments for DWC EP APIs Changes in v7: - Rebased on top of v6.7-rc1 - Kept the current dw_pcie_ep_init_complete() API instead of renaming it to dw_pcie_ep_init_late(), since changing the name causes a slight ambiguity. - Splitted the change that moves pci_epc_init_notify() inside dw_pcie_ep_init_notify() to help bisecting and also to avoid build issue. - Added a new patch that moves pci_epc_init_notify() inside dw_pcie_ep_init_notify(). - Took over the authorship and dropped the previous Ack as the patches are heavily modified. Changes in v6: - Rebased on top of pci/next (6e2fca71e187) - removed ep_init_late() callback as it is no longer necessary For previous changelog, please refer [1]. Signed-off-by: Manivannan Sadhasivam --- Manivannan Sadhasivam (8): PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk from host PCI: dwc: ep: Add Kernel-doc comments for APIs PCI: dwc: ep: Remove deinit() callback from struct dw_pcie_ep_ops PCI: dwc: ep: Rename dw_pcie_ep_exit() to dw_pcie_ep_deinit() PCI: dwc: ep: Introduce dw_pcie_ep_cleanup() API for drivers supporting PERST# PCI: dwc: ep: Rename dw_pcie_ep_init_complete() to dw_pcie_ep_init_registers() PCI: dwc: ep: Call dw_pcie_ep_init_registers() API directly from all glue drivers PCI: dwc: ep: Remove "core_init_notifier" flag drivers/pci/controller/dwc/pci-dra7xx.c | 9 + drivers/pci/controller/dwc/pci-imx6.c | 10 + drivers/pci/controller/dwc/pci-keystone.c | 11 + drivers/pci/controller/dwc/pci-layerscape-ep.c | 9 + drivers/pci/controller/dwc/pcie-artpec6.c | 15 +- drivers/pci/controller/dwc/pcie-designware-ep.c | 238 +++++++++++++++------- drivers/pci/controller/dwc/pcie-designware-plat.c | 11 + drivers/pci/controller/dwc/pcie-designware.h | 14 +- drivers/pci/controller/dwc/pcie-keembay.c | 18 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 28 ++- drivers/pci/controller/dwc/pcie-tegra194.c | 5 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 15 +- drivers/pci/endpoint/functions/pci-epf-test.c | 18 +- drivers/pci/endpoint/pci-ep-cfs.c | 9 + drivers/pci/endpoint/pci-epc-core.c | 22 ++ include/linux/pci-epc.h | 7 +- 17 files changed, 332 insertions(+), 111 deletions(-) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20240224-pci-dbi-rework-b2e99a62930c Best regards, -- Manivannan Sadhasivam