linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] dmaengine: rcar-dmac: minor modifications
@ 2019-08-27 11:10 Yoshihiro Shimoda
  2019-08-27 11:10 ` [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Yoshihiro Shimoda @ 2019-08-27 11:10 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, linux-renesas-soc, Yoshihiro Shimoda

This patch series is based on renesas-drivers.git /
renesas-drivers-2019-08-13-v5.3-rc4 tag. This is minor modifications
to add support for changed registers memory mapping hardware support
easily in the future.

Yoshihiro Shimoda (2):
  dmaengine: rcar-dmac: Use of_data values instead of a macro
  dmaengine: rcar-dmac: Use devm_platform_ioremap_resource()

 drivers/dma/sh/rcar-dmac.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro
  2019-08-27 11:10 [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Yoshihiro Shimoda
@ 2019-08-27 11:10 ` Yoshihiro Shimoda
  2019-08-27 13:08   ` Geert Uytterhoeven
  2019-08-27 11:10 ` [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource() Yoshihiro Shimoda
  2019-09-04  6:09 ` [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Vinod Koul
  2 siblings, 1 reply; 9+ messages in thread
From: Yoshihiro Shimoda @ 2019-08-27 11:10 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, linux-renesas-soc, Yoshihiro Shimoda

Since we will have changed memory mapping of the DMAC in the future,
this patch uses of_data values instead of a macro to calculate
each channel's base offset.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/dma/sh/rcar-dmac.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index eb6f231..1ff6d81 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -208,12 +208,20 @@ struct rcar_dmac {
 
 #define to_rcar_dmac(d)		container_of(d, struct rcar_dmac, engine)
 
+/*
+ * struct rcar_dmac_of_data - This driver's OF data
+ * @chan_offset_base: DMAC channels base offset
+ * @chan_offset_coefficient: DMAC channels offset coefficient
+ */
+struct rcar_dmac_of_data {
+	u32 chan_offset_base;
+	u32 chan_offset_coefficient;
+};
+
 /* -----------------------------------------------------------------------------
  * Registers
  */
 
-#define RCAR_DMAC_CHAN_OFFSET(i)	(0x8000 + 0x80 * (i))
-
 #define RCAR_DMAISTA			0x0020
 #define RCAR_DMASEC			0x0030
 #define RCAR_DMAOR			0x0060
@@ -1721,6 +1729,7 @@ static const struct dev_pm_ops rcar_dmac_pm = {
 
 static int rcar_dmac_chan_probe(struct rcar_dmac *dmac,
 				struct rcar_dmac_chan *rchan,
+				const struct rcar_dmac_of_data *data,
 				unsigned int index)
 {
 	struct platform_device *pdev = to_platform_device(dmac->dev);
@@ -1730,7 +1739,8 @@ static int rcar_dmac_chan_probe(struct rcar_dmac *dmac,
 	int ret;
 
 	rchan->index = index;
-	rchan->iomem = dmac->iomem + RCAR_DMAC_CHAN_OFFSET(index);
+	rchan->iomem = dmac->iomem + data->chan_offset_base +
+		       data->chan_offset_coefficient * index;
 	rchan->mid_rid = -EINVAL;
 
 	spin_lock_init(&rchan->lock);
@@ -1803,10 +1813,15 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 	unsigned int channels_offset = 0;
 	struct dma_device *engine;
 	struct rcar_dmac *dmac;
+	const struct rcar_dmac_of_data *data;
 	struct resource *mem;
 	unsigned int i;
 	int ret;
 
+	data = of_device_get_match_data(&pdev->dev);
+	if (!data)
+		return -EINVAL;
+
 	dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
 	if (!dmac)
 		return -ENOMEM;
@@ -1890,7 +1905,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&engine->channels);
 
 	for (i = 0; i < dmac->n_channels; ++i) {
-		ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i],
+		ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i], data,
 					   i + channels_offset);
 		if (ret < 0)
 			goto error;
@@ -1938,8 +1953,16 @@ static void rcar_dmac_shutdown(struct platform_device *pdev)
 	rcar_dmac_stop_all_chan(dmac);
 }
 
+static const struct rcar_dmac_of_data rcar_dmac_data = {
+	.chan_offset_base = 0x8000,
+	.chan_offset_coefficient = 0x80,
+};
+
 static const struct of_device_id rcar_dmac_of_ids[] = {
-	{ .compatible = "renesas,rcar-dmac", },
+	{
+		.compatible = "renesas,rcar-dmac",
+		.data = &rcar_dmac_data,
+	},
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rcar_dmac_of_ids);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource()
  2019-08-27 11:10 [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Yoshihiro Shimoda
  2019-08-27 11:10 ` [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Yoshihiro Shimoda
@ 2019-08-27 11:10 ` Yoshihiro Shimoda
  2019-08-27 13:10   ` Geert Uytterhoeven
  2019-09-04  6:09 ` [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Vinod Koul
  2 siblings, 1 reply; 9+ messages in thread
From: Yoshihiro Shimoda @ 2019-08-27 11:10 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, linux-renesas-soc, Yoshihiro Shimoda

This patch uses devm_platform_ioremap_resource() instead of
using platform_get_resource() and devm_ioremap_resource() together
to simplify.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/dma/sh/rcar-dmac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 1ff6d81..779b715 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1814,7 +1814,6 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 	struct dma_device *engine;
 	struct rcar_dmac *dmac;
 	const struct rcar_dmac_of_data *data;
-	struct resource *mem;
 	unsigned int i;
 	int ret;
 
@@ -1855,8 +1854,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* Request resources. */
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dmac->iomem = devm_ioremap_resource(&pdev->dev, mem);
+	dmac->iomem = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dmac->iomem))
 		return PTR_ERR(dmac->iomem);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro
  2019-08-27 11:10 ` [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Yoshihiro Shimoda
@ 2019-08-27 13:08   ` Geert Uytterhoeven
  2019-08-31  8:36     ` Simon Horman
  0 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2019-08-27 13:08 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: Vinod, dmaengine, Linux-Renesas

Hi Shimoda-san,

On Tue, Aug 27, 2019 at 1:12 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Since we will have changed memory mapping of the DMAC in the future,
> this patch uses of_data values instead of a macro to calculate
> each channel's base offset.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -208,12 +208,20 @@ struct rcar_dmac {
>
>  #define to_rcar_dmac(d)                container_of(d, struct rcar_dmac, engine)
>
> +/*
> + * struct rcar_dmac_of_data - This driver's OF data
> + * @chan_offset_base: DMAC channels base offset
> + * @chan_offset_coefficient: DMAC channels offset coefficient

Perhaps "stride" instead of "coefficient"? Or "step"?

> @@ -1803,10 +1813,15 @@ static int rcar_dmac_probe(struct platform_device *pdev)
>         unsigned int channels_offset = 0;
>         struct dma_device *engine;
>         struct rcar_dmac *dmac;
> +       const struct rcar_dmac_of_data *data;
>         struct resource *mem;
>         unsigned int i;
>         int ret;
>
> +       data = of_device_get_match_data(&pdev->dev);
> +       if (!data)
> +               return -EINVAL;

This cannot fail, as the driver is DT only, and all entries in the match table
have a data pointer.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource()
  2019-08-27 11:10 ` [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource() Yoshihiro Shimoda
@ 2019-08-27 13:10   ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2019-08-27 13:10 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: Vinod, dmaengine, Linux-Renesas

On Tue, Aug 27, 2019 at 1:12 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch uses devm_platform_ioremap_resource() instead of
> using platform_get_resource() and devm_ioremap_resource() together
> to simplify.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro
  2019-08-27 13:08   ` Geert Uytterhoeven
@ 2019-08-31  8:36     ` Simon Horman
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2019-08-31  8:36 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Yoshihiro Shimoda, Vinod, dmaengine, Linux-Renesas

On Tue, Aug 27, 2019 at 03:08:16PM +0200, Geert Uytterhoeven wrote:
> Hi Shimoda-san,
> 
> On Tue, Aug 27, 2019 at 1:12 PM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> > Since we will have changed memory mapping of the DMAC in the future,
> > this patch uses of_data values instead of a macro to calculate
> > each channel's base offset.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> > --- a/drivers/dma/sh/rcar-dmac.c
> > +++ b/drivers/dma/sh/rcar-dmac.c
> > @@ -208,12 +208,20 @@ struct rcar_dmac {
> >
> >  #define to_rcar_dmac(d)                container_of(d, struct rcar_dmac, engine)
> >
> > +/*
> > + * struct rcar_dmac_of_data - This driver's OF data
> > + * @chan_offset_base: DMAC channels base offset
> > + * @chan_offset_coefficient: DMAC channels offset coefficient
> 
> Perhaps "stride" instead of "coefficient"? Or "step"?
> 
> > @@ -1803,10 +1813,15 @@ static int rcar_dmac_probe(struct platform_device *pdev)
> >         unsigned int channels_offset = 0;
> >         struct dma_device *engine;
> >         struct rcar_dmac *dmac;
> > +       const struct rcar_dmac_of_data *data;
> >         struct resource *mem;
> >         unsigned int i;
> >         int ret;
> >
> > +       data = of_device_get_match_data(&pdev->dev);
> > +       if (!data)
> > +               return -EINVAL;
> 
> This cannot fail, as the driver is DT only, and all entries in the match table
> have a data pointer.

It seems to me that not including this check would make the code both more
fragile and less intuitive for a marginal gain in simplicity.

> 
> 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
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] dmaengine: rcar-dmac: minor modifications
  2019-08-27 11:10 [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Yoshihiro Shimoda
  2019-08-27 11:10 ` [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Yoshihiro Shimoda
  2019-08-27 11:10 ` [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource() Yoshihiro Shimoda
@ 2019-09-04  6:09 ` Vinod Koul
  2019-09-04  6:14   ` Yoshihiro Shimoda
  2 siblings, 1 reply; 9+ messages in thread
From: Vinod Koul @ 2019-09-04  6:09 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: dmaengine, linux-renesas-soc

On 27-08-19, 20:10, Yoshihiro Shimoda wrote:
> This patch series is based on renesas-drivers.git /
> renesas-drivers-2019-08-13-v5.3-rc4 tag. This is minor modifications
> to add support for changed registers memory mapping hardware support
> easily in the future.

This fails to apply for me, please rebase and resend.

Thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/2] dmaengine: rcar-dmac: minor modifications
  2019-09-04  6:09 ` [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Vinod Koul
@ 2019-09-04  6:14   ` Yoshihiro Shimoda
  2019-09-04  9:33     ` Vinod Koul
  0 siblings, 1 reply; 9+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-04  6:14 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dmaengine, linux-renesas-soc

Hi Vinod,

> From: Vinod Koul, Sent: Wednesday, September 4, 2019 3:10 PM
> 
> On 27-08-19, 20:10, Yoshihiro Shimoda wrote:
> > This patch series is based on renesas-drivers.git /
> > renesas-drivers-2019-08-13-v5.3-rc4 tag. This is minor modifications
> > to add support for changed registers memory mapping hardware support
> > easily in the future.
> 
> This fails to apply for me, please rebase and resend.

I'm sorry for this. I'll rebase this patch series.
Also, I'll rebase the following patch as one series.
https://patchwork.kernel.org/patch/11118639/

And, note that the following patch [1] is already superseded.
https://patchwork.kernel.org/patch/11118637/

Best regards,
Yoshihiro Shimoda


> Thanks
> 
> --
> ~Vinod

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] dmaengine: rcar-dmac: minor modifications
  2019-09-04  6:14   ` Yoshihiro Shimoda
@ 2019-09-04  9:33     ` Vinod Koul
  0 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2019-09-04  9:33 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: dmaengine, linux-renesas-soc

On 04-09-19, 06:14, Yoshihiro Shimoda wrote:
> Hi Vinod,
> 
> > From: Vinod Koul, Sent: Wednesday, September 4, 2019 3:10 PM
> > 
> > On 27-08-19, 20:10, Yoshihiro Shimoda wrote:
> > > This patch series is based on renesas-drivers.git /
> > > renesas-drivers-2019-08-13-v5.3-rc4 tag. This is minor modifications
> > > to add support for changed registers memory mapping hardware support
> > > easily in the future.
> > 
> > This fails to apply for me, please rebase and resend.
> 
> I'm sorry for this. I'll rebase this patch series.
> Also, I'll rebase the following patch as one series.
> https://patchwork.kernel.org/patch/11118639/
> 
> And, note that the following patch [1] is already superseded.
> https://patchwork.kernel.org/patch/11118637/

Yes I think I picked the v2, please check my -next and send updated if
any on top of that :)

-- 
~Vinod

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-04  9:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 11:10 [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Yoshihiro Shimoda
2019-08-27 11:10 ` [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Yoshihiro Shimoda
2019-08-27 13:08   ` Geert Uytterhoeven
2019-08-31  8:36     ` Simon Horman
2019-08-27 11:10 ` [PATCH 2/2] dmaengine: rcar-dmac: Use devm_platform_ioremap_resource() Yoshihiro Shimoda
2019-08-27 13:10   ` Geert Uytterhoeven
2019-09-04  6:09 ` [PATCH 0/2] dmaengine: rcar-dmac: minor modifications Vinod Koul
2019-09-04  6:14   ` Yoshihiro Shimoda
2019-09-04  9:33     ` Vinod Koul

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).