[ARM] 3764/1: S3C24XX: change type naming to kernel style

Patch from Ben Dooks

The type naming in the s3c24xx dma code is riddled with
typedefs creating _t types, from the code import from 2.4
which is contrary to the current Kernel coding style.

This patch cleans this up, removing the typedefs and
and fixing up the resultant code changes.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Ben Dooks and committed by Russell King f105a7df 851fb304

+80 -88
+44 -44
arch/arm/mach-s3c2410/dma.c
··· 60 static kmem_cache_t *dma_kmem; 61 62 /* dma channel state information */ 63 - s3c2410_dma_chan_t s3c2410_chans[S3C2410_DMA_CHANNELS]; 64 65 /* debugging functions */ 66 ··· 74 #define dma_wrreg(chan, reg, val) writel((val), (chan)->regs + (reg)) 75 #else 76 static inline void 77 - dma_wrreg(s3c2410_dma_chan_t *chan, int reg, unsigned long val) 78 { 79 pr_debug("writing %08x to register %08x\n",(unsigned int)val,reg); 80 writel(val, dma_regaddr(chan, reg)); ··· 102 */ 103 104 static void 105 - dmadbg_capture(s3c2410_dma_chan_t *chan, struct s3c2410_dma_regstate *regs) 106 { 107 regs->dcsrc = dma_rdreg(chan, S3C2410_DMA_DCSRC); 108 regs->disrc = dma_rdreg(chan, S3C2410_DMA_DISRC); ··· 112 } 113 114 static void 115 - dmadbg_dumpregs(const char *fname, int line, s3c2410_dma_chan_t *chan, 116 struct s3c2410_dma_regstate *regs) 117 { 118 printk(KERN_DEBUG "dma%d: %s:%d: DCSRC=%08lx, DISRC=%08lx, DSTAT=%08lx DMT=%02lx, DCON=%08lx\n", ··· 122 } 123 124 static void 125 - dmadbg_showchan(const char *fname, int line, s3c2410_dma_chan_t *chan) 126 { 127 struct s3c2410_dma_regstate state; 128 ··· 136 } 137 138 static void 139 - dmadbg_showregs(const char *fname, int line, s3c2410_dma_chan_t *chan) 140 { 141 struct s3c2410_dma_regstate state; 142 ··· 164 */ 165 166 static void 167 - s3c2410_dma_stats_timeout(s3c2410_dma_stats_t *stats, int val) 168 { 169 if (stats == NULL) 170 return; ··· 183 */ 184 185 static int 186 - s3c2410_dma_waitforload(s3c2410_dma_chan_t *chan, int line) 187 { 188 int timeout = chan->load_timeout; 189 int took; ··· 230 */ 231 232 static inline int 233 - s3c2410_dma_loadbuffer(s3c2410_dma_chan_t *chan, 234 - s3c2410_dma_buf_t *buf) 235 { 236 unsigned long reload; 237 ··· 304 */ 305 306 static void 307 - s3c2410_dma_call_op(s3c2410_dma_chan_t *chan, s3c2410_chan_op_t op) 308 { 309 if (chan->op_fn != NULL) { 310 (chan->op_fn)(chan, op); ··· 318 */ 319 320 static inline void 321 - s3c2410_dma_buffdone(s3c2410_dma_chan_t *chan, s3c2410_dma_buf_t *buf, 322 - s3c2410_dma_buffresult_t result) 323 { 324 pr_debug("callback_fn=%p, buf=%p, id=%p, size=%d, result=%d\n", 325 chan->callback_fn, buf, buf->id, buf->size, result); ··· 334 * start a dma channel going 335 */ 336 337 - static int s3c2410_dma_start(s3c2410_dma_chan_t *chan) 338 { 339 unsigned long tmp; 340 unsigned long flags; ··· 430 */ 431 432 static int 433 - s3c2410_dma_canload(s3c2410_dma_chan_t *chan) 434 { 435 if (chan->load_state == S3C2410_DMALOAD_NONE || 436 chan->load_state == S3C2410_DMALOAD_1RUNNING) ··· 460 int s3c2410_dma_enqueue(unsigned int channel, void *id, 461 dma_addr_t data, int size) 462 { 463 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 464 - s3c2410_dma_buf_t *buf; 465 unsigned long flags; 466 467 check_channel(channel); ··· 540 EXPORT_SYMBOL(s3c2410_dma_enqueue); 541 542 static inline void 543 - s3c2410_dma_freebuf(s3c2410_dma_buf_t *buf) 544 { 545 int magicok = (buf->magic == BUF_MAGIC); 546 ··· 560 */ 561 562 static inline void 563 - s3c2410_dma_lastxfer(s3c2410_dma_chan_t *chan) 564 { 565 pr_debug("dma%d: s3c2410_dma_lastxfer: load_state %d\n", 566 chan->number, chan->load_state); ··· 601 static irqreturn_t 602 s3c2410_dma_irq(int irq, void *devpw, struct pt_regs *regs) 603 { 604 - s3c2410_dma_chan_t *chan = (s3c2410_dma_chan_t *)devpw; 605 - s3c2410_dma_buf_t *buf; 606 607 buf = chan->curr; 608 ··· 731 * get control of an dma channel 732 */ 733 734 - int s3c2410_dma_request(unsigned int channel, s3c2410_dma_client_t *client, 735 void *dev) 736 { 737 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 738 unsigned long flags; 739 int err; 740 ··· 807 * allowed to go through. 808 */ 809 810 - int s3c2410_dma_free(dmach_t channel, s3c2410_dma_client_t *client) 811 { 812 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 813 unsigned long flags; 814 815 check_channel(channel); ··· 846 847 EXPORT_SYMBOL(s3c2410_dma_free); 848 849 - static int s3c2410_dma_dostop(s3c2410_dma_chan_t *chan) 850 { 851 unsigned long tmp; 852 unsigned long flags; ··· 880 return 0; 881 } 882 883 - void s3c2410_dma_waitforstop(s3c2410_dma_chan_t *chan) 884 { 885 unsigned long tmp; 886 unsigned int timeout = 0x10000; ··· 901 * stop the channel, and remove all current and pending transfers 902 */ 903 904 - static int s3c2410_dma_flush(s3c2410_dma_chan_t *chan) 905 { 906 - s3c2410_dma_buf_t *buf, *next; 907 unsigned long flags; 908 909 pr_debug("%s: chan %p (%d)\n", __FUNCTION__, chan, chan->number); ··· 958 } 959 960 int 961 - s3c2410_dma_started(s3c2410_dma_chan_t *chan) 962 { 963 unsigned long flags; 964 ··· 995 } 996 997 int 998 - s3c2410_dma_ctrl(dmach_t channel, s3c2410_chan_op_t op) 999 { 1000 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1001 1002 check_channel(channel); 1003 ··· 1046 int xferunit, 1047 int dcon) 1048 { 1049 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1050 1051 pr_debug("%s: chan=%d, xfer_unit=%d, dcon=%08x\n", 1052 __FUNCTION__, channel, xferunit, dcon); ··· 1086 1087 int s3c2410_dma_setflags(dmach_t channel, unsigned int flags) 1088 { 1089 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1090 1091 check_channel(channel); 1092 ··· 1106 1107 int s3c2410_dma_set_opfn(dmach_t channel, s3c2410_dma_opfn_t rtn) 1108 { 1109 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1110 1111 check_channel(channel); 1112 ··· 1121 1122 int s3c2410_dma_set_buffdone_fn(dmach_t channel, s3c2410_dma_cbfn_t rtn) 1123 { 1124 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1125 1126 check_channel(channel); 1127 ··· 1149 */ 1150 1151 int s3c2410_dma_devconfig(int channel, 1152 - s3c2410_dmasrc_t source, 1153 int hwcfg, 1154 unsigned long devaddr) 1155 { 1156 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1157 1158 check_channel(channel); 1159 ··· 1200 1201 int s3c2410_dma_getposition(dmach_t channel, dma_addr_t *src, dma_addr_t *dst) 1202 { 1203 - s3c2410_dma_chan_t *chan = &s3c2410_chans[channel]; 1204 1205 check_channel(channel); 1206 ··· 1222 1223 static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) 1224 { 1225 - s3c2410_dma_chan_t *cp = container_of(dev, s3c2410_dma_chan_t, dev); 1226 1227 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); 1228 ··· 1262 1263 static void s3c2410_dma_cache_ctor(void *p, kmem_cache_t *c, unsigned long f) 1264 { 1265 - memset(p, 0, sizeof(s3c2410_dma_buf_t)); 1266 } 1267 1268 ··· 1270 1271 static int __init s3c2410_init_dma(void) 1272 { 1273 - s3c2410_dma_chan_t *cp; 1274 int channel; 1275 int ret; 1276 ··· 1288 goto err; 1289 } 1290 1291 - dma_kmem = kmem_cache_create("dma_desc", sizeof(s3c2410_dma_buf_t), 0, 1292 SLAB_HWCACHE_ALIGN, 1293 s3c2410_dma_cache_ctor, NULL); 1294 ··· 1301 for (channel = 0; channel < S3C2410_DMA_CHANNELS; channel++) { 1302 cp = &s3c2410_chans[channel]; 1303 1304 - memset(cp, 0, sizeof(s3c2410_dma_chan_t)); 1305 1306 /* dma channel irqs are in order.. */ 1307 cp->number = channel;
··· 60 static kmem_cache_t *dma_kmem; 61 62 /* dma channel state information */ 63 + struct s3c2410_dma_chan s3c2410_chans[S3C2410_DMA_CHANNELS]; 64 65 /* debugging functions */ 66 ··· 74 #define dma_wrreg(chan, reg, val) writel((val), (chan)->regs + (reg)) 75 #else 76 static inline void 77 + dma_wrreg(struct s3c2410_dma_chan *chan, int reg, unsigned long val) 78 { 79 pr_debug("writing %08x to register %08x\n",(unsigned int)val,reg); 80 writel(val, dma_regaddr(chan, reg)); ··· 102 */ 103 104 static void 105 + dmadbg_capture(struct s3c2410_dma_chan *chan, struct s3c2410_dma_regstate *regs) 106 { 107 regs->dcsrc = dma_rdreg(chan, S3C2410_DMA_DCSRC); 108 regs->disrc = dma_rdreg(chan, S3C2410_DMA_DISRC); ··· 112 } 113 114 static void 115 + dmadbg_dumpregs(const char *fname, int line, struct s3c2410_dma_chan *chan, 116 struct s3c2410_dma_regstate *regs) 117 { 118 printk(KERN_DEBUG "dma%d: %s:%d: DCSRC=%08lx, DISRC=%08lx, DSTAT=%08lx DMT=%02lx, DCON=%08lx\n", ··· 122 } 123 124 static void 125 + dmadbg_showchan(const char *fname, int line, struct s3c2410_dma_chan *chan) 126 { 127 struct s3c2410_dma_regstate state; 128 ··· 136 } 137 138 static void 139 + dmadbg_showregs(const char *fname, int line, struct s3c2410_dma_chan *chan) 140 { 141 struct s3c2410_dma_regstate state; 142 ··· 164 */ 165 166 static void 167 + s3c2410_dma_stats_timeout(struct s3c2410_dma_stats *stats, int val) 168 { 169 if (stats == NULL) 170 return; ··· 183 */ 184 185 static int 186 + s3c2410_dma_waitforload(struct s3c2410_dma_chan *chan, int line) 187 { 188 int timeout = chan->load_timeout; 189 int took; ··· 230 */ 231 232 static inline int 233 + s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan, 234 + struct s3c2410_dma_buf *buf) 235 { 236 unsigned long reload; 237 ··· 304 */ 305 306 static void 307 + s3c2410_dma_call_op(struct s3c2410_dma_chan *chan, enum s3c2410_chan_op op) 308 { 309 if (chan->op_fn != NULL) { 310 (chan->op_fn)(chan, op); ··· 318 */ 319 320 static inline void 321 + s3c2410_dma_buffdone(struct s3c2410_dma_chan *chan, struct s3c2410_dma_buf *buf, 322 + enum s3c2410_dma_buffresult result) 323 { 324 pr_debug("callback_fn=%p, buf=%p, id=%p, size=%d, result=%d\n", 325 chan->callback_fn, buf, buf->id, buf->size, result); ··· 334 * start a dma channel going 335 */ 336 337 + static int s3c2410_dma_start(struct s3c2410_dma_chan *chan) 338 { 339 unsigned long tmp; 340 unsigned long flags; ··· 430 */ 431 432 static int 433 + s3c2410_dma_canload(struct s3c2410_dma_chan *chan) 434 { 435 if (chan->load_state == S3C2410_DMALOAD_NONE || 436 chan->load_state == S3C2410_DMALOAD_1RUNNING) ··· 460 int s3c2410_dma_enqueue(unsigned int channel, void *id, 461 dma_addr_t data, int size) 462 { 463 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 464 + struct s3c2410_dma_buf *buf; 465 unsigned long flags; 466 467 check_channel(channel); ··· 540 EXPORT_SYMBOL(s3c2410_dma_enqueue); 541 542 static inline void 543 + s3c2410_dma_freebuf(struct s3c2410_dma_buf *buf) 544 { 545 int magicok = (buf->magic == BUF_MAGIC); 546 ··· 560 */ 561 562 static inline void 563 + s3c2410_dma_lastxfer(struct s3c2410_dma_chan *chan) 564 { 565 pr_debug("dma%d: s3c2410_dma_lastxfer: load_state %d\n", 566 chan->number, chan->load_state); ··· 601 static irqreturn_t 602 s3c2410_dma_irq(int irq, void *devpw, struct pt_regs *regs) 603 { 604 + struct s3c2410_dma_chan *chan = (struct s3c2410_dma_chan *)devpw; 605 + struct s3c2410_dma_buf *buf; 606 607 buf = chan->curr; 608 ··· 731 * get control of an dma channel 732 */ 733 734 + int s3c2410_dma_request(unsigned int channel, struct s3c2410_dma_client *client, 735 void *dev) 736 { 737 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 738 unsigned long flags; 739 int err; 740 ··· 807 * allowed to go through. 808 */ 809 810 + int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *client) 811 { 812 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 813 unsigned long flags; 814 815 check_channel(channel); ··· 846 847 EXPORT_SYMBOL(s3c2410_dma_free); 848 849 + static int s3c2410_dma_dostop(struct s3c2410_dma_chan *chan) 850 { 851 unsigned long tmp; 852 unsigned long flags; ··· 880 return 0; 881 } 882 883 + void s3c2410_dma_waitforstop(struct s3c2410_dma_chan *chan) 884 { 885 unsigned long tmp; 886 unsigned int timeout = 0x10000; ··· 901 * stop the channel, and remove all current and pending transfers 902 */ 903 904 + static int s3c2410_dma_flush(struct s3c2410_dma_chan *chan) 905 { 906 + struct s3c2410_dma_buf *buf, *next; 907 unsigned long flags; 908 909 pr_debug("%s: chan %p (%d)\n", __FUNCTION__, chan, chan->number); ··· 958 } 959 960 int 961 + s3c2410_dma_started(struct s3c2410_dma_chan *chan) 962 { 963 unsigned long flags; 964 ··· 995 } 996 997 int 998 + s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op) 999 { 1000 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1001 1002 check_channel(channel); 1003 ··· 1046 int xferunit, 1047 int dcon) 1048 { 1049 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1050 1051 pr_debug("%s: chan=%d, xfer_unit=%d, dcon=%08x\n", 1052 __FUNCTION__, channel, xferunit, dcon); ··· 1086 1087 int s3c2410_dma_setflags(dmach_t channel, unsigned int flags) 1088 { 1089 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1090 1091 check_channel(channel); 1092 ··· 1106 1107 int s3c2410_dma_set_opfn(dmach_t channel, s3c2410_dma_opfn_t rtn) 1108 { 1109 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1110 1111 check_channel(channel); 1112 ··· 1121 1122 int s3c2410_dma_set_buffdone_fn(dmach_t channel, s3c2410_dma_cbfn_t rtn) 1123 { 1124 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1125 1126 check_channel(channel); 1127 ··· 1149 */ 1150 1151 int s3c2410_dma_devconfig(int channel, 1152 + enum s3c2410_dmasrc source, 1153 int hwcfg, 1154 unsigned long devaddr) 1155 { 1156 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1157 1158 check_channel(channel); 1159 ··· 1200 1201 int s3c2410_dma_getposition(dmach_t channel, dma_addr_t *src, dma_addr_t *dst) 1202 { 1203 + struct s3c2410_dma_chan *chan = &s3c2410_chans[channel]; 1204 1205 check_channel(channel); 1206 ··· 1222 1223 static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) 1224 { 1225 + struct s3c2410_dma_chan *cp = container_of(dev, struct s3c2410_dma_chan, dev); 1226 1227 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); 1228 ··· 1262 1263 static void s3c2410_dma_cache_ctor(void *p, kmem_cache_t *c, unsigned long f) 1264 { 1265 + memset(p, 0, sizeof(struct s3c2410_dma_buf)); 1266 } 1267 1268 ··· 1270 1271 static int __init s3c2410_init_dma(void) 1272 { 1273 + struct s3c2410_dma_chan *cp; 1274 int channel; 1275 int ret; 1276 ··· 1288 goto err; 1289 } 1290 1291 + dma_kmem = kmem_cache_create("dma_desc", sizeof(struct s3c2410_dma_buf), 0, 1292 SLAB_HWCACHE_ALIGN, 1293 s3c2410_dma_cache_ctor, NULL); 1294 ··· 1301 for (channel = 0; channel < S3C2410_DMA_CHANNELS; channel++) { 1302 cp = &s3c2410_chans[channel]; 1303 1304 + memset(cp, 0, sizeof(struct s3c2410_dma_chan)); 1305 1306 /* dma channel irqs are in order.. */ 1307 cp->number = channel;
+36 -44
include/asm-arm/arch-s3c2410/dma.h
··· 35 36 /* types */ 37 38 - typedef enum { 39 S3C2410_DMA_IDLE, 40 S3C2410_DMA_RUNNING, 41 S3C2410_DMA_PAUSED 42 - } s3c2410_dma_state_t; 43 44 45 - /* s3c2410_dma_loadst_t 46 * 47 * This represents the state of the DMA engine, wrt to the loaded / running 48 * transfers. Since we don't have any way of knowing exactly the state of ··· 70 * currently running. 71 */ 72 73 - typedef enum { 74 S3C2410_DMALOAD_NONE, 75 S3C2410_DMALOAD_1LOADED, 76 S3C2410_DMALOAD_1RUNNING, 77 S3C2410_DMALOAD_1LOADED_1RUNNING, 78 - } s3c2410_dma_loadst_t; 79 80 - typedef enum { 81 S3C2410_RES_OK, 82 S3C2410_RES_ERR, 83 S3C2410_RES_ABORT 84 - } s3c2410_dma_buffresult_t; 85 86 87 - typedef enum s3c2410_dmasrc_e s3c2410_dmasrc_t; 88 - 89 - enum s3c2410_dmasrc_e { 90 S3C2410_DMASRC_HW, /* source is memory */ 91 S3C2410_DMASRC_MEM /* source is hardware */ 92 }; 93 94 - /* enum s3c2410_chan_op_e 95 * 96 * operation codes passed to the DMA code by the user, and also used 97 * to inform the current channel owner of any changes to the system state 98 */ 99 100 - enum s3c2410_chan_op_e { 101 S3C2410_DMAOP_START, 102 S3C2410_DMAOP_STOP, 103 S3C2410_DMAOP_PAUSE, ··· 105 S3C2410_DMAOP_STARTED, /* indicate channel started */ 106 }; 107 108 - typedef enum s3c2410_chan_op_e s3c2410_chan_op_t; 109 - 110 /* flags */ 111 112 #define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about ··· 113 114 /* dma buffer */ 115 116 - typedef struct s3c2410_dma_buf_s s3c2410_dma_buf_t; 117 - 118 struct s3c2410_dma_client { 119 char *name; 120 }; 121 - 122 - typedef struct s3c2410_dma_client s3c2410_dma_client_t; 123 124 /* s3c2410_dma_buf_s 125 * ··· 123 * buffer. 124 */ 125 126 - struct s3c2410_dma_buf_s { 127 - s3c2410_dma_buf_t *next; 128 int magic; /* magic */ 129 int size; /* buffer size in bytes */ 130 dma_addr_t data; /* start of DMA data */ ··· 135 136 /* [1] is this updated for both recv/send modes? */ 137 138 - typedef struct s3c2410_dma_chan_s s3c2410_dma_chan_t; 139 140 /* s3c2410_dma_cbfn_t 141 * 142 * buffer callback routine type 143 */ 144 145 - typedef void (*s3c2410_dma_cbfn_t)(s3c2410_dma_chan_t *, void *buf, int size, 146 - s3c2410_dma_buffresult_t result); 147 148 - typedef int (*s3c2410_dma_opfn_t)(s3c2410_dma_chan_t *, 149 - s3c2410_chan_op_t ); 150 151 - struct s3c2410_dma_stats_s { 152 unsigned long loads; 153 unsigned long timeout_longest; 154 unsigned long timeout_shortest; ··· 157 unsigned long timeout_failed; 158 }; 159 160 - typedef struct s3c2410_dma_stats_s s3c2410_dma_stats_t; 161 - 162 - /* struct s3c2410_dma_chan_s 163 * 164 * full state information for each DMA channel 165 */ 166 167 - struct s3c2410_dma_chan_s { 168 /* channel state flags and information */ 169 unsigned char number; /* number of this dma channel */ 170 unsigned char in_use; /* channel allocated */ ··· 172 173 /* channel state */ 174 175 - s3c2410_dma_state_t state; 176 - s3c2410_dma_loadst_t load_state; 177 - s3c2410_dma_client_t *client; 178 179 /* channel configuration */ 180 - s3c2410_dmasrc_t source; 181 unsigned long dev_addr; 182 unsigned long load_timeout; 183 unsigned int flags; /* channel flags */ ··· 193 s3c2410_dma_opfn_t op_fn; /* channel operation callback */ 194 195 /* stats gathering */ 196 - s3c2410_dma_stats_t *stats; 197 - s3c2410_dma_stats_t stats_store; 198 199 /* buffer list and information */ 200 - s3c2410_dma_buf_t *curr; /* current dma buffer */ 201 - s3c2410_dma_buf_t *next; /* next buffer to load */ 202 - s3c2410_dma_buf_t *end; /* end of queue */ 203 204 /* system device */ 205 struct sys_device dev; 206 }; 207 208 /* the currently allocated channel information */ 209 - extern s3c2410_dma_chan_t s3c2410_chans[]; 210 211 /* note, we don't really use dma_device_t at the moment */ 212 typedef unsigned long dma_device_t; ··· 219 */ 220 221 extern int s3c2410_dma_request(dmach_t channel, 222 - s3c2410_dma_client_t *, void *dev); 223 224 225 /* s3c2410_dma_ctrl ··· 227 * change the state of the dma channel 228 */ 229 230 - extern int s3c2410_dma_ctrl(dmach_t channel, s3c2410_chan_op_t op); 231 232 /* s3c2410_dma_setflags 233 * ··· 242 * free the dma channel (will also abort any outstanding operations) 243 */ 244 245 - extern int s3c2410_dma_free(dmach_t channel, s3c2410_dma_client_t *); 246 247 /* s3c2410_dma_enqueue 248 * ··· 266 * configure the device we're talking to 267 */ 268 269 - extern int s3c2410_dma_devconfig(int channel, s3c2410_dmasrc_t source, 270 int hwcfg, unsigned long devaddr); 271 272 /* s3c2410_dma_getposition
··· 35 36 /* types */ 37 38 + enum s3c2410_dma_state { 39 S3C2410_DMA_IDLE, 40 S3C2410_DMA_RUNNING, 41 S3C2410_DMA_PAUSED 42 + }; 43 44 45 + /* enum s3c2410_dma_loadst 46 * 47 * This represents the state of the DMA engine, wrt to the loaded / running 48 * transfers. Since we don't have any way of knowing exactly the state of ··· 70 * currently running. 71 */ 72 73 + enum s3c2410_dma_loadst { 74 S3C2410_DMALOAD_NONE, 75 S3C2410_DMALOAD_1LOADED, 76 S3C2410_DMALOAD_1RUNNING, 77 S3C2410_DMALOAD_1LOADED_1RUNNING, 78 + }; 79 80 + enum s3c2410_dma_buffresult { 81 S3C2410_RES_OK, 82 S3C2410_RES_ERR, 83 S3C2410_RES_ABORT 84 + }; 85 86 87 + enum s3c2410_dmasrc { 88 S3C2410_DMASRC_HW, /* source is memory */ 89 S3C2410_DMASRC_MEM /* source is hardware */ 90 }; 91 92 + /* enum s3c2410_chan_op 93 * 94 * operation codes passed to the DMA code by the user, and also used 95 * to inform the current channel owner of any changes to the system state 96 */ 97 98 + enum s3c2410_chan_op { 99 S3C2410_DMAOP_START, 100 S3C2410_DMAOP_STOP, 101 S3C2410_DMAOP_PAUSE, ··· 107 S3C2410_DMAOP_STARTED, /* indicate channel started */ 108 }; 109 110 /* flags */ 111 112 #define S3C2410_DMAF_SLOW (1<<0) /* slow, so don't worry about ··· 117 118 /* dma buffer */ 119 120 struct s3c2410_dma_client { 121 char *name; 122 }; 123 124 /* s3c2410_dma_buf_s 125 * ··· 131 * buffer. 132 */ 133 134 + struct s3c2410_dma_buf; 135 + struct s3c2410_dma_buf { 136 + struct s3c2410_dma_buf *next; 137 int magic; /* magic */ 138 int size; /* buffer size in bytes */ 139 dma_addr_t data; /* start of DMA data */ ··· 142 143 /* [1] is this updated for both recv/send modes? */ 144 145 + struct s3c2410_dma_chan; 146 147 /* s3c2410_dma_cbfn_t 148 * 149 * buffer callback routine type 150 */ 151 152 + typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *, 153 + void *buf, int size, 154 + enum s3c2410_dma_buffresult result); 155 156 + typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *, 157 + enum s3c2410_chan_op ); 158 159 + struct s3c2410_dma_stats { 160 unsigned long loads; 161 unsigned long timeout_longest; 162 unsigned long timeout_shortest; ··· 163 unsigned long timeout_failed; 164 }; 165 166 + /* struct s3c2410_dma_chan 167 * 168 * full state information for each DMA channel 169 */ 170 171 + struct s3c2410_dma_chan { 172 /* channel state flags and information */ 173 unsigned char number; /* number of this dma channel */ 174 unsigned char in_use; /* channel allocated */ ··· 180 181 /* channel state */ 182 183 + enum s3c2410_dma_state state; 184 + enum s3c2410_dma_loadst load_state; 185 + struct s3c2410_dma_client *client; 186 187 /* channel configuration */ 188 + enum s3c2410_dmasrc source; 189 unsigned long dev_addr; 190 unsigned long load_timeout; 191 unsigned int flags; /* channel flags */ ··· 201 s3c2410_dma_opfn_t op_fn; /* channel operation callback */ 202 203 /* stats gathering */ 204 + struct s3c2410_dma_stats *stats; 205 + struct s3c2410_dma_stats stats_store; 206 207 /* buffer list and information */ 208 + struct s3c2410_dma_buf *curr; /* current dma buffer */ 209 + struct s3c2410_dma_buf *next; /* next buffer to load */ 210 + struct s3c2410_dma_buf *end; /* end of queue */ 211 212 /* system device */ 213 struct sys_device dev; 214 }; 215 216 /* the currently allocated channel information */ 217 + extern struct s3c2410_dma_chan s3c2410_chans[]; 218 219 /* note, we don't really use dma_device_t at the moment */ 220 typedef unsigned long dma_device_t; ··· 227 */ 228 229 extern int s3c2410_dma_request(dmach_t channel, 230 + struct s3c2410_dma_client *, void *dev); 231 232 233 /* s3c2410_dma_ctrl ··· 235 * change the state of the dma channel 236 */ 237 238 + extern int s3c2410_dma_ctrl(dmach_t channel, enum s3c2410_chan_op op); 239 240 /* s3c2410_dma_setflags 241 * ··· 250 * free the dma channel (will also abort any outstanding operations) 251 */ 252 253 + extern int s3c2410_dma_free(dmach_t channel, struct s3c2410_dma_client *); 254 255 /* s3c2410_dma_enqueue 256 * ··· 274 * configure the device we're talking to 275 */ 276 277 + extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source, 278 int hwcfg, unsigned long devaddr); 279 280 /* s3c2410_dma_getposition