mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 10/14] arm: reimplement startup code in C
Date: Wed, 28 Apr 2010 12:04:55 +0200	[thread overview]
Message-ID: <20100428100455.GF7634@pengutronix.de> (raw)
In-Reply-To: <20100428023235.GF19722@game.jcrosoft.org>

On Wed, Apr 28, 2010 at 04:32:35AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:03 Fri 23 Apr     , Sascha Hauer wrote:
> > Lets translate the startup code to a language we all understand better.
> > Tested on pcm038 (arm v5) and pcm043 (arm v6).
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  arch/arm/cpu/Makefile              |    6 +-
> >  arch/arm/cpu/start-arm.S           |  248 ------------------------------------
> >  arch/arm/cpu/start.c               |  107 ++++++++++++++++
> >  arch/arm/include/asm/barebox-arm.h |    3 +
> >  arch/arm/lib/barebox.lds.S         |    2 +-
> >  5 files changed, 112 insertions(+), 254 deletions(-)
> >  delete mode 100644 arch/arm/cpu/start-arm.S
> >  create mode 100644 arch/arm/cpu/start.c
> > 
> > diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
> > index ae1f762..036768e 100644
> > --- a/arch/arm/cpu/Makefile
> > +++ b/arch/arm/cpu/Makefile
> > @@ -1,15 +1,11 @@
> >  obj-y += cpu.o
> >  obj-y += exceptions.o
> >  obj-y += interrupts.o
> > +obj-y += start.o
> >  
> >  #
> >  # Any variants can be called as start-armxyz.S
> >  #
> > -obj-$(CONFIG_CPU_ARM920T) += start-arm.o
> > -obj-$(CONFIG_CPU_ARM926T) += start-arm.o
> > -obj-$(CONFIG_CPU_V7) += start-arm.o
> > -obj-$(CONFIG_ARCH_IMX31) += start-arm.o
> > -obj-$(CONFIG_ARCH_IMX35) += start-arm.o
> >  obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o
> >  obj-$(CONFIG_MMU) += mmu.o
> >  obj-$(CONFIG_CPU_32v4T) += cache-armv4.o
> > diff --git a/arch/arm/cpu/start-arm.S b/arch/arm/cpu/start-arm.S
> > deleted file mode 100644
> > index 4d61cee..0000000
> > --- a/arch/arm/cpu/start-arm.S
> > +++ /dev/null
> > @@ -1,248 +0,0 @@
> > -/*
> > +
> > +	/* disable MMU stuff and caches */
> > +	__asm__ __volatile__("mrc p15, 0, %0, c1, c0, 0":"=r"(r));
> > +	r &= ~0x2387; /* clear bits 13, 9:8, 7, 2:0 (--V- --RS B--- -CAM) */
> > +	r |= 0x1002; /* set bit 2 (A) Align, set bit 12 (I) I-Cache */
> can we use here the CP15 macro
> as CR_M and get_cr and set_cr?

We don't have these macros now, eh wait, we do now ;)
I'll send an update soon.

> > +	__asm__ __volatile__("mcr p15, 0, %0, c1, c0, 0" : : "r"(r));
> > +
> > +#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT
> > +	board_init_lowlevel();
> > +#endif
> why not always avoid the ifdef CONFIG_ in the code and define an inline?

Must think about it a bit further. But since this is the old behaviour
lets just keep it for now, we can always change it later.

> > +	board_init_lowlevel_return();
> > +}
> > +
> otherwise it's really easier than the asm to maintain evenif I prefer to write
> it in asm personnaly

The original motivation was to get the pcm043 lowlevel setup smaller so
that for Nand boot the initial code fits better into 2k of memory. I
could have done some hand optimization in the assembler code, but that
would have made it more unreadable. I didn't want to stop then...
We can always look at the resulting disassembly if we want to.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-04-28 10:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23  9:03 some more patches for -next Sascha Hauer
2010-04-23  9:03 ` [PATCH 01/14] i.MX35 stack: Fix mc9sdz60 reset register offset Sascha Hauer
2010-04-23  9:03 ` [PATCH 02/14] ARM: use memalign in dma_alloc_coherent to assure alignment Sascha Hauer
2010-04-23  9:03 ` [PATCH 03/14] fsl_udc: make it work with MMU on Sascha Hauer
2010-04-23  9:03 ` [PATCH 04/14] Increase MAX_FILES to 128 Sascha Hauer
2010-04-23  9:03 ` [PATCH 05/14] fix _update scripts Sascha Hauer
2010-04-23  9:03 ` [PATCH 06/14] pcm043: Speed up NAND controller before copying barebox image Sascha Hauer
2010-04-23  9:03 ` [PATCH 07/14] add arm helper function to determine the program counter Sascha Hauer
2010-04-28  2:37   ` Jean-Christophe PLAGNIOL-VILLARD
2010-04-28  9:02     ` Sascha Hauer
2010-04-23  9:03 ` [PATCH 08/14] arm: remove unused variables from header file Sascha Hauer
2010-04-23  9:03 ` [PATCH 09/14] arm: move __mmu_cache_flush to bare_init section Sascha Hauer
2010-04-23  9:03 ` [PATCH 10/14] arm: reimplement startup code in C Sascha Hauer
2010-04-27  1:45   ` Shinya Kuribayashi
2010-04-28  2:32   ` Jean-Christophe PLAGNIOL-VILLARD
2010-04-28 10:04     ` Sascha Hauer [this message]
2010-04-23  9:04 ` [PATCH 11/14] i.MX: remove __REG from esd controller regs. use readl/writel instead Sascha Hauer
2010-04-23  9:04 ` [PATCH 12/14] pcm043: reimplement lowlevel code in C Sascha Hauer
2010-04-28  2:35   ` Jean-Christophe PLAGNIOL-VILLARD
2010-04-23  9:04 ` [PATCH 13/14] i.MX35: Fix ahbclock calculation Sascha Hauer
2010-04-23  9:04 ` [PATCH 14/14] pcm038: reimplement lowlevel code in C Sascha Hauer
2010-04-26 12:04 ` some more patches for -next Ivo Clarysse

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=20100428100455.GF7634@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox