Skip to contentSkip to conversation

mxs_ocotp: Shift the HBUS divider correctly

PATCH New Marek Vasut 2 participants 2 messages Jul 12, 2015 – Aug 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mxs_ocotp: Shift the HBUS divider correctly

From: Chris Smith <[email protected]>

When the original HBUS divider value is retrieved in mxs_ocotp_scale_hclk() for the purpose or restoring it back later, the value is not shifted by the HBUS divider offset in that register. This is not a problem, since the shift is zero on all MXS hardware. Add the shift anyway, for completeness and in case FSL ever decides to re-use this driver on future designs.

---
 drivers/misc/mxs_ocotp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/mxs_ocotp.c +1 -0
index 6f0a1d3..6c0d247 100644
@@ -152,6 +152,7 @@ static int mxs_ocotp_scale_hclk(bool enter, uint32_t *val)
 		/* Return the original HCLK clock speed. */
 		*val = readl(&clkctrl_regs->hw_clkctrl_hbus);
 		*val &= CLKCTRL_HBUS_DIV_MASK;
+		*val >>= CLKCTRL_HBUS_DIV_OFFSET;
 
 		/* Scale the HCLK to 454/19 = 23.9 MHz . */
 		scale_val = (~19) << CLKCTRL_HBUS_DIV_OFFSET;
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 mxs_ocotp: Shift the HBUS divider correctly

Quoted 22 lines · Marek Vasut

From: Chris Smith <[email protected]>

When the original HBUS divider value is retrieved in mxs_ocotp_scale_hclk() for the purpose or restoring it back later, the value is not shifted by the HBUS divider offset in that register. This is not a problem, since the shift is zero on all MXS hardware. Add the shift anyway, for completeness and in case FSL ever decides to re-use this driver on future designs.

---
 drivers/misc/mxs_ocotp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/mxs_ocotp.c +0 -0
index 6f0a1d3..6c0d247 100644

drivers/misc/mxs_ocotp.c static int mxs_ocotp_scale_hclk(bool enter, uint32_t *val) · line 158

Quoted 7 lines
drivers/misc/mxs_ocotp.c +1 -0
@@ -152,6 +152,7 @@ static int mxs_ocotp_scale_hclk(bool enter, uint32_t *val)
 		/* Return the original HCLK clock speed. */
 		*val = readl(&clkctrl_regs->hw_clkctrl_hbus);
 		*val &= CLKCTRL_HBUS_DIV_MASK;
+		*val >>= CLKCTRL_HBUS_DIV_OFFSET;
 
 		/* Scale the HCLK to 454/19 = 23.9 MHz . */
 		scale_val = (~19) << CLKCTRL_HBUS_DIV_OFFSET;

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
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 at denx.de
=====================================================================