From patchwork Mon Jun 12 08:52:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JiaJie Ho X-Patchwork-Id: 106339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2447430vqr; Mon, 12 Jun 2023 02:03:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GoFp684WkH8ZHM29x+tHbzurdXBKvy156lWmq9lTtFoqk34iOLwZYd76P8WI4mcB1lT3P X-Received: by 2002:a05:6a21:99a2:b0:10d:bc30:b9ea with SMTP id ve34-20020a056a2199a200b0010dbc30b9eamr10306683pzb.39.1686560605039; Mon, 12 Jun 2023 02:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686560605; cv=none; d=google.com; s=arc-20160816; b=jq1mi+rp3dI1yZcVU0WuRlSt7WyxOK0I8zFxDjA75cHhCS6UgOLXGBKMMgE2mFEo8H 1je6LkDcrxHQYUCyDjYMol0xt0J8vv51nc+pG+TAG9Dmn0S2ytIskFXyJCp+AEdxJUEe ySvWZu6zZ1nRB6qeTlhcj/vizG18eIjMK8W7B9y4CWxd4XHIEkHi0wOkJujgKfiWArJk iePXletK7GloatVlccPfpa8TOi5Si1tYPG1Gih2/xPcacx91Z6iYY4Qc0DMpdZo+5iHf EDTGZbFt2lmkFTd0zZ7CzHQfWqOCVuMefzdcIhDVK4vpI2DD4NhPTdvUmEsce9cfO0aQ JVJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EAdh4rsK3oSzAOv7nPqLfYFgPTVKJaFATcaMfL+LRFc=; b=PyX8DppNQ5M3o4KEUqegNUy2qsgmCMvV8w3To+KfOL3hGjWWX9vhPQ8R2H9ZDcVpiT Br5M15yxEmVZIJWhct286pix6g8JVAq8t2dIE4OcnwDRHEbzNruzHZHwJJxs1WmHlzXi /6GNAMGJwmAJY3EnETmYQy7P8gqitAILcPwuUmjnpfHPMzXKy+1sJ+/pnz2AEKEreYGN EwjNb6G0rX6HLgQfp+gKoH7qQ8M/zpZw72IsVkGIe1GHwC0G6Du9fnSXmlMWnofxjTMQ isXannTAfTGppeXjAB8tweB69vnyTLnfp4rDRsVqrVGVqvEWPf0DD68C+G4WK2lEtnT3 1+lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a633816000000b0053fb1d02b00si6733241pga.383.2023.06.12.02.03.12; Mon, 12 Jun 2023 02:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234181AbjFLIyW convert rfc822-to-8bit (ORCPT + 99 others); Mon, 12 Jun 2023 04:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233804AbjFLIxk (ORCPT ); Mon, 12 Jun 2023 04:53:40 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03B603A80; Mon, 12 Jun 2023 01:52:40 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id D38BA24E26F; Mon, 12 Jun 2023 16:52:37 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 12 Jun 2023 16:52:37 +0800 Received: from ubuntu.localdomain (202.188.176.82) by EXMBX068.cuchost.com (172.16.6.68) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 12 Jun 2023 16:52:35 +0800 From: Jia Jie Ho To: Herbert Xu , "David S . Miller" CC: , Subject: [PATCH v3 1/2] crypto: starfive - Update hash module irq handling Date: Mon, 12 Jun 2023 16:52:29 +0800 Message-ID: <20230612085230.193507-2-jiajie.ho@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612085230.193507-1-jiajie.ho@starfivetech.com> References: <20230612085230.193507-1-jiajie.ho@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768486972759105764?= X-GMAIL-MSGID: =?utf-8?q?1768486972759105764?= Hash driver needs to check the value of irq mask register before writing as it will mask irq of other modules. Co-developed-by: Huan Feng Signed-off-by: Huan Feng Signed-off-by: Jia Jie Ho --- drivers/crypto/starfive/jh7110-hash.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/starfive/jh7110-hash.c b/drivers/crypto/starfive/jh7110-hash.c index 3801e44f2f33..5064150b8a1c 100644 --- a/drivers/crypto/starfive/jh7110-hash.c +++ b/drivers/crypto/starfive/jh7110-hash.c @@ -39,6 +39,7 @@ #define STARFIVE_HASH_SHAWKLEN (STARFIVE_HASH_REGS_OFFSET + 0x24) #define STARFIVE_HASH_BUFLEN SHA512_BLOCK_SIZE +#define STARFIVE_HASH_RESET 0x2 static inline int starfive_hash_wait_busy(struct starfive_cryp_ctx *ctx) { @@ -95,6 +96,7 @@ static void starfive_hash_start(void *param) struct starfive_cryp_dev *cryp = ctx->cryp; union starfive_alg_cr alg_cr; union starfive_hash_csr csr; + u32 stat; dma_unmap_sg(cryp->dev, rctx->in_sg, rctx->in_sg_len, DMA_TO_DEVICE); @@ -107,7 +109,9 @@ static void starfive_hash_start(void *param) csr.firstb = 0; csr.final = 1; - writel(~STARFIVE_IE_MASK_HASH_DONE, cryp->base + STARFIVE_IE_MASK_OFFSET); + stat = readl(cryp->base + STARFIVE_IE_MASK_OFFSET); + stat &= ~STARFIVE_IE_MASK_HASH_DONE; + writel(stat, cryp->base + STARFIVE_IE_MASK_OFFSET); writel(csr.v, cryp->base + STARFIVE_HASH_SHACSR); } @@ -223,6 +227,9 @@ void starfive_hash_done_task(unsigned long param) if (!err) err = starfive_hash_copy_hash(cryp->req.hreq); + /* Reset to clear hash_done in irq register*/ + writel(STARFIVE_HASH_RESET, cryp->base + STARFIVE_HASH_SHACSR); + crypto_finalize_hash_request(cryp->engine, cryp->req.hreq, err); }