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

static int setup_interrupt_handling ( void   )  [static]

Register the SCM and SMN interrupt handlers.

Called from scc_init()

Returns:
0 on success

Definition at line 1331 of file mxc_scc.c.

References INT_SCC_SCM, INT_SCC_SMN, os_printk, os_register_interrupt, SCC_DRIVER_NAME, SCC_WRITE_REGISTER, SCM_INTERRUPT_CTRL, SCM_INTERRUPT_CTRL_CLEAR_INTERRUPT, SCM_INTERRUPT_CTRL_MASK_INTERRUPTS, scm_irq_set, SMN_COMMAND, SMN_COMMAND_CLEAR_INTERRUPT, SMN_COMMAND_ENABLE_INTERRUPT, and smn_irq_set.

Referenced by scc_init().

{
      int smn_error_code = -1;
      int scm_error_code = -1;

      /* Disnable SCM interrupts */
      SCC_WRITE_REGISTER(SCM_INTERRUPT_CTRL,
                     SCM_INTERRUPT_CTRL_CLEAR_INTERRUPT
                     | SCM_INTERRUPT_CTRL_MASK_INTERRUPTS);

#ifdef USE_SMN_INTERRUPT
      /* Install interrupt service routine for SMN. */
      smn_error_code = os_register_interrupt(SCC_DRIVER_NAME,
                                     INT_SCC_SMN, scc_irq);
      if (smn_error_code != 0) {
            os_printk
                ("SCC Driver: Error installing SMN Interrupt Handler: %d\n",
                 smn_error_code);
      } else {
            smn_irq_set = 1;  /* remember this for cleanup */
            /* Enable SMN interrupts */
            SCC_WRITE_REGISTER(SMN_COMMAND,
                           SMN_COMMAND_CLEAR_INTERRUPT |
                           SMN_COMMAND_ENABLE_INTERRUPT);
      }
#else
      smn_error_code = 0;     /* no problems... will handle later */
#endif

      /*
       * Install interrupt service routine for SCM (or both together).
       */
      scm_error_code = os_register_interrupt(SCC_DRIVER_NAME,
                                     INT_SCC_SCM, scc_irq);
      if (scm_error_code != 0) {
#ifndef MXC
            os_printk
                ("SCC Driver: Error installing SCM Interrupt Handler: %d\n",
                 scm_error_code);
#else
            os_printk
                ("SCC Driver: Error installing SCC Interrupt Handler: %d\n",
                 scm_error_code);
#endif
      } else {
            scm_irq_set = 1;  /* remember this for cleanup */
#if defined(USE_SMN_INTERRUPT) && !defined(NO_SMN_INTERRUPT)
            /* Enable SMN interrupts */
            SCC_WRITE_REGISTER(SMN_COMMAND,
                           SMN_COMMAND_CLEAR_INTERRUPT |
                           SMN_COMMAND_ENABLE_INTERRUPT);
#endif
      }

      /* Return an error if one was encountered */
      return scm_error_code ? scm_error_code : smn_error_code;
}                       /* setup_interrupt_handling */


Generated by  Doxygen 1.6.0   Back to index