summaryrefslogtreecommitdiffstats
path: root/tools/updater
diff options
context:
space:
mode:
Diffstat (limited to 'tools/updater')
-rw-r--r--tools/updater/Makefile8
-rw-r--r--tools/updater/cmd_flash.c17
-rw-r--r--tools/updater/flash_hw.c15
-rw-r--r--tools/updater/string.c6
-rw-r--r--tools/updater/update.c2
-rw-r--r--tools/updater/utils.c116
6 files changed, 81 insertions, 83 deletions
diff --git a/tools/updater/Makefile b/tools/updater/Makefile
index a8fb4ced3d..21b11ca409 100644
--- a/tools/updater/Makefile
+++ b/tools/updater/Makefile
@@ -29,9 +29,9 @@ PROG = updater
IMAGE = updater.image
SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c
ASRC = ppcstring.S
-OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
+OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
-LIB = $(TOPDIR)/examples/libsyscall.a
+LIB = $(TOPDIR)/examples/libsyscall.a
LIBAOBJS= $(TOPDIR)/examples/syscall.o
LIBCOBJS=
LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
@@ -50,14 +50,14 @@ $(LIB): .depend $(LIBOBJS)
$(OBJCOPY) -O srec $(<:.o=) $@
%.o: %.c
- $(CC) $(CPPFLAGS) -c $<
+ $(CC) $(CPPFLAGS) -c $<
%.o: %.S
$(CC) $(CPPFLAGS) -c $<
#########################################################################
-updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
+updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
$(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB) \
$(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
$(OBJCOPY) -O binary updater updater.bin
diff --git a/tools/updater/cmd_flash.c b/tools/updater/cmd_flash.c
index f3465f1d5b..573546dbe9 100644
--- a/tools/updater/cmd_flash.c
+++ b/tools/updater/cmd_flash.c
@@ -26,7 +26,6 @@
*/
#include <common.h>
#include <command.h>
-#include <cmd_boot.h>
#include <flash.h>
#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
@@ -227,7 +226,7 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
}
}
if (erased) {
- // mon_printf ("Erased %d sectors\n", erased);
+ /* mon_printf ("Erased %d sectors\n", erased); */
} else {
mon_printf ("Error: start and/or end address"
" not on sector boundary\n");
@@ -264,8 +263,8 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
if (info->flash_id == FLASH_UNKNOWN) {
continue;
}
- //mon_printf ("%sProtect Flash Bank # %ld\n",
- // p ? "" : "Un-", bank);
+ /*mon_printf ("%sProtect Flash Bank # %ld\n", */
+ /* p ? "" : "Un-", bank); */
for (i=0; i<info->sector_count; ++i) {
#if defined(CFG_FLASH_PROTECTION)
@@ -290,9 +289,9 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
mon_printf("Bad sector specification\n");
return 1;
}
- //mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
- // p ? "" : "Un-", sect_first, sect_last,
- // (info-flash_info)+1);
+ /*mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */
+ /* p ? "" : "Un-", sect_first, sect_last, */
+ /* (info-flash_info)+1); */
for (i = sect_first; i <= sect_last; i++) {
#if defined(CFG_FLASH_PROTECTION)
if (flash_real_protect(info, i, p))
@@ -418,8 +417,8 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
}
if (protected) {
- // mon_printf ("%sProtected %d sectors\n",
- // p ? "" : "Un-", protected);
+ /* mon_printf ("%sProtected %d sectors\n", */
+ /* p ? "" : "Un-", protected); */
} else {
mon_printf ("Error: start and/or end address"
" not on sector boundary\n");
diff --git a/tools/updater/flash_hw.c b/tools/updater/flash_hw.c
index ec11589c77..1d782c61e0 100644
--- a/tools/updater/flash_hw.c
+++ b/tools/updater/flash_hw.c
@@ -31,7 +31,6 @@
/*---------------------------------------------------------------------*/
#undef DEBUG_FLASH
-//#define DEBUG_FLASH
#ifdef DEBUG_FLASH
#define DEBUGF(fmt,args...) mon_printf(fmt ,##args)
@@ -68,7 +67,7 @@ static void flash_to_mem(void)
unsigned char x;
flash_xd_nest --;
-
+
if (flash_xd_nest == 0)
{
DEBUGF("Flash on memory bus\n");
@@ -327,7 +326,7 @@ static int flash_get_offsets (ulong base, flash_info_t *info)
/* set sector offsets for uniform sector type */
for (i = 0; i < info->sector_count; i++) {
info->start[i] = base + i * info->size /
- info->sector_count;
+ info->sector_count;
}
break;
default:
@@ -479,7 +478,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
}
if ((rc = write_word(info, wp, data)) != 0) {
- flash_to_mem();
+ flash_to_mem();
return (rc);
}
wp += 4;
@@ -491,7 +490,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
* handle word aligned part
*/
while (cnt >= 4) {
- if (out_cnt>26214)
+ if (out_cnt>26214)
{
mon_putc(219);
out_cnt = 0;
@@ -590,7 +589,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
*/
static void flash_reset (ulong addr)
{
- flash_to_xd();
+ flash_to_xd();
out8(addr, 0xF0); /* reset bank */
iobarrier_rw();
flash_to_mem();
@@ -641,10 +640,10 @@ void flash_print_info (flash_info_t *info)
info->size / 0x100000, info->sector_count);
} else if (info->size % 0x400 == 0) {
mon_printf (" Size: %ld KB in %d Sectors\n",
- info->size / 0x400, info->sector_count);
+ info->size / 0x400, info->sector_count);
} else {
mon_printf (" Size: %ld B in %d Sectors\n",
- info->size, info->sector_count);
+ info->size, info->sector_count);
}
mon_printf (" Sector Start Addresses:");
diff --git a/tools/updater/string.c b/tools/updater/string.c
index 50537a6554..8a8edec5cf 100644
--- a/tools/updater/string.c
+++ b/tools/updater/string.c
@@ -129,8 +129,8 @@ char * strrchr(const char * s, int c)
{
const char *p = s + strlen(s);
do {
- if (*p == (char)c)
- return (char *)p;
+ if (*p == (char)c)
+ return (char *)p;
} while (--p >= s);
return NULL;
}
@@ -316,7 +316,7 @@ void * memscan(void * addr, int c, size_t size)
p++;
size--;
}
- return (void *) p;
+ return (void *) p;
}
#endif
diff --git a/tools/updater/update.c b/tools/updater/update.c
index 66c6dfc30d..26204fb632 100644
--- a/tools/updater/update.c
+++ b/tools/updater/update.c
@@ -35,7 +35,7 @@ void _main(void)
mon_printf("\nUpdate done. Please remove diskette.\n");
mon_printf("The machine will automatically reset in %d seconds\n", i);
mon_printf("You can switch off/reset now when the floppy is removed\n\n");
-
+
while (i)
{
mon_printf("Resetting in %d\r", i);
diff --git a/tools/updater/utils.c b/tools/updater/utils.c
index e230e19f92..0304f94c10 100644
--- a/tools/updater/utils.c
+++ b/tools/updater/utils.c
@@ -15,7 +15,7 @@ get_msr(void)
static __inline__ void
set_msr(unsigned long msr)
{
- asm volatile("mtmsr %0" : : "r" (msr));
+ asm volatile("mtmsr %0" : : "r" (msr));
}
static __inline__ unsigned long
@@ -31,7 +31,7 @@ get_dec(void)
static __inline__ void
set_dec(unsigned long val)
{
- asm volatile("mtdec %0" : : "r" (val));
+ asm volatile("mtdec %0" : : "r" (val));
}
@@ -69,80 +69,80 @@ unsigned long in32(u32 port)
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
- unsigned long result = 0,value;
-
- if (*cp == '0') {
- cp++;
- if ((*cp == 'x') && isxdigit(cp[1])) {
- base = 16;
- cp++;
- }
- if (!base) {
- base = 8;
- }
- }
- if (!base) {
- base = 10;
- }
- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
- ? toupper(*cp) : *cp)-'A'+10) < base) {
- result = result*base + value;
- cp++;
- }
- if (endp)
- *endp = (char *)cp;
- return result;
+ unsigned long result = 0,value;
+
+ if (*cp == '0') {
+ cp++;
+ if ((*cp == 'x') && isxdigit(cp[1])) {
+ base = 16;
+ cp++;
+ }
+ if (!base) {
+ base = 8;
+ }
+ }
+ if (!base) {
+ base = 10;
+ }
+ while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+ ? toupper(*cp) : *cp)-'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }
+ if (endp)
+ *endp = (char *)cp;
+ return result;
}
long simple_strtol(const char *cp,char **endp,unsigned int base)
{
- if(*cp=='-')
- return -simple_strtoul(cp+1,endp,base);
- return simple_strtoul(cp,endp,base);
+ if(*cp=='-')
+ return -simple_strtoul(cp+1,endp,base);
+ return simple_strtoul(cp,endp,base);
}
static inline void
soft_restart(unsigned long addr)
{
- /* SRR0 has system reset vector, SRR1 has default MSR value */
- /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
+ /* SRR0 has system reset vector, SRR1 has default MSR value */
+ /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
- __asm__ __volatile__ ("mtspr 26, %0" :: "r" (addr));
- __asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
- __asm__ __volatile__ ("mtspr 27, 4");
- __asm__ __volatile__ ("rfi");
+ __asm__ __volatile__ ("mtspr 26, %0" :: "r" (addr));
+ __asm__ __volatile__ ("li 4, (1 << 6)" ::: "r4");
+ __asm__ __volatile__ ("mtspr 27, 4");
+ __asm__ __volatile__ ("rfi");
- while(1); /* not reached */
+ while(1); /* not reached */
}
void
do_reset (void)
{
- ulong addr;
- /* flush and disable I/D cache */
- __asm__ __volatile__ ("mfspr 3, 1008" ::: "r3");
- __asm__ __volatile__ ("ori 5, 5, 0xcc00" ::: "r5");
- __asm__ __volatile__ ("ori 4, 3, 0xc00" ::: "r4");
- __asm__ __volatile__ ("andc 5, 3, 5" ::: "r5");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 4");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
- __asm__ __volatile__ ("mtspr 1008, 5");
- __asm__ __volatile__ ("isync");
- __asm__ __volatile__ ("sync");
+ ulong addr;
+ /* flush and disable I/D cache */
+ __asm__ __volatile__ ("mfspr 3, 1008" ::: "r3");
+ __asm__ __volatile__ ("ori 5, 5, 0xcc00" ::: "r5");
+ __asm__ __volatile__ ("ori 4, 3, 0xc00" ::: "r4");
+ __asm__ __volatile__ ("andc 5, 3, 5" ::: "r5");
+ __asm__ __volatile__ ("sync");
+ __asm__ __volatile__ ("mtspr 1008, 4");
+ __asm__ __volatile__ ("isync");
+ __asm__ __volatile__ ("sync");
+ __asm__ __volatile__ ("mtspr 1008, 5");
+ __asm__ __volatile__ ("isync");
+ __asm__ __volatile__ ("sync");
#ifdef CFG_RESET_ADDRESS
- addr = CFG_RESET_ADDRESS;
+ addr = CFG_RESET_ADDRESS;
#else
- /*
- * note: when CFG_MONITOR_BASE points to a RAM address,
- * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
- * address. Better pick an address known to be invalid on your
- * system and assign it to CFG_RESET_ADDRESS.
- */
- addr = CFG_MONITOR_BASE - sizeof (ulong);
+ /*
+ * note: when CFG_MONITOR_BASE points to a RAM address,
+ * CFG_MONITOR_BASE - sizeof (ulong) is usually a valid
+ * address. Better pick an address known to be invalid on your
+ * system and assign it to CFG_RESET_ADDRESS.
+ */
+ addr = CFG_MONITOR_BASE - sizeof (ulong);
#endif
- soft_restart(addr);
- while(1); /* not reached */
+ soft_restart(addr);
+ while(1); /* not reached */
}
OpenPOWER on IntegriCloud