Convert boards that set memory node to use fdt_fixup_memory()
[platform/kernel/u-boot.git] / board / cm5200 / cm5200.c
index 6804e33..79fb71d 100644 (file)
@@ -122,7 +122,7 @@ long int initdram(int board_type)
        mem_conf_t *mem_conf;
 
        mem_conf = get_mem_config(board_type);
-       
+
        /* configure SDRAM start/end for detection */
        *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e; /* 2G at 0x0 */
 
@@ -263,7 +263,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
 {
        int len, ret, nodeoffset = 0;
        char module_name[MODULE_NAME_MAXLEN] = {0};
-       ulong memory_data[2] = {0};
 
        compose_module_name(hw_id, module_name);
        len = strlen(module_name) + 1;
@@ -273,22 +272,12 @@ static void ft_blob_update(void *blob, bd_t *bd)
        printf("ft_blob_update(): cannot set /model property err:%s\n",
                fdt_strerror(ret));
 
-       memory_data[0] = cpu_to_be32(bd->bi_memstart);
-       memory_data[1] = cpu_to_be32(bd->bi_memsize);
+       ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 
-       nodeoffset = fdt_find_node_by_path (blob, "/memory");
-       if (nodeoffset >= 0) {
-               ret = fdt_setprop(blob, nodeoffset, "reg", memory_data,
-                                       sizeof(memory_data));
-       if (ret < 0)
+       if (ret < 0) {
                printf("ft_blob_update): cannot set /memory/reg "
                        "property err:%s\n", fdt_strerror(ret));
        }
-       else {
-               /* memory node is required in dts */
-               printf("ft_blob_update(): cannot find /memory node "
-               "err:%s\n", fdt_strerror(nodeoffset));
-       }
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
 
@@ -303,7 +292,7 @@ int checkboard(void)
        hw_id_t hw_id_tmp;
        char module_name_tmp[MODULE_NAME_MAXLEN] = "";
 
-       /* 
+       /*
         * We need I2C to access HW ID data from EEPROM, so we call i2c_init()
         * here despite the fact that it will be called again later on. We
         * also use a little trick to silence I2C-related output.
@@ -321,7 +310,7 @@ int checkboard(void)
        else
                printf("Board: unrecognized cm5200 module (%s)\n",
                        module_name_tmp);
-       
+
        return 0;
 }
 
@@ -397,6 +386,7 @@ int misc_init_r(void)
                                        "operational\n");
 
        /* set the hostname appropriate to the module we're running on */
+       hostname[0] = 0x00;
        compose_hostname(hw_id, hostname);
        setenv("hostname", hostname);