summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-05-11 09:25:36 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-05-11 09:25:36 +0200
commitec7023db8dc95966919589541f1ca09355a3f7a5 (patch)
tree69be08a0b3f19e3e1d99ea7829931f8f800a01d9 /tools
parente825b100d209a9d3c79b2998452cafa94eec986a (diff)
parentd782c1fe7246301143ed78c0d86ea6c81f9325f9 (diff)
downloadu-boot-imx-ec7023db8dc95966919589541f1ca09355a3f7a5.zip
u-boot-imx-ec7023db8dc95966919589541f1ca09355a3f7a5.tar.gz
u-boot-imx-ec7023db8dc95966919589541f1ca09355a3f7a5.tar.bz2
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
Conflicts: drivers/mtd/nand/mxc_nand_spl.c include/configs/m28evk.h
Diffstat (limited to 'tools')
-rw-r--r--tools/imximage.c17
-rw-r--r--tools/imximage.h9
-rw-r--r--tools/mxsboot.c8
3 files changed, 25 insertions, 9 deletions
diff --git a/tools/imximage.c b/tools/imximage.c
index fa308c9..5e8e470 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -37,6 +37,7 @@
*/
static table_entry_t imximage_cmds[] = {
{CMD_BOOT_FROM, "BOOT_FROM", "boot command", },
+ {CMD_BOOT_OFFSET, "BOOT_OFFSET", "Boot offset", },
{CMD_DATA, "DATA", "Reg Write Data", },
{CMD_IMAGE_VERSION, "IMAGE_VERSION", "image version", },
{-1, "", "", },
@@ -352,6 +353,11 @@ static void parse_cfg_cmd(struct imx_header *imxhdr, int32_t cmd, char *token,
if (unlikely(cmd_ver_first != 1))
cmd_ver_first = 0;
break;
+ case CMD_BOOT_OFFSET:
+ imxhdr->flash_offset = get_cfg_value(token, name, lineno);
+ if (unlikely(cmd_ver_first != 1))
+ cmd_ver_first = 0;
+ break;
case CMD_DATA:
value = get_cfg_value(token, name, lineno);
(*set_dcd_val)(imxhdr, name, lineno, fld, value, dcd_len);
@@ -518,11 +524,14 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
/*
* ROM bug alert
- * mx53 only loads 512 byte multiples.
- * The remaining fraction of a block bytes would
- * not be loaded.
+ *
+ * MX53 only loads 512 byte multiples in case of SD boot.
+ * MX53 only loads NAND page multiples in case of NAND boot and
+ * supports up to 4096 byte large pages, thus align to 4096.
+ *
+ * The remaining fraction of a block bytes would not be loaded!
*/
- *header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 512);
+ *header_size_ptr = ROUND(sbuf->st_size + imxhdr->flash_offset, 4096);
}
int imximage_check_params(struct mkimage_params *params)
diff --git a/tools/imximage.h b/tools/imximage.h
index 42b6090..5c929e4 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -31,6 +31,11 @@
#define HEADER_OFFSET 0x400
+/*
+ * NOTE: This file must be kept in sync with arch/arm/include/asm/\
+ * imx-common/imximage.cfg because tools/imximage.c can not
+ * cross-include headers from arch/arm/ and vice-versa.
+ */
#define CMD_DATA_STR "DATA"
#define FLASH_OFFSET_UNDEFINED 0xFFFFFFFF
#define FLASH_OFFSET_STANDARD 0x400
@@ -52,6 +57,7 @@ enum imximage_cmd {
CMD_INVALID,
CMD_IMAGE_VERSION,
CMD_BOOT_FROM,
+ CMD_BOOT_OFFSET,
CMD_DATA
};
@@ -151,13 +157,14 @@ typedef struct {
dcd_v2_t dcd_table;
} imx_header_v2_t;
+/* The header must be aligned to 4k on MX53 for NAND boot */
struct imx_header {
union {
imx_header_v1_t hdr_v1;
imx_header_v2_t hdr_v2;
} header;
uint32_t flash_offset;
-};
+} __attribute__((aligned(4096)));
typedef void (*set_dcd_val_t)(struct imx_header *imxhdr,
char *name, int lineno,
diff --git a/tools/mxsboot.c b/tools/mxsboot.c
index 6c05aa4..d92c39f 100644
--- a/tools/mxsboot.c
+++ b/tools/mxsboot.c
@@ -551,7 +551,7 @@ static int mx28_create_sd_image(int infd, int outfd)
fsize = lseek(infd, 0, SEEK_END);
lseek(infd, 0, SEEK_SET);
- size = fsize + 512;
+ size = fsize + 4 * 512;
buf = malloc(size);
if (!buf) {
@@ -559,7 +559,7 @@ static int mx28_create_sd_image(int infd, int outfd)
goto err0;
}
- ret = read(infd, (uint8_t *)buf + 512, fsize);
+ ret = read(infd, (uint8_t *)buf + 4 * 512, fsize);
if (ret != fsize) {
ret = -1;
goto err1;
@@ -574,8 +574,8 @@ static int mx28_create_sd_image(int infd, int outfd)
cb->drv_info[0].chip_num = 0x0;
cb->drv_info[0].drive_type = 0x0;
cb->drv_info[0].tag = 0x1;
- cb->drv_info[0].first_sector_number = sd_sector + 1;
- cb->drv_info[0].sector_count = (size - 1) / 512;
+ cb->drv_info[0].first_sector_number = sd_sector + 4;
+ cb->drv_info[0].sector_count = (size - 4) / 512;
wr_size = write(outfd, buf, size);
if (wr_size != size) {