Message ID | 20220719150000.383722-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2,1/2] dmaengine: sh: rz-dmac: Add device_synchronize callback | expand |
On Tue, Jul 19, 2022 at 5:00 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > Some on-chip peripheral modules(for eg:- rspi) on RZ/G2L SoC > use the same signal for both interrupt and DMA transfer requests. > The signal works as a DMA transfer request signal by setting > DMARS, and subsequent interrupt requests to the interrupt controller > are masked. > > We can enable the interrupt by clearing the DMARS. re-enable? > > This patch adds device_synchronize callback for clearing > DMARS and thereby allowing DMA consumers to switch to > DMA mode. interrupt mode > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > v1->v2: > * No change With the above fixed: Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Biju, On Thu, Jul 21, 2022 at 11:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Tue, Jul 19, 2022 at 5:00 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > Some on-chip peripheral modules(for eg:- rspi) on RZ/G2L SoC > > use the same signal for both interrupt and DMA transfer requests. > > The signal works as a DMA transfer request signal by setting > > DMARS, and subsequent interrupt requests to the interrupt controller > > are masked. > > > > We can enable the interrupt by clearing the DMARS. > > re-enable? > > > > > This patch adds device_synchronize callback for clearing > > DMARS and thereby allowing DMA consumers to switch to > > DMA mode. > > interrupt mode > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > --- > > v1->v2: > > * No change > > With the above fixed: > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > > +static void rz_dmac_device_synchronize(struct dma_chan *chan) > > +{ > > + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); > > + struct rz_dmac *dmac = to_rz_dmac(chan->device); > > + Actually this should check if the DMA operation has been completed or terminated, and wait (sleep) if needed. > > + rz_dmac_set_dmars_register(dmac, channel->index, 0); > > +} Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert, Thanks for the feedback > Subject: Re: [PATCH v2 1/2] dmaengine: sh: rz-dmac: Add > device_synchronize callback > > On Tue, Jul 19, 2022 at 5:00 PM Biju Das <biju.das.jz@bp.renesas.com> > wrote: > > Some on-chip peripheral modules(for eg:- rspi) on RZ/G2L SoC use the > > same signal for both interrupt and DMA transfer requests. > > The signal works as a DMA transfer request signal by setting DMARS, > > and subsequent interrupt requests to the interrupt controller are > > masked. > > > > We can enable the interrupt by clearing the DMARS. > > re-enable? OK. > > > > > This patch adds device_synchronize callback for clearing DMARS and > > thereby allowing DMA consumers to switch to DMA mode. > > interrupt mode OK. Will fix this in v2. Cheers, Biju > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > --- > > v1->v2: > > * No change > > With the above fixed: > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux- > m68k.org > > In personal conversations with technical people, I call myself a hacker. > But when I'm talking to journalists I just say "programmer" or something > like that. > -- Linus Torvalds
Hi Geert, Thanks for the feedback. > Subject: Re: [PATCH v2 1/2] dmaengine: sh: rz-dmac: Add > device_synchronize callback > > Hi Biju, > > On Thu, Jul 21, 2022 at 11:47 AM Geert Uytterhoeven <geert@linux- > m68k.org> wrote: > > On Tue, Jul 19, 2022 at 5:00 PM Biju Das <biju.das.jz@bp.renesas.com> > wrote: > > > Some on-chip peripheral modules(for eg:- rspi) on RZ/G2L SoC use the > > > same signal for both interrupt and DMA transfer requests. > > > The signal works as a DMA transfer request signal by setting DMARS, > > > and subsequent interrupt requests to the interrupt controller are > > > masked. > > > > > > We can enable the interrupt by clearing the DMARS. > > > > re-enable? > > > > > > > > This patch adds device_synchronize callback for clearing DMARS and > > > thereby allowing DMA consumers to switch to DMA mode. > > > > interrupt mode > > > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > --- > > > v1->v2: > > > * No change > > > > With the above fixed: > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > > > > +static void rz_dmac_device_synchronize(struct dma_chan *chan) { > > > + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); > > > + struct rz_dmac *dmac = to_rz_dmac(chan->device); > > > + > > Actually this should check if the DMA operation has been completed or > terminated, and wait (sleep) if needed. OK will send v3 with these changes. Cheers, Biju
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index ee2872e7d64c..675e6d5319d7 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -630,6 +630,14 @@ static void rz_dmac_virt_desc_free(struct virt_dma_desc *vd) */ } +static void rz_dmac_device_synchronize(struct dma_chan *chan) +{ + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); + struct rz_dmac *dmac = to_rz_dmac(chan->device); + + rz_dmac_set_dmars_register(dmac, channel->index, 0); +} + /* * ----------------------------------------------------------------------------- * IRQ handling @@ -909,6 +917,7 @@ static int rz_dmac_probe(struct platform_device *pdev) engine->device_config = rz_dmac_config; engine->device_terminate_all = rz_dmac_terminate_all; engine->device_issue_pending = rz_dmac_issue_pending; + engine->device_synchronize = rz_dmac_device_synchronize; engine->copy_align = DMAENGINE_ALIGN_1_BYTE; dma_set_max_seg_size(engine->dev, U32_MAX);
Some on-chip peripheral modules(for eg:- rspi) on RZ/G2L SoC use the same signal for both interrupt and DMA transfer requests. The signal works as a DMA transfer request signal by setting DMARS, and subsequent interrupt requests to the interrupt controller are masked. We can enable the interrupt by clearing the DMARS. This patch adds device_synchronize callback for clearing DMARS and thereby allowing DMA consumers to switch to DMA mode. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- v1->v2: * No change --- drivers/dma/sh/rz-dmac.c | 9 +++++++++ 1 file changed, 9 insertions(+)