From: 倪振宇 <nzy@rock-chips.com>
Date: Thu, 6 May 2010 08:21:12 +0000 (+0000)
Subject: modify method that get irq status
X-Git-Tag: firefly_0821_release~11580
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bf70d5d56dc7318ce936fe2c4af9cee2ed235be2;p=firefly-linux-kernel-4.4.55.git

modify method that get irq status
---

diff --git a/arch/arm/mach-rk2818/dma.c b/arch/arm/mach-rk2818/dma.c
index 6b004d3f4292..bcd2924e9b2b 100644
--- a/arch/arm/mach-rk2818/dma.c
+++ b/arch/arm/mach-rk2818/dma.c
@@ -385,6 +385,10 @@ static int rk28_dma_enable(unsigned int dma_ch, dma_t *dma_t)
             goto bad_enable;
         }        
     } else { /*single transfer*/
+        if ((!dma_t->addr) || (dma_t->count == 0)) {
+            printk(KERN_ERR "dma_enable: channel %d does not have leagal address or count\n", dma_ch);
+            goto bad_enable;
+        }    	
         dma_t->buf.dma_address = (dma_addr_t)dma_t->addr;
         dma_t->buf.length = dma_t->count;
     }
@@ -511,7 +515,9 @@ static int rk28_dma_free(unsigned int dma_ch, dma_t *dma_t)
     
     rk28dma->dma_t.irqHandle = NULL;
     rk28dma->dma_t.data = NULL;
-    rk28dma->dma_t.sg = NULL;    
+    rk28dma->dma_t.sg = NULL;
+    rk28dma->dma_t.addr = NULL;
+    rk28dma->dma_t.count = 0;      
     rk28dma->dma_llp_vir = NULL;
     rk28dma->dma_llp_phy = NULL;
     rk28dma->residue = 0;
@@ -582,7 +588,7 @@ static irqreturn_t rk28_dma_irq_handler(int irq, void *dev_id)
 	int i, raw_status;
     struct rk2818_dma *rk28dma;
     		     
-    raw_status = read_dma_reg(DWDMA_RawBlock);
+    raw_status = read_dma_reg(DWDMA_RawTfr);
     
 	for (i = 0; i < MAX_DMA_CHANNELS; i++) {
         if (raw_status & (1 << i)) {
@@ -636,6 +642,8 @@ static int __init rk28_dma_init(void)
 		rk2818_dma[i].dma_t.irqHandle = NULL;
 		rk2818_dma[i].dma_t.data = NULL;
 		rk2818_dma[i].dma_t.sg = NULL;
+		rk2818_dma[i].dma_t.addr = NULL;
+		rk2818_dma[i].dma_t.count = 0;		
 		rk2818_dma[i].dma_t.d_ops = &rk2818_dma_ops;
 	    dma_add(i, &rk2818_dma[i].dma_t);
 
diff --git a/arch/arm/mach-rk2818/include/mach/dma.h b/arch/arm/mach-rk2818/include/mach/dma.h
index 91538abd883d..ee750adf5a81 100644
--- a/arch/arm/mach-rk2818/include/mach/dma.h
+++ b/arch/arm/mach-rk2818/include/mach/dma.h
@@ -174,28 +174,28 @@ struct rk28_dma_llp;
 typedef struct rk28_dma_llp llp_t;
 
 struct rk28_dma_llp {
-    u32      sar;
-    u32      dar;
+    unsigned int      sar;
+    unsigned int      dar;
     llp_t   *llp;
-    u32      ctll;
-    u32      size; 
+    unsigned int      ctll;
+    unsigned int      size; 
 };
 
 struct rk28_dma_dev {
-    u32      hd_if_r;   /* hardware interface for reading */
-    u32      hd_if_w;   /* hardware interface for writing */
-    u32      dev_addr_r;   /* device basic addresss for reading */
-    u32      dev_addr_w;   /* device basic addresss for reading */
-    u32      fifo_width;  /* fifo width of device */
+    unsigned int      hd_if_r;   /* hardware interface for reading */
+    unsigned int      hd_if_w;   /* hardware interface for writing */
+    unsigned int      dev_addr_r;   /* device basic addresss for reading */
+    unsigned int      dev_addr_w;   /* device basic addresss for reading */
+    unsigned int      fifo_width;  /* fifo width of device */
 };
 
 struct rk2818_dma {
     dma_t  dma_t;
 	struct rk28_dma_dev *dev_info;/* basic address of sg in memory */
     struct rk28_dma_llp *dma_llp_vir;  /* virtual cpu addrress of linked list */
-    u32 dma_llp_phy;                   /* physical bus address of linked list */
-	u32 length;     /* current transfer block */ 
-	u32 residue;     /* residue block of current dma transfer */
+    unsigned int dma_llp_phy;                   /* physical bus address of linked list */
+	unsigned int length;     /* current transfer block */ 
+	unsigned int residue;     /* residue block of current dma transfer */
 	spinlock_t		lock;
 };