OMAP3+: introduce generic Adaptive Body Bias Support
v3 cover OMAP3+: introduce generic Adaptive Body Bias Support
Adaptive Body Biasing (ABB) modulates transistor bias voltages dynamically in order to optimize switching speed versus leakage. Adaptive Body-Bias ldos are present for some voltage domains:
starting with OMAP3630. There are three modes of operation:
* Bypass - the default, it just follows the vdd voltage
* Foward Body-Bias - applies voltage bias to increase transistor performance at the cost of power. Used to operate safely at high OPPs.
* Reverse Body-Bias - applies voltage bias to decrease leakage and save power. Used to save power at lower OPPs.
The application of FBB/RBB technique is determined for each unique device in some process nodes, whereas, they are mandated on other process nodes.
OMAP5 silicon requires ABB to be properly configured on early boot stage. The following patch series adds generic ABB configuration and enables it for OMAP5 silicons.
v02: series contains minor comments fixes.
v03: series contains:
- clearing pending ABB interrupts before beginning of ABB configuration.
- clearing ABB "setup" and "control" registers before beginning of ABB configuration.
- removing superfluous wait on ABB "in transition" done status.
Andrii Tseglytskyi (2):
OMAP3+: introduce generic ABB support
OMAP5: add ABB setup for MPU voltage domain
arch/arm/cpu/armv7/omap-common/Makefile | 1 + arch/arm/cpu/armv7/omap-common/abb.c | 137 ++++++++++++++++++++++++ arch/arm/cpu/armv7/omap-common/clocks-common.c | 9 ++ arch/arm/cpu/armv7/omap5/Makefile | 1 + arch/arm/cpu/armv7/omap5/abb.c | 67 ++++++++++++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 7 ++ arch/arm/include/asm/arch-omap3/omap3.h | 7 ++ arch/arm/include/asm/arch-omap4/omap.h | 7 ++ arch/arm/include/asm/arch-omap5/omap.h | 13 +++ arch/arm/include/asm/omap_common.h | 22 ++++ 10 files changed, 271 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap-common/abb.c create mode 100644 arch/arm/cpu/armv7/omap5/abb.c
Signature · 1 line
1.7.9.5
PATCH v3 1/2 OMAP3+: introduce generic ABB support
Adaptive Body Biasing (ABB) modulates transistor bias voltages dynamically in order to optimize switching speed versus leakage. Adaptive Body-Bias ldos are present for some voltage domains starting with OMAP3630. There are three modes of operation:
* Bypass - the default, it just follows the vdd voltage
* Foward Body-Bias - applies voltage bias to increase transistor performance at the cost of power. Used to operate safely at high OPPs.
* Reverse Body-Bias - applies voltage bias to decrease leakage and save power. Used to save power at lower OPPs.
--- arch/arm/cpu/armv7/omap-common/Makefile | 1 + arch/arm/cpu/armv7/omap-common/abb.c | 137 +++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/omap5/Makefile | 1 + arch/arm/cpu/armv7/omap5/abb.c | 67 +++++++++++++++ arch/arm/include/asm/arch-omap3/omap3.h | 7 ++ arch/arm/include/asm/arch-omap4/omap.h | 7 ++ arch/arm/include/asm/arch-omap5/omap.h | 13 +++ arch/arm/include/asm/omap_common.h | 22 +++++ 8 files changed, 255 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap-common/abb.c create mode 100644 arch/arm/cpu/armv7/omap5/abb.c
arch/arm/cpu/armv7/omap-common/Makefile +1 -0
@@ -34,6 +34,7 @@ COBJS += hwinit-common.o COBJS += clocks-common.o COBJS += emif-common.o COBJS += vc.o +COBJS += abb.o endif ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TI814X),)
arch/arm/cpu/armv7/omap-common/abb.c new file +137 -0
137 lines not on this page · raw message
arch/arm/cpu/armv7/omap5/Makefile +1 -0
@@ -30,6 +30,7 @@ COBJS += emif.o COBJS += sdram.o COBJS += prcm-regs.o COBJS += hw_data.o +COBJS += abb.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/omap5/abb.c new file +67 -0
67 lines not on this page · raw message
arch/arm/include/asm/arch-omap3/omap3.h +7 -0
@@ -253,4 +253,11 @@ struct gpio {#define OMAP3_EMU_HAL_START_HAL_CRITICAL 4 +/* ABB settings */ +#define OMAP_ABB_SETTLING_TIME 30 +#define OMAP_ABB_CLOCK_CYCLES 8 + +/* ABB tranxdone mask */ +#define OMAP_ABB_MPU_TXDONE_MASK (0x1 << 26) +#endif
arch/arm/include/asm/arch-omap4/omap.h +7 -0
@@ -170,6 +170,13 @@ struct s32ktimer {#define CH_FLAGS_CHFLASH (0x1 << 2)#define CH_FLAGS_CHMMCSD (0x1 << 3) +/* ABB settings */ +#define OMAP_ABB_SETTLING_TIME 50 +#define OMAP_ABB_CLOCK_CYCLES 16 + +/* ABB tranxdone mask */ +#define OMAP_ABB_MPU_TXDONE_MASK (0x1 << 7) + #ifndef __ASSEMBLY__ struct omap_boot_parameters { char *boot_message;
arch/arm/include/asm/arch-omap5/omap.h +13 -0
@@ -243,6 +243,19 @@ struct s32ktimer {#define SRCODE_OVERRIDE_SEL_XS_SHIFT 0#define SRCODE_OVERRIDE_SEL_XS_MASK (1 << 0) +/* ABB settings */ +#define OMAP_ABB_SETTLING_TIME 50 +#define OMAP_ABB_CLOCK_CYCLES 16 + +/* ABB tranxdone mask */ +#define OMAP_ABB_MPU_TXDONE_MASK (0x1 << 7) + +/* ABB efuse masks */ +#define OMAP5_ABB_FUSE_VSET_MASK (0x1F << 24) +#define OMAP5_ABB_FUSE_ENABLE_MASK (0x1 << 29) +#define OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK (0x1 << 10) +#define OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK (0x1f << 0) + #ifndef __ASSEMBLY__ struct srcomp_params { s8 divide_factor;
arch/arm/include/asm/omap_common.h +22 -0
@@ -240,6 +240,8 @@ struct prcm_regs {u32 cm_l3init_fsusb_clkctrl;u32 cm_l3init_ocp2scp1_clkctrl; +u32 prm_irqstatus_mpu_2; +/* cm2.l4per */ u32 cm_l4per_clkstctrl;u32 cm_l4per_dynamicdep;
@@ -325,6 +327,8 @@ struct prcm_regs {u32 prm_sldo_mpu_ctrl;u32 prm_sldo_mm_setup;u32 prm_sldo_mm_ctrl; +u32 prm_abbldo_mpu_setup; +u32 prm_abbldo_mpu_ctrl;u32 cm_div_m4_dpll_core;u32 cm_div_m5_dpll_core;
@@ -347,6 +351,7 @@ struct prcm_regs {struct omap_sys_ctrl_regs {u32 control_status; +u32 control_std_fuse_opp_vdd_mpu_2;u32 control_core_mmr_lock1;u32 control_core_mmr_lock2;u32 control_core_mmr_lock3;
@@ -416,6 +421,7 @@ struct omap_sys_ctrl_regs {u32 control_port_emif2_sdram_config;u32 control_emif1_sdram_config_ext;u32 control_emif2_sdram_config_ext; +u32 control_wkup_ldovbb_mpu_voltage_ctrl;u32 control_smart1nopmio_padconf_0;u32 control_smart1nopmio_padconf_1;u32 control_padconf_mode;
@@ -542,6 +548,9 @@ void enable_non_essential_clocks(void);void scale_vcores (struct vcores_data const *);u32 get_offset_code (u32 volt_offset,struct pmic_data *pmic);void do_scale_vcore (u32 vcore_reg,u32 volt_mv,struct pmic_data *pmic); +void abb_setup (u32 fuse,u32 ldovbb,u32 setup,u32 control, +u32 txdone,u32 txdone_mask,u32 opp); +s8 abb_setup_ldovbb (u32 fuse,u32 ldovbb);/* Max value for DPLL multiplier M */ #define OMAP_DPLL_MAX_N 127
@@ -552,6 +561,19 @@ void do_scale_vcore(u32 vcore_reg, u32 volt_mv, struct pmic_data *pmic);#define OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL 2#define OMAP_INIT_CONTEXT_UBOOT_AFTER_CH 3 +/* ABB */ +#define OMAP_ABB_NOMINAL_OPP 0 +#define OMAP_ABB_FAST_OPP 1 +#define OMAP_ABB_SLOW_OPP 3 +#define OMAP_ABB_CONTROL_FAST_OPP_SEL_MASK (0x1 << 0) +#define OMAP_ABB_CONTROL_SLOW_OPP_SEL_MASK (0x1 << 1) +#define OMAP_ABB_CONTROL_OPP_CHANGE_MASK (0x1 << 2) +#define OMAP_ABB_CONTROL_SR2_IN_TRANSITION_MASK (0x1 << 6) +#define OMAP_ABB_SETUP_SR2EN_MASK (0x1 << 0) +#define OMAP_ABB_SETUP_ACTIVE_FBB_SEL_MASK (0x1 << 2) +#define OMAP_ABB_SETUP_ACTIVE_RBB_SEL_MASK (0x1 << 1) +#define OMAP_ABB_SETUP_SR2_WTCNT_VALUE_MASK (0xff << 8) +static inline u32 omap_revision (void ) {extern u32 *const omap_si_rev;
Signature · 1 line
1.7.9.5
PATCH v3 1/2 OMAP3+: introduce generic ABB support
Hi Andrii,
We are almost there.. minor comments follow:
On 11:42-20130521, Andrii Tseglytskyi wrote:
[...]
arch/arm/cpu/armv7/omap5/abb.c
Quoted 6 lines
arch/arm/cpu/armv7/omap5/abb.c new file +0
-0@@ -0,0 +1,67 @@
I might introduce this as part of patch #2... but no strong feelings about it.
[...]
Quoted 10 lines
arch/arm/cpu/armv7/omap5/abb.c new file +10
-0+s8 abb_setup_ldovbb (u32 fuse,u32 ldovbb) +{ +u32 vset; + +/* +* ABB parameters must be properly fused +* otherwise ABB should be disabled +*/ + vset =readl (fuse); +if (!(vset &OMAP5_ABB_FUSE_ENABLE_MASK ))
arch/arm/cpu/armv7/omap5/abb.c line 64
Quoted 10 lines
arch/arm/cpu/armv7/omap5/abb.c new file +10
-0+return -1 ; + +/* prepare VSET value for LDOVBB mux register */ + vset &=OMAP5_ABB_FUSE_VSET_MASK ; + vset >>=ffs (OMAP5_ABB_FUSE_VSET_MASK ) -1 ; + vset <<=ffs (OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK ) -1 ; + vset |=OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK ; + +/* setup LDOVBB using fused value */ +clrsetbits_le32 (ldovbb,OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK , vset);
OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK wont get set :(
[...]
Other than this, I have no further comments.
Signature · 2 lines
Regards, Nishanth Menon
PATCH v3 1/2 OMAP3+: introduce generic ABB support
Quoted 26 lines · Nishanth Menon
Hi Andrii,
We are almost there.. minor comments follow:
On 11:42-20130521, Andrii Tseglytskyi wrote:
[...]arch/arm/cpu/armv7/omap5/abb.c
Quoted 6 lines
arch/arm/cpu/armv7/omap5/abb.c new file +0
-0@@ -0,0 +1,67 @@I might introduce this as part of patch #2... but no strong feelings about it.
[...]Quoted 13 lines
arch/arm/cpu/armv7/omap5/abb.c new file +13
-0+s8 abb_setup_ldovbb (u32 fuse,u32 ldovbb) +{ +u32 vset; + +/* +* ABB parameters must be properly fused +* otherwise ABB should be disabled +*/ + vset =readl (fuse); +if (!(vset &OMAP5_ABB_FUSE_ENABLE_MASK )) +return -1 ; + +/* prepare VSET value for LDOVBB mux register */
Quoted 8 lines
arch/arm/cpu/armv7/omap5/abb.c line 64
Quoted 7 lines
arch/arm/cpu/armv7/omap5/abb.c new file +7
-0+ vset &=OMAP5_ABB_FUSE_VSET_MASK ; + vset >>=ffs (OMAP5_ABB_FUSE_VSET_MASK ) -1 ; + vset <<=ffs (OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK ) -1 ; + vset |=OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK ; + +/* setup LDOVBB using fused value */ +clrsetbits_le32 (ldovbb,OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK , vset);
OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASKwont get set :(
Sorry didn't get... I have
vset |= *OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK*; <-- set here clrsetbits_le32(ldovbb, OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset);
Maybe it would be more clear to rework to:
clrsetbits_le32(ldovbb, OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset | *OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK*);
Is this your suggestion?
Regards,
Andrii
Quoted 3 lines
[...]
Other than this, I have no further comments.
PATCH v3 1/2 OMAP3+: introduce generic ABB support
Quoted 36 lines · Andrii Tseglytskyi
Quoted 26 lines · Nishanth Menon
Hi Andrii,
We are almost there.. minor comments follow:
On 11:42-20130521, Andrii Tseglytskyi wrote:
[...]arch/arm/cpu/armv7/omap5/abb.c
Quoted 6 lines
arch/arm/cpu/armv7/omap5/abb.c new file +0
-0@@ -0,0 +1,67 @@I might introduce this as part of patch #2... but no strong feelings about it.
[...]Quoted 13 lines
arch/arm/cpu/armv7/omap5/abb.c new file +13
-0+s8 abb_setup_ldovbb (u32 fuse,u32 ldovbb) +{ +u32 vset; + +/* +* ABB parameters must be properly fused +* otherwise ABB should be disabled +*/ + vset =readl (fuse); +if (!(vset &OMAP5_ABB_FUSE_ENABLE_MASK )) +return -1 ; + +/* prepare VSET value for LDOVBB mux register */ Quoted 8 lines
arch/arm/cpu/armv7/omap5/abb.c line 64
Quoted 7 lines
arch/arm/cpu/armv7/omap5/abb.c new file +7
-0+ vset &=OMAP5_ABB_FUSE_VSET_MASK ; + vset >>=ffs (OMAP5_ABB_FUSE_VSET_MASK ) -1 ; + vset <<=ffs (OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK ) -1 ; + vset |=OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK ; + +/* setup LDOVBB using fused value */ +clrsetbits_le32 (ldovbb,OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK , vset);
OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASKwont get set :(
Quoted 4 lines
Sorry didn't get... I have
vset |= *OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK*; <-- set here
clrsetbits_le32(ldovbb, OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset);
define clrsetbits(type, addr, clear, set) \
out_##type((addr), (in_##type(addr) & ~(clear)) | (set))Arrgh.. I missed this :(. I had confused this with *rmw (read modify write) in Linux which would do set &= mask;
My Bad. the patch is doing the right thing.
In short,
Signature · 2 lines
Regards, Nishanth Menon
PATCH v3 1/2 OMAP3+: introduce generic ABB support
In reply to Nishanth MenonQuoted 4 lines · Nishanth Menon
Hi Andrii,
We are almost there.. minor comments follow:
On 11:42-20130521, Andrii Tseglytskyi wrote:
[...]
Quoted 8 lines
arch/arm/cpu/armv7/omap5/abb.c
Quoted 6 lines
arch/arm/cpu/armv7/omap5/abb.c new file +0
-0@@ -0,0 +1,67 @@I might introduce this as part of patch #2... but no strong feelings about it.
I suggest to introduce OMAP5 logic in this patch. Now series is divided to 2 patches:
1. Control logic and needed definitions for all OMAPs -> so after this patch ABB can be used for OMAP3/4/5
2. ABB setup function call (in common code) and ABB registers add to OMAP5 data structures, so ABB will be configured for OMAP5 only in this case.
So, we have -> 1. complete control logic introduction + 2. using previously introduced logic.
I suggest to leave this as is.
Quoted 25 lines
[...]
Quoted 10 lines
arch/arm/cpu/armv7/omap5/abb.c new file +10
-0+s8 abb_setup_ldovbb (u32 fuse,u32 ldovbb) +{ +u32 vset; + +/* +* ABB parameters must be properly fused +* otherwise ABB should be disabled +*/ + vset =readl (fuse); +if (!(vset &OMAP5_ABB_FUSE_ENABLE_MASK ))arch/arm/cpu/armv7/omap5/abb.c line 64
Quoted 10 lines
arch/arm/cpu/armv7/omap5/abb.c new file +10
-0+return -1 ; + +/* prepare VSET value for LDOVBB mux register */ + vset &=OMAP5_ABB_FUSE_VSET_MASK ; + vset >>=ffs (OMAP5_ABB_FUSE_VSET_MASK ) -1 ; + vset <<=ffs (OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK ) -1 ; + vset |=OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK ; + +/* setup LDOVBB using fused value */ +clrsetbits_le32 (ldovbb,OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK , vset);
OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASKwont get set :(
[...]Other than this, I have no further comments.
PATCH v3 2/2 OMAP5: add ABB setup for MPU voltage domain
In reply to Andrii TseglytskyiPatch adds a call of abb_setup() function, and proper registers definitions needed for ABB setup sequence. ABB is initialized for MPU voltage domain.
--- arch/arm/cpu/armv7/omap-common/clocks-common.c | 9 +++++++++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 7 +++++++ 2 files changed, 16 insertions(+)
arch/arm/cpu/armv7/omap-common/clocks-common.c +9 -0
@@ -533,6 +533,15 @@ void scale_vcores(struct vcores_data const *vcores)do_scale_vcore (vcores->mpu.addr, vcores->mpu.value, vcores->mpu.pmic); +/* Configure MPU ABB LDO after scale */ +abb_setup ((*ctrl)->control_std_fuse_opp_vdd_mpu_2, + (*ctrl)->control_wkup_ldovbb_mpu_voltage_ctrl, + (*prcm)->prm_abbldo_mpu_setup, + (*prcm)->prm_abbldo_mpu_ctrl, + (*prcm)->prm_irqstatus_mpu_2, +OMAP_ABB_MPU_TXDONE_MASK , +OMAP_ABB_FAST_OPP ); +do_scale_vcore (vcores->mm.addr, vcores->mm.value, vcores->mm.pmic);
arch/arm/cpu/armv7/omap5/prcm-regs.c +7 -0
@@ -311,6 +311,7 @@ struct prcm_regs const omap5_es1_prcm = {struct omap_sys_ctrl_regs const omap5_ctrl = { .control_status =0x4A002134 , + .control_std_fuse_opp_vdd_mpu_2 =0x4A0021B4 , .control_paconf_global =0x4A002DA0 , .control_paconf_mode =0x4A002DA4 , .control_smart1io_padconf_0 =0x4A002DA8 ,
@@ -358,6 +359,7 @@ struct omap_sys_ctrl_regs const omap5_ctrl = { .control_port_emif2_sdram_config = 0x4AE0C118, .control_emif1_sdram_config_ext = 0x4AE0C144, .control_emif2_sdram_config_ext = 0x4AE0C148, + .control_wkup_ldovbb_mpu_voltage_ctrl = 0x4AE0C318, .control_smart1nopmio_padconf_0 = 0x4AE0CDA0, .control_smart1nopmio_padconf_1 = 0x4AE0CDA4, .control_padconf_mode = 0x4AE0CDA8,
@@ -709,6 +711,9 @@ struct prcm_regs const omap5_es2_prcm = { .cm_l3init_fsusb_clkctrl = 0x4a0096d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0096e0, +/* prm irqstatus regs */ + .prm_irqstatus_mpu_2 = 0x4ae06014, +/* l4 wkup regs */ .cm_abe_pll_ref_clksel = 0x4ae0610c, .cm_sys_clksel = 0x4ae06110,
@@ -739,6 +744,8 @@ struct prcm_regs const omap5_es2_prcm = { .prm_sldo_mpu_ctrl = 0x4ae07cd0, .prm_sldo_mm_setup = 0x4ae07cd4, .prm_sldo_mm_ctrl = 0x4ae07cd8, + .prm_abbldo_mpu_setup = 0x4ae07cdc, + .prm_abbldo_mpu_ctrl = 0x4ae07ce0, };struct prcm_regs const dra7xx_prcm = {
Signature · 1 line
1.7.9.5