From patchwork Thu Sep 8 06:25:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M.h. Lian" X-Patchwork-Id: 9320403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1902C6077F for ; Thu, 8 Sep 2016 06:26:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10C50295AD for ; Thu, 8 Sep 2016 06:26:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05984295AF; Thu, 8 Sep 2016 06:26:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 18CC6295AD for ; Thu, 8 Sep 2016 06:26:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhsl9-00051O-My; Thu, 08 Sep 2016 06:24:27 +0000 Received: from mail-by2nam03on0089.outbound.protection.outlook.com ([104.47.42.89] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhsl1-0004ir-00 for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2016 06:24:22 +0000 Received: from BLUPR0301CA0026.namprd03.prod.outlook.com (10.162.113.164) by BN6PR03MB2434.namprd03.prod.outlook.com (10.168.223.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Thu, 8 Sep 2016 06:23:55 +0000 Received: from BL2FFO11FD022.protection.gbl (2a01:111:f400:7c09::154) by BLUPR0301CA0026.outlook.office365.com (2a01:111:e400:5259::36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Thu, 8 Sep 2016 06:23:55 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD022.mail.protection.outlook.com (10.173.161.101) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Thu, 8 Sep 2016 06:23:54 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.63]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u886No2Q022045; Wed, 7 Sep 2016 23:23:51 -0700 From: Minghuan Lian To: Subject: [PATCH 1/2] pci/layercape: disable all iATUs before initialization Date: Thu, 8 Sep 2016 14:25:49 +0800 Message-ID: <1473315950-6396-1-git-send-email-Minghuan.Lian@nxp.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131177894350906744; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(50226002)(4326007)(2906002)(87936001)(77096005)(110136002)(229853001)(47776003)(2351001)(97736004)(85426001)(105606002)(106466001)(92566002)(626004)(5660300001)(189998001)(7416002)(86362001)(8676002)(305945005)(81166006)(68736007)(50466002)(7846002)(8666005)(81156014)(50986999)(586003)(48376002)(19580395003)(104016004)(356003)(36756003)(11100500001)(19580405001)(8936002)(5003940100001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2434; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD022; 1:Uq3bRuOgm0sZwJF6aR0Zj0zGEG4XP2o7EZLtqEh58zOC35DSKmz6yx7meAq6D9s9MN24GGMmAti23RMWJhB6zUJt0MlwAhnjl9Syq4VD2a6Sa6bLZ3ERrx2taBfMGlF2HGbAbMOKpld58yUfO4+lrb4uCZ9eu0ob3RK7jWC17U4bpatvXQrv1p50L/Z7hTF0B3lSRDUj8trGywqay8J7o8A1+ZwX8js/P/MTe+o0CVWEIGZKAgPGHuztrjxFNELZgluykur6S6AmAGWeAcSq9vK6luNWqJyuL1eZpyPtaBmGWhJf89CkFisYVVVai359VjE8LjXR4+88+AWx3xAm47e59HJeBjJ5NOfDhBa76lAFn7/Y/HUqJKKQoroFL7nTQbxJOLyk8jqZZUwAPnGS6YQRUdV/lGVd4PJHEg5K57+PrT67TRBYmviS11G9Prfd64Iz9H8UQgxNVQQ1k9Yha1+pr9M5R2L9sD16Amt48piyJyTtTK6gQ4gNPontTSHxEC86CWOC5J20pSQt6lGGyn0fmQoourCg9UrWhsbdwWvlcipHA5T2uVD3hHa3ktGq/tip3sC+eJGviXGTi6PsFpnPbLDLm1qhenolMU398vPxdH8ZH6bc02kPpV027wlsLZuUkvKSV1J9//8xSX4VMXV3XmZSiSm0gdaiGvz6DtyMXbsKtlkLvkl+FXVzMqzjWvFch7+ep4Q/v5+FX43AwFUZ2jdAYf3UKVaJ649NYoo= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b9d3d171-804c-4650-0417-08d3d7b0b5a0 X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2434; 2:TrlnoYoxKOok/mgr1XLozP9K8gpbOWo79g05PZdLCPWooA3EP1DRCsHsq5bCQC+KFKdkom+JsVGbRR3LO/Q/LYzSvcsNWqXAzcb0rJmBL3kFSBRdtS5QvB+DBR6A3Tf3owx89LpPmK0RWMr7m6dtNxvejCscUiyCR4ePguN/VYvT04nBwbk4gkU44idankBB; 3:YzuoVofWUWyWl2OY0uhAMzWI3fGdIemsKTvg/mC8gsTFvQLMqKI7Ej5B78GGvQQCuirbdoVtbu8dN11j4Gw5GPg2FNl78h27vmIWxvDufn5AdYDpQXJNf8zntqkS+/rgQ+Uu4eVsGwgx68NqWeNG5X83oKMdpP9KYf5acK7KK3CkPuGbYsFpArJ6FIleCGQgwVFnUAJk4bXv0XL3HZVe0UZNwtbwDgh/q/LZ624OZhA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR03MB2434; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2434; 25:dPQ4VXIOLWOCMPJO6Ko6PvY02FZrcKsVpO2C1llf9rEdDVmjQYgaAD4ptwYyNEPbwqnyTPHrj75azppGKOEbGY4mPjpNH2fJdLoG3VgA/L0P2+/Kdat0HX915OJ3vV1VmdlqWY9uFL1YgP3MDAAJ7vQBLIER4fTBekJ2rMShMQRieF6Vx8eGV8AQmj2IuAtpj30FULFuau1x8wmStRxO6Et92GSje7iNLV/KeH9WUXsZb9j5eGRVAG2FudmVY/akqCpnSkABUcn8ftVMJzkomQJciPCnOPIowmqpQIvMTQaY3jv/Lc6ggPh6D+n37+KmHHSmbN1olMd4pJiolOEPujhfjlRNOZ4IBXHFnOXImuP8NeuRYsa2XgjGs2PxtoErCQ5ERQA/ah5c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tfJMR9dW5FImSS7ew0arNZFAv7HR/+PFFQlhvORab4+Y/l5a1VwwUooI7GUFVMUa/KbyvXDaulxh3HbkYz1AsG53wG/s7DXU9D5NREl4Uy40JsKk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13024025)(13018025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BN6PR03MB2434; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2434; X-Forefront-PRVS: 00594E8DBA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2434; 23:xBFhhLW6ROVu4p6zwobYeJENFI8/SaO5FOnxkCmXj?= =?us-ascii?Q?uvLKda7K81ubhOc75g4zlasWAKRnMidAQbzQn72xvC7W2znMz8CkCCVJ/gj7?= =?us-ascii?Q?le+0JYWnti+F2MXHW1EyynFKdOqSFqmQvywD7vp1TGM2TJ37k/CCH0NnK8L8?= =?us-ascii?Q?1th+526BKasN5/rn6sTpYrtFj825s38S9UFlgWv+WpkX2w+TiDuEJjKEfYcW?= =?us-ascii?Q?Ap77NnMuyPi60kWO6sRH3oPsD5IztVEy14Ie/+6ol/3IvxWPiukqoQcZyrtv?= =?us-ascii?Q?jUD1B/v7+tMGAOJVBXwM4vFQvHJRKfh2IROCp9IhFbZ/DRDyDV2QsJ/+QIDU?= =?us-ascii?Q?xbh5/EWDScgzCYrNUKTMaOMbl2kpnYhmPmVmu4wSAiliJELT0IhwznCiD5IZ?= =?us-ascii?Q?9ZABDaAXnMP4AMvwQaHzXyQgpaI2MRjoRrAGeIASnGsEo6t/atn+1JmtfF8D?= =?us-ascii?Q?dnXk8mWXvoCOZHJuEzHgsM6dxndh80NsmcPyYcWRRukIZtMAggBdtUrzyiPS?= =?us-ascii?Q?ky6hoSNiT7HTY27jG7NJDkiJEx6Ocw4Yc1+I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qxobSzgy/S1vlBoljTeW7vwa2MLeTVWR79t2rwq3vJx+eR8Bdii112b8BSBpZzDWbQnVXUMRpkFhZLtexcmGXoEcGO7nnyf2xG7NTVSwG/v7UzS8oJbZ0xCdAymh6TYADaFBqj0pUst4+lERO2L7N75w792NmALb1Hak=; 24:00ii3FxO1yjGRc+qBNkNova6OJ/TyBHgAI3F4Q0NSQLx8GxJebfBIlCs7xJeDsjR7f98DG3j4HXdYoejDODw+fL5d0sYT670UMRxV4psl9Q=; 7:ROCdDYZ2T1HW2wtMooS2CEPRk2h+2bTTrcp//FbKiyinb3CUQUv2diDH64OOd1LFU9p20ozLKaztVHH1iBZURXICrWMQhoyH0hOX3aDN+WUgho3IyNWZAV+niBgLYF/lHysXDEnU8XEh+CIhpIrksATSR1G2ZYOVLG+JrFU1cOUVy21QL6c05L+UhdJltUHTnd4Kz1cnq7cV0QmBkbKx4e+xv5I9L2SsAXXHgsP3K2p9V0RlVVO7C4FlPEx9B2Mm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2016 06:23:54.9034 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2434 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160907_232419_542044_787CD4A0 X-CRM114-Status: GOOD ( 16.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roy Zang , Arnd Bergmann , Jingoo Han , Stuart Yoder , Yang-Leo Li , Minghuan Lian , linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , Mingkai Hu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Layerscape PCIe has 6 outbound iATUs. The bootloader such as u-boot uses 4 iATUs for CFG0 CFG1 IO and MEM separately. But Designware driver only uses two outbound iATUs. To avoid conflict between enabled but unused iATUs with used iATUs under Linux and unexpected behavior, the patch disables all iATUs before initialization. Signed-off-by: Minghuan Lian --- drivers/pci/host/pci-layerscape.c | 17 +++++++++++++++-- drivers/pci/host/pcie-designware.c | 7 +++++++ drivers/pci/host/pcie-designware.h | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index 114ba81..cf783ad 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -38,6 +38,8 @@ /* PEX LUT registers */ #define PCIE_LUT_DBG 0x7FC /* PEX LUT Debug Register */ +#define PCIE_IATU_NUM 6 + struct ls_pcie_drvdata { u32 lut_offset; u32 ltssm_shift; @@ -55,6 +57,8 @@ struct ls_pcie { #define to_ls_pcie(x) container_of(x, struct ls_pcie, pp) +static void ls_pcie_host_init(struct pcie_port *pp); + static bool ls_pcie_is_bridge(struct ls_pcie *pcie) { u32 header_type; @@ -87,6 +91,14 @@ static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie) iowrite32(val, pcie->dbi + PCIE_STRFMR1); } +static void ls_pcie_disable_outbound_atus(struct ls_pcie *pcie) +{ + int i; + + for (i = 0; i < PCIE_IATU_NUM; i++) + dw_pcie_disable_outbound_atu(&pcie->pp, i); +} + static int ls1021_pcie_link_up(struct pcie_port *pp) { u32 state; @@ -124,9 +136,8 @@ static void ls1021_pcie_host_init(struct pcie_port *pp) } pcie->index = index[1]; + ls_pcie_host_init(pp); dw_pcie_setup_rc(pp); - - ls_pcie_drop_msg_tlp(pcie); } static int ls_pcie_link_up(struct pcie_port *pp) @@ -153,6 +164,8 @@ static void ls_pcie_host_init(struct pcie_port *pp) ls_pcie_clear_multifunction(pcie); ls_pcie_drop_msg_tlp(pcie); iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN); + + ls_pcie_disable_outbound_atus(pcie); } static int ls_pcie_msi_host_init(struct pcie_port *pp, diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 12afce1..e4d1203 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -172,6 +172,13 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index, dw_pcie_readl_rc(pp, PCIE_ATU_CR2, &val); } +void dw_pcie_disable_outbound_atu(struct pcie_port *pp, int index) +{ + dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | index, + PCIE_ATU_VIEWPORT); + dw_pcie_writel_rc(pp, 0, PCIE_ATU_CR2); +} + static struct irq_chip dw_msi_irq_chip = { .name = "PCI-MSI", .irq_enable = pci_msi_unmask_irq, diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index f437f9b..e998bfc 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h @@ -85,5 +85,6 @@ int dw_pcie_wait_for_link(struct pcie_port *pp); int dw_pcie_link_up(struct pcie_port *pp); void dw_pcie_setup_rc(struct pcie_port *pp); int dw_pcie_host_init(struct pcie_port *pp); +void dw_pcie_disable_outbound_atu(struct pcie_port *pp, int index); #endif /* _PCIE_DESIGNWARE_H */