From patchwork Fri May 27 03:03:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 822622 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4R33sVo013153 for ; Fri, 27 May 2011 03:03:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758643Ab1E0DDx (ORCPT ); Thu, 26 May 2011 23:03:53 -0400 Received: from smtp-out.google.com ([74.125.121.67]:30666 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753074Ab1E0DDx (ORCPT ); Thu, 26 May 2011 23:03:53 -0400 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id p4R33mej002357; Thu, 26 May 2011 20:03:48 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1306465428; bh=y2Nycv/u8ASg7BDlRxYVJo6WPfI=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=IOfiVgWP7IAcmSz17NbVTVxvv3V/27AgfS3qfJUCJ3FZPdwogv/SYYEfrLLoasnVT IFPJPR6f9scIoTELXziEw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=date:from:to:subject:message-id:mime-version:content-type: content-disposition:user-agent:x-system-of-record; b=bMlzN/e1E6Lq2DrXyHrxDChAIog/pVo20hXriQtA4Zq6REe+S2oLSzeM5Bt2BZrQ1 ZDsNzcoTC9fBBLFsOx/sg== Received: from conslugarocko.mtv.corp.google.com (conslugarocko.mtv.corp.google.com [172.18.102.26]) by wpaz5.hot.corp.google.com with ESMTP id p4R33kWb017782; Thu, 26 May 2011 20:03:46 -0700 Received: by conslugarocko.mtv.corp.google.com (Postfix, from userid 115684) id 49CF823424B; Thu, 26 May 2011 20:03:46 -0700 (PDT) Date: Thu, 26 May 2011 20:03:46 -0700 From: Todd Poynor To: Kevin Hilman , linux-omap@vger.kernel.org Subject: [PATCH pm_wip/voltdm_nm] ARM: OMAP: Explicitly mask VPVOLTAGE field Message-ID: <20110527030346.GA2720@google.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-System-Of-Record: true Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 27 May 2011 03:03:56 +0000 (UTC) Reading the VPVOLTAGE field of PRM_VP_*_VOLTAGE registers currently relies on a u32 -> u8 conversion to mask off the FORCEUPDATEWAIT field in the upper bits. Make this explicit using the mask and shift symbols already defined, added as new fields in struct omap_vp_common. Signed-off-by: Todd Poynor --- arch/arm/mach-omap2/vp.c | 3 ++- arch/arm/mach-omap2/vp.h | 4 ++++ arch/arm/mach-omap2/vp3xxx_data.c | 3 +++ arch/arm/mach-omap2/vp44xx_data.c | 2 ++ 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index e7d38f6..c3b7fde 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c @@ -227,7 +227,8 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) return 0; } - curr_vsel = voltdm->read(vp->voltage); + curr_vsel = (voltdm->read(vp->voltage) & vp->common->vpvoltage_mask) + >> vp->common->vpvoltage_shift; if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) { pr_warning("%s: PMIC function to convert vsel to voltage" diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h index 0d63267..cb62a7b 100644 --- a/arch/arm/mach-omap2/vp.h +++ b/arch/arm/mach-omap2/vp.h @@ -63,6 +63,8 @@ struct omap_vp_ops { * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg + * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg + * @vpvoltage_shift: VPVOLTAGE field shift in PRM_VP*_VOLTAGE reg */ struct omap_vp_common { u32 vpconfig_erroroffset_mask; @@ -79,6 +81,8 @@ struct omap_vp_common { u8 vlimitto_vddmin_shift; u8 vlimitto_vddmax_shift; u8 vlimitto_timeout_shift; + u8 vpvoltage_mask; + u8 vpvoltage_shift; const struct omap_vp_ops *ops; }; diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c index d429c44..0b149e0 100644 --- a/arch/arm/mach-omap2/vp3xxx_data.c +++ b/arch/arm/mach-omap2/vp3xxx_data.c @@ -51,6 +51,9 @@ static const struct omap_vp_common omap3_vp_common = { .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT, .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT, .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT, + .vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK, + .vpvoltage_shift = OMAP3430_VPVOLTAGE_SHIFT, + .ops = &omap3_vp_ops, }; diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c index 0daf2a4..174d6f7 100644 --- a/arch/arm/mach-omap2/vp44xx_data.c +++ b/arch/arm/mach-omap2/vp44xx_data.c @@ -51,6 +51,8 @@ static const struct omap_vp_common omap4_vp_common = { .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT, .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT, .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT, + .vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK, + .vpvoltage_shift = OMAP4430_VPVOLTAGE_SHIFT, .ops = &omap4_vp_ops, };