From patchwork Mon Nov 23 09:28:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 7678501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65D23BF90C for ; Mon, 23 Nov 2015 09:31:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82A752041F for ; Mon, 23 Nov 2015 09:31:56 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id B1D8420445 for ; Mon, 23 Nov 2015 09:31:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0nRp-0004VG-4o; Mon, 23 Nov 2015 09:30:09 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0nRf-0003zv-8n for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 09:30:00 +0000 Received: by wmvv187 with SMTP id v187so151087955wmv.1 for ; Mon, 23 Nov 2015 01:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=GmRPHWdfMz2wD3vWk02WozJWW5F52Etr8mPuH57gHIc=; b=f+2vS4r6J46lk/f5OSG6M7ljz3+BntqIcvxahWrCG2YWaNzpT31phcJWm0Cf1Zs51w MrPFflqppopsYgfRzMEH4Li9CDS7LfQu9UbyPZ1ap+DDmHba3P0bAnTvHIHnmK+D9JTG tFMHJ0j/DBCYOY8OOYmYoevro9Y8u8/RnInZ138qoct8X/AhtknXqxoSM76C3lHFGdLN aMYB3APaS5BYFlOTFheb3RZtPZPFuyV8yDETaFuRrtkovmZ6L9qScAVus2Do+fyYCCgn O5DhKCZ+1UgZjAnADuUs/Cw67R8ymFlxH4/L9rK4Sq1Q2kVaO29f8DePlnrz6wIJmVBK DKig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=GmRPHWdfMz2wD3vWk02WozJWW5F52Etr8mPuH57gHIc=; b=bVQPT3at5zvBa4op/oXL4MUyI0a2OH5IVtpRh1ag1/EYDNdLoVTM7oqhlK5ZigETPQ 3h/+9fEEjbhDVRbbCB6hsLs4X3PhdX1o8DctdzGr5kiwLQdfzJv0YFqhyvWhcfu3a8Do tRUi7NmK7Q5106Auxb6av6bJUvrIsfO533HnsJqVqXktQMCHil2Czj4b2xcdkuAYgtvQ MS3tQW95zbwO/Ky3imLv1vTe+jcQ6IagOgfcGk9IVmrYiAiAJw62816MmysMZT7HUm+q naxees9UZecFD2d6lXyMolP397cH4YEvUyOecocelZ8joLpUu+GpQRIkrOlYOT6vQwEr 9bZA== X-Gm-Message-State: ALoCoQnsV9quuveMiQP5BAV9GiujiVsGdmW7Avwg9aMdKnVSE2miHi0G8l3768J+UZFtElpyyNVI X-Received: by 10.194.23.33 with SMTP id j1mr29127198wjf.4.1448270976401; Mon, 23 Nov 2015 01:29:36 -0800 (PST) Received: from mms734.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id k125sm5547508wmf.2.2015.11.23.01.29.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2015 01:29:35 -0800 (PST) From: Stanimir Varbanov To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH v3 2/6] PCI: designware: add memory barrier after enabling region Date: Mon, 23 Nov 2015 11:28:59 +0200 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_012959_575536_C2A22FAC X-CRM114-Status: GOOD ( 12.91 ) X-Spam-Score: -2.6 (--) 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: Mark Rutland , Arnd Bergmann , Pawel Moll , Ian Campbell , Jingoo Han , Pratyush Anand , Stanimir Varbanov , Rob Herring , Srinivas Kandagatla , Bjorn Andersson MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add 'write memory' barrier after enable region in PCIE_ATU_CR2 register. The barrier is needed to ensure that the region enable request has been reached it's destination at time when we read/write to PCI configuration space. Without this barrier PCI device enumeration during kernel boot is not reliable, and reading configuration space for particular PCI device on the bus returns zero aka no device. Signed-off-by: Stanimir Varbanov --- drivers/pci/host/pcie-designware.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 02a7452bdf23..e15a2ae1583f 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -164,6 +164,11 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index, dw_pcie_writel_rc(pp, upper_32_bits(pci_addr), PCIE_ATU_UPPER_TARGET); dw_pcie_writel_rc(pp, type, PCIE_ATU_CR1); dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); + /* + * ensure that the ATU enable has been happaned before accessing + * pci configuration/io spaces through dw_pcie_cfg_[read|write]. + */ + smp_wmb(); } static struct irq_chip dw_msi_irq_chip = {