OMAP3: PM: Adding voltage driver support.
This patch adds voltage driver support for OMAP3. The driver allows configuring the voltage controller and voltage processors during init and exports APIs to enable/disable voltage processors, scale voltage and reset voltage. The driver maintains the global voltage table on a per VDD basis which contains the various voltages supported by the VDD along with per voltage dependent data like smartreflex efuse offset, errminlimit and voltage processor errorgain. The driver also allows the voltage parameters dependent on the PMIC to be passed from the PMIC file through an API. The driver allows scaling of VDD voltages either through "vc bypass method" or through "vp forceupdate method" the choice being configurable through the board file. This patch contains code originally in linux omap pm branch smartreflex driver. Major contributors to this driver are Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley, Nishant Menon, Kevin Hilman. The separation of PMIC parameters into a separate structure which can be populated from the PMIC file is based on the work of Lun Chang from Motorola in an internal tree. Signed-off-by: Thara Gopinath <thara@ti.com> [khilman: fixed link error for OMAP2-only defconfig] Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
This commit is contained in:
Родитель
f17f9726c2
Коммит
2f34ce81b8
|
@ -57,8 +57,9 @@ endif
|
|||
# Power Management
|
||||
ifeq ($(CONFIG_PM),y)
|
||||
obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o cpuidle34xx.o pm_bus.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o voltage.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o voltage.o \
|
||||
cpuidle34xx.o pm_bus.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o pm_bus.o
|
||||
obj-$(CONFIG_PM_DEBUG) += pm-debug.o
|
||||
|
||||
|
|
|
@ -148,6 +148,15 @@
|
|||
#define OMAP343X_CONTROL_TEST_KEY_11 (OMAP2_CONTROL_GENERAL + 0x00f4)
|
||||
#define OMAP343X_CONTROL_TEST_KEY_12 (OMAP2_CONTROL_GENERAL + 0x00f8)
|
||||
#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP1_VDD1 (OMAP2_CONTROL_GENERAL + 0x0110)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP2_VDD1 (OMAP2_CONTROL_GENERAL + 0x0114)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP3_VDD1 (OMAP2_CONTROL_GENERAL + 0x0118)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP4_VDD1 (OMAP2_CONTROL_GENERAL + 0x011c)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP5_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP1_VDD2 (OMAP2_CONTROL_GENERAL + 0x0124)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP2_VDD2 (OMAP2_CONTROL_GENERAL + 0x0128)
|
||||
#define OMAP343X_CONTROL_FUSE_OPP3_VDD2 (OMAP2_CONTROL_GENERAL + 0x012c)
|
||||
#define OMAP343X_CONTROL_FUSE_SR (OMAP2_CONTROL_GENERAL + 0x0130)
|
||||
#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
|
||||
#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
|
||||
#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
|
||||
|
@ -164,6 +173,14 @@
|
|||
#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0)
|
||||
#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4)
|
||||
|
||||
/* OMAP3630 only CONTROL_GENERAL register offsets */
|
||||
#define OMAP3630_CONTROL_FUSE_OPP1G_VDD1 (OMAP2_CONTROL_GENERAL + 0x0110)
|
||||
#define OMAP3630_CONTROL_FUSE_OPP50_VDD1 (OMAP2_CONTROL_GENERAL + 0x0114)
|
||||
#define OMAP3630_CONTROL_FUSE_OPP100_VDD1 (OMAP2_CONTROL_GENERAL + 0x0118)
|
||||
#define OMAP3630_CONTROL_FUSE_OPP120_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120)
|
||||
#define OMAP3630_CONTROL_FUSE_OPP50_VDD2 (OMAP2_CONTROL_GENERAL + 0x0128)
|
||||
#define OMAP3630_CONTROL_FUSE_OPP100_VDD2 (OMAP2_CONTROL_GENERAL + 0x012C)
|
||||
|
||||
/* AM35XX only CONTROL_GENERAL register offsets */
|
||||
#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038)
|
||||
#define AM35XX_CONTROL_DEVCONF2 (OMAP2_CONTROL_GENERAL + 0x0310)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <plat/omap-pm.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/common.h>
|
||||
#include <plat/voltage.h>
|
||||
|
||||
#include "powerdomain.h"
|
||||
#include "clockdomain.h"
|
||||
|
@ -163,3 +164,10 @@ static int __init omap2_common_pm_init(void)
|
|||
}
|
||||
postcore_initcall(omap2_common_pm_init);
|
||||
|
||||
static int __init omap2_common_pm_late_init(void)
|
||||
{
|
||||
omap_voltage_late_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall(omap2_common_pm_late_init);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* OMAP Voltage Management Routines
|
||||
*
|
||||
* Author: Thara Gopinath <thara@ti.com>
|
||||
*
|
||||
* Copyright (C) 2009 Texas Instruments, Inc.
|
||||
* Thara Gopinath <thara@ti.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
|
||||
#define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
|
||||
|
||||
#define VOLTSCALE_VPFORCEUPDATE 1
|
||||
#define VOLTSCALE_VCBYPASS 2
|
||||
|
||||
/*
|
||||
* OMAP3 GENERIC setup times. Revisit to see if these needs to be
|
||||
* passed from board or PMIC file
|
||||
*/
|
||||
#define OMAP3_CLKSETUP 0xff
|
||||
#define OMAP3_VOLTOFFSET 0xff
|
||||
#define OMAP3_VOLTSETUP2 0xff
|
||||
|
||||
/* Voltage value defines */
|
||||
#define OMAP3430_VDD_MPU_OPP1_UV 975000
|
||||
#define OMAP3430_VDD_MPU_OPP2_UV 1075000
|
||||
#define OMAP3430_VDD_MPU_OPP3_UV 1200000
|
||||
#define OMAP3430_VDD_MPU_OPP4_UV 1270000
|
||||
#define OMAP3430_VDD_MPU_OPP5_UV 1350000
|
||||
|
||||
#define OMAP3430_VDD_CORE_OPP1_UV 975000
|
||||
#define OMAP3430_VDD_CORE_OPP2_UV 1050000
|
||||
#define OMAP3430_VDD_CORE_OPP3_UV 1150000
|
||||
|
||||
#define OMAP3630_VDD_MPU_OPP50_UV 1012500
|
||||
#define OMAP3630_VDD_MPU_OPP100_UV 1200000
|
||||
#define OMAP3630_VDD_MPU_OPP120_UV 1325000
|
||||
#define OMAP3630_VDD_MPU_OPP1G_UV 1375000
|
||||
|
||||
#define OMAP3630_VDD_CORE_OPP50_UV 1000000
|
||||
#define OMAP3630_VDD_CORE_OPP100_UV 1200000
|
||||
|
||||
/**
|
||||
* struct voltagedomain - omap voltage domain global structure.
|
||||
* @name: Name of the voltage domain which can be used as a unique
|
||||
* identifier.
|
||||
*/
|
||||
struct voltagedomain {
|
||||
char *name;
|
||||
};
|
||||
|
||||
/* API to get the voltagedomain pointer */
|
||||
struct voltagedomain *omap_voltage_domain_lookup(char *name);
|
||||
|
||||
/**
|
||||
* struct omap_volt_data - Omap voltage specific data.
|
||||
* @voltage_nominal: The possible voltage value in uV
|
||||
* @sr_efuse_offs: The offset of the efuse register(from system
|
||||
* control module base address) from where to read
|
||||
* the n-target value for the smartreflex module.
|
||||
* @sr_errminlimit: Error min limit value for smartreflex. This value
|
||||
* differs at differnet opp and thus is linked
|
||||
* with voltage.
|
||||
* @vp_errorgain: Error gain value for the voltage processor. This
|
||||
* field also differs according to the voltage/opp.
|
||||
*/
|
||||
struct omap_volt_data {
|
||||
u32 volt_nominal;
|
||||
u32 sr_efuse_offs;
|
||||
u8 sr_errminlimit;
|
||||
u8 vp_errgain;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
|
||||
* @slew_rate: PMIC slew rate (in uv/us)
|
||||
* @step_size: PMIC voltage step size (in uv)
|
||||
* @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
|
||||
* @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
|
||||
*/
|
||||
struct omap_volt_pmic_info {
|
||||
int slew_rate;
|
||||
int step_size;
|
||||
u32 on_volt;
|
||||
u32 onlp_volt;
|
||||
u32 ret_volt;
|
||||
u32 off_volt;
|
||||
u16 volt_setup_time;
|
||||
u8 vp_erroroffset;
|
||||
u8 vp_vstepmin;
|
||||
u8 vp_vstepmax;
|
||||
u8 vp_vddmin;
|
||||
u8 vp_vddmax;
|
||||
u8 vp_timeout_us;
|
||||
u8 i2c_slave_addr;
|
||||
u8 pmic_reg;
|
||||
unsigned long (*vsel_to_uv) (const u8 vsel);
|
||||
u8 (*uv_to_vsel) (unsigned long uV);
|
||||
};
|
||||
|
||||
unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
|
||||
void omap_vp_enable(struct voltagedomain *voltdm);
|
||||
void omap_vp_disable(struct voltagedomain *voltdm);
|
||||
int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
|
||||
unsigned long target_volt);
|
||||
void omap_voltage_reset(struct voltagedomain *voltdm);
|
||||
void omap_voltage_get_volttable(struct voltagedomain *voltdm,
|
||||
struct omap_volt_data **volt_data);
|
||||
struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
|
||||
unsigned long volt);
|
||||
unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
|
||||
struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
|
||||
#ifdef CONFIG_PM
|
||||
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
|
||||
struct omap_volt_pmic_info *pmic_info);
|
||||
void omap_change_voltscale_method(struct voltagedomain *voltdm,
|
||||
int voltscale_method);
|
||||
int omap_voltage_late_init(void);
|
||||
#else
|
||||
static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
|
||||
struct omap_volt_pmic_info *pmic_info) {}
|
||||
static inline void omap_change_voltscale_method(struct voltagedomain *voltdm,
|
||||
int voltscale_method) {}
|
||||
static inline int omap_voltage_late_init(void)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче