mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Vicente Bergas <vicencb@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] OMAP4: add command to select next boot device priority
Date: Mon, 11 Mar 2013 22:42:47 +0100	[thread overview]
Message-ID: <20130311214247.GO1906@pengutronix.de> (raw)
In-Reply-To: <1362958567-6110-4-git-send-email-vicencb@gmail.com>

On Mon, Mar 11, 2013 at 12:36:06AM +0100, Vicente Bergas wrote:
> On OMAP4 SoC there is a SAR memory region (Save & Rescue) where the ROM
> code reads the device to boot from.
> This patch adds a way to set this.
> 
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
> ---
>  arch/arm/mach-omap/include/mach/omap4-silicon.h | 20 ++++++
>  arch/arm/mach-omap/omap4_generic.c              | 20 ++++++
>  commands/Kconfig                                |  5 ++
>  commands/Makefile                               |  1 +
>  commands/boot_order.c                           | 83 +++++++++++++++++++++++++
>  5 files changed, 129 insertions(+)
>  create mode 100644 commands/boot_order.c
> 
> +static int cmd_boot_order(int argc, char *argv[])
> +{
> +	u32 device_list[] = {
> +		OMAP44XX_SAR_BOOT_VOID,
> +		OMAP44XX_SAR_BOOT_VOID,
> +		OMAP44XX_SAR_BOOT_VOID,
> +		OMAP44XX_SAR_BOOT_VOID,
> +	};
> +	int i, j = 1, do_reset = 0;
> +
> +	if (argc > 1 && strcmp(argv[1], "-r") == 0) {
> +		do_reset = 1;
> +		j = 2;
> +	}

You should use getopt() to parse options.

> +	for (i = 0; i < 4 && j < argc; i++, j++) {
> +		if      (strcmp(argv[j], "xip") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_XIP;
> +		else if (strcmp(argv[j], "xipwait") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_XIPWAIT;
> +		else if (strcmp(argv[j], "nand") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_NAND;
> +		else if (strcmp(argv[j], "onenand") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_ONENAND;
> +		else if (strcmp(argv[j], "mmc1") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_MMC1;
> +		else if (strcmp(argv[j], "mmc2_1") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_MMC2_1;
> +		else if (strcmp(argv[j], "mmc2_2") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_MMC2_2;
> +		else if (strcmp(argv[j], "uart") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_UART;
> +		else if (strcmp(argv[j], "usb_1") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_USB_1;
> +		else if (strcmp(argv[j], "usb_ulpi") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_USB_ULPI;
> +		else if (strcmp(argv[j], "usb_2") == 0)
> +			device_list[i] = OMAP44XX_SAR_BOOT_USB_2;

You could add a table for this, something like

struct bootsrc {
	const char *name;
	uint32_t sar;
};

> +	}
> +	if (device_list[0] == OMAP44XX_SAR_BOOT_VOID) {
> +		printf("First boot device can't be void\n");
> +		return COMMAND_ERROR_USAGE;
> +	}
> +	omap4_set_warmboot_order(device_list);
> +	if (do_reset) {
> +		shutdown_barebox();
> +		reset_cpu(0);
> +	}

Why is this done here? I mean you could execute the reset command after
this one.

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:[~2013-03-11 21:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 23:36 [PATCH 0/4] ArchosG9: add keyboard input and new reset menu entries Vicente Bergas
2013-03-10 23:36 ` [PATCH 1/4] gpio_keys: detect keys pressed before booting Vicente Bergas
2013-03-10 23:36 ` [PATCH 2/4] twl6030: add power button as an input key Vicente Bergas
2013-03-11 21:35   ` Sascha Hauer
2013-03-10 23:36 ` [PATCH 3/4] OMAP4: add command to select next boot device priority Vicente Bergas
2013-03-11 21:42   ` Sascha Hauer [this message]
2013-03-10 23:36 ` [PATCH 4/4] ArchosG9: add keyboard input and new reset menu entries Vicente Bergas
2013-03-11 21:45   ` Sascha Hauer
2013-03-12  0:09     ` vj
2013-03-12  0:01 [PATCH 2/4] twl6030: add power button as an input key Vicente Bergas
2013-03-12  0:01 ` [PATCH 3/4] OMAP4: add command to select next boot device priority Vicente Bergas
2013-03-12 17:51   ` Sascha Hauer
2013-03-12 20:20     ` vj
2013-03-12 21:20       ` Sascha Hauer
2013-03-12 23:07         ` vj

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=20130311214247.GO1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=vicencb@gmail.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