public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: viresh kumar <viresh.kumar@st.com>
To: "Koul, Vinod" <vinod.koul@intel.com>
Cc: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	Linus WALLEIJ <linus.walleij@stericsson.com>,
	amitgoel <amit.goel@st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Armando VISCONTI <armando.visconti@st.com>,
	Shiraz HASHIM <shiraz.hashim@st.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 8/8 resend] dw_dmac.c: Pass Channel Priority from platform_data
Date: Thu, 3 Mar 2011 09:21:53 +0530	[thread overview]
Message-ID: <4D6F1059.4010109@st.com> (raw)
In-Reply-To: <1299091561.6974.103.camel@vkoul-udesk3>

On 03/03/2011 12:16 AM, Koul, Vinod wrote:
> On Mon, 2011-02-28 at 16:11 +0530, Viresh Kumar wrote:
>> In Synopsys designware, channel priority is programmable. This patch adds
>> support for passing channel priority through platform data. By default Ascending
>> channel priority will be followed, i.e. channel 0 will get highest priority and
>> channel 7 will get lowest.
>>
>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>> ---
>>  drivers/dma/dw_dmac.c      |   11 ++++++++++-
>>  drivers/dma/dw_dmac_regs.h |    3 +++
>>  include/linux/dw_dmac.h    |    4 +++-
>>  3 files changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
>> index 37ffd2c..edb3d3b 100644
>> --- a/drivers/dma/dw_dmac.c
>> +++ b/drivers/dma/dw_dmac.c
>> @@ -896,8 +896,11 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
>>  		BUG_ON(!dws->dma_dev || dws->dma_dev != dw->dma.dev);
>>  
>>  		cfghi = dws->cfg_hi;
>> -		cfglo = dws->cfg_lo;
>> +		cfglo = dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
>>  	}
>> +
>> +	cfglo |= DWC_CFGL_CH_PRIOR(dwc->priority);
>> +
>>  	channel_writel(dwc, CFG_LO, cfglo);
>>  	channel_writel(dwc, CFG_HI, cfghi);
>>  
>> @@ -1320,6 +1323,12 @@ static int __init dw_probe(struct platform_device *pdev)
>>  		else
>>  			list_add(&dwc->chan.device_node, &dw->dma.channels);
>>  
>> +		/* 7 is highest priority & 0 is lowest. */
>> +		if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING)
>> +			dwc->priority = 7 - i;
>> +		else
>> +			dwc->priority = i;
>> +
>>  		dwc->ch_regs = &__dw_regs(dw)->CHAN[i];
>>  		spin_lock_init(&dwc->lock);
>>  		dwc->mask = 1 << i;
>> diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
>> index d9a939f..6a8e6d3 100644
>> --- a/drivers/dma/dw_dmac_regs.h
>> +++ b/drivers/dma/dw_dmac_regs.h
>> @@ -101,6 +101,8 @@ struct dw_dma_regs {
>>  #define DWC_CTLH_BLOCK_TS_MASK	0x00000fff
>>  
>>  /* Bitfields in CFG_LO. Platform-configurable bits are in <linux/dw_dmac.h> */
>> +#define DWC_CFGL_CH_PRIOR_MASK	(0x7 << 5)	/* priority mask */
>> +#define DWC_CFGL_CH_PRIOR(x)	((x) << 5)	/* priority */
>>  #define DWC_CFGL_CH_SUSP	(1 << 8)	/* pause xfer */
>>  #define DWC_CFGL_FIFO_EMPTY	(1 << 9)	/* pause xfer */
>>  #define DWC_CFGL_HS_DST		(1 << 10)	/* handshake w/dst */
>> @@ -134,6 +136,7 @@ struct dw_dma_chan {
>>  	struct dma_chan		chan;
>>  	void __iomem		*ch_regs;
>>  	u8			mask;
>> +	u8			priority;
>>  
>>  	spinlock_t		lock;
>>  
>> diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
>> index 057e883..53072c8 100644
>> --- a/include/linux/dw_dmac.h
>> +++ b/include/linux/dw_dmac.h
>> @@ -22,6 +22,9 @@ struct dw_dma_platform_data {
>>  #define CHAN_ALLOCATION_ASCENDING	0	/* zero to seven */
>>  #define CHAN_ALLOCATION_DESCENDING	1	/* seven to zero */
>>  	unsigned int	chan_allocation_order;
>> +#define CHAN_PRIORITY_ASCENDING		0	/* chan0 highest */
>> +#define CHAN_PRIORITY_DESCENDING	1	/* chan7 highest */
> How about generic CHAN_ORDER_ASCENDING which you can use in both?

By both, you probably mean, both for allocation and priority??
Actually i thought of this, but realized thought, people might want
to control them separately. They may want priority ascending (0 to 7),
but may need allocation in reverse order (7 to 0). So kept them separate.
What do you say??

--
viresh

  reply	other threads:[~2011-03-03  3:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 10:41 [PATCH 0/8 resend] dw_dmac: Extending support & minor fixes Viresh Kumar
2011-02-28 10:41 ` [PATCH 1/8 resend] dw_dmac: Remove compilation dependency from AVR32 Viresh Kumar
2011-03-02 16:46   ` Koul, Vinod
2011-03-03  3:42     ` viresh kumar
2011-03-03  4:19       ` Shiraz Hashim
2011-03-05 11:38         ` Russell King - ARM Linux
2011-03-07  4:15           ` viresh kumar
2011-02-28 10:41 ` [PATCH 2/8 resend] dw_dmac: Move single descriptor from dwc->queue to dwc->active_list in dwc_complete_all Viresh Kumar
2011-02-28 10:41 ` [PATCH 3/8 resend] dw_dmac: call dwc_scan_descriptor from dwc_issue_pending only if active list is empty Viresh Kumar
2011-02-28 10:46   ` Jamie Iles
2011-02-28 10:58     ` viresh kumar
2011-02-28 10:41 ` [PATCH 4/8 resend] dw_dmac: calling dwc_scan_descriptors from dwc_tx_status() after taking lock Viresh Kumar
2011-03-02 18:13   ` Koul, Vinod
2011-03-03  3:44     ` viresh kumar
2011-02-28 10:41 ` [PATCH 5/8 resend] dw_dmac: adding support for 64 bit access width for memcpy xfers Viresh Kumar
2011-02-28 10:41 ` [PATCH 6/8 resend] dw_dmac: Mark all tx_descriptors with DMA_CRTL_ACK after xfer finish Viresh Kumar
2011-02-28 12:05   ` Sergei Shtylyov
2011-02-28 15:04     ` viresh kumar
2011-03-02 18:34   ` Koul, Vinod
2011-03-03  3:45     ` viresh kumar
2011-02-28 10:41 ` [PATCH 7/8 resend] dw_dmac.c: Pass Channel Allocation Order from platform_data Viresh Kumar
2011-03-02 18:37   ` Koul, Vinod
2011-03-03  3:48     ` viresh kumar
2011-02-28 10:41 ` [PATCH 8/8 resend] dw_dmac.c: Pass Channel Priority " Viresh Kumar
2011-03-02 18:46   ` Koul, Vinod
2011-03-03  3:51     ` viresh kumar [this message]
2011-03-02 16:39 ` [PATCH 0/8 resend] dw_dmac: Extending support & minor fixes Koul, Vinod
2011-03-03  3:40   ` viresh kumar

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=4D6F1059.4010109@st.com \
    --to=viresh.kumar@st.com \
    --cc=amit.goel@st.com \
    --cc=armando.visconti@st.com \
    --cc=dan.j.williams@intel.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shiraz.hashim@st.com \
    --cc=vinod.koul@intel.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