summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/system-target.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-01-10 00:43:08 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-01-10 00:51:35 +0000
commit5aa19f3eeb4e401b2d1ac57131a87b87b6ce55d5 (patch)
treeae54a62a5a4420dff8ec5198f6f5c9418c34151f /firmware/target/arm/imx233/system-target.h
parentb9923df170104320e55bff05ecc2a0105067f9cb (diff)
downloadrockbox-5aa19f3eeb4e401b2d1ac57131a87b87b6ce55d5.tar.gz
rockbox-5aa19f3eeb4e401b2d1ac57131a87b87b6ce55d5.zip
imx233: implement emi frequency scaling (disabled by default)
CPU frequency scaling is basically useless without scaling the memory frequency. On the i.MX233, the EMI (external memory interface) and DRAM blocks are responsable for the DDR settings. This commits implements emi frequency scaling. Only some settings are implemented and the timings values only apply to mDDR (extracted from Sigmatel linux port) and have been checked to work on the Fuze+ and Zen X-Fi2/3. This feature is still disabled by default but I expected some battery life savings by boosting higher to 454MHz and unboosting lower to 64MHz. Note that changing the emi frequency is particularly tricky and to avoid writing it entirely in assembly we rely on the compiler to not use the stack except in the prolog and epilog (because it's in dram which is disabled when doing the change) and to put constant pools in iram which should always be true if the compiler isn't completely dumb and since the code itself is put in iram. If this proves to be insufficient, one can always switch the stack to the irq stack since interrupts are disabled during the change. Change-Id: If6ef5357f7ff091130ca1063e48536c6028f23ba
Diffstat (limited to 'firmware/target/arm/imx233/system-target.h')
-rw-r--r--firmware/target/arm/imx233/system-target.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/firmware/target/arm/imx233/system-target.h b/firmware/target/arm/imx233/system-target.h
index 5515597570..c6073a9ae3 100644
--- a/firmware/target/arm/imx233/system-target.h
+++ b/firmware/target/arm/imx233/system-target.h
@@ -37,6 +37,18 @@
37 37
38#define HW_DIGCTL_MICROSECONDS (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xC0)) 38#define HW_DIGCTL_MICROSECONDS (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0xC0))
39 39
40#define HW_DIGCTL_ARMCACHE (*(volatile uint32_t *)(HW_DIGCTL_BASE + 0x2b0))
41#define HW_DIGCTL_ARMCACHE__ITAG_SS_BP 0
42#define HW_DIGCTL_ARMCACHE__ITAG_SS_BM (3 << 0)
43#define HW_DIGCTL_ARMCACHE__DTAG_SS_BP 4
44#define HW_DIGCTL_ARMCACHE__DTAG_SS_BM (3 << 4)
45#define HW_DIGCTL_ARMCACHE__CACHE_SS_BP 8
46#define HW_DIGCTL_ARMCACHE__CACHE_SS_BM (3 << 8)
47#define HW_DIGCTL_ARMCACHE__DRTY_SS_BP 12
48#define HW_DIGCTL_ARMCACHE__DRTY_SS_BM (3 << 12)
49#define HW_DIGCTL_ARMCACHE__VALID_SS_BP 16
50#define HW_DIGCTL_ARMCACHE__VALID_SS_BM (3 << 16)
51
40/* USB Phy */ 52/* USB Phy */
41#define HW_USBPHY_BASE 0x8007C000 53#define HW_USBPHY_BASE 0x8007C000
42#define HW_USBPHY_PWD (*(volatile uint32_t *)(HW_USBPHY_BASE + 0)) 54#define HW_USBPHY_PWD (*(volatile uint32_t *)(HW_USBPHY_BASE + 0))
@@ -48,17 +60,17 @@
48 * Absolute maximum CPU speed: 454.74 MHz 60 * Absolute maximum CPU speed: 454.74 MHz
49 * Intermediate CPU speeds: 392.73 MHz, 360MHz, 261.82 MHz, 64 MHz 61 * Intermediate CPU speeds: 392.73 MHz, 360MHz, 261.82 MHz, 64 MHz
50 * Absolute minimum CPU speed: 24 MHz */ 62 * Absolute minimum CPU speed: 24 MHz */
51#define IMX233_CPUFREQ_454_MHz 454740000 63#define IMX233_CPUFREQ_454_MHz 454740
52#define IMX233_CPUFREQ_392_MHz 392730000 64#define IMX233_CPUFREQ_392_MHz 392730
53#define IMX233_CPUFREQ_360_MHz 360000000 65#define IMX233_CPUFREQ_360_MHz 360000
54#define IMX233_CPUFREQ_261_MHz 261820000 66#define IMX233_CPUFREQ_261_MHz 261820
55#define IMX233_CPUFREQ_64_MHz 64000000 67#define IMX233_CPUFREQ_64_MHz 64000
56#define IMX233_CPUFREQ_24_MHz 24000000 68#define IMX233_CPUFREQ_24_MHz 24000
57 69
58#define CPUFREQ_DEFAULT IMX233_CPUFREQ_261_MHz 70#define CPUFREQ_DEFAULT IMX233_CPUFREQ_64_MHz
59#define CPUFREQ_NORMAL IMX233_CPUFREQ_261_MHz 71#define CPUFREQ_NORMAL IMX233_CPUFREQ_64_MHz
60#define CPUFREQ_MAX IMX233_CPUFREQ_454_MHz 72#define CPUFREQ_MAX IMX233_CPUFREQ_454_MHz
61#define CPUFREQ_SLEEP IMX233_CPUFREQ_261_MHz 73#define CPUFREQ_SLEEP IMX233_CPUFREQ_64_MHz
62 74
63void udelay(unsigned us); 75void udelay(unsigned us);
64bool imx233_us_elapsed(uint32_t ref, unsigned us_delay); 76bool imx233_us_elapsed(uint32_t ref, unsigned us_delay);