Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3174685ybi; Fri, 5 Jul 2019 03:10:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7Hv+7QY8Xke8os3iZ2SYib6Y0eRc8FITV5tm8d/rogfNVamccNRRUETOBfXPwDw1uJ1Px X-Received: by 2002:a17:902:102c:: with SMTP id b41mr4376190pla.204.1562321421091; Fri, 05 Jul 2019 03:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562321421; cv=none; d=google.com; s=arc-20160816; b=PyCr16T7W4FCBm5J0bvHzRGbOkekgxdd9c6BGsZ+sHDqKWACV0iND+k5GmbXUuQp4u Llz91R3LDhw6uwL6d9hbw0hFqz9QbDzqaYytrTyUl0oo4S3SRBfrsN3UXiWHTDjW1Fp3 edPdSR23ArEZUIORmGtbQyl/AzPacSIytOb503BS0VpGjljQbRvbtQG3xBKZwCDqIAoX fOdbSf9TCCXEO/MD/AKXJY9cQfZzVEset0t2aTkRNOy+c2StVXgKIKX0hPGEtxT8pboW cgJfAkbB4pAxQVjHf8/QOVPZHXJ1+vm/zvaa6XXlWAtrSmzijX0OGc5wE6xqMpAyb55U mx2w== 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; bh=v8dRz2I2BYnxS4wlY6Q+LLDOh9mMxYSMnF5NezamMGk=; b=WeXB+AkOOCa6c0Z8j6092UB+kP8st21r+iMvGoP2qquhEwl4EGBxFxBVnvJT2kngjb OJWKyyPWODJ9p63enj5fUNM3b/GT5RCnwkz037fmNDrLdYtAS44Z0536h7Jw2gkqk+8u /d5z5XQ6sh81x+8Hvy6Hzg8DqhY/2K+FKuOA6WhWEBHChA5EIeB6U0CvjeZoJ60QziaX I+3jfXTietCCpkRR8i9aTkpGJ6zxP1vwtzDK9OZe50ghqrW8AV9qGCmASxAFS5Sf4v6B yolNKcjaZ/4puKsiaKV4rD0JyU5LNygAJp66aooTbRKK2xBUuOpHw36fJABIFTxO02dC jujQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si7954320pgp.245.2019.07.05.03.10.05; Fri, 05 Jul 2019 03:10:21 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728512AbfGEKIF (ORCPT + 99 others); Fri, 5 Jul 2019 06:08:05 -0400 Received: from inva020.nxp.com ([92.121.34.13]:33314 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727372AbfGEKHp (ORCPT ); Fri, 5 Jul 2019 06:07:45 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 07ABA1A0EA4; Fri, 5 Jul 2019 12:07:43 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 787331A0779; Fri, 5 Jul 2019 12:07:34 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 6D1E840297; Fri, 5 Jul 2019 18:07:24 +0800 (SGT) From: Hou Zhiqiang To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com, l.subrahmanya@mobiveil.co.in, shawnguo@kernel.org, leoyang.li@nxp.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: Mingkai.Hu@nxp.com, Minghuan.Lian@nxp.com, Xiaowei.Bao@nxp.com, Hou Zhiqiang Subject: [PATCHv6 25/28] PCI: mobiveil: Fix the CPU base address setup in inbound window Date: Fri, 5 Jul 2019 17:56:53 +0800 Message-Id: <20190705095656.19191-26-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20190705095656.19191-1-Zhiqiang.Hou@nxp.com> References: <20190705095656.19191-1-Zhiqiang.Hou@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In function program_ib_windows(), currently it use the parameter 'pci_addr' to initialize both CPU base address and PCI base address of the inbound window, it is not correct, and another problem is the upper 32-bit CPU address is not initialized. So, this patch adds an new parameter 'u64 cpu_addr' for the CPU base address setup and adds upper 32-bit CPU base address initialization. Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver") Signed-off-by: Hou Zhiqiang Reviewed-by: Minghuan Lian Reviewed-by: Subrahmanya Lingappa --- V6: - Splited from #9 of v5 patches, no functional change. drivers/pci/controller/pcie-mobiveil.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index 75494f0..aeba37c 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -88,6 +88,7 @@ #define AMAP_CTRL_TYPE_MASK 3 #define PAB_EXT_PEX_AMAP_SIZEN(win) PAB_EXT_REG_ADDR(0xbef0, win) +#define PAB_EXT_PEX_AMAP_AXI_WIN(win) PAB_EXT_REG_ADDR(0xb4a0, win) #define PAB_PEX_AMAP_AXI_WIN(win) PAB_REG_ADDR(0x4ba4, win) #define PAB_PEX_AMAP_PEX_WIN_L(win) PAB_REG_ADDR(0x4ba8, win) #define PAB_PEX_AMAP_PEX_WIN_H(win) PAB_REG_ADDR(0x4bac, win) @@ -457,7 +458,7 @@ static int mobiveil_pcie_parse_dt(struct mobiveil_pcie *pcie) } static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, - u64 pci_addr, u32 type, u64 size) + u64 cpu_addr, u64 pci_addr, u32 type, u64 size) { u32 value; u64 size64 = ~(size - 1); @@ -481,7 +482,10 @@ static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, csr_writel(pcie, upper_32_bits(size64), PAB_EXT_PEX_AMAP_SIZEN(win_num)); - csr_writel(pcie, pci_addr, PAB_PEX_AMAP_AXI_WIN(win_num)); + csr_writel(pcie, lower_32_bits(cpu_addr), + PAB_PEX_AMAP_AXI_WIN(win_num)); + csr_writel(pcie, upper_32_bits(cpu_addr), + PAB_EXT_PEX_AMAP_AXI_WIN(win_num)); csr_writel(pcie, lower_32_bits(pci_addr), PAB_PEX_AMAP_PEX_WIN_L(win_num)); @@ -618,7 +622,7 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) CFG_WINDOW_TYPE, resource_size(pcie->ob_io_res)); /* memory inbound translation window */ - program_ib_windows(pcie, WIN_NUM_0, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE); + program_ib_windows(pcie, WIN_NUM_0, 0, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE); /* Get the I/O and memory ranges from DT */ resource_list_for_each_entry(win, &pcie->resources) { -- 1.7.1