From patchwork Mon Jul 29 14:20:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 13745033 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 29955C3DA61 for ; Mon, 29 Jul 2024 14:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Lnsu/Wi7dGj1nJVAQ+x0DLiP3zgedc4tHolE2i3TsXs=; b=nXGKYGi3xUHl4MmfGIUE8az9wu U8Rg5+dSjWn17HNGZpoBUemE189JGxF8iq0DqZ0PEqxccVtrctqiCUJ28bZnP5X3c2H+Lmz2vc2ls xBppR0hfx/BOeAc3BU7GF7oXJyFqOdz6Bd0G2xNV1NjJX/pVusknlPtI74rW9+RJSgIqmFq+++0MW mY45LYqVMrD9ULZy7WcRG4Ma1VghCWU01BK7M/xMsqCCOzVXu06Su52cOaWhMia5MZMLOgoh7Vy+o 66IbMIOAa07eXj6VAIWszZ3oJ8KmUhF74yfnyxt7KazuHNvoSW7cicwFnZGTZqM5MUkmmdsW1PfLO VgKN55mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRLZ-0000000BaZ4-2gMS; Mon, 29 Jul 2024 14:27:33 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRFe-0000000BXgm-0QLZ for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 14:21:27 +0000 Received: by mail.gandi.net (Postfix) with ESMTPA id 09396240017; Mon, 29 Jul 2024 14:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1722262884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lnsu/Wi7dGj1nJVAQ+x0DLiP3zgedc4tHolE2i3TsXs=; b=jIbxCO4oG7wm2lbIMUDqM4FGW33R5m+Wx+bt9eT4XSej5NCngci4tYAd1K1lbnlnMPOvoy NxEdfrKdNzlHlK8ZyGo2NdnyhzMggftF8RiQUjzIZtjswTtDansXOwhhvod562UT4hZHri E4T9A/octqZV7WkA85rSXEHnlnPDzCePegDF+Hfq6tfTwhDU0EyWbBL7VdYAMWORyhfznS lyW3MGNHAlP4+xGYlfHv6dPmlXG7tDl4Vf1PCaKSx+/BcH4Hz98y5jPs/q0Dgiy39TK3Du efUP8E/CfpJcxrGQITKMNwoml/sHhQutWrogYxHICyLAioxqBKT/NvifQJfXKQ== From: Herve Codina To: Herve Codina , Christophe Leroy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Qiang Zhao , Li Yang , Mark Brown Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni Subject: [PATCH v1 13/36] soc: fsl: cpm1: tsa: Introduce tsa_version Date: Mon, 29 Jul 2024 16:20:42 +0200 Message-ID: <20240729142107.104574-14-herve.codina@bootlin.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240729142107.104574-1-herve.codina@bootlin.com> References: <20240729142107.104574-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_072126_369963_D6A2540E X-CRM114-Status: GOOD ( 15.88 ) 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 Current code handles CPM1 version of TSA. In order to prepare the support for the QUICC Engine (QE) version of TSA, introduce tsa_version to identify versions. This will enable the code to make the distinction between several TSA implementations. Signed-off-by: Herve Codina --- drivers/soc/fsl/qe/tsa.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/tsa.c b/drivers/soc/fsl/qe/tsa.c index 48a176cece86..3b7c9766e25c 100644 --- a/drivers/soc/fsl/qe/tsa.c +++ b/drivers/soc/fsl/qe/tsa.c @@ -114,12 +114,17 @@ struct tsa_tdm { #define TSA_TDMA 0 #define TSA_TDMB 1 +enum tsa_version { + TSA_CPM1 = 1, /* Avoid 0 value */ +}; + struct tsa { struct device *dev; void __iomem *si_regs; void __iomem *si_ram; resource_size_t si_ram_sz; spinlock_t lock; /* Lock for read/modify/write sequence */ + enum tsa_version version; int tdms; /* TSA_TDMx ORed */ struct tsa_tdm tdm[2]; /* TDMa and TDMb */ struct tsa_serial { @@ -685,6 +690,15 @@ static int tsa_probe(struct platform_device *pdev) return -ENOMEM; tsa->dev = &pdev->dev; + tsa->version = (enum tsa_version)of_device_get_match_data(&pdev->dev); + switch (tsa->version) { + case TSA_CPM1: + dev_info(tsa->dev, "CPM1 version\n"); + break; + default: + dev_err(tsa->dev, "Unknown version (%d)\n", tsa->version); + return -EINVAL; + } for (i = 0; i < ARRAY_SIZE(tsa->serials); i++) tsa->serials[i].id = i; @@ -746,7 +760,7 @@ static void tsa_remove(struct platform_device *pdev) } static const struct of_device_id tsa_id_table[] = { - { .compatible = "fsl,cpm1-tsa" }, + { .compatible = "fsl,cpm1-tsa", .data = (void *)TSA_CPM1 }, {} /* sentinel */ }; MODULE_DEVICE_TABLE(of, tsa_id_table);