]> git.sur5r.net Git - u-boot/blobdiff - arch/powerpc/cpu/mpc8xxx/ddr/interactive.c
powerpc: Use print_size() where appropriate
[u-boot] / arch / powerpc / cpu / mpc8xxx / ddr / interactive.c
index e5ee7754640c6023920f1583fea6a62b03f2820e..260fce577f33617f9daac1892f27cbb80e4030a0 100644 (file)
@@ -1,9 +1,7 @@
 /*
  * Copyright 2010-2012 Freescale Semiconductor, Inc.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * Version 2 or any later versionas published by the Free Software Foundation.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -207,6 +205,7 @@ static void fsl_ddr_dimm_parameters_edit(fsl_ddr_info_t *pinfo,
                DIMM_PARM(primary_sdram_width),
                DIMM_PARM(ec_sdram_width),
                DIMM_PARM(registered_dimm),
+               DIMM_PARM(device_width),
 
                DIMM_PARM(n_row_addr),
                DIMM_PARM(n_col_addr),
@@ -265,6 +264,7 @@ static void print_dimm_parameters(const dimm_params_t *pdimm)
                DIMM_PARM(primary_sdram_width),
                DIMM_PARM(ec_sdram_width),
                DIMM_PARM(registered_dimm),
+               DIMM_PARM(device_width),
 
                DIMM_PARM(n_row_addr),
                DIMM_PARM(n_col_addr),
@@ -445,6 +445,7 @@ static void fsl_ddr_options_edit(fsl_ddr_info_t *pinfo,
                CTRL_OPTIONS(twoT_en),
                CTRL_OPTIONS(threeT_en),
                CTRL_OPTIONS(ap_en),
+               CTRL_OPTIONS(x4_en),
                CTRL_OPTIONS(bstopre),
                CTRL_OPTIONS(wrlvl_override),
                CTRL_OPTIONS(wrlvl_sample),
@@ -689,6 +690,7 @@ static void print_memctl_options(const memctl_options_t *popts)
                CTRL_OPTIONS(threeT_en),
                CTRL_OPTIONS(registered_dimm_en),
                CTRL_OPTIONS(ap_en),
+               CTRL_OPTIONS(x4_en),
                CTRL_OPTIONS(bstopre),
                CTRL_OPTIONS(wrlvl_override),
                CTRL_OPTIONS(wrlvl_sample),
@@ -1430,11 +1432,23 @@ static unsigned int fsl_ddr_parse_interactive_cmd(
        return error;
 }
 
-unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo)
+int fsl_ddr_interactive_env_var_exists(void)
+{
+       char buffer[CONFIG_SYS_CBSIZE];
+
+       if (getenv_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
+               return 1;
+
+       return 0;
+}
+
+unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
 {
        unsigned long long ddrsize;
        const char *prompt = "FSL DDR>";
        char buffer[CONFIG_SYS_CBSIZE];
+       char buffer2[CONFIG_SYS_CBSIZE];
+       char *p = NULL;
        char *argv[CONFIG_SYS_MAXARGS + 1];     /* NULL terminated */
        int argc;
        unsigned int next_step = STEP_GET_SPD;
@@ -1451,16 +1465,39 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo)
                "go         program the memory controller and continue with u-boot\n"
        };
 
+       if (var_is_set) {
+               if (getenv_f("ddr_interactive", buffer2, CONFIG_SYS_CBSIZE) > 0) {
+                       p = buffer2;
+               } else {
+                       var_is_set = 0;
+               }
+       }
+
        /*
         * The strategy for next_step is that it points to the next
         * step in the computation process that needs to be done.
         */
        while (1) {
-               /*
-                * No need to worry for buffer overflow here in
-                * this function;  readline() maxes out at CFG_CBSIZE
-                */
-               readline_into_buffer(prompt, buffer, 0);
+               if (var_is_set) {
+                       char *pend = strchr(p, ';');
+                       if (pend) {
+                               /* found command separator, copy sub-command */
+                               *pend = '\0';
+                               strcpy(buffer, p);
+                               p = pend + 1;
+                       } else {
+                               /* separator not found, copy whole string */
+                               strcpy(buffer, p);
+                               p = NULL;
+                               var_is_set = 0;
+                       }
+               } else {
+                       /*
+                        * No need to worry for buffer overflow here in
+                        * this function;  readline() maxes out at CFG_CBSIZE
+                        */
+                       readline_into_buffer(prompt, buffer, 0);
+               }
                argc = parse_line(buffer, argv);
                if (argc == 0)
                        continue;