diff options
Diffstat (limited to 'board/mcc200')
-rw-r--r-- | board/mcc200/auto_update.c | 38 | ||||
-rw-r--r-- | board/mcc200/mcc200.c | 7 |
2 files changed, 16 insertions, 29 deletions
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c index 786543e..f1bb721 100644 --- a/board/mcc200/auto_update.c +++ b/board/mcc200/auto_update.c @@ -79,8 +79,7 @@ #define AU_FIRMWARE "u-boot.img" #define AU_KERNEL "kernel.img" -struct flash_layout -{ +struct flash_layout { long start; long end; }; @@ -122,10 +121,10 @@ struct flash_layout aufl_layout[AU_MAXFILES] = { \ #define I2C_PSOC_KEYPAD_ADDR 0x53 /* keypad mask */ -#define KEYPAD_ROW 3 -#define KEYPAD_COL 3 -#define KEYPAD_MASK_LO ((1<<(KEYPAD_COL-1+(KEYPAD_ROW*4-4)))&0xFF) -#define KEYPAD_MASK_HI ((1<<(KEYPAD_COL-1+(KEYPAD_ROW*4-4)))>>8) +#define KEYPAD_ROW 2 +#define KEYPAD_COL 2 +#define KEYPAD_MASK_LO ((1<<(KEYPAD_COL-1+(KEYPAD_ROW*3-3)))&0xFF) +#define KEYPAD_MASK_HI ((1<<(KEYPAD_COL-1+(KEYPAD_ROW*3-3)))>>8) /* externals */ extern int fat_register_device(block_dev_desc_t *, int); @@ -139,33 +138,28 @@ extern int flash_write (char *, ulong, ulong); extern block_dev_desc_t *get_dev (char*, int); extern int u_boot_hush_start(void); -int -au_check_cksum_valid(int idx, long nbytes) +int au_check_cksum_valid(int idx, long nbytes) { image_header_t *hdr; unsigned long checksum; hdr = (image_header_t *)LOAD_ADDR; - if (nbytes != (sizeof(*hdr) + ntohl(hdr->ih_size))) - { + if (nbytes != (sizeof(*hdr) + ntohl(hdr->ih_size))) { printf ("Image %s bad total SIZE\n", aufile[idx]); return -1; } /* check the data CRC */ checksum = ntohl(hdr->ih_dcrc); - if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size)) - != checksum) - { + if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size)) != checksum) { printf ("Image %s bad data checksum\n", aufile[idx]); return -1; } return 0; } -int -au_check_header_valid(int idx, long nbytes) +int au_check_header_valid(int idx, long nbytes) { image_header_t *hdr; unsigned long checksum; @@ -180,13 +174,11 @@ au_check_header_valid(int idx, long nbytes) printf("size %#x %#lx ", ntohl(hdr->ih_size), nbytes); printf("type %#x %#x ", hdr->ih_type, IH_TYPE_KERNEL); #endif - if (nbytes < sizeof(*hdr)) - { + if (nbytes < sizeof(*hdr)) { printf ("Image %s bad header SIZE\n", aufile[idx]); return -1; } - if (ntohl(hdr->ih_magic) != IH_MAGIC || hdr->ih_arch != IH_CPU_PPC) - { + if (ntohl(hdr->ih_magic) != IH_MAGIC || hdr->ih_arch != IH_CPU_PPC) { printf ("Image %s bad MAGIC or ARCH\n", aufile[idx]); return -1; } @@ -222,9 +214,7 @@ au_check_header_valid(int idx, long nbytes) return 0; } - -int -au_do_update(int idx, long sz) +int au_do_update(int idx, long sz) { image_header_t *hdr; char *addr; @@ -303,14 +293,12 @@ au_do_update(int idx, long sz) return 0; } - /* * this is called from board_init() after the hardware has been set up * and is usable. That seems like a good time to do this. * Right now the return value is ignored. */ -int -do_auto_update(void) +int do_auto_update(void) { block_dev_desc_t *stor_dev; long sz; diff --git a/board/mcc200/mcc200.c b/board/mcc200/mcc200.c index 67969a6..554c51d 100644 --- a/board/mcc200/mcc200.c +++ b/board/mcc200/mcc200.c @@ -228,10 +228,6 @@ int misc_init_r (void) { ulong flash_sup_end, snum; -#ifdef CONFIG_AUTO_UPDATE - /* this has priority over all else */ - do_auto_update(); -#endif /* * Adjust flash start and offset to detected values */ @@ -294,6 +290,9 @@ int misc_init_r (void) flash_info[0].sector_count = snum; } +#ifdef CONFIG_AUTO_UPDATE + do_auto_update(); +#endif return (0); } |