x86: Initialise SPI if enabled
[platform/kernel/u-boot.git] / arch / x86 / lib / init_helpers.c
index 547b180..d10a846 100644 (file)
@@ -28,7 +28,9 @@
 #include <net.h>
 #include <ide.h>
 #include <serial.h>
+#include <spi.h>
 #include <status_led.h>
+#include <asm/processor.h>
 #include <asm/u-boot-x86.h>
 
 #include <asm/init_helpers.h>
@@ -70,6 +72,45 @@ int init_baudrate_f(void)
        return 0;
 }
 
+int calculate_relocation_address(void)
+{
+       ulong text_start = (ulong)&__text_start;
+       ulong bss_end = (ulong)&__bss_end;
+       ulong dest_addr;
+
+       /*
+        * NOTE: All destination address are rounded down to 16-byte
+        *       boundary to satisfy various worst-case alignment
+        *       requirements
+        */
+
+       /* Stack is at top of available memory */
+       dest_addr = gd->ram_size;
+       gd->start_addr_sp = dest_addr;
+
+       /* U-Boot is below the stack */
+       dest_addr -= CONFIG_SYS_STACK_SIZE;
+       dest_addr -= (bss_end - text_start);
+       dest_addr &= ~15;
+       gd->relocaddr = dest_addr;
+       gd->reloc_off = (dest_addr - text_start);
+
+       return 0;
+}
+
+int init_cache_f_r(void)
+{
+       /* Initialise the CPU cache(s) */
+       return init_cache();
+}
+
+int set_reloc_flag_r(void)
+{
+       gd->flags = GD_FLG_RELOC;
+
+       return 0;
+}
+
 int mem_malloc_init_r(void)
 {
        mem_malloc_init(((gd->relocaddr - CONFIG_SYS_MALLOC_LEN)+3)&~3,
@@ -104,14 +145,6 @@ int flash_init_r(void)
 }
 #endif
 
-int init_ip_address_r(void)
-{
-       /* IP Address */
-       bd_data.bi_ip_addr = getenv_IPaddr("ipaddr");
-
-       return 0;
-}
-
 #ifdef CONFIG_STATUS_LED
 int status_led_set_r(void)
 {
@@ -121,22 +154,18 @@ int status_led_set_r(void)
 }
 #endif
 
-int set_bootfile_r(void)
+int set_load_addr_r(void)
 {
-       char *s;
-
-       s = getenv("bootfile");
-
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
+       /* Initialize from environment */
+       load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
        return 0;
 }
 
-int set_load_addr_r(void)
+int init_func_spi(void)
 {
-       /* Initialize from environment */
-       load_addr = getenv_ulong("loadaddr", 16, load_addr);
-
+       puts("SPI:   ");
+       spi_init();
+       puts("ready\n");
        return 0;
 }