summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-04-07 03:43:48 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-04-07 03:43:48 +0000
commit87eea33def283e23e239e716ee67093b0bdde226 (patch)
tree834f1914514735a39842e5ec69047138d28bb433 /firmware/target
parent48789c5361419ebc88fe603912c139ca077b5cfb (diff)
downloadrockbox-87eea33def283e23e239e716ee67093b0bdde226.tar.gz
rockbox-87eea33def283e23e239e716ee67093b0bdde226.zip
Gigabeat S (imx31): Begin voltage and frequency scaling code. For now, to avoid overdrive voltage, just lower core voltage to 1.35V since voltage scaling shouldn't be required for frequencies lower than 399 MHz (according to Freescale BSP, which set all working points to 1.35V for those frequencies). Perhaps battery life will improve as well (cross fingers :).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25506 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/imx31/dvfs_dptc-imx31.c48
-rw-r--r--firmware/target/arm/imx31/dvfs_dptc-imx31.h30
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c2
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/system-imx31.c2
4 files changed, 82 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/dvfs_dptc-imx31.c b/firmware/target/arm/imx31/dvfs_dptc-imx31.c
new file mode 100644
index 0000000000..8f32fd0fba
--- /dev/null
+++ b/firmware/target/arm/imx31/dvfs_dptc-imx31.c
@@ -0,0 +1,48 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Michael Sevakis
11 *
12 * i.MX31 DVFS and DPTC drivers
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#include "config.h"
24#include "system.h"
25#include "ccm-imx31.h"
26#include "mc13783.h"
27
28/* Most of the code in here is based upon the Linux BSP provided by Freescale
29 * Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved. */
30
31void dvfs_dptc_start(void)
32{
33 /* For now, just set the regulator voltage off of overdrive mode */
34 /* For 264 MHz, DPTC is not needed and lower V can be used */
35
36 mc13783_write_masked(MC13783_SWITCHERS0,
37 MC13783_SW_1_350 << MC13783_SW1A_POS,
38 MC13783_SW1A);
39 imx31_regmod32(&CCM_PMCR0, CCM_PMCR0_DVS1_0_DVS0_0,
40 CCM_PMCR0_DVSUP_DVS);
41}
42
43
44void dvfs_dptc_stop(void)
45{
46 /* Nothing for now */
47}
48
diff --git a/firmware/target/arm/imx31/dvfs_dptc-imx31.h b/firmware/target/arm/imx31/dvfs_dptc-imx31.h
new file mode 100644
index 0000000000..8f6f5da98d
--- /dev/null
+++ b/firmware/target/arm/imx31/dvfs_dptc-imx31.h
@@ -0,0 +1,30 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Michael Sevakis
11 *
12 * i.MX31 DVFS and DPTC driver declarations
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24#ifndef _DVFS_DPTC_IMX31_H_
25#define _DVFS_DPTC_IMX31_H_
26
27void dvfs_dptc_start(void);
28void dvfs_dptc_stop(void);
29
30#endif /* _DVFS_DPTC_IMX31_H_ */
diff --git a/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c b/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c
index 775f5cebf0..8e81447bd3 100644
--- a/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c
@@ -25,6 +25,7 @@
25#include "mc13783.h" 25#include "mc13783.h"
26#include "ccm-imx31.h" 26#include "ccm-imx31.h"
27#include "sdma-imx31.h" 27#include "sdma-imx31.h"
28#include "dvfs_dptc-imx31.h"
28#include "kernel.h" 29#include "kernel.h"
29#include "thread.h" 30#include "thread.h"
30 31
@@ -69,6 +70,7 @@ void kernel_device_init(void)
69 sdma_init(); 70 sdma_init();
70 spi_init(); 71 spi_init();
71 mc13783_init(); 72 mc13783_init();
73 dvfs_dptc_start();
72} 74}
73 75
74#ifdef BOOTLOADER 76#ifdef BOOTLOADER
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
index 65299cb8d0..cd684e77ac 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
@@ -31,6 +31,7 @@
31#include "debug.h" 31#include "debug.h"
32#include "ccm-imx31.h" 32#include "ccm-imx31.h"
33#include "mc13783.h" 33#include "mc13783.h"
34#include "dvfs_dptc-imx31.h"
34 35
35static unsigned long product_rev; 36static unsigned long product_rev;
36static unsigned long system_rev; 37static unsigned long system_rev;
@@ -241,6 +242,7 @@ void __attribute__((naked)) imx31_regclr32(volatile uint32_t *reg_p,
241#ifdef BOOTLOADER 242#ifdef BOOTLOADER
242void system_prepare_fw_start(void) 243void system_prepare_fw_start(void)
243{ 244{
245 dvfs_dptc_stop();
244 disable_interrupt(IRQ_FIQ_STATUS); 246 disable_interrupt(IRQ_FIQ_STATUS);
245 avic_disable_int(INT_ALL); 247 avic_disable_int(INT_ALL);
246 mc13783_close(); 248 mc13783_close();