From patchwork Thu Jun 24 22:26:20 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: 12343297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43063C49EA6 for ; Thu, 24 Jun 2021 22:29:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1048061164 for ; Thu, 24 Jun 2021 22:29:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1048061164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=IziO7y0YsuOKItmmb1eDyMor8I7uldEGcKjw/5RvI3A=; b=dO78ikz1DG4Ix0 xHLZpH3ZuPN32F2HJYB4yOTnUAyGJ9N4/bgJu8XStA0UvN23KKuRbgPbtQVoWW/CeSTdbD+l36aXk lcFwA18rJ5hYKF6UduYEoM+sX7KN7cQDlbP3IDYn+KNQEImjjAlnlfq5V4ltdM+lSkNVijtmDK26K 4wgy3UIO+wCE2AQaBWY/aqVeGHJUQtWRyzJMGGk72xaHy7BGlky8ROgXdTrV4jCPrGVYSHcl1Lox+ hl16FRSCZEmGkTAIvBGXUE3ihiIvtiyMtnpkxaqh84hTSg0JS9Bk3VoZJb1ajE9DcnP97po2nYSXv 2dpTXFBjNWvHW0SgdNug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwXpC-00GVDC-5y; Thu, 24 Jun 2021 22:27:54 +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 1lwXoV-00GV6m-2R for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 22:27:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A635E613AB; Thu, 24 Jun 2021 22:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624573630; bh=Abh9XGgE1ipE6laKxqtRrQbaboUN5YYNzU9KrJVJ4A4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPb9HZhfiRsegh08jXRFFjTY7QMb5lQk8SmScz+r8HO8aR6VTOvDijtiU8YVjDz5W M3y9WSYIgv/cQwe0uHVmo1AscxNAkMQGHuvjEwGLGJ2ecIp44c9ORpcW18awGuwQsP Dvd7hLFlkAJP3eqdfye+s6goRTsa7W0JoqhcdzA7AEfbuPOGLTp6p1ONZdzsR1BTCG 1HDKO0H1nE/WdFzZLSduvzdnk4o0IiXArDZ4SgMnMjhJK7yAF9n8eybAmhYO2toQCW z4uUi6cQAPAdBsCmsZ1rq+LYECN0wYxhtG1x+rYrhR3yg2oEehXxYUF2h5jcvnEPJM fqOopr45O+Xqg== Received: by pali.im (Postfix) id 64C9C8A3; Fri, 25 Jun 2021 00:27:10 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Bjorn Helgaas , Rob Herring , Gregory Clement Cc: =?utf-8?q?Marek_Beh=C3=BAn?= , "Remi Pommarel" , Xogium , "Tomasz Maciej Nowak" , Nadav Haklai , Kostya Porotchkin , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH 4/5] PCI: aardvark: Implement workaround for the readback value of VEND_ID Date: Fri, 25 Jun 2021 00:26:20 +0200 Message-Id: <20210624222621.4776-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210624222621.4776-1-pali@kernel.org> References: <20210624222621.4776-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_152711_173873_FA70FA09 X-CRM114-Status: GOOD ( 11.59 ) 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 Marvell Armada 3700 Functional Errata, Guidelines, and Restrictions document describes in erratum 4.1 PCIe value of vendor ID (Ref #: 243): The readback value of VEND_ID (RD0070000h [15:0]) is 1B4Bh, while it should read 11ABh. The firmware can write the correct value, 11ABh, through VEND_ID (RD0076044h [15:0]). Implement this workaround in aardvark driver for both PCI vendor id and PCI subsystem vendor id. This change affects and fixes PCI vendor id of emulated PCIe root bridge. After this change emulated PCIe root bridge has correct vendor id. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space") Cc: stable@vger.kernel.org --- drivers/pci/controller/pci-aardvark.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 397431d641f6..9ff68abd8d1e 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -166,6 +166,7 @@ #define LTSSM_MASK 0x3f #define LTSSM_L0 0x10 #define RC_BAR_CONFIG 0x300 +#define VENDOR_ID_REG (LMI_BASE_ADDR + 0x44) /* PCIe core controller registers */ #define CTRL_CORE_BASE_ADDR 0x18000 @@ -417,6 +418,16 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) reg |= (IS_RC_MSK << IS_RC_SHIFT); advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); + /* + * Replace incorrect PCI vendor id value 0x1b4b by correct value 0x11ab. + * VENDOR_ID_REG contains vendor id in low 16 bits and subsystem vendor + * id in high 16 bits. Updating this register changes readback value of + * read-only vendor id bits in PCIE_CORE_DEV_ID_REG register. Workaround + * for erratum 4.1: "The value of device and vendor ID is incorrect". + */ + reg = (PCI_VENDOR_ID_MARVELL << 16) | PCI_VENDOR_ID_MARVELL; + advk_writel(pcie, reg, VENDOR_ID_REG); + /* Set Advanced Error Capabilities and Control PF0 register */ reg = PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX | PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX_EN |