Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
dma.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <plat/cpu.h>
#include <plat/dma.h>
#include <plat/tc.h>

Go to the source code of this file.

Data Structures

struct  omap_dma_global_context_registers
 
struct  dma_link_info
 

Macros

#define MAX_LOGICAL_DMA_CH_COUNT   32
 
#define OMAP_DMA_ACTIVE   0x01
 
#define OMAP2_DMA_CSR_CLEAR_MASK   0xffffffff
 
#define OMAP_FUNC_MUX_ARM_BASE   (0xfffe1000 + 0xec)
 
#define OMAP_DMA_CHAIN_QINIT(chain_id)
 
#define OMAP_DMA_CHAIN_QFULL(chain_id)
 
#define OMAP_DMA_CHAIN_QLAST(chain_id)
 
#define OMAP_DMA_CHAIN_QEMPTY(chain_id)   (0 == dma_linked_lch[chain_id].q_count)
 
#define __OMAP_DMA_CHAIN_INCQ(end)   ((end) = ((end)+1) % dma_linked_lch[chain_id].no_of_lchs_linked)
 
#define OMAP_DMA_CHAIN_INCQHEAD(chain_id)
 
#define OMAP_DMA_CHAIN_INCQTAIL(chain_id)
 
#define REVISIT_24XX()
 
#define omap_dma_in_1510_mode()   0
 
#define set_gdma_dev(req, dev)   do {} while (0)
 
#define omap_readl(reg)   0
 
#define omap_writel(val, reg)   do {} while (0)
 
#define omap1_dma_irq_handler   NULL
 

Enumerations

enum  {
  DMA_CH_ALLOC_DONE, DMA_CH_PARAMS_SET_DONE, DMA_CH_STARTED, DMA_CH_QUEUED,
  DMA_CH_NOTSTARTED, DMA_CH_PAUSED, DMA_CH_LINK_ENABLED
}
 
enum  { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }
 

Functions

void omap_set_dma_priority (int lch, int dst_port, int priority)
 
 EXPORT_SYMBOL (omap_set_dma_priority)
 
void omap_set_dma_transfer_params (int lch, int data_type, int elem_count, int frame_count, int sync_mode, int dma_trigger, int src_or_dst_synch)
 
 EXPORT_SYMBOL (omap_set_dma_transfer_params)
 
void omap_set_dma_color_mode (int lch, enum omap_dma_color_mode mode, u32 color)
 
 EXPORT_SYMBOL (omap_set_dma_color_mode)
 
void omap_set_dma_write_mode (int lch, enum omap_dma_write_mode mode)
 
 EXPORT_SYMBOL (omap_set_dma_write_mode)
 
void omap_set_dma_channel_mode (int lch, enum omap_dma_channel_mode mode)
 
 EXPORT_SYMBOL (omap_set_dma_channel_mode)
 
void omap_set_dma_src_params (int lch, int src_port, int src_amode, unsigned long src_start, int src_ei, int src_fi)
 
 EXPORT_SYMBOL (omap_set_dma_src_params)
 
void omap_set_dma_params (int lch, struct omap_dma_channel_params *params)
 
 EXPORT_SYMBOL (omap_set_dma_params)
 
void omap_set_dma_src_index (int lch, int eidx, int fidx)
 
 EXPORT_SYMBOL (omap_set_dma_src_index)
 
void omap_set_dma_src_data_pack (int lch, int enable)
 
 EXPORT_SYMBOL (omap_set_dma_src_data_pack)
 
void omap_set_dma_src_burst_mode (int lch, enum omap_dma_burst_mode burst_mode)
 
 EXPORT_SYMBOL (omap_set_dma_src_burst_mode)
 
void omap_set_dma_dest_params (int lch, int dest_port, int dest_amode, unsigned long dest_start, int dst_ei, int dst_fi)
 
 EXPORT_SYMBOL (omap_set_dma_dest_params)
 
void omap_set_dma_dest_index (int lch, int eidx, int fidx)
 
 EXPORT_SYMBOL (omap_set_dma_dest_index)
 
void omap_set_dma_dest_data_pack (int lch, int enable)
 
 EXPORT_SYMBOL (omap_set_dma_dest_data_pack)
 
void omap_set_dma_dest_burst_mode (int lch, enum omap_dma_burst_mode burst_mode)
 
 EXPORT_SYMBOL (omap_set_dma_dest_burst_mode)
 
void omap_enable_dma_irq (int lch, u16 bits)
 
 EXPORT_SYMBOL (omap_enable_dma_irq)
 
void omap_disable_dma_irq (int lch, u16 bits)
 
 EXPORT_SYMBOL (omap_disable_dma_irq)
 
int omap_request_dma (int dev_id, const char *dev_name, void(*callback)(int lch, u16 ch_status, void *data), void *data, int *dma_ch_out)
 
 EXPORT_SYMBOL (omap_request_dma)
 
void omap_free_dma (int lch)
 
 EXPORT_SYMBOL (omap_free_dma)
 
void omap_dma_set_global_params (int arb_rate, int max_fifo_depth, int tparams)
 omap_dma_set_global_params : Set global priority settings for dma
 
 EXPORT_SYMBOL (omap_dma_set_global_params)
 
int omap_dma_set_prio_lch (int lch, unsigned char read_prio, unsigned char write_prio)
 omap_dma_set_prio_lch : Set channel wise priority settings
 
 EXPORT_SYMBOL (omap_dma_set_prio_lch)
 
void omap_clear_dma (int lch)
 
 EXPORT_SYMBOL (omap_clear_dma)
 
void omap_start_dma (int lch)
 
 EXPORT_SYMBOL (omap_start_dma)
 
void omap_stop_dma (int lch)
 
 EXPORT_SYMBOL (omap_stop_dma)
 
int omap_set_dma_callback (int lch, void(*callback)(int lch, u16 ch_status, void *data), void *data)
 
 EXPORT_SYMBOL (omap_set_dma_callback)
 
dma_addr_t omap_get_dma_src_pos (int lch)
 
 EXPORT_SYMBOL (omap_get_dma_src_pos)
 
dma_addr_t omap_get_dma_dst_pos (int lch)
 
 EXPORT_SYMBOL (omap_get_dma_dst_pos)
 
int omap_get_dma_active_status (int lch)
 
 EXPORT_SYMBOL (omap_get_dma_active_status)
 
int omap_dma_running (void)
 
void omap_dma_link_lch (int lch_head, int lch_queue)
 
 EXPORT_SYMBOL (omap_dma_link_lch)
 
void omap_dma_unlink_lch (int lch_head, int lch_queue)
 
 EXPORT_SYMBOL (omap_dma_unlink_lch)
 
int omap_request_dma_chain (int dev_id, const char *dev_name, void(*callback)(int lch, u16 ch_status, void *data), int *chain_id, int no_of_chans, int chain_mode, struct omap_dma_channel_params params)
 omap_request_dma_chain : Request a chain of DMA channels
 
 EXPORT_SYMBOL (omap_request_dma_chain)
 
int omap_modify_dma_chain_params (int chain_id, struct omap_dma_channel_params params)
 omap_modify_dma_chain_param : Modify the chain's params - Modify the params after setting it. Dont do this while dma is running!!
 
 EXPORT_SYMBOL (omap_modify_dma_chain_params)
 
int omap_free_dma_chain (int chain_id)
 omap_free_dma_chain - Free all the logical channels in a chain.
 
 EXPORT_SYMBOL (omap_free_dma_chain)
 
int omap_dma_chain_status (int chain_id)
 omap_dma_chain_status - Check if the chain is in active / inactive state.
 
 EXPORT_SYMBOL (omap_dma_chain_status)
 
int omap_dma_chain_a_transfer (int chain_id, int src_start, int dest_start, int elem_count, int frame_count, void *callbk_data)
 omap_dma_chain_a_transfer - Get a free channel from a chain, set the params and start the transfer.
 
 EXPORT_SYMBOL (omap_dma_chain_a_transfer)
 
int omap_start_dma_chain_transfers (int chain_id)
 omap_start_dma_chain_transfers - Start the chain
 
 EXPORT_SYMBOL (omap_start_dma_chain_transfers)
 
int omap_stop_dma_chain_transfers (int chain_id)
 omap_stop_dma_chain_transfers - Stop the dma transfer of a chain.
 
 EXPORT_SYMBOL (omap_stop_dma_chain_transfers)
 
int omap_get_dma_chain_index (int chain_id, int *ei, int *fi)
 omap_get_dma_chain_index - Get the element and frame index of the ongoing DMA in chain
 
 EXPORT_SYMBOL (omap_get_dma_chain_index)
 
int omap_get_dma_chain_dst_pos (int chain_id)
 omap_get_dma_chain_dst_pos - Get the destination position of the ongoing DMA in chain
 
 EXPORT_SYMBOL (omap_get_dma_chain_dst_pos)
 
int omap_get_dma_chain_src_pos (int chain_id)
 omap_get_dma_chain_src_pos - Get the source position of the ongoing DMA in chain
 
 EXPORT_SYMBOL (omap_get_dma_chain_src_pos)
 
void omap_dma_global_context_save (void)
 
void omap_dma_global_context_restore (void)
 
 arch_initcall (omap_system_dma_init)
 
 MODULE_DESCRIPTION ("OMAP SYSTEM DMA DRIVER")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:"DRIVER_NAME)
 
 MODULE_AUTHOR ("Texas Instruments Inc")
 
 __setup ("omap_dma_reserve_ch=", omap_dma_cmdline_reserve_ch)
 

Macro Definition Documentation

#define __OMAP_DMA_CHAIN_INCQ (   end)    ((end) = ((end)+1) % dma_linked_lch[chain_id].no_of_lchs_linked)

Definition at line 113 of file dma.c.

#define MAX_LOGICAL_DMA_CH_COUNT   32

Definition at line 50 of file dma.c.

#define omap1_dma_irq_handler   NULL

Definition at line 1866 of file dma.c.

#define OMAP2_DMA_CSR_CLEAR_MASK   0xffffffff

Definition at line 63 of file dma.c.

#define OMAP_DMA_ACTIVE   0x01

Definition at line 62 of file dma.c.

#define OMAP_DMA_CHAIN_INCQHEAD (   chain_id)
Value:
do { \
__OMAP_DMA_CHAIN_INCQ(dma_linked_lch[chain_id].q_head); \
dma_linked_lch[chain_id].q_count--; \
} while (0)

Definition at line 115 of file dma.c.

#define OMAP_DMA_CHAIN_INCQTAIL (   chain_id)
Value:
do { \
__OMAP_DMA_CHAIN_INCQ(dma_linked_lch[chain_id].q_tail); \
dma_linked_lch[chain_id].q_count++; \
} while (0)

Definition at line 121 of file dma.c.

#define OMAP_DMA_CHAIN_QEMPTY (   chain_id)    (0 == dma_linked_lch[chain_id].q_count)

Definition at line 111 of file dma.c.

#define OMAP_DMA_CHAIN_QFULL (   chain_id)
Value:
(dma_linked_lch[chain_id].no_of_lchs_linked == \
dma_linked_lch[chain_id].q_count)

Definition at line 103 of file dma.c.

#define OMAP_DMA_CHAIN_QINIT (   chain_id)
Value:
do { \
dma_linked_lch[chain_id].q_head = \
dma_linked_lch[chain_id].q_tail = \
dma_linked_lch[chain_id].q_count = 0; \
} while (0)

Definition at line 97 of file dma.c.

#define OMAP_DMA_CHAIN_QLAST (   chain_id)
Value:
do { \
((dma_linked_lch[chain_id].no_of_lchs_linked-1) == \
dma_linked_lch[chain_id].q_count) \
} while (0)

Definition at line 106 of file dma.c.

#define omap_dma_in_1510_mode ( )    0

Definition at line 149 of file dma.c.

#define OMAP_FUNC_MUX_ARM_BASE   (0xfffe1000 + 0xec)

Definition at line 65 of file dma.c.

#define omap_readl (   reg)    0

Definition at line 174 of file dma.c.

#define omap_writel (   val,
  reg 
)    do {} while (0)

Definition at line 175 of file dma.c.

#define REVISIT_24XX ( )
Value:
printk(KERN_ERR "FIXME: no %s on 24xx\n", \
__func__);

Definition at line 139 of file dma.c.

#define set_gdma_dev (   req,
  dev 
)    do {} while (0)

Definition at line 173 of file dma.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
DMA_CH_ALLOC_DONE 
DMA_CH_PARAMS_SET_DONE 
DMA_CH_STARTED 
DMA_CH_QUEUED 
DMA_CH_NOTSTARTED 
DMA_CH_PAUSED 
DMA_CH_LINK_ENABLED 

Definition at line 55 of file dma.c.

anonymous enum
Enumerator:
DMA_CHAIN_STARTED 
DMA_CHAIN_NOTSTARTED 

Definition at line 59 of file dma.c.

Function Documentation

__setup ( )
arch_initcall ( omap_system_dma_init  )
EXPORT_SYMBOL ( omap_set_dma_priority  )
EXPORT_SYMBOL ( omap_set_dma_transfer_params  )
EXPORT_SYMBOL ( omap_set_dma_color_mode  )
EXPORT_SYMBOL ( omap_set_dma_write_mode  )
EXPORT_SYMBOL ( omap_set_dma_channel_mode  )
EXPORT_SYMBOL ( omap_set_dma_src_params  )
EXPORT_SYMBOL ( omap_set_dma_params  )
EXPORT_SYMBOL ( omap_set_dma_src_index  )
EXPORT_SYMBOL ( omap_set_dma_src_data_pack  )
EXPORT_SYMBOL ( omap_set_dma_src_burst_mode  )
EXPORT_SYMBOL ( omap_set_dma_dest_params  )
EXPORT_SYMBOL ( omap_set_dma_dest_index  )
EXPORT_SYMBOL ( omap_set_dma_dest_data_pack  )
EXPORT_SYMBOL ( omap_set_dma_dest_burst_mode  )
EXPORT_SYMBOL ( omap_enable_dma_irq  )
EXPORT_SYMBOL ( omap_disable_dma_irq  )
EXPORT_SYMBOL ( omap_request_dma  )
EXPORT_SYMBOL ( omap_free_dma  )
EXPORT_SYMBOL ( omap_dma_set_global_params  )
EXPORT_SYMBOL ( omap_dma_set_prio_lch  )
EXPORT_SYMBOL ( omap_clear_dma  )
EXPORT_SYMBOL ( omap_start_dma  )
EXPORT_SYMBOL ( omap_stop_dma  )
EXPORT_SYMBOL ( omap_set_dma_callback  )
EXPORT_SYMBOL ( omap_get_dma_src_pos  )
EXPORT_SYMBOL ( omap_get_dma_dst_pos  )
EXPORT_SYMBOL ( omap_get_dma_active_status  )
EXPORT_SYMBOL ( omap_dma_link_lch  )
EXPORT_SYMBOL ( omap_dma_unlink_lch  )
EXPORT_SYMBOL ( omap_request_dma_chain  )
EXPORT_SYMBOL ( omap_modify_dma_chain_params  )
EXPORT_SYMBOL ( omap_free_dma_chain  )
EXPORT_SYMBOL ( omap_dma_chain_status  )
EXPORT_SYMBOL ( omap_dma_chain_a_transfer  )
EXPORT_SYMBOL ( omap_start_dma_chain_transfers  )
EXPORT_SYMBOL ( omap_stop_dma_chain_transfers  )
EXPORT_SYMBOL ( omap_get_dma_chain_index  )
EXPORT_SYMBOL ( omap_get_dma_chain_dst_pos  )
EXPORT_SYMBOL ( omap_get_dma_chain_src_pos  )
MODULE_ALIAS ( "platform:"  DRIVER_NAME)
MODULE_AUTHOR ( "Texas Instruments Inc"  )
MODULE_DESCRIPTION ( "OMAP SYSTEM DMA DRIVER )
MODULE_LICENSE ( "GPL"  )
void omap_clear_dma ( int  lch)

Definition at line 867 of file dma.c.

void omap_disable_dma_irq ( int  lch,
u16  bits 
)

Definition at line 602 of file dma.c.

int omap_dma_chain_a_transfer ( int  chain_id,
int  src_start,
int  dest_start,
int  elem_count,
int  frame_count,
void callbk_data 
)

omap_dma_chain_a_transfer - Get a free channel from a chain, set the params and start the transfer.

Parameters
chain_id
src_start- buffer start address
dest_start- Dest address
elem_count
frame_count
callbk_data- channel callback parameter data.
Returns
- Success : 0 Failure: -EINVAL/-EBUSY

Definition at line 1456 of file dma.c.

int omap_dma_chain_status ( int  chain_id)

omap_dma_chain_status - Check if the chain is in active / inactive state.

Parameters
chain_id
Returns
- Success : OMAP_DMA_CHAIN_ACTIVE/OMAP_DMA_CHAIN_INACTIVE Failure : -EINVAL

Definition at line 1419 of file dma.c.

void omap_dma_global_context_restore ( void  )

Definition at line 1982 of file dma.c.

void omap_dma_global_context_save ( void  )

Definition at line 1973 of file dma.c.

void omap_dma_link_lch ( int  lch_head,
int  lch_queue 
)

Definition at line 1140 of file dma.c.

int omap_dma_running ( void  )

Definition at line 1120 of file dma.c.

void omap_dma_set_global_params ( int  arb_rate,
int  max_fifo_depth,
int  tparams 
)

omap_dma_set_global_params : Set global priority settings for dma

Parameters
arb_rate
max_fifo_depth
tparams- Number of threads to reserve : DMA_THREAD_RESERVE_NORM DMA_THREAD_RESERVE_ONET DMA_THREAD_RESERVE_TWOT DMA_THREAD_RESERVE_THREET

Definition at line 809 of file dma.c.

int omap_dma_set_prio_lch ( int  lch,
unsigned char  read_prio,
unsigned char  write_prio 
)

omap_dma_set_prio_lch : Set channel wise priority settings

Parameters
lch
read_prio- Read priority
write_prio- Write priority Both of the above can be set with one of the following values : DMA_CH_PRIO_HIGH/DMA_CH_PRIO_LOW

Definition at line 841 of file dma.c.

void omap_dma_unlink_lch ( int  lch_head,
int  lch_queue 
)

Definition at line 1166 of file dma.c.

void omap_enable_dma_irq ( int  lch,
u16  bits 
)

Definition at line 596 of file dma.c.

void omap_free_dma ( int  lch)

Definition at line 766 of file dma.c.

int omap_free_dma_chain ( int  chain_id)

omap_free_dma_chain - Free all the logical channels in a chain.

Parameters
chain_id
Returns
- Success : 0 Failure : -EINVAL

Definition at line 1375 of file dma.c.

int omap_get_dma_active_status ( int  lch)

Definition at line 1114 of file dma.c.

int omap_get_dma_chain_dst_pos ( int  chain_id)

omap_get_dma_chain_dst_pos - Get the destination position of the ongoing DMA in chain

Parameters
chain_id
Returns
- Success : Destination position Failure : -EINVAL

Definition at line 1748 of file dma.c.

int omap_get_dma_chain_index ( int  chain_id,
int ei,
int fi 
)

omap_get_dma_chain_index - Get the element and frame index of the ongoing DMA in chain

Parameters
chain_id
ei- Element index
fi- Frame index
Returns
- Success : 0 Failure : -EINVAL

Definition at line 1708 of file dma.c.

int omap_get_dma_chain_src_pos ( int  chain_id)

omap_get_dma_chain_src_pos - Get the source position of the ongoing DMA in chain

Parameters
chain_id
Returns
- Success : Destination position Failure : -EINVAL

Definition at line 1782 of file dma.c.

dma_addr_t omap_get_dma_dst_pos ( int  lch)

Definition at line 1083 of file dma.c.

dma_addr_t omap_get_dma_src_pos ( int  lch)

Definition at line 1044 of file dma.c.

int omap_modify_dma_chain_params ( int  chain_id,
struct omap_dma_channel_params  params 
)

omap_modify_dma_chain_param : Modify the chain's params - Modify the params after setting it. Dont do this while dma is running!!

Parameters
chain_id- Chained logical channel id.
params
Returns
- Success : 0 Failure : -EINVAL

Definition at line 1334 of file dma.c.

int omap_request_dma ( int  dev_id,
const char dev_name,
void(*)(int lch, u16 ch_status, void *data callback,
void data,
int dma_ch_out 
)

Definition at line 689 of file dma.c.

int omap_request_dma_chain ( int  dev_id,
const char dev_name,
void(*)(int lch, u16 ch_status, void *data callback,
int chain_id,
int  no_of_chans,
int  chain_mode,
struct omap_dma_channel_params  params 
)

omap_request_dma_chain : Request a chain of DMA channels

Parameters
dev_id- Device id using the dma channel
dev_name- Device name
callback- Call back function - - Number of channels requested - Dynamic or static chaining : OMAP_DMA_STATIC_CHAIN OMAP_DMA_DYNAMIC_CHAIN - Channel parameters
Returns
- Success : 0 Failure: -EINVAL/-ENOMEM

Definition at line 1245 of file dma.c.

int omap_set_dma_callback ( int  lch,
void(*)(int lch, u16 ch_status, void *data callback,
void data 
)

Definition at line 1013 of file dma.c.

void omap_set_dma_channel_mode ( int  lch,
enum omap_dma_channel_mode  mode 
)

Definition at line 356 of file dma.c.

void omap_set_dma_color_mode ( int  lch,
enum omap_dma_color_mode  mode,
u32  color 
)

Definition at line 283 of file dma.c.

void omap_set_dma_dest_burst_mode ( int  lch,
enum omap_dma_burst_mode  burst_mode 
)

Definition at line 531 of file dma.c.

void omap_set_dma_dest_data_pack ( int  lch,
int  enable 
)

Definition at line 519 of file dma.c.

void omap_set_dma_dest_index ( int  lch,
int  eidx,
int  fidx 
)

Definition at line 509 of file dma.c.

void omap_set_dma_dest_params ( int  lch,
int  dest_port,
int  dest_amode,
unsigned long  dest_start,
int  dst_ei,
int  dst_fi 
)

Definition at line 484 of file dma.c.

void omap_set_dma_params ( int  lch,
struct omap_dma_channel_params params 
)

Definition at line 397 of file dma.c.

void omap_set_dma_priority ( int  lch,
int  dst_port,
int  priority 
)

Definition at line 178 of file dma.c.

void omap_set_dma_src_burst_mode ( int  lch,
enum omap_dma_burst_mode  burst_mode 
)

Definition at line 438 of file dma.c.

void omap_set_dma_src_data_pack ( int  lch,
int  enable 
)

Definition at line 426 of file dma.c.

void omap_set_dma_src_index ( int  lch,
int  eidx,
int  fidx 
)

Definition at line 416 of file dma.c.

void omap_set_dma_src_params ( int  lch,
int  src_port,
int  src_amode,
unsigned long  src_start,
int  src_ei,
int  src_fi 
)

Definition at line 370 of file dma.c.

void omap_set_dma_transfer_params ( int  lch,
int  data_type,
int  elem_count,
int  frame_count,
int  sync_mode,
int  dma_trigger,
int  src_or_dst_synch 
)

Definition at line 220 of file dma.c.

void omap_set_dma_write_mode ( int  lch,
enum omap_dma_write_mode  mode 
)

Definition at line 343 of file dma.c.

void omap_start_dma ( int  lch)

Definition at line 877 of file dma.c.

int omap_start_dma_chain_transfers ( int  chain_id)

omap_start_dma_chain_transfers - Start the chain

Parameters
chain_id
Returns
- Success : 0 Failure : -EINVAL/-EBUSY

Definition at line 1593 of file dma.c.

void omap_stop_dma ( int  lch)

Definition at line 938 of file dma.c.

int omap_stop_dma_chain_transfers ( int  chain_id)

omap_stop_dma_chain_transfers - Stop the dma transfer of a chain.

Parameters
chain_id
Returns
- Success : 0 Failure : EINVAL

Definition at line 1645 of file dma.c.