]> git.sur5r.net Git - u-boot/blobdiff - board/matrix_vision/mvblm7/mvblm7.c
Blackfin: bf537-stamp: use common spi boot workaround code
[u-boot] / board / matrix_vision / mvblm7 / mvblm7.c
index 6984af9847995316b7e873eb48ee64f591171a71..6a4ed525bf039818cb9b84f2dbe21fa885d6f9c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
+ * Copyright (C) Freescale Semiconductor, Inc. 2006.
  *
  * (C) Copyright 2008
  * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.de
@@ -34,6 +34,7 @@
 #include <libfdt.h>
 #endif
 
+#include "../common/mv_common.h"
 #include "mvblm7.h"
 
 int fixed_sdram(void)
@@ -42,8 +43,15 @@ int fixed_sdram(void)
        u32 msize = 0;
        u32 ddr_size;
        u32 ddr_size_log2;
+       char *s = getenv("ddr_size");
 
        msize = CONFIG_SYS_DDR_SIZE;
+       if (s) {
+               u32 env_ddr_size = simple_strtoul(s, NULL, 10);
+               if (env_ddr_size == 512)
+                       msize = 512;
+       }
+
        for (ddr_size = msize << 20, ddr_size_log2 = 0;
             (ddr_size > 1);
             ddr_size = ddr_size >> 1, ddr_size_log2++) {
@@ -63,14 +71,19 @@ int fixed_sdram(void)
        im->ddr.sdram_cfg = CONFIG_SYS_DDR_SDRAM_CFG;
        im->ddr.sdram_cfg2 = CONFIG_SYS_DDR_SDRAM_CFG2;
        im->ddr.sdram_mode = CONFIG_SYS_DDR_MODE;
+       im->ddr.sdram_mode2 = CONFIG_SYS_DDR_MODE2;
        im->ddr.sdram_interval = CONFIG_SYS_DDR_INTERVAL;
-       im->ddr.sdram_clk_cntl = CONFIG_SYS_DDR_CLK_CNTL;
+       im->ddr.sdram_clk_cntl = CONFIG_SYS_DDR_SDRAM_CLK_CNTL;
 
-       udelay(300);
+       asm("sync;isync");
+       udelay(600);
 
        im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN;
 
-       return CONFIG_SYS_DDR_SIZE;
+       asm("sync;isync");
+       udelay(500);
+
+       return msize;
 }
 
 phys_size_t initdram(int board_type)
@@ -88,40 +101,22 @@ phys_size_t initdram(int board_type)
        return msize * 1024 * 1024;
 }
 
-int checkboard(void)
+int misc_init_r(void)
 {
-       puts("Board: Matrix Vision mvBlueLYNX-M7\n");
-
-       return 0;
-}
+       char *s = getenv("reset_env");
 
-u8 *dhcp_vendorex_prep(u8 *e)
-{
-       char *ptr;
-
-       /* DHCP vendor-class-identifier = 60 */
-       ptr = getenv("dhcp_vendor-class-identifier");
-       if (ptr) {
-               *e++ = 60;
-               *e++ = strlen(ptr);
-               while (*ptr)
-                       *e++ = *ptr++;
-       }
-       /* DHCP_CLIENT_IDENTIFIER = 61 */
-       ptr = getenv("dhcp_client_id");
-       if (ptr) {
-               *e++ = 61;
-               *e++ = strlen(ptr);
-               while (*ptr)
-                       *e++ = *ptr++;
+       if (s) {
+               mv_reset_environment();
        }
 
-       return e;
+       return 0;
 }
 
-u8 *dhcp_vendorex_proc(u8 *popt)
+int checkboard(void)
 {
-       return NULL;
+       puts("Board: Matrix Vision mvBlueLYNX-M7\n");
+
+       return 0;
 }
 
 #ifdef CONFIG_HARD_SPI