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

Hi!

On Wed, Oct 14, 2015 at 04:16:30PM +0200, Lucas Stach wrote:
> 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;
> > +}
> > +
> [...]
> 

You are right (obviously). I will change that.

Thanks,
Steffen

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  reply	other threads:[~2015-10-23  9:55 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
2015-10-23  9:55     ` Steffen Trumtrar [this message]
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=20151023095503.GA1166@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@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