All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] ARM: mxs: allow boards to select DC-DC switching clock source
Date: Sat, 12 Dec 2015 02:42:47 +0100	[thread overview]
Message-ID: <201512120242.47750.marex@denx.de> (raw)
In-Reply-To: <1449788736-14609-1-git-send-email-mhei@heimpold.de>

On Friday, December 11, 2015 at 12:05:36 AM, 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.

Can you elaborate on this ? Also, is there gonna be a user for this?

> 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_select_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 v2:
>   - use a weak function approach instead of ifdef'ery as suggested
>     by Marek Vasut
> 
>  arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 31
> +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mxs/sys_proto.h  
> |  2 ++
>  2 files changed, 33 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..64e215c
> 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
> @@ -248,6 +248,36 @@ static void mxs_power_setup_5v_detect(void)
>  }
> 
>  /**
> + * mxs_power_switch_dcdc_clocksource() - Switch PLL clock for DC-DC
> converters + *
> + * This function configures and then enables an alternative PLL clock
> source + * for the DC-DC converters.
> + */
> +void mxs_power_select_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()

Please make sure this is compatible with kerneldoc.

> + * Normally, there is no need to switch DC-DC clocksource. However, boards
> + * can implement this function when required.
> + */
> +__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 +902,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..4160e43 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_select_dcdc_clocksource(uint32_t freqsel);

This function does not need to be exported if it's __weak I believe.

  reply	other threads:[~2015-12-12  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 23:05 [U-Boot] [PATCH v2] ARM: mxs: allow boards to select DC-DC switching clock source Michael Heimpold
2015-12-12  1:42 ` Marek Vasut [this message]
2015-12-12  9:02   ` Michael Heimpold
2015-12-12 15:33     ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201512120242.47750.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.