李燎原
2008-12-03



发件人: [EMAIL PROTECTED]
发送时间: 2008-12-03 12:01:29
收件人: [email protected]
抄送: 
主题: Davinci-linux-open-source Digest, Vol 36, Issue 8

Send Davinci-linux-open-source mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Davinci-linux-open-source digest..."


Today's Topics:

   1. DM355 on the depth of the problem of sleep mode? (amingaming)
   2. [PATCH 5/7] ARM: DaVinci: dma: return -EINVAL (Troy Kisky)
   3. [PATCH 3/7] ARM: DaVinci: dma: Set irq parameters before
      enabling (Troy Kisky)
   4. [PATCH 2/7] ARM: DaVinci: Notice missed dma events 32-63
      (Troy Kisky)
   5. [PATCH 1/7] ARM: DaVinci: Don't read from write only
      registers (Troy Kisky)
   6. [PATCH 4/7] ARM: DaVinci: dma: readability change (Troy Kisky)


----------------------------------------------------------------------

Message: 1
Date: Wed, 3 Dec 2008 10:52:42 +0800
From: amingaming  <[EMAIL PROTECTED] >
Subject: DM355 on the depth of the problem of sleep mode?
To:  <[email protected] >
Message-ID:  <[EMAIL PROTECTED] >
Content-Type: text/plain; charset="gb2312"


Dear all:
    USED TI LSP 1.20 (Linux 2.6.10), and based on:               
http://www.mail-archive.com/[email protected]/msg04407.html
    
    GIO00 low DM355 into SLEEP, GIO00 change to wake up high, but after SLEEP 
into the low power consumption has not    changed, TI in the document referred 
to DEEP SLEEP power only 1mw! Who can put a complete code enough? 
               Thank you!
               Regards,               aming
_________________________________________________________________
超炫人气榜给您所有偶像的最新资讯和排名,快来支持自己的偶像!
http://cnweb.search.live.com/xrank/results.aspx?q=%e5%91%a8%e6%9d%b0%e4%bc%a6&FORM=MSNH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://linux.omap.com/pipermail/davinci-linux-open-source/attachments/20081203/6456d0f2/attachment-0001.htm

------------------------------

Message: 2
Date: Tue,  2 Dec 2008 20:20:56 -0700
From: Troy Kisky  <[EMAIL PROTECTED] >
Subject: [PATCH 5/7] ARM: DaVinci: dma: return -EINVAL
To: [email protected]
Message-ID:
<[EMAIL PROTECTED] >

davinci_start_dma should return -EINVAL
instead of EINVAL.

Signed-off-by: Troy Kisky  <[EMAIL PROTECTED] >

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 5849f18..cfe63a4 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -1329,7 +1329,7 @@ int davinci_start_dma(int lch)
      (1  < < (lch - DAVINCI_EDMA_QSTART));
  ret_val = 0;
  } else { /* for slaveChannels */
- ret_val = EINVAL;
+ ret_val = -EINVAL;
  }
  return ret_val;
 }
-- 
1.5.4.3




------------------------------

Message: 3
Date: Tue,  2 Dec 2008 20:20:54 -0700
From: Troy Kisky  <[EMAIL PROTECTED] >
Subject: [PATCH 3/7] ARM: DaVinci: dma: Set irq parameters before
enabling
To: [email protected]
Message-ID:
<[EMAIL PROTECTED] >

In request_dma_interrupt, set the irq parameters before
enabling the interrupt.

Signed-off-by: Troy Kisky  <[EMAIL PROTECTED] >

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 19ee7c7..fdb2bbd 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -444,12 +444,12 @@ static int request_dma_interrupt(int lch,
  }
  }
  if (free_intr_no  >= 0 && free_intr_no  < 64) {
+ intr_data[free_intr_no].callback = callback;
+ intr_data[free_intr_no].data = data;
  (free_intr_no  < 32) ?
      (ptr_edmacc_regs- >shadow[0].iesr = (1UL  < < free_intr_no))
      : (ptr_edmacc_regs- >shadow[0].iesrh =
         (1UL  < < (free_intr_no - 32)));
- intr_data[free_intr_no].callback = callback;
- intr_data[free_intr_no].data = data;
  }
  return free_intr_no;
 }
-- 
1.5.4.3




------------------------------

Message: 4
Date: Tue,  2 Dec 2008 20:20:53 -0700
From: Troy Kisky  <[EMAIL PROTECTED] >
Subject: [PATCH 2/7] ARM: DaVinci: Notice missed dma events 32-63
To: [email protected]
Message-ID:
<[EMAIL PROTECTED] >

A copy/paste bug causes missed dma events 32-63 (i.e. underrun)
to be missed.

Signed-off-by: Troy Kisky  <[EMAIL PROTECTED] >

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 3a5da88..19ee7c7 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -575,7 +575,7 @@ static void dma_ccerr_handler(void)
  int i;
  unsigned int cnt;
  cnt = 0;
- if ((ptr_edmacc_regs- >emr == 0) && (ptr_edmacc_regs- >emr == 0) &&
+ if ((ptr_edmacc_regs- >emr == 0) && (ptr_edmacc_regs- >emrh == 0) &&
      (ptr_edmacc_regs- >qemr == 0) && (ptr_edmacc_regs- >ccerr == 0))
  return;
  while (1) {
@@ -606,11 +606,12 @@ static void dma_ccerr_handler(void)
  /* Clear any SER */
  ptr_edmacc_regs- >shadow[0].secrh =
      (1  < < i);
- if (intr_data[i].callback) {
- intr_data[i].callback(i,
-       DMA_CC_ERROR,
-       intr_data
-       [i].data);
+ if (intr_data[32 + i].callback) {
+ intr_data[32 + i].callback(
+ 32 + i,
+ DMA_CC_ERROR,
+ intr_data
+ [32 + i].data);
  }
  }
  }
-- 
1.5.4.3




------------------------------

Message: 5
Date: Tue,  2 Dec 2008 20:20:52 -0700
From: Troy Kisky  <[EMAIL PROTECTED] >
Subject: [PATCH 1/7] ARM: DaVinci: Don't read from write only
registers
To: [email protected]
Message-ID:
<[EMAIL PROTECTED] >

This patch removes reads of the following registers:

esr, esrh, eesr, eesrh, iesr, iesrh, qeesr
 are write 1 to set registers

ecr, ecrh, eecr, eecrh, emcr, emcrh,
icr, icrh, secr, secrh,
ccerrclr, qeecr, qemcr, qsecr,
 are write 1 to clear registers

Signed-off-by: Troy Kisky  <[EMAIL PROTECTED] >

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 51f80ae..3a5da88 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -445,8 +445,8 @@ static int request_dma_interrupt(int lch,
  }
  if (free_intr_no  >= 0 && free_intr_no  < 64) {
  (free_intr_no  < 32) ?
-     (ptr_edmacc_regs- >shadow[0].iesr |= (1UL  < < free_intr_no))
-     : (ptr_edmacc_regs- >shadow[0].iesrh |=
+     (ptr_edmacc_regs- >shadow[0].iesr = (1UL  < < free_intr_no))
+     : (ptr_edmacc_regs- >shadow[0].iesrh =
         (1UL  < < (free_intr_no - 32)));
  intr_data[free_intr_no].callback = callback;
  intr_data[free_intr_no].data = data;
@@ -467,9 +467,9 @@ static int request_dma_interrupt(int lch,
 static void free_dma_interrupt(int intr_no)
 {
  if (intr_no  >= 0 && intr_no  < 64) {
- (intr_no  < 32) ? (ptr_edmacc_regs- >shadow[0].icr |=
+ (intr_no  < 32) ? (ptr_edmacc_regs- >shadow[0].icr =
    (1UL  < < (intr_no))) : (ptr_edmacc_regs- >
-  shadow[0].icrh |=
+  shadow[0].icrh =
   (1UL  < <
    (intr_no - 32)));
  LOCK;
@@ -522,7 +522,7 @@ static void dma_irq_handler(void)
  for (i = 0; i  < 32; i++) {
  if (ptr_edmacc_regs- >shadow[0].ipr & (1  < < i)) {
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >shadow[0].icr |=
+ ptr_edmacc_regs- >shadow[0].icr =
      (1  < < i);
  if (intr_data[i].callback) {
  intr_data[i].callback(i,
@@ -539,7 +539,7 @@ static void dma_irq_handler(void)
  for (i = 0; i  < 32; i++) {
  if (ptr_edmacc_regs- >shadow[0].iprh & (1  < < i)) {
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >shadow[0].icrh |=
+ ptr_edmacc_regs- >shadow[0].icrh =
      (1  < < i);
  if (intr_data[32 + i].callback) {
  intr_data[32 + i].callback(32 +
@@ -584,9 +584,9 @@ static void dma_ccerr_handler(void)
  for (i = 0; i  < 32; i++) {
  if (ptr_edmacc_regs- >emr & (1  < < i)) {
  /* Clear the corresponding EMR bits */
- ptr_edmacc_regs- >emcr |= (1  < < i);
+ ptr_edmacc_regs- >emcr = (1  < < i);
  /* Clear any SER */
- ptr_edmacc_regs- >shadow[0].secr |=
+ ptr_edmacc_regs- >shadow[0].secr =
      (1  < < i);
  if (intr_data[i].callback) {
  intr_data[i].callback(i,
@@ -602,9 +602,9 @@ static void dma_ccerr_handler(void)
  for (i = 0; i  < 32; i++) {
  if (ptr_edmacc_regs- >emrh & (1  < < i)) {
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >emcrh |= (1  < < i);
+ ptr_edmacc_regs- >emcrh = (1  < < i);
  /* Clear any SER */
- ptr_edmacc_regs- >shadow[0].secrh |=
+ ptr_edmacc_regs- >shadow[0].secrh =
      (1  < < i);
  if (intr_data[i].callback) {
  intr_data[i].callback(i,
@@ -620,8 +620,8 @@ static void dma_ccerr_handler(void)
  for (i = 0; i  < 8; i++) {
  if (ptr_edmacc_regs- >qemr & (1  < < i)) {
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >qemcr |= (1  < < i);
- ptr_edmacc_regs- >shadow[0].qsecr |=
+ ptr_edmacc_regs- >qemcr = (1  < < i);
+ ptr_edmacc_regs- >shadow[0].qsecr =
      (1  < < i);
  }
  }
@@ -631,7 +631,7 @@ static void dma_ccerr_handler(void)
  for (i = 0; i  < 8; i++) {
  if (ptr_edmacc_regs- >ccerr & (1  < < i)) {
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >ccerrclr |= (1  < < i);
+ ptr_edmacc_regs- >ccerrclr = (1  < < i);
  }
  }
  }
@@ -1318,9 +1318,9 @@ int davinci_start_dma(int lch)
  ptr_edmacc_regs- >shadow[0].esr);

  (lch  < 32) ?
-     (ptr_edmacc_regs- >shadow[0].esr |=
+     (ptr_edmacc_regs- >shadow[0].esr =
       (1UL  < < lch)) : (ptr_edmacc_regs- >
-       shadow[0].esrh |=
+       shadow[0].esrh =
        (1UL  < < (lch - 32)));
  flag = 1;
  ret_val = 0;
@@ -1334,20 +1334,20 @@ int davinci_start_dma(int lch)
  ptr_edmacc_regs- >shadow[0].er);
  /* Clear any pedning error */
  (lch  < 32) ?
-     (ptr_edmacc_regs- >emcr |=
+     (ptr_edmacc_regs- >emcr =
       (1UL  < < lch)) :
-     (ptr_edmacc_regs- >emcrh |= (1UL  < < (lch - 32)));
+     (ptr_edmacc_regs- >emcrh = (1UL  < < (lch - 32)));
  /* Clear any SER */
  (lch  < 32) ?
-     (ptr_edmacc_regs- >shadow[0].secr |=
+     (ptr_edmacc_regs- >shadow[0].secr =
       (1UL  < < lch)) :
-     (ptr_edmacc_regs- >shadow[0].secrh |=
+     (ptr_edmacc_regs- >shadow[0].secrh =
       (1UL  < < (lch - 32)));

  (lch  < 32) ?
-     (ptr_edmacc_regs- >shadow[0].eesr |=
+     (ptr_edmacc_regs- >shadow[0].eesr =
       (1UL  < < lch)) :
-     (ptr_edmacc_regs- >shadow[0].eesrh |=
+     (ptr_edmacc_regs- >shadow[0].eesrh =
       (1UL  < < (lch - 32)));

  dev_dbg(&edma_dev.dev, "EER=%d\r\n",
@@ -1357,7 +1357,7 @@ int davinci_start_dma(int lch)
  } else if ((lch  >= DAVINCI_EDMA_NUM_DMACH)
     && (lch  <
         (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))) {
- ptr_edmacc_regs- >shadow[0].qeesr |=
+ ptr_edmacc_regs- >shadow[0].qeesr =
      (1  < < (lch - DAVINCI_EDMA_NUM_DMACH));
  ret_val = 0;
  } else { /* for slaveChannels */
@@ -1392,15 +1392,15 @@ void davinci_stop_dma(int lch)
  }
  if (!flag) {
  /* EDMA channel with event association */
- (lch  < 32) ? (ptr_edmacc_regs- >shadow[0].eecr |=
+ (lch  < 32) ? (ptr_edmacc_regs- >shadow[0].eecr =
        (1UL  < < lch)) :
-     (ptr_edmacc_regs- >shadow[0].eecrh |=
+     (ptr_edmacc_regs- >shadow[0].eecrh =
       (1UL  < < (lch - 32)));
  if (lch  < 32) {
  if (ptr_edmacc_regs- >shadow[0].er & (1  < < lch)) {
  dev_dbg(&edma_dev.dev, "ER=%x\n",
  ptr_edmacc_regs- >shadow[0].er);
- ptr_edmacc_regs- >shadow[0].ecr |=
+ ptr_edmacc_regs- >shadow[0].ecr =
      (1  < < lch);
  }
  } else {
@@ -1408,7 +1408,7 @@ void davinci_stop_dma(int lch)
      & (1  < < (lch - 32))) {
  dev_dbg(&edma_dev.dev, "ERH=%x\n",
  ptr_edmacc_regs- >shadow[0].erh);
- ptr_edmacc_regs- >shadow[0].ecrh |=
+ ptr_edmacc_regs- >shadow[0].ecrh =
      (1  < < (lch - 32));
  }
  }
@@ -1416,7 +1416,7 @@ void davinci_stop_dma(int lch)
  if (ptr_edmacc_regs- >shadow[0].ser & (1  < < lch)) {
  dev_dbg(&edma_dev.dev, "SER=%x\n",
  ptr_edmacc_regs- >shadow[0].ser);
- ptr_edmacc_regs- >shadow[0].secr |=
+ ptr_edmacc_regs- >shadow[0].secr =
      (1  < < lch);
  } else {
  }
@@ -1426,7 +1426,7 @@ void davinci_stop_dma(int lch)
  dev_dbg(&edma_dev.dev, "SERH=%x\n",
  ptr_edmacc_regs- >shadow[0].
  serh);
- ptr_edmacc_regs- >shadow[0].secrh |=
+ ptr_edmacc_regs- >shadow[0].secrh =
      (1  < < (lch - 32));
  }
  }
@@ -1434,13 +1434,13 @@ void davinci_stop_dma(int lch)
  if (ptr_edmacc_regs- >emr & (1  < < lch)) {
  dev_dbg(&edma_dev.dev, "EMR=%x\n",
  ptr_edmacc_regs- >emr);
- ptr_edmacc_regs- >emcr |= (1  < < lch);
+ ptr_edmacc_regs- >emcr = (1  < < lch);
  }
  } else {
  if (ptr_edmacc_regs- >emrh & (1  < < (lch - 32))) {
  dev_dbg(&edma_dev.dev, "EMRH=%x\n",
  ptr_edmacc_regs- >emrh);
- ptr_edmacc_regs- >emcrh |=
+ ptr_edmacc_regs- >emcrh =
      (1  < < (lch - 32));
  }
  }
@@ -1454,7 +1454,7 @@ void davinci_stop_dma(int lch)
     &&
     (lch  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))) {
  /* for QDMA channels */
- ptr_edmacc_regs- >qeecr |= (1  < < (lch - DAVINCI_EDMA_NUM_DMACH));
+ ptr_edmacc_regs- >qeecr = (1  < < (lch - DAVINCI_EDMA_NUM_DMACH));
  dev_dbg(&edma_dev.dev, "QER=%d\r\n", ptr_edmacc_regs- >qer);
  dev_dbg(&edma_dev.dev, "QEER=%d\r\n", ptr_edmacc_regs- >qeer);
  } else if ((lch  >= (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))
@@ -1646,12 +1646,12 @@ void davinci_clean_channel(int ch_no)
  if (ch_no  < 32) {
  for (i = 0; i  < 32; i++) {
  if (ch_no == i) {
- ptr_edmacc_regs- >shadow[0].ecr |= (1  < < i);
+ ptr_edmacc_regs- >shadow[0].ecr = (1  < < i);
  /* Clear the corresponding EMR bits */
- ptr_edmacc_regs- >emcr |= (1  < < i);
+ ptr_edmacc_regs- >emcr = (1  < < i);
  /* Clear any SER */
- ptr_edmacc_regs- >shadow[0].secr |= (1  < < i);
- ptr_edmacc_regs- >ccerrclr |= ((1  < < 16) | 0x3);
+ ptr_edmacc_regs- >shadow[0].secr = (1  < < i);
+ ptr_edmacc_regs- >ccerrclr = ((1  < < 16) | 0x3);
  }
  }
  }
@@ -1660,12 +1660,12 @@ void davinci_clean_channel(int ch_no)
  dev_dbg(&edma_dev.dev, "EMRH =%d\r\n", ptr_edmacc_regs- >emrh);
  for (i = 0; i  < 32; i++) {
  if (ch_no == (i + 32)) {
- ptr_edmacc_regs- >shadow[0].ecrh |= (1  < < i);
+ ptr_edmacc_regs- >shadow[0].ecrh = (1  < < i);
  /* Clear the corresponding IPR bits */
- ptr_edmacc_regs- >emcrh |= (1  < < i);
+ ptr_edmacc_regs- >emcrh = (1  < < i);
  /* Clear any SER */
- ptr_edmacc_regs- >shadow[0].secrh |= (1  < < i);
- ptr_edmacc_regs- >ccerrclr |= ((1  < < 16) | 0x3);
+ ptr_edmacc_regs- >shadow[0].secrh = (1  < < i);
+ ptr_edmacc_regs- >ccerrclr = ((1  < < 16) | 0x3);
  }
  }
  }
-- 
1.5.4.3




------------------------------

Message: 6
Date: Tue,  2 Dec 2008 20:20:55 -0700
From: Troy Kisky  <[EMAIL PROTECTED] >
Subject: [PATCH 4/7] ARM: DaVinci: dma: readability change
To: [email protected]
Message-ID:
<[EMAIL PROTECTED] >

Use macro DAVINCI_EDMA_IS_Q to make
code easier to read

Signed-off-by: Troy Kisky  <[EMAIL PROTECTED] >

diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index fdb2bbd..5849f18 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -176,10 +176,8 @@ static void map_dmach_queue(int ch_no, int queue_no)
  ptr_edmacc_regs- >dmaqnum[ch_no  > > 3] &= (~(0x7  < < bit_start));
  ptr_edmacc_regs- >dmaqnum[ch_no  > > 3] |=
      ((queue_no & 0x7)  < < bit_start);
- } else if (ch_no  >= DAVINCI_EDMA_NUM_DMACH
-    &&
-    ch_no  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- int bit_start = (ch_no - DAVINCI_EDMA_NUM_DMACH) * 4;
+ } else if (DAVINCI_EDMA_IS_Q(ch_no)) {
+ int bit_start = (ch_no - DAVINCI_EDMA_QSTART) * 4;
  ptr_edmacc_regs- >qdmaqnum &= (~(0x7  < < bit_start));
  ptr_edmacc_regs- >qdmaqnum |= ((queue_no & 0x7)  < < bit_start);
  }
@@ -189,11 +187,10 @@ static void map_dmach_queue(int ch_no, int queue_no)
    entry */
 static void map_dmach_param(int ch_no, int param_no)
 {
- if (ch_no  >= DAVINCI_EDMA_NUM_DMACH
-     && ch_no  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- ptr_edmacc_regs- >qchmap[ch_no - DAVINCI_EDMA_NUM_DMACH] &=
+ if (DAVINCI_EDMA_IS_Q(ch_no)) {
+ ptr_edmacc_regs- >qchmap[ch_no - DAVINCI_EDMA_QSTART] &=
      ~(PAENTRY | TRWORD);
- ptr_edmacc_regs- >qchmap[ch_no - DAVINCI_EDMA_NUM_DMACH] |=
+ ptr_edmacc_regs- >qchmap[ch_no - DAVINCI_EDMA_QSTART] |=
      (((param_no & 0x1ff)  < < 5) | (QDMA_TRWORD  < < 2));
  }
 }
@@ -353,8 +350,7 @@ static int request_dma_interrupt(int lch,
  }

  /* qdma channels */
- else if (lch  >= DAVINCI_EDMA_NUM_DMACH
-  && lch  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ else if (DAVINCI_EDMA_IS_Q(lch)) {
  if (requested_tcc != TCC_ANY) {
  /* Complete allocation algo requires lock and as it's
     shared resources could be invoked by several thread.
@@ -432,8 +428,7 @@ static int request_dma_interrupt(int lch,
  if (is_break) {
  dev_dbg(&edma_dev.dev, "While allocating EDMA channel for QDMA");
  }
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(lch)) {
  if (free_intr_no  < 32) {
  ptr_edmacc_regs- >dra[0].drae =
      ptr_edmacc_regs- >dra[0].drae | (1  < < free_intr_no);
@@ -765,11 +760,9 @@ int davinci_request_dma(int dev_id, const char *name,
  dev_id);
  return -EINVAL;
  }
- } else if (dev_id  >= DAVINCI_EDMA_NUM_DMACH
-    && dev_id  <=
-    (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ } else if (DAVINCI_EDMA_IS_Q(dev_id)) {
  if (!(qdma_channels_arm[0] &
-       (0x1  < < (dev_id - DAVINCI_EDMA_NUM_DMACH)))) {
+       (0x1  < < (dev_id - DAVINCI_EDMA_QSTART)))) {

  dev_dbg(&edma_dev.dev,
  "dev_id = %d not supported on ARM side\r\n",
@@ -780,13 +773,10 @@ int davinci_request_dma(int dev_id, const char *name,

  if ((dev_id != DAVINCI_DMA_CHANNEL_ANY)
      && (dev_id != DAVINCI_EDMA_PARAM_ANY)) {
- if (dev_id  >= DAVINCI_EDMA_NUM_DMACH
-     &&
-     dev_id  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)
-     ) {
+ if (DAVINCI_EDMA_IS_Q(dev_id)) {
  ptr_edmacc_regs- >qrae[0] =
      ptr_edmacc_regs- >qrae[0] |
-     (1  < < (dev_id - DAVINCI_EDMA_NUM_DMACH));
+     (1  < < (dev_id - DAVINCI_EDMA_QSTART));
  } else {
  if (dev_id  < 32) {
  ptr_edmacc_regs- >dra[0].drae =
@@ -844,13 +834,12 @@ int davinci_request_dma(int dev_id, const char *name,
  ret_val = -EINVAL;
  }

- else if (dev_id  >= DAVINCI_EDMA_NUM_DMACH && dev_id  <
-  (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- if ((qdam_to_param_mapping[dev_id - DAVINCI_EDMA_NUM_DMACH] !=
+ else if (DAVINCI_EDMA_IS_Q(dev_id)) {
+ if ((qdam_to_param_mapping[dev_id - DAVINCI_EDMA_QSTART] !=
       -1)
      &&
      (dma_chan
-      [qdam_to_param_mapping[dev_id - DAVINCI_EDMA_NUM_DMACH]].
+      [qdam_to_param_mapping[dev_id - DAVINCI_EDMA_QSTART]].
       in_use)
      ) {
  ret_val = -EINVAL;
@@ -895,18 +884,12 @@ int davinci_request_dma(int dev_id, const char *name,
  }
  dev_dbg(&edma_dev.dev, "param_no=%d\r\n",
  dma_chan[*lch].param_no);
- if (dma_chan[*lch].param_no  >=
-     DAVINCI_EDMA_NUM_DMACH
-     &&
-     dma_chan[*lch].param_no  <
-     (DAVINCI_EDMA_NUM_DMACH +
-      DAVINCI_EDMA_NUM_QDMACH)
-     ) {
-
+ if (DAVINCI_EDMA_IS_Q(
+ dma_chan[*lch].param_no)) {
  ptr_edmacc_regs- >qrae[0] =
      ptr_edmacc_regs- >qrae[0] |
      (1  < < (dma_chan[*lch].param_no -
-    DAVINCI_EDMA_NUM_DMACH));
+    DAVINCI_EDMA_QSTART));

  } else {
  if (dma_chan[*lch].param_no  < 32) {
@@ -950,7 +933,7 @@ int davinci_request_dma(int dev_id, const char *name,

  else if (dev_id == DAVINCI_EDMA_PARAM_ANY) {
  ret_val = 0;
- for (i = (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH);
+ for (i = DAVINCI_EDMA_QEND;
       i  < DAVINCI_EDMA_NUM_PARAMENTRY; i++) {
  if (!dma_chan[i].in_use) {
  dev_dbg(&edma_dev.dev, "any link = %d\r\n", i);
@@ -977,27 +960,23 @@ int davinci_request_dma(int dev_id, const char *name,
  ret_val = -EINVAL;
  }
  if (!ret_val) {
- if (dev_id  >= DAVINCI_EDMA_NUM_DMACH && dev_id  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(dev_id)) {
  /* Master Channel */
- qdam_to_param_mapping[dev_id -
-       DAVINCI_EDMA_NUM_DMACH] =
-     dma_chan[*lch].param_no;
+ qdam_to_param_mapping[dev_id - DAVINCI_EDMA_QSTART] =
+ dma_chan[*lch].param_no;
  LOCK;
  /* It's used global data structure and used to find out
     whether channel is available or not */
  dma_chan[qdam_to_param_mapping
-  [dev_id - DAVINCI_EDMA_NUM_DMACH]].in_use = 1;
+  [dev_id - DAVINCI_EDMA_QSTART]].in_use = 1;
  UNLOCK;
  dma_chan[qdam_to_param_mapping
-  [dev_id - DAVINCI_EDMA_NUM_DMACH]].dev_id =
-     *lch;
+  [dev_id - DAVINCI_EDMA_QSTART]].dev_id = *lch;
  dma_chan[qdam_to_param_mapping
-  [dev_id - DAVINCI_EDMA_NUM_DMACH]].tcc =
-     dma_chan[*lch].tcc;
- temp_ch =
-     qdam_to_param_mapping[dev_id -
-   DAVINCI_EDMA_NUM_DMACH];
+  [dev_id - DAVINCI_EDMA_QSTART]].tcc =
+ dma_chan[*lch].tcc;
+ temp_ch = qdam_to_param_mapping
+ [dev_id - DAVINCI_EDMA_QSTART];
  dma_chan[temp_ch].param_no = dma_chan[*lch].param_no;
  if (dma_chan[*lch].tcc != -1) {
  ptr_edmacc_regs- >paramentry[dma_chan[temp_ch].
@@ -1064,9 +1043,8 @@ int davinci_request_dma(int dev_id, const char *name,
 void davinci_free_dma(int lch)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  LOCK;
@@ -1074,10 +1052,8 @@ void davinci_free_dma(int lch)
  UNLOCK;
  free_param(dma_chan[lch].param_no);

- if (lch  >= 0
-     && lch  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if ((lch  >= 0) && (lch  < DAVINCI_EDMA_QEND))
  free_dma_interrupt(dma_chan[lch].tcc);
- }
 }

 /******************************************************************************
@@ -1093,9 +1069,8 @@ void davinci_set_dma_src_params(int lch, unsigned long 
src_port,
  enum address_mode mode, enum fifo_width width)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1130,9 +1105,8 @@ void davinci_set_dma_dest_params(int lch, unsigned long 
dest_port,
   enum address_mode mode, enum fifo_width width)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1165,9 +1139,8 @@ void davinci_set_dma_dest_params(int lch, unsigned long 
dest_port,
 void davinci_set_dma_src_index(int lch, short src_bidx, short src_cidx)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }

@@ -1195,9 +1168,8 @@ void davinci_set_dma_src_index(int lch, short src_bidx, 
short src_cidx)
 void davinci_set_dma_dest_index(int lch, short dest_bidx, short dest_cidx)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1229,9 +1201,8 @@ void davinci_set_dma_transfer_params(int lch, unsigned 
short acnt,
       enum sync_dimension sync_mode)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1262,9 +1233,8 @@ void davinci_set_dma_transfer_params(int lch, unsigned 
short acnt,
 void davinci_set_dma_params(int lch, edmacc_paramentry_regs * temp)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1285,9 +1255,8 @@ void davinci_set_dma_params(int lch, 
edmacc_paramentry_regs * temp)
 void davinci_get_dma_params(int lch, edmacc_paramentry_regs * temp)
 {
  int temp_ch = 0;
- if (lch  >= DAVINCI_EDMA_NUM_DMACH && lch  <
-     (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch)) {
+ temp_ch = qdam_to_param_mapping[lch - DAVINCI_EDMA_QSTART];
  lch = temp_ch;
  }
  if (lch  >= 0 && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
@@ -1355,11 +1324,9 @@ int davinci_start_dma(int lch)
  ptr_edmacc_regs- >shadow[0].eer);
  ret_val = 0;
  }
- } else if ((lch  >= DAVINCI_EDMA_NUM_DMACH)
-    && (lch  <
-        (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))) {
+ } else if (DAVINCI_EDMA_IS_Q(lch)) {
  ptr_edmacc_regs- >shadow[0].qeesr =
-     (1  < < (lch - DAVINCI_EDMA_NUM_DMACH));
+     (1  < < (lch - DAVINCI_EDMA_QSTART));
  ret_val = 0;
  } else { /* for slaveChannels */
  ret_val = EINVAL;
@@ -1451,14 +1418,12 @@ void davinci_stop_dma(int lch)
     then just set the link field of the corresponding
     param entry to 0xffff */
  }
- } else if ((lch  >= DAVINCI_EDMA_NUM_DMACH)
-    &&
-    (lch  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))) {
+ } else if (DAVINCI_EDMA_IS_Q(lch)) {
  /* for QDMA channels */
- ptr_edmacc_regs- >qeecr = (1  < < (lch - DAVINCI_EDMA_NUM_DMACH));
+ ptr_edmacc_regs- >qeecr = (1  < < (lch - DAVINCI_EDMA_QSTART));
  dev_dbg(&edma_dev.dev, "QER=%d\r\n", ptr_edmacc_regs- >qer);
  dev_dbg(&edma_dev.dev, "QEER=%d\r\n", ptr_edmacc_regs- >qeer);
- } else if ((lch  >= (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))
+ } else if ((lch  >= DAVINCI_EDMA_QEND)
     && lch  < DAVINCI_EDMA_NUM_PARAMENTRY) {
  /* for slaveChannels */
  ptr_edmacc_regs- >paramentry[lch].link_bcntrld &= 0xffff0000;
@@ -1482,18 +1447,14 @@ void davinci_dma_link_lch(int lch_head, int lch_queue)
 {
  unsigned long link;
  int temp_ch = 0;
- if (lch_head  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(lch_head)) {
  temp_ch =
-     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_NUM_DMACH];
+     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_QSTART];
  lch_head = temp_ch;
  }
- if (lch_queue  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_queue  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(lch_queue)) {
  temp_ch =
-     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_NUM_DMACH];
+     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_QSTART];
  lch_queue = temp_ch;
  }
  if ((lch_head  >= 0 && lch_head  < DAVINCI_EDMA_NUM_PARAMENTRY)
@@ -1529,18 +1490,14 @@ void davinci_dma_link_lch(int lch_head, int lch_queue)
 void davinci_dma_unlink_lch(int lch_head, int lch_queue)
 {
  int temp_ch = 0;
- if (lch_head  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(lch_head)) {
  temp_ch =
-     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_NUM_DMACH];
+     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_QSTART];
  lch_head = temp_ch;
  }
- if (lch_queue  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_queue  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
+ if (DAVINCI_EDMA_IS_Q(lch_queue)) {
  temp_ch =
-     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_NUM_DMACH];
+     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_QSTART];
  lch_queue = temp_ch;
  }
  if ((lch_head  >= 0 && lch_head  < DAVINCI_EDMA_NUM_PARAMENTRY)
@@ -1564,26 +1521,20 @@ void davinci_dma_unlink_lch(int lch_head, int lch_queue)
 void davinci_dma_chain_lch(int lch_head, int lch_queue)
 {
  int temp_ch = 0;
- if (lch_head  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch =
-     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch_head)) {
+ temp_ch = qdam_to_param_mapping
+ [lch_head - DAVINCI_EDMA_QSTART];
  lch_head = temp_ch;
  }
- if (lch_queue  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_queue  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch =
-     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch_queue)) {
+ temp_ch = qdam_to_param_mapping
+ [lch_queue - DAVINCI_EDMA_QSTART];
  lch_queue = temp_ch;
  }
- if ((lch_head  >= 0
-      && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))
-     &&
-     (lch_queue  >= 0
-      && lch_queue  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))
-     ) { /* set TCCHEN */
+ if ((lch_head  >= 0) &&
+     (lch_head  < DAVINCI_EDMA_QEND) &&
+     (lch_queue  >= 0) &&
+     (lch_queue  < DAVINCI_EDMA_QEND)) {
  /* set TCCHEN */
  ptr_edmacc_regs- >paramentry[lch_head].opt |= TCCHEN;
  /* program tcc */
@@ -1605,25 +1556,20 @@ void davinci_dma_chain_lch(int lch_head, int lch_queue)
 void davinci_dma_unchain_lch(int lch_head, int lch_queue)
 {
  int temp_ch = 0;
- if (lch_head  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch =
-     qdam_to_param_mapping[lch_head - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch_head)) {
+ temp_ch = qdam_to_param_mapping
+ [lch_head - DAVINCI_EDMA_QSTART];
  lch_head = temp_ch;
  }
- if (lch_queue  >=
-     DAVINCI_EDMA_NUM_DMACH
-     && lch_queue  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH)) {
- temp_ch =
-     qdam_to_param_mapping[lch_queue - DAVINCI_EDMA_NUM_DMACH];
+ if (DAVINCI_EDMA_IS_Q(lch_queue)) {
+ temp_ch = qdam_to_param_mapping
+ [lch_queue - DAVINCI_EDMA_QSTART];
  lch_queue = temp_ch;
  }
- if ((lch_head  >= 0
-      && lch_head  < (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))
-     && (lch_queue  >= 0
- && lch_queue  <
- (DAVINCI_EDMA_NUM_DMACH + DAVINCI_EDMA_NUM_QDMACH))) {
+ if ((lch_head  >= 0) &&
+     (lch_head  < DAVINCI_EDMA_QEND) &&
+     (lch_queue  >= 0) &&
+     (lch_queue  < DAVINCI_EDMA_QEND)) {
  /* reset TCCHEN */
  ptr_edmacc_regs- >paramentry[lch_head].opt &= ~TCCHEN;
  }
diff --git a/arch/arm/mach-davinci/include/mach/edma.h 
b/arch/arm/mach-davinci/include/mach/edma.h
index 22cd795..3b87fb5 100644
--- a/arch/arm/mach-davinci/include/mach/edma.h
+++ b/arch/arm/mach-davinci/include/mach/edma.h
@@ -236,6 +236,10 @@ typedef struct {

 #define DAVINCI_EDMA_NUM_DMACH           64
 #define DAVINCI_EDMA_NUM_QDMACH           8
+#define DAVINCI_EDMA_QSTART DAVINCI_EDMA_NUM_DMACH
+#define DAVINCI_EDMA_QEND (DAVINCI_EDMA_QSTART + DAVINCI_EDMA_NUM_QDMACH)
+#define DAVINCI_EDMA_IS_Q(ch_no) \
+ ((ch_no  >= DAVINCI_EDMA_QSTART) && (ch_no  < DAVINCI_EDMA_QEND))
 #define DAVINCI_EDMA_NUM_PARAMENTRY     128
 #define DAVINCI_EDMA_NUM_EVQUE            2
 #define DAVINCI_EDMA_CHMAPEXIST           0
-- 
1.5.4.3




------------------------------

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


End of Davinci-linux-open-source Digest, Vol 36, Issue 8
********************************************************
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to