diff options
Diffstat (limited to 'arch/powerpc/sysdev/bestcomm/gen_bd.c')
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/gen_bd.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.c b/arch/powerpc/sysdev/bestcomm/gen_bd.c index 8d33eafbb3f4..a3a134c35b0a 100644 --- a/arch/powerpc/sysdev/bestcomm/gen_bd.c +++ b/arch/powerpc/sysdev/bestcomm/gen_bd.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | 21 | ||
22 | #include <asm/mpc52xx.h> | 22 | #include <asm/mpc52xx.h> |
23 | #include <asm/mpc52xx_psc.h> | ||
23 | 24 | ||
24 | #include "bestcomm.h" | 25 | #include "bestcomm.h" |
25 | #include "bestcomm_priv.h" | 26 | #include "bestcomm_priv.h" |
@@ -253,6 +254,100 @@ bcom_gen_bd_tx_release(struct bcom_task *tsk) | |||
253 | } | 254 | } |
254 | EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release); | 255 | EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release); |
255 | 256 | ||
257 | /* --------------------------------------------------------------------- | ||
258 | * PSC support code | ||
259 | */ | ||
260 | |||
261 | /** | ||
262 | * bcom_psc_parameters - Bestcomm initialization value table for PSC devices | ||
263 | * | ||
264 | * This structure is only used internally. It is a lookup table for PSC | ||
265 | * specific parameters to bestcomm tasks. | ||
266 | */ | ||
267 | static struct bcom_psc_params { | ||
268 | int rx_initiator; | ||
269 | int rx_ipr; | ||
270 | int tx_initiator; | ||
271 | int tx_ipr; | ||
272 | } bcom_psc_params[] = { | ||
273 | [0] = { | ||
274 | .rx_initiator = BCOM_INITIATOR_PSC1_RX, | ||
275 | .rx_ipr = BCOM_IPR_PSC1_RX, | ||
276 | .tx_initiator = BCOM_INITIATOR_PSC1_TX, | ||
277 | .tx_ipr = BCOM_IPR_PSC1_TX, | ||
278 | }, | ||
279 | [1] = { | ||
280 | .rx_initiator = BCOM_INITIATOR_PSC2_RX, | ||
281 | .rx_ipr = BCOM_IPR_PSC2_RX, | ||
282 | .tx_initiator = BCOM_INITIATOR_PSC2_TX, | ||
283 | .tx_ipr = BCOM_IPR_PSC2_TX, | ||
284 | }, | ||
285 | [2] = { | ||
286 | .rx_initiator = BCOM_INITIATOR_PSC3_RX, | ||
287 | .rx_ipr = BCOM_IPR_PSC3_RX, | ||
288 | .tx_initiator = BCOM_INITIATOR_PSC3_TX, | ||
289 | .tx_ipr = BCOM_IPR_PSC3_TX, | ||
290 | }, | ||
291 | [3] = { | ||
292 | .rx_initiator = BCOM_INITIATOR_PSC4_RX, | ||
293 | .rx_ipr = BCOM_IPR_PSC4_RX, | ||
294 | .tx_initiator = BCOM_INITIATOR_PSC4_TX, | ||
295 | .tx_ipr = BCOM_IPR_PSC4_TX, | ||
296 | }, | ||
297 | [4] = { | ||
298 | .rx_initiator = BCOM_INITIATOR_PSC5_RX, | ||
299 | .rx_ipr = BCOM_IPR_PSC5_RX, | ||
300 | .tx_initiator = BCOM_INITIATOR_PSC5_TX, | ||
301 | .tx_ipr = BCOM_IPR_PSC5_TX, | ||
302 | }, | ||
303 | [5] = { | ||
304 | .rx_initiator = BCOM_INITIATOR_PSC6_RX, | ||
305 | .rx_ipr = BCOM_IPR_PSC6_RX, | ||
306 | .tx_initiator = BCOM_INITIATOR_PSC6_TX, | ||
307 | .tx_ipr = BCOM_IPR_PSC6_TX, | ||
308 | }, | ||
309 | }; | ||
310 | |||
311 | /** | ||
312 | * bcom_psc_gen_bd_rx_init - Allocate a receive bcom_task for a PSC port | ||
313 | * @psc_num: Number of the PSC to allocate a task for | ||
314 | * @queue_len: number of buffer descriptors to allocate for the task | ||
315 | * @fifo: physical address of FIFO register | ||
316 | * @maxbufsize: Maximum receive data size in bytes. | ||
317 | * | ||
318 | * Allocate a bestcomm task structure for receiving data from a PSC. | ||
319 | */ | ||
320 | struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len, | ||
321 | phys_addr_t fifo, int maxbufsize) | ||
322 | { | ||
323 | if (psc_num >= MPC52xx_PSC_MAXNUM) | ||
324 | return NULL; | ||
325 | |||
326 | return bcom_gen_bd_rx_init(queue_len, fifo, | ||
327 | bcom_psc_params[psc_num].rx_initiator, | ||
328 | bcom_psc_params[psc_num].rx_ipr, | ||
329 | maxbufsize); | ||
330 | } | ||
331 | EXPORT_SYMBOL_GPL(bcom_psc_gen_bd_rx_init); | ||
332 | |||
333 | /** | ||
334 | * bcom_psc_gen_bd_tx_init - Allocate a transmit bcom_task for a PSC port | ||
335 | * @psc_num: Number of the PSC to allocate a task for | ||
336 | * @queue_len: number of buffer descriptors to allocate for the task | ||
337 | * @fifo: physical address of FIFO register | ||
338 | * | ||
339 | * Allocate a bestcomm task structure for transmitting data to a PSC. | ||
340 | */ | ||
341 | struct bcom_task * | ||
342 | bcom_psc_gen_bd_tx_init(unsigned psc_num, int queue_len, phys_addr_t fifo) | ||
343 | { | ||
344 | struct psc; | ||
345 | return bcom_gen_bd_tx_init(queue_len, fifo, | ||
346 | bcom_psc_params[psc_num].tx_initiator, | ||
347 | bcom_psc_params[psc_num].tx_ipr); | ||
348 | } | ||
349 | EXPORT_SYMBOL_GPL(bcom_psc_gen_bd_tx_init); | ||
350 | |||
256 | 351 | ||
257 | MODULE_DESCRIPTION("BestComm General Buffer Descriptor tasks driver"); | 352 | MODULE_DESCRIPTION("BestComm General Buffer Descriptor tasks driver"); |
258 | MODULE_AUTHOR("Jeff Gibbons <jeff.gibbons@appspec.com>"); | 353 | MODULE_AUTHOR("Jeff Gibbons <jeff.gibbons@appspec.com>"); |