From: Kevin Hilman <khilman@ti.com> To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/12] OMAP3+: VP: combine setting init voltage into common function Date: Mon, 29 Aug 2011 10:58:12 -0700 [thread overview] Message-ID: <1314640692-3386-13-git-send-email-khilman@ti.com> (raw) In-Reply-To: <1314640692-3386-1-git-send-email-khilman@ti.com> combine VPCONFIG init voltage setup into common function and use from both vp_enable and from vp_forceupdate_scale(). NOTE: this patch changes the sequence of when the initVDD bit is cleared. The bit is now cleared immediately after it was written. Since only the rising edge of this bit has any affect according to the TRM, the exact timing of clearing of this bit should not have any effect. Signed-off-by: Kevin Hilman <khilman@ti.com> --- arch/arm/mach-omap2/vp.c | 58 +++++++++++++++------------------------------- 1 files changed, 19 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index 24020ea..66bd700 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c @@ -9,31 +9,18 @@ #include "prm-regbits-44xx.h" #include "prm44xx.h" -static void vp_latch_vsel(struct voltagedomain *voltdm) +static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt) { struct omap_vp_instance *vp = voltdm->vp; u32 vpconfig; - unsigned long uvdc; char vsel; - uvdc = omap_voltage_get_nom_volt(voltdm); - if (!uvdc) { - pr_warning("%s: unable to find current voltage for vdd_%s\n", - __func__, voltdm->name); - return; - } - - if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) { - pr_warning("%s: PMIC function to convert voltage in uV to" - " vsel not registered\n", __func__); - return; - } - - vsel = voltdm->pmic->uv_to_vsel(uvdc); + vsel = voltdm->pmic->uv_to_vsel(volt); vpconfig = voltdm->read(vp->vpconfig); vpconfig &= ~(vp->common->vpconfig_initvoltage_mask | - vp->common->vpconfig_initvdd); + vp->common->vpconfig_forceupdate | + vp->common->vpconfig_initvdd); vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask); voltdm->write(vpconfig, vp->vpconfig); @@ -43,6 +30,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm) /* Clear initVDD copy trigger bit */ voltdm->write(vpconfig, vp->vpconfig); + + return vpconfig; } /* Generic voltage init functions */ @@ -149,22 +138,11 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, return -ETIMEDOUT; } - /* Configure for VP-Force Update */ - vpconfig = voltdm->read(vp->vpconfig); - vpconfig &= ~(vp->common->vpconfig_initvdd | - vp->common->vpconfig_forceupdate | - vp->common->vpconfig_initvoltage_mask); - vpconfig |= ((target_vsel << - __ffs(vp->common->vpconfig_initvoltage_mask))); - voltdm->write(vpconfig, vp->vpconfig); - - /* Trigger initVDD value copy to voltage processor */ - vpconfig |= vp->common->vpconfig_initvdd; - voltdm->write(vpconfig, vp->vpconfig); + vpconfig = _vp_set_init_voltage(voltdm, target_volt); /* Force update of voltage */ - vpconfig |= vp->common->vpconfig_forceupdate; - voltdm->write(vpconfig, vp->vpconfig); + voltdm->write(vpconfig | vp->common->vpconfig_forceupdate, + voltdm->vp->vpconfig); /* * Wait for TransactionDone. Typical latency is <200us. @@ -197,12 +175,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, "to clear the TRANXDONE status\n", __func__, voltdm->name); - vpconfig = voltdm->read(vp->vpconfig); - /* Clear initVDD copy trigger bit */ - vpconfig &= ~vp->common->vpconfig_initvdd; - voltdm->write(vpconfig, vp->vpconfig); /* Clear force bit */ - vpconfig &= ~vp->common->vpconfig_forceupdate; voltdm->write(vpconfig, vp->vpconfig); return 0; @@ -218,7 +191,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, void omap_vp_enable(struct voltagedomain *voltdm) { struct omap_vp_instance *vp; - u32 vpconfig; + u32 vpconfig, volt; if (!voltdm || IS_ERR(voltdm)) { pr_warning("%s: VDD specified does not exist!\n", __func__); @@ -236,12 +209,19 @@ void omap_vp_enable(struct voltagedomain *voltdm) if (vp->enabled) return; - vp_latch_vsel(voltdm); + volt = voltdm_get_voltage(voltdm); + if (!volt) { + pr_warning("%s: unable to find current voltage for %s\n", + __func__, voltdm->name); + return; + } + + vpconfig = _vp_set_init_voltage(voltdm, volt); /* Enable VP */ - vpconfig = voltdm->read(vp->vpconfig); vpconfig |= vp->common->vpconfig_vpenable; voltdm->write(vpconfig, vp->vpconfig); + vp->enabled = true; } -- 1.7.6
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/12] OMAP3+: VP: combine setting init voltage into common function Date: Mon, 29 Aug 2011 10:58:12 -0700 [thread overview] Message-ID: <1314640692-3386-13-git-send-email-khilman@ti.com> (raw) In-Reply-To: <1314640692-3386-1-git-send-email-khilman@ti.com> combine VPCONFIG init voltage setup into common function and use from both vp_enable and from vp_forceupdate_scale(). NOTE: this patch changes the sequence of when the initVDD bit is cleared. The bit is now cleared immediately after it was written. Since only the rising edge of this bit has any affect according to the TRM, the exact timing of clearing of this bit should not have any effect. Signed-off-by: Kevin Hilman <khilman@ti.com> --- arch/arm/mach-omap2/vp.c | 58 +++++++++++++++------------------------------- 1 files changed, 19 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index 24020ea..66bd700 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c @@ -9,31 +9,18 @@ #include "prm-regbits-44xx.h" #include "prm44xx.h" -static void vp_latch_vsel(struct voltagedomain *voltdm) +static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt) { struct omap_vp_instance *vp = voltdm->vp; u32 vpconfig; - unsigned long uvdc; char vsel; - uvdc = omap_voltage_get_nom_volt(voltdm); - if (!uvdc) { - pr_warning("%s: unable to find current voltage for vdd_%s\n", - __func__, voltdm->name); - return; - } - - if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) { - pr_warning("%s: PMIC function to convert voltage in uV to" - " vsel not registered\n", __func__); - return; - } - - vsel = voltdm->pmic->uv_to_vsel(uvdc); + vsel = voltdm->pmic->uv_to_vsel(volt); vpconfig = voltdm->read(vp->vpconfig); vpconfig &= ~(vp->common->vpconfig_initvoltage_mask | - vp->common->vpconfig_initvdd); + vp->common->vpconfig_forceupdate | + vp->common->vpconfig_initvdd); vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask); voltdm->write(vpconfig, vp->vpconfig); @@ -43,6 +30,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm) /* Clear initVDD copy trigger bit */ voltdm->write(vpconfig, vp->vpconfig); + + return vpconfig; } /* Generic voltage init functions */ @@ -149,22 +138,11 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, return -ETIMEDOUT; } - /* Configure for VP-Force Update */ - vpconfig = voltdm->read(vp->vpconfig); - vpconfig &= ~(vp->common->vpconfig_initvdd | - vp->common->vpconfig_forceupdate | - vp->common->vpconfig_initvoltage_mask); - vpconfig |= ((target_vsel << - __ffs(vp->common->vpconfig_initvoltage_mask))); - voltdm->write(vpconfig, vp->vpconfig); - - /* Trigger initVDD value copy to voltage processor */ - vpconfig |= vp->common->vpconfig_initvdd; - voltdm->write(vpconfig, vp->vpconfig); + vpconfig = _vp_set_init_voltage(voltdm, target_volt); /* Force update of voltage */ - vpconfig |= vp->common->vpconfig_forceupdate; - voltdm->write(vpconfig, vp->vpconfig); + voltdm->write(vpconfig | vp->common->vpconfig_forceupdate, + voltdm->vp->vpconfig); /* * Wait for TransactionDone. Typical latency is <200us. @@ -197,12 +175,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, "to clear the TRANXDONE status\n", __func__, voltdm->name); - vpconfig = voltdm->read(vp->vpconfig); - /* Clear initVDD copy trigger bit */ - vpconfig &= ~vp->common->vpconfig_initvdd; - voltdm->write(vpconfig, vp->vpconfig); /* Clear force bit */ - vpconfig &= ~vp->common->vpconfig_forceupdate; voltdm->write(vpconfig, vp->vpconfig); return 0; @@ -218,7 +191,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, void omap_vp_enable(struct voltagedomain *voltdm) { struct omap_vp_instance *vp; - u32 vpconfig; + u32 vpconfig, volt; if (!voltdm || IS_ERR(voltdm)) { pr_warning("%s: VDD specified does not exist!\n", __func__); @@ -236,12 +209,19 @@ void omap_vp_enable(struct voltagedomain *voltdm) if (vp->enabled) return; - vp_latch_vsel(voltdm); + volt = voltdm_get_voltage(voltdm); + if (!volt) { + pr_warning("%s: unable to find current voltage for %s\n", + __func__, voltdm->name); + return; + } + + vpconfig = _vp_set_init_voltage(voltdm, volt); /* Enable VP */ - vpconfig = voltdm->read(vp->vpconfig); vpconfig |= vp->common->vpconfig_vpenable; voltdm->write(vpconfig, vp->vpconfig); + vp->enabled = true; } -- 1.7.6
next prev parent reply other threads:[~2011-08-29 17:58 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-29 17:58 [PATCH 00/12] OMAP: voltage cleanup part C: VP cleanup Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 01/12] OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renames Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 02/12] OMAP3+: voltage: remove unneeded debugfs interface Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 03/12] OMAP3+: VP: struct omap_vp_common: replace shift with __ffs(mask) Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 04/12] OMAP3+: VP: move SoC-specific sys clock rate retreival late init Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 05/12] OMAP3+: VP: move timing calculation/config into VP init Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 06/12] OMAP3+: VP: create VP helper function for updating error gain Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 07/12] OMAP3+: VP: remove omap_vp_runtime_data Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 08/12] OMAP3+: VP: move voltage scale function pointer into struct voltagedomain Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 09/12] OMAP: VP: Explicitly mask VPVOLTAGE field Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-09-07 12:31 ` Jean Pihet 2011-09-07 12:31 ` Jean Pihet 2011-08-29 17:58 ` [PATCH 10/12] OMAP3+: VP: update_errorgain(): return error if VP Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` [PATCH 11/12] OMAP3+: VP: remove unused omap_vp_get_curr_volt() Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman 2011-08-29 17:58 ` Kevin Hilman [this message] 2011-08-29 17:58 ` [PATCH 12/12] OMAP3+: VP: combine setting init voltage into common function Kevin Hilman 2011-09-07 19:11 ` [PATCH 00/12] OMAP: voltage cleanup part C: VP cleanup Jean Pihet 2011-09-07 19:11 ` Jean Pihet
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1314640692-3386-13-git-send-email-khilman@ti.com \ --to=khilman@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.