Ejemplo n.º 1
0
int meson_power_suspend(void)
{
	static int test_flag = 0;
	unsigned addr;
	unsigned p_addr;
	void	(*pwrtest_entry)(unsigned,unsigned,unsigned,unsigned);

	check_in_param();
	flush_cache_all();

	addr = 0x04F04400;//entry.s start
	p_addr = (unsigned)__phys_to_virt(addr);
	pwrtest_entry = (void (*)(unsigned,unsigned,unsigned,unsigned))p_addr;
	if(test_flag != 1234){
		test_flag = 1234;
		printk("initial appf\n");
		pwrtest_entry(APPF_INITIALIZE,0,0,IO_PL310_BASE & 0xffff0000);
	}
	if(AML_WDT_ENABLED){
		disable_watchdog();
		if(awdtv)
			enable_watchdog(awdtv->firmware_timeout*awdtv->one_second);
	}

	printk("power down cpu --\n");
	pwrtest_entry(APPF_POWER_DOWN_CPU,0,0,APPF_SAVE_PMU|APPF_SAVE_VFP|APPF_SAVE_L2 |( IO_PL310_BASE & 0xffff0000));
	if(AML_WDT_ENABLED){
		disable_watchdog();
		if(awdtv)
			enable_watchdog(awdtv->suspend_timeout*awdtv->one_second);
	}
	return 0;
}
Ejemplo n.º 2
0
static int aml_wdt_start(struct watchdog_device *wdog)
{
    struct aml_wdt_dev *wdev = watchdog_get_drvdata(wdog);
    spin_lock(&wdt_lock);
    if(wdog->timeout==0xffffffff)
        enable_watchdog(wdev->default_timeout * wdev->one_second);
    else
        enable_watchdog(wdog->timeout* wdev->one_second);
    spin_unlock(&wdt_lock);
#if 0
    if(wdev->boot_queue)
        cancel_delayed_work(&wdev->boot_queue);
#endif
    return 0;
}
Ejemplo n.º 3
0
int meson_power_suspend(void)
{
	static int test_flag = 0;
	unsigned addr;
  unsigned p_addr;
	void	(*pwrtest_entry)(unsigned,unsigned,unsigned,unsigned);

	flush_cache_all();

	addr = 0x1FF04400;
	p_addr = (unsigned)virt_to_phys((void*)addr);
	pwrtest_entry = (void (*)(unsigned,unsigned,unsigned,unsigned))p_addr;
	if(test_flag != 1234){
		test_flag = 1234;
		printk("initial appf\n");
		pwrtest_entry(APPF_INITIALIZE,0,0,0);
	}
#ifdef CONFIG_SUSPEND_WATCHDOG
	disable_watchdog();
#endif
	printk("power down cpu --\n");
	pwrtest_entry(APPF_POWER_DOWN_CPU,0,0,APPF_SAVE_PMU|APPF_SAVE_VFP|APPF_SAVE_L2);
#ifdef CONFIG_SUSPEND_WATCHDOG
	enable_watchdog();
#endif
	return 0;
}
Ejemplo n.º 4
0
int main(void)
{
	halInit();
	chSysInit();

	mcu_conf();

	for (int i = 0; i < 10; i++)
	{
		chThdSleepMilliseconds(100);
		palTogglePad(TEST_LED_PORT3, TEST_LED_PIN3);
	}

	ap.start();
	appInit();

	ph.StartAutoIdle();
	ph.setFunctionTable(&ph_ft);
	enable_watchdog();
	ph.RequestData(STARTUP);

	while (TRUE)
	{
		Scheduler::Play();
		sysTime = chTimeNow();
		ph.HandlePacketLoop();
	}

	return 1;
}
Ejemplo n.º 5
0
static int aml_wtd_pm_notify(struct notifier_block *nb, unsigned long event,
                             void *dummy)
{

    if (event == PM_SUSPEND_PREPARE) {
        printk("set watch dog suspend timeout %d seconds\n",awdtv->suspend_timeout);
        enable_watchdog(awdtv->suspend_timeout*awdtv->one_second);
    }
    if (event == PM_POST_SUSPEND) {
        printk("resume watch dog finish\n");
        if(awdtv->timeout==0xffffffff)
            enable_watchdog(awdtv->default_timeout * awdtv->one_second);
        else
            enable_watchdog(awdtv->timeout* awdtv->one_second);
    }
    return NOTIFY_OK;
}
Ejemplo n.º 6
0
static int aml_wtd_pm_notify(struct notifier_block *nb, unsigned long event,
	void *dummy)
{

	if (event == PM_SUSPEND_PREPARE) {
		disable_watchdog(awdtv);
		pr_info("disable watchdog\n");
	}
	if (event == PM_POST_SUSPEND) {
		enable_watchdog(awdtv);
		pr_info("enable watchdog\n");
	}
	return NOTIFY_OK;
}
Ejemplo n.º 7
0
static int aml_wdt_probe(struct platform_device *pdev)
{
	struct watchdog_device *aml_wdt;
	struct aml_wdt_dev *wdev;
	int ret;
	aml_wdt = devm_kzalloc(&pdev->dev, sizeof(*aml_wdt), GFP_KERNEL);
	if (!aml_wdt)
		return -ENOMEM;

	wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
	if (!wdev)
		return -ENOMEM;
	wdev->dev		= &pdev->dev;
	mutex_init(&wdev->lock);
	aml_init_pdata(wdev);

	aml_wdt->info	      = &aml_wdt_info;
	aml_wdt->ops	      = &aml_wdt_ops;
	aml_wdt->min_timeout = wdev->min_timeout;
	aml_wdt->max_timeout = wdev->max_timeout;
	aml_wdt->timeout = 0xffffffff;
	wdev->timeout = 0xffffffff;

	watchdog_set_drvdata(aml_wdt, wdev);
	platform_set_drvdata(pdev, aml_wdt);
	if (wdev->reset_watchdog_method == 1) {

		INIT_DELAYED_WORK(&wdev->boot_queue, boot_moniter_work);
		mod_delayed_work(system_freezable_wq, &wdev->boot_queue,
	 round_jiffies(msecs_to_jiffies(wdev->reset_watchdog_time*1000)));
		enable_watchdog(wdev);
		set_watchdog_cnt(wdev,
				 wdev->default_timeout * wdev->one_second);
		dev_info(wdev->dev, "creat work queue for watch dog\n");
	}
	ret = watchdog_register_device(aml_wdt);
	if (ret)
		return ret;
	awdtv = wdev;
	register_pm_notifier(&aml_wdt_pm_notifier);
	register_reboot_notifier(&aml_wdt_reboot_notifier);
	dev_info(wdev->dev, "AML Watchdog Timer probed done\n");

	return 0;
}