mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/6] crypto: add i.MX6 CAAM support
Date: Wed, 14 Oct 2015 16:16:30 +0200	[thread overview]
Message-ID: <1444832190.13276.18.camel@pengutronix.de> (raw)
In-Reply-To: <1444829979-1100-4-git-send-email-s.trumtrar@pengutronix.de>

Am Mittwoch, den 14.10.2015, 15:39 +0200 schrieb Steffen Trumtrar:
> Add the i.MX6 crypto core CAAM.
> 
> The core itself works with jobrings in which descriptors can be
> queued/dequeued for processing.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  
[...]

> +/*
> + * Init JobR independent of platform property detection
> + */
> +static int caam_jr_init(struct device_d *dev)
> +{
> +	struct caam_drv_private_jr *jrp;
> +	int i, error;
> +
> +	jrp = dev->priv;
> +
> +	error = caam_reset_hw_jr(dev);
> +	if (error)
> +		return -EINVAL;
> +
> +	error = -ENOMEM;
> +	jrp->inpring = dma_alloc_coherent(sizeof(*jrp->inpring) * JOBR_DEPTH,
> +					  DMA_ADDRESS_BROKEN);
> +	if (!jrp->inpring)
> +		return error;
> +
> +	jrp->outring = dma_alloc_coherent(sizeof(*jrp->outring) *
> +					  JOBR_DEPTH, DMA_ADDRESS_BROKEN);
> +	if (!jrp->outring)
> +		goto out_free_inpring;

No new code with DMA_ADDRESS_BROKEN please.

> +
> +	jrp->entinfo = xzalloc(sizeof(*jrp->entinfo) * JOBR_DEPTH);
> +	if (!jrp->entinfo)
> +		goto out_free_outring;
> +
> +	for (i = 0; i < JOBR_DEPTH; i++)
> +		jrp->entinfo[i].desc_addr_dma = !0;
> +
> +	/* Setup rings */
> +	jrp->inp_ring_write_index = 0;
> +	jrp->out_ring_read_index = 0;
> +	jrp->head = 0;
> +	jrp->tail = 0;
> +
> +	wr_reg64(&jrp->rregs->inpring_base, (dma_addr_t) jrp->inpring);
> +	wr_reg64(&jrp->rregs->outring_base, (dma_addr_t) jrp->outring);

This should use the real DMA address, provided by dma_alloc_coherent
above. Hint: it also gets rid of the cast. ;)

> +	wr_reg32(&jrp->rregs->inpring_size, JOBR_DEPTH);
> +	wr_reg32(&jrp->rregs->outring_size, JOBR_DEPTH);
> +
> +	jrp->ringsize = JOBR_DEPTH;
> +
> +	return 0;
> +
> +out_free_outring:
> +	dma_free_coherent(jrp->outring, 0, sizeof(struct jr_outentry) * JOBR_DEPTH);
> +out_free_inpring:
> +	dma_free_coherent(jrp->inpring, 0, sizeof(dma_addr_t) * JOBR_DEPTH);
> +	dev_err(dev, "can't allocate job rings for %d\n", jrp->ridx);
> +	return error;
> +}
> +
[...]

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-10-14 14:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 13:39 [PATCH 1/6] lib: add base64 helpers Steffen Trumtrar
2015-10-14 13:39 ` [PATCH 2/6] include: linux: add circular buffers Steffen Trumtrar
2015-10-14 13:39 ` [PATCH 3/6] ARM: imx6qdl: add caam clks Steffen Trumtrar
2015-10-14 13:39 ` [PATCH 4/6] crypto: add i.MX6 CAAM support Steffen Trumtrar
2015-10-14 14:16   ` Lucas Stach [this message]
2015-10-23  9:55     ` Steffen Trumtrar
2015-10-19  6:21   ` Sascha Hauer
2015-10-23 10:02     ` Steffen Trumtrar
2015-10-14 13:39 ` [PATCH 5/6] ARM: i.MX6qdl: add caam node Steffen Trumtrar
2015-10-14 13:39 ` [PATCH 6/6] crypto: caam: add blob_gen driver Steffen Trumtrar

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=1444832190.13276.18.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox