Consolidate strmhz() implementation
[platform/kernel/u-boot.git] / lib_m68k / board.c
index d27c89c..e59c6b0 100644 (file)
 #include <i2c.h>
 #endif
 
+#ifdef CONFIG_CMD_SPI
+#include <spi.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static char *failed = "*** failed ***\n";
@@ -136,23 +140,6 @@ void *sbrk (ptrdiff_t increment)
        return ((void *)old);
 }
 
-char *strmhz(char *buf, long hz)
-{
-       long l, n;
-       long m;
-
-       n = hz / 1000000L;
-
-       l = sprintf (buf, "%ld", n);
-
-       m = (hz % 1000000L) / 1000L;
-
-       if (m != 0)
-               sprintf (buf+l, ".%03ld", m);
-
-       return (buf);
-}
-
 /*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
@@ -212,6 +199,16 @@ static int init_func_i2c (void)
 }
 #endif
 
+#if defined(CONFIG_HARD_SPI)
+static int init_func_spi (void)
+{
+       puts ("SPI:   ");
+       spi_init ();
+       puts ("ready\n");
+       return (0);
+}
+#endif
+
 /***********************************************************************/
 
 /************************************************************************
@@ -231,6 +228,9 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
        init_func_i2c,
 #endif
+#if defined(CONFIG_HARD_SPI)
+       init_func_spi,
+#endif
        init_func_ram,
 #if defined(CFG_DRAM_TEST)
        testdram,
@@ -347,11 +347,11 @@ board_init_f (ulong bootflag)
        addr_sp -= sizeof (bd_t);
        bd = (bd_t *) addr_sp;
        gd->bd = bd;
-       debug ("Reserving %d Bytes for Board Info at: %08lx\n",
+       debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
                        sizeof (bd_t), addr_sp);
        addr_sp -= sizeof (gd_t);
        id = (gd_t *) addr_sp;
-       debug ("Reserving %d Bytes for Global Data at: %08lx\n",
+       debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
                        sizeof (gd_t), addr_sp);
 
        /* Reserve memory for boot params. */