From patchwork Thu Nov 25 12:45:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 612AFC433EF for ; Thu, 25 Nov 2021 12:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cS/ldVaiqbL1thYKyZzOAZ2rBRzhl3OREee/yTObhvI=; b=dB2Z7x9N+d8FJ5 5RY/N7Ojg44OJeyETcbmqlWWMY+VzfoGcP/vGggHWOTQJCD6Z71r689p6+O4EtE5atXHVU5CG/KlS vxtPA/ZRjYcvRPF0rqV5pxbmtOriNpBaNtJ4MEgd9ufv8pzptbKH5qvpLZJJZ+rZJcdJSoSPRxPr+ 84VUsomH6aShaeqLpYvG0zds+DqDuz+uJvhB/ZojJqiDo16daDoaEvdyEf0HNdseBiAQ7PVSC/efd /YLyFvJYVxPdVhNJtFW6RqimRjuii+ioCZfJvVLUDUzZFLa/umLIonGb6PTmXRyF2v2DcHSB+VaNp ZXo+NJuhUTJNVDa6jW4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqEDc-007V3t-2B; Thu, 25 Nov 2021 12:51:16 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE9A-007Spo-1I for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 12:46:41 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B93EA610D2; Thu, 25 Nov 2021 12:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637844399; bh=HAwmzdzGbp3IRdqXEag5++Pgk0BJ9we/P6AQ8qPIyTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRIycqlRwe0l1Cpe9qadszwuU8qNRH+vVX/HsiQnK7rhxqghhwTZ4uy32NGKbh8qs GR2RQ3Bj2IMZqTezqHB0X0pVrbnqDMrQLzK9n+jfePCfgRp69th2x1ML2jOzYp44aW MecvdFbDzJtyGiz4VtNejtEViTY3tOAZO2TMGG9a3vda7x/8nKQ4ELUBtddz1ViJUi xk6xMwAgeB8z7GXWgXZGGHwieC02Vop7XQsMvq3Y+GHIwZTj8VB7TDhMnx8ReGIYeo kcCSX8WmUcKVL7CsKG7iwU9yt18Low8+yJW9nVnsTTHTRV3eKeBmUAa638kq2n6B5w /viQaVb0SXsLA== Received: by pali.im (Postfix) id 77E46EDE; Thu, 25 Nov 2021 13:46:39 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/15] PCI: mvebu: Setup PCIe controller to Root Complex mode Date: Thu, 25 Nov 2021 13:45:59 +0100 Message-Id: <20211125124605.25915-10-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211125124605.25915-1-pali@kernel.org> References: <20211125124605.25915-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_044640_174282_F7EB0CC7 X-CRM114-Status: GOOD ( 10.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This driver operates only in Root Complex mode, so ensure that hardware is properly configured in Root Complex mode. Signed-off-by: Pali Rohár Cc: stable@vger.kernel.org --- drivers/pci/controller/pci-mvebu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 12afa565bfcf..017ae9f869ac 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -56,6 +56,7 @@ #define PCIE_MASK_ENABLE_INTS 0x0f000000 #define PCIE_CTRL_OFF 0x1a00 #define PCIE_CTRL_X1_MODE 0x0001 +#define PCIE_CTRL_RC_MODE BIT(1) #define PCIE_STAT_OFF 0x1a04 #define PCIE_STAT_BUS 0xff00 #define PCIE_STAT_DEV 0x1f0000 @@ -224,7 +225,12 @@ static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port) static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) { - u32 cmd, mask; + u32 ctrl, cmd, mask; + + /* Setup PCIe controller to Root Complex mode. */ + ctrl = mvebu_readl(port, PCIE_CTRL_OFF); + ctrl |= PCIE_CTRL_RC_MODE; + mvebu_writel(port, ctrl, PCIE_CTRL_OFF); /* Disable Root Bridge I/O space, memory space and bus mastering. */ cmd = mvebu_readl(port, PCIE_CMD_OFF);