From patchwork Fri Aug 21 03:53:46 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: 248049 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:d4c:0:0:0:0 with SMTP id h12csp4297ilj; Thu, 20 Aug 2020 20:54:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/Xgc/4ml27BTW+/mzyrReCB0jRb/1s4QQpEOTfWT0mCfxUvcNXwJDz4bxW9UIABCtmfH/ X-Received: by 2002:a17:906:dc03:: with SMTP id yy3mr1080930ejb.380.1597982098545; Thu, 20 Aug 2020 20:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597982098; cv=none; d=google.com; s=arc-20160816; b=K+SeTQOd0EnBS8cw4+qdgPNySOozz07yMpPyUN/V7+9Sxtc1ysmhSPOJT6SC/SwFoM a7jHcdG7GhwEe7DlkbHWjKoBtwUTWiD42tbwIZ6LAiemoihxRsmioFHBOatG/gpn1ZX4 IowfOQke4RyMabpqGGaan1nyz1oR43gk9LD9+al5Bl5BiwEwtpEvLC52cvyPJ5AzVXVz myqxj98CcUjidHIAn7JqNk9gx526wJC3TxFxZ3tyEbFPOXnGpzX4UgFhV/RAtBcF2kvh DyrhQJuu3/o7JFbPWGxwaCF4dmU4zF1tmBRWDHEia22itv3Sje02M49uAdN4jiCXLCJ4 4/NQ== 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=EwCNR+WNDjfzqtdcC/li0ejBM2HfVilEnzsTLaeoEwU=; b=q5dY7cKLBJSTDAsF3SEgT8wW78v5CD//EBwF9bGFALSPdswSQcEMzCZ4XpycPTjKHg YOnwGu+3KVEjhU2OaLrIqXksGcNmD+u+HgtT594Ow3spzHBKdD1uybwsb2AMAkuC+YAF nXgy4Xb0YnvY+njZUJpKRlLIvq1EIgp8EjYjN00hvnsnG3LcWYSbXLCxVshXCSgtkAYc npDJhBjaTS1XUbuOdYStHMML87t1EdyfDl3Qe/KijRw5+4mugXUw1Rzt1V5fI4NSUTVE EvfEco41HV9+tkorEKLT9fi3Xae9uoSEyvdsCnINXSbzIpC5VyDc9VDEe8s4AEDr9ra5 hA3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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.54.58; Thu, 20 Aug 2020 20:54:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727879AbgHUDy5 (ORCPT + 15 others); Thu, 20 Aug 2020 23:54:57 -0400 Received: from mail-il1-f196.google.com ([209.85.166.196]:36942 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbgHUDyz (ORCPT ); Thu, 20 Aug 2020 23:54:55 -0400 Received: by mail-il1-f196.google.com with SMTP id v2so340296ilq.4; Thu, 20 Aug 2020 20:54:54 -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=EwCNR+WNDjfzqtdcC/li0ejBM2HfVilEnzsTLaeoEwU=; b=gp0cnml5Q3aKVQ1gKldNVuHR/6A8SuahGZ9s0lEd3Qj5jMO9Fqy3zYdhpO0SdvbmrO 2fr3Nwp6YCcx7EMdZgx0L24WyLrYL4wcPWdxhXFiYwZCs8syf8nVcek1CfQqC3rPofCC MuwPez3sQ4ogeKxvFGIdJ5G2zB4WfJ2mGcbfkdsYQtjmM+oOijnMl/+ZNw4i9UhiR+Ht X2yBEdGLtTdjB2JLLZkuM2wdx8kAuKhKjSJ0AvxwfovDULB/tgPHuQTXt4r0IHlk+wPA KjU/lwR7oIMIwK4IHR/qCYhTvOxOchj4jAGDgOKi4fsSsHBj9YzIxjlIgvjQIg02r3LP oHPA== X-Gm-Message-State: AOAM5310dkcYRGqEVSf2WPEG6qotjAaCPAddAcpJTw4w2cPUfoI07JAL oTck7Rmga40mTmo4KyDi+A== X-Received: by 2002:a92:c9cb:: with SMTP id k11mr1025850ilq.194.1597982094261; Thu, 20 Aug 2020 20:54:54 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 20:54:53 -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 06/40] PCI: dwc: keystone: Use pci_ops for config space accessors Date: Thu, 20 Aug 2020 21:53:46 -0600 Message-Id: <20200821035420.380495-7-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that DWC drivers can setup their own pci_ops for the root and child buses, convert the TI Keystone driver to use the standard pci_ops for config accesses. Cc: Murali Karicheri Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Signed-off-by: Rob Herring --- drivers/pci/controller/dwc/pci-keystone.c | 40 ++++++++++------------- 1 file changed, 18 insertions(+), 22 deletions(-) -- 2.25.1 diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index c8c9d6a75f17..2b0906e1e0d3 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -430,10 +430,10 @@ static void ks_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie) ks_pcie_app_writel(ks_pcie, CMD_STATUS, val); } -static int ks_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, - unsigned int devfn, int where, int size, - u32 *val) +static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus, + unsigned int devfn, int where) { + struct pcie_port *pp = bus->sysdata; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); u32 reg; @@ -444,25 +444,14 @@ static int ks_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, reg |= CFG_TYPE1; ks_pcie_app_writel(ks_pcie, CFG_SETUP, reg); - return dw_pcie_read(pp->va_cfg0_base + where, size, val); + return pp->va_cfg0_base + where; } -static int ks_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, - unsigned int devfn, int where, int size, - u32 val) -{ - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); - u32 reg; - - reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) | - CFG_FUNC(PCI_FUNC(devfn)); - if (!pci_is_root_bus(bus->parent)) - reg |= CFG_TYPE1; - ks_pcie_app_writel(ks_pcie, CFG_SETUP, reg); - - return dw_pcie_write(pp->va_cfg0_base + where, size, val); -} +static struct pci_ops ks_child_pcie_ops = { + .map_bus = ks_pcie_other_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, +}; /** * ks_pcie_v3_65_scan_bus() - keystone scan_bus post initialization @@ -490,6 +479,12 @@ static void ks_pcie_v3_65_scan_bus(struct pcie_port *pp) dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, ks_pcie->app.start); } +static struct pci_ops ks_pcie_ops = { + .map_bus = dw_pcie_own_conf_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, +}; + /** * ks_pcie_link_up() - Check if link up */ @@ -807,6 +802,9 @@ static int __init ks_pcie_host_init(struct pcie_port *pp) struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); int ret; + pp->bridge->ops = &ks_pcie_ops; + pp->bridge->child_ops = &ks_child_pcie_ops; + ret = ks_pcie_config_legacy_irq(ks_pcie); if (ret) return ret; @@ -842,8 +840,6 @@ static int __init ks_pcie_host_init(struct pcie_port *pp) } static const struct dw_pcie_host_ops ks_pcie_host_ops = { - .rd_other_conf = ks_pcie_rd_other_conf, - .wr_other_conf = ks_pcie_wr_other_conf, .host_init = ks_pcie_host_init, .msi_host_init = ks_pcie_msi_host_init, .scan_bus = ks_pcie_v3_65_scan_bus,