Exemplo n.º 1
0
static void loongson2_cpu_wait(void)
{
	unsigned long flags;
	u32 cpu_freq;

	spin_lock_irqsave(&loongson2_wait_lock, flags);
	cpu_freq = LOONGSON_CHIPCFG(0);
	LOONGSON_CHIPCFG(0) &= ~0x7;	/* Put CPU into wait mode */
	LOONGSON_CHIPCFG(0) = cpu_freq;	/* Restore CPU state */
	spin_unlock_irqrestore(&loongson2_wait_lock, flags);
	local_irq_enable();
}
Exemplo n.º 2
0
static void reset_cpu(void)
{
	/*
	 * reset cpu to full speed, this is needed when enabling cpu frequency
	 * scalling
	 */
	LOONGSON_CHIPCFG(0) |= 0x7;
}
Exemplo n.º 3
0
Arquivo: pm.c Projeto: 0-T-0/ps4-linux
static void loongson_suspend_enter(void)
{
	static unsigned int cached_cpu_freq;

	/* setup wakeup events via enabling the IRQs */
	setup_wakeup_events();

	stop_perf_counters();

	cached_cpu_freq = LOONGSON_CHIPCFG(0);

	/* Put CPU into wait mode */
	LOONGSON_CHIPCFG(0) &= ~0x7;

	/* wait for the given events to wakeup cpu from wait mode */
	wait_for_wakeup_events();

	LOONGSON_CHIPCFG(0) = cached_cpu_freq;
	mmiowb();
}
Exemplo n.º 4
0
Arquivo: pm.c Projeto: 0-T-0/ps4-linux
/*
 * If the events are really what we want to wakeup the CPU, wake it up
 * otherwise put the CPU asleep again.
 */
static void wait_for_wakeup_events(void)
{
	while (!wakeup_loongson())
		LOONGSON_CHIPCFG(0) &= ~0x7;
}