[PATCH 6/7] at91: add bootstrap version
Jan Lübbe
jlu at pengutronix.de
Wed Jan 2 06:41:31 EST 2013
On Sat, 2012-12-29 at 11:08 +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
> new file mode 100644
> index 0000000..2ec16f1
> --- /dev/null
> +++ b/arch/arm/mach-at91/bootstrap.c
> @@ -0,0 +1,86 @@
> +/*
> + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio at jcrosoft.com>
> + *
> + * Under GPLv2
> + */
> +
> +#include <common.h>
> +#include <bootstrap.h>
> +#include <mach/bootstrap.h>
> +#include <sizes.h>
> +#include <malloc.h>
> +
> +#if defined(CONFIG_MCI_ATMEL)
> +#define is_mmc() 1
> +#else
> +#define is_mmc() 0
> +#endif
> +
> +#ifdef CONFIG_NAND_ATMEL
> +#define is_nand() 1
> +#else
> +#define is_nand() 0
> +#endif
> +
> +#ifdef CONFIG_MTD_M25P80
> +#define is_m25p80() 1
> +#else
> +#define is_m25p80() 0
> +#endif
> +
> +#ifdef CONFIG_MTD_DATAFLASH
> +#define is_dataflash() 1
> +#else
> +#define is_dataflash() 0
> +#endif
> +
> +static void boot_seq(bool is_barebox)
> +{
> + char *name = is_barebox ? "barebox" : "unknown";
> + int (*func)(void) = NULL;
> +
> + if (is_m25p80()) {
> + func = bootstrap_board_read_m25p80();
> + printf("Boot %s from m25p80\n", name);
> + bootstrap_boot(func, is_barebox);
> + bootstrap_err("... failled\n");
> + free(func);
> + }
> + if (is_dataflash()) {
> + printf("Boot %s from dataflash\n", name);
> + func = bootstrap_board_read_dataflash();
> + bootstrap_boot(func, is_barebox);
> + bootstrap_err("... failled\n");
> + free(func);
> + }
> + if (is_nand()) {
> + printf("Boot %s from nand\n", name);
> + func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> + bootstrap_boot(func, is_barebox);
> + bootstrap_err("... failled\n");
> + free(func);
> + }
> +}
Why can't you use IS_ENABLED(CONFIG_xxx) here?
--
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 |
More information about the barebox
mailing list