Commit 08d1c9a3 authored by Kevin Hilman's avatar Kevin Hilman

OMAP3+: VC: move on/onlp/ret/off command configuration into common init

Configuring the on/onlp/ret/off command values is common to OMAP3 & 4.
Move from OMAP3-only init into common VC init.
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent 5892bb1f
...@@ -157,26 +157,11 @@ static void __init omap3_vfsm_init(struct voltagedomain *voltdm) ...@@ -157,26 +157,11 @@ static void __init omap3_vfsm_init(struct voltagedomain *voltdm)
static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
{ {
struct omap_vc_channel *vc = voltdm->vc;
struct omap_vdd_info *vdd = voltdm->vdd;
static bool is_initialized; static bool is_initialized;
u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
u32 vc_val;
if (is_initialized) if (is_initialized)
return; return;
/* Set up the on, inactive, retention and off voltage */
on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
vc_val = ((on_vsel << vc->common->cmd_on_shift) |
(onlp_vsel << vc->common->cmd_onlp_shift) |
(ret_vsel << vc->common->cmd_ret_shift) |
(off_vsel << vc->common->cmd_off_shift));
voltdm->write(vc_val, vc->cmdval_reg);
/* /*
* Generic VC parameters init * Generic VC parameters init
* XXX This data should be abstracted out * XXX This data should be abstracted out
...@@ -201,8 +186,6 @@ static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) ...@@ -201,8 +186,6 @@ static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
if (is_initialized) if (is_initialized)
return; return;
/* TODO: Configure setup times and CMD_VAL values*/
/* /*
* Generic VC parameters init * Generic VC parameters init
* XXX This data should be abstracted out * XXX This data should be abstracted out
...@@ -223,6 +206,8 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) ...@@ -223,6 +206,8 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
{ {
struct omap_vc_channel *vc = voltdm->vc; struct omap_vc_channel *vc = voltdm->vc;
struct omap_vdd_info *vdd = voltdm->vdd; struct omap_vdd_info *vdd = voltdm->vdd;
u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
u32 val;
if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
pr_err("%s: PMIC info requried to configure vc for" pr_err("%s: PMIC info requried to configure vc for"
...@@ -259,6 +244,17 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) ...@@ -259,6 +244,17 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
vc->common->smps_cmdra_reg); vc->common->smps_cmdra_reg);
/* Set up the on, inactive, retention and off voltage */
on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
val = ((on_vsel << vc->common->cmd_on_shift) |
(onlp_vsel << vc->common->cmd_onlp_shift) |
(ret_vsel << vc->common->cmd_ret_shift) |
(off_vsel << vc->common->cmd_off_shift));
voltdm->write(val, vc->cmdval_reg);
/* Configure the setup times */ /* Configure the setup times */
voltdm->rmw(voltdm->vfsm->voltsetup_mask, voltdm->rmw(voltdm->vfsm->voltsetup_mask,
vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask), vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment