From patchwork Thu Jan 5 13:47:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tretter X-Patchwork-Id: 13090510 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 BEB9FC3DA7A for ; Thu, 5 Jan 2023 21:36:20 +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=2za7jcxUvNQ4vbwB2OKILTk3bAj6I0AqQ22i2HTvcN8=; b=ddxJGEkKXpmrrB wLsbi8wzGzMqVlAJoZl86Dpk7OgkPy42AkJH3dnRJyW0iDknojIR8085lacewbZkyxc27XDXdAC5n +QEZsgvVmBa2fo8AoIbY0l2U7d+2tjPAfCrxUWEfcTgaTY9HRvZknfAedYgVG9V/P0+77ZmS9T5N4 KylvQk3CYk17lM4f+a7ZwXO0Wj0jazpNuhiSwmO8HWByRb9AXiPx7F5BxKgd+Diw/JXbmq1DorgwY OPd+e/QWuTQh4K+MML89FYmecJLV6HJ0Bsv4oRU/4eA4ocjdldrBcaq6denuxFWBHs6FLC7080KVK oADCBZQYKmtGs6EA2pWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXtM-00F9oP-8R; Thu, 05 Jan 2023 21:35:18 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUye-00Danq-Po for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:28:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=kRSxxA2VnfsJDITplIxh8YYAKTIodppKM10ZbgrLRV8=; b=pKMTAXA6DnS6mQAVJuy6dYuXry qTVzgaz1lJrr3Fh6QCZ3JwPclgZfvWrqM8gtjcMsoVBWUdcueiFFn7H7n5stPRsB0LL2Uy69eSzv/ q35IFOWcfKxlvY6blR6qrMTZDaN+yuD7gGiRk5DiBZ0JoY2bhb/iEArQ+JO7h688e2ZMSDew+bK6g 1PwoB3tB04zA4YFV8q9TUy6ycp4iF0RYBmySlMklS0ZYkedR5voM/3SB3copE46o2P4xqZnfv7PBE UYvvt60VOyahzt9jNpQoxcd/4/WJ6bAYQplLVVj3CtYHACNkkuItZiydGBn40sD51xQan2Y17fbN2 ++z5dB9A==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDQap-001M6f-1H for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 13:47:43 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDQai-0003Qt-5e; Thu, 05 Jan 2023 14:47:32 +0100 Received: from [2a0a:edc0:0:900:1d::48] (helo=litschi) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pDQah-0040Lg-Gz; Thu, 05 Jan 2023 14:47:31 +0100 Received: from mtr by litschi with local (Exim 4.94.2) (envelope-from ) id 1pDQaf-000FVD-F4; Thu, 05 Jan 2023 14:47:29 +0100 From: Michael Tretter To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Philipp Zabel Cc: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Fabio Estevam , Laurent Pinchart , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, Michael Tretter Subject: [PATCH 2/8] media: imx-pxp: detect PXP version Date: Thu, 5 Jan 2023 14:47:23 +0100 Message-Id: <20230105134729.59542-3-m.tretter@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230105134729.59542-1-m.tretter@pengutronix.de> References: <20230105134729.59542-1-m.tretter@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_134740_850526_F540F081 X-CRM114-Status: GOOD ( 14.74 ) 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 Different versions of the Pixel Pipeline have different blocks and their routing may be different. Read the PXP_HW_VERSION register to determine the version of the PXP and print it to the log for debugging purposes. Signed-off-by: Michael Tretter --- drivers/media/platform/nxp/imx-pxp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c index 689ae5e6ac62..05abe40558b0 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -10,6 +10,7 @@ * Pawel Osciak, * Marek Szyprowski, */ +#include #include #include #include @@ -52,6 +53,11 @@ MODULE_PARM_DESC(debug, "activates debug info"); #define MEM2MEM_HFLIP (1 << 0) #define MEM2MEM_VFLIP (1 << 1) +#define PXP_VERSION_MAJOR(version) \ + FIELD_GET(BM_PXP_VERSION_MAJOR, version) +#define PXP_VERSION_MINOR(version) \ + FIELD_GET(BM_PXP_VERSION_MINOR, version) + #define dprintk(dev, fmt, arg...) \ v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg) @@ -192,6 +198,8 @@ struct pxp_dev { struct clk *clk; void __iomem *mmio; + u32 hw_version; + atomic_t num_inst; struct mutex dev_mutex; spinlock_t irqlock; @@ -1660,6 +1668,11 @@ static int pxp_soft_reset(struct pxp_dev *dev) return 0; } +static u32 pxp_read_version(struct pxp_dev *dev) +{ + return readl(dev->mmio + HW_PXP_VERSION); +} + static int pxp_probe(struct platform_device *pdev) { struct pxp_dev *dev; @@ -1705,6 +1718,11 @@ static int pxp_probe(struct platform_device *pdev) goto err_clk; } + dev->hw_version = pxp_read_version(dev); + dev_info(&pdev->dev, "PXP Version %d.%d\n", + PXP_VERSION_MAJOR(dev->hw_version), + PXP_VERSION_MINOR(dev->hw_version)); + ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_clk;