Exemplo n.º 1
0
static void mmp_pm_powered_up(void)
{
    int mpidr, cpu, cluster;
    unsigned long flags;

    mpidr = read_cpuid_mpidr();
    cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
    cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
    pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
    BUG_ON(cluster >= MAX_NR_CLUSTERS || cpu >= MAX_CPUS_PER_CLUSTER);

    cpu_dcstat_event(cpu_dcstat_clk, cpu, CPU_IDLE_EXIT, MAX_LPM_INDEX);
#ifdef CONFIG_VOLDC_STAT
    vol_dcstat_event(VLSTAT_LPM_EXIT, 0, 0);
    vol_ledstatus_event(MAX_LPM_INDEX);
#endif
    trace_pxa_cpu_idle(LPM_EXIT(0), cpu, cluster);

    local_irq_save(flags);
    arch_spin_lock(&mmp_lpm_lock);

    if (cluster_is_idle(cluster)) {
        if (mmp_wake_saved && mmp_idle->ops->restore_wakeup) {
            mmp_wake_saved = 0;
            mmp_idle->ops->restore_wakeup();
        }
        /* If hardware really shutdown MP subsystem */
        if (!(readl_relaxed(regs_addr_get_va(REGS_ADDR_GIC_DIST) +
                            GIC_DIST_CTRL) & 0x1)) {
            pr_debug("%s: cpu%u: cluster%u is up!\n", __func__, cpu, cluster);
            cpu_cluster_pm_exit();
        }
    }

    if (!mmp_pm_use_count[cluster][cpu])
        mmp_pm_use_count[cluster][cpu] = 1;

    mmp_enter_lpm[cluster][cpu] = 0;

    if (mmp_idle->ops->clr_pmu)
        mmp_idle->ops->clr_pmu(cpu);

    arch_spin_unlock(&mmp_lpm_lock);
    local_irq_restore(flags);
}
Exemplo n.º 2
0
__interrupt void UartInterrupt(void)
{
   Word_t        VectorRegister;
   volatile char Dummy;

   /* Read the Vector register once to determine the cause of the       */
   /* interrupt.                                                        */
   VectorRegister = BT_UART_IVR;

   /* Determine the cause of the interrupt (Rx or Tx).                  */
   if(VectorRegister == USCI_UCRXIFG)
   {
      /* Check to see if there is buffer space to receive the data.     */
      if(UartContext.RxBytesFree)
      {
         /* check to see if an overrun occured.                         */
         if(HWREG8(UartContext.UartBase + MSP430_UART_STAT_OFFSET) & 0xEC)
            HAL_ConsoleWrite(1, "?");

         /* Read the character from the UART Receive Buf.               */
         UartContext.RxBuffer[UartContext.RxInIndex++] = UARTReceiveBufferReg(UartContext.UartBase);

         /* Credit the received character.                              */
         --(UartContext.RxBytesFree);

         /* Check to see if we have reached the end of the Buffer and   */
         /* need to loop back to the beginning.                         */
         if(UartContext.RxInIndex >= UartContext.RxBufferSize)
            UartContext.RxInIndex = 0;

         /* Check to see if we need to Disable Rx Flow                  */
         /* RxThread will re-enable flow control when it is possible    */
         if((UartContext.Flags & UART_CONTEXT_FLAG_FLOW_ENABLED) && (UartContext.RxBytesFree <= UartContext.XOffLimit))
         {
            /* if Flow is Enabled then disable it                       */
            UartContext.Flags &= (~UART_CONTEXT_FLAG_FLOW_ENABLED);
            FLOW_OFF();
         }
      }
      else
      {
         /* We have data in the FIFO, but no place to put the data,     */
         /* so will will have to flush the FIFO and discard the data.   */
         Dummy = UARTReceiveBufferReg(UartContext.UartBase);

         /* Flag that we have encountered an RX Overrun.                */
         /* Also Disable Rx Flow.                                       */
         UartContext.Flags |= UART_CONTEXT_FLAG_RX_OVERRUN;
         UartContext.Flags &= (~UART_CONTEXT_FLAG_FLOW_ENABLED);
         FLOW_OFF();
      }

      /* If the UART is in the process of shutting down flag that this  */
      /* has been interrupted due to the arrival of UART data.          */
      if(UartContext.SuspendState == hssSuspendWait)
      {
         /* Indicate the suspend is interrupted.                        */
         UartContext.SuspendState = hssSuspendWaitInterrupted;
      }
   }
   else
   {
      if(VectorRegister == USCI_UCTXIFG)
      {
         /* Process the Transmit Empty Interrupt.                       */
         TxTransmit();
      }
   }

   /* Exit from LPM if necessary (this statement will have no effect if */
   /* we are not currently in low power mode).                          */
   LPM_EXIT();
}