From: Vinod Koul <vkoul@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Chris Paterson <Chris.Paterson2@renesas.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
dmaengine@vger.kernel.org,
Chris Brandt <chris.brandt@renesas.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v3 2/4] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
Date: Wed, 14 Jul 2021 11:45:12 +0530 [thread overview]
Message-ID: <YO6A8KXRSvqUN6pL@matsya> (raw)
In-Reply-To: <20210702100527.28251-3-biju.das.jz@bp.renesas.com>
On 02-07-21, 11:05, Biju Das wrote:
> +static void rz_dmac_set_dmars_register(struct rz_dmac *dmac, int nr,
> + u32 dmars)
> +{
> + u32 dmars_offset = (nr / 2) * 4;
> + u32 dmars32;
> +
> + dmars32 = rz_dmac_ext_readl(dmac, dmars_offset);
> + if (nr % 2) {
> + dmars32 &= 0x0000ffff;
> + dmars32 |= dmars << 16;
> + } else {
> + dmars32 &= 0xffff0000;
> + dmars32 |= dmars;
> + }
how about using upper_16_bits() and lower_16_bits() for extracting
above?
> +static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel)
> +{
> + struct dma_chan *chan = &channel->vc.chan;
> + struct rz_dmac *dmac = to_rz_dmac(chan->device);
> + struct rz_lmdesc *lmdesc = channel->lmdesc.base;
> + struct rz_dmac_desc *d = channel->desc;
> + u32 chcfg = CHCFG_MEM_COPY;
> + u32 dmars = 0;
> +
> + lmdesc = channel->lmdesc.tail;
> +
> + /* prepare descriptor */
> + lmdesc->sa = d->src;
> + lmdesc->da = d->dest;
> + lmdesc->tb = d->len;
> + lmdesc->chcfg = chcfg;
> + lmdesc->chitvl = 0;
> + lmdesc->chext = 0;
> + lmdesc->header = HEADER_LV;
> +
> + rz_dmac_set_dmars_register(dmac, channel->index, dmars);
why not pass 0 as last arg and remove dmars?
> +static enum dma_status rz_dmac_tx_status(struct dma_chan *chan,
> + dma_cookie_t cookie,
> + struct dma_tx_state *txstate)
> +{
> + return dma_cookie_status(chan, cookie, txstate);
> +}
why not assign status as dma_cookie_status and remove
rz_dmac_tx_status()
> +static int rz_dmac_config(struct dma_chan *chan,
> + struct dma_slave_config *config)
> +{
> + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> + u32 *ch_cfg;
> + u32 val;
> +
> + if (config->direction == DMA_DEV_TO_MEM) {
config->direction is deprecated, pls save the dma_slave_config here and
then use based on txn direction...
> +static bool rz_dmac_chan_filter(struct dma_chan *chan, void *arg)
> +{
> + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> + struct rz_dmac *dmac = to_rz_dmac(chan->device);
> + struct of_phandle_args *dma_spec = arg;
> +
> + if (chan->device->device_config != rz_dmac_config)
> + return false;
which cases would this be false?
> +
> + channel->mid_rid = dma_spec->args[0];
> +
> + return !test_and_set_bit(dma_spec->args[0], dmac->modules);
> +}
> +
> +static struct dma_chan *rz_dmac_of_xlate(struct of_phandle_args *dma_spec,
> + struct of_dma *ofdma)
> +{
> + dma_cap_mask_t mask;
> +
> + if (dma_spec->args_count != 1)
> + return NULL;
> +
> + /* Only slave DMA channels can be allocated via DT */
> + dma_cap_zero(mask);
> + dma_cap_set(DMA_SLAVE, mask);
> +
> + return dma_request_channel(mask, rz_dmac_chan_filter, dma_spec);
> +}
> +
> +/* -----------------------------------------------------------------------------
> + * Probe and remove
> + */
we use
/*
* this style
* multi-line comments
*/
--
~Vinod
next prev parent reply other threads:[~2021-07-14 6:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 10:05 [PATCH v3 0/4] Add RZ/G2L DMAC support Biju Das
2021-07-02 10:05 ` [PATCH v3 1/4] dt-bindings: dma: Document RZ/G2L bindings Biju Das
2021-07-02 21:37 ` Rob Herring
2021-07-02 10:05 ` [PATCH v3 2/4] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC Biju Das
2021-07-14 6:15 ` Vinod Koul [this message]
2021-07-15 12:25 ` Biju Das
2021-07-14 8:09 ` Geert Uytterhoeven
2021-07-15 12:27 ` Biju Das
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=YO6A8KXRSvqUN6pL@matsya \
--to=vkoul@kernel.org \
--cc=Chris.Paterson2@renesas.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=chris.brandt@renesas.com \
--cc=dmaengine@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
/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).