From: Kevin Hilman <khilman@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>
Subject: Re: [PM-WIP/voltdm_c][PATCH 04/11] OMAP4: PM: VC: support configuration of i2c clks
Date: Wed, 18 May 2011 10:53:34 +0200 [thread overview]
Message-ID: <87y624xucx.fsf@ti.com> (raw)
In-Reply-To: <1305695854-9638-5-git-send-email-nm@ti.com> (Nishanth Menon's message of "Wed, 18 May 2011 00:17:27 -0500")
Nishanth Menon <nm@ti.com> writes:
> Patch "OMAP2+: voltage: split voltage controller (VC) code into dedicated layer"
> splits out the hardcoded value in the code to vc's channel init.
>
> This patch further isolates the configuration to remove out PMIC specific
> configuration as high and low times are pmic specific.
>
> Values are updated as well based on latest TI analysis done in android k35
> kernel.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
OK, this is a step in the right direction, but IIUC, these values are
sys_clk dependent right? Shouldn't we be calculating these values based
on sys_clk?
Kevin
> ---
> note: Generates two over 80 char warnings, left as is for maintaining
> code continuity.
> WARNING: line over 80 characters
> #71: FILE: arch/arm/mach-omap2/prm-regbits-44xx.h:1068:
> +#define OMAP4430_HSCLH_MASK (0xff << 16)
> WARNING: line over 80 characters
> #75: FILE: arch/arm/mach-omap2/prm-regbits-44xx.h:1072:
> +#define OMAP4430_HSCLL_MASK (0xff << 24)
>
> arch/arm/mach-omap2/omap_twl.c | 13 +++++++++++++
> arch/arm/mach-omap2/prm-regbits-44xx.h | 8 ++++++++
> arch/arm/mach-omap2/vc.c | 16 ++++++++++++----
> arch/arm/mach-omap2/voltage.h | 8 ++++++++
> 4 files changed, 41 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
> index 30f4323..82a91be 100644
> --- a/arch/arm/mach-omap2/omap_twl.c
> +++ b/arch/arm/mach-omap2/omap_twl.c
> @@ -202,6 +202,10 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
> .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
> .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG,
> .i2c_high_speed = true,
> + .i2c_scll_low = 0x28,
> + .i2c_scll_high = 0x2C,
> + .i2c_hscll_low = 0x0B,
> + .i2c_hscll_high = 0x00,
> .vsel_to_uv = twl6030_vsel_to_uv,
> .uv_to_vsel = twl6030_uv_to_vsel,
> };
> @@ -223,6 +227,10 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
> .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
> .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG,
> .i2c_high_speed = true,
> + .i2c_scll_low = 0x28,
> + .i2c_scll_high = 0x2C,
> + .i2c_hscll_low = 0x0B,
> + .i2c_hscll_high = 0x00,
> .vsel_to_uv = twl6030_vsel_to_uv,
> .uv_to_vsel = twl6030_uv_to_vsel,
> };
> @@ -242,6 +250,11 @@ static struct omap_voltdm_pmic omap4_core_pmic = {
> .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
> .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
> .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
> + .i2c_high_speed = true,
> + .i2c_scll_low = 0x28,
> + .i2c_scll_high = 0x2C,
> + .i2c_hscll_low = 0x0B,
> + .i2c_hscll_high = 0x00,
> .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG,
> .vsel_to_uv = twl6030_vsel_to_uv,
> .uv_to_vsel = twl6030_uv_to_vsel,
> diff --git a/arch/arm/mach-omap2/prm-regbits-44xx.h b/arch/arm/mach-omap2/prm-regbits-44xx.h
> index 6d2776f..32a5eb5 100644
> --- a/arch/arm/mach-omap2/prm-regbits-44xx.h
> +++ b/arch/arm/mach-omap2/prm-regbits-44xx.h
> @@ -1063,6 +1063,14 @@
> #define OMAP4430_SCLL_SHIFT 8
> #define OMAP4430_SCLL_MASK (0xff << 8)
>
> +/* Used by PRM_VC_CFG_I2C_CLK */
> +#define OMAP4430_HSCLH_SHIFT 16
> +#define OMAP4430_HSCLH_MASK (0xff << 16)
> +
> +/* Used by PRM_VC_CFG_I2C_CLK */
> +#define OMAP4430_HSCLL_SHIFT 24
> +#define OMAP4430_HSCLL_MASK (0xff << 24)
> +
> /* Used by PRM_RSTST */
> #define OMAP4430_SECURE_WDT_RST_SHIFT 4
> #define OMAP4430_SECURE_WDT_RST_MASK (1 << 4)
> diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
> index 8ca200d..79b9e86 100644
> --- a/arch/arm/mach-omap2/vc.c
> +++ b/arch/arm/mach-omap2/vc.c
> @@ -191,14 +191,22 @@ static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
> static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
> {
> static bool is_initialized;
> - u32 vc_val;
> + struct omap_voltdm_pmic *pmic = voltdm->pmic;
> + u32 vc_val = 0;
>
> if (is_initialized)
> return;
>
> - /* XXX These are magic numbers and do not belong! */
> - vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
> - voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
> + if (pmic->i2c_high_speed) {
> + vc_val |= pmic->i2c_hscll_low << OMAP4430_HSCLL_SHIFT;
> + vc_val |= pmic->i2c_hscll_high << OMAP4430_HSCLH_SHIFT;
> + }
> +
> + vc_val |= pmic->i2c_scll_low << OMAP4430_SCLL_SHIFT;
> + vc_val |= pmic->i2c_scll_high << OMAP4430_SCLH_SHIFT;
> +
> + if (vc_val)
> + voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
>
> is_initialized = true;
> }
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
> index 2f7b268..3fe56e4 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -118,6 +118,10 @@ struct omap_volt_data {
> * @i2c_mcode: master code value for I2C high-speed preamble transmission
> * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
> * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
> + * @i2c_hscll_low: PMIC interface speed config for highspeed mode (T low)
> + * @i2c_hscll_high: PMIC interface speed config for highspeed mode (T high)
> + * @i2c_scll_low: PMIC interface speed config for fullspeed mode (T low)
> + * @i2c_scll_high: PMIC interface speed config for fullspeed mode (T high)
> */
> struct omap_voltdm_pmic {
> int slew_rate;
> @@ -137,6 +141,10 @@ struct omap_voltdm_pmic {
> u8 volt_reg_addr;
> u8 cmd_reg_addr;
> bool i2c_high_speed;
> + u8 i2c_hscll_low;
> + u8 i2c_hscll_high;
> + u8 i2c_scll_low;
> + u8 i2c_scll_high;
> u8 i2c_mcode;
> unsigned long (*vsel_to_uv) (const u8 vsel);
> u8 (*uv_to_vsel) (unsigned long uV);
next prev parent reply other threads:[~2011-05-18 8:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-18 5:17 [PM-WIP/voltdm_c][PATCH 00/11] OMAP4: Fixes for voltage scale Nishanth Menon
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 01/11] OMAP3+: PM: SR: fix debugfs Nishanth Menon
2011-05-18 8:55 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 02/11] OMAP3+: PM: voltage: add required debugfs interfaces Nishanth Menon
2011-05-18 7:59 ` Tony Lindgren
2011-05-18 8:06 ` Menon, Nishanth
2011-05-18 8:34 ` Tony Lindgren
2011-05-18 8:41 ` Menon, Nishanth
2011-05-18 8:44 ` Kevin Hilman
2011-05-18 8:50 ` Menon, Nishanth
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 03/11] OMAP3+: PM: VP: fix vstepmax Nishanth Menon
2011-05-18 8:58 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 04/11] OMAP4: PM: VC: support configuration of i2c clks Nishanth Menon
2011-05-18 8:53 ` Kevin Hilman [this message]
2011-05-18 8:57 ` Menon, Nishanth
2011-05-25 18:17 ` Kevin Hilman
2011-05-25 18:32 ` Menon, Nishanth
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 05/11] OMAP4: PM: VC: fix highspeed i2c for SR Nishanth Menon
2011-05-18 8:59 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 06/11] OMAP4: PM: VC: fix channel bit offset for MPU Nishanth Menon
2011-05-18 9:34 ` Kevin Hilman
2011-05-18 9:47 ` Menon, Nishanth
2011-05-18 11:06 ` Kevin Hilman
2011-05-18 11:22 ` Menon, Nishanth
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 07/11] OMAP4: PM: TWL6030: fix voltage conversion formula Nishanth Menon
2011-05-18 9:38 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 08/11] OMAP4: PM: TWL6030: fix uv to voltage for >0x39 Nishanth Menon
2011-05-18 9:41 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 09/11] OMAP4: PM: TWL6030: address 0V conversions Nishanth Menon
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 10/11] OMAP4: PM: TWL6030: fix ON/RET/OFF voltages Nishanth Menon
2011-05-18 10:44 ` Kevin Hilman
2011-05-18 5:17 ` [PM-WIP/voltdm_c][PATCH 11/11] OMAP4: PM: TWL6030: add cmd register Nishanth Menon
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=87y624xucx.fsf@ti.com \
--to=khilman@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
/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: link
Be 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.