* [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source
@ 2015-12-13 11:08 Michael Heimpold
2015-12-13 15:41 ` Marek Vasut
2016-01-03 14:57 ` Stefano Babic
0 siblings, 2 replies; 3+ messages in thread
From: Michael Heimpold @ 2015-12-13 11:08 UTC (permalink / raw)
To: u-boot
For some board designs, it might be useful to switch the DC-DC
clock source to something else rather the default 24 MHz, e.g.
for EMI reasons.
For this, override the mxs_power_setup_dcdc_clocksource function
in your board support files.
Example:
void mxs_power_setup_dcdc_clocksource(void)
{
mxs_power_switch_dcdc_clocksource(POWER_MISC_FREQSEL_20MHZ);
}
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes in v3:
- fixed and improved kerneldoc
- renamed mxs_power_select_dcdc_clocksource to mxs_power_switch_dcdc_clocksource
to fit the comment
Changes in v2:
- use a weak function approach instead of ifdef'ery as suggested
by Marek Vasut
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 34 +++++++++++++++++++++++++++++
arch/arm/include/asm/arch-mxs/sys_proto.h | 2 ++
2 files changed, 36 insertions(+)
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index 1972de8..1ec8e2b 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -248,6 +248,39 @@ static void mxs_power_setup_5v_detect(void)
}
/**
+ * mxs_power_switch_dcdc_clocksource() - Switch PLL clock for DC-DC converters
+ * @freqsel: One of the POWER_MISC_FREQSEL_xxx defines to select the clock
+ *
+ * This function configures and then enables an alternative PLL clock source
+ * for the DC-DC converters.
+ */
+void mxs_power_switch_dcdc_clocksource(uint32_t freqsel)
+{
+ struct mxs_power_regs *power_regs =
+ (struct mxs_power_regs *)MXS_POWER_BASE;
+
+ /* Select clocksource for DC-DC converters */
+ clrsetbits_le32(&power_regs->hw_power_misc,
+ POWER_MISC_FREQSEL_MASK,
+ freqsel);
+ setbits_le32(&power_regs->hw_power_misc,
+ POWER_MISC_SEL_PLLCLK);
+}
+
+/**
+ * mxs_power_setup_dcdc_clocksource() - Setup PLL clock source for DC-DC converters
+ *
+ * Normally, there is no need to switch DC-DC clocksource. This is the reason,
+ * why this function is a stub and does nothing. However, boards can implement
+ * this function when required and call mxs_power_switch_dcdc_clocksource() to
+ * switch to an alternative clock source.
+ */
+__weak void mxs_power_setup_dcdc_clocksource(void)
+{
+ debug("SPL: Using default DC-DC clocksource\n");
+}
+
+/**
* mxs_src_power_init() - Preconfigure the power block
*
* This function configures reasonable values for the DC-DC control loop
@@ -872,6 +905,7 @@ static void mxs_power_configure_power_source(void)
debug("SPL: Configuring power source\n");
+ mxs_power_setup_dcdc_clocksource();
mxs_src_power_init();
if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h b/arch/arm/include/asm/arch-mxs/sys_proto.h
index 20ff101..f2b075e 100644
--- a/arch/arm/include/asm/arch-mxs/sys_proto.h
+++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
@@ -25,6 +25,8 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int), int (*cd)(int));
void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr,
const iomux_cfg_t *iomux_setup,
const unsigned int iomux_size);
+
+void mxs_power_switch_dcdc_clocksource(uint32_t freqsel);
#endif
struct mxs_pair {
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source
2015-12-13 11:08 [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source Michael Heimpold
@ 2015-12-13 15:41 ` Marek Vasut
2016-01-03 14:57 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2015-12-13 15:41 UTC (permalink / raw)
To: u-boot
On Sunday, December 13, 2015 at 12:08:37 PM, Michael Heimpold wrote:
> For some board designs, it might be useful to switch the DC-DC
> clock source to something else rather the default 24 MHz, e.g.
> for EMI reasons.
>
> For this, override the mxs_power_setup_dcdc_clocksource function
> in your board support files.
>
> Example:
> void mxs_power_setup_dcdc_clocksource(void)
> {
> mxs_power_switch_dcdc_clocksource(POWER_MISC_FREQSEL_20MHZ);
> }
>
> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Acked-by: Marek Vasut <marex@denx.de>
> Cc: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
[...]
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source
2015-12-13 11:08 [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source Michael Heimpold
2015-12-13 15:41 ` Marek Vasut
@ 2016-01-03 14:57 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2016-01-03 14:57 UTC (permalink / raw)
To: u-boot
On 13/12/2015 12:08, Michael Heimpold wrote:
> For some board designs, it might be useful to switch the DC-DC
> clock source to something else rather the default 24 MHz, e.g.
> for EMI reasons.
>
> For this, override the mxs_power_setup_dcdc_clocksource function
> in your board support files.
>
> Example:
> void mxs_power_setup_dcdc_clocksource(void)
> {
> mxs_power_switch_dcdc_clocksource(POWER_MISC_FREQSEL_20MHZ);
> }
>
> Signed-off-by: Michael Heimpold <mhei@heimpold.de>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> ---
Applied to u-boot-imx, 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 at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-03 14:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-13 11:08 [U-Boot] [PATCH v3] ARM: mxs: allow boards to select DC-DC switching clock source Michael Heimpold
2015-12-13 15:41 ` Marek Vasut
2016-01-03 14:57 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox