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
This commit is contained in:
Michael Sevakis 2010-04-07 03:43:48 +00:00
parent 48789c5361
commit 87eea33def
7 changed files with 332 additions and 0 deletions

View file

@ -0,0 +1,48 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Michael Sevakis
*
* i.MX31 DVFS and DPTC drivers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "config.h"
#include "system.h"
#include "ccm-imx31.h"
#include "mc13783.h"
/* Most of the code in here is based upon the Linux BSP provided by Freescale
* Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved. */
void dvfs_dptc_start(void)
{
/* For now, just set the regulator voltage off of overdrive mode */
/* For 264 MHz, DPTC is not needed and lower V can be used */
mc13783_write_masked(MC13783_SWITCHERS0,
MC13783_SW_1_350 << MC13783_SW1A_POS,
MC13783_SW1A);
imx31_regmod32(&CCM_PMCR0, CCM_PMCR0_DVS1_0_DVS0_0,
CCM_PMCR0_DVSUP_DVS);
}
void dvfs_dptc_stop(void)
{
/* Nothing for now */
}

View file

@ -0,0 +1,30 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Michael Sevakis
*
* i.MX31 DVFS and DPTC driver declarations
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _DVFS_DPTC_IMX31_H_
#define _DVFS_DPTC_IMX31_H_
void dvfs_dptc_start(void);
void dvfs_dptc_stop(void);
#endif /* _DVFS_DPTC_IMX31_H_ */

View file

@ -25,6 +25,7 @@
#include "mc13783.h"
#include "ccm-imx31.h"
#include "sdma-imx31.h"
#include "dvfs_dptc-imx31.h"
#include "kernel.h"
#include "thread.h"
@ -69,6 +70,7 @@ void kernel_device_init(void)
sdma_init();
spi_init();
mc13783_init();
dvfs_dptc_start();
}
#ifdef BOOTLOADER

View file

@ -31,6 +31,7 @@
#include "debug.h"
#include "ccm-imx31.h"
#include "mc13783.h"
#include "dvfs_dptc-imx31.h"
static unsigned long product_rev;
static unsigned long system_rev;
@ -241,6 +242,7 @@ void __attribute__((naked)) imx31_regclr32(volatile uint32_t *reg_p,
#ifdef BOOTLOADER
void system_prepare_fw_start(void)
{
dvfs_dptc_stop();
disable_interrupt(IRQ_FIQ_STATUS);
avic_disable_int(INT_ALL);
mc13783_close();