diff mbox

[1/7] mmc: tmio: add .enable_dma

Message ID 87d27lve84.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto Dec. 15, 2014, 2:27 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Some controllers need DMA special register/setting.
This patch adds new .enable_dma callback for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/tmio_mmc_dma.c |    3 +++
 include/linux/mfd/tmio.h        |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Ulf Hansson Dec. 19, 2014, 11:52 a.m. UTC | #1
On 15 December 2014 at 03:27, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Some controllers need DMA special register/setting.
> This patch adds new .enable_dma callback for it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/tmio_mmc_dma.c |    3 +++
>  include/linux/mfd/tmio.h        |    4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index 7d07738..f0bf6df 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -30,6 +30,9 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
>
>         if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
>                 sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
> +
> +       if (host->pdata->dma->enable)
> +               host->pdata->dma->enable(host, enable);
>  }
>
>  void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 5738817..6788f9b 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
>  void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>
>  struct dma_chan;
> +struct tmio_mmc_host;
>
>  struct tmio_mmc_dma {
>         void *chan_priv_tx;
> @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
>         int alignment_shift;
>         dma_addr_t dma_rx_offset;
>         bool (*filter)(struct dma_chan *chan, void *arg);
> +       void (*enable)(struct tmio_mmc_host *host, bool enable);

Before we decide to add more callbacks to this struct, can we please
try to move the mmc specific parts into the mmc tmio specific header?
drivers/mmc/host/tmio_mmc.h.

For example the tmio_mmc_dma can be moved there.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Dec. 24, 2014, 1:19 a.m. UTC | #2
Hi Ulf

> On 15 December 2014 at 03:27, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Some controllers need DMA special register/setting.
> > This patch adds new .enable_dma callback for it.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/tmio_mmc_dma.c |    3 +++
> >  include/linux/mfd/tmio.h        |    4 ++--
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index 7d07738..f0bf6df 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -30,6 +30,9 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
> >
> >         if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
> >                 sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
> > +
> > +       if (host->pdata->dma->enable)
> > +               host->pdata->dma->enable(host, enable);
> >  }
> >
> >  void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 5738817..6788f9b 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
> >  void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> >
> >  struct dma_chan;
> > +struct tmio_mmc_host;
> >
> >  struct tmio_mmc_dma {
> >         void *chan_priv_tx;
> > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
> >         int alignment_shift;
> >         dma_addr_t dma_rx_offset;
> >         bool (*filter)(struct dma_chan *chan, void *arg);
> > +       void (*enable)(struct tmio_mmc_host *host, bool enable);
> 
> Before we decide to add more callbacks to this struct, can we please
> try to move the mmc specific parts into the mmc tmio specific header?
> drivers/mmc/host/tmio_mmc.h.
> 
> For example the tmio_mmc_dma can be moved there.

OK, I understand
Will do

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Dec. 24, 2014, 1:30 a.m. UTC | #3
Hi Ulf, again

> > >  void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> > > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > > index 5738817..6788f9b 100644
> > > --- a/include/linux/mfd/tmio.h
> > > +++ b/include/linux/mfd/tmio.h
> > > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
> > >  void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> > >
> > >  struct dma_chan;
> > > +struct tmio_mmc_host;
> > >
> > >  struct tmio_mmc_dma {
> > >         void *chan_priv_tx;
> > > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
> > >         int alignment_shift;
> > >         dma_addr_t dma_rx_offset;
> > >         bool (*filter)(struct dma_chan *chan, void *arg);
> > > +       void (*enable)(struct tmio_mmc_host *host, bool enable);
> > 
> > Before we decide to add more callbacks to this struct, can we please
> > try to move the mmc specific parts into the mmc tmio specific header?
> > drivers/mmc/host/tmio_mmc.h.
> > 
> > For example the tmio_mmc_dma can be moved there.

Hmm....
tmio_mmc_dma is used from tmio_mmc_data.
And, tmio_mmc_data is used from drivers/mfd/xxx.c
It seems impossible to move it.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Dec. 30, 2014, 12:12 p.m. UTC | #4
On 24 December 2014 at 02:30, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Ulf, again
>
>> > >  void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
>> > > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
>> > > index 5738817..6788f9b 100644
>> > > --- a/include/linux/mfd/tmio.h
>> > > +++ b/include/linux/mfd/tmio.h
>> > > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
>> > >  void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>> > >
>> > >  struct dma_chan;
>> > > +struct tmio_mmc_host;
>> > >
>> > >  struct tmio_mmc_dma {
>> > >         void *chan_priv_tx;
>> > > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
>> > >         int alignment_shift;
>> > >         dma_addr_t dma_rx_offset;
>> > >         bool (*filter)(struct dma_chan *chan, void *arg);
>> > > +       void (*enable)(struct tmio_mmc_host *host, bool enable);
>> >
>> > Before we decide to add more callbacks to this struct, can we please
>> > try to move the mmc specific parts into the mmc tmio specific header?
>> > drivers/mmc/host/tmio_mmc.h.
>> >
>> > For example the tmio_mmc_dma can be moved there.
>
> Hmm....
> tmio_mmc_dma is used from tmio_mmc_data.
> And, tmio_mmc_data is used from drivers/mfd/xxx.c
> It seems impossible to move it.

Doesn't a forward declaration of struct tmio_mmc_dma; in
linux/mfd/tmio.h solve that?

Moreover I did a git grep search for "tmio_mmc_data" to find out
what's being provided to the tmio mmc driver as platform data. Unless
my research was wrong, I only find the following being used:
.hclk
.set_pwr
.set_clk_div

So, we can clean up the struct tmio_mmc_data. That will in
linux/mfd/tmio.h remove the dependency to forward declare both struct
tmio_mmc_host and struct tmio_mmc_dma.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 7d07738..f0bf6df 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -30,6 +30,9 @@  void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
 
 	if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
 		sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
+
+	if (host->pdata->dma->enable)
+		host->pdata->dma->enable(host, enable);
 }
 
 void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 5738817..6788f9b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -111,6 +111,7 @@  void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
 void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
 
 struct dma_chan;
+struct tmio_mmc_host;
 
 struct tmio_mmc_dma {
 	void *chan_priv_tx;
@@ -120,10 +121,9 @@  struct tmio_mmc_dma {
 	int alignment_shift;
 	dma_addr_t dma_rx_offset;
 	bool (*filter)(struct dma_chan *chan, void *arg);
+	void (*enable)(struct tmio_mmc_host *host, bool enable);
 };
 
-struct tmio_mmc_host;
-
 /*
  * data for the MMC controller
  */