Paul Cercueil
ecfb9f4047
clk: ingenic: jz4760: Update M/N/OD calculation algorithm
...
The previous algorithm was pretty broken.
- The inner loop had a '(m > m_max)' condition, and the value of 'm'
would increase in each iteration;
- Each iteration would actually multiply 'm' by two, so it is not needed
to re-compute the whole equation at each iteration;
- It would loop until (m & 1) == 0, which means it would loop at most
once.
- The outer loop would divide the 'n' value by two at the end of each
iteration. This meant that for a 12 MHz parent clock and a 1.2 GHz
requested clock, it would first try n=12, then n=6, then n=3, then
n=1, none of which would work; the only valid value is n=2 in this
case.
Simplify this algorithm with a single for loop, which decrements 'n'
after each iteration, addressing all of the above problems.
Fixes: bdbfc02937 ("clk: ingenic: Add support for the JZ4760")
Cc: <stable@vger.kernel.org >
Signed-off-by: Paul Cercueil <paul@crapouillou.net >
Link: https://lore.kernel.org/r/20221214123704.7305-1-paul@crapouillou.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org >
2023-01-25 16:08:27 -08:00
..
2022-04-22 19:01:20 -07:00
2021-07-02 12:08:10 -07:00
2022-11-17 15:35:52 +02:00
2022-03-11 18:22:15 -08:00
2022-06-10 14:51:35 +02:00
2022-09-30 14:20:56 -07:00
2022-10-28 13:03:19 +02:00
2022-08-19 14:50:24 -07:00
2022-10-04 10:54:14 -07:00
2022-03-29 10:19:10 -07:00
2022-11-25 11:22:15 +02:00
2023-01-25 16:08:27 -08:00
2022-10-17 16:08:17 -07:00
2022-03-11 18:13:24 -08:00
2022-12-12 11:13:28 -08:00
2022-12-12 11:12:52 -08:00
2023-01-19 11:45:35 +02:00
2022-09-30 13:34:07 -07:00
2022-10-27 11:44:27 -07:00
2022-09-30 17:46:30 -07:00
2022-10-03 12:34:32 -07:00
2022-09-28 18:35:45 -07:00
2022-10-03 12:32:03 -07:00
2022-12-12 11:13:28 -08:00
2022-02-15 17:06:37 +01:00
2022-11-16 09:05:59 +01:00
2022-12-12 11:13:08 -08:00
2022-12-12 11:12:26 -08:00
2022-10-17 14:07:11 -07:00
2022-12-13 13:46:07 -08:00
2022-11-22 18:03:52 -08:00
2022-10-04 10:54:14 -07:00
2022-12-07 18:27:11 -08:00
2022-03-10 18:17:33 -08:00
2022-06-09 15:34:08 -07:00
2022-07-04 21:59:30 +02:00
2022-11-16 19:49:18 +01:00
2022-11-19 02:00:32 +01:00
2022-11-22 17:04:20 -08:00
2022-03-11 19:29:02 -08:00
2022-05-18 13:34:03 -07:00
2021-12-07 12:25:29 -08:00
2022-11-29 12:11:00 -08:00
2022-10-26 17:39:33 -07:00
2022-10-17 15:30:00 -07:00
2022-03-29 10:17:49 -07:00
2022-08-30 15:05:59 -07:00
2022-07-14 10:35:44 -06:00
2022-10-10 20:37:50 -07:00
2022-03-15 09:56:12 -07:00
2022-09-29 17:55:26 -07:00
2022-10-03 14:12:15 -07:00
2021-02-08 18:13:13 -08:00
2021-06-27 18:42:45 -07:00
2022-01-06 17:46:56 -08:00
2022-10-17 16:07:51 -07:00
2022-08-16 12:46:26 +02:00
2022-10-17 16:06:49 -07:00
2022-03-11 18:13:24 -08:00
2022-09-15 09:32:11 -07:00
2022-08-16 12:46:26 +02:00
2022-06-22 16:10:23 -07:00
2022-09-15 09:31:40 -07:00
2022-04-26 11:17:47 -07:00
2022-07-29 16:44:08 -07:00
2021-02-11 11:56:05 -08:00
2022-09-29 17:55:29 -07:00
2022-11-22 18:19:39 -08:00
2021-08-12 12:42:00 -07:00
2020-12-07 16:56:41 -08:00
2020-12-07 14:06:16 -08:00
2022-01-24 17:22:53 -08:00
2021-12-08 11:19:20 +01:00
2021-12-02 17:27:48 -08:00
2022-06-10 14:51:35 +02:00
2021-06-30 11:34:36 -07:00
2022-10-03 14:14:02 -07:00
2022-12-08 17:18:43 -08:00
2022-08-22 16:04:00 -07:00
2022-04-22 19:28:08 -07:00
2022-06-10 14:51:35 +02:00
2022-04-25 15:49:20 -07:00
2022-12-09 10:26:25 -08:00
2022-09-28 17:39:04 -07:00
2022-08-19 14:35:43 -07:00
2021-08-05 17:34:30 -07:00
2020-12-10 12:24:18 -08:00
2022-08-19 14:41:47 -07:00
2022-10-17 14:06:07 -07:00
2020-12-19 15:53:31 -08:00
2022-02-21 10:37:00 +00:00
2020-12-10 12:24:40 -08:00
2022-08-16 12:46:26 +02:00
2022-04-22 19:28:08 -07:00
2022-08-16 12:46:26 +02:00
2022-08-16 12:46:26 +02:00
2022-08-16 12:46:26 +02:00
2021-11-02 14:29:17 -07:00
2021-12-15 22:45:48 -08:00
2021-08-05 17:36:10 -07:00
2022-10-27 17:01:16 -07:00
2022-09-24 19:12:32 +02:00
2022-11-22 17:52:07 -08:00
2022-10-08 10:06:48 -07:00
2022-10-03 14:13:29 -07:00
2022-12-12 11:13:28 -08:00
2022-09-30 14:50:11 -07:00
2022-10-04 10:54:34 -07:00
2022-09-30 17:34:35 -07:00