From: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v02 1/2] OMAP3+: introduce generic ABB support
Date: Mon, 20 May 2013 14:06:38 +0300 [thread overview]
Message-ID: <519A03BE.60902@ti.com> (raw)
In-Reply-To: <20130517131101.GB4892@kahuna>
Hi,
Thank you for review.
On 05/17/2013 04:11 PM, Nishanth Menon wrote:
[snip]
> On 19:49-20130513, Andrii Tseglytskyi wrote:
> [...]
>> + if (fuse && ldovbb) {
>> + if (abb_setup_ldovbb(fuse, ldovbb))
>> + return;
>> + }
>> +
>> + /* configure timings, based on oscillator value */
>> + abb_setup_timings(setup);
> Still missing txdone clear..
> If txdone was set on entry, you'd escape a bit waiting for transition
> completion bit in SR2, However, by clearing TXDONE here, you can just wait
> for TXDONE.
We touch ABB first time here. I can add check/clear txdone here to
double check that everything is fine,
but this may be superfluous.
>> +
>> + /* select ABB type */
>> + clrsetbits_le32(setup,
>> + abb_type_mask | OMAP_ABB_SETUP_SR2EN_MASK,
>> + abb_type_mask | OMAP_ABB_SETUP_SR2EN_MASK);
> This is no better than set_bits! clearbits (addr, clr, set) -> the clr
> bits should clear *all* bits of the field. in this example ABB_TYPE
> should both be cleared, same in OPP_SEL.
> See the following change on top of this series:
Yep. should be:
clrsetbits_le32(setup,
OMAP_ABB_SETUP_ACTIVE_FBB_SEL_MASK
|OMAP_ABB_SETUP_ACTIVE_RBB_SEL_MASK | OMAP_ABB_SETUP_SR2EN_MASK,
abb_type_mask | OMAP_ABB_SETUP_SR2EN_MASK)
But I propose to rework this in the following way:
- at the beginning of setup function clear both ABB registers (setup and
control),
writel(0, setup);
writel(0, control);
- use setbits_le32 everywhere.
This guarantees that there will be no trash values in ABB registers and
increases code readability.
Your opinion?
> diff --git a/arch/arm/cpu/armv7/omap-common/abb.c b/arch/arm/cpu/armv7/omap-common/abb.c
> index 73eadb2..31332fb 100644
> --- a/arch/arm/cpu/armv7/omap-common/abb.c
> +++ b/arch/arm/cpu/armv7/omap-common/abb.c
> @@ -115,14 +115,22 @@ void abb_setup(u32 fuse, u32 ldovbb, u32 setup, u32 control,
> /* configure timings, based on oscillator value */
> abb_setup_timings(setup);
>
> + /*
> + * Clear any pending ABB tranxdones before we wait for txdone.
> + * We do not know the mode in which we have been handed over
> + * the system (warm/cold reboot), ROM code operations etc..
> + * on a cold boot, we do not expect to see this set.
> + */
> + setbits_le32(txdone, OMAP_ABB_MPU_TXDONE_MASK);
> +
> /* select ABB type */
> - clrsetbits_le32(setup,
> - abb_type_mask | OMAP_ABB_SETUP_SR2EN_MASK,
> + clrsetbits_le32(setup, OMAP_ABB_SETUP_ABB_SEL_MASK |
> + OMAP_ABB_SETUP_SR2EN_MASK,
> abb_type_mask | OMAP_ABB_SETUP_SR2EN_MASK);
>
> /* initiate ABB ldo change */
> - clrsetbits_le32(control,
> - opp_sel_mask | OMAP_ABB_CONTROL_OPP_CHANGE_MASK,
> + clrsetbits_le32(control, OMAP_ABB_CONTROL_OPP_SEL_MASK |
> + OMAP_ABB_CONTROL_OPP_CHANGE_MASK,
> opp_sel_mask | OMAP_ABB_CONTROL_OPP_CHANGE_MASK);
>
> /* wait until transition complete */
> diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
> index 4892c0a..c2fc180 100644
> --- a/arch/arm/include/asm/omap_common.h
> +++ b/arch/arm/include/asm/omap_common.h
> @@ -565,13 +565,17 @@ s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb);
> #define OMAP_ABB_NOMINAL_OPP 0
> #define OMAP_ABB_FAST_OPP 1
> #define OMAP_ABB_SLOW_OPP 3
> +#define OMAP_ABB_CONTROL_OPP_SEL_MASK (0x3 << 0)
> #define OMAP_ABB_CONTROL_FAST_OPP_SEL_MASK (0x1 << 0)
> -#define OMAP_ABB_CONTROL_SLOW_OPP_SEL_MASK (0x1 << 1)
> +#define OMAP_ABB_CONTROL_SLOW_OPP_SEL_MASK (0x3 << 0)
> +#define OMAP_ABB_CONTROL_NOMINAL_OPP_SEL_MASK (0x0 << 0)
> #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_ABB_SEL_MASK (OMAP_ABB_SETUP_ACTIVE_RBB_SEL_MASK | \
> + OMAP_ABB_SETUP_ACTIVE_FBB_SEL_MASK)
> #define OMAP_ABB_SETUP_SR2_WTCNT_VALUE_MASK (0xff << 8)
>
> static inline u32 omap_revision(void)
>
>> +
>> + /* initiate ABB ldo change */
>> + clrsetbits_le32(control,
>> + opp_sel_mask | OMAP_ABB_CONTROL_OPP_CHANGE_MASK,
>> + opp_sel_mask | OMAP_ABB_CONTROL_OPP_CHANGE_MASK);
>> +
>> + /* wait until transition complete */
>> + if (!wait_on_value(OMAP_ABB_CONTROL_SR2_IN_TRANSITION_MASK, 0,
>> + (void *)control, LDELAY))
>> + puts("Error: ABB is in transition\n");
> superfluous if you wait for txdone.
Agree. Can be removed.
[snip]
> + /* setup LDOVBB using fused value */
> + clrsetbits_le32(ldovbb, vset, vset);
> here as well -> please why clrbits need to be clearing all field -
> suggest looking in all usages.
This is a mistake :( Should be clrsetbits_le32(ldovbb,
OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset)
Thank you for catching this!
>> +
>> + return 0;
>> +}
>> ____________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
[snip]
Regards,
Andrii
next prev parent reply other threads:[~2013-05-20 11:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 16:49 [U-Boot] [PATCH v02 0/2] OMAP3+: introduce generic Adaptive Body Bias Support Andrii Tseglytskyi
2013-05-13 16:49 ` [U-Boot] [PATCH v02 1/2] OMAP3+: introduce generic ABB support Andrii Tseglytskyi
2013-05-17 13:11 ` Nishanth Menon
2013-05-20 11:06 ` Andrii Tseglytskyi [this message]
2013-05-20 13:51 ` Nishanth Menon
2013-05-13 16:49 ` [U-Boot] [PATCH v02 2/2] OMAP5: add ABB setup for MPU voltage domain Andrii Tseglytskyi
2013-05-17 13:01 ` 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=519A03BE.60902@ti.com \
--to=andrii.tseglytskyi@ti.com \
--cc=u-boot@lists.denx.de \
/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.