Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1620776imj; Fri, 8 Feb 2019 04:41:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ9zZ7zrxWgwmWZ6va2pQ2YVwn3yqbQ12XpbdNEJfZJwbyRHgl3Cg/5FT7A294eSoIsMkT6 X-Received: by 2002:a63:3541:: with SMTP id c62mr16150054pga.191.1549629712104; Fri, 08 Feb 2019 04:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549629712; cv=none; d=google.com; s=arc-20160816; b=bdENdlv0WSak0Ap0WwsTUTG9AxLQAnwUZpMas7esKHBiO7pecJ5UNoLMS78o7Ru1e5 +h0i6B36Up/ZGL0ue/kQBcv8e+4q9MjuGkdgZeq14S5BuDfvKms5bCt1/DF0tmCEpxHm 12dKm4Tt8u1NVnTFIUQyQ3nDKz1ny84gKia+JpcBfgRjoiDYF6K1Cojiam4DUn8a/SqZ T4nyqly9JIlQSf32im6+FiROwrFNqctCWyDQlZ0gq0CGl+aNNDGPJB5yMo7xBQaCiH74 eZneEM+tLxSsc4QerEdaxN1mgkYLULRG3KhATXAkQkLYNS8If4uT+lz6wr5iSWiaCT0+ l95g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8TiUMbeW9gx3E0RaTlHXWjEpmH+gOGQ7pHr2BlHGy88=; b=MVsMBF9Bc2BNkf4xVXMJmI3VVoJrFIR7naIC8zbWqA7gyeaSUzRVDabaWM1hIcoJCZ za2kiyudc0/Oh0ximnW+AHA5ZfzY8iQWddiI40GBW5KlYCzntVQDzFzrURIZ/JdpWENd BhW0RdATcAwdTB8Ft5itf7xtyFsuWaFghBH4ZcF1nIztASD/CHpN/3MTkiclsuTCFNSw f4Q+Yn+N0kQm3UJGY38NriqjU80zTnLAeZQxOAcB/HJx0IUFhMZ0jkEeYxZ6f+RRLr64 kspMpmII7ziCpex3rXyP1gKTh9YNZSC+nwPUbJgH2KqCvFSObaaT8nSx/hg9d02IAs1d FNKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mobiveil.co.in header.s=google header.b=RRsVGm7H; 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 m5si1807888pgv.498.2019.02.08.04.41.36; Fri, 08 Feb 2019 04:41:52 -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; dkim=pass header.i=@mobiveil.co.in header.s=google header.b=RRsVGm7H; 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 S1727532AbfBHMjg (ORCPT + 99 others); Fri, 8 Feb 2019 07:39:36 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52740 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbfBHMjf (ORCPT ); Fri, 8 Feb 2019 07:39:35 -0500 Received: by mail-wm1-f67.google.com with SMTP id m1so3276262wml.2 for ; Fri, 08 Feb 2019 04:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mobiveil.co.in; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8TiUMbeW9gx3E0RaTlHXWjEpmH+gOGQ7pHr2BlHGy88=; b=RRsVGm7He3M1H0dan/L6W9QFbvDfV4DdV22eijIGeVYXVK7Fj4k2o8H3QdRJhyv0Rr 7n10xPbAa1F4rmoR21AM5Lg2l/uNqfcx630EIcVu2AW4AIqDUfyGDv9NJUf49sk7ddvQ XmvC0OGenZFfPlD42kmOca47Wol7zADKtTD1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8TiUMbeW9gx3E0RaTlHXWjEpmH+gOGQ7pHr2BlHGy88=; b=rtXO87912oVNVJBbXvpeKScEDecL+P6xg+TNY/SZk24bgR0xxeFpl5TTxSaRSF5O39 JU3MVwwS8Eu1vd8RH4MeyoEkKAI7J4tUwnWecHqIPDNVGRIbmOJ1x1/kCc1Mkkyy7hA/ e8tajHJIbMCZTjrFEVG2wbuT3QYHD7gemb2YjnSOOkNP2thqgw1QFJUuxJxbawCMpop1 enKaTkbRLzpSe24W2zAJtFvluJEi2xFw5b9ptRfw1NZqnQ4FMsqs8ppt0BM6rWwazy8F rK/ZInkpWHayLPGWNIA8TLe7518kNrhtegyONIjIXFcx5UYEYc84/5p3TOL8CuLlqDXJ Vsqg== X-Gm-Message-State: AHQUAuZqaa84A+7+NdG8YMXkKkheYkIRv87J4Y5EcPxXsQTEsPs7IB4h YEDYmXMOJTP0q9TxgSYNlO3uO9Jl+Oe4ZC5WXl2DNQ== X-Received: by 2002:a1c:9e4a:: with SMTP id h71mr11825119wme.82.1549629572788; Fri, 08 Feb 2019 04:39:32 -0800 (PST) MIME-Version: 1.0 References: <20190129080926.36773-1-Zhiqiang.Hou@nxp.com> <20190129080926.36773-20-Zhiqiang.Hou@nxp.com> In-Reply-To: <20190129080926.36773-20-Zhiqiang.Hou@nxp.com> From: Subrahmanya Lingappa Date: Fri, 8 Feb 2019 18:12:12 +0530 Message-ID: Subject: Re: [PATCHv3 19/27] PCI: mobiveil: disabled IB and OB windows set by bootloader To: "Z.q. Hou" Cc: "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" , "shawnguo@kernel.org" , Leo Li , "lorenzo.pieralisi@arm.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , Mingkai Hu , "M.h. Lian" , Xiaowei Bao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 1:40 PM Z.q. Hou wrote: > > From: Hou Zhiqiang > > Disabled all inbound and outbound windows before set up the windows > in kernel, in case transactions match the window set by bootloader. > > Signed-off-by: Hou Zhiqiang > Reviewed-by: Minghuan Lian > --- > V3: > - No change > > .../controller/mobiveil/pcie-mobiveil-host.c | 7 +++++++ > .../pci/controller/mobiveil/pcie-mobiveil.c | 18 ++++++++++++++++++ > .../pci/controller/mobiveil/pcie-mobiveil.h | 2 ++ > 3 files changed, 27 insertions(+) > > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > index d1765d572f44..d028cdf31d0e 100644 > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > @@ -221,6 +221,13 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) > { > u32 value, pab_ctrl, type; > struct resource_entry *win; > + int i; > + > + /* Disable all inbound/outbound windows */ > + for (i = 0; i < pcie->apio_wins; i++) > + mobiveil_pcie_disable_ob_win(pcie, i); > + for (i = 0; i < pcie->ppio_wins; i++) > + mobiveil_pcie_disable_ib_win(pcie, i); > > /* setup bus numbers */ > value = csr_readl(pcie, PCI_PRIMARY_BUS); > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.c b/drivers/pci/controller/mobiveil/pcie-mobiveil.c > index 370658d6546d..49d471b75925 100644 > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil.c > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.c > @@ -226,3 +226,21 @@ int mobiveil_bringup_link(struct mobiveil_pcie *pcie) > > return -ETIMEDOUT; > } > + > +void mobiveil_pcie_disable_ib_win(struct mobiveil_pcie *pci, int win_num) > +{ > + u32 val; > + > + val = csr_readl(pci, PAB_PEX_AMAP_CTRL(win_num)); > + val &= ~(1 << AMAP_CTRL_EN_SHIFT); > + csr_writel(pci, val, PAB_PEX_AMAP_CTRL(win_num)); > +} > + > +void mobiveil_pcie_disable_ob_win(struct mobiveil_pcie *pci, int win_num) > +{ > + u32 val; > + > + val = csr_readl(pci, PAB_AXI_AMAP_CTRL(win_num)); > + val &= ~(1 << WIN_ENABLE_SHIFT); > + csr_writel(pci, val, PAB_AXI_AMAP_CTRL(win_num)); > +} > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.h b/drivers/pci/controller/mobiveil/pcie-mobiveil.h > index eb4cb61291a8..81685840b378 100644 > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h > @@ -171,6 +171,8 @@ void program_ob_windows(struct mobiveil_pcie *pcie, int win_num, u64 cpu_addr, > u64 pci_addr, u32 type, u64 size); > void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, u64 cpu_addr, > u64 pci_addr, u32 type, u64 size); > +void mobiveil_pcie_disable_ob_win(struct mobiveil_pcie *pci, int win_num); > +void mobiveil_pcie_disable_ib_win(struct mobiveil_pcie *pci, int win_num); > u32 csr_read(struct mobiveil_pcie *pcie, u32 off, size_t size); > void csr_write(struct mobiveil_pcie *pcie, u32 val, u32 off, size_t size); > > -- > 2.17.1 > Reviewed-by: Subrahmanya Lingappa