m68k: Use getenv_ulong() in place of getenv(), strtoul

This changes the board code to use the new getenv_ulong() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
master
Simon Glass 13 years ago committed by Wolfgang Denk
parent c1f485a1e8
commit 77b8f2033b
  1. 33
      arch/m68k/lib/board.c

@ -119,13 +119,8 @@ typedef int (init_fnc_t) (void);
static int init_baudrate (void) static int init_baudrate (void)
{ {
char tmp[64]; /* long enough for environment variables */ gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
int i = getenv_f("baudrate", tmp, sizeof (tmp)); return 0;
gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
: CONFIG_BAUDRATE;
return (0);
} }
/***********************************************************************/ /***********************************************************************/
@ -221,9 +216,7 @@ board_init_f (ulong bootflag)
gd_t *id; gd_t *id;
init_fnc_t **init_fnc_ptr; init_fnc_t **init_fnc_ptr;
#ifdef CONFIG_PRAM #ifdef CONFIG_PRAM
int i;
ulong reg; ulong reg;
char tmp[64]; /* long enough for environment variables */
#endif #endif
/* Pointer is writable since we allocated a register for it */ /* Pointer is writable since we allocated a register for it */
@ -264,8 +257,7 @@ board_init_f (ulong bootflag)
/* /*
* reserve protected RAM * reserve protected RAM
*/ */
i = getenv_f("pram", tmp, sizeof (tmp)); reg = getenv_ulong("pram", 10, CONFIG_PRAM);
reg = (i > 0) ? simple_strtoul (tmp, NULL, 10) : CONFIG_PRAM;
addr -= (reg << 10); /* size is in kB */ addr -= (reg << 10); /* size is in kB */
debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr); debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
#endif /* CONFIG_PRAM */ #endif /* CONFIG_PRAM */
@ -575,9 +567,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
/* Insert function pointers now that we have relocated the code */ /* Insert function pointers now that we have relocated the code */
/* Initialize from environment */ /* Initialize from environment */
if ((s = getenv ("loadaddr")) != NULL) { load_addr = getenv_ulong("loadaddr", 16, load_addr);
load_addr = simple_strtoul (s, NULL, 16);
}
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
if ((s = getenv ("bootfile")) != NULL) { if ((s = getenv ("bootfile")) != NULL) {
copy_filename (BootFile, s, sizeof (BootFile)); copy_filename (BootFile, s, sizeof (BootFile));
@ -648,18 +638,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
* taking into account the protected RAM at top of memory * taking into account the protected RAM at top of memory
*/ */
{ {
ulong pram; ulong pram = 0;
char memsz[32]; uchar memsz[32];
#ifdef CONFIG_PRAM
char *s;
if ((s = getenv ("pram")) != NULL) { #ifdef CONFIG_PRAM
pram = simple_strtoul (s, NULL, 10); pram = getenv_ulong("pram", 10, CONFIG_PRAM);
} else {
pram = CONFIG_PRAM;
}
#else
pram=0;
#endif #endif
#ifdef CONFIG_LOGBUFFER #ifdef CONFIG_LOGBUFFER
/* Also take the logbuffer into account (pram is in kB) */ /* Also take the logbuffer into account (pram is in kB) */

Loading…
Cancel
Save