mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Reilly <marc@cpdesign.com.au>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] imx(25,35): save boot location into $barebox_loc env.
Date: Wed, 12 Jan 2011 18:04:43 +1100	[thread overview]
Message-ID: <201101121804.44105.marc@cpdesign.com.au> (raw)
In-Reply-To: <20110112025858.GD20706@game.jcrosoft.org>


> > +#include <mach/imx-regs.h>
> > +
> > +#if defined(CONFIG_ARCH_IMX25) || defined(CONFIG_ARCH_IMX35)
> 
> please move this to the Makefile

I respectfully disagree. :) Other imx will require a slightly different 
approach to this function, the imx31 and the imx51 are both different for 
example.

So we either need to have a separate .c file for each different type and link 
them appropriately in the Makefile, or we have a single boot.c and 
conditionally compile.
I think its overkill to split it up into separate files, especially seeing as 
some code will be (hopefully) be used by multiple processors. I also think its 
better that with one file the code with similar functionality is grouped 
together.

Hope those arguments make sense.
> 
> > +/*
> > + * Saves the boot source media into the $barebox_loc enviroment variable
> > + *
> > + * This information is useful for barebox init scripts as we can then
> > easily + * use a kernel image stored on the same media that we launch
> > barebox with + * (for example).
> > + *
> > + * imx25 and imx35 can boot into barebox from several media such as
> > + * nand, nor, mmc/sd cards, serial roms. "mmc" is used to represent
> > several + * sources as its impossible to distinguish between them.
> > + *
> > + * Some sources such as serial roms can themselves have 3 different boot
> > + * possibilities (i2c1, i2c2 etc). It is assumed that any board will
> > + * only be using one of these at any one time.
> > + *
> > + * Note also that I suspect that the boot source pins are only sampled
> > at + * power up.
> > + */
> > +static int imx_boot_save_loc(void)
> > +{
> > +	const char *bareboxloc = NULL;
> > +	uint32_t reg;
> > +	unsigned int ctrl, type;
> > +
> > +	/* [CTRL][TYPE] */
> > +	const char *const locations[4][4] = {
> 
> 	a struct could be better not sure

I couldn't think of a way where a struct would make it easier than it is... 
suggestions?

> 
> > +		{ /* CTRL = WEIM */
> > +			"nor",
> > +			0,
> 
> 			NULL no?

Ack, you're right.

Guess I'll have to have another go :) I'll let it rest for a bit and see if 
there are any other comments.

Cheers
Marc

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

      reply	other threads:[~2011-01-12  7:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12  2:27 Marc Reilly
2011-01-12  2:58 ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-12  7:04   ` Marc Reilly [this message]

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=201101121804.44105.marc@cpdesign.com.au \
    --to=marc@cpdesign.com.au \
    --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