1
2
3
4
5
6
7
8#ifdef __KERNEL__
9#ifndef _ASM_DBDMA_H_
10#define _ASM_DBDMA_H_
11
12
13
14struct dbdma_regs {
15 unsigned int control;
16 unsigned int status;
17 unsigned int cmdptr_hi;
18 unsigned int cmdptr;
19 unsigned int intr_sel;
20 unsigned int br_sel;
21 unsigned int wait_sel;
22 unsigned int xfer_mode;
23 unsigned int data2ptr_hi;
24 unsigned int data2ptr;
25 unsigned int res1;
26 unsigned int address_hi;
27 unsigned int br_addr_hi;
28 unsigned int res2[3];
29};
30
31
32#define RUN 0x8000
33#define PAUSE 0x4000
34#define FLUSH 0x2000
35#define WAKE 0x1000
36#define DEAD 0x0800
37#define ACTIVE 0x0400
38#define BT 0x0100
39#define DEVSTAT 0x00ff
40
41
42
43
44struct dbdma_cmd {
45 __le16 req_count;
46 __le16 command;
47 __le32 phy_addr;
48 __le32 cmd_dep;
49 __le16 res_count;
50 __le16 xfer_status;
51};
52
53
54#define OUTPUT_MORE 0
55#define OUTPUT_LAST 0x1000
56#define INPUT_MORE 0x2000
57#define INPUT_LAST 0x3000
58#define STORE_WORD 0x4000
59#define LOAD_WORD 0x5000
60#define DBDMA_NOP 0x6000
61#define DBDMA_STOP 0x7000
62
63
64#define KEY_STREAM0 0
65#define KEY_STREAM1 0x100
66#define KEY_STREAM2 0x200
67#define KEY_STREAM3 0x300
68#define KEY_REGS 0x500
69#define KEY_SYSTEM 0x600
70#define KEY_DEVICE 0x700
71
72
73#define INTR_NEVER 0
74#define INTR_IFSET 0x10
75#define INTR_IFCLR 0x20
76#define INTR_ALWAYS 0x30
77
78
79#define BR_NEVER 0
80#define BR_IFSET 0x4
81#define BR_IFCLR 0x8
82#define BR_ALWAYS 0xc
83
84
85#define WAIT_NEVER 0
86#define WAIT_IFSET 1
87#define WAIT_IFCLR 2
88#define WAIT_ALWAYS 3
89
90
91#define DBDMA_ALIGN(x) (((unsigned long)(x) + sizeof(struct dbdma_cmd) - 1) \
92 & -sizeof(struct dbdma_cmd))
93
94
95#define DBDMA_DO_STOP(regs) do { \
96 out_le32(&((regs)->control), (RUN|FLUSH)<<16); \
97 while(in_le32(&((regs)->status)) & (ACTIVE|FLUSH)) \
98 ; \
99} while(0)
100
101#define DBDMA_DO_RESET(regs) do { \
102 out_le32(&((regs)->control), (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16);\
103 while(in_le32(&((regs)->status)) & (RUN)) \
104 ; \
105} while(0)
106
107#endif
108#endif
109