From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEC36C55178 for ; Thu, 5 Nov 2020 21:15:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 301472073A for ; Thu, 5 Nov 2020 21:15:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yBe3djlh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 301472073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LlDspEy8XFEhiJKtf2uFkHOHwlw5pdJbqXoejUcs0qc=; b=yBe3djlh3J5SpnjiJja5CSsfl I3M9AdFkHVA2okWqrGRHCvDBl1qF2ovzrOtkQdcfE+ElRI9RR6t1lThUlSMICJ9Xm4hHP5sjH5eOs 3jv6wAOe0VU4YGho+Jt4ttzjQ/GeDvH24PAtbnPcqNGksLtnMOVxLcSA/P/eNQcCOHu9bYpykOrIg uoBls3hdYbqxDbVo732/7SKPvq0aIPraTcFS1EvDqnnofEX6rROk9znPXD5oyMq2O/jus6sodj8j9 I//bOdvpk/OQQk1lRYFkadgGBgZeuwqV6BD/ET6B2wYnQH8lbnlgKaEkOIZ1aIumJgFf6tBi3FFYK Q8CVySHkg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kamao-0000h4-8a; Thu, 05 Nov 2020 21:14:50 +0000 Received: from mail-oi1-f195.google.com ([209.85.167.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kamYV-0007lI-66 for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 21:12:29 +0000 Received: by mail-oi1-f195.google.com with SMTP id j7so3147467oie.12 for ; Thu, 05 Nov 2020 13:12:26 -0800 (PST) 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=5hcZakSJUhRFvjna18Ua4O/OJhqtOUdxfTzHnucmOj8=; b=q1AI86hSoRG8D6ZWIsDXHH17k+Kzj2+qM+Fsp84SwxRJhAJPCZuxb/hjUGjvBdH/ck nKje7gmHdPEJekPZDKVrkfOXLCm+Ag/TTVtZBxGsV2oUOOHEg8YL7oA9DlwJyapDi7kf 9uo3H69QcZ+7SCyfip+6xWbCNBkHiQEtRwLoCVbh7GatlTAM40ohy9hsyWH0dX8utfeV oUZh9PwVsBOwYevzrXbEJQckDWlsVh7pNVDgCRJpN/X/mMyTJXJISowicd75lsPTZa/T /E6P1mzi7XmJrPJvIYjCXM04Vu+bK6TZg+0P6BRHdWrXLBwptIVllH8m2i0oV33kC3ue scQg== X-Gm-Message-State: AOAM533Qu3HGtIRHKdhMWJG1CWcTqMAjRLc5A9oEx5E8xcUolG8uloGK u8HGrpubfvys78WErkivt1MdeowKFeVY X-Google-Smtp-Source: ABdhPJxdDzfSB3qfZ3bJyaFVJMx+eCkG/JO3NAT2SigMzFeAAr+hJuX1TQG4CufqggpkGTSna2RuQQ== X-Received: by 2002:aca:4257:: with SMTP id p84mr897507oia.176.1604610746448; Thu, 05 Nov 2020 13:12:26 -0800 (PST) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id z19sm622549ooi.32.2020.11.05.13.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 13:12:25 -0800 (PST) From: Rob Herring To: Subject: [PATCH v2 15/16] PCI: dwc: Move inbound and outbound windows to common struct Date: Thu, 5 Nov 2020 15:11:58 -0600 Message-Id: <20201105211159.1814485-16-robh@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201105211159.1814485-1-robh@kernel.org> References: <20201105211159.1814485-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_161227_285047_DEE0483C X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Jingoo Han , linux-pci@vger.kernel.org, Gustavo Pimentel , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The number of inbound and outbound windows are defined by the h/w and apply to both RC and EP modes, so move them to the appropriate struct. Cc: Jingoo Han Cc: Gustavo Pimentel Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Signed-off-by: Rob Herring --- v2: - new patch .../pci/controller/dwc/pcie-designware-ep.c | 25 ++++++++++--------- drivers/pci/controller/dwc/pcie-designware.h | 4 +-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 6fe176e1bdd2..79b998982e41 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -161,8 +161,8 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, u32 free_win; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - free_win = find_first_zero_bit(ep->ib_window_map, ep->num_ib_windows); - if (free_win >= ep->num_ib_windows) { + free_win = find_first_zero_bit(ep->ib_window_map, pci->num_ib_windows); + if (free_win >= pci->num_ib_windows) { dev_err(pci->dev, "No free inbound window\n"); return -EINVAL; } @@ -187,8 +187,8 @@ static int dw_pcie_ep_outbound_atu(struct dw_pcie_ep *ep, u8 func_no, u32 free_win; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - free_win = find_first_zero_bit(ep->ob_window_map, ep->num_ob_windows); - if (free_win >= ep->num_ob_windows) { + free_win = find_first_zero_bit(ep->ob_window_map, pci->num_ob_windows); + if (free_win >= pci->num_ob_windows) { dev_err(pci->dev, "No free outbound window\n"); return -EINVAL; } @@ -264,8 +264,9 @@ static int dw_pcie_find_index(struct dw_pcie_ep *ep, phys_addr_t addr, u32 *atu_index) { u32 index; + struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - for (index = 0; index < ep->num_ob_windows; index++) { + for (index = 0; index < pci->num_ob_windows; index++) { if (ep->outbound_addr[index] != addr) continue; *atu_index = index; @@ -713,41 +714,41 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->phys_base = res->start; ep->addr_size = resource_size(res); - ret = of_property_read_u32(np, "num-ib-windows", &ep->num_ib_windows); + ret = of_property_read_u32(np, "num-ib-windows", &pci->num_ib_windows); if (ret < 0) { dev_err(dev, "Unable to read *num-ib-windows* property\n"); return ret; } - if (ep->num_ib_windows > MAX_IATU_IN) { + if (pci->num_ib_windows > MAX_IATU_IN) { dev_err(dev, "Invalid *num-ib-windows*\n"); return -EINVAL; } - ret = of_property_read_u32(np, "num-ob-windows", &ep->num_ob_windows); + ret = of_property_read_u32(np, "num-ob-windows", &pci->num_ob_windows); if (ret < 0) { dev_err(dev, "Unable to read *num-ob-windows* property\n"); return ret; } - if (ep->num_ob_windows > MAX_IATU_OUT) { + if (pci->num_ob_windows > MAX_IATU_OUT) { dev_err(dev, "Invalid *num-ob-windows*\n"); return -EINVAL; } ep->ib_window_map = devm_kcalloc(dev, - BITS_TO_LONGS(ep->num_ib_windows), + BITS_TO_LONGS(pci->num_ib_windows), sizeof(long), GFP_KERNEL); if (!ep->ib_window_map) return -ENOMEM; ep->ob_window_map = devm_kcalloc(dev, - BITS_TO_LONGS(ep->num_ob_windows), + BITS_TO_LONGS(pci->num_ob_windows), sizeof(long), GFP_KERNEL); if (!ep->ob_window_map) return -ENOMEM; - addr = devm_kcalloc(dev, ep->num_ob_windows, sizeof(phys_addr_t), + addr = devm_kcalloc(dev, pci->num_ob_windows, sizeof(phys_addr_t), GFP_KERNEL); if (!addr) return -ENOMEM; diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 57326aebc6e1..e4f964e6cabe 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -236,8 +236,6 @@ struct dw_pcie_ep { phys_addr_t *outbound_addr; unsigned long *ib_window_map; unsigned long *ob_window_map; - u32 num_ib_windows; - u32 num_ob_windows; void __iomem *msi_mem; phys_addr_t msi_mem_phys; struct pci_epf_bar *epf_bar[PCI_STD_NUM_BARS]; @@ -263,6 +261,8 @@ struct dw_pcie { /* Used when iatu_unroll_enabled is true */ void __iomem *atu_base; u32 num_viewport; + u32 num_ib_windows; + u32 num_ob_windows; struct pcie_port pp; struct dw_pcie_ep ep; const struct dw_pcie_ops *ops; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel