/* Finds out at which frequency the CPU of the Elan SOC runs at the moment. Frequencies from 1 to 33 MHz are generated the normal way, 66 and 99 MHz are called "Hyperspeed Mode" and have the rest of the chip running with 33 MHz.  */
static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
/* Finds out at which frequency the CPU of the Elan SOC runs at the moment. Frequencies from 1 to 33 MHz are generated the normal way, 66 and 99 MHz are called "Hyperspeed Mode" and have the rest of the chip running with 33 MHz.  */
static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
{
	u8 clockspeed_reg;
	local_irq_disable();
	outb_p(0x80, REG_CSCIR);
	clockspeed_reg = inb_p(REG_CSCDR);
	local_irq_enable();
	if ((clockspeed_reg & 0xE0) == 0xE0)
		return 0;
	if ((clockspeed_reg & 0xE0) == 0xC0) {
		if ((clockspeed_reg & 0x01) == 0)
			return 66000;
		else
			return 99000;
	}
	if ((clockspeed_reg & 0xE0) == 0xA0)
		return 33000;
	return (1<<((clockspeed_reg & 0xE0) >> 5)) * 1000;
}