Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2640ima; Thu, 31 Jan 2019 21:36:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN4sj0nqkMT5v3/t3tCfk73T2tc0odav+mKx1dGTpvJXjc39Z2KZ/xhNKnsMu0NYQLbvo29t X-Received: by 2002:a62:e0d8:: with SMTP id d85mr37232259pfm.214.1548999405589; Thu, 31 Jan 2019 21:36:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548999405; cv=none; d=google.com; s=arc-20160816; b=O1rqbdvlu0023XgFreUy/AsOPkSTmS9/jvoVI7TZO1a4RzqmnlJPcuUyyWDfUB62K5 i09BwrAbfFoRPVGIn6KNAfKPD2+knUCI1rGeFKDx709jS6ol44id8mFTxE8xvZQl9sFv Z7EXpYnAFRPqn5Q+5fsP5Q3udiQzKSmtK2HFAFAqCwlWjhVwLBfw/E4Mj7RWOiCXvJy0 rJVthDrG1U9rA3sRdWUw4KPiK7VPvB1DuMLioJ7uE+L3AzkGAtHyGJXAgEySnA8faZMA 6lDRVmpUv/WzGSd6acFagtMGW2MiNMa0rcPEVcGJXB9OgbIgTvlfzRMDUqxBgYlSfqll Omxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=CxYn+aHgCSnwBkAEYP9E0jZEVHjLf2fAOduR5DN74xs=; b=AHT1rmMjJCGbw+464BSjF1yeKt0wu8IhWnhFR+pq+xUwM/vKwcgqfsAL25qcQ27e0H uGS+NZafRPGY7hLtmHE3I4s7Av69LwOCRCH/oWpVnvenoH9MRnkFHyJs/In7yO0hrZV2 PjcXFLxhetAGe/t+TQSnvg4Kxuc7UN8pOMfQIwTpp8rUuFupRgBxhSUgiWraByidtaOf n+wqAdmbapmyD73ph4FnXAygj3sKH5u9KTIVF8sFZN9hBi64iQvai4V7DOxjZpIrzD54 D06xCwUkR957WEdQXHm67FHkMBJ+Lb9VntQarnFcPxGDgrTYz9hxzPNDaimoWktffphK EYTw== 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 w11si5961787pgf.452.2019.01.31.21.36.29; Thu, 31 Jan 2019 21:36:45 -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 S1726572AbfBAFgW (ORCPT + 99 others); Fri, 1 Feb 2019 00:36:22 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:26463 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725826AbfBAFgU (ORCPT ); Fri, 1 Feb 2019 00:36:20 -0500 X-UUID: 6302292f14b149d6a4a6ffc0f457fe2d-20190201 X-UUID: 6302292f14b149d6a4a6ffc0f457fe2d-20190201 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 25183322; Fri, 01 Feb 2019 13:36:13 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 13:36:11 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 13:36:11 +0800 From: To: , , , , , , CC: , , , , , Honghui Zhang Subject: [PATCH v3 2/2] PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM Date: Fri, 1 Feb 2019 13:36:07 +0800 Message-ID: <1548999367-11733-3-git-send-email-honghui.zhang@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1548999367-11733-1-git-send-email-honghui.zhang@mediatek.com> References: <1548999367-11733-1-git-send-email-honghui.zhang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Honghui Zhang The PCIE_AXI_WINDOW0 defines the translate window size for the request from EP side. Request outside of this window will be treated as unsupported request. Enlarge this window size from fls(0xffffffff) to 2^33 to support 8GB translate address range then EP DMA is capable of fully access 4GB DRAM range(physical DRAM is start from 0x40000000). Reported-by: Bjorn Helgaas Signed-off-by: Honghui Zhang --- drivers/pci/controller/pcie-mediatek.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index c42fe5c..0b6c728 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -90,6 +90,12 @@ #define AHB2PCIE_SIZE(x) ((x) & GENMASK(4, 0)) #define PCIE_AXI_WINDOW0 0x448 #define WIN_ENABLE BIT(7) +/* + * Define PCIe to AHB window size as 2^33 to support max 8GB address space + * translate, support least 4GB DRAM size access from EP DMA(physical DRAM + * start from 0x40000000). + */ +#define PCIE2AHB_SIZE 0x21 /* PCIe V2 configuration transaction header */ #define PCIE_CFG_HEADER0 0x460 @@ -713,7 +719,7 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port) writel(val, port->base + PCIE_AHB_TRANS_BASE0_H); /* Set PCIe to AXI translation memory space.*/ - val = fls(0xffffffff) | WIN_ENABLE; + val = PCIE2AHB_SIZE | WIN_ENABLE; writel(val, port->base + PCIE_AXI_WINDOW0); return 0; -- 2.6.4