From patchwork Sat Feb 24 06:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 205779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1020892dyb; Fri, 23 Feb 2024 22:56:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVL79vpwT5ZIQzUPwt7SDi3KTNfU41t6p5OZr8Cp3GCljuvaB5ocVnEWFmNyJNTynV1Dk5u4Va1EJ2m8CkDXERmWGhIyg== X-Google-Smtp-Source: AGHT+IHvCI/+r3srJgRl5EdZz89RC6Y1z2JsMtcWMtvzYTPDHVyE09yDZ7do2QLjHgdtdqLQrpvK X-Received: by 2002:a17:902:d512:b0:1d9:a4bb:29f2 with SMTP id b18-20020a170902d51200b001d9a4bb29f2mr2011630plg.46.1708757800525; Fri, 23 Feb 2024 22:56:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708757800; cv=pass; d=google.com; s=arc-20160816; b=q/iF1wggitYqUyaHAT7JuMgrz1UXCZV3YIdt630ytk43P9kusycnTzZtUo1UDVAd/Q 1Gti4KJO/8KMrni5uajsbfd0yUHOYP+0rV/NUbyhD3T66kgYZzSbRqhN6NGtiGEs7WMW nuJ3XFhPiEC4TtB+b5a5k/s984q51q6UuEft944CAN5kx9oyTlqbXV8fRSWNKDtQDWzv cjWvNlfIIiM7DWaPm9mP6nXlbCGfJwJ01OPkdFmgvOPPIdw98F4L+No+JNFIRpE1fJvX w8hL/lYt4pMqS5BxnXtvInLecqslzaxyf1Aftpx6mjom31UEtHYa8SRXEhsvQooaajyL b+Kg== 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=rvfF4g98Ijo6m++nuM1DbtNbeUYHGhnhy9JXPPe6Ez0=; fh=Q/6Mk3w9hWV6jiIaq8yvXbVm/C54DqDOh/irveZ39iU=; b=0gJLGVAml97gwalRuz61Tds1EpB9WiQMI1MoDNd4PHwQ5TPMSm+pLLMbXKxaJGIlW7 4QOCM1LNI9oWu9Kze/0TzM6WGMSdUGAvRowmnn2IMQYtzoIyUNUalHWk8Lndyr8PS2P4 FHdiT0M0/rYln5fZR4DkbHREa+3PDy5gugvXOrFmwkzZaWvHb79j0NGwZ8lKM8W7glsC 2dndWqNRvAAO96sMciLgdUUmNlrlU7v8up93JpAjv/KeJ9+mbWphxvFyvpNzYY2eqbe0 qlKSRWoeODFD3U0Hg7pZrHEbdW0uZbl49dHXXznbf+yypkGOA2hm4ZLg1FIvnTgGKnq2 qtWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VxnPIxT6; 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-79490-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79490-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s17-20020a17090302d100b001dc67d1c03dsi437455plk.298.2024.02.23.22.56.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 22:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79490-ouuuleilei=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=VxnPIxT6; 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-79490-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79490-ouuuleilei=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 5547B2823AF for ; Sat, 24 Feb 2024 06:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0139E21364; Sat, 24 Feb 2024 06:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VxnPIxT6" Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 2EE3E1EA78 for ; Sat, 24 Feb 2024 06:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708757719; cv=none; b=g/7LVwpJK3OmbEDD9To3j+0HQfwnTz11lp80SXqCXsb0VOTJh18ax+rNC/V1DA/IoyJ+M6P/n1/NyT1DYShDvHtwZlxVR7K28foyMLupPilKr8xKzwQcFWVkdn1FZJp1EIV4mtpL+V4HE/1OjpomRgqiNazklnBmUlDS18BFYB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708757719; c=relaxed/simple; bh=vGTtKxV9OKY08fPKN8YLUvUySfkvvZ/ZCA5S4DEJbe0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F7ebVveDyXCiQrWsPWbnUvOFo8A4a4NScoVPdBoXItH5IxoVGKjtNRoO7Dten0Q8EmWlXPmzISFf7wv5WRqvX7jOGaKfPlkIEW0QHCykHT8wF7tDw3iasH8pzDzkCExtJhNGPjlOelNusS7Nr9ejte+fq6YhBq8lK3zpxenb1D4= 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=VxnPIxT6; arc=none smtp.client-ip=209.85.161.44 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-oo1-f44.google.com with SMTP id 006d021491bc7-59fdcf8ebbcso668312eaf.3 for ; Fri, 23 Feb 2024 22:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708757717; x=1709362517; 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=rvfF4g98Ijo6m++nuM1DbtNbeUYHGhnhy9JXPPe6Ez0=; b=VxnPIxT6XmPEcmC6oIQ10FncfQMGAO9JKmy2yOEWHrDFSgDx9OOvfczLYNdMHypov3 58Mdb2iLE/tER2OKT04Jy3xMCCQ/MNNJpg8XpLbVk519x0KwvqThdLPzYWzix0QDuUKe ygh6vgU5hKZltddP0rgmm7X9rhF3+oNRiURlOz/y1WDyxtCY29XhDbQphwqqqIcZwoMG KfZ/WUI4dU6XKkuKxbNRHTYIiJoEHtjRuy2GFYxZuGvoi+hNkVydE80euTg+JAUaZ70F TkxU7vVxk7sHDgdozwhyb5H8+OAa7pBrg2w7b0IUml0hyKxosrykI7DPLBbuQUT+NEmx n17A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708757717; x=1709362517; 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=rvfF4g98Ijo6m++nuM1DbtNbeUYHGhnhy9JXPPe6Ez0=; b=s0HshaNQLAXYgdHTJpVZ50mULhAIB8qCnKdYBsqoi2kZeOkQIwTSY+pqwQdTF7AcRZ //oQVbGWLBxIL5mLigVzrM00Ij5vBtEd47BP4mpcMF/aX7B3opvoxckAhODvOfYaFbIu 7uo0rCZllJch++21q0hTiyMS1nA8zlqS6wbgRRzQuxJl6F7C1UV7bjbkcgsTqOpb3Tb6 n+Wgs7y4UK5If6qYvCPdmhCCXbe/t4sQ82wcglLNmiprEYtUuecRZ1qltwfRnu9P0G3h xlgKQ/hmcfBczLBlSz21gGJQQTsxVk1RWM1RTRTmqNn1y6mPqA4mGXKZNA7s6qi8168J RSKg== X-Forwarded-Encrypted: i=1; AJvYcCU6DtItTIVzf69E8y5N/REoFbpLXPjFpeRN3Bv9Ej193EznZzW549R/pb8msK97k7lUCyfQgSu3F4w1BPgISb9xjNvdRemE9ynaiRGt X-Gm-Message-State: AOJu0YzdUnheuHOklabEpqxyczDmIPxottUj+v8lOeMIt+rv2Pn02ery MpJxptrF5X6UpOU8bmBw7Fq57H0IxFhUtwX5jfA2XfRTNNXP6Dyr9FSz8wQO/Q== X-Received: by 2002:a05:6358:6422:b0:178:b97c:f087 with SMTP id f34-20020a056358642200b00178b97cf087mr2428706rwh.15.1708757716797; Fri, 23 Feb 2024 22:55:16 -0800 (PST) Received: from [127.0.1.1] ([120.138.12.46]) by smtp.gmail.com with ESMTPSA id r5-20020aa78b85000000b006e4cb7f4393sm502932pfd.165.2024.02.23.22.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 22:55:16 -0800 (PST) From: Manivannan Sadhasivam Date: Sat, 24 Feb 2024 12:24:12 +0530 Subject: [PATCH v8 06/10] PCI: dwc: ep: Call dw_pcie_ep_init_registers() API directly from all glue drivers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240224-pci-dbi-rework-v8-6-64c7fd0cfe64@linaro.org> References: <20240224-pci-dbi-rework-v8-0-64c7fd0cfe64@linaro.org> In-Reply-To: <20240224-pci-dbi-rework-v8-0-64c7fd0cfe64@linaro.org> To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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 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 , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=8046; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=vGTtKxV9OKY08fPKN8YLUvUySfkvvZ/ZCA5S4DEJbe0=; b=owGbwMvMwMUYOl/w2b+J574ynlZLYki9OWl6sFuATXiG5k9FVta9Fq6vpy27dVpEOj4mdJPnH 1W20HK7TkZjFgZGLgZZMUWW9KXOWo0ep28siVCfDjOIlQlkCgMXpwBM5HsJ+/9CIWOv3D6p+Tlr jf+rSlXO2GjUx/JaJ2uDcowzb5/kc4cnLNMEzrXsWiwV6fg6NPkR2/nge3zd6YLsH9QLDd4G/Re trT+d5XfB6kbysXNPfEvzbjOEbBFUPXHTpTQzoHu2QYvxaZNjC1vsZ7q2fih8axagkdSkOuOZ6v qOhKQd+wVPBhu/nMDG03TQvOqs1olWh5LTvUuOyu4y/BA9yVzh9ELVRfN75jV+cOtL/qzKHuDtc 1/mdvHxikkczwy4j8c8FtpcFy2UtFJnAyvDxulnYx8FVNXNs+7rlNyU/e9vcrmLU8E/c1OJeRuF FvT9sLow0TndIT15mp6786XLgov4jjBwf9Jn+dRT8SkbAA== X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791762419608084059 X-GMAIL-MSGID: 1791762419608084059 Currently, dw_pcie_ep_init_registers() API is directly called by the glue drivers requiring active refclk from host. But for the other drivers, it is getting called implicitly by dw_pcie_ep_init(). This is due to the fact that this API initializes DWC EP specific registers and that requires an active refclk (either from host or generated locally by endpoint itsef). But, this causes a discrepancy among the glue drivers. So to avoid this confusion, let's call this API directly from all glue drivers irrespective of refclk dependency. Only difference here is that the drivers requiring refclk from host will call this API only after the refclk is received and other drivers without refclk dependency will call this API right after dw_pcie_ep_init(). This change will also allow us to remove the "core_init_notifier" flag in the later commits. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pci-dra7xx.c | 7 +++++++ drivers/pci/controller/dwc/pci-imx6.c | 8 ++++++++ drivers/pci/controller/dwc/pci-keystone.c | 9 +++++++++ drivers/pci/controller/dwc/pci-layerscape-ep.c | 7 +++++++ drivers/pci/controller/dwc/pcie-designware-ep.c | 22 ---------------------- drivers/pci/controller/dwc/pcie-designware-plat.c | 9 +++++++++ drivers/pci/controller/dwc/pcie-rcar-gen4.c | 12 +++++++++++- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 13 ++++++++++++- 8 files changed, 63 insertions(+), 24 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index 0e406677060d..395042b29ffc 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c @@ -467,6 +467,13 @@ static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx, return ret; } + ret = dw_pcie_ep_init_registers(ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(ep); + return ret; + } + return 0; } diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index dc2c036ab28c..bfcafa440ddb 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1136,6 +1136,14 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, dev_err(dev, "failed to initialize endpoint\n"); return ret; } + + ret = dw_pcie_ep_init_registers(ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(ep); + return ret; + } + /* Start LTSSM. */ imx6_pcie_ltssm_enable(dev); diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index c0c62533a3f1..8392894ed286 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -1286,6 +1286,13 @@ static int ks_pcie_probe(struct platform_device *pdev) ret = dw_pcie_ep_init(&pci->ep); if (ret < 0) goto err_get_sync; + + ret = dw_pcie_ep_init_registers(&pci->ep); + if (ret < 0) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + goto err_ep_init; + } + break; default: dev_err(dev, "INVALID device type %d\n", mode); @@ -1295,6 +1302,8 @@ static int ks_pcie_probe(struct platform_device *pdev) return 0; +err_ep_init: + dw_pcie_ep_deinit(&pci->ep); err_get_sync: pm_runtime_put(dev); pm_runtime_disable(dev); diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c index 2e398494e7c0..b712fdd06549 100644 --- a/drivers/pci/controller/dwc/pci-layerscape-ep.c +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c @@ -276,6 +276,13 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev) if (ret) return ret; + ret = dw_pcie_ep_init_registers(&pci->ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(&pci->ep); + return ret; + } + return ls_pcie_ep_interrupt_init(pcie, pdev); } diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index ed1f2afd830a..278bdc9b2269 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -729,7 +729,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) struct device *dev = pci->dev; struct platform_device *pdev = to_platform_device(dev); struct device_node *np = dev->of_node; - const struct pci_epc_features *epc_features; INIT_LIST_HEAD(&ep->func_list); @@ -775,29 +774,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) goto err_exit_epc_mem; } - if (ep->ops->get_features) { - epc_features = ep->ops->get_features(ep); - if (epc_features->core_init_notifier) - return 0; - } - - /* - * NOTE:- Avoid accessing the hardware (Ex:- DBI space) before this - * step as platforms that implement 'core_init_notifier' feature may - * not have the hardware ready (i.e. core initialized) for access - * (Ex: tegra194). Any hardware access on such platforms result - * in system hang. - */ - ret = dw_pcie_ep_init_registers(ep); - if (ret) - goto err_free_epc_mem; - return 0; -err_free_epc_mem: - pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem, - epc->mem->window.page_size); - err_exit_epc_mem: pci_epc_mem_exit(epc); diff --git a/drivers/pci/controller/dwc/pcie-designware-plat.c b/drivers/pci/controller/dwc/pcie-designware-plat.c index 778588b4be70..ca9b22e654cd 100644 --- a/drivers/pci/controller/dwc/pcie-designware-plat.c +++ b/drivers/pci/controller/dwc/pcie-designware-plat.c @@ -145,6 +145,15 @@ static int dw_plat_pcie_probe(struct platform_device *pdev) pci->ep.ops = &pcie_ep_ops; ret = dw_pcie_ep_init(&pci->ep); + if (ret) + return ret; + + ret = dw_pcie_ep_init_registers(&pci->ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(&pci->ep); + } + break; default: dev_err(dev, "INVALID device type %d\n", dw_plat_pcie->mode); diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c index 9d9d22e367bb..fb7c03639a53 100644 --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c @@ -414,6 +414,7 @@ static const struct dw_pcie_ep_ops pcie_ep_ops = { static int rcar_gen4_add_dw_pcie_ep(struct rcar_gen4_pcie *rcar) { struct dw_pcie_ep *ep = &rcar->dw.ep; + struct device *dev = rcar->dw.dev; int ret; if (!IS_ENABLED(CONFIG_PCIE_RCAR_GEN4_EP)) @@ -422,8 +423,17 @@ static int rcar_gen4_add_dw_pcie_ep(struct rcar_gen4_pcie *rcar) ep->ops = &pcie_ep_ops; ret = dw_pcie_ep_init(ep); - if (ret) + if (ret) { rcar_gen4_pcie_ep_deinit(rcar); + return ret; + } + + ret = dw_pcie_ep_init_registers(ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(ep); + rcar_gen4_pcie_ep_deinit(rcar); + } return ret; } diff --git a/drivers/pci/controller/dwc/pcie-uniphier-ep.c b/drivers/pci/controller/dwc/pcie-uniphier-ep.c index 3fced0d3e851..82ccaea089be 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier-ep.c +++ b/drivers/pci/controller/dwc/pcie-uniphier-ep.c @@ -399,7 +399,18 @@ static int uniphier_pcie_ep_probe(struct platform_device *pdev) return ret; priv->pci.ep.ops = &uniphier_pcie_ep_ops; - return dw_pcie_ep_init(&priv->pci.ep); + ret = dw_pcie_ep_init(&priv->pci.ep); + if (ret) + return ret; + + ret = dw_pcie_ep_init_registers(&priv->pci.ep); + if (ret) { + dev_err(dev, "Failed to initialize DWC endpoint registers\n"); + dw_pcie_ep_deinit(&priv->pci.ep); + return ret; + } + + return 0; } static const struct uniphier_pcie_ep_soc_data uniphier_pro5_data = {