From patchwork Tue Dec 21 14:14:52 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: 12696986 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 0156BC433F5 for ; Tue, 21 Dec 2021 14:58:33 +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=nfDsLX5QZht+F3nwXgOAArm6CHMRPmLv8JTvINfRUb4=; b=hMZ3g6WsU3qY5A BSBt7bWYfM3qaxcFmjtNcMkWwhx35LlIPS7s9GAE50jr4lYcZwaRwF9sSvqQZKbAwlI+M40Em5qYp jqSfyHTFID3LCniSZ/P1uRwhT1Z49rf6Ex+Zgw6Lq0+ZOXsR/u93sb88FCO94YTdxXabaiENWqOgn WeA7TIYjh9CssFIq6EGwLK3dEOTOCztF3LeASffsFQi5Y4pcpCOC7Cz0pAim+hkiFW8X+EXtmHhiz zriwdT2t12QPvXkbUqOrVHnHj61PCSIrNi950ZysqhXQ0zhCyhFq3aAfpAZi9suVYSWGWgxCSxjwS u3UoVDJkEFMImsWl9PVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzgZU-007DyL-B0; Tue, 21 Dec 2021 14:56:56 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzgZN-007Dsz-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Dec 2021 14:56:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 837D961639; Tue, 21 Dec 2021 14:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C184FC36AEA; Tue, 21 Dec 2021 14:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640098607; bh=5rM1AcOc3PS1pgnZALHKjdSUqdfRbqAmu6E9C1EEBE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhzGxqWh6aWOldNXcCKillJ/acf4fW+XGebyC4jeQS6NYKAZAYbvjP1OiT2tTDABb m8gMySo1+HQa65b+yZZXGCT5ygv05Fkba1DtmWwpTC3awDhsm6jmPc1zw5KtrTddbx 8EkeJZoPS0em1h8D8jdRJveJVZPZgQ9LtA1Tfg7A4Mc0FAZ2XrfepLfWFtkVTfE54p +KMF6hZUmu6JxgAljueKO3HSD9J+2WdrY4DUYq3SgKpwXql1LVgziTgdZyYh0kZZlj k0zh0hVKG9JSTJ3b3aGOHAH7RvKZiULo7pp5Lcu3jHr02cODSfO3J47cXJ0vIy8Otb L7l/UqCwMOfGA== Received: by pali.im (Postfix) id AB41A2AAD; Tue, 21 Dec 2021 15:18:15 +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 08/11] PCI: mvebu: Properly initialize vendor, device and revision of emulated bridge Date: Tue, 21 Dec 2021 15:14:52 +0100 Message-Id: <20211221141455.30011-9-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211221141455.30011-1-pali@kernel.org> References: <20211221141455.30011-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211221_065649_120093_D40FC5AA X-CRM114-Status: GOOD ( 12.37 ) 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 With this change also PCI vendor id is read from mvebu registers. Signed-off-by: Pali Rohár --- drivers/pci/controller/pci-mvebu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 551f55af5226..94ef00b6d697 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -712,13 +712,14 @@ static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) { unsigned int bridge_flags = PCI_BRIDGE_EMUL_NO_PREFMEM_FORWARD; struct pci_bridge_emul *bridge = &port->bridge; + u32 dev_id = mvebu_readl(port, PCIE_DEV_ID_OFF); + u32 dev_rev = mvebu_readl(port, PCIE_DEV_REV_OFF); u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP); u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); - bridge->conf.vendor = PCI_VENDOR_ID_MARVELL; - bridge->conf.device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; - bridge->conf.class_revision = - mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff; + bridge->conf.vendor = cpu_to_le16(dev_id & 0xffff); + bridge->conf.device = cpu_to_le16(dev_id >> 16); + bridge->conf.class_revision = cpu_to_le32(dev_rev & 0xff); if (mvebu_has_ioport(port)) { /* We support 32 bits I/O addressing */