From: axel.lin@ingics.com (Axel Lin)
To: linux-arm-kernel@lists.infradead.org
Subject: Question about checking rate_spi in pwrap_init_reg_clock
Date: Tue, 21 Apr 2015 09:58:07 +0800 [thread overview]
Message-ID: <1429581487.5994.1.camel@ingics.com> (raw)
hi,
The implementation in pwrap_init_reg_clock seems has off-by-one bug.
If rate_spi is 26000000, current code set ck_mhz to 18 rather than 26.
I guess it needs below fix, but I'm not 100% sure as I don't have the datasheet.
Can someone confirm if this is a bug or not?
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index db5be1e..e910e19 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -568,9 +568,9 @@ static int pwrap_init_reg_clock(struct pmic_wrapper *wrp)
rate_spi = clk_get_rate(wrp->clk_spi);
- if (rate_spi > 26000000)
+ if (rate_spi >= 26000000)
ck_mhz = 26;
- else if (rate_spi > 18000000)
+ else if (rate_spi >= 18000000)
ck_mhz = 18;
else
ck_mhz = 0;
next reply other threads:[~2015-04-21 1:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 1:58 Axel Lin [this message]
2015-04-21 10:31 ` Question about checking rate_spi in pwrap_init_reg_clock Sascha Hauer
2015-04-21 11:43 ` Matthias Brugger
2015-04-21 12:52 ` Sascha Hauer
2015-04-21 15:42 ` Matthias Brugger
2015-05-08 9:33 ` Axel Lin
2015-05-08 9:51 ` Eddie Huang
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=1429581487.5994.1.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).