Skip to content

Commit dd5e743

Browse files
Shubhrajyoti Dattabebarino
authored andcommitted
clk: clocking-wizard: Fix the reconfig for 5.2
The 5.2 the reconfig is triggered by writing 7 followed by 2 to the reconfig reg. Add the same. Also 6.0 is backward compatible so it should be fine. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/20220411100443.15132-5-shubhrajyoti.datta@xilinx.com Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 787dddd commit dd5e743

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/clk/xilinx/clk-xlnx-clock-wizard.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#define WZRD_DR_INIT_REG_OFFSET 0x25C
4545
#define WZRD_DR_DIV_TO_PHASE_OFFSET 4
4646
#define WZRD_DR_BEGIN_DYNA_RECONF 0x03
47+
#define WZRD_DR_BEGIN_DYNA_RECONF_5_2 0x07
48+
#define WZRD_DR_BEGIN_DYNA_RECONF1_5_2 0x02
4749

4850
#define WZRD_USEC_POLL 10
4951
#define WZRD_TIMEOUT_POLL 1000
@@ -165,7 +167,9 @@ static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate,
165167
goto err_reconfig;
166168

167169
/* Initiate reconfiguration */
168-
writel(WZRD_DR_BEGIN_DYNA_RECONF,
170+
writel(WZRD_DR_BEGIN_DYNA_RECONF_5_2,
171+
divider->base + WZRD_DR_INIT_REG_OFFSET);
172+
writel(WZRD_DR_BEGIN_DYNA_RECONF1_5_2,
169173
divider->base + WZRD_DR_INIT_REG_OFFSET);
170174

171175
/* Check status register */
@@ -224,7 +228,7 @@ static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate,
224228
struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw);
225229
void __iomem *div_addr = divider->base + divider->offset;
226230

227-
rate_div = ((parent_rate * 1000) / rate);
231+
rate_div = DIV_ROUND_DOWN_ULL(parent_rate * 1000, rate);
228232
clockout0_div = rate_div / 1000;
229233

230234
pre = DIV_ROUND_CLOSEST((parent_rate * 1000), rate);
@@ -246,7 +250,9 @@ static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate,
246250
return err;
247251

248252
/* Initiate reconfiguration */
249-
writel(WZRD_DR_BEGIN_DYNA_RECONF,
253+
writel(WZRD_DR_BEGIN_DYNA_RECONF_5_2,
254+
divider->base + WZRD_DR_INIT_REG_OFFSET);
255+
writel(WZRD_DR_BEGIN_DYNA_RECONF1_5_2,
250256
divider->base + WZRD_DR_INIT_REG_OFFSET);
251257

252258
/* Check status register */

0 commit comments

Comments
 (0)