@@ -77,21 +77,26 @@ static struct cpuidle_params omap3_cpuidle_params_table[] = {
{1, 10000, 30000, 300000},
};
-/* FIXME: These are not the optimal setup values to be used on 3430sdp*/
static struct prm_setup_vc omap3_setuptime_table = {
- .clksetup = 0xff,
- .voltsetup_time1 = 0xfff,
- .voltsetup_time2 = 0xfff,
- .voltoffset = 0xff,
- .voltsetup2 = 0xff,
- .vdd0_on = 0x30,
- .vdd0_onlp = 0x20,
- .vdd0_ret = 0x1e,
- .vdd0_off = 0x00,
- .vdd1_on = 0x2c,
+ /* CLK SETUPTIME for RET & OFF */
+ .clksetup_ret = 0x1,
+ .clksetup_off = 0x14A,
+ /* VOLT SETUPTIME for RET & OFF */
+ .voltsetup_time1_ret = 0x005B,
+ .voltsetup_time2_ret = 0x0055,
+ .voltsetup_time1_off = 0x00B3,
+ .voltsetup_time2_off = 0x00A0,
+ .voltoffset = 0x118,
+ .voltsetup2 = 0x32,
+ /* VC COMMAND VALUES for VDD1/VDD2 */
+ .vdd1_on = 0x30,
.vdd1_onlp = 0x20,
.vdd1_ret = 0x1e,
.vdd1_off = 0x00,
+ .vdd2_on = 0x2c,
+ .vdd2_onlp = 0x20,
+ .vdd2_ret = 0x1e,
+ .vdd2_off = 0x00,
};
static int board_keymap[] = {
@@ -25,6 +25,29 @@
#include "mux.h"
#include "sdram-hynix-h8mbx00u0mer-0em.h"
+#include "pm.h"
+
+static struct prm_setup_vc omap3_setuptime_table = {
+ /* CLK SETUPTIME for RET & OFF */
+ .clksetup_ret = 0x1,
+ .clksetup_off = 0x14A,
+ /* VOLT SETUPTIME for RET & OFF */
+ .voltsetup_time1_ret = 0x005B,
+ .voltsetup_time2_ret = 0x0055,
+ .voltsetup_time1_off = 0x00B3,
+ .voltsetup_time2_off = 0x00A0,
+ .voltoffset = 0x118,
+ .voltsetup2 = 0x32,
+ /* VC COMMAND VALUES for VDD1/VDD2 */
+ .vdd1_on = 0x28, /* 1.1v */
+ .vdd1_onlp = 0x20, /* 1.0v */
+ .vdd1_ret = 0x13, /* 0.83v */
+ .vdd1_off = 0x00, /* 0.6v */
+ .vdd2_on = 0x2B, /* 1.1375v */
+ .vdd2_onlp = 0x20, /* 1.0v */
+ .vdd2_ret = 0x14, /* 0.85v */
+ .vdd2_off = 0x00, /* 0.6v */
+};
#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
@@ -97,7 +120,7 @@ static struct omap_board_mux board_mux[] __initdata = {
static void __init omap_sdp_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
- zoom_peripherals_init();
+ zoom_peripherals_init(&omap3_setuptime_table);
board_smc91x_init();
enable_board_wakeup_source();
usb_ehci_init(&ehci_pdata);
@@ -26,6 +26,8 @@
#include "mux.h"
#include "hsmmc.h"
+#include "pm.h"
+#include "voltage.h"
/* Zoom2 has Qwerty keyboard*/
static int board_keymap[] = {
@@ -277,8 +279,12 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
}
-void __init zoom_peripherals_init(void)
+void __init zoom_peripherals_init(void *peripheral_data)
{
+ struct prm_setup_vc *omap3_setuptime =
+ (struct prm_setup_vc *)peripheral_data;
+
+ omap_voltage_init_vc(omap3_setuptime);
omap_i2c_init();
omap_serial_init();
usb_musb_init(&musb_board_data);
@@ -26,6 +26,29 @@
#include "mux.h"
#include "sdram-micron-mt46h32m32lf-6.h"
#include "omap3-opp.h"
+#include "pm.h"
+
+static struct prm_setup_vc omap3_setuptime_table = {
+ /* CLK SETUPTIME for RET & OFF */
+ .clksetup_ret = 0x1,
+ .clksetup_off = 0x14A,
+ /* VOLT SETUPTIME for RET & OFF */
+ .voltsetup_time1_ret = 0x005B,
+ .voltsetup_time2_ret = 0x0055,
+ .voltsetup_time1_off = 0x00B3,
+ .voltsetup_time2_off = 0x00A0,
+ .voltoffset = 0x118,
+ .voltsetup2 = 0x32,
+ /* VC COMMAND VALUES for VDD1/VDD2 */
+ .vdd1_on = 0x30,
+ .vdd1_onlp = 0x20,
+ .vdd1_ret = 0x1e,
+ .vdd1_off = 0x00,
+ .vdd2_on = 0x2c,
+ .vdd2_onlp = 0x20,
+ .vdd2_ret = 0x1e,
+ .vdd2_off = 0x00,
+};
static void __init omap_zoom2_init_irq(void)
{
@@ -82,7 +105,7 @@ static struct omap_board_mux board_mux[] __initdata = {
static void __init omap_zoom2_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
- zoom_peripherals_init();
+ zoom_peripherals_init(&omap3_setuptime_table);
zoom_debugboard_init();
}
@@ -24,6 +24,29 @@
#include "mux.h"
#include "sdram-hynix-h8mbx00u0mer-0em.h"
+#include "pm.h"
+
+static struct prm_setup_vc omap3_setuptime_table = {
+ /* CLK SETUPTIME for RET & OFF */
+ .clksetup_ret = 0x1,
+ .clksetup_off = 0x14A,
+ /* VOLT SETUPTIME for RET & OFF */
+ .voltsetup_time1_ret = 0x005B,
+ .voltsetup_time2_ret = 0x0055,
+ .voltsetup_time1_off = 0x00B3,
+ .voltsetup_time2_off = 0x00A0,
+ .voltoffset = 0x118,
+ .voltsetup2 = 0x32,
+ /* VC COMMAND VALUES for VDD1/VDD2 */
+ .vdd1_on = 0x28, /* 1.1v */
+ .vdd1_onlp = 0x20, /* 1.0v */
+ .vdd1_ret = 0x13, /* 0.83v */
+ .vdd1_off = 0x00, /* 0.6v */
+ .vdd2_on = 0x2B, /* 1.1375v */
+ .vdd2_onlp = 0x20, /* 1.0v */
+ .vdd2_ret = 0x14, /* 0.85v */
+ .vdd2_off = 0x00, /* 0.6v */
+};
static void __init omap_zoom_map_io(void)
{
@@ -66,7 +89,7 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
static void __init omap_zoom_init(void)
{
omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
- zoom_peripherals_init();
+ zoom_peripherals_init(&omap3_setuptime_table);
zoom_debugboard_init();
omap_mux_init_gpio(64, OMAP_PIN_OUTPUT);
@@ -2,4 +2,4 @@
* Defines for zoom boards
*/
extern int __init zoom_debugboard_init(void);
-extern void __init zoom_peripherals_init(void);
+extern void __init zoom_peripherals_init(void *);
@@ -41,21 +41,26 @@ inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
#endif
struct prm_setup_vc {
- u16 clksetup;
- u16 voltsetup_time1;
- u16 voltsetup_time2;
+/* CLK SETUPTIME for RET & OFF */
+ u16 clksetup_ret;
+ u16 clksetup_off;
+/* VOLT SETUPTIME for RET & OFF */
+ u16 voltsetup_time1_ret;
+ u16 voltsetup_time2_ret;
+ u16 voltsetup_time1_off;
+ u16 voltsetup_time2_off;
u16 voltoffset;
u16 voltsetup2;
/* PRM_VC_CMD_VAL_0 specific bits */
- u16 vdd0_on;
- u16 vdd0_onlp;
- u16 vdd0_ret;
- u16 vdd0_off;
-/* PRM_VC_CMD_VAL_1 specific bits */
u16 vdd1_on;
u16 vdd1_onlp;
u16 vdd1_ret;
u16 vdd1_off;
+/* PRM_VC_CMD_VAL_1 specific bits */
+ u16 vdd2_on;
+ u16 vdd2_onlp;
+ u16 vdd2_ret;
+ u16 vdd2_off;
};
extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
@@ -359,6 +359,7 @@ void omap_sram_idle(void)
int core_prev_state, per_prev_state;
u32 sdrc_pwr = 0;
int per_state_modified = 0;
+ u32 voltctrl = 0;
if (!_omap_sram_idle)
return;
@@ -423,20 +424,25 @@ void omap_sram_idle(void)
omap_uart_prepare_idle(0);
omap_uart_prepare_idle(1);
if (core_next_state == PWRDM_POWER_OFF) {
- u32 voltctrl = OMAP3430_AUTO_OFF;
+ voltctrl = OMAP3430_AUTO_OFF;
if (voltage_off_while_idle)
voltctrl |= OMAP3430_SEL_OFF;
prm_set_mod_reg_bits(voltctrl,
OMAP3430_GR_MOD,
OMAP3_PRM_VOLTCTRL_OFFSET);
- omap3_core_save_context();
- omap3_prcm_save_context();
} else if (core_next_state == PWRDM_POWER_RET) {
prm_set_mod_reg_bits(OMAP3430_AUTO_RET,
OMAP3430_GR_MOD,
OMAP3_PRM_VOLTCTRL_OFFSET);
}
+ /* Update the voltsetup time for RET/OFF */
+ update_voltsetup_time(core_next_state);
+
+ if (core_next_state == PWRDM_POWER_OFF) {
+ omap3_core_save_context();
+ omap3_prcm_save_context();
+ }
/* Enable IO-PAD and IO-CHAIN wakeups */
prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
omap3_enable_io_chain();
@@ -496,7 +502,7 @@ void omap_sram_idle(void)
omap_uart_resume_idle(0);
omap_uart_resume_idle(1);
if (core_next_state == PWRDM_POWER_OFF) {
- u32 voltctrl = OMAP3430_AUTO_OFF;
+ voltctrl = OMAP3430_AUTO_OFF;
if (voltage_off_while_idle)
voltctrl |= OMAP3430_SEL_OFF;
@@ -73,19 +73,25 @@ struct vc_reg_info {
* Default voltage controller settings for OMAP3
*/
static struct prm_setup_vc vc_config = {
- .clksetup = 0xff,
- .voltsetup_time1 = 0xfff,
- .voltsetup_time2 = 0xfff,
+ /* CLK SETUPTIME for RET & OFF */
+ .clksetup_ret = 0xff,
+ .clksetup_off = 0xff,
+ /* VOLT SETUPTIME for RET & OFF */
+ .voltsetup_time1_ret = 0xfff,
+ .voltsetup_time2_ret = 0xfff,
+ .voltsetup_time1_off = 0xfff,
+ .voltsetup_time2_off = 0xfff,
.voltoffset = 0xff,
.voltsetup2 = 0xff,
- .vdd0_on = 0x30, /* 1.2v */
- .vdd0_onlp = 0x20, /* 1.0v */
- .vdd0_ret = 0x1e, /* 0.975v */
- .vdd0_off = 0x00, /* 0.6v */
- .vdd1_on = 0x2c, /* 1.15v */
+ /* VC COMMAND VALUES for VDD1/VDD2 */
+ .vdd1_on = 0x30, /* 1.2v */
.vdd1_onlp = 0x20, /* 1.0v */
- .vdd1_ret = 0x1e, /* .975v */
+ .vdd1_ret = 0x1e, /* 0.975v */
.vdd1_off = 0x00, /* 0.6v */
+ .vdd2_on = 0x2c, /* 1.15v */
+ .vdd2_onlp = 0x20, /* 1.0v */
+ .vdd2_ret = 0x1e, /* .975v */
+ .vdd2_off = 0x00, /* 0.6v */
};
static inline u32 voltage_read_reg(void __iomem *offset)
@@ -149,26 +155,26 @@ static void __init init_voltagecontroller(void)
VC_VOLRA0_SHIFT));
voltage_write_reg(vc_reg.vc_cmdval0_reg,
- (vc_config.vdd0_on << VC_CMD_ON_SHIFT) |
- (vc_config.vdd0_onlp << VC_CMD_ONLP_SHIFT) |
- (vc_config.vdd0_ret << VC_CMD_RET_SHIFT) |
- (vc_config.vdd0_off << VC_CMD_OFF_SHIFT));
-
- voltage_write_reg(vc_reg.vc_cmdval1_reg,
(vc_config.vdd1_on << VC_CMD_ON_SHIFT) |
(vc_config.vdd1_onlp << VC_CMD_ONLP_SHIFT) |
(vc_config.vdd1_ret << VC_CMD_RET_SHIFT) |
(vc_config.vdd1_off << VC_CMD_OFF_SHIFT));
+ voltage_write_reg(vc_reg.vc_cmdval1_reg,
+ (vc_config.vdd2_on << VC_CMD_ON_SHIFT) |
+ (vc_config.vdd2_onlp << VC_CMD_ONLP_SHIFT) |
+ (vc_config.vdd2_ret << VC_CMD_RET_SHIFT) |
+ (vc_config.vdd2_off << VC_CMD_OFF_SHIFT));
+
voltage_write_reg(vc_ch_conf_reg, VC_CMD1 | VC_RAV1);
voltage_write_reg(vc_i2c_cfg_reg, VC_MCODE_SHIFT | VC_HSEN);
/* Write setup times */
- voltage_write_reg(prm_clksetup_reg, vc_config.clksetup);
+ voltage_write_reg(prm_clksetup_reg, vc_config.clksetup_ret);
voltage_write_reg(prm_voltsetup1_reg,
- (vc_config.voltsetup_time2 << VC_SETUP_TIME2_SHIFT) |
- (vc_config.voltsetup_time1 << VC_SETUP_TIME1_SHIFT));
+ (vc_config.voltsetup_time2_ret << VC_SETUP_TIME2_SHIFT) |
+ (vc_config.voltsetup_time1_ret << VC_SETUP_TIME1_SHIFT));
voltage_write_reg(prm_voltoffset_reg, vc_config.voltoffset);
voltage_write_reg(prm_voltsetup2_reg, vc_config.voltsetup2);
@@ -497,19 +503,57 @@ void __init omap_voltage_init_vc(struct prm_setup_vc *setup_vc)
if (!setup_vc)
return;
- vc_config.clksetup = setup_vc->clksetup;
- vc_config.voltsetup_time1 = setup_vc->voltsetup_time1;
- vc_config.voltsetup_time2 = setup_vc->voltsetup_time2;
+ /* CLK SETUPTIME for RET & OFF */
+ vc_config.clksetup_ret = setup_vc->clksetup_ret;
+ vc_config.clksetup_off = setup_vc->clksetup_off;
+ /* VOLT SETUPTIME for RET & OFF */
+ vc_config.voltsetup_time1_ret = setup_vc->voltsetup_time1_ret;
+ vc_config.voltsetup_time2_ret = setup_vc->voltsetup_time2_ret;
+ vc_config.voltsetup_time1_off = setup_vc->voltsetup_time1_off;
+ vc_config.voltsetup_time2_off = setup_vc->voltsetup_time2_off;
vc_config.voltoffset = setup_vc->voltoffset;
vc_config.voltsetup2 = setup_vc->voltsetup2;
- vc_config.vdd0_on = setup_vc->vdd0_on;
- vc_config.vdd0_onlp = setup_vc->vdd0_onlp;
- vc_config.vdd0_ret = setup_vc->vdd0_ret;
- vc_config.vdd0_off = setup_vc->vdd0_off;
+
+ /* VC COMMAND VALUES for VDD1/VDD2 */
vc_config.vdd1_on = setup_vc->vdd1_on;
vc_config.vdd1_onlp = setup_vc->vdd1_onlp;
vc_config.vdd1_ret = setup_vc->vdd1_ret;
vc_config.vdd1_off = setup_vc->vdd1_off;
+ vc_config.vdd2_on = setup_vc->vdd2_on;
+ vc_config.vdd2_onlp = setup_vc->vdd2_onlp;
+ vc_config.vdd2_ret = setup_vc->vdd2_ret;
+ vc_config.vdd2_off = setup_vc->vdd2_off;
+}
+
+void update_voltsetup_time(int core_next_state)
+{
+ /* update voltsetup time */
+ if (core_next_state == PWRDM_POWER_OFF) {
+ prm_write_mod_reg(vc_config.clksetup_off, OMAP3430_GR_MOD,
+ OMAP3_PRM_CLKSETUP_OFFSET);
+ prm_write_mod_reg((vc_config.voltsetup_time2_off <<
+ OMAP3430_SETUP_TIME2_SHIFT) |
+ (vc_config.voltsetup_time1_off <<
+ OMAP3430_SETUP_TIME1_SHIFT),
+ OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET);
+
+ if (voltage_off_while_idle)
+ prm_write_mod_reg(vc_config.voltsetup2, OMAP3430_GR_MOD,
+ OMAP3_PRM_VOLTSETUP2_OFFSET);
+
+ } else if (core_next_state == PWRDM_POWER_RET) {
+ prm_write_mod_reg(vc_config.clksetup_ret, OMAP3430_GR_MOD,
+ OMAP3_PRM_CLKSETUP_OFFSET);
+ prm_write_mod_reg((vc_config.voltsetup_time2_ret <<
+ OMAP3430_SETUP_TIME2_SHIFT) |
+ (vc_config.voltsetup_time1_ret <<
+ OMAP3430_SETUP_TIME1_SHIFT),
+ OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET);
+
+ /* clear voltsetup2_reg if sys_off not enabled */
+ prm_write_mod_reg(0x0, OMAP3430_GR_MOD,
+ OMAP3_PRM_VOLTSETUP2_OFFSET);
+ }
}
/**
@@ -73,6 +73,7 @@ extern int get_vdd2_opp(void);
void omap_voltageprocessor_enable(int vp_id);
void omap_voltageprocessor_disable(int vp_id);
void omap_voltage_init_vc(struct prm_setup_vc *setup_vc);
+void update_voltsetup_time(int core_next_state);
void omap_voltage_init(void);
int omap_voltage_scale(int vdd, u8 target_vsel, u8 current_vsel);
void omap_reset_voltage(int vdd);