1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
/*
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/init.h>
#include <linux/device.h>
#include <asm/dma.h>
#include <asm/arch/hardware.h>
#include "serial.h"
struct mxc_sdma_info_entry_s {
mxc_dma_device_t device;
mxc_sdma_channel_params_t *chnl_info;
};
static mxc_sdma_channel_params_t mxc_sdma_uart1_rx_params = {
.chnl_params = {
.watermark_level = UART1_UFCR_RXTL,
.per_address = UART1_BASE_ADDR,
.peripheral_type = UART,
.transfer_type = per_2_emi,
.event_id = DMA_REQ_UART1_RX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART1_RX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_uart1_tx_params = {
.chnl_params = {
.watermark_level = UART1_UFCR_TXTL,
.per_address = UART1_BASE_ADDR + MXC_UARTUTXD,
.peripheral_type = UART,
.transfer_type = emi_2_per,
.event_id = DMA_REQ_UART1_TX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART1_TX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_uart2_rx_params = {
.chnl_params = {
.watermark_level = UART2_UFCR_RXTL,
.per_address = UART2_BASE_ADDR,
.peripheral_type = UART,
.transfer_type = per_2_emi,
.event_id = DMA_REQ_UART2_RX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART2_RX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_uart2_tx_params = {
.chnl_params = {
.watermark_level = UART2_UFCR_TXTL,
.per_address = UART2_BASE_ADDR + MXC_UARTUTXD,
.peripheral_type = UART,
.transfer_type = emi_2_per,
.event_id = DMA_REQ_UART2_TX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART2_TX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_uart3_rx_params = {
.chnl_params = {
.watermark_level = UART3_UFCR_RXTL,
.per_address = UART3_BASE_ADDR,
.peripheral_type = UART_SP,
.transfer_type = per_2_emi,
.event_id = DMA_REQ_UART3_RX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART3_RX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_uart3_tx_params = {
.chnl_params = {
.watermark_level = UART3_UFCR_TXTL,
.per_address = UART3_BASE_ADDR + MXC_UARTUTXD,
.peripheral_type = UART_SP,
.transfer_type = emi_2_per,
.event_id = DMA_REQ_UART3_TX,
.bd_number = 32,
.word_size = TRANSFER_8BIT,
},
.channel_num = MXC_DMA_CHANNEL_UART3_TX,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static mxc_sdma_channel_params_t mxc_sdma_memory_params = {
.chnl_params = {
.peripheral_type = MEMORY,
.transfer_type = emi_2_emi,
.bd_number = 32,
.word_size = TRANSFER_32BIT,
},
.channel_num = MXC_DMA_CHANNEL_MEMORY,
.chnl_priority = MXC_SDMA_DEFAULT_PRIORITY,
};
static struct mxc_sdma_info_entry_s mxc_sdma_active_dma_info[] = {
{MXC_DMA_UART1_RX, &mxc_sdma_uart1_rx_params},
{MXC_DMA_UART1_TX, &mxc_sdma_uart1_tx_params},
{MXC_DMA_UART2_RX, &mxc_sdma_uart2_rx_params},
{MXC_DMA_UART2_TX, &mxc_sdma_uart2_tx_params},
{MXC_DMA_UART3_RX, &mxc_sdma_uart3_rx_params},
{MXC_DMA_UART3_TX, &mxc_sdma_uart3_tx_params},
{MXC_DMA_MEMORY, &mxc_sdma_memory_params},
};
static int mxc_sdma_info_entrys =
sizeof(mxc_sdma_active_dma_info) / sizeof(mxc_sdma_active_dma_info[0]);
/*!
* This functions Returns the SDMA paramaters associated for a module
*
* @param channel_id the ID of the module requesting DMA
* @return returns the sdma parameters structure for the device
*/
mxc_sdma_channel_params_t *mxc_sdma_get_channel_params(mxc_dma_device_t
channel_id)
{
struct mxc_sdma_info_entry_s *p = mxc_sdma_active_dma_info;
int i;
for (i = 0; i < mxc_sdma_info_entrys; i++, p++) {
if (p->device == channel_id)
return p->chnl_info;
}
return NULL;
}
EXPORT_SYMBOL(mxc_sdma_get_channel_params);
/*!
* This functions marks the SDMA channels that are statically allocated
*
* @param chnl the channel array used to store channel information
*/
void mxc_get_static_channels(mxc_dma_channel_t *chnl)
{
/* No channels statically allocated for MX35 */
}
EXPORT_SYMBOL(mxc_get_static_channels);
|