mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Philipp Zabel <philipp.zabel@gmail.com>
Cc: barebox@lists.infradead.org, Troy Kisky <troy.kisky@boundarydevices.com>
Subject: Re: [RFC PATCH 2/2] commands: add bootmode command
Date: Mon, 27 Jan 2014 09:46:33 +0100	[thread overview]
Message-ID: <20140127084633.GU16215@pengutronix.de> (raw)
In-Reply-To: <1390431691-5090-3-git-send-email-philipp.zabel@gmail.com>

Hi Philipp,

On Thu, Jan 23, 2014 at 12:01:31AM +0100, Philipp Zabel wrote:
> On some SoCs the boot rom can be instructed to boot from a specific
> device, once, after the next reset. The bootmode command allows to
> list boot device candidates and to set up one of those devices as
> boot source after the next reset.
> 
> Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
> ---
>  commands/Kconfig    |   9 ++++
>  commands/Makefile   |   1 +
>  commands/bootmode.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  common/Kconfig      |   3 ++
>  common/Makefile     |   1 +
>  5 files changed, 157 insertions(+)
>  create mode 100644 commands/bootmode.c
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 1e07b5b..851a14a 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -770,6 +770,15 @@ config CMD_WD_DEFAULT_TIMOUT
>  	  enabled and re-triggered with the default timeout value).
>  endif
>  
> +config CMD_BOOTMODE
> +	bool
> +	depends on OFTREE
> +	prompt "bootmode command"
> +	select BOOTMODE
> +	help
> +	  The 'bootmode' command on some SoCs allows to instruct the boot rom
> +	  from which bootsource to boot, once, after the next reset.
> +
>  endmenu
>  
>  endif
> diff --git a/commands/Makefile b/commands/Makefile
> index 58d27fa..9e63e3f 100644
> --- a/commands/Makefile
> +++ b/commands/Makefile
> @@ -93,3 +93,4 @@ obj-$(CONFIG_CMD_MIITOOL)	+= miitool.o
>  obj-$(CONFIG_CMD_DETECT)	+= detect.o
>  obj-$(CONFIG_CMD_BOOT)		+= boot.o
>  obj-$(CONFIG_CMD_DEVINFO)	+= devinfo.o
> +obj-$(CONFIG_CMD_BOOTMODE)	+= bootmode.o
> diff --git a/commands/bootmode.c b/commands/bootmode.c
> +
> +static struct bootsource_name bootsources[] = {
> +	{ BOOTSOURCE_NAND,   "nand" },
> +	{ BOOTSOURCE_NOR,    "nor"  },
> +	{ BOOTSOURCE_MMC,    "mmc"  },
> +	{ BOOTSOURCE_I2C,    "i2c"  },
> +	{ BOOTSOURCE_SPI,    "m25p" },
> +	{ BOOTSOURCE_SERIAL, "cs"   },
> +	{ BOOTSOURCE_HD,     "ahci" },
> +};
> +
> +static enum bootsource get_bootsource(struct device_d *dev, int *instance)
> +{

For bootsource we currently have bootsource/instance for referring to a
bootsource. Using a struct device_d (and therefore also struct
device_node) is pretty cool, but should be introduced consistently. With
the function above we have to use a devicename to specify the
bootsource, but a devicename is not what we get as current bootsource. I
suggest to either switch to devicenames completely or to let the
bootmode command just understand bootmode <type> <instance>, like
bootmode mmc 2.

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:[~2014-01-27  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 23:01 [RFC PATCH 0/2] Bootmode override on i.MX6 Philipp Zabel
2014-01-22 23:01 ` [RFC PATCH 1/2] ARM i.MX6: Add bootmode setting code Philipp Zabel
2014-01-22 23:01 ` [RFC PATCH 2/2] commands: add bootmode command Philipp Zabel
2014-01-27  8:46   ` Sascha Hauer [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=20140127084633.GU16215@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=philipp.zabel@gmail.com \
    --cc=troy.kisky@boundarydevices.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