Ejemplo n.º 1
0
static void mt_gpt_set_mode(enum clock_event_mode mode,
                                struct clock_event_device *evt)
{
    struct gpt_device *dev = id_to_dev(GPT_CLKEVT_ID);

    //printk("[%s]entry, mode=%d\n", __func__, mode);
    switch (mode) {
    case CLOCK_EVT_MODE_PERIODIC:
        __gpt_stop(dev);
        __gpt_set_mode(dev, GPT_REPEAT);
        __gpt_enable_irq(dev);
        __gpt_start_from_zero(dev);
        break;

    case CLOCK_EVT_MODE_ONESHOT:
        __gpt_stop(dev);
        __gpt_set_mode(dev, GPT_ONE_SHOT);
        __gpt_enable_irq(dev);
        __gpt_start_from_zero(dev);
        break;

    case CLOCK_EVT_MODE_UNUSED:
    case CLOCK_EVT_MODE_SHUTDOWN:
        __gpt_stop(dev);
        __gpt_disable_irq(dev);
        __gpt_ack_irq(dev);
    case CLOCK_EVT_MODE_RESUME:
        break;
    }
}
Ejemplo n.º 2
0
static void __gpt_reset(struct gpt_device *dev)
{
    DRV_WriteReg32(dev->base_addr + GPT_CON, 0x0);
    __gpt_disable_irq(dev);
    __gpt_ack_irq(dev);
    DRV_WriteReg32(dev->base_addr + GPT_CLK, 0x0);
    DRV_WriteReg32(dev->base_addr + GPT_CON, 0x2);
    DRV_WriteReg32(dev->base_addr + GPT_CMP, 0x0);
    if (dev->features & GPT_FEAT_64_BIT) {
        DRV_WriteReg32(dev->base_addr + GPT_CMPH, 0);
    } 
}
Ejemplo n.º 3
0
static void __gpt_reset(struct gpt_device *dev)
{

	mt_reg_sync_writel(0x0, dev->base_addr + GPT_CON);
	__gpt_disable_irq(dev);
	__gpt_ack_irq(dev);
	mt_reg_sync_writel(0x0, dev->base_addr + GPT_CLK);
	mt_reg_sync_writel(0x2, dev->base_addr + GPT_CON);
	mt_reg_sync_writel(0x0, dev->base_addr + GPT_CMP);
	if (dev->features & GPT_FEAT_64_BIT)
		mt_reg_sync_writel(0, dev->base_addr + GPT_CMPH);
}
Ejemplo n.º 4
0
static void syscnt_assist_resume(void)
{
    unsigned int old_loop;
    unsigned int assist_cnt1, assist_cnt2;
    unsigned int syscnt_cnt[2] = {0};

    struct gpt_device *assist_dev = id_to_dev(GPT_SYSCNT_ASSIST_ID);
    struct gpt_device *syscnt_dev = id_to_dev(GPT_SYSCNT_ID);

    do {
        __gpt_get_cnt(assist_dev, &assist_cnt1);
        __gpt_get_cnt(syscnt_dev, syscnt_cnt);
        __gpt_ack_irq(assist_dev);
        __gpt_get_cnt(assist_dev, &assist_cnt2);
    } while (assist_cnt1 > assist_cnt2);

    old_loop = loop;
    loop = syscnt_cnt[1];

    printk("[%s]assist(0x%08x, 0x%08x),syscnt(0x%08x,0x%08x),loop(%u->%u)\n",
            __func__, assist_cnt1, assist_cnt2, syscnt_cnt[0], syscnt_cnt[1],
            old_loop, loop);
}