* [PATCH] imx8ulp: clock: Fix lcd clock algo
@ 2022-03-31 10:39 Loic Poulain
2022-04-07 3:12 ` Peng Fan (OSS)
2022-04-21 12:26 ` sbabic
0 siblings, 2 replies; 3+ messages in thread
From: Loic Poulain @ 2022-03-31 10:39 UTC (permalink / raw)
To: sbabic, festevam; +Cc: u-boot, alice.guo, uboot-imx, ye.li, Loic Poulain
The div loop uses reassign and reuse parent_rate, which causes
the parent rate reference to be wrong after the first loop, the
resulting clock becomes incorrect for div != 1.
Fixes: 829e06bf4175 ("imx8ulp: clock: Add MIPI DSI clock and DCNano clock")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
arch/arm/mach-imx/imx8ulp/clock.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c
index 91580b2..dbe0f78 100644
--- a/arch/arm/mach-imx/imx8ulp/clock.c
+++ b/arch/arm/mach-imx/imx8ulp/clock.c
@@ -381,10 +381,9 @@ void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz)
debug("PLL4 rate %ukhz\n", pll4_rate);
for (pfd = 12; pfd <= 35; pfd++) {
- parent_rate = pll4_rate;
- parent_rate = parent_rate * 18 / pfd;
-
for (div = 1; div <= 64; div++) {
+ parent_rate = pll4_rate;
+ parent_rate = parent_rate * 18 / pfd;
parent_rate = parent_rate / div;
for (pcd = 0; pcd < 8; pcd++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] imx8ulp: clock: Fix lcd clock algo
2022-03-31 10:39 [PATCH] imx8ulp: clock: Fix lcd clock algo Loic Poulain
@ 2022-04-07 3:12 ` Peng Fan (OSS)
2022-04-21 12:26 ` sbabic
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2022-04-07 3:12 UTC (permalink / raw)
To: Loic Poulain, sbabic, festevam; +Cc: u-boot, Alice Guo, dl-uboot-imx, Ye Li
On 2022/3/31 18:39, Loic Poulain wrote:
> The div loop uses reassign and reuse parent_rate, which causes
> the parent rate reference to be wrong after the first loop, the
> resulting clock becomes incorrect for div != 1.
>
> Fixes: 829e06bf4175 ("imx8ulp: clock: Add MIPI DSI clock and DCNano clock")
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
> arch/arm/mach-imx/imx8ulp/clock.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c
> index 91580b2..dbe0f78 100644
> --- a/arch/arm/mach-imx/imx8ulp/clock.c
> +++ b/arch/arm/mach-imx/imx8ulp/clock.c
> @@ -381,10 +381,9 @@ void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz)
> debug("PLL4 rate %ukhz\n", pll4_rate);
>
> for (pfd = 12; pfd <= 35; pfd++) {
> - parent_rate = pll4_rate;
> - parent_rate = parent_rate * 18 / pfd;
> -
> for (div = 1; div <= 64; div++) {
> + parent_rate = pll4_rate;
> + parent_rate = parent_rate * 18 / pfd;
> parent_rate = parent_rate / div;
>
> for (pcd = 0; pcd < 8; pcd++) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] imx8ulp: clock: Fix lcd clock algo
2022-03-31 10:39 [PATCH] imx8ulp: clock: Fix lcd clock algo Loic Poulain
2022-04-07 3:12 ` Peng Fan (OSS)
@ 2022-04-21 12:26 ` sbabic
1 sibling, 0 replies; 3+ messages in thread
From: sbabic @ 2022-04-21 12:26 UTC (permalink / raw)
To: Loic Poulain, u-boot
> The div loop uses reassign and reuse parent_rate, which causes
> the parent rate reference to be wrong after the first loop, the
> resulting clock becomes incorrect for div != 1.
> Fixes: 829e06bf4175 ("imx8ulp: clock: Add MIPI DSI clock and DCNano clock")
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-21 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 10:39 [PATCH] imx8ulp: clock: Fix lcd clock algo Loic Poulain
2022-04-07 3:12 ` Peng Fan (OSS)
2022-04-21 12:26 ` sbabic
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.