diff options
Diffstat (limited to 'drivers/dma/fsldma.h')
-rw-r--r-- | drivers/dma/fsldma.h | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index ba78c42121ba..6faf07ba0d0e 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define FSL_DMA_MR_EOTIE 0x00000080 | 40 | #define FSL_DMA_MR_EOTIE 0x00000080 |
41 | 41 | ||
42 | #define FSL_DMA_SR_CH 0x00000020 | 42 | #define FSL_DMA_SR_CH 0x00000020 |
43 | #define FSL_DMA_SR_PE 0x00000010 | ||
43 | #define FSL_DMA_SR_CB 0x00000004 | 44 | #define FSL_DMA_SR_CB 0x00000004 |
44 | #define FSL_DMA_SR_TE 0x00000080 | 45 | #define FSL_DMA_SR_TE 0x00000080 |
45 | #define FSL_DMA_SR_EOSI 0x00000002 | 46 | #define FSL_DMA_SR_EOSI 0x00000002 |
@@ -74,12 +75,15 @@ | |||
74 | #define FSL_DMA_DGSR_EOSI 0x02 | 75 | #define FSL_DMA_DGSR_EOSI 0x02 |
75 | #define FSL_DMA_DGSR_EOLSI 0x01 | 76 | #define FSL_DMA_DGSR_EOLSI 0x01 |
76 | 77 | ||
78 | typedef u64 __bitwise v64; | ||
79 | typedef u32 __bitwise v32; | ||
80 | |||
77 | struct fsl_dma_ld_hw { | 81 | struct fsl_dma_ld_hw { |
78 | u64 __bitwise src_addr; | 82 | v64 src_addr; |
79 | u64 __bitwise dst_addr; | 83 | v64 dst_addr; |
80 | u64 __bitwise next_ln_addr; | 84 | v64 next_ln_addr; |
81 | u32 __bitwise count; | 85 | v32 count; |
82 | u32 __bitwise reserve; | 86 | v32 reserve; |
83 | } __attribute__((aligned(32))); | 87 | } __attribute__((aligned(32))); |
84 | 88 | ||
85 | struct fsl_desc_sw { | 89 | struct fsl_desc_sw { |
@@ -91,13 +95,13 @@ struct fsl_desc_sw { | |||
91 | } __attribute__((aligned(32))); | 95 | } __attribute__((aligned(32))); |
92 | 96 | ||
93 | struct fsl_dma_chan_regs { | 97 | struct fsl_dma_chan_regs { |
94 | u32 __bitwise mr; /* 0x00 - Mode Register */ | 98 | u32 mr; /* 0x00 - Mode Register */ |
95 | u32 __bitwise sr; /* 0x04 - Status Register */ | 99 | u32 sr; /* 0x04 - Status Register */ |
96 | u64 __bitwise cdar; /* 0x08 - Current descriptor address register */ | 100 | u64 cdar; /* 0x08 - Current descriptor address register */ |
97 | u64 __bitwise sar; /* 0x10 - Source Address Register */ | 101 | u64 sar; /* 0x10 - Source Address Register */ |
98 | u64 __bitwise dar; /* 0x18 - Destination Address Register */ | 102 | u64 dar; /* 0x18 - Destination Address Register */ |
99 | u32 __bitwise bcr; /* 0x20 - Byte Count Register */ | 103 | u32 bcr; /* 0x20 - Byte Count Register */ |
100 | u64 __bitwise ndar; /* 0x24 - Next Descriptor Address Register */ | 104 | u64 ndar; /* 0x24 - Next Descriptor Address Register */ |
101 | }; | 105 | }; |
102 | 106 | ||
103 | struct fsl_dma_chan; | 107 | struct fsl_dma_chan; |
@@ -150,25 +154,27 @@ struct fsl_dma_chan { | |||
150 | #ifndef __powerpc64__ | 154 | #ifndef __powerpc64__ |
151 | static u64 in_be64(const u64 __iomem *addr) | 155 | static u64 in_be64(const u64 __iomem *addr) |
152 | { | 156 | { |
153 | return ((u64)in_be32((u32 *)addr) << 32) | (in_be32((u32 *)addr + 1)); | 157 | return ((u64)in_be32((u32 __iomem *)addr) << 32) | |
158 | (in_be32((u32 __iomem *)addr + 1)); | ||
154 | } | 159 | } |
155 | 160 | ||
156 | static void out_be64(u64 __iomem *addr, u64 val) | 161 | static void out_be64(u64 __iomem *addr, u64 val) |
157 | { | 162 | { |
158 | out_be32((u32 *)addr, val >> 32); | 163 | out_be32((u32 __iomem *)addr, val >> 32); |
159 | out_be32((u32 *)addr + 1, (u32)val); | 164 | out_be32((u32 __iomem *)addr + 1, (u32)val); |
160 | } | 165 | } |
161 | 166 | ||
162 | /* There is no asm instructions for 64 bits reverse loads and stores */ | 167 | /* There is no asm instructions for 64 bits reverse loads and stores */ |
163 | static u64 in_le64(const u64 __iomem *addr) | 168 | static u64 in_le64(const u64 __iomem *addr) |
164 | { | 169 | { |
165 | return ((u64)in_le32((u32 *)addr + 1) << 32) | (in_le32((u32 *)addr)); | 170 | return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) | |
171 | (in_le32((u32 __iomem *)addr)); | ||
166 | } | 172 | } |
167 | 173 | ||
168 | static void out_le64(u64 __iomem *addr, u64 val) | 174 | static void out_le64(u64 __iomem *addr, u64 val) |
169 | { | 175 | { |
170 | out_le32((u32 *)addr + 1, val >> 32); | 176 | out_le32((u32 __iomem *)addr + 1, val >> 32); |
171 | out_le32((u32 *)addr, (u32)val); | 177 | out_le32((u32 __iomem *)addr, (u32)val); |
172 | } | 178 | } |
173 | #endif | 179 | #endif |
174 | 180 | ||
@@ -181,9 +187,11 @@ static void out_le64(u64 __iomem *addr, u64 val) | |||
181 | 187 | ||
182 | #define DMA_TO_CPU(fsl_chan, d, width) \ | 188 | #define DMA_TO_CPU(fsl_chan, d, width) \ |
183 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ | 189 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ |
184 | be##width##_to_cpu(d) : le##width##_to_cpu(d)) | 190 | be##width##_to_cpu((__force __be##width)(v##width)d) : \ |
191 | le##width##_to_cpu((__force __le##width)(v##width)d)) | ||
185 | #define CPU_TO_DMA(fsl_chan, c, width) \ | 192 | #define CPU_TO_DMA(fsl_chan, c, width) \ |
186 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ | 193 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ |
187 | cpu_to_be##width(c) : cpu_to_le##width(c)) | 194 | (__force v##width)cpu_to_be##width(c) : \ |
195 | (__force v##width)cpu_to_le##width(c)) | ||
188 | 196 | ||
189 | #endif /* __DMA_FSLDMA_H */ | 197 | #endif /* __DMA_FSLDMA_H */ |