1 /*
2 * linux/include/asm-arm/arch-sa1100/dma.h
3 *
4 * Generic SA1100 DMA support
5 *
6 * Copyright (C) 2000 Nicolas Pitre
7 *
8 */
9
10 #ifndef __ASM_ARCH_DMA_H
11 #define __ASM_ARCH_DMA_H
12
13 #include <linux/config.h>
14 #include "hardware.h"
15
16
17 /*
18 * This is the maximum DMA address that can be DMAd to.
19 */
20 #define MAX_DMA_ADDRESS 0xffffffff
21
22
23 /*
24 * The regular generic DMA interface is inappropriate for the
25 * SA1100 DMA model. None of the SA1100 specific drivers using
26 * DMA are portable anyway so it's pointless to try to twist the
27 * regular DMA API to accommodate them.
28 */
29 #define MAX_DMA_CHANNELS 0
30
31
32 /*
33 * The SA1100 has six internal DMA channels.
34 */
35 #define SA1100_DMA_CHANNELS 6
36
37
38 /*
39 * The SA-1111 SAC has two DMA channels.
40 */
41 #define SA1111_SAC_DMA_CHANNELS 2
42 #define SA1111_SAC_XMT_CHANNEL 0
43 #define SA1111_SAC_RCV_CHANNEL 1
44
45
46 /*
47 * The SA-1111 SAC channels will reside in the same index space as
48 * the built-in SA-1100 channels, and will take on the next available
49 * identifiers after the 1100.
50 */
51 #define SA1111_SAC_DMA_BASE SA1100_DMA_CHANNELS
52
53 #ifdef CONFIG_SA1111
54 # define MAX_SA1100_DMA_CHANNELS (SA1100_DMA_CHANNELS + SA1111_SAC_DMA_CHANNELS)
55 #else
56 # define MAX_SA1100_DMA_CHANNELS SA1100_DMA_CHANNELS
57 #endif
58
59
60 /*
61 * All possible SA1100 devices a DMA channel can be attached to.
62 */
63 typedef enum {
64 DMA_Ser0UDCWr = DDAR_Ser0UDCWr, /* Ser. port 0 UDC Write */
65 DMA_Ser0UDCRd = DDAR_Ser0UDCRd, /* Ser. port 0 UDC Read */
66 DMA_Ser1UARTWr = DDAR_Ser1UARTWr, /* Ser. port 1 UART Write */
67 DMA_Ser1UARTRd = DDAR_Ser1UARTRd, /* Ser. port 1 UART Read */
68 DMA_Ser1SDLCWr = DDAR_Ser1SDLCWr, /* Ser. port 1 SDLC Write */
69 DMA_Ser1SDLCRd = DDAR_Ser1SDLCRd, /* Ser. port 1 SDLC Read */
70 DMA_Ser2UARTWr = DDAR_Ser2UARTWr, /* Ser. port 2 UART Write */
71 DMA_Ser2UARTRd = DDAR_Ser2UARTRd, /* Ser. port 2 UART Read */
72 DMA_Ser2HSSPWr = DDAR_Ser2HSSPWr, /* Ser. port 2 HSSP Write */
73 DMA_Ser2HSSPRd = DDAR_Ser2HSSPRd, /* Ser. port 2 HSSP Read */
74 DMA_Ser3UARTWr = DDAR_Ser3UARTWr, /* Ser. port 3 UART Write */
75 DMA_Ser3UARTRd = DDAR_Ser3UARTRd, /* Ser. port 3 UART Read */
76 DMA_Ser4MCP0Wr = DDAR_Ser4MCP0Wr, /* Ser. port 4 MCP 0 Write (audio) */
77 DMA_Ser4MCP0Rd = DDAR_Ser4MCP0Rd, /* Ser. port 4 MCP 0 Read (audio) */
78 DMA_Ser4MCP1Wr = DDAR_Ser4MCP1Wr, /* Ser. port 4 MCP 1 Write */
79 DMA_Ser4MCP1Rd = DDAR_Ser4MCP1Rd, /* Ser. port 4 MCP 1 Read */
80 DMA_Ser4SSPWr = DDAR_Ser4SSPWr, /* Ser. port 4 SSP Write (16 bits) */
81 DMA_Ser4SSPRd = DDAR_Ser4SSPRd /* Ser. port 4 SSP Read (16 bits) */
82 } dma_device_t;
83
84
85 typedef void (*dma_callback_t)( void *buf_id, int size );
86
87
88 /* SA1100 DMA API */
89 extern int sa1100_request_dma( dmach_t *channel, const char *device_id,
90 dma_device_t device );
91 extern int sa1100_dma_set_callback( dmach_t channel, dma_callback_t cb );
92 extern int sa1100_dma_set_spin( dmach_t channel, dma_addr_t addr, int size );
93 extern int sa1100_dma_queue_buffer( dmach_t channel, void *buf_id,
94 dma_addr_t data, int size );
95 extern int sa1100_dma_get_current( dmach_t channel, void **buf_id, dma_addr_t *addr );
96 extern int sa1100_dma_stop( dmach_t channel );
97 extern int sa1100_dma_resume( dmach_t channel );
98 extern int sa1100_dma_flush_all( dmach_t channel );
99 extern void sa1100_free_dma( dmach_t channel );
100 extern int sa1100_dma_sleep( dmach_t channel );
101 extern int sa1100_dma_wakeup( dmach_t channel );
102
103 /* Sa1111 DMA interface (all but registration uses the above) */
104 extern int sa1111_sac_request_dma( dmach_t *channel, const char *device_id,
105 unsigned int direction );
106 extern int sa1111_check_dma_bug( dma_addr_t addr );
107
108 #ifdef CONFIG_SA1111
109 static inline void
__arch_adjust_zones(int node,unsigned long * size,unsigned long * holes)110 __arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
111 {
112 unsigned int sz = 256;
113
114 if (node != 0)
115 sz = 0;
116
117 size[1] = size[0] - sz;
118 size[0] = sz;
119 }
120
121 #define arch_adjust_zones(node,size,holes) __arch_adjust_zones(node,size,holes)
122 #endif
123
124 #endif /* _ASM_ARCH_DMA_H */
125