OMAP2+: voltage: fixes
cover OMAP2+: voltage: fixes
Bunch of fixes for VC, VP incorporating previous comments merges two series of PMIC and voltage cleanups I send previously.
Applies on:git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.gitvoltdm_nm 3c217ab OMAP3+: PM: VC: handle mutant channel config for OMAP4 MPU channel
Original series:
http://marc.info/?l=linux-omap&m=130671118605896&w=2
http://marc.info/?l=linux-omap&m=130682723914928&w=2
Nishanth Menon (10):
OMAP3+: VC: fix mutant channel handling
OMAP4: PM: VC: allow channels use of default channel i2c_slaveaddr
OMAP4: PM: VC: allow channels to use cmdra reg
OMAP4: PM: VC: allow channels use of default channel volt_reg_addr
OMAP4: PM: VC: allow channels use of default channel cmd_reg_addr OMAP3+: PM: VC: support configuring PMIC over I2C_SR OMAP3+: PM: VP: use uV for max and min voltage limits OMAP3+: PM: introduce a central pmic control
OMAP2+: PM: secure OPP access using rcu locks
OMAP2+: PM: init_voltages: handle non compliant bootloaders
arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/omap_pmic.c | 74 +++++++++++++++++++++ arch/arm/mach-omap2/omap_twl.c | 103 ++++++++++++++---------------- arch/arm/mach-omap2/pm.c | 61 ++++++++++++++---- arch/arm/mach-omap2/pm.h | 35 +++++++++-- arch/arm/mach-omap2/vc.c | 134 ++++++++++++++++++++++++++++++++------- arch/arm/mach-omap2/vc.h | 8 ++- arch/arm/mach-omap2/voltage.h | 37 +++++++++-- arch/arm/mach-omap2/vp.c | 4 +- 9 files changed, 351 insertions(+), 107 deletions(-) create mode 100644 arch/arm/mach-omap2/omap_pmic.c
Regards,
Nishanth Menon
PATCH 1/10 OMAP3+: VC: fix mutant channel handling
"OMAP3+: PM: VC: handle mutant channel config for OMAP4 MPU channel" handles the mutant channel flags, however since vc_cfg_bits is static file wide variable, it makes better sense to update this based on the specific channel using mutant or not. else if we have a initial registration of mutant channel definition, all other channels will end up using the mutant definition.
---
we should probably squash this in to the original commit
arch/arm/mach-omap2/vc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/vc.c +3 -1
@@ -53,7 +53,7 @@ static struct omap_vc_channel_cfg vc_mutant_channel_cfg = { .cmd = BIT(1), }; -static struct omap_vc_channel_cfg *vc_cfg_bits = &vc_default_channel_cfg; +static struct omap_vc_channel_cfg *vc_cfg_bits;#define CFG_CHANNEL_MASK 0x1f/**
@@ -300,6 +300,8 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->cfg_channel =0 ;if (vc->flags &OMAP_VC_CHANNEL_CFG_MUTANT ) vc_cfg_bits = &vc_mutant_channel_cfg; +else + vc_cfg_bits = &vc_default_channel_cfg;/* get PMIC/board specific settings */ vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 01/10] OMAP3+: VC: fix mutant channel handling
Quoted 6 lines · Nishanth Menon
"OMAP3+: PM: VC: handle mutant channel config for OMAP4 MPU channel" handles the mutant channel flags, however since
vc_cfg_bitsis static file wide variable, it makes better sense to update this based on the specific channel using mutant or not. else if we have a initial registration of mutant channel definition, all other channels will end up using the mutant definition.
Indeed.
Quoted 3 lines
Signed-off-by Nishanth Menon <[email protected]>---
we should probably squash this in to the original commit
Thanks, squashed.
Kevin
Quoted 25 lines
arch/arm/mach-omap2/vc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)arch/arm/mach-omap2/vc.c +3
-1@@ -53,7 +53,7 @@ static struct omap_vc_channel_cfg vc_mutant_channel_cfg = { .cmd = BIT(1), }; -static struct omap_vc_channel_cfg *vc_cfg_bits = &vc_default_channel_cfg; +static struct omap_vc_channel_cfg *vc_cfg_bits;#define CFG_CHANNEL_MASK 0x1f/** @@ -300,6 +300,8 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->cfg_channel =0 ;if (vc->flags &OMAP_VC_CHANNEL_CFG_MUTANT ) vc_cfg_bits = &vc_mutant_channel_cfg; +else + vc_cfg_bits = &vc_default_channel_cfg;/* get PMIC/board specific settings */ vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
PATCH 2/10 OMAP4: PM: VC: allow channels use of default channel i2c_slaveaddr
In reply to Nishanth MenonOMAP4's PRM_VC_CFG_CHANNEL register allows for flexibility of configuring for various PMIC configurations. In combinations where the same slave address is used for all domains, it is possible to setup the VC channel for the dependent channels to use the same slave address as the default channel.
Since I2C addressing could be 7 bit or 11 bits as per the I2C specification, we use the BIT(15) to flag that this should use the default channel's configuration. Depending on the PMIC and platform used, this can be populated on the PMIC's datastructure and percolates to VC's configuration.
--- arch/arm/mach-omap2/vc.c | 18 ++++++++++++++---- arch/arm/mach-omap2/vc.h | 2 +- arch/arm/mach-omap2/voltage.h | 11 ++++++++++- 3 files changed, 25 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/vc.c +14 -4
@@ -309,11 +309,21 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; vc->setup_time = voltdm->pmic->volt_setup_time; +if ((vc->flags &OMAP_VC_CHANNEL_DEFAULT ) && + (vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM )) { +pr_err ("%s: voltdm %s: default channel " +"bad config-sa=%2x ?\n" , __func__, voltdm->name, + vc->i2c_slave_addr); +return ; + } +/* Configure the i2c slave address for this VC */ - voltdm->rmw (vc->smps_sa_mask, - vc->i2c_slave_addr <<__ffs (vc->smps_sa_mask), - vc->common->smps_sa_reg); - vc->cfg_channel |= vc_cfg_bits->sa; +if (vc->i2c_slave_addr !=USE_DEFAULT_CHANNEL_I2C_PARAM ) { + voltdm->rmw (vc->smps_sa_mask, + vc->i2c_slave_addr <<__ffs (vc->smps_sa_mask), + vc->common->smps_sa_reg); + vc->cfg_channel |= vc_cfg_bits->sa; + }/* * Configure the PMIC register addresses.
arch/arm/mach-omap2/vc.h +1 -1
@@ -77,7 +77,7 @@ struct omap_vc_channel {u8 flags;/* channel state */ -u8 i2c_slave_addr; +u16 i2c_slave_addr;u8 volt_reg_addr;u8 cmd_reg_addr;u8 cfg_channel;
arch/arm/mach-omap2/voltage.h +10 -1
@@ -109,6 +109,15 @@ struct omap_volt_data {u8 vp_errgain; }; +/* +* Introduced in OMAP4, is a concept of a default channel - in OMAP4, this +* channel is MPU, all other domains such as IVA/CORE, could optionally +* link their i2c reg configuration to use MPU channel's configuration if +* required. To do this, mark in the PMIC structure's +* i2c_slave_addr with this macro. +*/ +#define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000 +/** * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. * @slew_rate: PMIC slew rate (in uv/us)
@@ -132,7 +141,7 @@ struct omap_voltdm_pmic {u8 vp_vddmin;u8 vp_vddmax;u8 vp_timeout_us; -u8 i2c_slave_addr; +u16 i2c_slave_addr;u8 volt_reg_addr;u8 cmd_reg_addr;bool i2c_high_speed;
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 02/10] OMAP4: PM: VC: allow channels use of default channel i2c_slaveaddr
Quoted 6 lines · Nishanth Menon
OMAP4's
PRM_VC_CFG_CHANNELregister allows for flexibility of configuring for various PMIC configurations. In combinations where the same slave address is used for all domains, it is possible to setup the VC channel for the dependent channels to use the same slave address as the default channel.Since I2C addressing could be 7 bit or 11 bits as per the I2C specification,
That alone should be the justification for the u8 -> u16 change.
In fact, I'll change all these i2c address fields so u16 in the original patches for that reason. Then here, you can just say you use BIT(15)
because I2C address are a max of 11 bits. BTW is it 11 or 10? I've
only heard of 10-bit addressing for I2C.
Quoted 61 lines
we use the BIT(15) to flag that this should use the default channel's configuration. Depending on the PMIC and platform used, this can be populated on the PMIC's datastructure and percolates to VC's configuration.
Signed-off-by Nishanth Menon <[email protected]>--- arch/arm/mach-omap2/vc.c | 18 ++++++++++++++---- arch/arm/mach-omap2/vc.h | 2 +- arch/arm/mach-omap2/voltage.h | 11 ++++++++++- 3 files changed, 25 insertions(+), 6 deletions(-)arch/arm/mach-omap2/vc.c +14
-4@@ -309,11 +309,21 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; vc->setup_time = voltdm->pmic->volt_setup_time; +if ((vc->flags &OMAP_VC_CHANNEL_DEFAULT ) && + (vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM )) { +pr_err ("%s: voltdm %s: default channel " +"bad config-sa=%2x ?\n" , __func__, voltdm->name, + vc->i2c_slave_addr); +return ; + } +/* Configure the i2c slave address for this VC */ - voltdm->rmw (vc->smps_sa_mask, - vc->i2c_slave_addr <<__ffs (vc->smps_sa_mask), - vc->common->smps_sa_reg); - vc->cfg_channel |= vc_cfg_bits->sa; +if (vc->i2c_slave_addr !=USE_DEFAULT_CHANNEL_I2C_PARAM ) { + voltdm->rmw (vc->smps_sa_mask, + vc->i2c_slave_addr <<__ffs (vc->smps_sa_mask), + vc->common->smps_sa_reg); + vc->cfg_channel |= vc_cfg_bits->sa; + }/* * Configure the PMIC register addresses. arch/arm/mach-omap2/vc.h +1
-1@@ -77,7 +77,7 @@ struct omap_vc_channel {u8 flags;/* channel state */ -u8 i2c_slave_addr; +u16 i2c_slave_addr;u8 volt_reg_addr;u8 cmd_reg_addr;u8 cfg_channel;arch/arm/mach-omap2/voltage.h +0
-0@@ -109,6 +109,15 @@ struct omap_volt_data {u8 vp_errgain; };
arch/arm/mach-omap2/voltage.h struct omap_volt_data { · line 120
Quoted 10 lines
arch/arm/mach-omap2/voltage.h +9
-0+/* +* Introduced in OMAP4, is a concept of a default channel - in OMAP4, this +* channel is MPU, all other domains such as IVA/CORE, could optionally +* link their i2c reg configuration to use MPU channel's configuration if +* required. To do this, mark in the PMIC structure's +* i2c_slave_addr with this macro. +*/ +#define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000 +
Needs a VC prefix, also use BIT().
Also, later on in the series you use the same value for things other than the I2C slave address. How about just calling this:
#define OMAP_VC_USE_DEFAULT_CHANNEL BIT(15)
Quoted 12 lines
arch/arm/mach-omap2/voltage.h +1
-1/** * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. * @slew_rate: PMIC slew rate (in uv/us) @@ -132,7 +141,7 @@ struct omap_voltdm_pmic {u8 vp_vddmin;u8 vp_vddmax;u8 vp_timeout_us; -u8 i2c_slave_addr; +u16 i2c_slave_addr;u8 volt_reg_addr;u8 cmd_reg_addr;bool i2c_high_speed;
Re: [pm-wip/voltdm_nm][PATCH 02/10] OMAP4: PM: VC: allow channels use of default channel i2c_slaveaddr
Kevin Hilman <[email protected]> writes:
[...]
Quoted 20 lines
Quoted 7 lines
arch/arm/mach-omap2/voltage.h +0
-0@@ -109,6 +109,15 @@ struct omap_volt_data {u8 vp_errgain; };arch/arm/mach-omap2/voltage.h struct omap_volt_data { · line 120
Quoted 10 lines
arch/arm/mach-omap2/voltage.h +9
-0+/* +* Introduced in OMAP4, is a concept of a default channel - in OMAP4, this +* channel is MPU, all other domains such as IVA/CORE, could optionally +* link their i2c reg configuration to use MPU channel's configuration if +* required. To do this, mark in the PMIC structure's +* i2c_slave_addr with this macro. +*/ +#define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000 +Needs a VC prefix, also use
BIT().
Quoted 5 lines
Also, later on in the series you use the same value for things other than the I2C slave address. How about just calling this:
#define
OMAP_VC_USE_DEFAULT_CHANNELBIT(15)
Also, this should be in vc.h, not voltage.h
Kevin
PATCH 3/10 OMAP4: PM: VC: allow channels to use cmdra reg
In reply to Nishanth Menonif volt_reg and cmd_reg are the same from PMIC configuration, we can use the cmd reg by using racen - this is valid for voltage commands, however, in most cases, we'd like to retain voltage reg configuration as well for vfsm commands going thru from h/w.
--- arch/arm/mach-omap2/vc.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/vc.c +5 -1
@@ -337,9 +337,13 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) voltdm->rmw (vc->smps_cmdra_mask, vc->cmd_reg_addr <<__ffs (vc->smps_cmdra_mask), vc->common->smps_cmdra_reg); - vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen; + vc->cfg_channel |= vc_cfg_bits->rac; } +/* If voltage and cmd regs are same, we can use cmdra register */ +if (vc->volt_reg_addr == vc->cmd_reg_addr) + vc->cfg_channel |= vc_cfg_bits->racen; +/* Set up the on, inactive, retention and off voltage */ on_vsel = voltdm->pmic->uv_to_vsel (voltdm->pmic->on_volt); onlp_vsel = voltdm->pmic->uv_to_vsel (voltdm->pmic->onlp_volt);
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 03/10] OMAP4: PM: VC: allow channels to use cmdra reg
Quoted 2 lines · Nishanth Menon
if
volt_regandcmd_regare the same from PMIC configuration, we can use the cmd reg by using racen -
-ECONFUSED
If volt_reg and cmd_reg are the same then I understood RACEN to be a don't care. Zero means use volt_reg, 1 means use cmd_reg, but if volt_reg == cmd_reg, then either way is the same result.
The way I understood (and coded) this is that the only time you need RACEN set is precicesly the case when a cmd_reg is provided (and thus is different from volt_reg.
What am I missing?
Or, stated differently, I guess I don't understand the use case for RAC != RACEN
Kevin
Quoted 29 lines
this is valid for
voltage commands, however, in most cases, we'd like to retain voltage reg configuration as well for vfsm commands going thru from h/w.Signed-off-by Nishanth Menon <[email protected]>--- arch/arm/mach-omap2/vc.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)arch/arm/mach-omap2/vc.c +5
-1@@ -337,9 +337,13 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) voltdm->rmw (vc->smps_cmdra_mask, vc->cmd_reg_addr <<__ffs (vc->smps_cmdra_mask), vc->common->smps_cmdra_reg); - vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen; + vc->cfg_channel |= vc_cfg_bits->rac; } +/* If voltage and cmd regs are same, we can use cmdra register */ +if (vc->volt_reg_addr == vc->cmd_reg_addr) + vc->cfg_channel |= vc_cfg_bits->racen; +/* Set up the on, inactive, retention and off voltage */ on_vsel = voltdm->pmic->uv_to_vsel (voltdm->pmic->on_volt); onlp_vsel = voltdm->pmic->uv_to_vsel (voltdm->pmic->onlp_volt);
PATCH 4/10 OMAP4: PM: VC: allow channels use of default channel volt_reg_addr
In reply to Nishanth MenonOMAP4's PRM_VC_CFG_CHANNEL register allows for flexibility of configuring for various PMIC configurations. In combinations where we'd like to use the default VC channel's voltage_reg address in a particular non-default VC channel, we allow the use of USE_DEFAULT_CHANNEL_I2C_PARAM.
Since 0 is a valid register address, we need to increase the size of reg storage for the flag. Depending on the PMIC and platform used, this can be populated on the PMIC's datastructure and percolates to VC's configuration.
--- arch/arm/mach-omap2/vc.c | 17 ++++++++++------- arch/arm/mach-omap2/vc.h | 2 +- arch/arm/mach-omap2/voltage.h | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/vc.c +10 -7
@@ -310,10 +310,11 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->setup_time = voltdm->pmic->volt_setup_time;if ((vc->flags &OMAP_VC_CHANNEL_DEFAULT ) && - (vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM )) { + ((vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ) || + (vc->volt_reg_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ))) {pr_err ("%s: voltdm %s: default channel " -"bad config-sa=%2x ?\n" , __func__, voltdm->name, - vc->i2c_slave_addr); +"bad config-sa=%2x vol=%2x?\n" , __func__, voltdm->name, + vc->i2c_slave_addr, vc->volt_reg_addr);return ; }
@@ -328,10 +329,12 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)/* * Configure the PMIC register addresses. */ - voltdm->rmw (vc->smps_volra_mask, - vc->volt_reg_addr <<__ffs (vc->smps_volra_mask), - vc->common->smps_volra_reg); - vc->cfg_channel |= vc_cfg_bits->rav; +if (vc->volt_reg_addr !=USE_DEFAULT_CHANNEL_I2C_PARAM ) { + voltdm->rmw (vc->smps_volra_mask, + vc->volt_reg_addr <<__ffs (vc->smps_volra_mask), + vc->common->smps_volra_reg); + vc->cfg_channel |= vc_cfg_bits->rav; + }if (vc->cmd_reg_addr) { voltdm->rmw(vc->smps_cmdra_mask,
arch/arm/mach-omap2/vc.h +1 -1
@@ -78,7 +78,7 @@ struct omap_vc_channel {/* channel state */ u16 i2c_slave_addr; -u8 volt_reg_addr; +u16 volt_reg_addr;u8 cmd_reg_addr;u8 cfg_channel;u16 setup_time;
arch/arm/mach-omap2/voltage.h +2 -2
@@ -114,7 +114,7 @@ struct omap_volt_data {* channel is MPU, all other domains such as IVA/CORE, could optionally * link their i2c reg configuration to use MPU channel's configuration if * required. To do this, mark in the PMIC structure's -* i2c_slave_addr with this macro. +* i2c_slave_addr, volt_reg_addr with this macro. */ #define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000
@@ -142,7 +142,7 @@ struct omap_voltdm_pmic {u8 vp_vddmax;u8 vp_timeout_us;u16 i2c_slave_addr; -u8 volt_reg_addr; +u16 volt_reg_addr;u8 cmd_reg_addr;bool i2c_high_speed;u8 i2c_mcode;
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 04/10] OMAP4: PM: VC: allow channels use of default channel volt_reg_addr
Quoted 11 lines · Nishanth Menon
OMAP4's
PRM_VC_CFG_CHANNELregister allows for flexibility of configuring for various PMIC configurations. In combinations where we'd like to use the default VC channel'svoltage_regaddress in a particular non-default VC channel, we allow the use ofUSE_DEFAULT_CHANNEL_I2C_PARAM.Since 0 is a valid register address, we need to increase the size of reg storage for the flag. Depending on the PMIC and platform used, this can be populated on the PMIC's datastructure and percolates to VC's configuration.
Signed-off-by Nishanth Menon <[email protected]>
Approach is fine. After rebase, you won't have to do the u16 changes anymore since I squashed them into earlier patches already.
Minor nit below...
Quoted 11 lines
--- arch/arm/mach-omap2/vc.c | 17 ++++++++++------- arch/arm/mach-omap2/vc.h | 2 +- arch/arm/mach-omap2/voltage.h | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-)arch/arm/mach-omap2/vc.c +0
-0
arch/arm/mach-omap2/vc.c void __init omap_vc_init_channel(struct voltagedomain *voltdm) · line 314
Quoted 6 lines
arch/arm/mach-omap2/vc.c +2
-1@@ -310,10 +310,11 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->setup_time = voltdm->pmic->volt_setup_time;if ((vc->flags &OMAP_VC_CHANNEL_DEFAULT ) && - (vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM )) { + ((vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ) || + (vc->volt_reg_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ))) {
Please fixup the indentation here. (and in original patch that added this.) Run it through scripts/Lindent and see what the result should look like. I usually ends up to be leading tabs plus any extra spaces required to make it line up right.
Kevin
Quoted 60 lines
arch/arm/mach-omap2/vc.c +8
-6pr_err ("%s: voltdm %s: default channel " -"bad config-sa=%2x ?\n" , __func__, voltdm->name, - vc->i2c_slave_addr); +"bad config-sa=%2x vol=%2x?\n" , __func__, voltdm->name, + vc->i2c_slave_addr, vc->volt_reg_addr);return ; }@@ -328,10 +329,12 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)/* * Configure the PMIC register addresses. */ - voltdm->rmw (vc->smps_volra_mask, - vc->volt_reg_addr <<__ffs (vc->smps_volra_mask), - vc->common->smps_volra_reg); - vc->cfg_channel |= vc_cfg_bits->rav; +if (vc->volt_reg_addr !=USE_DEFAULT_CHANNEL_I2C_PARAM ) { + voltdm->rmw (vc->smps_volra_mask, + vc->volt_reg_addr <<__ffs (vc->smps_volra_mask), + vc->common->smps_volra_reg); + vc->cfg_channel |= vc_cfg_bits->rav; + }if (vc->cmd_reg_addr) { voltdm->rmw(vc->smps_cmdra_mask,arch/arm/mach-omap2/vc.h +1
-1@@ -78,7 +78,7 @@ struct omap_vc_channel {/* channel state */ u16 i2c_slave_addr; -u8 volt_reg_addr; +u16 volt_reg_addr;u8 cmd_reg_addr;u8 cfg_channel;u16 setup_time;arch/arm/mach-omap2/voltage.h +2
-2@@ -114,7 +114,7 @@ struct omap_volt_data {* channel is MPU, all other domains such as IVA/CORE, could optionally * link their i2c reg configuration to use MPU channel's configuration if * required. To do this, mark in the PMIC structure's -* i2c_slave_addr with this macro. +* i2c_slave_addr, volt_reg_addr with this macro. */ #define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000@@ -142,7 +142,7 @@ struct omap_voltdm_pmic {u8 vp_vddmax;u8 vp_timeout_us;u16 i2c_slave_addr; -u8 volt_reg_addr; +u16 volt_reg_addr;u8 cmd_reg_addr;bool i2c_high_speed;u8 i2c_mcode;
PATCH 5/10 OMAP4: PM: VC: allow channels use of default channel cmd_reg_addr
In reply to Nishanth MenonOMAP4's PRM_VC_CFG_CHANNEL register allows for flexibility of configuring for various PMIC configurations. In combinations where we'd like to use the default VC channel's cmd_reg address in a particular non-default VC channel, we allow the use of USE_DEFAULT_CHANNEL_I2C_PARAM.
Since 0 is a valid register address, we need to increase the size of reg storage for the flag. Depending on the PMIC and platform used, this can be populated on the PMIC's datastructure and percolates to VC's configuration.
--- arch/arm/mach-omap2/vc.c | 8 +++++--- arch/arm/mach-omap2/vc.h | 2 +- arch/arm/mach-omap2/voltage.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/vc.c +5 -3
@@ -311,10 +311,12 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)if ((vc->flags &OMAP_VC_CHANNEL_DEFAULT ) && ((vc->i2c_slave_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ) || + (vc->cmd_reg_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ) || (vc->volt_reg_addr ==USE_DEFAULT_CHANNEL_I2C_PARAM ))) {pr_err ("%s: voltdm %s: default channel " -"bad config-sa=%2x vol=%2x?\n" , __func__, voltdm->name, - vc->i2c_slave_addr, vc->volt_reg_addr); +"bad config-sa=%2x vol=%2x, cmd=%2x?\n" , __func__, + voltdm->name, vc->i2c_slave_addr, vc->volt_reg_addr, + vc->cmd_reg_addr);return ; }
@@ -336,7 +338,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) vc->cfg_channel |= vc_cfg_bits->rav; } -if (vc->cmd_reg_addr) { +if (vc->cmd_reg_addr !=USE_DEFAULT_CHANNEL_I2C_PARAM ) { voltdm->rmw (vc->smps_cmdra_mask, vc->cmd_reg_addr <<__ffs (vc->smps_cmdra_mask), vc->common->smps_cmdra_reg);
arch/arm/mach-omap2/vc.h +1 -1
@@ -79,7 +79,7 @@ struct omap_vc_channel {/* channel state */ u16 i2c_slave_addr;u16 volt_reg_addr; -u8 cmd_reg_addr; +u16 cmd_reg_addr;u8 cfg_channel;u16 setup_time;bool i2c_high_speed;
arch/arm/mach-omap2/voltage.h +2 -2
@@ -114,7 +114,7 @@ struct omap_volt_data {* channel is MPU, all other domains such as IVA/CORE, could optionally * link their i2c reg configuration to use MPU channel's configuration if * required. To do this, mark in the PMIC structure's -* i2c_slave_addr, volt_reg_addr with this macro. +* i2c_slave_addr, volt_reg_addr,cmd_reg_addr with this macro. */ #define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000
@@ -143,7 +143,7 @@ struct omap_voltdm_pmic {u8 vp_timeout_us;u16 i2c_slave_addr;u16 volt_reg_addr; -u8 cmd_reg_addr; +u16 cmd_reg_addr;bool i2c_high_speed;u8 i2c_mcode;unsigned long (*vsel_to_uv) (const u8 vsel);
Signature · 1 line
1.7.1
PATCH 6/10 OMAP3+: PM: VC: support configuring PMIC over I2C_SR
In reply to Nishanth MenonMany simpler PMICs such as TPS65023 as discussed in [1] with a single I2C interface do still have configuration registers that may need population. Typical being slew rate, thermal shutdown configuration etc. These devices are typically hooked on Application Processor's(AP) standard I2C busses. Unfortunately, when hooked on I2C_SR, unlike the standard I2C framework, we cannot read using Voltage Controller, but we can definitely write to them. Hence for using PMICs such as these and others such as those used with OMAP4460, it is imperative that we provide a hook to support the device configuration.
[1] http://marc.info/?t=129848405600010&r=1&w=2
--- arch/arm/mach-omap2/vc.c | 91 ++++++++++++++++++++++++++++++++++++++++------ arch/arm/mach-omap2/vc.h | 2 + 2 files changed, 81 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/vc.c +79 -12
@@ -147,25 +147,23 @@ void omap_vc_post_scale(struct voltagedomain *voltdm, voltdm->curr_volt = target_volt; } -/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */ -int omap_vc_bypass_scale_voltage (struct voltagedomain *voltdm, -unsigned long target_volt) +static int omap_vc_bypass_send_value (struct voltagedomain *voltdm, +struct omap_vc_channel *vc,u8 sa,u8 reg,u32 data) { -struct omap_vc_channel *vc = voltdm->vc;u32 loop_cnt =0 , retries_cnt =0 ;u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; -u8 target_vsel, current_vsel; -int ret; - ret =omap_vc_pre_scale (voltdm, target_volt, &target_vsel, ¤t_vsel); -if (ret) -return ret; +if (IS_ERR_OR_NULL (vc->common)) { +pr_err ("%s voldm=%s bad value for vc->common\n" , + __func__, voltdm->name); +return -EINVAL ; + } vc_valid = vc->common->valid; vc_bypass_val_reg = vc->common->bypass_val_reg; - vc_bypass_value = (target_vsel << vc->common->data_shift) | - (vc->volt_reg_addr << vc->common->regaddr_shift) | - (vc->i2c_slave_addr << vc->common->slaveaddr_shift); + vc_bypass_value = (data << vc->common->data_shift) | + (reg << vc->common->regaddr_shift) | + (sa << vc->common->slaveaddr_shift); voltdm->write (vc_bypass_value, vc_bypass_val_reg); voltdm->write (vc_bypass_value | vc_valid, vc_bypass_val_reg);
@@ -192,10 +190,79 @@ int omap_vc_bypass_scale_voltage(struct voltagedomain *voltdm, vc_bypass_value = voltdm->read (vc_bypass_val_reg); } +return 0 ; + +} + +/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */ +int omap_vc_bypass_scale_voltage (struct voltagedomain *voltdm, +unsigned long target_volt) +{ +struct omap_vc_channel *vc; +u8 target_vsel, current_vsel; +int ret; + +if (IS_ERR_OR_NULL (voltdm)) { +pr_err ("%s bad voldm\n" , __func__); +return -EINVAL ; + } + + vc = voltdm->vc; +if (IS_ERR_OR_NULL (vc)) { +pr_err ("%s voldm=%s bad vc\n" , __func__, voltdm->name); +return -EINVAL ; + } + + ret =omap_vc_pre_scale (voltdm, target_volt, &target_vsel, + ¤t_vsel); +if (ret) +return ret; + + ret =omap_vc_bypass_send_value (voltdm, vc, vc->i2c_slave_addr, + vc->volt_reg_addr, target_vsel); +if (ret) +return ret; +omap_vc_post_scale (voltdm, target_volt, target_vsel, current_vsel);return 0 ; } +/** +* omap_vc_bypass_send_i2c_msg() - Function to control PMIC registers over SRI2C +* @voltdm: voltage domain +* @slave_addr: slave address of the device. +* @reg_addr: register address to access +* @data: what do we want to write there +* +* Many simpler PMICs with a single I2C interface still have configuration +* registers that may need population. Typical being slew rate configurations +* thermal shutdown configuration etc. When these PMICs are hooked on I2C_SR, +* this function allows these configuration registers to be accessed. +* +* WARNING: Though this could be used for voltage register configurations over +* I2C_SR, DONOT use it for that purpose, all the Voltage controller's internal +* information is bypassed using this function and must be used judiciously. +*/ +int omap_vc_bypass_send_i2c_msg (struct voltagedomain *voltdm,u8 slave_addr, +u8 reg_addr,u8 data) +{ +struct omap_vc_channel *vc; + +if (IS_ERR_OR_NULL (voltdm)) { +pr_err ("%s bad voldm\n" , __func__); +return -EINVAL ; + } + + vc = voltdm->vc; +if (IS_ERR_OR_NULL (vc)) { +pr_err ("%s voldm=%s bad vc\n" , __func__, voltdm->name); +return -EINVAL ; + } + +return omap_vc_bypass_send_value (voltdm, vc, slave_addr, + reg_addr, data); +} +static void __init omap3_vfsm_init (struct voltagedomain *voltdm) {/*
arch/arm/mach-omap2/vc.h +2 -0
@@ -109,5 +109,7 @@ void omap_vc_post_scale(struct voltagedomain *voltdm, u8 target_vsel, u8 current_vsel);int omap_vc_bypass_scale_voltage (struct voltagedomain *voltdm,unsigned long target_volt); +int omap_vc_bypass_send_i2c_msg (struct voltagedomain *voltdm, +u8 slave_addr,u8 reg_addr,u8 data);#endif
Signature · 1 line
1.7.1
PATCH 7/10 OMAP3+: PM: VP: use uV for max and min voltage limits
In reply to Nishanth MenonEvery PMIC has it's own eccentricities, For example, one of the PMIC has MSB set to 1 for a specific function - voltage enable! using an hardcoded value specific for TWL when copied over to such an implementation causes the system to crash as the MSB bit was 0 and the voltage got disabled!.
Instead we use actual values and depend on the convertion routines to abstract out the eccentricities of each PMIC.
With this, we can now move the voltages to a common location in voltage.h as they are no longer dependent on PMICs and expect the PMIC's conversion routines to set a cap if the voltage is out of reach for the PMIC.
The corresponding voltage values are arrived at by using the following pre-existing equations:
TWL4030/5030 for OMAP3430/OMAP3630:(twl4030_vsel_to_uv)
(((vsel * 125) + 6000)) * 100 TWL6030 (OMAP4430):(twl6030_uv_to_vsel) ((((vsel - 1) * 1266) + 70900)) * 10
--- arch/arm/mach-omap2/omap_twl.c | 17 ----------------- arch/arm/mach-omap2/voltage.h | 22 ++++++++++++++++++++-- arch/arm/mach-omap2/vp.c | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-)
arch/arm/mach-omap2/omap_twl.c +0 -17
@@ -30,16 +30,6 @@#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 -#define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14 -#define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42 -#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18 -#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c - -#define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18 -#define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c -#define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18 -#define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30 -#define OMAP4_SRI2C_SLAVE_ADDR 0x12#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55#define OMAP4_VDD_MPU_SR_CMD_REG 0x56
@@ -53,13 +43,6 @@#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 -#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 0x39 -#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 0x2D -#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 0x28 -static bool is_offset_valid;static u8 smps_offset;/*
arch/arm/mach-omap2/voltage.h +20 -2
@@ -118,6 +118,24 @@ struct omap_volt_data {*/ #define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000 +/* Min and max voltages from OMAP perspective */ +#define OMAP3430_VP1_VLIMITTO_VDDMIN 850000 +#define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000 +#define OMAP3430_VP2_VLIMITTO_VDDMIN 900000 +#define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000 + +#define OMAP3630_VP1_VLIMITTO_VDDMIN 900000 +#define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000 +#define OMAP3630_VP2_VLIMITTO_VDDMIN 900000 +#define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000 + +#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000 +#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000 +#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000 +/** * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. * @slew_rate: PMIC slew rate (in uv/us)
@@ -138,8 +156,8 @@ struct omap_voltdm_pmic {u8 vp_erroroffset;u8 vp_vstepmin;u8 vp_vstepmax; -u8 vp_vddmin; -u8 vp_vddmax; +u32 vp_vddmin; +u32 vp_vddmax;u8 vp_timeout_us;u16 i2c_slave_addr;u16 volt_reg_addr;
arch/arm/mach-omap2/vp.c +2 -2
@@ -64,8 +64,8 @@ void __init omap_vp_init(struct voltagedomain *voltdm) sys_clk_rate = voltdm->sys_clk.rate /1000 ; timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) /1000 ; - vddmin = voltdm->pmic->vp_vddmin; - vddmax = voltdm->pmic->vp_vddmax; + vddmin = voltdm->pmic->uv_to_vsel (voltdm->pmic->vp_vddmin); + vddmax = voltdm->pmic->uv_to_vsel (voltdm->pmic->vp_vddmax); waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) * sys_clk_rate) /1000 ;
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 07/10] OMAP3+: PM: VP: use uV for max and min voltage limits
Quoted 17 lines · Nishanth Menon
Every PMIC has it's own eccentricities, For example, one of the PMIC has MSB set to 1 for a specific function - voltage enable! using an hardcoded value specific for TWL when copied over to such an implementation causes the system to crash as the MSB bit was 0 and the voltage got disabled!.
Instead we use actual values and depend on the convertion routines to abstract out the eccentricities of each PMIC.
With this, we can now move the voltages to a common location in
voltage.has they are no longer dependent on PMICs and expect the PMIC's conversion routines to set a cap if the voltage is out of reach for the PMIC.The corresponding voltage values are arrived at by using the following pre-existing equations:
TWL4030/5030 for OMAP3430/OMAP3630:(twl4030_vsel_to_uv)
Quoted 6 lines
(((vsel * 125) + 6000)) * 100 TWL6030 (OMAP4430):(twl6030_uv_to_vsel) ((((vsel - 1) * 1266) + 70900)) * 10Reported-by Jon Hunter <[email protected]>Signed-off-by Nishanth Menon <[email protected]>
Nice!
A reference to where these voltages values came from would be good to have in the code as well.
Kevin
Quoted 96 lines
--- arch/arm/mach-omap2/omap_twl.c | 17 ----------------- arch/arm/mach-omap2/voltage.h | 22 ++++++++++++++++++++-- arch/arm/mach-omap2/vp.c | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-)arch/arm/mach-omap2/omap_twl.c +0
-17@@ -30,16 +30,6 @@#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 -#define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14 -#define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42 -#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18 -#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c - -#define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18 -#define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c -#define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18 -#define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30 -#define OMAP4_SRI2C_SLAVE_ADDR 0x12#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55#define OMAP4_VDD_MPU_SR_CMD_REG 0x56@@ -53,13 +43,6 @@#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 -#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 0x39 -#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 0x2D -#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 0xA -#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 0x28 -static bool is_offset_valid;static u8 smps_offset;/* arch/arm/mach-omap2/voltage.h +20
-2@@ -118,6 +118,24 @@ struct omap_volt_data {*/ #define USE_DEFAULT_CHANNEL_I2C_PARAM 0x8000 +/* Min and max voltages from OMAP perspective */ +#define OMAP3430_VP1_VLIMITTO_VDDMIN 850000 +#define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000 +#define OMAP3430_VP2_VLIMITTO_VDDMIN 900000 +#define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000 + +#define OMAP3630_VP1_VLIMITTO_VDDMIN 900000 +#define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000 +#define OMAP3630_VP2_VLIMITTO_VDDMIN 900000 +#define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000 + +#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000 +#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000 +#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000 +#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000 +/** * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. * @slew_rate: PMIC slew rate (in uv/us) @@ -138,8 +156,8 @@ struct omap_voltdm_pmic {u8 vp_erroroffset;u8 vp_vstepmin;u8 vp_vstepmax; -u8 vp_vddmin; -u8 vp_vddmax; +u32 vp_vddmin; +u32 vp_vddmax;u8 vp_timeout_us;u16 i2c_slave_addr;u16 volt_reg_addr;arch/arm/mach-omap2/vp.c +2
-2@@ -64,8 +64,8 @@ void __init omap_vp_init(struct voltagedomain *voltdm) sys_clk_rate = voltdm->sys_clk.rate /1000 ; timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) /1000 ; - vddmin = voltdm->pmic->vp_vddmin; - vddmax = voltdm->pmic->vp_vddmax; + vddmin = voltdm->pmic->uv_to_vsel (voltdm->pmic->vp_vddmin); + vddmax = voltdm->pmic->uv_to_vsel (voltdm->pmic->vp_vddmax); waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) * sys_clk_rate) /1000 ;
Re: [pm-wip/voltdm_nm][PATCH 07/10] OMAP3+: PM: VP: use uV for max and min voltage limits
Quoted 4 lines · Kevin Hilman
Nice!
A reference to where these voltages values came from would be good to have in the code as well.
these are just conversions of the existing values - :( I think we need a seperate patch updating from each of OMAP DMs..
Regards,
Nishanth Menon
Re: [pm-wip/voltdm_nm][PATCH 07/10] OMAP3+: PM: VP: use uV for max and min voltage limits
Quoted 7 lines · Nishanth
Quoted 4 lines · Kevin Hilman
Nice!
A reference to where these voltages values came from would be good to have in the code as well.
these are just conversions of the existing values - :( I think we need a seperate patch updating from each of OMAP DMs..
Yes please.
PATCH 8/10 OMAP3+: PM: introduce a central pmic control
In reply to Nishanth MenonSince we are starting to use multiple PMICs in various combinations, use the existing .omap_chip = OMAP_CHIP_INIT() to mark the structures we are interested in using per OMAP device we are currently running on. This mapping is based on the default device recommendations from TI. Boards using custom PMICs now have an opportunity to register their own custom mapping.
With this we no longer need omap4_twl_init and omap3_twl_int instead we introduce a registration mechanism which is PMIC generic and move twl implementation to use the same. This allows for future OMAP4460 support where there is a mixture of PMIC combinations used.
--- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/omap_pmic.c | 74 +++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/omap_twl.c | 86 ++++++++++++++++++++++----------------- arch/arm/mach-omap2/pm.c | 5 +- arch/arm/mach-omap2/pm.h | 35 +++++++++++++--- 5 files changed, 155 insertions(+), 47 deletions(-) create mode 100644 arch/arm/mach-omap2/omap_pmic.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -4,7 +4,7 @@ # Common support obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ - common.o gpio.o dma.o wd_timer.o + common.o gpio.o dma.o wd_timer.o omap_pmic.o omap-2-3-common = irq.o sdrc.o hwmod-common = omap_hwmod.o \
arch/arm/mach-omap2/omap_pmic.c new file +74 -0
74 lines not on this page · raw message
arch/arm/mach-omap2/omap_twl.c +49 -37
102 lines not on this page · raw message
arch/arm/mach-omap2/pm.c +2 -3
@@ -251,9 +251,8 @@ postcore_initcall(omap2_common_pm_init);static int __init omap2_common_pm_late_init (void ) { -/* Init the OMAP TWL parameters */ -omap3_twl_init (); -omap4_twl_init (); +/* Init the OMAP PMIC parameters */ +omap_pmic_data_init ();/* Init the voltage layer */ omap_voltage_late_init ();
arch/arm/mach-omap2/pm.h +29 -6
@@ -125,16 +125,39 @@ static inline int omap_devinit_smartreflex(void)static inline void omap_enable_smartreflex_on_init (void ) {}#endif -#ifdef CONFIG_TWL4030_CORE -extern int omap3_twl_init (void ); -extern int omap4_twl_init (void ); -extern int omap3_twl_set_sr_bit (bool enable); +/** +* struct omap_pmic_map - Describe the OMAP PMIC data for OMAP +* @name: name of the voltage domain +* @pmic_data: pmic data associated with it +* @omap_chip: initialize with OMAP_CHIP_INIT the OMAP chips this data maps to +* @special_action: callback for any specific action to take for that map +* +* Since we support multiple PMICs each potentially functioning on multiple +* OMAP devices, we describe the parameters in a map allowing us to reuse the +* data as necessary. +*/ +struct omap_pmic_map { +char *name; +struct omap_voltdm_pmic *pmic_data; +struct omap_chip_id omap_chip; +int (*special_action)(struct voltagedomain *); +}; + +#ifdef CONFIG_PM +extern int omap_pmic_register_data (struct omap_pmic_map *map);#else -static inline int omap3_twl_init (void ) +static inline int omap_pmic_register_data (struct omap_pmic_map *map) {return -EINVAL ; } -static inline int omap4_twl_init (void ) +#endif +extern void omap_pmic_data_init (void ); + +#ifdef CONFIG_TWL4030_CORE +extern int omap_twl_init (void ); +extern int omap3_twl_set_sr_bit (bool enable); +#else +static inline int omap_twl_init (void ) {return -EINVAL ; }
Signature · 1 line
1.7.1
PATCH 9/10 OMAP2+: PM: secure OPP access using rcu locks
In reply to Nishanth MenonOPP functions as described in Documentation/power/opp.txt should be accessed under rcu_locks.
--- arch/arm/mach-omap2/pm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.c +3 -0
@@ -198,14 +198,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, freq = clk->rate;clk_put (clk); +rcu_read_lock (); opp =opp_find_freq_ceil (dev, &freq);if (IS_ERR (opp)) { +rcu_read_unlock ();printk (KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n" , __func__, vdd_name); goto exit; } bootup_volt =opp_get_voltage (opp); +rcu_read_unlock ();if (!bootup_volt) {printk (KERN_ERR "%s: unable to find voltage corresponding" "to the bootup OPP for vdd_%s\n" , __func__, vdd_name);
Signature · 1 line
1.7.1
Re: [pm-wip/voltdm_nm][PATCH 09/10] OMAP2+: PM: secure OPP access using rcu locks
Quoted 4 lines · Nishanth Menon
OPP functions as described in
Documentation/power/opp.txtshould be accessed underrcu_locks.Signed-off-by Nishanth Menon <[email protected]>
This looks like a fix needed in mainline.
Please send as a standalone patch against mainline and Cc linux-arm-kernel.
Thanks,
Kevin
Quoted 26 lines
--- arch/arm/mach-omap2/pm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)arch/arm/mach-omap2/pm.c +3
-0@@ -198,14 +198,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, freq = clk->rate;clk_put (clk); +rcu_read_lock (); opp =opp_find_freq_ceil (dev, &freq);if (IS_ERR (opp)) { +rcu_read_unlock ();printk (KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n" , __func__, vdd_name); goto exit; } bootup_volt =opp_get_voltage (opp); +rcu_read_unlock ();if (!bootup_volt) {printk (KERN_ERR "%s: unable to find voltage corresponding" "to the bootup OPP for vdd_%s\n" , __func__, vdd_name);
Re: [pm-wip/voltdm_nm][PATCH 09/10] OMAP2+: PM: secure OPP access using rcu locks
Quoted 11 lines · Kevin Hilman
Quoted 4 lines · Nishanth Menon
OPP functions as described in
Documentation/power/opp.txtshould be accessed underrcu_locks.Signed-off-by Nishanth Menon <[email protected]>This looks like a fix needed in mainline.
Please send as a standalone patch against mainline and Cc linux-arm-kernel.
ok will do.
Regards,
Nishanth Menon
Quoted 26 lines
Thanks,
Kevin
Quoted 21 lines
---
arch/arm/mach-omap2/pm.c | 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/arm/mach-omap2/pm.c +2
-0@@ -198,14 +198,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, freq = clk->rate; clk_put(clk); + rcu_read_lock(); opp = opp_find_freq_ceil(dev, &freq); if (IS_ERR(opp)) { + rcu_read_unlock(); printk(KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n", __func__, vdd_name); goto exit; }
Quoted 6 lines
Quoted 5 lines
arch/arm/mach-omap2/pm.c +1
-0bootup_volt = opp_get_voltage(opp); + rcu_read_unlock(); if (!bootup_volt) {printk(KERN_ERR "%s: unable to find voltage corresponding" "to the bootup OPP for vdd_%s\n",
__func__,vdd_name);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html