linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] dma: mxs-dma: let dma_is_apbh and apbh_is_old take parameter
Date: Wed, 9 May 2012 11:00:34 +0200	[thread overview]
Message-ID: <201205091100.34314.marex@denx.de> (raw)
In-Reply-To: <1336552827.1540.165.camel@vkoul-udesk3>

Dear Vinod Koul,

> On Mon, 2012-05-07 at 22:23 +0800, Shawn Guo wrote:
> > Let macros dma_is_apbh and apbh_is_old take mxs_dma as parameter
> > to make the code easy to read.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > ---
> > 
> >  drivers/dma/mxs-dma.c |   24 ++++++++++++------------
> >  1 files changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > index bd27818..e801fbf 100644
> > --- a/drivers/dma/mxs-dma.c
> > +++ b/drivers/dma/mxs-dma.c
> > @@ -38,10 +38,10 @@
> > 
> >  #define MXS_DMA_APBH		0
> >  #define MXS_DMA_APBX		1
> > 
> > -#define dma_is_apbh()		(mxs_dma->dev_id == MXS_DMA_APBH)
> > +#define dma_is_apbh(mxs_dma)	(mxs_dma->dev_id == MXS_DMA_APBH)
> > 
> >  #define APBH_VERSION_LATEST	3
> > 
> > -#define apbh_is_old()		(mxs_dma->version < APBH_VERSION_LATEST)
> > +#define apbh_is_old(mxs_dma)	(mxs_dma->version < APBH_VERSION_LATEST)
> > 
> >  #define HW_APBHX_CTRL0				0x000
> >  #define BM_APBH_CTRL0_APB_BURST8_EN		(1 << 29)
> > 
> > @@ -54,10 +54,10 @@
> > 
> >  #define HW_APBH_VERSION				(cpu_is_mx23() ? 0x3f0 : 
0x800)
> >  #define HW_APBX_VERSION				0x800
> >  #define BP_APBHX_VERSION_MAJOR			24
> > 
> > -#define HW_APBHX_CHn_NXTCMDAR(n) \
> > -	(((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 0x70)
> > -#define HW_APBHX_CHn_SEMA(n) \
> > -	(((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 0x70)
> > +#define HW_APBHX_CHn_NXTCMDAR(d, n) \
> > +	(((dma_is_apbh(d) && apbh_is_old(d)) ? 0x050 : 0x110) + (n) * 0x70)
> > +#define HW_APBHX_CHn_SEMA(d, n) \
> > +	(((dma_is_apbh(d) && apbh_is_old(d)) ? 0x080 : 0x140) + (n) * 0x70)
> 
> while at it, care to say what the above magic numbers mean. Isnt
> terrible clear to me.

Check the email above ;-) I think simple comment would be enough here, but 
defining those would not hurt either.

> 
> >  /*
> >  
> >   * ccw bits definitions
> > 
> > @@ -136,7 +136,7 @@ static void mxs_dma_reset_chan(struct mxs_dma_chan
> > *mxs_chan)
> > 
> >  	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> >  	int chan_id = mxs_chan->chan.chan_id;
> > 
> > -	if (dma_is_apbh() && apbh_is_old())
> > +	if (dma_is_apbh(mxs_dma) && apbh_is_old(mxs_dma))
> > 
> >  		writel(1 << (chan_id + BP_APBH_CTRL0_RESET_CHANNEL),
> >  		
> >  			mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> >  	
> >  	else
> > 
> > @@ -151,10 +151,10 @@ static void mxs_dma_enable_chan(struct mxs_dma_chan
> > *mxs_chan)
> > 
> >  	/* set cmd_addr up */
> >  	writel(mxs_chan->ccw_phys,
> > 
> > -		mxs_dma->base + HW_APBHX_CHn_NXTCMDAR(chan_id));
> > +		mxs_dma->base + HW_APBHX_CHn_NXTCMDAR(mxs_dma, chan_id));
> > 
> >  	/* write 1 to SEMA to kick off the channel */
> > 
> > -	writel(1, mxs_dma->base + HW_APBHX_CHn_SEMA(chan_id));
> > +	writel(1, mxs_dma->base + HW_APBHX_CHn_SEMA(mxs_dma, chan_id));
> > 
> >  }
> >  
> >  static void mxs_dma_disable_chan(struct mxs_dma_chan *mxs_chan)
> > 
> > @@ -168,7 +168,7 @@ static void mxs_dma_pause_chan(struct mxs_dma_chan
> > *mxs_chan)
> > 
> >  	int chan_id = mxs_chan->chan.chan_id;
> >  	
> >  	/* freeze the channel */
> > 
> > -	if (dma_is_apbh() && apbh_is_old())
> > +	if (dma_is_apbh(mxs_dma) && apbh_is_old(mxs_dma))
> > 
> >  		writel(1 << chan_id,
> >  		
> >  			mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> >  	
> >  	else
> > 
> > @@ -184,7 +184,7 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan
> > *mxs_chan)
> > 
> >  	int chan_id = mxs_chan->chan.chan_id;
> >  	
> >  	/* unfreeze the channel */
> > 
> > -	if (dma_is_apbh() && apbh_is_old())
> > +	if (dma_is_apbh(mxs_dma) && apbh_is_old(mxs_dma))
> > 
> >  		writel(1 << chan_id,
> >  		
> >  			mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_CLR);
> >  	
> >  	else
> > 
> > @@ -578,7 +578,7 @@ static int __init mxs_dma_init(struct mxs_dma_engine
> > *mxs_dma)
> > 
> >  				BP_APBHX_VERSION_MAJOR;
> >  	
> >  	/* enable apbh burst */
> > 
> > -	if (dma_is_apbh()) {
> > +	if (dma_is_apbh(mxs_dma)) {
> > 
> >  		writel(BM_APBH_CTRL0_APB_BURST_EN,
> >  		
> >  			mxs_dma->base + HW_APBHX_CTRL0 + STMP_OFFSET_REG_SET);
> >  		
> >  		writel(BM_APBH_CTRL0_APB_BURST8_EN,

Best regards,
Marek Vasut

  reply	other threads:[~2012-05-09  9:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 14:23 [PATCH 0/6] Add device tree support for mxs-dma Shawn Guo
2012-05-07 14:23 ` [PATCH 1/6] dma: mxs-dma: use global stmp_device functionality Shawn Guo
2012-05-07 23:34   ` Marek Vasut
2012-05-07 14:23 ` [PATCH 2/6] dma: mxs-dma: let dma_is_apbh and apbh_is_old take parameter Shawn Guo
2012-05-07 23:37   ` Marek Vasut
2012-05-08 14:03     ` Shawn Guo
2012-05-09  8:40   ` Vinod Koul
2012-05-09  9:00     ` Marek Vasut [this message]
2012-05-09  9:02       ` Vinod Koul
2012-05-09  9:16         ` Marek Vasut
2012-05-09  9:32           ` Shawn Guo
2012-05-07 14:23 ` [PATCH 3/6] dma: mxs-dma: make platform_device_id more generic Shawn Guo
2012-05-07 23:38   ` Marek Vasut
2012-05-07 14:23 ` [PATCH 4/6] dma: mxs-dma: add device tree probe support Shawn Guo
2012-05-07 23:39   ` Marek Vasut
2012-05-07 14:23 ` [PATCH 5/6] ARM: mxs: do not add dma device by default Shawn Guo
2012-05-07 23:40   ` Marek Vasut
2012-05-07 14:23 ` [PATCH 6/6] ARM: mxs: add mxs-dma dt support Shawn Guo
2012-05-07 23:40   ` Marek Vasut

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=201205091100.34314.marex@denx.de \
    --to=marex@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).