diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2015-05-06 12:32:05 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-07 09:49:41 +0200 |
commit | 903c9477a08c5655161779ef4144886928ecc7d1 (patch) | |
tree | 7ed30b03224d9d2383a8815a051ff66de7dbf466 /arch/arm/mach-imx/xload.c | |
parent | c66574342dacbdb755ac8193057fc34e9b175c0b (diff) | |
download | barebox-903c9477a08c5655161779ef4144886928ecc7d1.tar.gz barebox-903c9477a08c5655161779ef4144886928ecc7d1.tar.xz |
i.MX: Add provisions to boot from IRAM
This commit add a very basic code to allow Barebox to be booted from
IRAM. Given that the amount of IRAM on most i.MX variants is
insufficient to contain a copy of Barebox with any reasonable degree
of functionality this code uses IRAM only as a temporary location and
eventually bootstraps from DRAM. But the presense of the intermediate
IRAM-only stage allows to add provisions to test the area of DRAM that
Barebox would be using to facilitate various testing scenarious.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/xload.c')
-rw-r--r-- | arch/arm/mach-imx/xload.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/xload.c b/arch/arm/mach-imx/xload.c new file mode 100644 index 0000000000..16d56ab288 --- /dev/null +++ b/arch/arm/mach-imx/xload.c @@ -0,0 +1,52 @@ +#include <bootsource.h> +#include <bootstrap.h> +#include <common.h> +#include <malloc.h> +#include <init.h> +#include <envfs.h> +#include <linux/sizes.h> +#include <fs.h> +#include <io.h> + +#include <linux/clkdev.h> +#include <linux/stat.h> +#include <linux/clk.h> + +#include <mach/devices-imx51.h> + +static __noreturn int imx_xload(void) +{ + enum bootsource bootsource = bootsource_get(); + void *buf; + + switch (bootsource) { + case BOOTSOURCE_MMC: + pr_info("booting from MMC\n"); + buf = bootstrap_read_disk("disk0.0", "fat"); + break; + case BOOTSOURCE_SPI: + pr_info("booting from SPI\n"); + buf = bootstrap_read_devfs("dataflash0", false, + SZ_256K, SZ_1M, SZ_1M); + break; + default: + pr_err("unknown bootsource %d\n", bootsource); + hang(); + } + + if (!buf) { + pr_err("failed to load barebox.bin\n"); + hang(); + } + + bootstrap_boot(buf, 0); + + hang(); +} + +static int imx_devices_init(void) +{ + barebox_main = imx_xload; + return 0; +} +coredevice_initcall(imx_devices_init); |