From patchwork Fri Aug 21 03:53:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 248053 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:d4c:0:0:0:0 with SMTP id h12csp4533ilj; Thu, 20 Aug 2020 20:55:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUO6rtj2KqJU9/iQQDHKz3fNMiMsJDRNbafWesweQTv/9yYHoW6VRQDuAdcEtBykhin8rU X-Received: by 2002:a17:906:7c46:: with SMTP id g6mr1027297ejp.178.1597982117679; Thu, 20 Aug 2020 20:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597982117; cv=none; d=google.com; s=arc-20160816; b=XdbYSMnTya9wf9xy6w0w3cHMmO7PWhnn2/0ieKlL6MSu7p/Av4RxCOCJjPLdGX1nFy B3PVVK6+g/KH+1nwO3XF+Uup0IzTJmjQqoTjTmMUBfgCuIjiFrsQpQm8/Lzoy/ptSj2q T2FV6rrexZbvQij8rMwzHAtwZYa9WpvmRiZelZk1S3dOg0Hk5w0XQD80n0BOwqSZ0hY4 OqfKwNYko7Z7nRRAyh8PifYh9fg6aPkhFryQqqW1J2OvDlsaJRmNUqTSJP7T40ueBYKA Ay6atPUBFkDvWE31SJqG2+C0ywsZwXsrc2fjGUtkGecLPj4+cAS+LCEHXPuGb0O0Xk2D GXPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EWe/hGwQkMqkRgfmf3CKztYtr/mVIP4aBkGHJDTxqi8=; b=P9tSIcj+JD/Zi5RtY6nJdlq7dpIQMaYYfxV52ENanOcIMvub/wUsh+4MyODZajOrmL 2awR+RzrDoxWoWL04V/7KEnZRl2BFGkgB8fCnKKAxaqPHls5R4Fz4KYlPgpZh0MttMBU nUV2q6M4IW+zf1LhcXLywsOLCn1F2CfC+zr8lvZJgV4gHULaVmahvsSu5c04KK4dviq3 Ky6LN3wMdm+DjoXetSXvlXGCNT6qY+4sZJo+tSJp1eMLrqInHCx2Lltfs1FYYMd2Ks4f /nNE2+Uq0cbFKl/Gl4Ax1bo0p4aGvZg08+4FE8DX4zvlXECZWd/f76VW+cVzx5P7Cnw6 Mdpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si380194ejx.477.2020.08.20.20.55.17; Thu, 20 Aug 2020 20:55:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727924AbgHUDzP (ORCPT + 4 others); Thu, 20 Aug 2020 23:55:15 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:45465 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727909AbgHUDzN (ORCPT ); Thu, 20 Aug 2020 23:55:13 -0400 Received: by mail-io1-f65.google.com with SMTP id u126so451928iod.12; Thu, 20 Aug 2020 20:55:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EWe/hGwQkMqkRgfmf3CKztYtr/mVIP4aBkGHJDTxqi8=; b=BpCGu8UZb2A6pC5Ws2lrjA8S8ULqQzFxLMsY/+XxHK644TLSue9uVYTRpCI7C+yo53 9sHsSs02DiVq5yt4p1tA+fxjyZFqMsUXug1aXuzmQbn8eSkXOhMRZzYryyqmsTewxP/z IY6EZ54MfoVmTdABSb7ggB6PzEVsGxtOzB0hXzswskoSp0jZ20r2nw0/fY0WF9wCuuWg 0dO9atALUc9weQ7flEPjDexJhy6hbknoH0HoYTWYulcs0LGkWYNuwO1z4wmaR/vyhShm tBXq78L6ao+pARnTAI50McykVv2xvbjOgx+ELUAMgiyzhvpj7y5uSLqBTzB9HDccFd8h oaeg== X-Gm-Message-State: AOAM531xgzPUS2wUZol+17y9V4C5AaXAthvTKQiCNnUZ5gk0QzlFi+SS BW1StcZ3FDdSXbhUAatFng== X-Received: by 2002:a05:6638:2515:: with SMTP id v21mr824983jat.109.1597982111917; Thu, 20 Aug 2020 20:55:11 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.249]) by smtp.googlemail.com with ESMTPSA id 79sm413923ilc.9.2020.08.20.20.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 20:55:11 -0700 (PDT) From: Rob Herring To: Bjorn Helgaas , Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, Andy Gross , Binghui Wang , Bjorn Andersson , Dilip Kota , Fabio Estevam , Gustavo Pimentel , Jerome Brunet , Jesper Nilsson , Jingoo Han , Jonathan Chocron , Jonathan Hunter , Kevin Hilman , Kishon Vijay Abraham I , Krzysztof Kozlowski , Kukjin Kim , Kunihiko Hayashi , Lucas Stach , Martin Blumenstingl , Masahiro Yamada , Murali Karicheri , Neil Armstrong , NXP Linux Team , Pengutronix Kernel Team , Pratyush Anand , Richard Zhu , Sascha Hauer , Shawn Guo , Shawn Guo , Stanimir Varbanov , Thierry Reding , Xiaowei Song , Yue Wang , Marc Zyngier , linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 10/40] PCI: dwc: exynos: Use pci_ops for root config space accessors Date: Thu, 20 Aug 2020 21:53:50 -0600 Message-Id: <20200821035420.380495-11-robh@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821035420.380495-1-robh@kernel.org> References: <20200821035420.380495-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Now that DWC drivers can setup their own pci_ops for the root and child buses, convert the Samsung Exynos driver to use the standard pci_ops for root bus config accesses. Cc: Jingoo Han Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Kukjin Kim Cc: Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org Signed-off-by: Rob Herring --- drivers/pci/controller/dwc/pci-exynos.c | 45 ++++++++++++++----------- 1 file changed, 25 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index 8d82c43ae299..242683cde04a 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -336,32 +336,37 @@ static void exynos_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, exynos_pcie_sideband_dbi_w_mode(ep, false); } -static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, - u32 *val) +static int exynos_pcie_rd_own_conf(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 *val) { - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct exynos_pcie *ep = to_exynos_pcie(pci); - int ret; + struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata); - exynos_pcie_sideband_dbi_r_mode(ep, true); - ret = dw_pcie_read(pci->dbi_base + where, size, val); - exynos_pcie_sideband_dbi_r_mode(ep, false); - return ret; + if (PCI_SLOT(devfn)) { + *val = ~0; + return PCIBIOS_DEVICE_NOT_FOUND; + } + + *val = dw_pcie_read_dbi(pci, where, size); + return PCIBIOS_SUCCESSFUL; } -static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size, - u32 val) +static int exynos_pcie_wr_own_conf(struct pci_bus *bus, unsigned int devfn, + int where, int size, u32 val) { - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct exynos_pcie *ep = to_exynos_pcie(pci); - int ret; + struct dw_pcie *pci = to_dw_pcie_from_pp(bus->sysdata); - exynos_pcie_sideband_dbi_w_mode(ep, true); - ret = dw_pcie_write(pci->dbi_base + where, size, val); - exynos_pcie_sideband_dbi_w_mode(ep, false); - return ret; + if (PCI_SLOT(devfn)) + return PCIBIOS_DEVICE_NOT_FOUND; + + dw_pcie_write_dbi(pci, where, size, val); + return PCIBIOS_SUCCESSFUL; } +static struct pci_ops exynos_pci_ops = { + .read = exynos_pcie_rd_own_conf, + .write = exynos_pcie_wr_own_conf, +}; + static int exynos_pcie_link_up(struct dw_pcie *pci) { struct exynos_pcie *ep = to_exynos_pcie(pci); @@ -379,6 +384,8 @@ static int exynos_pcie_host_init(struct pcie_port *pp) struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct exynos_pcie *ep = to_exynos_pcie(pci); + pp->bridge->ops = &exynos_pci_ops; + exynos_pcie_establish_link(ep); exynos_pcie_enable_interrupts(ep); @@ -386,8 +393,6 @@ static int exynos_pcie_host_init(struct pcie_port *pp) } static const struct dw_pcie_host_ops exynos_pcie_host_ops = { - .rd_own_conf = exynos_pcie_rd_own_conf, - .wr_own_conf = exynos_pcie_wr_own_conf, .host_init = exynos_pcie_host_init, };