2 * OMAP3/OMAP4 Voltage Management Routines
4 * Author: Thara Gopinath <thara@ti.com>
6 * Copyright (C) 2007 Texas Instruments, Inc.
7 * Rajendra Nayak <rnayak@ti.com>
8 * Lesly A M <x0080970@ti.com>
10 * Copyright (C) 2008 Nokia Corporation
13 * Copyright (C) 2010 Texas Instruments, Inc.
14 * Thara Gopinath <thara@ti.com>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
20 #include <linux/kernel.h>
21 #include <linux/err.h>
22 #include <linux/init.h>
23 #include <linux/clk.h>
25 #include <plat/common.h>
27 #include "prm-regbits-44xx.h"
30 #include "prminst44xx.h"
32 #include "omap_opp_data.h"
37 static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm
= {
38 .voltsetup_reg
= OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET
,
39 .voltsetup_mask
= OMAP4430_RAMP_DOWN_PRESCAL_MASK
|
40 OMAP4430_RAMP_DOWN_COUNT_MASK
|
41 OMAP4430_RAMP_UP_PRESCAL_MASK
|
42 OMAP4430_RAMP_UP_COUNT_MASK
,
43 .voltsetupoff_reg
= OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET
,
46 static struct omap_vdd_info omap4_vdd_mpu_info
;
48 static const struct omap_vfsm_instance omap4_vdd_iva_vfsm
= {
49 .voltsetup_reg
= OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET
,
50 .voltsetup_mask
= OMAP4430_RAMP_DOWN_PRESCAL_MASK
|
51 OMAP4430_RAMP_DOWN_COUNT_MASK
|
52 OMAP4430_RAMP_UP_PRESCAL_MASK
|
53 OMAP4430_RAMP_UP_COUNT_MASK
,
54 .voltsetupoff_reg
= OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET
,
57 static struct omap_vdd_info omap4_vdd_iva_info
;
59 static const struct omap_vfsm_instance omap4_vdd_core_vfsm
= {
60 .voltsetup_reg
= OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET
,
61 .voltsetup_mask
= OMAP4430_RAMP_DOWN_PRESCAL_MASK
|
62 OMAP4430_RAMP_DOWN_COUNT_MASK
|
63 OMAP4430_RAMP_UP_PRESCAL_MASK
|
64 OMAP4430_RAMP_UP_COUNT_MASK
,
65 .voltsetupoff_reg
= OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET
,
68 static struct omap_vdd_info omap4_vdd_core_info
;
70 static struct voltagedomain omap4_voltdm_mpu
= {
73 .read
= omap4_prm_vcvp_read
,
74 .write
= omap4_prm_vcvp_write
,
75 .rmw
= omap4_prm_vcvp_rmw
,
77 .vfsm
= &omap4_vdd_mpu_vfsm
,
79 .vdd
= &omap4_vdd_mpu_info
,
80 .abb
= &omap4_ldo_abb_mpu_instance
,
83 static struct voltagedomain omap4_voltdm_iva
= {
86 .read
= omap4_prm_vcvp_read
,
87 .write
= omap4_prm_vcvp_write
,
88 .rmw
= omap4_prm_vcvp_rmw
,
90 .vfsm
= &omap4_vdd_iva_vfsm
,
92 .vdd
= &omap4_vdd_iva_info
,
93 .abb
= &omap4_ldo_abb_iva_instance
,
96 static struct voltagedomain omap4_voltdm_core
= {
99 .read
= omap4_prm_vcvp_read
,
100 .write
= omap4_prm_vcvp_write
,
101 .rmw
= omap4_prm_vcvp_rmw
,
102 .vc
= &omap4_vc_core
,
103 .vfsm
= &omap4_vdd_core_vfsm
,
104 .vp
= &omap4_vp_core
,
105 .vdd
= &omap4_vdd_core_info
,
108 static struct voltagedomain omap4_voltdm_wkup
= {
112 static struct voltagedomain
*voltagedomains_omap4
[] __initdata
= {
121 * Handle Mutant pre_scalar to sysclk cycles map:
122 * Due to "Errata Id: i623: Retention/Sleep Voltage Transitions Ramp Time"
123 * on OMAP4430 specifically, the maps is 64, 256, 512, 2048 cycles.
124 * Handle this condition dynamically from version detection logic
126 static u16 pre_scaler_to_sysclk_cycles_443x
[] = {64, 256, 512, 2048};
128 static const char *sys_clk_name __initdata
= "sys_clkin_ck";
130 void __init
omap44xx_voltagedomains_init(void)
132 struct voltagedomain
*voltdm
;
136 * XXX Will depend on the process, validation, and binning
137 * for the currently-running IC
139 if (cpu_is_omap443x()) {
140 struct setup_time_ramp_params
*params
=
141 omap4_vc_core
.common
->setup_time_params
;
144 params
->pre_scaler_to_sysclk_cycles
=
145 pre_scaler_to_sysclk_cycles_443x
;
147 omap4_vdd_mpu_info
.volt_data
= omap443x_vdd_mpu_volt_data
;
148 omap4_vdd_iva_info
.volt_data
= omap443x_vdd_iva_volt_data
;
149 omap4_vdd_core_info
.volt_data
= omap443x_vdd_core_volt_data
;
150 omap4_vdd_mpu_info
.dep_vdd_info
= omap443x_vddmpu_dep_info
;
151 omap4_vdd_iva_info
.dep_vdd_info
= omap443x_vddiva_dep_info
;
152 } else if (cpu_is_omap446x()) {
153 omap4_vdd_mpu_info
.volt_data
= omap446x_vdd_mpu_volt_data
;
154 omap4_vdd_iva_info
.volt_data
= omap446x_vdd_iva_volt_data
;
155 omap4_vdd_core_info
.volt_data
= omap446x_vdd_core_volt_data
;
156 omap4_vdd_mpu_info
.dep_vdd_info
= omap446x_vddmpu_dep_info
;
157 omap4_vdd_iva_info
.dep_vdd_info
= omap446x_vddiva_dep_info
;
162 for (i
= 0; voltdm
= voltagedomains_omap4
[i
], voltdm
; i
++)
163 voltdm
->sys_clk
.name
= sys_clk_name
;
165 voltdm_init(voltagedomains_omap4
);