Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6833456imu; Thu, 31 Jan 2019 00:02:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN44W/ljp1s5nWiKYs3Chtza+9ud140DrhrbgAcZamWaebewWgQFvPMXFZgeybuPfpxDmi8v X-Received: by 2002:a17:902:720c:: with SMTP id ba12mr33934759plb.79.1548921757331; Thu, 31 Jan 2019 00:02:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548921757; cv=none; d=google.com; s=arc-20160816; b=V0G5EqrC4wwQvj5pujRie9dwvnS0xtzeTunL7Iko++oFXuzllZpRyw72k+bCoxIzNi TDYoJwbD/vAvjgc6XK5UbxaqBXZBV7q/q+laQ7pkSY/vCMqR4VyNrVtVbsbW0xjYuxSZ kwYh+c4ydFeqcuIOgT1OOk7xX13zIeRW39Nb/7NJaAPUFtbaRRlQVjWzYxMu02mkCfLL HPJ4fQvw2/mwLg9EvhmZmqdoCJuiIMipksR0LkGdroXdbyRUSAAqxgm7b6nKzxj1pBIK xZSbLHMtyov5Yw7keizs7ioK5jdJ4L196y+1mazL+RnH4LlBCOUxO2sfFop2dc66uXhY FcTA== 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=st3VLo6z1mWmdXjtAY6lRrkiCLAzEMDxIC8HaHXc3DE=; b=ojZ+KzkuVUtRILLJ3pMqsPjU11kCHFCwEgkNLed3X/40Hq9b3LsQw5MUo8rYPjJxzN j6r/uUnWPsKbPRdFJ1rsRYR0Jsm+mrnD29+o99mvs4lPzaJIhQ1ge7tLgQTZ5XL540Au zcbNy/dAgf6/uTBSW1T5IptSilH55RKJml77y/Wlk9//WGNTCJElZSEztb3R0iTuURje +jfqntjMnz9Af71JnfuqhiqHhf/92wyhkJRM3FqWp5lOS7g1ZUJ/GshczjTum9kJ6Wcm mIIVeJGYx39OFPrcKaMUZ/l+w+NNJcG9s11H4EkAsLJpfTQ5w6DRZ+4DT6g7mCThBhUN VeZw== 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 c3si4020011pls.73.2019.01.31.00.02.21; Thu, 31 Jan 2019 00:02:37 -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 S1731485AbfAaICK (ORCPT + 99 others); Thu, 31 Jan 2019 03:02:10 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:53311 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726341AbfAaICG (ORCPT ); Thu, 31 Jan 2019 03:02:06 -0500 X-UUID: 939512b1174b4934a81b08c41571bdb5-20190131 X-UUID: 939512b1174b4934a81b08c41571bdb5-20190131 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 432288136; Thu, 31 Jan 2019 16:01:59 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 31 Jan 2019 16:01:58 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 31 Jan 2019 16:01:57 +0800 From: To: , , , , , , CC: , , , , , Honghui Zhang Subject: [PATCH v2 2/2] PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM Date: Thu, 31 Jan 2019 16:01:53 +0800 Message-ID: <1548921713-5355-3-git-send-email-honghui.zhang@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1548921713-5355-1-git-send-email-honghui.zhang@mediatek.com> References: <1548921713-5355-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 01126b8..60326c4 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