All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenyou.Yang at microchip.com <Wenyou.Yang@microchip.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] [RFC] at91: SPL clock fix for AT91SAM9G15	based boards.
Date: Sun, 18 Sep 2016 02:19:55 +0000	[thread overview]
Message-ID: <F9F4555C4E01D7469D37975B62D0EFBB3D8D83@CHN-SV-EXMX07.mchp-main.com> (raw)
In-Reply-To: <1471418009-12660-7-git-send-email-hs@denx.de>

Hi Heiko,

> -----Original Message-----
> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Heiko
> Schocher
> Sent: 2016?8?17? 15:13
> To: U-Boot Mailing List <u-boot@lists.denx.de>
> Cc: Bo Shen <voice.shen@atmel.com>
> Subject: [U-Boot] [PATCH 6/6] [RFC] at91: SPL clock fix for AT91SAM9G15
> based boards.
> 
> on a at91sam9g15 basd board I need another MOR register init as common for
> at91 based boards. Changes:
> MM
> - set AT91_PMC_MOR_KEY to 0x37, without this writting has
>   no effect to tthis register.
> - AT91_PMC_MOR_OSCOUNT to 0
> - set AT91_PMC_MOR_MOSCEN and AT91_PMC_MOR_MOSCSEL
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> 
> ---
> I post this as a RFC patch, because this settings may break other boards ... so if
> this is not a valid common setting, I propose to make this setting board
> configurable through a weak function ...
> 
>  arch/arm/mach-at91/spl_at91.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/spl_at91.c b/arch/arm/mach-at91/spl_at91.c index
> cc3341a..4d8ed26 100644
> --- a/arch/arm/mach-at91/spl_at91.c
> +++ b/arch/arm/mach-at91/spl_at91.c
> @@ -31,13 +31,20 @@ static void enable_ext_reset(void)  void
> lowlevel_clock_init(void)  {
>  	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
> +	u32 tmp;
> 
>  	if (!(readl(&pmc->sr) & AT91_PMC_MOSCS)) {
> -		/* Enable Main Oscillator */
> -		writel(AT91_PMC_MOSCS | (0x40 << 8), &pmc->mor);
> +		tmp = readl(&pmc->mor);
> +		tmp &= ~AT91_PMC_MOR_OSCOUNT(0xff);
> +		tmp &= ~AT91_PMC_MOR_KEY(0xff);
> +		tmp |= AT91_PMC_MOR_MOSCEN;
> +		tmp |= AT91_PMC_MOR_MOSCSEL;
> +		tmp |= AT91_PMC_MOR_OSCOUNT(0);
> +		tmp |= AT91_PMC_MOR_KEY(0x37);
> +		writel(tmp, &pmc->mor);

I think, it needs two steps to configure  the CKGR_MOR register.
1./ set AT91_PMC_MOR_MOSCEN, then wait to check the MOSCXTS bit of the PMC Status Register.
2./ set AT91_PMC_MOR_MOSCSEL, then wait for check the MOSCSLES bit of the PMC Status Register.

AT91_PMC_MOR_OSCOUNT should not be set 0.

> 
>  		/* Wait until Main Oscillator is stable */
> -		while (!(readl(&pmc->sr) & AT91_PMC_MOSCS))
> +		while (!(readl(&pmc->sr) & AT91_PMC_IXR_MOSCS))
>  			;
>  	}
> 
> --
> 2.5.5
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


Best Regards,
Wenyou Yang

  reply	other threads:[~2016-09-18  2:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17  7:13 [U-Boot] [PATCH 0/6] at91: at91sam9g15 improvements Heiko Schocher
2016-08-17  7:13 ` [U-Boot] [PATCH 1/6] arm: at91: mpddrc: add missing MPDDRC_MD defines Heiko Schocher
2016-09-18  2:07   ` Wenyou.Yang at microchip.com
2016-10-06 21:07   ` Andreas Bießmann
2016-10-28 16:49   ` [U-Boot] [U-Boot, " Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 2/6] ARM: at91: clock: correct PRES offset for at91sam9x5 Heiko Schocher
2016-09-18  2:11   ` Wenyou.Yang at microchip.com
2016-10-06 21:40   ` Andreas Bießmann
2016-10-28  9:47   ` [U-Boot] [U-Boot, " Andreas Bießmann
2016-10-28 16:49   ` Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 3/6] arm, at91: add icache support Heiko Schocher
2016-08-18  3:45   ` Simon Glass
2016-10-06 21:58   ` Andreas Bießmann
2016-10-28 16:49   ` [U-Boot] [U-Boot,3/6] " Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 4/6] arm, at91: add some missing fields in PIO struct Heiko Schocher
2016-09-18  2:09   ` Wenyou.Yang at microchip.com
2016-10-06 22:06   ` Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 5/6] at91: add function to set IO drive Heiko Schocher
2016-09-18  2:05   ` Wenyou.Yang at microchip.com
2016-10-06 22:11   ` Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 6/6] [RFC] at91: SPL clock fix for AT91SAM9G15 based boards Heiko Schocher
2016-09-18  2:19   ` Wenyou.Yang at microchip.com [this message]
2016-10-06 22:34   ` Andreas Bießmann
2016-09-30  5:14 ` [U-Boot] [PATCH 0/6] at91: at91sam9g15 improvements Heiko Schocher

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=F9F4555C4E01D7469D37975B62D0EFBB3D8D83@CHN-SV-EXMX07.mchp-main.com \
    --to=wenyou.yang@microchip.com \
    --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.