aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/dma.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/dma.h')
-rw-r--r--include/asm-powerpc/dma.h39
1 files changed, 4 insertions, 35 deletions
diff --git a/include/asm-powerpc/dma.h b/include/asm-powerpc/dma.h
index 7a4374bdbef4..a7e06e25c708 100644
--- a/include/asm-powerpc/dma.h
+++ b/include/asm-powerpc/dma.h
@@ -93,16 +93,6 @@
93 * 93 *
94 */ 94 */
95 95
96/* see prep_setup_arch() for detailed informations */
97#if defined(CONFIG_SOUND_CS4232) && defined(CONFIG_PPC_PREP)
98extern long ppc_cs4232_dma, ppc_cs4232_dma2;
99#define SND_DMA1 ppc_cs4232_dma
100#define SND_DMA2 ppc_cs4232_dma2
101#else
102#define SND_DMA1 -1
103#define SND_DMA2 -1
104#endif
105
106/* 8237 DMA controllers */ 96/* 8237 DMA controllers */
107#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
108#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ 98#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
@@ -269,24 +259,15 @@ static __inline__ void set_dma_page(unsigned int dmanr, int pagenr)
269 dma_outb(pagenr >> 8, DMA_HI_PAGE_3); 259 dma_outb(pagenr >> 8, DMA_HI_PAGE_3);
270 break; 260 break;
271 case 5: 261 case 5:
272 if (SND_DMA1 == 5 || SND_DMA2 == 5) 262 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
273 dma_outb(pagenr, DMA_LO_PAGE_5);
274 else
275 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
276 dma_outb(pagenr >> 8, DMA_HI_PAGE_5); 263 dma_outb(pagenr >> 8, DMA_HI_PAGE_5);
277 break; 264 break;
278 case 6: 265 case 6:
279 if (SND_DMA1 == 6 || SND_DMA2 == 6) 266 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
280 dma_outb(pagenr, DMA_LO_PAGE_6);
281 else
282 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
283 dma_outb(pagenr >> 8, DMA_HI_PAGE_6); 267 dma_outb(pagenr >> 8, DMA_HI_PAGE_6);
284 break; 268 break;
285 case 7: 269 case 7:
286 if (SND_DMA1 == 7 || SND_DMA2 == 7) 270 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
287 dma_outb(pagenr, DMA_LO_PAGE_7);
288 else
289 dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
290 dma_outb(pagenr >> 8, DMA_HI_PAGE_7); 271 dma_outb(pagenr >> 8, DMA_HI_PAGE_7);
291 break; 272 break;
292 } 273 }
@@ -302,12 +283,6 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys)
302 ((dmanr & 3) << 1) + IO_DMA1_BASE); 283 ((dmanr & 3) << 1) + IO_DMA1_BASE);
303 dma_outb((phys >> 8) & 0xff, 284 dma_outb((phys >> 8) & 0xff,
304 ((dmanr & 3) << 1) + IO_DMA1_BASE); 285 ((dmanr & 3) << 1) + IO_DMA1_BASE);
305 } else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
306 dma_outb(phys & 0xff,
307 ((dmanr & 3) << 2) + IO_DMA2_BASE);
308 dma_outb((phys >> 8) & 0xff,
309 ((dmanr & 3) << 2) + IO_DMA2_BASE);
310 dma_outb((dmanr & 3), DMA2_EXT_REG);
311 } else { 286 } else {
312 dma_outb((phys >> 1) & 0xff, 287 dma_outb((phys >> 1) & 0xff,
313 ((dmanr & 3) << 2) + IO_DMA2_BASE); 288 ((dmanr & 3) << 2) + IO_DMA2_BASE);
@@ -334,11 +309,6 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
334 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE); 309 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
335 dma_outb((count >> 8) & 0xff, 310 dma_outb((count >> 8) & 0xff,
336 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE); 311 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
337 } else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
338 dma_outb(count & 0xff,
339 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
340 dma_outb((count >> 8) & 0xff,
341 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
342 } else { 312 } else {
343 dma_outb((count >> 1) & 0xff, 313 dma_outb((count >> 1) & 0xff,
344 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE); 314 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
@@ -368,8 +338,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
368 count = 1 + dma_inb(io_port); 338 count = 1 + dma_inb(io_port);
369 count += dma_inb(io_port) << 8; 339 count += dma_inb(io_port) << 8;
370 340
371 return (dmanr <= 3 || dmanr == SND_DMA1 || dmanr == SND_DMA2) 341 return (dmanr <= 3) ? count : (count << 1);
372 ? count : (count << 1);
373} 342}
374 343
375/* These are in kernel/dma.c: */ 344/* These are in kernel/dma.c: */