* [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs
@ 2018-04-28 13:23 ` Martin Blumenstingl
0 siblings, 0 replies; 6+ messages in thread
From: Martin Blumenstingl @ 2018-04-28 13:23 UTC (permalink / raw)
To: linus-amlogic
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
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs @ 2018-04-28 13:23 ` Martin Blumenstingl 0 siblings, 0 replies; 6+ messages in thread From: Martin Blumenstingl @ 2018-04-28 13:23 UTC (permalink / raw) To: jbrunet, narmstrong, linux-amlogic Cc: mturquette, sboyd, carlo, khilman, linux-clk, Martin Blumenstingl 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs 2018-04-28 13:23 ` Martin Blumenstingl @ 2018-04-28 15:01 ` Jerome Brunet -1 siblings, 0 replies; 6+ messages in thread From: Jerome Brunet @ 2018-04-28 15:01 UTC (permalink / raw) To: linus-amlogic On Sat, 2018-04-28 at 15:23 +0200, Martin Blumenstingl wrote: > 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. It should either be rounding up or down, not down or 'more down' I guess I need to revisit this series. In the mean time, I'll drop it. Thanks for reporting the issue > > 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", ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs @ 2018-04-28 15:01 ` Jerome Brunet 0 siblings, 0 replies; 6+ messages in thread From: Jerome Brunet @ 2018-04-28 15:01 UTC (permalink / raw) To: Martin Blumenstingl, narmstrong, linux-amlogic Cc: mturquette, sboyd, carlo, khilman, linux-clk On Sat, 2018-04-28 at 15:23 +0200, Martin Blumenstingl wrote: > 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. It should either be rounding up or down, not down or 'more down' I guess I need to revisit this series. In the mean time, I'll drop it. Thanks for reporting the issue > > 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", ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs 2018-04-28 15:01 ` Jerome Brunet @ 2018-05-15 14:48 ` Jerome Brunet -1 siblings, 0 replies; 6+ messages in thread From: Jerome Brunet @ 2018-05-15 14:48 UTC (permalink / raw) To: linus-amlogic On Sat, 2018-04-28 at 17:01 +0200, Jerome Brunet wrote: > On Sat, 2018-04-28 at 15:23 +0200, Martin Blumenstingl wrote: > > 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. > > It should either be rounding up or down, not down or 'more down' > I guess I need to revisit this series. In the mean time, I'll drop it. > Thanks for reporting the issue Hi Martin, I think I found the problem in the mpll round closest code. It does not seem to be a 32bit overflow, as we had before. Apparently, I got confused with rounding up and down stuff :( I'll post a v2 soon. I'll wait for your feedback before applying it this time Thanks again for reporting the issue. Cheers Jerome > > > > > 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", > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH meson-clk-next] clk: meson: meson8b: enable CLK_MESON_MPLL_ROUND_CLOSEST for all MPLLs @ 2018-05-15 14:48 ` Jerome Brunet 0 siblings, 0 replies; 6+ messages in thread From: Jerome Brunet @ 2018-05-15 14:48 UTC (permalink / raw) To: Martin Blumenstingl, narmstrong, linux-amlogic Cc: mturquette, sboyd, carlo, khilman, linux-clk On Sat, 2018-04-28 at 17:01 +0200, Jerome Brunet wrote: > On Sat, 2018-04-28 at 15:23 +0200, Martin Blumenstingl wrote: > > 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. > > It should either be rounding up or down, not down or 'more down' > I guess I need to revisit this series. In the mean time, I'll drop it. > Thanks for reporting the issue Hi Martin, I think I found the problem in the mpll round closest code. It does not seem to be a 32bit overflow, as we had before. Apparently, I got confused with rounding up and down stuff :( I'll post a v2 soon. I'll wait for your feedback before applying it this time Thanks again for reporting the issue. Cheers Jerome > > > > > 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", > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-15 14:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 13:23 ` 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
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.