Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

int __init sdma_init ( void   ) 

Initializes dma

Definition at line 1385 of file sdma.c.

References iapi_configs_data::acr, iapi_configs_data::dspdma, init_event_table(), init_iapi_struct(), init_mutexes(), init_priorities(), init_proc_fs(), init_sdma_data(), init_sdma_pool(), sdma_script_start_addrs::mxc_sdma_ram_code_size, sdma_script_start_addrs::mxc_sdma_ram_code_start_addr, sdma_script_start_addrs::mxc_sdma_start_addr, and sdma_int_handler().

{
      int res = 0;
      configs_data confreg_data;

      /* Initialize to the default values */
      confreg_data = iapi_ConfigDefaults;

      confreg_data.dspdma = 0;
      /* Set ACR bit */
      mxc_sdma_ahb_clk = clk_get(NULL, "sdma_ahb_clk");
      mxc_sdma_ipg_clk = clk_get(NULL, "sdma_ipg_clk");
      clk_enable(mxc_sdma_ahb_clk);
      clk_enable(mxc_sdma_ipg_clk);
      if (clk_get_rate(mxc_sdma_ahb_clk) / clk_get_rate(mxc_sdma_ipg_clk) < 2) {
            printk(KERN_INFO "Setting SDMA ACR\n");
            confreg_data.acr = 1;
      }

      init_sdma_data();

      init_sdma_pool();

      res = request_irq(MXC_INT_SDMA, sdma_int_handler, 0, "mxcsdma", 0);

      if (res < 0) {
            goto sdma_init_fail;
      }

      init_mutexes();

      init_iapi_struct();

      mxc_sdma_get_script_info(&sdma_script_addrs);

      res = iapi_Init(sdma_data[0].cd, &confreg_data,
                  sdma_script_addrs.mxc_sdma_start_addr,
                  sdma_script_addrs.mxc_sdma_ram_code_size * 2,
                  sdma_script_addrs.mxc_sdma_ram_code_start_addr);

      if (res < 0) {
            free_irq(MXC_INT_SDMA, 0);
            goto sdma_init_fail;
      }

      init_priorities();

      init_event_table();

#if defined(CONFIG_MXC_SUPER_GEM)
      res = init_super_gem();
      if (res < 0) {
            free_irq(MXC_INT_SDMA, 0);
            goto sdma_init_fail;
      }
#endif

      init_proc_fs();

      printk(KERN_INFO "MXC DMA API initialized\n");

      clk_disable(mxc_sdma_ahb_clk);
      clk_disable(mxc_sdma_ipg_clk);
      return res;

      sdma_init_fail:
      printk(KERN_ERR "Error 0x%x in sdma_init\n", res);
      clk_disable(mxc_sdma_ahb_clk);
      clk_disable(mxc_sdma_ipg_clk);
      return res;

}


Generated by  Doxygen 1.6.0   Back to index