diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-12-05 21:13:14 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-12-05 21:13:14 +0000 |
commit | 2bd1c4a418f5e739b871a9dcbc0ec3e83189f55d (patch) | |
tree | 15b8e135ff6db2b0d7c4f7e14d50b46f45dbbc02 /sys/arch | |
parent | 26a225eaf663f2c4a99773819be6259024e5c2b7 (diff) |
- Run only the necessary code to transition from one speed to another.
- Don't clobber perflevel, instead leave it to the user requested value.
precise description and ok drahn@ :)
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_apm.c | 61 |
1 files changed, 25 insertions, 36 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_apm.c b/sys/arch/arm/xscale/pxa2x0_apm.c index 51d693bca7b..e7f81333304 100644 --- a/sys/arch/arm/xscale/pxa2x0_apm.c +++ b/sys/arch/arm/xscale/pxa2x0_apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_apm.c,v 1.20 2005/12/02 17:50:51 uwe Exp $ */ +/* $OpenBSD: pxa2x0_apm.c,v 1.21 2005/12/05 21:13:13 uwe Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -1398,51 +1398,40 @@ pxa2x0_setperf(int speed) #if 0 /* Not yet, because OSCR0 does not run in low-power mode. */ if (speed <= 30) { - pxa27x_run_mode(); - pxa27x_fastbus_run_mode(0, MDREFR_LOW); - delay(1); - pxa27x_cpu_speed_91(); - freq = 91; - if (perflevel > 50) + if (freq > 91) { + pxa27x_run_mode(); + pxa27x_fastbus_run_mode(0, MDREFR_LOW); + pxa27x_cpu_speed_91(); pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh, PI2C_VOLTAGE_LOW); - perflevel = 25; + freq = 91; + } } else #endif if (speed < 60) { - if (perflevel < 50) + if (freq < 208) pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh, PI2C_VOLTAGE_HIGH); - - pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16, - CLKCFG_F, &pxa2x0_memcfg); - - /* XXX is the delay long enough, and necessary at all? */ - delay(1); - - pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high); - freq = 208; - perflevel = 50; + if (freq != 208) { + pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | + CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg); + pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high); + freq = 208; + } } else { - if (perflevel < 50) + if (freq < 208) { pxa2x0_pi2c_setvoltage(sc->sc_iot, sc->sc_pm_ioh, PI2C_VOLTAGE_HIGH); - - /* Change to 208Mhz run mode with fast-bus still disabled. */ - pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16, - CLKCFG_F, &pxa2x0_memcfg); - - /* XXX is the delay long enough, and necessary at all? */ - delay(1); - - pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high); - - /* Change to 416Mhz turbo mode with fast-bus enabled. */ - pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | CCCR_RUN_X16, - CLKCFG_B | CLKCFG_F | CLKCFG_T, &pxa2x0_memcfg); - - freq = 416; - perflevel = 100; + pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | + CCCR_RUN_X16, CLKCFG_F, &pxa2x0_memcfg); + pxa27x_fastbus_run_mode(1, pxa2x0_memcfg.mdrefr_high); + } + if (freq < 416) { + pxa27x_frequency_change(CCCR_A | CCCR_TURBO_X2 | + CCCR_RUN_X16, CLKCFG_B | CLKCFG_F | CLKCFG_T, + &pxa2x0_memcfg); + freq = 416; + } } restore_interrupts(s); |