public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Weijie Gao <weijie.gao@mediatek.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/3] mips: mt76x8: ddr_cal: Correct dqs_find_min/max implementations
Date: Wed, 15 Apr 2020 15:20:56 +0800	[thread overview]
Message-ID: <1586935256.26858.145.camel@mcddlt001> (raw)
In-Reply-To: <20200306141405.24539-3-sr@denx.de>

On Fri, 2020-03-06 at 15:14 +0100, Stefan Roese wrote:
> The current implementations have some issues detecting the correct
> values:
> 
> dqs_find_max() will return "last passing fieldval + 1" instead of
> "last passing fieldval". Also it will return "maxval + 1" in the
> case that all fieldvals are tested valid (without error).
> 
> dqs_find_min() will not test the "lowest" value because of using ">"
> instead of ">=".
> 
> This patch now rewrites these functions to fix those issues. Also,
> this patch uses the same approach of a for loop in both functions making
> it easier to read and maintain.
> 
> Since the variables are integers now, we can use min()/max(), which
> handles the wrap around case for fieldval=0: return (0 - 1).
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Weijie Gao <weijie.gao@mediatek.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
>  arch/mips/mach-mtmips/ddr_cal.c | 28 ++++++++++------------------
>  1 file changed, 10 insertions(+), 18 deletions(-)
> 

Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>

  reply	other threads:[~2020-04-15  7:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 14:14 [PATCH 1/3] mips: mt76x8: ddr_cal: Rename dqs_test_valid() to dqs_test_error() Stefan Roese
2020-03-06 14:14 ` [PATCH 2/3] mips: mt76x8: ddr_cal: Change types from u32 to int in dqs_find_min/max Stefan Roese
2020-04-15  7:21   ` Weijie Gao
2020-03-06 14:14 ` [PATCH 3/3] mips: mt76x8: ddr_cal: Correct dqs_find_min/max implementations Stefan Roese
2020-04-15  7:20   ` Weijie Gao [this message]
2020-04-15  7:19 ` [PATCH 1/3] mips: mt76x8: ddr_cal: Rename dqs_test_valid() to dqs_test_error() Weijie Gao
2020-04-15  7:46   ` Stefan Roese
2020-04-27 13:38 ` Daniel Schwierzeck

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=1586935256.26858.145.camel@mcddlt001 \
    --to=weijie.gao@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox