All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan (OSS) <peng.fan@oss.nxp.com>
To: u-boot@lists.denx.de
Subject: [PATCH 23/37] crypto: caam: change JR running loop
Date: Thu, 25 Mar 2021 17:30:22 +0800	[thread overview]
Message-ID: <20210325093036.3270101-24-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20210325093036.3270101-1-peng.fan@oss.nxp.com>

From: Franck LENORMAND <franck.lenormand@nxp.com>

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/crypto/fsl/jr.c | 12 +++++++-----
 drivers/crypto/fsl/jr.h |  4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index 44273c345f..de5e68bf8e 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -21,6 +21,7 @@
 #include <asm/fsl_pamu.h>
 #endif
 #include <dm/lists.h>
+#include <linux/delay.h>
 
 #define CIRC_CNT(head, tail, size)	(((head) - (tail)) & (size - 1))
 #define CIRC_SPACE(head, tail, size)	CIRC_CNT((tail), (head) + 1, (size))
@@ -355,8 +356,8 @@ static void desc_done(uint32_t status, void *arg)
 
 static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
 {
-	unsigned long long timeval = get_ticks();
-	unsigned long long timeout = usec2ticks(CONFIG_SEC_DEQ_TIMEOUT);
+	unsigned long long timeval = 0;
+	unsigned long long timeout = CONFIG_USEC_DEQ_TIMEOUT;
 	struct result op;
 	int ret = 0;
 
@@ -369,9 +370,10 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
 		goto out;
 	}
 
-	timeval = get_ticks();
-	timeout = usec2ticks(CONFIG_SEC_DEQ_TIMEOUT);
 	while (op.done != 1) {
+		udelay(1);
+		timeval += 1;
+
 		ret = jr_dequeue(sec_idx);
 		if (ret) {
 			debug("Error in SEC deq\n");
@@ -379,7 +381,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
 			goto out;
 		}
 
-		if ((get_ticks() - timeval) > timeout) {
+		if (timeval > timeout) {
 			debug("SEC Dequeue timed out\n");
 			ret = JQ_DEQ_TO_ERR;
 			goto out;
diff --git a/drivers/crypto/fsl/jr.h b/drivers/crypto/fsl/jr.h
index ffd3a19273..1a215143d9 100644
--- a/drivers/crypto/fsl/jr.h
+++ b/drivers/crypto/fsl/jr.h
@@ -10,8 +10,8 @@
 #include <linux/compiler.h>
 
 #define JR_SIZE 4
-/* Timeout currently defined as 90 sec */
-#define CONFIG_SEC_DEQ_TIMEOUT	90000000U
+/* Timeout currently defined as 10 sec */
+#define CONFIG_USEC_DEQ_TIMEOUT	10000000U
 
 #define DEFAULT_JR_ID		0
 #define DEFAULT_JR_LIODN	0
-- 
2.25.1

  parent reply	other threads:[~2021-03-25  9:30 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  9:29 [PATCH 00/37] imx: hab/caam new feature and update Peng Fan
2021-03-25  9:30 ` [PATCH 01/37] imx8mn: evk: update MAINTAINERS Peng Fan
2021-03-25  9:30 ` [PATCH 02/37] imx8m: add regs used by CAAM Peng Fan
2021-03-25  9:30 ` [PATCH 03/37] imx: imx7 Support for Manufacturing Protection Peng Fan
2021-03-25  9:30 ` [PATCH 04/37] imx: Avoid hardcoded output ring size register offset (ORSR) Peng Fan
2021-03-25  9:30 ` [PATCH 05/37] imx: Ensure CAAM clock is enabled prior getting out_jr_size Peng Fan
2021-03-25  9:30 ` [PATCH 06/37] imx: Avoid hardcoded Job Ring Max size Peng Fan
2021-03-25  9:30 ` [PATCH 07/37] imx: hab: Add function to authenticate kernel image Peng Fan
2021-03-25  9:30 ` [PATCH 08/37] imx: HAB: Update hab codes to support ARM64 and i.MX8M Peng Fan
2021-03-25  9:30 ` [PATCH 09/37] imx: HAB: Validate IVT before authenticating image Peng Fan
2021-03-25  9:30 ` [PATCH 10/37] hab: Change calling to ROM API failsafe Peng Fan
2021-03-25  9:30 ` [PATCH 11/37] imx: hab: Enable hab.c to authenticate additional images in open configuration Peng Fan
2021-03-25  9:30 ` [PATCH 12/37] imx: hab: Display All HAB events via hab_status command Peng Fan
2021-03-25  9:30 ` [PATCH 13/37] imx: hab: Check if IVT header is HABv4 Peng Fan
2021-03-25  9:30 ` [PATCH 14/37] mx7ulp: hab: Add hab_status command for HABv4 M4 boot Peng Fan
2021-03-25  9:30 ` [PATCH 15/37] imx: hab: Fix build warnings in 32-bit targets Peng Fan
2021-03-25  9:30 ` [PATCH 16/37] imx: HAB: Add support for iMX8MM Peng Fan
2021-03-25  9:30 ` [PATCH 17/37] crypto: fsl: blob: Flush dcache range for destination address Peng Fan
2021-03-25  9:30 ` [PATCH 18/37] iMX8M: Add support to enable CONFIG_IMX_HAB Peng Fan
2021-03-25  9:30 ` [PATCH 19/37] imx: cmd_dek: Enable DEK only for chips supporting CAAM Peng Fan
2021-03-25  9:30 ` [PATCH 20/37] mx6dq: hab: Fix chip version in hab.h code Peng Fan
2021-03-25  9:30 ` [PATCH 21/37] cmd: blob: Add IMX_HAB and CAAM supported SoCs as dependency Peng Fan
2021-03-25  9:30 ` [PATCH 22/37] cmd: blob: Instantiate RNG before running CMD_BLOB Peng Fan
2021-03-25  9:30 ` Peng Fan [this message]
2021-03-25  9:30 ` [PATCH 24/37] caam: enable support for iMX7ULP Peng Fan
2021-03-25  9:30 ` [PATCH 25/37] imx7ulp: Enable support for cmd blob Peng Fan
2021-03-25  9:30 ` [PATCH 26/37] crypto: caam: Add CAAM support to i.MX8M platforms Peng Fan
2021-03-25  9:30 ` [PATCH 27/37] crypto: caam: Fix build warnings pointer casting Peng Fan
2021-03-25  9:30 ` [PATCH 28/37] crypto: Add blob command support for i.MX8M platforms Peng Fan
2021-03-25  9:30 ` [PATCH 29/37] crypto: caam: Fix pointer size to 32bit for i.MX8M Peng Fan
2021-03-25  9:30 ` [PATCH 30/37] crypto: caam: Add secure memory vid 3 support Peng Fan
2021-03-25  9:30 ` [PATCH 31/37] crypto: caam: Add fsl caam driver Peng Fan
2021-04-08 18:24   ` Stefano Babic
2021-07-08  8:02     ` Peng Fan (OSS)
2021-07-08  8:28       ` Stefano Babic
2021-03-25  9:30 ` [PATCH 32/37] crypto: caam: RNG4 TRNG errata Peng Fan
2021-03-25  9:30 ` [PATCH 33/37] imx: caam: new u-boot command to set PRIBLOB bitfield from CAAM SCFGR register to 0x3 Peng Fan
2021-03-25  9:30 ` [PATCH 34/37] imx8m: Add DEK blob encapsulation for imx8m Peng Fan
2021-03-25  9:30 ` [PATCH 35/37] imx8: Add DEK blob encapsulation Peng Fan
2021-03-25  9:30 ` [PATCH 36/37] fsl_mfgprot: Fix typo in sign_mppubk() Peng Fan
2021-03-25  9:30 ` [PATCH 37/37] crypto: fsl: refactor for 32 bit version CAAM support on ARM64 Peng Fan
2021-03-31 12:32 ` [PATCH 00/37] imx: hab/caam new feature and update Horia Geantă

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325093036.3270101-24-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.