All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: jbrunet@baylibre.com, narmstrong@baylibre.com,
	linux-amlogic@lists.infradead.org
Cc: mturquette@baylibre.com, sboyd@kernel.org, carlo@caione.org,
	khilman@baylibre.com, linux-clk@vger.kernel.org,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs
Date: Sat, 28 Apr 2018 15:23:16 +0200	[thread overview]
Message-ID: <20180428132316.20108-1-martin.blumenstingl@googlemail.com> (raw)

Until recently the clk-mpll implementation always used
DIV_ROUND_UP_ULL(). However, since commit 1b0e500dc606e9 ("clk: meson:
mpll: add round closest support") the default was changed to round down
the SDM divisor.
This broke RGMII Ethernet on Meson8b (which uses MPLL2 as RGMII TX
clock). With the old implementation the MPLL2 output was 249999701Hz,
but with "round closest" disabled the output is 212500000Hz.

Enabling CLK_MESON_MPLL_ROUND_CLOSEST for all MPLL2 clocks on Meson8b
fixes this because we now get the same 249999701Hz from MPLL2 as before.

Fixes: 1b0e500dc606e9 ("clk: meson: mpll: add round closest support")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/clk/meson/meson8b.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index d0524ec71aad..2639a892a5d4 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -382,6 +382,7 @@ static struct clk_regmap meson8b_mpll0_div = {
 			.width   = 1,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll0_div",
@@ -423,6 +424,7 @@ static struct clk_regmap meson8b_mpll1_div = {
 			.width   = 9,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll1_div",
@@ -464,6 +466,7 @@ static struct clk_regmap meson8b_mpll2_div = {
 			.width   = 9,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll2_div",
-- 
2.17.0

WARNING: multiple messages have this Message-ID (diff)
From: martin.blumenstingl@googlemail.com (Martin Blumenstingl)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs
Date: Sat, 28 Apr 2018 15:23:16 +0200	[thread overview]
Message-ID: <20180428132316.20108-1-martin.blumenstingl@googlemail.com> (raw)

Until recently the clk-mpll implementation always used
DIV_ROUND_UP_ULL(). However, since commit 1b0e500dc606e9 ("clk: meson:
mpll: add round closest support") the default was changed to round down
the SDM divisor.
This broke RGMII Ethernet on Meson8b (which uses MPLL2 as RGMII TX
clock). With the old implementation the MPLL2 output was 249999701Hz,
but with "round closest" disabled the output is 212500000Hz.

Enabling CLK_MESON_MPLL_ROUND_CLOSEST for all MPLL2 clocks on Meson8b
fixes this because we now get the same 249999701Hz from MPLL2 as before.

Fixes: 1b0e500dc606e9 ("clk: meson: mpll: add round closest support")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/clk/meson/meson8b.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index d0524ec71aad..2639a892a5d4 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -382,6 +382,7 @@ static struct clk_regmap meson8b_mpll0_div = {
 			.width   = 1,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll0_div",
@@ -423,6 +424,7 @@ static struct clk_regmap meson8b_mpll1_div = {
 			.width   = 9,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll1_div",
@@ -464,6 +466,7 @@ static struct clk_regmap meson8b_mpll2_div = {
 			.width   = 9,
 		},
 		.lock = &meson_clk_lock,
+		.flags = CLK_MESON_MPLL_ROUND_CLOSEST,
 	},
 	.hw.init = &(struct clk_init_data){
 		.name = "mpll2_div",
-- 
2.17.0

             reply	other threads:[~2018-04-28 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-28 13:23 Martin Blumenstingl [this message]
2018-04-28 13:23 ` [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs Martin Blumenstingl
2018-04-28 15:01 ` Jerome Brunet
2018-04-28 15:01   ` Jerome Brunet
2018-05-15 14:48   ` Jerome Brunet
2018-05-15 14:48     ` Jerome Brunet

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=20180428132316.20108-1-martin.blumenstingl@googlemail.com \
    --to=martin.blumenstingl@googlemail.com \
    --cc=carlo@caione.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=narmstrong@baylibre.com \
    --cc=sboyd@kernel.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 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.