From patchwork Fri Aug 21 03:53:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 248050 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:d4c:0:0:0:0 with SMTP id h12csp4326ilj; Thu, 20 Aug 2020 20:55:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/zZ3etKdsh9zqRNhJjM2hvF490KXph5VcdzY5BUCUHGObUhJGdY0lCvgDyGWroTD7Dwc2 X-Received: by 2002:a17:906:a219:: with SMTP id r25mr1028507ejy.201.1597982100488; Thu, 20 Aug 2020 20:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597982100; cv=none; d=google.com; s=arc-20160816; b=qb7EIXe3XJXGN52Wcp3ZyzrTquIxiNevnQoDQH3Xo2RaZFKnXTfl9fYIWdPgtdqI5z YYf5podTl4GHKZxZasBL1sQkk2bhhYElm9zqIXjH4+48PyMxrvoxD3R0QbCpOG7UiXsP Itfp8ay6I5jwhI7abUGzPrjX98JfW76FjU0NsvMjF0Jux2HgTx4LYsS10/BgXoatV3V8 8W3SJP7cdxoK3LAJTPjK7GACTAHWCMITeg0P/aZ0tz+yCRckA20DG1FDPQrdENuJikvv rnfr7QKX3TfHFFKWiQEkVhp2bYHRjy+ZduU5WCv87RlMHUj6NG463WCZke1HZ0Xo/Ceq Mb0g== 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=H+ujdoKHStFeKJ1jXdR6XUfewUNSi1zr1kmdQR9ZccE=; b=X4vEc1eOsrMAFBLjYn20R0OzgFos2y9sOeGkzx3j7YdiCf89ygpUcu+tUJuCH7d+XB XgBWqDssrCHawN8gmP1X8J57pZTUN5f5+PP0Hz+uAenDpE9RCp4500Nbi5E3lsVElz7H Ve+qYhTyGYm5ZBImpoxnbKgqfFm+nmYGLM6BUklgziOGwnpgS0itWnvh5/M9KJqVz+aA lXTvs7iyL5/LGCTgYZyKxI6aEZ1GO0pW+ma5DEEoJlZYBDZMlF62Bjk70Kcad0kbTXUJ sjhft24fmlHSiRGywG+47kvxqF5O6JpwPeybv1P8nqESquP57ay/ioFmcgxXLG8aIsUN +/xQ== 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 cb21si471335edb.31.2020.08.20.20.55.00; Thu, 20 Aug 2020 20:55:00 -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 S1727888AbgHUDy7 (ORCPT + 4 others); Thu, 20 Aug 2020 23:54:59 -0400 Received: from mail-il1-f196.google.com ([209.85.166.196]:36651 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbgHUDy7 (ORCPT ); Thu, 20 Aug 2020 23:54:59 -0400 Received: by mail-il1-f196.google.com with SMTP id f75so52995ilh.3; Thu, 20 Aug 2020 20:54:58 -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=H+ujdoKHStFeKJ1jXdR6XUfewUNSi1zr1kmdQR9ZccE=; b=oqOy4jiyaOBCquToZqd1lzi7DYKYDXqdGVPhSHgvAxNGsaZVNnzLG0wBF6UOCx1KZg unQcG9LS3CaRQip8hsTu+Nle/EpA6kEz5814DgLsXVGI8dZf+BTUnojO7HHU/ZH9IQgS jwJ0Wmzqbzq1ALhAxYOngMIxvJ61ly7l3dUokF5AwDBADrkCAQHUBnakk6bbClxlJPBh U92kI/RJKbox8B9By+5NZwZ+k6/5JCc1gLYqFyVfim7JnwT9bTGbFdI6GNWpYdWQ8r7z vCfbtqjKFUfo3EBilonXOP5zHUzr+Br4sh+Pq3hhuw3xuPQL65TU88I4zLSNgfZcchK/ wsOQ== X-Gm-Message-State: AOAM533SJkTYWdEbs9GXfX5H4FVxy0b5S8J2KtJKSlD0e/3F0xJaHO8y a/pC7I03t/vutG1H4phmag== X-Received: by 2002:a92:914a:: with SMTP id t71mr959815ild.298.1597982098265; Thu, 20 Aug 2020 20:54:58 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.249]) by smtp.googlemail.com with ESMTPSA id 79sm413923ilc.9.2020.08.20.20.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 20:54:57 -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 07/40] PCI: dwc: tegra: Use pci_ops for root config space accessors Date: Thu, 20 Aug 2020 21:53:47 -0600 Message-Id: <20200821035420.380495-8-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 Tegra driver to use the standard pci_ops for root bus config accesses. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Thierry Reding Cc: Jonathan Hunter Cc: linux-tegra@vger.kernel.org Signed-off-by: Rob Herring --- drivers/pci/controller/dwc/pcie-tegra194.c | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index 70498689d0c0..b723c9f3ece4 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -568,42 +568,44 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) return IRQ_HANDLED; } -static int tegra_pcie_dw_rd_own_conf(struct pcie_port *pp, int where, int size, - u32 *val) +static int tegra_pcie_dw_rd_own_conf(struct pci_bus *bus, u32 devfn, int where, + int size, u32 *val) { - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - /* * This is an endpoint mode specific register happen to appear even * when controller is operating in root port mode and system hangs * when it is accessed with link being in ASPM-L1 state. * So skip accessing it altogether */ - if (where == PORT_LOGIC_MSIX_DOORBELL) { + if (!PCI_SLOT(devfn) && where == PORT_LOGIC_MSIX_DOORBELL) { *val = 0x00000000; return PCIBIOS_SUCCESSFUL; } - return dw_pcie_read(pci->dbi_base + where, size, val); + return pci_generic_config_read(bus, devfn, where, size, val); } -static int tegra_pcie_dw_wr_own_conf(struct pcie_port *pp, int where, int size, - u32 val) +static int tegra_pcie_dw_wr_own_conf(struct pci_bus *bus, u32 devfn, int where, + int size, u32 val) { - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - /* * This is an endpoint mode specific register happen to appear even * when controller is operating in root port mode and system hangs * when it is accessed with link being in ASPM-L1 state. * So skip accessing it altogether */ - if (where == PORT_LOGIC_MSIX_DOORBELL) + if (!PCI_SLOT(devfn) && where == PORT_LOGIC_MSIX_DOORBELL) return PCIBIOS_SUCCESSFUL; - return dw_pcie_write(pci->dbi_base + where, size, val); + return pci_generic_config_write(bus, devfn, where, size, val); } +static struct pci_ops tegra_pci_ops = { + .map_bus = dw_pcie_own_conf_map_bus, + .read = tegra_pcie_dw_rd_own_conf, + .write = tegra_pcie_dw_wr_own_conf, +}; + #if defined(CONFIG_PCIEASPM) static void disable_aspm_l11(struct tegra_pcie_dw *pcie) { @@ -970,6 +972,8 @@ static int tegra_pcie_dw_host_init(struct pcie_port *pp) struct tegra_pcie_dw *pcie = to_tegra_pcie(pci); u32 val, tmp, offset, speed; + pp->bridge->ops = &tegra_pci_ops; + tegra_pcie_prepare_host(pp); if (dw_pcie_wait_for_link(pci)) { @@ -1057,8 +1061,6 @@ static const struct dw_pcie_ops tegra_dw_pcie_ops = { }; static struct dw_pcie_host_ops tegra_pcie_dw_host_ops = { - .rd_own_conf = tegra_pcie_dw_rd_own_conf, - .wr_own_conf = tegra_pcie_dw_wr_own_conf, .host_init = tegra_pcie_dw_host_init, .set_num_vectors = tegra_pcie_set_msi_vec_num, };