From: Martin Kaiser <martin@kaiser.cx>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH v2 6/6] hwrng: imx-rngc - remove interrupt handler
Date: Thu, 24 Aug 2023 21:20:59 +0200 [thread overview]
Message-ID: <20230824192059.1569591-7-martin@kaiser.cx> (raw)
In-Reply-To: <20230824192059.1569591-1-martin@kaiser.cx>
Remove the interrupt handler and the code for its installation and
cleanup.
We use readl_poll_timeout now for the selftest and the initial seed.
There are no more users of the interrupt.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
- separate commit for removing irq code
drivers/char/hw_random/imx-rngc.c | 55 -------------------------------
1 file changed, 55 deletions(-)
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 3a3f0f923bed..7fe09c59ce19 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -63,12 +63,6 @@ struct imx_rngc {
struct clk *clk;
void __iomem *base;
struct hwrng rng;
- struct completion rng_op_done;
- /*
- * err_reg is written only by the irq handler and read only
- * when interrupts are masked, we need no spinlock
- */
- u32 err_reg;
};
@@ -91,15 +85,6 @@ static inline void imx_rngc_irq_mask_clear(struct imx_rngc *rngc)
writel(cmd, rngc->base + RNGC_COMMAND);
}
-static inline void imx_rngc_irq_unmask(struct imx_rngc *rngc)
-{
- u32 ctrl;
-
- ctrl = readl(rngc->base + RNGC_CONTROL);
- ctrl &= ~(RNGC_CTRL_MASK_DONE | RNGC_CTRL_MASK_ERROR);
- writel(ctrl, rngc->base + RNGC_CONTROL);
-}
-
static int imx_rngc_self_test(struct imx_rngc *rngc)
{
u32 cmd, status;
@@ -143,26 +128,6 @@ static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait)
return retval ? retval : -EIO;
}
-static irqreturn_t imx_rngc_irq(int irq, void *priv)
-{
- struct imx_rngc *rngc = (struct imx_rngc *)priv;
- u32 status;
-
- /*
- * clearing the interrupt will also clear the error register
- * read error and status before clearing
- */
- status = readl(rngc->base + RNGC_STATUS);
- rngc->err_reg = readl(rngc->base + RNGC_ERROR);
-
- imx_rngc_irq_mask_clear(rngc);
-
- if (status & (RNGC_STATUS_SEED_DONE | RNGC_STATUS_ST_DONE))
- complete(&rngc->rng_op_done);
-
- return IRQ_HANDLED;
-}
-
static int imx_rngc_init(struct hwrng *rng)
{
struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng);
@@ -198,21 +163,9 @@ static int imx_rngc_init(struct hwrng *rng)
ctrl |= RNGC_CTRL_AUTO_SEED;
writel(ctrl, rngc->base + RNGC_CONTROL);
- /*
- * if initialisation was successful, we keep the interrupt
- * unmasked until imx_rngc_cleanup is called
- * we mask the interrupt ourselves if we return an error
- */
return 0;
}
-static void imx_rngc_cleanup(struct hwrng *rng)
-{
- struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng);
-
- imx_rngc_irq_mask_clear(rngc);
-}
-
static int __init imx_rngc_probe(struct platform_device *pdev)
{
struct imx_rngc *rngc;
@@ -246,12 +199,9 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB)
return -ENODEV;
- init_completion(&rngc->rng_op_done);
-
rngc->rng.name = pdev->name;
rngc->rng.init = imx_rngc_init;
rngc->rng.read = imx_rngc_read;
- rngc->rng.cleanup = imx_rngc_cleanup;
rngc->rng.quality = 19;
rngc->dev = &pdev->dev;
@@ -259,11 +209,6 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
imx_rngc_irq_mask_clear(rngc);
- ret = devm_request_irq(&pdev->dev,
- irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
- if (ret)
- return dev_err_probe(&pdev->dev, ret, "Can't get interrupt working.\n");
-
if (self_test) {
ret = imx_rngc_self_test(rngc);
if (ret)
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-08-24 19:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 19:20 [PATCH v2 0/6] hwrng: imx-rngc - use polling instead of interrupt Martin Kaiser
2023-08-24 19:20 ` [PATCH v2 1/6] hwrng: imx-rngc - reasonable timeout for selftest Martin Kaiser
2023-08-24 19:20 ` [PATCH v2 2/6] hwrng: imx-rngc - reasonable timeout for initial seed Martin Kaiser
2023-08-24 19:20 ` [PATCH v2 3/6] hwrng: imx-rngc - use polling to detect end of self test Martin Kaiser
2023-08-25 7:12 ` Alexander Stein
2023-08-29 18:58 ` Martin Kaiser
2023-08-24 19:20 ` [PATCH v2 4/6] hwrng: imx-rngc - read status register for error checks Martin Kaiser
2023-08-24 19:20 ` [PATCH v2 5/6] hwrng: imx-rngc - use polling for initial seed Martin Kaiser
2023-08-24 19:20 ` Martin Kaiser [this message]
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=20230824192059.1569591-7-martin@kaiser.cx \
--to=martin@kaiser.cx \
--cc=alexander.stein@ew.tq-group.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).