All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] MIPS: Add CONFIG_SKIP_LOWLEVEL_INIT and flush dcache upon relocation
Date: Sun, 16 Nov 2008 15:45:43 +0900	[thread overview]
Message-ID: <491FC197.2070306@ruby.dti.ne.jp> (raw)
In-Reply-To: <1226492257-27730-1-git-send-email-sr@denx.de>

Hi Stefan,

Stefan Roese wrote:
> This patch adds the CONFIG_SKIP_LOWLEVEL_INIT option to start.S. This
> enables support for boards where the lowlevel initialization is
> already done when U-Boot runs (e.g. via OnChip ROM).
> 
> Also the data cache will be flushed upon relocation. This is missing
> in the current implementation.
> 
> All this will be used in the upcoming VCTH board support.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
>  cpu/mips/start.S |   19 ++++++++++++++++++-
>  1 files changed, 18 insertions(+), 1 deletions(-)

sorry for my late reply.  Please find the comments below.

> diff --git a/cpu/mips/start.S b/cpu/mips/start.S
> index 6a22302..5b71b00 100644
> --- a/cpu/mips/start.S
> +++ b/cpu/mips/start.S
> @@ -243,9 +243,11 @@ reset:
>  	mtc0	zero, CP0_COUNT
>  	mtc0	zero, CP0_COMPARE
>  
> +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT)
>  	/* CONFIG0 register */
>  	li	t0, CONF_CM_UNCACHED
>  	mtc0	t0, CP0_CONFIG
> +#endif /* !CONFIG_SKIP_LOWLEVEL_INIT */
>  
>  	/* Initialize $gp.
>  	 */

It might be preferable to remove the /* CONFIG_SKIP_LOWLEVEL_INIT */
comment for better readability, IMHO.

> @@ -323,6 +327,14 @@ relocate_code:
>  	 * t1 = target address
>  	 * t2 = source end address
>  	 */
> +
> +	/*
> +	 * Save destination address and size for later usage in flush_cache()
> +	 */
> +	move	t7, a1		/* save gd in t7		*/
> +	move	a0, t1		/* a0 <-- destination addr	*/
> +	sub	a1, t2, t0	/* a1 <-- size			*/
> +
>  	/* On the purple board we copy the code earlier in a special way
>  	 * in order to solve flash problems
>  	 */
> @@ -338,6 +350,11 @@ relocate_code:
>  	/* If caches were enabled, we would have to flush them here.
>  	 */
>  
> +	/* a0 & a1 are already set up for flush_cache(start, size) */
> +	la	t9, flush_cache
> +	jalr	t9
> +	nop
> +
>  	/* Jump to where we've relocated ourselves.
>  	 */
>  	addi	t0, a2, in_ram - _start
> @@ -387,7 +404,7 @@ in_ram:
>  	bltl	t1, t2, 1b
>  	sw	zero, 0(t1)	/* delay slot			*/
>  
> -	move	a0, a1
> +	move	a0, t7		/* a0 <-- gd			*/
>  	la	t9, board_init_r
>  	jr	t9
>  	move	a1, a2		/* delay slot			*/

- Could we separate this flush_cache patch from this patch?

- Please use save register, s[0-7], instead of t7, since t7 register
  might be overwritten with another value in flush_cache().
  Furthermore, in this case, a2 should be saved as well.


Thanks,

  Shinya

  reply	other threads:[~2008-11-16  6:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 12:17 [U-Boot] [PATCH] MIPS: Add CONFIG_SKIP_LOWLEVEL_INIT and flush dcache upon relocation Stefan Roese
2008-11-16  6:45 ` Shinya Kuribayashi [this message]
2008-11-17 13:54   ` Stefan Roese
2008-11-18  2:31     ` Shinya Kuribayashi

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=491FC197.2070306@ruby.dti.ne.jp \
    --to=skuribay@ruby.dti.ne.jp \
    --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.