aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32/kernel/dma.c
diff options
context:
space:
mode:
authorGuanXuetao <gxt@mprc.pku.edu.cn>2011-02-26 08:21:18 -0500
committerGuanXuetao <gxt@mprc.pku.edu.cn>2011-03-16 21:19:19 -0400
commite5abf78b57199a417eb01ff922a5ea6ff9e10b61 (patch)
tree6f72a13d44c0dc8c4d575d84885f5694c16ed1da /arch/unicore32/kernel/dma.c
parent4517366d870b89d6fb8c0c90deb6c73d975908af (diff)
unicore32 io: redefine __REG(x) and re-use readl/writel funcs
-- by advice of Arnd Bergmann Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/unicore32/kernel/dma.c')
-rw-r--r--arch/unicore32/kernel/dma.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/unicore32/kernel/dma.c b/arch/unicore32/kernel/dma.c
index b8dcc2514e9..ae441bc3122 100644
--- a/arch/unicore32/kernel/dma.c
+++ b/arch/unicore32/kernel/dma.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/io.h>
19 20
20#include <asm/system.h> 21#include <asm/system.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
@@ -94,15 +95,16 @@ EXPORT_SYMBOL(puv3_free_dma);
94 95
95static irqreturn_t dma_irq_handler(int irq, void *dev_id) 96static irqreturn_t dma_irq_handler(int irq, void *dev_id)
96{ 97{
97 int i, dint = DMAC_ITCSR; 98 int i, dint;
98 99
100 dint = readl(DMAC_ITCSR);
99 for (i = 0; i < MAX_DMA_CHANNELS; i++) { 101 for (i = 0; i < MAX_DMA_CHANNELS; i++) {
100 if (dint & DMAC_CHANNEL(i)) { 102 if (dint & DMAC_CHANNEL(i)) {
101 struct dma_channel *channel = &dma_channels[i]; 103 struct dma_channel *channel = &dma_channels[i];
102 104
103 /* Clear TC interrupt of channel i */ 105 /* Clear TC interrupt of channel i */
104 DMAC_ITCCR = DMAC_CHANNEL(i); 106 writel(DMAC_CHANNEL(i), DMAC_ITCCR);
105 DMAC_ITCCR = 0; 107 writel(0, DMAC_ITCCR);
106 108
107 if (channel->name && channel->irq_handler) { 109 if (channel->name && channel->irq_handler) {
108 channel->irq_handler(i, channel->data); 110 channel->irq_handler(i, channel->data);
@@ -121,15 +123,16 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
121 123
122static irqreturn_t dma_err_handler(int irq, void *dev_id) 124static irqreturn_t dma_err_handler(int irq, void *dev_id)
123{ 125{
124 int i, dint = DMAC_IESR; 126 int i, dint;
125 127
128 dint = readl(DMAC_IESR);
126 for (i = 0; i < MAX_DMA_CHANNELS; i++) { 129 for (i = 0; i < MAX_DMA_CHANNELS; i++) {
127 if (dint & DMAC_CHANNEL(i)) { 130 if (dint & DMAC_CHANNEL(i)) {
128 struct dma_channel *channel = &dma_channels[i]; 131 struct dma_channel *channel = &dma_channels[i];
129 132
130 /* Clear Err interrupt of channel i */ 133 /* Clear Err interrupt of channel i */
131 DMAC_IECR = DMAC_CHANNEL(i); 134 writel(DMAC_CHANNEL(i), DMAC_IECR);
132 DMAC_IECR = 0; 135 writel(0, DMAC_IECR);
133 136
134 if (channel->name && channel->err_handler) { 137 if (channel->name && channel->err_handler) {
135 channel->err_handler(i, channel->data); 138 channel->err_handler(i, channel->data);