From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE5AA60A2626 for ; Wed, 2 Dec 2026 10:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ZhTcXlks; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=epLZk2gz 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-Unsubscribe-Post:List-Owner; bh=x211lFO6Q1hM5RMpg0Yi9+5mHQBAahbFH+GPH7hjjlg=; b=ZhTcXlksgh595YW0PQNXy+AdVD FKUOnTJxDNs+IZsJn8xquR+VTYz5+ekROs/7oQCnd+ULOsqsmGyQI4sh5eYvq0lQ+85/dZ9Kyey/R M9Ntnqj3nA193KRfXrQUjYP5r4wNm0q8ka7S/Wfyj/iarhfyvtB2IO+8p0oWWfn/bioiTYdufOml0 PR6RpKh4OYRxasJR4GFhx32gB3LNLA0qu0xnAp+AJzHEbQuLpNyX5JelxMFMVh1vwusYXuLMBTfRA k0zVWofkKelJvh67ESy0MFApBxhsmCHzaj5lwAeFxL7ExXKYP5QQyUrocuvCe6lq1VSeb9QMKtuOP tqbu+Ofg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFS-0000000B0lX-3Za7; Wed, 02 Dec 2026 10:07:38 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFL-0000000B0aQ-49uv for linux-amlogic@lists.infradead.org; Wed, 02 Dec 2026 10:07:37 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-491846221ffso11237910f8f.3 for ; Wed, 02 Dec 2026 02:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796206050; x=1796810850; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XqT27+GBtpfCf7ztgs/y8u3mQaQEef1xuXCdlweX9P8=; b=epLZk2gz0HxYJBT+2rsT1MoWtT9s983ZT3PVvspQP4GxVCw+6yNWjlWmXRLVjLrLwA u4LMlAa1xxcShgCY9S3egoqbiZXNhv+G1Y8cxU9pjFpvjlvLNrYsZimEQYw/h35R9K46 F4UYwOhvcGNMB+RUgr+o+k91ZVc54BhGAQm/UntsfHqj8y76vKvHUzWv5S/fdgDEWCyE iXV3WU9XS4sOZd5lLXtFrrMW5l4lp9eDOKWDLvQP3nDetpimpXobLnwjMhXrfsGtZ8KZ YMdBsnWqGoQPiFklANDO9IFi9U7GIN2Oc3j/JUU84TwWYIQd3lLwQ9HWcLKfpAapkUaj H8kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796206050; x=1796810850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=XqT27+GBtpfCf7ztgs/y8u3mQaQEef1xuXCdlweX9P8=; b=ydVWcU2oyBQi78BnhfCgaDfX25jYRooRQvMp7qh7ewcL8iEbhW1fgP1dFCaze9UC5r SN59HEsUUEz6ftSP8eVr7bsh/kjlVAe1Pvn2O0wjSmVZRZDFj7IekhmdW+KLKKLiq1B0 GpMaw3iyWR4a+CDPXvNjofELjP7w4GbLNdJKwmgrdHqpjJxeTm56bY6J764qxAuv0t76 028Lz171vytTWw7dXavZJobFXQrQ7UFJx5l8Ym1hZf0qPRBlHV6jHqhypBi7++3nyGe5 iLLv2BIbec88NW7v73TEulbyZtWvmZqtPdJ7zzLawrMNqnRGCtCsUIg1AldjG91rPskM XxkQ== X-Forwarded-Encrypted: i=1; AL+hErHf8IUZrjh9OuFlgYyBiCDlGtKim6gfSrCBXT0E8PUpu6n8tykWaIlqdCt8jiB5wfG+altVPpe4X7JB1cSE@lists.infradead.org X-Gm-Message-State: APuU4Z8LjqXkCU5zJRt1x2o9oNbr9HdjC/ZpRqQtw/u+RL1cKvPEtUwL cevuzijnv94GiytubcPoaB2gi4Rrc2LsJgzL9YS7G/YZACLi5ceGueqw X-Gm-Gg: AZFdTZc1f+/GpmWVk6q/37IRR7HZYUTOgZ0Q9youMeOAUDBmJGxrwyrO7RvYXcPQrf3 Hc0dGNDRBGId21Z6ZAL+74ogpVkWwkLI9Fn1dBTf6Qd78LLB17ai47/8o2l6tyzoQDpyfKW4bQS EeNgeC+Hk+ESzBFn7EQcB4q5bnOAtLiF27STnPykzVQweiM3XZ0KgDbMMAoG2752jELncM05je0 6HIrO013mECVzZpn9QVTSTzEIyifX0JR3iTsETSL9vk451circ4cO4CZ41EIp93llwIBGLCHmNy qPz1xUhmd3EErS14qVG1JwkHMYbovJg37hJnkJHqr7CCLiIdVnLYki81vvvALK/vzS64qjZdOxO 2UYU7VJ2Ib2qUMjNA4DQ8SphPZEmFwNxKnNkkoHy1JzD28xkK/CY06BIs9yfgDutJ5q8kU0I+SY Ndq4FjEQRdA33RmsUGJJaOTu2OajdLr4XOCmiwXr0Iy228p4laKNSKwCwwn3giipaKXn2wGRSzM ErwKNP/4FUyP3H+uU6w0GV609gKRP2dCmE/A8igA6530mjVL5ct6wVsGzPCeVUinR3Rps2790ol 47/1tYJ8Fhu2rz1xpLxnKVPWU/FC3ULC9/kTuSbNwWSOsg== X-Received: by 2002:a05:6000:4013:b0:4a7:d4c9:ea03 with SMTP id ffacd0b85a97d-4abaac57bb5mr72729992f8f.6.1796206049837; Wed, 02 Dec 2026 02:07:29 -0800 (PST) Received: from localhost.localdomain ([79.117.198.103]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a67fe75sm87617495f8f.24.2026.12.02.02.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:07:29 -0800 (PST) From: Jose Nieto To: Corentin Labbe , Herbert Xu , "David S . Miller" Cc: linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexey Romanov , Jose Nieto Subject: [PATCH v15 04/35] crypto: amlogic - Add platform data Date: Wed, 2 Dec 2026 11:06:43 +0100 Message-ID: <20261202100714.115460-5-jnieto.alaber@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261202100714.115460-1-jnieto.alaber@gmail.com> References: <20261202100714.115460-1-jnieto.alaber@gmail.com> X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_020732_168326_14798C3B X-CRM114-Status: GOOD ( 19.23 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Alexey Romanov To support other Amlogic SoC's we have to use platform data: descriptors and status registers offsets are individual for each SoC series. Signed-off-by: Alexey Romanov Signed-off-by: Jose Nieto --- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 +- drivers/crypto/amlogic/amlogic-gxl-core.c | 22 +++++++++++++++++---- drivers/crypto/amlogic/amlogic-gxl.h | 11 +++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index bcaed2f413d3..c458548f29b2 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c +++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c @@ -234,7 +234,7 @@ static int meson_cipher(struct skcipher_request *areq) reinit_completion(&mc->chanlist[flow].complete); mc->chanlist[flow].status = 0; - writel(mc->chanlist[flow].t_phy | 2, mc->base + (flow << 2)); + writel(mc->chanlist[flow].t_phy | 2, mc->base + ((mc->pdata->descs_reg + flow) << 2)); wait_for_completion_interruptible_timeout(&mc->chanlist[flow].complete, msecs_to_jiffies(500)); if (mc->chanlist[flow].status == 0) { diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c index b6933be39a37..24ef7d5a5607 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "amlogic-gxl.h" @@ -30,9 +31,10 @@ static irqreturn_t meson_irq_handler(int irq, void *data) for (flow = 0; flow < mc->flow_cnt; flow++) { if (mc->chanlist[flow].irq == irq) { - p = readl(mc->base + ((0x04 + flow) << 2)); + p = readl(mc->base + ((mc->pdata->status_reg + flow) << 2)); if (p) { - writel_relaxed(0xF, mc->base + ((0x4 + flow) << 2)); + writel_relaxed(0xF, mc->base + + ((mc->pdata->status_reg + flow) << 2)); mc->chanlist[flow].status = 1; complete(&mc->chanlist[flow].complete); return IRQ_HANDLED; @@ -254,6 +256,10 @@ static int meson_crypto_probe(struct platform_device *pdev) if (!mc) return -ENOMEM; + mc->pdata = of_device_get_match_data(&pdev->dev); + if (!mc->pdata) + return -EINVAL; + mc->dev = &pdev->dev; platform_set_drvdata(pdev, mc); @@ -307,9 +313,17 @@ static void meson_crypto_remove(struct platform_device *pdev) meson_free_chanlist(mc, mc->flow_cnt - 1); } +static const struct meson_pdata meson_gxl_pdata = { + .descs_reg = 0x0, + .status_reg = 0x4, +}; + static const struct of_device_id meson_crypto_of_match_table[] = { - { .compatible = "amlogic,gxl-crypto", }, - {} + { + .compatible = "amlogic,gxl-crypto", + .data = &meson_gxl_pdata, + }, + {}, }; MODULE_DEVICE_TABLE(of, meson_crypto_of_match_table); diff --git a/drivers/crypto/amlogic/amlogic-gxl.h b/drivers/crypto/amlogic/amlogic-gxl.h index 9f1ef87333ae..e0bc5c39bf2c 100644 --- a/drivers/crypto/amlogic/amlogic-gxl.h +++ b/drivers/crypto/amlogic/amlogic-gxl.h @@ -78,6 +78,16 @@ struct meson_flow { #endif }; +/* + * struct meson_pdata - SoC series dependent data. + * @reg_descs: offset to descriptors register + * @reg_status: offset to status register + */ +struct meson_pdata { + u32 descs_reg; + u32 status_reg; +}; + /* * struct meson_dev - main container for all this driver information * @base: base address of amlogic-crypto @@ -93,6 +103,7 @@ struct meson_dev { void __iomem *base; struct clk *busclk; struct device *dev; + const struct meson_pdata *pdata; struct meson_flow *chanlist; atomic_t flow; int flow_cnt; -- 2.47.3 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic