diff --git a/arch/arm/config.mk b/arch/arm/config.mk index ea6dca77ce..715fd3426a 100755 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -20,7 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # -CROSS_COMPILE ?= arm-linux-gnueabi- + +CROSS_COMPILE ?= arm-none-linux-gnueabi- ifndef CONFIG_STANDALONE_LOAD_ADDR ifeq ($(SOC),omap3) diff --git a/arch/arm/cpu/armv7/sunxi/lowlevel_init.S b/arch/arm/cpu/armv7/sunxi/lowlevel_init.S index bf7decde99..142debc845 100755 --- a/arch/arm/cpu/armv7/sunxi/lowlevel_init.S +++ b/arch/arm/cpu/armv7/sunxi/lowlevel_init.S @@ -47,3 +47,25 @@ lowlevel_init: SRAM_STACK: .word LOW_LEVEL_SRAM_STACK + +.global sunxi_pre_clean +sunxi_pre_clean: +#if defined(CONFIG_SUN7I_FPGA) + /* clear all registers for simulation */ + mov r0, #0 + mov r1, #0 + mov r2, #0 + mov r3, #0 + mov r4, #0 + mov r5, #0 + mov r6, #0 + mov r7, #0 + mov r8, #0 + mov r9, #0 + mov r10, #0 + mov r11, #0 + mov r12, #0 + + /* back to arch calling code */ + mov pc, lr +#endif diff --git a/arch/arm/cpu/armv7/sunxi/partition.c b/arch/arm/cpu/armv7/sunxi/partition.c index 88cda2fdc2..9b9ce3bbbe 100755 --- a/arch/arm/cpu/armv7/sunxi/partition.c +++ b/arch/arm/cpu/armv7/sunxi/partition.c @@ -178,11 +178,11 @@ int sunxi_partition_init(void) crc = calc_crc32(&mbr->version, MBR_SIZE-4); if(crc == mbr->crc32) { - if(mbr->PartCount < 32) + if(mbr->PartCount < MBR_MAX_PART_COUNT) { PARTITION* pe = mbr->array; - for(i=0; iPartCount && i < MBR_MAX_PART_COUNT; i++, pe++) + for(i=0; iPartCount; i++, pe++) { unsigned long long len, addr; diff --git a/arch/arm/include/asm/arch-sunxi/nand_fspart.h b/arch/arm/include/asm/arch-sunxi/nand_fspart.h index 7257955985..e30113562e 100755 --- a/arch/arm/include/asm/arch-sunxi/nand_fspart.h +++ b/arch/arm/include/asm/arch-sunxi/nand_fspart.h @@ -18,12 +18,13 @@ #define DOWNLOAD_MAP_NAME "dlinfo.fex" /* MBR */ -#define MBR_SIZE 1024 -#define MBR_MAGIC "softw311" +#define MBR_SIZE (16*1024) +#define MBR_MAGIC "softw411" #define MBR_START_ADDRESS 0x00000000 -#define MBR_MAX_PART_COUNT 15 +#define MBR_MAX_PART_COUNT 120 #define MBR_COPY_NUM 4 //mbr的备份数量 -#define MBR_RESERVED (MBR_SIZE - 20 - (MBR_MAX_PART_COUNT * sizeof(PARTITION))) //mbr保留的空间 +#define MBR_RESERVED (MBR_SIZE - 32 - (MBR_MAX_PART_COUNT * sizeof(PARTITION))) //mbr保留的空间 +#define DL_RESERVED (DL_SIZE - 32 - (MBR_MAX_PART_COUNT * sizeof(dl_one_part_info))) //分区信息, 64byte typedef struct tag_PARTITION @@ -32,47 +33,50 @@ typedef struct tag_PARTITION unsigned int addrlo; // unsigned int lenhi; //长度 unsigned int lenlo; // - unsigned char classname[12]; //次设备名 - unsigned char name[12]; //主设备名 + unsigned char classname[16]; //次设备名 + unsigned char name[16]; //主设备名 unsigned int user_type; //用户类型 + unsigned int keydata; //关键数据,要求量产不丢失 unsigned int ro; //读写属性 - unsigned char res[16]; //保留 + unsigned char reserved[68]; //保留数据,匹配分区信息128字节 } __attribute__ ((packed))PARTITION; //MBR信息 typedef struct tag_MBR { unsigned int crc32; // crc 1k - 4 unsigned int version; // 版本信息, 0x00000100 - unsigned char magic[8]; //"softw311" - unsigned char copy; //分数 - unsigned char index; //第几个MBR备份 - unsigned short PartCount; //分区个数 + unsigned char magic[8]; //"softw411" + unsigned int copy; //分数 + unsigned int index; //第几个MBR备份 + unsigned int PartCount; //分区个数 + unsigned int stamp[1]; //对齐 PARTITION array[MBR_MAX_PART_COUNT]; // unsigned char res[MBR_RESERVED]; }__attribute__ ((packed)) MBR; typedef struct tag_one_part_info { - unsigned char classname[12]; //所烧写分区的次设备名 - unsigned char name[12]; //所烧写分区的主设备名 + unsigned char name[16]; //所烧写分区的主设备名 unsigned int addrhi; //所烧写分区的高地址,扇区单位 unsigned int addrlo; //所烧写分区的低地址,扇区单位 unsigned int lenhi; //所烧写分区的长度,高32位,扇区单位 unsigned int lenlo; //所烧写分区的长度,低32位,扇区单位 - unsigned char part_name[12]; //所烧写分区的名称,和MBR中的分区 classname 对应 unsigned char dl_filename[16]; //所烧写分区的文件名称,长度固定16字节 unsigned char vf_filename[16]; //所烧写分区的校验文件名称,长度固定16字节 unsigned int encrypt; //所烧写分区的数据是否进行加密 0:加密 1:不加密 + unsigned int verify; //所烧写分区的数据是否进行校验 0:不校验 1:校验 } dl_one_part_info; //分区烧写信息 typedef struct tag_download_info { - unsigned int crc32; //crc - unsigned int version; //版本号 0x00000101 - unsigned char magic[8]; //"softw311" - unsigned int download_count; //需要烧写的分区个数 + unsigned int crc32; //crc + unsigned int version; //版本号 0x00000101 + unsigned char magic[8]; //"softw311" + unsigned int download_count; //需要烧写的分区个数 + unsigned int stamp[3]; //对齐 dl_one_part_info one_part_info[MBR_MAX_PART_COUNT]; //烧写分区的信息 + unsigned char res[DL_RESERVED]; } download_info; diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index a0aff4a44e..87097a113d 100755 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -464,7 +464,7 @@ void board_init_r(gd_t *id, ulong dest_addr) // debug("monitor flash len: %08lX\n", monitor_flash_len); #ifdef CONFIG_ALLWINNER #ifdef DEBUG -// printf("sunxi script init\n"); + printf("sunxi script init\n"); #endif sw_gpio_init(); if(script_parser_fetch("target", "storage_type", &storage_type, sizeof(int))) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 4497bff98f..7387b45bf4 100755 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -215,6 +215,7 @@ int do_boota_linux (struct fastboot_boot_img_hdr *hdr) sunxi_flash_exit(); /* we assume that the kernel is in place */ announce_and_cleanup(); + sr32(SUNXI_CCM_APB1_GATING, 16, 2, 0); sr32(SUNXI_CCM_APB1_GATING, 16, 1, 0); kernel_entry(0, bd->bi_arch_number, bd->bi_boot_params); diff --git a/board/allwinner/sun7i-evb/sun7i-evb.c b/board/allwinner/sun7i-evb/sun7i-evb.c index dac7065fa2..132778f34b 100755 --- a/board/allwinner/sun7i-evb/sun7i-evb.c +++ b/board/allwinner/sun7i-evb/sun7i-evb.c @@ -42,8 +42,8 @@ void fastboot_flash_partition_init(void) { fastboot_ptentry fb_part; int index, part_total; - char partition_sets[256]; - char part_name[16]; + char partition_sets[512]; + char part_name[32]; char *pa_index; int part_name_count; @@ -57,9 +57,9 @@ void fastboot_flash_partition_init(void) } printf("-total partitions:%d-\n", part_total); printf("%-12s %-12s %-12s\n", "-name-", "-start-", "-size-"); - memset(partition_sets, ' ', 256); + memset(partition_sets, ' ', sizeof(partition_sets)); - memset(part_name, 0, 16); + memset(part_name, 0, sizeof(part_name)); if(!storage_type) { memcpy(part_name, "nanda", 5); diff --git a/common/cmd_sunxi_flash.c b/common/cmd_sunxi_flash.c index aae65ca6ee..5add6c60be 100755 --- a/common/cmd_sunxi_flash.c +++ b/common/cmd_sunxi_flash.c @@ -96,7 +96,7 @@ int do_sunxi_flash(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) if((!strncmp(part_name, "boot", 4)) || (!strncmp(part_name, "recovery", 4))) { - readall_flag = 1; + // readall_flag = 1; } start_block = sunxi_partition_get_offset_byname((const char *)part_name); if(start_block == (u64)(-1)) diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h index 3c52997e87..bb8df1a792 100755 --- a/include/configs/sun7i.h +++ b/include/configs/sun7i.h @@ -115,7 +115,7 @@ * Size of malloc() pool * 1MB = 0x100000, 0x100000 = 1024 * 1024 */ -#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20)) +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (4 << 20)) #define CONFIG_FASTBOOT #define CONFIG_STORAGE_NAND diff --git a/include/fastboot.h b/include/fastboot.h old mode 100644 new mode 100755 index 0a186f78a4..9843b4bebc --- a/include/fastboot.h +++ b/include/fastboot.h @@ -158,7 +158,7 @@ typedef struct fastboot_ptentry fastboot_ptentry; struct fastboot_ptentry { /* The logical name for this partition, null terminated */ - char name[16]; + char name[32]; /* The start wrt the nand part, must be multiple of nand block size */ unsigned int start; /* The length of the partition, must be multiple of nand block size */ diff --git a/nand_sunxi/Makefile b/nand_sunxi/Makefile index c06f294493..f89f96b3a1 100755 --- a/nand_sunxi/Makefile +++ b/nand_sunxi/Makefile @@ -25,7 +25,8 @@ include $(TOPDIR)/config.mk all: ifeq ($(notdir $(shell find ./ -name lib)), lib) - + + @echo "make lib-nand from source" make -C lib else diff --git a/nand_sunxi/libnand b/nand_sunxi/libnand index 31d403ecc5..11d9e23e30 100644 Binary files a/nand_sunxi/libnand and b/nand_sunxi/libnand differ