// SPDX-License-Identifier: GPL-2.0-or-later /* * elanfreq: cpufreq driver for the AMD ELAN family * * (c) Copyright 2002 Robert Schwebel <r.schwebel@pengutronix.de> * * Parts of this code are (c) Sven Geggus <sven@geggus.net> * * All Rights Reserved. * * 2002-02-13: - initial revision for 2.4.18-pre9 by Robert Schwebel
*/
/** * elanfreq_get_cpu_frequency: determine current cpu speed * * 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.
*/
/* Are we in CPU clock multiplied mode (66/99 MHz)? */ if ((clockspeed_reg & 0xE0) == 0xC0) { if ((clockspeed_reg & 0x01) == 0) return 66000; else return 99000;
}
/* 33 MHz is not 32 MHz... */ if ((clockspeed_reg & 0xE0) == 0xA0) return 33000;
staticint elanfreq_target(struct cpufreq_policy *policy, unsignedint state)
{ /* * Access to the Elan's internal registers is indexed via * 0x22: Chip Setup & Control Register Index Register (CSCI) * 0x23: Chip Setup & Control Register Data Register (CSCD) *
*/
/* * 0x40 is the Power Management Unit's Force Mode Register. * Bit 6 enables Hyperspeed Mode (66/100 MHz core frequency)
*/
local_irq_disable();
outb_p(0x40, REG_CSCIR); /* Disable hyperspeed mode */
outb_p(0x00, REG_CSCDR);
local_irq_enable(); /* wait till internal pipelines and */
udelay(1000); /* buffers have cleaned up */
local_irq_disable();
/* now, set the CPU clock speed register (0x80) */
outb_p(0x80, REG_CSCIR);
outb_p(elan_multiplier[state].val80h, REG_CSCDR);
/* now, the hyperspeed bit in PMU Force Mode Register (0x40) */
outb_p(0x40, REG_CSCIR);
outb_p(elan_multiplier[state].val40h, REG_CSCDR);
udelay(10000);
local_irq_enable();
#ifndef MODULE /** * elanfreq_setup - elanfreq command line parameter parsing * * elanfreq command line parameter. Use: * elanfreq=66000 * to set the maximum CPU frequency to 66 MHz. Note that in * case you do not give this boot parameter, the maximum * frequency will fall back to _current_ CPU frequency which * might be lower. If you build this as a module, use the * max_freq module parameter instead.
*/ staticint __init elanfreq_setup(char *str)
{
max_freq = simple_strtoul(str, &str, 0);
pr_warn("You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n"); return 1;
}
__setup("elanfreq=", elanfreq_setup); #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.