Received: by 10.223.185.116 with SMTP id b49csp6319745wrg; Thu, 8 Mar 2018 05:38:07 -0800 (PST) X-Google-Smtp-Source: AG47ELuAnXTp/gy1RtOmJSy/7Ft2mt6iq7SFobx9kDMl4fO5kmTgAG7IhpQDTHISZiRQGMD+vT+2 X-Received: by 10.99.120.13 with SMTP id t13mr21437719pgc.35.1520516287813; Thu, 08 Mar 2018 05:38:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520516287; cv=none; d=google.com; s=arc-20160816; b=IHT4Rr3R5SFXvsKYwKsMw/snHXjh5z6CRt5vUUN9ibW9fgWboqnJuRCOPpV0fKAW80 9tM31vya0/UKhIURkXiIGcPfzHy4uU/NZx/gmCTQf8mVumcSxpikDrlac3gABJGMxvfT 1Ov3dqGNMVffy93cheCSR9+b5wjk/brZN/m9Qx0xRUBS4Ic70DkjlM662UbvKpQnihKj 9F70MI5/TOMWQ1Q6w++CjsRXDgJkuUmqSUwNbkS2j2EFFKTGsFJiWB6LJWF7fSR5qDD4 jWin5GAph+SnPJdVhqbFjdQtO32496OgTyarbOmIQvsFUY0G2R+ulHb/1UjFsDGHg6kF m9Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Dcm7j+MKCVqoj5qpxvTLslDmuKBKd/Olmd5znvH41JI=; b=JUZxZtbS+X147sUtD6JvGk/x1N6TMbidl2rfGaM2mvW3sdjB+g9Z9WfJM+3i+C3aq1 xpQkAqG5nyHZfWJ33nBHHy3XdNWj0eDXpq6/bYAW7OkTaecupBkx786K0TK1NlDpzEde 4LEmqAC7DuZTG9qnY2ma7vgvBxIZYeEreVONe4OJOYDmJJJH+shrmPxN8yy1Ynwwqofo wrll7WyTrfndExiH9KIM+gUEdtMnWWlRVH9vbeKgzpW+kIeuFy+qebnumlF1RNcUUreH 6od8drplJLmkfEa6QWz4QCC3TJssxH9icCY2Evaqf/sl7NtfJyVHchSnxbgMxjaVlZSP wQJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si14570802pll.168.2018.03.08.05.37.53; Thu, 08 Mar 2018 05:38:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755985AbeCHNfX (ORCPT + 99 others); Thu, 8 Mar 2018 08:35:23 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:60583 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755897AbeCHNdm (ORCPT ); Thu, 8 Mar 2018 08:33:42 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 4E08818768; Thu, 8 Mar 2018 14:33:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id MZ6so-xg3Z8K; Thu, 8 Mar 2018 14:33:39 +0100 (CET) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id 4C6F41876B; Thu, 8 Mar 2018 14:33:39 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F29311A06B; Thu, 8 Mar 2018 14:33:38 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E62A01A066; Thu, 8 Mar 2018 14:33:38 +0100 (CET) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder02.se.axis.com (Postfix) with ESMTP; Thu, 8 Mar 2018 14:33:38 +0100 (CET) Received: from lnxartpec1.se.axis.com (lnxartpec1.se.axis.com [10.88.4.10]) by thoth.se.axis.com (Postfix) with ESMTP id DA05A2AB5; Thu, 8 Mar 2018 14:33:38 +0100 (CET) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id D54A9401A5; Thu, 8 Mar 2018 14:33:38 +0100 (CET) From: Niklas Cassel To: kishon@ti.com, Jingoo Han , Joao Pinto , Lorenzo Pieralisi , Bjorn Helgaas Cc: Niklas Cassel , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] PCI: designware-ep: Make dw_pcie_ep_set_bar() handle 64-bit BARs properly Date: Thu, 8 Mar 2018 14:33:27 +0100 Message-Id: <20180308133331.19464-3-niklas.cassel@axis.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180308133331.19464-1-niklas.cassel@axis.com> References: <20180308133331.19464-1-niklas.cassel@axis.com> X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since a 64-bit BAR consists of a BAR pair, we need to write to both BARs in the BAR pair to setup the BAR properly. Signed-off-by: Niklas Cassel --- drivers/pci/dwc/pcie-designware-ep.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index 9236b998327f..946bbdf53c4d 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -136,8 +136,15 @@ static int dw_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, return ret; dw_pcie_dbi_ro_wr_en(pci); - dw_pcie_writel_dbi2(pci, reg, size - 1); - dw_pcie_writel_dbi(pci, reg, flags); + if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64) { + dw_pcie_writel_dbi2(pci, reg, lower_32_bits(size - 1)); + dw_pcie_writel_dbi(pci, reg, flags); + dw_pcie_writel_dbi2(pci, reg + 4, upper_32_bits(size - 1)); + dw_pcie_writel_dbi(pci, reg + 4, 0); + } else { + dw_pcie_writel_dbi2(pci, reg, size - 1); + dw_pcie_writel_dbi(pci, reg, flags); + } dw_pcie_dbi_ro_wr_dis(pci); return 0; -- 2.14.2