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 40ECE60A3801 for ; Wed, 2 Dec 2026 10:07:43 +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=gD0aA77Z; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=TnAR9zXF; 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=bi9Bif/g 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=3SZBPCvzdUn7dGU63R8OXwAapaM4rFl2U7DPB0pwu5I=; b=gD0aA77Zi0smMPdmwoBJVW46GG 5C4JB0gNSomQoGUdikQePhncnLr2rdN1X/NYEUtl2+NQYEBdtnZRRKsgbaButwRY51JvRBlMJZVUH CSp1aoWGi7gnyVHFtKJ5879O3xEujD5kMcBZ2bx72n4gUmeOZA8YTYGO5BPAJpT42vsVzVdzwI7QP DbBE+YOxyIKzKoqnwOUT4QHg9QXvmrUa1lxm3kkT5VFkFmbkA9cq80WoDpNv/NX6NVEzdepAp8USe Zn4+TQ1ha0pzgbU7pKXjWAv82yTpyM8JNxQBhn8fq/URyBBkmWZ6wZEp8T2I+/RK+1ltK3C87lkm/ U5U35geA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFW-0000000B0tf-2xge; Wed, 02 Dec 2026 10:07:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFU-0000000B0o4-3A9A for linux-amlogic@bombadil.infradead.org; Wed, 02 Dec 2026 10:07:40 +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=PdOxqoS3IkgTc/YWMViumYP5wfOQ117N2SViVjkY960=; b=TnAR9zXF2f6Cujws5sjSayZUir hI6Um1C1pDpZxNH/0oXwZYBPmJXavFV7nePDzH5N8wBwAn96pnkrR1V4uoftjTiOv8ovcVI5shAkK OyoLFnyIfTE8TQiTECpuWU3eDl6V9JetMa2zppW9bLJyXeo4fT1w5SiGuVxDSqrOmZpN8qUxISD4G EqVGJgkBDjpeQ95FOHKxcyFUPb2AWxYwxPHP38a7Sojs2lOUno2cXSigs6XthW9987t+Ai+v1z0gr 3lDxAVJPJ1O79/rpBrcFgIPK7+NxV0WvjX1hh1mJOlSVG6CETGcpFGbYo7mkFx1vbawJssySUnqXa UOTtguzQ==; Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by desiato.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFQ-0000000C89c-1gLT for linux-amlogic@lists.infradead.org; Wed, 02 Dec 2026 10:07:39 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-498f5fa5103so7668750f8f.2 for ; Wed, 02 Dec 2026 02:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796206054; x=1796810854; 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=PdOxqoS3IkgTc/YWMViumYP5wfOQ117N2SViVjkY960=; b=bi9Bif/giCvnUe8TUfm/WVRRj6wRiKA/68LLSfERCCYLXxYQVrNzNGqceEf2w3Y5cj UiuFwDunp44ON3nJ+yjbYTCL+jnTony5WgVKTV9xJgmHAIbijTNFvLnZQ2F2CWx/R//S DrYnot+eMaEUkTtlI5EjRknFwmr2cmxjIUE2FamJ9CfjK2pTV8zUWk921w2222EE1mqh VlGbOcy42ULP3athlpMAs42T1FvnCS1DN+NHRwTWmqu0VNB4Of7unjfCkqOU074HwjbY eCHXQKBRq/BF8ZRINH7bqjXtQ1UVqymyoV87iOM2OZ/CCSMYLrXLqUnkEDE8ZcaRn51J 6+CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796206054; x=1796810854; 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=PdOxqoS3IkgTc/YWMViumYP5wfOQ117N2SViVjkY960=; b=g1+FBIJggFsp5FUhrwjUBfTA9SmLxguoDaekg9iSa7ZjEkXkeF3OEMEXRDMaNNEpOd 3+rVTiV91a1ag2MKODw2aTFPCE1JYAAN0cCXM/bQGoJyupzzVXk6r+HFRPB5CPzr0gBq xXodzjYQbMj0CcsfD+15neOEegcE2xoa+DTQ/HcHjgVKfvMNpz9WnlrGWJFA2p7BIwzm D5TwTzG5AtAMn6iDpGigZTjJA3dnZ5wJAdQb2YmweKPM3DPEWCKLHO5gX/wyze71wXG9 YsAl7d8B2CHRq/nhJpJnRepS0DIbV7xkjHim4ehVJHrm9anUMv5Kw8WQX0k8S2yyGeoz Dl0A== X-Forwarded-Encrypted: i=1; AL+hErGgcMeu1U1V8TllXgj83+648YkBOmYOBifypfzZmghG9JUo0rXyA4W3d0PhL/sN2aNMg9/vmgPKON6ZzJHy@lists.infradead.org X-Gm-Message-State: APuU4Z9ygi7PFvedTO+k6YBz0xA0r4EXvmnhQD6wKm4JaB5UbbeQc4iu SMfdwI8wnMVnDs8lRYiufCoIP3AiYslFLiOMYUa7B05XPO0hIXWYcNpJ X-Gm-Gg: AZFdTZdmAwBjnX1T/u8zQ3AbxgdGkceGOZVbO3Ubu9xccTZH1QOC/dxdr4gjV4ChBTM 7mnFAhuS0cYkPiiXZAiay1+7Fkt7Zoi8yhOHS2cXE5HaYt4dnlU2yPl45mR2etci9iTH63m//df 3PbL0Em/wkEjlFqvWor++2FVyMI87fpKDP2Z+xKffb0xsGbCOdivD3xRJpABXTRFhtS3pVP1WaT Es146o4M1Tb2ZZry1hBzHlXkL2scGfgJs3HvEKSyDRmf6HZ2ytadtH7qhTqAvDR7m5t/OvQe+mF gNU9ixAnHyNkt+52AMU3WQCUdX5L01/u9j5UG64Kx55M3OvLyZLt0uIsSopjCDE7Htb1t9uYODy SFRbIY8TCQTzdHNfdSBopPEEEiGrowrq2K702XcZHsASFh8avMjteXLWimd/PAehJ+XRi/dNSPe +eDcGFJkbP9hIfsdowCkxnQjdWe/vkhUX1kogi9Azq1528xuS0gIgOkAoVwFY3StRfJKk7A/7l0 zqTjHcUiZCXQd4v3p9cAPkd5uJX10eWGlt8oCJ7t2iOrfBW1IhTrjq44BHnTDEsloZN0yabA5Xr DLmVfNFT7qWy5eb7PxfXNC0bjwRHQ908yZBFs8e0TT8ABQ== X-Received: by 2002:a05:6000:616:b0:4a6:e1ed:771 with SMTP id ffacd0b85a97d-4abb5db73c9mr88423500f8f.34.1796206054207; Wed, 02 Dec 2026 02:07:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:07:33 -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 06/35] crypto: amlogic - Add MMIO helpers Date: Wed, 2 Dec 2026 11:06:45 +0100 Message-ID: <20261202100714.115460-7-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_100737_553360_98F7303F X-CRM114-Status: GOOD ( 15.45 ) X-Spam-Score: -0.2 (/) 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 Add MMIO access helpers: meson_dma_start() and meson_dma_ready(). Signed-off-by: Alexey Romanov Reviewed-by: Neil Armstrong Signed-off-by: Jose Nieto --- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 +- drivers/crypto/amlogic/amlogic-gxl-core.c | 24 ++++++++++++++++----- drivers/crypto/amlogic/amlogic-gxl.h | 2 ++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index c458548f29b2..62aa82e1cb5d 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 + ((mc->pdata->descs_reg + flow) << 2)); + meson_dma_start(mc, flow); 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 37224d75edfb..b972df44e8b5 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -22,18 +22,32 @@ #include "amlogic-gxl.h" +void meson_dma_start(struct meson_dev *mc, int flow) +{ + u32 offset = (mc->pdata->descs_reg + flow) << 2; + + writel(mc->chanlist[flow].t_phy | 2, mc->base + offset); +} + +static bool meson_dma_ready(struct meson_dev *mc, int flow) +{ + u32 offset = (mc->pdata->status_reg + flow) << 2; + u32 data = readl(mc->base + offset); + + if (data) + writel_relaxed(0xF, mc->base + offset); + + return data; +} + static irqreturn_t meson_irq_handler(int irq, void *data) { struct meson_dev *mc = (struct meson_dev *)data; int flow; - u32 p; for (flow = 0; flow < mc->flow_cnt; flow++) { if (mc->chanlist[flow].irq == irq) { - p = readl(mc->base + ((mc->pdata->status_reg + flow) << 2)); - if (p) { - writel_relaxed(0xF, mc->base + - ((mc->pdata->status_reg + flow) << 2)); + if (meson_dma_ready(mc, flow)) { mc->chanlist[flow].status = 1; complete(&mc->chanlist[flow].complete); return IRQ_HANDLED; diff --git a/drivers/crypto/amlogic/amlogic-gxl.h b/drivers/crypto/amlogic/amlogic-gxl.h index 5149dc6e9f60..64f2f0e63f12 100644 --- a/drivers/crypto/amlogic/amlogic-gxl.h +++ b/drivers/crypto/amlogic/amlogic-gxl.h @@ -159,6 +159,8 @@ struct meson_alg_template { #endif }; +void meson_dma_start(struct meson_dev *mc, int flow); + int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, unsigned int keylen); int meson_cipher_init(struct crypto_tfm *tfm); -- 2.47.3 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic