[U-Boot] [PATCH v2 08/19] env: Distinguish finer between source of env change

2015-04-28 Thread Joe Hershberger
We already could tell the difference in the callback between an import
and "other" which we called interactive. Now add further distinction
between interactive (i.e. running env set / env edit / env ask / etc.
from the U-Boot command line) and programmatic (i.e. when u-boot source
calls any variant of setenv() ).

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 common/cmd_nvedit.c | 26 +++---
 include/search.h|  2 ++
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 6ca5a2e..f4c2523 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -208,12 +208,11 @@ DONE:
  * Set a new environment variable,
  * or replace or delete an existing one.
  */
-static int _do_env_set(int flag, int argc, char * const argv[])
+static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
 {
int   i, len;
char  *name, *value, *s;
ENTRY e, *ep;
-   int env_flag = H_INTERACTIVE;
 
debug("Initial value for argc=%d\n", argc);
while (argc > 1 && **(argv + 1) == '-') {
@@ -291,9 +290,9 @@ int setenv(const char *varname, const char *varvalue)
return 1;
 
if (varvalue == NULL || varvalue[0] == '\0')
-   return _do_env_set(0, 2, (char * const *)argv);
+   return _do_env_set(0, 2, (char * const *)argv, H_PROGRAMMATIC);
else
-   return _do_env_set(0, 3, (char * const *)argv);
+   return _do_env_set(0, 3, (char * const *)argv, H_PROGRAMMATIC);
 }
 
 /**
@@ -347,7 +346,7 @@ static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (argc < 2)
return CMD_RET_USAGE;
 
-   return _do_env_set(flag, argc, argv);
+   return _do_env_set(flag, argc, argv, H_INTERACTIVE);
 }
 
 /*
@@ -422,7 +421,7 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
}
 
/* Continue calling setenv code */
-   return _do_env_set(flag, len, local_args);
+   return _do_env_set(flag, len, local_args, H_INTERACTIVE);
 }
 #endif
 
@@ -588,6 +587,10 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int 
argc,
if (argc < 2)
return CMD_RET_USAGE;
 
+   /* before import into hashtable */
+   if (!(gd->flags & GD_FLG_ENV_READY))
+   return 1;
+
/* Set read buffer to initial value or empty sting */
init_val = getenv(argv[1]);
if (init_val)
@@ -598,7 +601,16 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int 
argc,
if (cli_readline_into_buffer("edit: ", buffer, 0) < 0)
return 1;
 
-   return setenv(argv[1], buffer);
+   if (buffer[0] == '\0') {
+   const char * const _argv[3] = { "setenv", argv[1], NULL };
+
+   return _do_env_set(0, 2, (char * const *)_argv, H_INTERACTIVE);
+   } else {
+   const char * const _argv[4] = { "setenv", argv[1], buffer,
+   NULL };
+
+   return _do_env_set(0, 3, (char * const *)_argv, H_INTERACTIVE);
+   }
 }
 #endif /* CONFIG_CMD_EDITENV */
 #endif /* CONFIG_SPL_BUILD */
diff --git a/include/search.h b/include/search.h
index 9701efb..343dbc3 100644
--- a/include/search.h
+++ b/include/search.h
@@ -120,5 +120,7 @@ extern int hwalk_r(struct hsearch_data *__htab, int 
(*callback)(ENTRY *));
 #define H_MATCH_SUBSTR (1 << 7) /* search for substring matches */
 #define H_MATCH_REGEX  (1 << 8) /* search for regular expression matches*/
 #define H_MATCH_METHOD (H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX)
+#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from setenv() */
+#define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC)
 
 #endif /* search.h */
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 06/19] env: Allow env_attr_walk to pass a priv * to callback

2015-04-28 Thread Joe Hershberger
In some cases it can be helpful to have context in the callback about
the calling situation. This is needed for following patches.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 common/cmd_nvedit.c   | 10 ++
 common/env_attr.c |  5 +++--
 common/env_callback.c |  6 +++---
 common/env_flags.c|  6 +++---
 include/env_attr.h| 10 +-
 5 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index be792ae..6ca5a2e 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -427,7 +427,8 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 #endif
 
 #if defined(CONFIG_CMD_ENV_CALLBACK)
-static int print_static_binding(const char *var_name, const char 
*callback_name)
+static int print_static_binding(const char *var_name, const char 
*callback_name,
+   void *priv)
 {
printf("\t%-20s %-20s\n", var_name, callback_name);
 
@@ -489,7 +490,7 @@ int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
puts("Static callback bindings:\n");
printf("\t%-20s %-20s\n", "Variable Name", "Callback Name");
printf("\t%-20s %-20s\n", "-", "-");
-   env_attr_walk(ENV_CALLBACK_LIST_STATIC, print_static_binding);
+   env_attr_walk(ENV_CALLBACK_LIST_STATIC, print_static_binding, NULL);
puts("\n");
 
/* walk through each variable and print the callback if it has one */
@@ -502,7 +503,8 @@ int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 #endif
 
 #if defined(CONFIG_CMD_ENV_FLAGS)
-static int print_static_flags(const char *var_name, const char *flags)
+static int print_static_flags(const char *var_name, const char *flags,
+ void *priv)
 {
enum env_flags_vartype type = env_flags_parse_vartype(flags);
enum env_flags_varaccess access = env_flags_parse_varaccess(flags);
@@ -559,7 +561,7 @@ int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
"Variable Access");
printf("\t%-20s %-20s %-20s\n", "-", "-",
"---");
-   env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags);
+   env_attr_walk(ENV_FLAGS_LIST_STATIC, print_static_flags, NULL);
puts("\n");
 
/* walk through each variable and print the flags if non-default */
diff --git a/common/env_attr.c b/common/env_attr.c
index 6e13184..b9de16f 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -26,7 +26,8 @@
  * list = entry[,list]
  */
 int env_attr_walk(const char *attr_list,
-   int (*callback)(const char *name, const char *attributes))
+   int (*callback)(const char *name, const char *attributes, void *priv),
+   void *priv)
 {
const char *entry, *entry_end;
char *name, *attributes;
@@ -93,7 +94,7 @@ int env_attr_walk(const char *attr_list,
if (strlen(name) != 0) {
int retval = 0;
 
-   retval = callback(name, attributes);
+   retval = callback(name, attributes, priv);
if (retval) {
free(entry_cpy);
return retval;
diff --git a/common/env_callback.c b/common/env_callback.c
index d03fa03..f4d3dbd 100644
--- a/common/env_callback.c
+++ b/common/env_callback.c
@@ -90,7 +90,7 @@ static int clear_callback(ENTRY *entry)
 /*
  * Call for each element in the list that associates variables to callbacks
  */
-static int set_callback(const char *name, const char *value)
+static int set_callback(const char *name, const char *value, void *priv)
 {
ENTRY e, *ep;
struct env_clbk_tbl *clbkp;
@@ -126,9 +126,9 @@ static int on_callbacks(const char *name, const char 
*value, enum env_op op,
hwalk_r(&env_htab, clear_callback);
 
/* configure any static callback bindings */
-   env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback);
+   env_attr_walk(ENV_CALLBACK_LIST_STATIC, set_callback, NULL);
/* configure any dynamic callback bindings */
-   env_attr_walk(value, set_callback);
+   env_attr_walk(value, set_callback, NULL);
 
return 0;
 }
diff --git a/common/env_flags.c b/common/env_flags.c
index 985f92e..5189f5b 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -435,7 +435,7 @@ static int clear_flags(ENTRY *entry)
 /*
  * Call for each element in the list that defines flags for a variable
  */
-static int set_flags(const char *name, const char *value)
+static int set_flags(const char *name, const char *value, void *priv)
 {
ENTRY e, *ep;
 
@@ -463,9 +463,9 @@ static int on_flags(const char *name, const char *value, 
enum env_op op,
hwalk_r(&env_htab, clear_flags);
 
/* configure any stat

[U-Boot] [PATCH v2 12/19] test: Generalize the unit test framework

2015-04-28 Thread Joe Hershberger
Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistenly throughout all
tests.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 include/dm/test.h | 35 +-
 include/test/test.h   | 47 ++
 include/{dm => test}/ut.h | 28 +-
 test/Kconfig  |  3 ++
 test/Makefile |  1 +
 test/dm/Kconfig   |  1 +
 test/dm/Makefile  |  2 --
 test/dm/bus.c | 39 +
 test/dm/core.c| 74 +--
 test/dm/eth.c | 14 -
 test/dm/gpio.c| 22 +++---
 test/dm/i2c.c | 20 ++---
 test/dm/pci.c |  6 ++--
 test/dm/sf.c  |  4 +--
 test/dm/spi.c |  8 ++---
 test/dm/test-driver.c |  6 ++--
 test/dm/test-fdt.c| 16 +-
 test/dm/test-main.c   | 36 +--
 test/dm/test-uclass.c |  7 +++--
 test/dm/usb.c |  6 ++--
 test/{dm => }/ut.c| 16 +-
 21 files changed, 217 insertions(+), 174 deletions(-)
 create mode 100644 include/test/test.h
 rename include/{dm => test}/ut.h (79%)
 rename test/{dm => }/ut.c (59%)

diff --git a/include/dm/test.h b/include/dm/test.h
index f03fbcb..98f2b9e 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -8,7 +8,7 @@
 #define __DM_TEST_H
 
 #include 
-#include 
+#include 
 
 /**
  * struct dm_test_cdata - configuration data for test instance
@@ -124,7 +124,7 @@ struct dm_test_perdev_uc_pdata {
  */
 extern int dm_testdrv_op_count[DM_TEST_OP_COUNT];
 
-extern struct dm_test_state global_test_state;
+extern struct unit_test_state global_dm_test_state;
 
 /*
  * struct dm_test_state - Entire state of dm test system
@@ -133,7 +133,6 @@ extern struct dm_test_state global_test_state;
  *
  * @root: Root device
  * @testdev: Test device
- * @fail_count: Number of tests that failed
  * @force_fail_alloc: Force all memory allocs to fail
  * @skip_post_probe: Skip uclass post-probe processing
  * @removed: Used to keep track of a device that was removed
@@ -141,11 +140,9 @@ extern struct dm_test_state global_test_state;
 struct dm_test_state {
struct udevice *root;
struct udevice *testdev;
-   int fail_count;
int force_fail_alloc;
int skip_post_probe;
struct udevice *removed;
-   struct mallinfo start;
 };
 
 /* Test flags for each test */
@@ -155,26 +152,8 @@ enum {
DM_TESTF_SCAN_FDT   = 1 << 2,   /* scan device tree */
 };
 
-/**
- * struct dm_test - Information about a driver model test
- *
- * @name: Name of test
- * @func: Function to call to perform test
- * @flags: Flags indicated pre-conditions for test
- */
-struct dm_test {
-   const char *name;
-   int (*func)(struct dm_test_state *dms);
-   int flags;
-};
-
 /* Declare a new driver model test */
-#define DM_TEST(_name, _flags) \
-   ll_entry_declare(struct dm_test, _name, dm_test) = {\
-   .name = #_name, \
-   .flags = _flags,\
-   .func = _name,  \
-   }
+#define DM_TEST(_name, _flags) UNIT_TEST(_name, _flags, dm_test)
 
 /* Declare ping methods for the drivers */
 int test_ping(struct udevice *dev, int pingval, int *pingret);
@@ -191,7 +170,7 @@ int testfdt_ping(struct udevice *dev, int pingval, int 
*pingret);
  * @priv: Pointer to private test information
  * @return 0 if OK, -ve on error
  */
-int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
+int dm_check_operations(struct unit_test_state *uts, struct udevice *dev,
uint32_t base, struct dm_test_priv *priv);
 
 /**
@@ -201,7 +180,7 @@ int dm_check_operations(struct dm_test_state *dms, struct 
udevice *dev,
  * @num_devices: Number of test devices to check
  * @return 0 if OK, -ve on error
  */
-int dm_check_devices(struct dm_test_state *dms, int num_devices);
+int dm_check_devices(struct unit_test_state *uts, int num_devices);
 
 /**
  * dm_leak_check_start() - Prepare to check for a memory leak
@@ -211,7 +190,7 @@ int dm_check_devices(struct dm_test_state *dms, int 
num_devices);
  *
  * @dms: Overall test state
  */
-void dm_leak_check_start(struct dm_test_state *dms);
+void dm_leak_check_start(struct unit_test_state *uts);
 
 /**
  * dm_leak_check_end() - Check that no memory has leaked
@@ -221,7 +200,7 @@ void dm_leak_check_start(struct dm_test_state *dms);
  * it sees a different amount of total memory allocated than before.
  *
  * @dms: Overall test state
- */int dm_leak_check_end(struct dm_test_state *dms);
+ */int dm_leak_check_end(struct unit_test_state *uts);
 
 
 /**
diff --git a/include/test/test.h b/include/test/

[U-Boot] [PATCH v2 07/19] env: Add regex support to env_attrs

2015-04-28 Thread Joe Hershberger
Allow the features that use env_attrs to specify regexs for the name

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2:
-Added description to README

 README |  8 +
 common/env_attr.c  | 85 ++
 include/env_callback.h | 10 --
 3 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/README b/README
index ee65fdb..5956329 100644
--- a/README
+++ b/README
@@ -4157,6 +4157,10 @@ Configuration Settings:
list, simply add an entry for the same variable name to the
".flags" variable.
 
+   If CONFIG_REGEX is defined, the variable_name above is evaluated as a
+   regular expression. This allows multiple variables to define the same
+   flags without explicitly listing them for each variable.
+
 - CONFIG_ENV_ACCESS_IGNORE_FORCE
If defined, don't allow the -f switch to env set override variable
access flags.
@@ -,6 +5559,10 @@ override any association in the static list. You can 
define
 CONFIG_ENV_CALLBACK_LIST_DEFAULT to a list (string) to define the
 ".callbacks" environment variable in the default or embedded environment.
 
+If CONFIG_REGEX is defined, the variable_name above is evaluated as a
+regular expression. This allows multiple variables to be connected to
+the same callback without explicitly listing them all out.
+
 
 Command Line Parsing:
 =
diff --git a/common/env_attr.c b/common/env_attr.c
index b9de16f..5bfe5e3 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -11,6 +11,7 @@
 #include 
 #else
 #include 
+#include 
 #endif
 
 #include 
@@ -109,6 +110,89 @@ int env_attr_walk(const char *attr_list,
return 0;
 }
 
+#if defined(CONFIG_REGEX)
+struct regex_callback_priv {
+   const char *searched_for;
+   char *regex;
+   char *attributes;
+};
+
+static int regex_callback(const char *name, const char *attributes, void *priv)
+{
+   int retval = 0;
+   struct regex_callback_priv *cbp = (struct regex_callback_priv *)priv;
+   struct slre slre;
+   char regex[strlen(name) + 3];
+
+   /* Require the whole string to be described by the regex */
+   sprintf(regex, "^%s$", name);
+   if (slre_compile(&slre, regex)) {
+   struct cap caps[slre.num_caps + 2];
+
+   if (slre_match(&slre, cbp->searched_for,
+  strlen(cbp->searched_for), caps)) {
+   free(cbp->regex);
+   cbp->regex = malloc(strlen(regex) + 1);
+   if (cbp->regex) {
+   strcpy(cbp->regex, regex);
+   } else {
+   retval = -ENOMEM;
+   goto done;
+   }
+
+   free(cbp->attributes);
+   cbp->attributes = malloc(strlen(attributes) + 1);
+   if (cbp->attributes) {
+   strcpy(cbp->attributes, attributes);
+   } else {
+   retval = -ENOMEM;
+   free(cbp->regex);
+   cbp->regex = NULL;
+   goto done;
+   }
+   }
+   } else {
+   printf("Error compiling regex: %s\n", slre.err_str);
+   retval = EINVAL;
+   }
+done:
+   return retval;
+}
+
+/*
+ * Retrieve the attributes string associated with a single name in the list
+ * There is no protection on attributes being too small for the value
+ */
+int env_attr_lookup(const char *attr_list, const char *name, char *attributes)
+{
+   if (!attributes)
+   /* bad parameter */
+   return -EINVAL;
+   if (!attr_list)
+   /* list not found */
+   return -EINVAL;
+
+   struct regex_callback_priv priv;
+   int retval;
+
+   priv.searched_for = name;
+   priv.regex = NULL;
+   priv.attributes = NULL;
+   retval = env_attr_walk(attr_list, regex_callback, &priv);
+   if (retval)
+   return retval; /* error */
+
+   if (priv.regex) {
+   strcpy(attributes, priv.attributes);
+   free(priv.attributes);
+   free(priv.regex);
+   /* success */
+   return 0;
+   }
+   return -ENOENT; /* not found in list */
+}
+#else
+
 /*
  * Search for the last exactly matching name in an attribute list
  */
@@ -219,3 +303,4 @@ int env_attr_lookup(const char *attr_list, const char 
*name, char *attributes)
/* not found in list */
return -ENOENT;
 }
+#endif
diff --git a/include/env_callback.h b/include/env_callback.h
index ab4e115..3de1093 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -31,12 +31,18 @@
 #define SPLASHIMAGE_CALLBACK
 #endif
 
+#ifdef CONFIG_REGEX
+#define ENV_DOT_ESCAPE 

[U-Boot] [PATCH v2 14/19] test: Return values from the asserts compatible with cmds

2015-04-28 Thread Joe Hershberger
The asserts are sometimes called from the context of the test command
itself so make sure that a return that happens as a result of a failure
is compatible with that command return. When called within a test, the
return value is ignored.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 include/test/ut.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/test/ut.h b/include/test/ut.h
index 275f27f..5e5aa6c 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -42,7 +42,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
 #define ut_assert(cond)
\
if (!(cond)) {  \
ut_fail(uts, __FILE__, __LINE__, __func__, #cond);  \
-   return -1;  \
+   return CMD_RET_FAILURE; \
}
 
 /* Assert that a condition is non-zero, with printf() string */
@@ -50,7 +50,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
if (!(cond)) {  \
ut_failf(uts, __FILE__, __LINE__, __func__, #cond,  \
 fmt, ##args);  \
-   return -1;  \
+   return CMD_RET_FAILURE; \
}
 
 /* Assert that two int expressions are equal */
@@ -61,7 +61,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
ut_failf(uts, __FILE__, __LINE__, __func__, \
 #expr1 " == " #expr2,  \
 "Expected %d, got %d", val1, val2);\
-   return -1;  \
+   return CMD_RET_FAILURE; \
}   \
 }
 
@@ -73,7 +73,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
ut_failf(uts, __FILE__, __LINE__, __func__, \
 #expr1 " = " #expr2,   \
 "Expected \"%s\", got \"%s\"", val1, val2);\
-   return -1;  \
+   return CMD_RET_FAILURE; \
}   \
 }
 
@@ -85,7 +85,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
ut_failf(uts, __FILE__, __LINE__, __func__, \
 #expr1 " = " #expr2,   \
 "Expected %p, got %p", val1, val2);\
-   return -1;  \
+   return CMD_RET_FAILURE; \
}   \
 }
 
@@ -97,7 +97,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, 
int line,
ut_failf(uts, __FILE__, __LINE__, __func__, \
 #expr " = NULL",   \
 "Expected non-null, got NULL");\
-   return -1;  \
+   return CMD_RET_FAILURE; \
}   \
 }
 
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 15/19] test: env: Add test framework for env

2015-04-28 Thread Joe Hershberger
Add a new "test" subcommand to the env command.

This will run unit tests on the env code. This should be targetable to
any device that supports the env features needed for the tests.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 Makefile|  1 +
 common/cmd_nvedit.c | 10 +-
 include/env_test.h  | 18 ++
 test/Kconfig|  1 +
 test/env/Kconfig|  8 
 test/env/Makefile   |  7 +++
 test/env/cmd_env_test.c | 36 
 7 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 include/env_test.h
 create mode 100644 test/env/Kconfig
 create mode 100644 test/env/Makefile
 create mode 100644 test/env/cmd_env_test.c

diff --git a/Makefile b/Makefile
index 1e52008..c89d5db 100644
--- a/Makefile
+++ b/Makefile
@@ -665,6 +665,7 @@ libs-$(CONFIG_API) += api/
 libs-$(CONFIG_HAS_POST) += post/
 libs-y += test/
 libs-y += test/dm/
+libs-$(CONFIG_ENV_TEST) += test/env/
 
 libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
 
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index f4c2523..ce1b03b 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1147,6 +1148,9 @@ static cmd_tbl_t cmd_env_sub[] = {
 #if defined(CONFIG_CMD_ENV_EXISTS)
U_BOOT_CMD_MKENT(exists, 2, 0, do_env_exists, "", ""),
 #endif
+#if defined(CONFIG_ENV_TEST)
+   U_BOOT_CMD_MKENT(test, 1, 0, do_env_test, "", ""),
+#endif
 };
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
@@ -1215,7 +1219,11 @@ static char env_help_text[] =
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
"env save - save environment\n"
 #endif
-   "env set [-f] name [arg ...]\n";
+   "env set [-f] name [arg ...]\n"
+#if defined(CONFIG_ENV_TEST)
+   "env test - run unit tests on the env commands"
+#endif
+   ;
 #endif
 
 U_BOOT_CMD(
diff --git a/include/env_test.h b/include/env_test.h
new file mode 100644
index 000..f9eb971
--- /dev/null
+++ b/include/env_test.h
@@ -0,0 +1,18 @@
+/*
+ * (C) Copyright 2015
+ * Joe Hershberger, National Instruments, joe.hershber...@ni.com
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#ifndef __ENV_TEST_H__
+#define __ENV_TEST_H__
+
+#include 
+
+int do_env_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+
+/* Declare a new environment test */
+#define ENV_TEST(_name, _flags)UNIT_TEST(_name, _flags, env_test)
+
+#endif /* __ENV_TEST_H__ */
diff --git a/test/Kconfig b/test/Kconfig
index 706b01b..1f8e41c 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -2,3 +2,4 @@ config UNIT_TEST
bool
 
 source "test/dm/Kconfig"
+source "test/env/Kconfig"
diff --git a/test/env/Kconfig b/test/env/Kconfig
new file mode 100644
index 000..df65ac2
--- /dev/null
+++ b/test/env/Kconfig
@@ -0,0 +1,8 @@
+config ENV_TEST
+   bool "Enable env test command"
+   select UNIT_TEST
+   help
+ This enables the 'env test' command which runs a series of unit
+ tests on the env code.
+ If all is well then all tests pass although there will be a few
+ messages printed along the way.
diff --git a/test/env/Makefile b/test/env/Makefile
new file mode 100644
index 000..c35b18e
--- /dev/null
+++ b/test/env/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2015 National Instruments, Inc
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += cmd_env_test.o
diff --git a/test/env/cmd_env_test.c b/test/env/cmd_env_test.c
new file mode 100644
index 000..9643caa
--- /dev/null
+++ b/test/env/cmd_env_test.c
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2015
+ * Joe Hershberger, National Instruments, joe.hershber...@ni.com
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int do_env_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   struct unit_test *tests = ll_entry_start(struct unit_test, env_test);
+   const int n_ents = ll_entry_count(struct unit_test, env_test);
+   struct unit_test_state uts = { .fail_count = 0 };
+   struct unit_test *test;
+
+   if (argc == 1)
+   printf("Running %d environment tests\n", n_ents);
+
+   for (test = tests; test < tests + n_ents; test++) {
+   if (argc > 1 && strcmp(argv[1], test->name))
+   continue;
+   printf("Test: %s\n", test->name);
+
+   uts.start = mallinfo();
+
+   test->func(&uts);
+   }
+
+   printf("Failures: %d\n", uts.fail_count);
+
+   return uts.fail_count ? CMD_RET_FAILURE : 0;
+}
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 13/19] test: dm: Don't bail on all tests if one test fails

2015-04-28 Thread Joe Hershberger
There's not much point in having a failure count if we always give up on
the first failure. Also stop clearing the entire state between tests.

Make sure that any failures are still passed out to the command line.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 test/dm/test-main.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 54aade8..3c27472 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -23,8 +23,6 @@ static int dm_test_init(struct unit_test_state *uts)
 {
struct dm_test_state *dms = uts->priv;
 
-   memset(uts, '\0', sizeof(*uts));
-   uts->priv = dms;
memset(dms, '\0', sizeof(*dms));
gd->dm_root = NULL;
memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
@@ -106,13 +104,12 @@ int dm_test_main(const char *test_name)
if (test->flags & DM_TESTF_SCAN_FDT)
ut_assertok(dm_scan_fdt(gd->fdt_blob, false));
 
-   if (test->func(uts))
-   break;
+   test->func(uts);
 
ut_assertok(dm_test_destroy(uts));
}
 
printf("Failures: %d\n", uts->fail_count);
 
-   return 0;
+   return uts->fail_count ? CMD_RET_FAILURE : 0;
 }
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 11/19] net: Add default flags for common net env vars

2015-04-28 Thread Joe Hershberger
Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 include/env_flags.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/env_flags.h b/include/env_flags.h
index fc6d0d8..2d2de88 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -52,8 +52,17 @@ enum env_flags_varaccess {
 #define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo,"
 #endif
 #endif
+#define NET_FLAGS \
+   "ipaddr:i," \
+   "gatewayip:i," \
+   "netmask:i," \
+   "serverip:i," \
+   "nvlan:i," \
+   "vlan:i," \
+   "dnsip:i,"
 #else
-#define ETHADDR_FLAGS ""
+#define ETHADDR_FLAGS
+#define NET_FLAGS
 #endif
 
 #ifndef CONFIG_ENV_OVERWRITE
@@ -64,6 +73,7 @@ enum env_flags_varaccess {
 
 #define ENV_FLAGS_LIST_STATIC \
ETHADDR_FLAGS \
+   NET_FLAGS \
SERIAL_FLAGS \
CONFIG_ENV_FLAGS_LIST_STATIC
 
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 16/19] test: env: Add test for verifying env attrs

2015-04-28 Thread Joe Hershberger
Add a test of the env_attr_lookup() function.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 test/env/Makefile |  1 +
 test/env/attr.c   | 62 +++
 2 files changed, 63 insertions(+)
 create mode 100644 test/env/attr.c

diff --git a/test/env/Makefile b/test/env/Makefile
index c35b18e..c8d345b 100644
--- a/test/env/Makefile
+++ b/test/env/Makefile
@@ -5,3 +5,4 @@
 #
 
 obj-y += cmd_env_test.o
+obj-y += attr.o
diff --git a/test/env/attr.c b/test/env/attr.c
new file mode 100644
index 000..87ebdac
--- /dev/null
+++ b/test/env/attr.c
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2015
+ * Joe Hershberger, National Instruments, joe.hershber...@ni.com
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int env_test_attrs_lookup(struct unit_test_state *uts)
+{
+   char attrs[32];
+
+   ut_assertok(env_attr_lookup("foo:bar", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(",foo:bar", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(",foo:bar,", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(" foo:bar", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup("foo : bar", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(" foo: bar ", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup("foo:bar ", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(",foo:bar,goo:baz", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_asserteq(-ENOENT, env_attr_lookup(",,", "foo", attrs));
+
+   ut_asserteq(-ENOENT, env_attr_lookup("goo:baz", "foo", attrs));
+
+   ut_assertok(env_attr_lookup("foo:bar,foo:bat,foo:baz", "foo", attrs));
+   ut_asserteq_str("baz", attrs);
+
+   ut_assertok(env_attr_lookup(
+   " foo : bar , foo : bat , foot : baz ", "foo", attrs));
+   ut_asserteq_str("bat", attrs);
+
+   ut_assertok(env_attr_lookup(
+   " foo : bar , foo : bat , ufoo : baz ", "foo", attrs));
+   ut_asserteq_str("bat", attrs);
+
+   ut_asserteq(-EINVAL, env_attr_lookup(NULL, "foo", attrs));
+   ut_asserteq(-EINVAL, env_attr_lookup("foo:bar", "foo", NULL));
+
+   return 0;
+}
+ENV_TEST(env_test_attrs_lookup, 0);
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 04/19] env: Fix return values in env_attr_lookup()

2015-04-28 Thread Joe Hershberger
This function returned numbers for error codes. Change them to error
codes.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 common/env_attr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/env_attr.c b/common/env_attr.c
index 64baca5..e791f44 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -148,10 +148,10 @@ int env_attr_lookup(const char *attr_list, const char 
*name, char *attributes)
 
if (!attributes)
/* bad parameter */
-   return -1;
+   return -EINVAL;
if (!attr_list)
/* list not found */
-   return 1;
+   return -EINVAL;
 
entry = reverse_strstr(attr_list, name, NULL);
while (entry != NULL) {
@@ -209,5 +209,5 @@ int env_attr_lookup(const char *attr_list, const char 
*name, char *attributes)
}
 
/* not found in list */
-   return 2;
+   return -ENOENT;
 }
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 05/19] env: Simplify the reverse_strstr() interface

2015-04-28 Thread Joe Hershberger
The logic to find the whole matching name was split needlessly between
the reverse_strstr function and its caller. Fully contain it to make the
interface for calling it more consistent.

Signed-off-by: Joe Hershberger 

---

Changes in v2:
-Fix bisectability issue
-Fix corner case in reverse_name_search() where searched starts with ' '

 common/env_attr.c | 87 ++-
 1 file changed, 47 insertions(+), 40 deletions(-)

diff --git a/common/env_attr.c b/common/env_attr.c
index e791f44..6e13184 100644
--- a/common/env_attr.c
+++ b/common/env_attr.c
@@ -109,33 +109,59 @@ int env_attr_walk(const char *attr_list,
 }
 
 /*
- * Search for the last matching string in another string with the option to
- * start looking at a certain point (i.e. ignore anything beyond that point).
+ * Search for the last exactly matching name in an attribute list
  */
-static char *reverse_strstr(const char *searched, const char *search_for,
-   const char *searched_start)
+static int reverse_name_search(const char *searched, const char *search_for,
+   const char **result)
 {
-   char *result = NULL;
+   int result_size = 0;
+   const char *cur_searched = searched;
 
-   if (*search_for == '\0')
-   return (char *)searched;
+   if (result)
+   *result = NULL;
+
+   if (*search_for == '\0') {
+   if (result)
+   *result = searched;
+   return strlen(searched);
+   }
 
for (;;) {
-   char *match = strstr(searched, search_for);
-
-   /*
-* Stop looking if no new match is found or looking past the
-* searched_start pointer
-*/
-   if (match == NULL || (searched_start != NULL &&
-   match + strlen(search_for) > searched_start))
+   const char *match = strstr(cur_searched, search_for);
+   const char *prevch;
+   const char *nextch;
+
+   /* Stop looking if no new match is found */
+   if (match == NULL)
break;
 
-   result = match;
-   searched = match + 1;
+   prevch = match - 1;
+   nextch = match + strlen(search_for);
+
+   /* Skip spaces */
+   while (*prevch == ' ' && prevch >= searched)
+   prevch--;
+   while (*nextch == ' ')
+   nextch++;
+
+   /* Start looking past the current match so last is found */
+   cur_searched = match + 1;
+   /* Check for an exact match */
+   if (match != searched &&
+   *prevch != ENV_ATTR_LIST_DELIM &&
+   prevch != searched - 1)
+   continue;
+   if (*nextch != ENV_ATTR_SEP &&
+   *nextch != ENV_ATTR_LIST_DELIM &&
+   *nextch != '\0')
+   continue;
+
+   if (result)
+   *result = match;
+   result_size = strlen(search_for);
}
 
-   return result;
+   return result_size;
 }
 
 /*
@@ -145,6 +171,7 @@ static char *reverse_strstr(const char *searched, const 
char *search_for,
 int env_attr_lookup(const char *attr_list, const char *name, char *attributes)
 {
const char *entry = NULL;
+   int entry_len;
 
if (!attributes)
/* bad parameter */
@@ -153,32 +180,12 @@ int env_attr_lookup(const char *attr_list, const char 
*name, char *attributes)
/* list not found */
return -EINVAL;
 
-   entry = reverse_strstr(attr_list, name, NULL);
-   while (entry != NULL) {
-   const char *prevch = entry - 1;
-   const char *nextch = entry + strlen(name);
-
-   /* Skip spaces */
-   while (*prevch == ' ')
-   prevch--;
-   while (*nextch == ' ')
-   nextch++;
-
-   /* check for an exact match */
-   if ((entry == attr_list ||
-*prevch == ENV_ATTR_LIST_DELIM) &&
-   (*nextch == ENV_ATTR_SEP ||
-*nextch == ENV_ATTR_LIST_DELIM ||
-*nextch == '\0'))
-   break;
-
-   entry = reverse_strstr(attr_list, name, entry);
-   }
+   entry_len = reverse_name_search(attr_list, name, &entry);
if (entry != NULL) {
int len;
 
/* skip the name */
-   entry += strlen(name);
+   entry += entry_len;
/* skip spaces */
while (*entry == ' ')
entry++;
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 19/19] sandbox: Enable env unit tests

2015-04-28 Thread Joe Hershberger
Enable the new env unit tests on sandbox.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 configs/sandbox_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 2bf3799..ff05c95 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -27,3 +27,4 @@ CONFIG_USB=y
 CONFIG_USB_EMUL=y
 CONFIG_USB_STORAGE=y
 CONFIG_REGEX=y
+CONFIG_ENV_TEST=y
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/19] sandbox: Enable regex support

2015-04-28 Thread Joe Hershberger
Enable regex support on sandbox.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 configs/sandbox_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 5de7fbe..340f5eb 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -26,3 +26,4 @@ CONFIG_TPM_TIS_SANDBOX=y
 CONFIG_SOUND=y
 CONFIG_CMD_SOUND=y
 CONFIG_SOUND_SANDBOX=y
+CONFIG_REGEX=y
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 17/19] test: env: Add a test of the new regex behavior for attrs

2015-04-28 Thread Joe Hershberger
The behavior of the env attrs depends on CONFIG_REGEX. Add an additional
test if that variable is set.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 test/env/attr.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/test/env/attr.c b/test/env/attr.c
index 87ebdac..19e066e 100644
--- a/test/env/attr.c
+++ b/test/env/attr.c
@@ -60,3 +60,30 @@ static int env_test_attrs_lookup(struct unit_test_state *uts)
return 0;
 }
 ENV_TEST(env_test_attrs_lookup, 0);
+
+#ifdef CONFIG_REGEX
+static int env_test_attrs_lookup_regex(struct unit_test_state *uts)
+{
+   char attrs[32];
+
+   ut_assertok(env_attr_lookup("foo1?:bar", "foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup("foo1?:bar", "foo1", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(".foo:bar", ".foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup(".foo:bar", "ufoo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_assertok(env_attr_lookup("\\.foo:bar", ".foo", attrs));
+   ut_asserteq_str("bar", attrs);
+
+   ut_asserteq(-ENOENT, env_attr_lookup("\\.foo:bar", "ufoo", attrs));
+
+   return 0;
+}
+ENV_TEST(env_test_attrs_lookup_regex, 0);
+#endif
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/19] net: Apply default format rules to all ethaddr

2015-04-28 Thread Joe Hershberger
Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2:
-Added comments about the use of .flags in the dm eth test

 include/env_flags.h | 11 ---
 test/dm/eth.c   |  3 +++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/env_flags.h b/include/env_flags.h
index 3ef6311..fc6d0d8 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -38,13 +38,18 @@ enum env_flags_varaccess {
 #endif
 
 #ifdef CONFIG_CMD_NET
+#ifdef CONFIG_REGEX
+#define ETHADDR_WILDCARD "\\d?"
+#else
+#define ETHADDR_WILDCARD
+#endif
 #ifdef CONFIG_ENV_OVERWRITE
-#define ETHADDR_FLAGS "ethaddr:ma,"
+#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:ma,"
 #else
 #ifdef CONFIG_OVERWRITE_ETHADDR_ONCE
-#define ETHADDR_FLAGS "ethaddr:mc,"
+#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mc,"
 #else
-#define ETHADDR_FLAGS "ethaddr:mo,"
+#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo,"
 #endif
 #endif
 #else
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 4891f3a..0c173b4 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -89,6 +89,8 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
/* Invalidate eth1's MAC address */
net_ping_ip = string_to_ip("1.1.2.2");
strcpy(ethaddr, getenv("eth1addr"));
+   /* Must disable access protection for eth1addr before clearing */
+   setenv(".flags", "eth1addr");
setenv("eth1addr", NULL);
 
/* Make sure that the default is to rotate to the next interface */
@@ -108,6 +110,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 
/* Invalidate eth0's MAC address */
strcpy(ethaddr, getenv("ethaddr"));
+   /* Must disable access protection for ethaddr before clearing */
setenv(".flags", "ethaddr");
setenv("ethaddr", NULL);
 
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 10/19] net: Use env callbacks for net variables

2015-04-28 Thread Joe Hershberger
Instead of checking for changes to the env each time we enter the
net_loop, use the env callbacks to update the values of the variables.
Don't update the variables when the source was programmatic, since the
variables were the source of the new value.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2:
-Simplified test for H_PROGRAMMATIC

 include/env_callback.h |  22 ++-
 net/net.c  | 105 +
 2 files changed, 110 insertions(+), 17 deletions(-)

diff --git a/include/env_callback.h b/include/env_callback.h
index 3de1093..91f3cc0 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -37,6 +37,26 @@
 #define ENV_DOT_ESCAPE
 #endif
 
+#ifdef CONFIG_CMD_DNS
+#define DNS_CALLBACK "dnsip:dnsip,"
+#else
+#define DNS_CALLBACK
+#endif
+
+#ifdef CONFIG_NET
+#define NET_CALLBACKS \
+   "bootfile:bootfile," \
+   "ipaddr:ipaddr," \
+   "gatewayip:gatewayip," \
+   "netmask:netmask," \
+   "serverip:serverip," \
+   "nvlan:nvlan," \
+   "vlan:vlan," \
+   DNS_CALLBACK
+#else
+#define NET_CALLBACKS
+#endif
+
 /*
  * This list of callback bindings is static, but may be overridden by defining
  * a new association in the ".callbacks" environment variable.
@@ -44,7 +64,7 @@
 #define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," 
\
ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \
"baudrate:baudrate," \
-   "bootfile:bootfile," \
+   NET_CALLBACKS \
"loadaddr:loadaddr," \
SILENT_CALLBACK \
SPLASHIMAGE_CALLBACK \
diff --git a/net/net.c b/net/net.c
index a365df0..67e0ad2 100644
--- a/net/net.c
+++ b/net/net.c
@@ -208,6 +208,9 @@ int __maybe_unused net_busy_flag;
 static int on_bootfile(const char *name, const char *value, enum env_op op,
int flags)
 {
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
switch (op) {
case env_op_create:
case env_op_overwrite:
@@ -222,6 +225,92 @@ static int on_bootfile(const char *name, const char 
*value, enum env_op op,
 }
 U_BOOT_ENV_CALLBACK(bootfile, on_bootfile);
 
+static int on_ipaddr(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_ip = string_to_ip(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(ipaddr, on_ipaddr);
+
+static int on_gatewayip(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_gateway = string_to_ip(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(gatewayip, on_gatewayip);
+
+static int on_netmask(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_netmask = string_to_ip(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(netmask, on_netmask);
+
+static int on_serverip(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_server_ip = string_to_ip(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(serverip, on_serverip);
+
+static int on_nvlan(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_native_vlan = string_to_vlan(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(nvlan, on_nvlan);
+
+static int on_vlan(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_our_vlan = string_to_vlan(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(vlan, on_vlan);
+
+#if defined(CONFIG_CMD_DNS)
+static int on_dnsip(const char *name, const char *value, enum env_op op,
+   int flags)
+{
+   if (flags & H_PROGRAMMATIC)
+   return 0;
+
+   net_dns_server = string_to_ip(value);
+
+   return 0;
+}
+U_BOOT_ENV_CALLBACK(dnsip, on_dnsip);
+#endif
+
 /*
  * Check if autoload is enabled. If so, use either NFS or TFTP to download
  * the boot file.
@@ -252,22 +341,6 @@ void net_auto_load(void)
 
 static void net_init_loop(void)
 {
-   static int env_changed_id;
-   int env_id = get_env_id();
-
-   /* update only when the environment has changed */
-   if (env_changed_id != env_id) {
-   net_ip = getenv_ip("ipaddr");
-   net_gateway = getenv_ip("gatewayip");
-   net_netmask = getenv_ip("netmask");
-   net_server_ip = getenv_ip("serverip");
-   net_native_vlan = getenv_vlan("nvlan");
-   net_our_vlan = getenv_vlan("vlan");
-#if defined(CONFIG_CMD_DNS)
-   net_dns_server = getenv_ip("dnsip");
-#endif
-   env_changed_id = env_id;
-   }
if (eth_get_dev())
memcpy(net_ethaddr, eth_get_ethaddr(), 6

[U-Boot] [PATCH v2 18/19] sandbox: Cleanup order and extra defines in defconfig

2015-04-28 Thread Joe Hershberger
The defconfigs should not be edited directly. They should be generated
by editing the .config (through menuconfig or whatever) and then run
make savedefconfig to have the Kconfig system generate a clean defconfig

I did this for sandbox here with no actual changes.

Signed-off-by: Joe Hershberger 
---

Changes in v2:
-New for version 2

 configs/sandbox_defconfig | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 340f5eb..2bf3799 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -1,29 +1,29 @@
-CONFIG_OF_CONTROL=y
-CONFIG_OF_HOSTFILE=y
+CONFIG_DM_USB=y
+CONFIG_PCI=y
+CONFIG_SYS_VSNPRINTF=y
+CONFIG_DEFAULT_DEVICE_TREE="sandbox"
+CONFIG_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_FIT_SIGNATURE=y
-CONFIG_DEFAULT_DEVICE_TREE="sandbox"
+CONFIG_CMD_SOUND=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_HOSTFILE=y
+CONFIG_DM_PCI=y
+CONFIG_PCI_SANDBOX=y
+CONFIG_SPI_FLASH_SANDBOX=y
+CONFIG_CMD_CROS_EC=y
 CONFIG_CROS_EC=y
 CONFIG_CROS_EC_SANDBOX=y
 CONFIG_CROS_EC_KEYB=y
-CONFIG_CMD_CROS_EC=y
-CONFIG_PCI=y
-CONFIG_DM_PCI=y
-CONFIG_PCI_SANDBOX=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
-CONFIG_USB_EMUL=y
-CONFIG_USB_STORAGE=y
-CONFIG_BOOTSTAGE=y
-CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_SANDBOX_GPIO=y
-CONFIG_SYS_VSNPRINTF=y
+CONFIG_TPM_TIS_SANDBOX=y
 CONFIG_SYS_I2C_SANDBOX=y
 CONFIG_SANDBOX_SPI=y
-CONFIG_SPI_FLASH_SANDBOX=y
-CONFIG_TPM_TIS_SANDBOX=y
+CONFIG_SANDBOX_GPIO=y
 CONFIG_SOUND=y
-CONFIG_CMD_SOUND=y
 CONFIG_SOUND_SANDBOX=y
+CONFIG_USB=y
+CONFIG_USB_EMUL=y
+CONFIG_USB_STORAGE=y
 CONFIG_REGEX=y
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 01/19] sandbox: Enable some ENV commands

2015-04-28 Thread Joe Hershberger
Enable some additional ENV commands in sandbox to aid in build testing
and run testing.

Signed-off-by: Joe Hershberger 
Reviewed-by: Simon Glass 
---

Changes in v2: None

 include/configs/sandbox.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 3bf45a2..6079898 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -151,6 +151,11 @@
 
 #define CONFIG_CMD_SANDBOX
 
+#define CONFIG_CMD_ENV_FLAGS
+#define CONFIG_CMD_ENV_CALLBACK
+#define CONFIG_CMD_GREPENV
+#define CONFIG_CMD_ASKENV
+
 #define CONFIG_BOOTARGS ""
 
 #define CONFIG_BOARD_LATE_INIT
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] switching to single .config configuration issues

2015-04-28 Thread Yehuda Yitschak
Hey Simon, Masahiro

May I suggest an alternative solution to this issue.

What if each Kconfigs option could be set as "y" (compile for u-boot only )or 
"s" (compile for u-boot and SPL)
Just as the kernel can set Kconfig to "y" or "m".

With minor modifications to the Makefile, SPL target will compile "obj-s" and 
u-boot  target will compile "obj-s" and "obj-y" 

What do you think ? 

Yehuda  

> -Original Message-
> From: s...@google.com [mailto:s...@google.com] On Behalf Of Simon Glass
> Sent: Wednesday, April 29, 2015 6:06
> To: Hanna Hawa
> Cc: u-boot@lists.denx.de; Yehuda Yitschak; Masahiro Yamada
> Subject: Re: switching to single .config configuration issues
> 
> +Masahiro (new address)
> 
> Hi Hanna,
> 
> On 27 April 2015 at 07:43, Hanna Hawa  wrote:
> > Hi everyone,
> >
> >
> >
> > I’m working on the latest u-boot 2015.04 trying to rebase my
> > repository to latest code.
> 
> I would suggest going with upstream/master (targeting 2015.07) since there
> are several driver model changes since 2015.04 (USB, PCI, Ethernet). There
> are still patches going in but the bulk of it should be there.
> 
> >
> > And I have question regarding patch e02ee2548afe (kconfig: switch to
> > single .config configuration)
> >
> >
> >
> > Issues that I face in the current solution (single .config):
> >
> > For my usage most of the CONFIG options will not supported in the SPL,
> > we need the SPL very tiny and most of the CONFIG will be enabled in
> > the u-boot, need to undef/disable(set=n) for every CONFIG in
> > scripts/Makefile.uncmd_spl/ include/config_uncmd_spl.h
> >
> > Also for future usage if we want to delete the defines of the commands
> > from the include file and move it to defconfig file, then need to
> > undef them in the SPL code.
> 
> Masahiro is the expert here. The idea is to use SPL-specific options for SPL.
> For example CONFIG_SPL_I2C_SUPPORT. This is much the same as before.
> 
> I suggest you create some SPL options for your new features, so that they
> are only enabled in SPL when you want them.
> 
> >
> >
> >
> > Do you planning for another solution for this issue?
> 
> Also, if you push your tree to github (or somewhere) I or Masahiro might be
> able to comment on specifics.
> 
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 14/20] x86: Provide access to the IDT

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> Add a function to return the address of the Interrupt Descriptor Table.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/interrupts.c| 5 +
>  arch/x86/include/asm/interrupt.h | 2 ++
>  2 files changed, 7 insertions(+)
>
> diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
> index a21d2a6..c777d36 100644
> --- a/arch/x86/cpu/interrupts.c
> +++ b/arch/x86/cpu/interrupts.c
> @@ -147,6 +147,11 @@ int cpu_init_interrupts(void)
> return 0;
>  }
>
> +void *x86_get_idt(void)
> +{
> +   return &idt_ptr;
> +}
> +
>  void __do_irq(int irq)
>  {
> printf("Unhandled IRQ : %d\n", irq);
> diff --git a/arch/x86/include/asm/interrupt.h 
> b/arch/x86/include/asm/interrupt.h
> index 25abde7..0a75f89 100644
> --- a/arch/x86/include/asm/interrupt.h
> +++ b/arch/x86/include/asm/interrupt.h
> @@ -38,4 +38,6 @@ extern char exception_stack[];
>   */
>  void configure_irq_trigger(int int_num, bool is_level_triggered);
>
> +void *x86_get_idt(void);
> +
>  #endif
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 14/20] x86: Provide access to the IDT

2015-04-28 Thread Bin Meng
Hi Simon,

On Wed, Apr 29, 2015 at 10:08 AM, Simon Glass  wrote:
> Hi Bin,
>
> On 28 April 2015 at 02:16, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Tue, Apr 28, 2015 at 6:48 AM, Simon Glass  wrote:
>>> Add a function to return the address of the Interrupt Descriptor Table.
>>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>>
>>>  arch/x86/cpu/interrupts.c| 5 +
>>>  arch/x86/include/asm/interrupt.h | 2 ++
>>>  2 files changed, 7 insertions(+)
>>>
>>> diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
>>> index a21d2a6..c777d36 100644
>>> --- a/arch/x86/cpu/interrupts.c
>>> +++ b/arch/x86/cpu/interrupts.c
>>> @@ -147,6 +147,11 @@ int cpu_init_interrupts(void)
>>> return 0;
>>>  }
>>>
>>> +void *x86_get_idt(void)
>>> +{
>>> +   return &idt_ptr;
>>> +}
>>> +
>>
>> idt_ptr is not declared as static, so this is unneeded? Or should we
>> change it to static?
>
> I think it is better to access it via a function. It is used from
> assembler so I would rather not make it static. Any thoughts?
>

OK, fair enough.

[snip]

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 12/20] x86: Add an mfence macro

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> Provide access to this x86 instruction from C code.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Remove unnecessary \t\n after mfence assembler instruction
>
>  arch/x86/include/asm/cpu.h | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
> index c839291..08284ee 100644
> --- a/arch/x86/include/asm/cpu.h
> +++ b/arch/x86/include/asm/cpu.h
> @@ -151,6 +151,11 @@ static inline int flag_is_changeable_p(uint32_t flag)
> return ((f1^f2) & flag) != 0;
>  }
>
> +static inline void mfence(void)
> +{
> +   __asm__ __volatile__("mfence" : : : "memory");
> +}
> +
>  /**
>   * cpu_enable_paging_pae() - Enable PAE-paging
>   *
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 08/20] x86: Add support for the Simple Firmware Interface (SFI)

2015-04-28 Thread Bin Meng
Hi Simon,

On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> This provides a way of passing information to Linux without requiring the
> full ACPI horror. Provide a rudimentary implementation sufficient to be
> recognised and parsed by Linux.
>
> Signed-off-by: Simon Glass 
> ---

Looks good, thanks!

Reviewed-by: Bin Meng 

But some nits below :)

>
> Changes in v2:
> - Rename CONFIG_SFI to CONFIG_GENERATE_SFI_TABLE and move within Kconfig
> - Correct Kconfig help indentation and text
> - Drop SFI_BASE config option
> - Always build sfi.o
> - Use SFI_TABLE_MAX_ENTRIES instead of 16 and ARRAY_SIZE()
> - Make get_entry_start() static
> - Use table_compute_checksum() to computer checksum
> - Add a few blank lines
> - Move patch to after the CPU uclass patch
> - Drop the RTC table as it is not needed
> - Move SFI calling code to write_tables()
> - Remove IDLE table
> - Remove SFI_SYST_SEARCH_BEGIN and SFI_SYST_SEARCH_END
> - Move '__packed' to immediately after 'struct'
> - Add SFI_DEV_TYPE_SD and convert to enum
> - Remove #ifdef CONFIG_SFI from hedaer file
> - Move sfi.h header file to arch/x86/include/asm
>
>  arch/x86/Kconfig   |  14 +
>  arch/x86/include/asm/sfi.h | 137 
>  arch/x86/lib/Makefile  |   1 +
>  arch/x86/lib/sfi.c | 154 
> +
>  arch/x86/lib/tables.c  |   5 ++
>  5 files changed, 311 insertions(+)
>  create mode 100644 arch/x86/include/asm/sfi.h
>  create mode 100644 arch/x86/lib/sfi.c
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index f3a600e..f38e9ba 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -393,6 +393,20 @@ config GENERATE_PIRQ_TABLE
>   It specifies the interrupt router information as well how all the 
> PCI
>   devices' interrupt pins are wired to PIRQs.
>
> +config GENERATE_SFI_TABLE
> +   bool "SFI (Simple Firmware Interface) Support"

Should we say: Generate an SFI (Simple Firmware Interface) table? This
is to match 'Generate a PIRQ table'.

> +   help
> + The Simple Firmware Interface (SFI) provides a lightweight method
> + for platform firmware to pass information to the operating system
> + via static tables in memory.  Kernel SFI support is required to
> + boot on SFI-only platforms.  If you have ACPI tables then these are
> + used instead.
> +
> + U-Boot writes this table in sfi_write_tables() just before booting

Should be: write_sfi_table

> + the OS.
> +
> + For more information, see http://simplefirmware.org
> +
>  endmenu
>

[snip]

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [UBOOT PATCH v2] ci_udc: Update the ci_udc driver to support bulk transfers

2015-04-28 Thread Siva Durga Prasad Paladugu
Update the ci_udc driver to support bulk transfer
and also added capability of having multiple dtds
if requested data is more than 16K.
These changes are tested for both the DFU and lthor.

Signed-off-by: Siva Durga Prasad Paladugu 
---
Changes for v2:
- Rebase it to u-boot-usb/master
---
 drivers/usb/gadget/ci_udc.c |  135 +--
 drivers/usb/gadget/ci_udc.h |1 +
 2 files changed, 117 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 22d288c..aadff42 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -50,6 +50,8 @@
 /* For each endpoint, we need 2 QTDs, one for each of IN and OUT */
 #define ILIST_SZ   (NUM_ENDPOINTS * 2 * ILIST_ENT_SZ)
 
+#define EP_MAX_LENGTH_TRANSFER 0x4000
+
 #ifndef DEBUG
 #define DBG(x...) do {} while (0)
 #else
@@ -102,13 +104,28 @@ static struct usb_ep_ops ci_ep_ops = {
 };
 
 /* Init values for USB endpoints. */
-static const struct usb_ep ci_ep_init[2] = {
+static const struct usb_ep ci_ep_init[5] = {
[0] = { /* EP 0 */
.maxpacket  = 64,
.name   = "ep0",
.ops= &ci_ep_ops,
},
-   [1] = { /* EP 1..n */
+   [1] = {
+   .maxpacket  = 512,
+   .name   = "ep1in-bulk",
+   .ops= &ci_ep_ops,
+   },
+   [2] = {
+   .maxpacket  = 512,
+   .name   = "ep2out-bulk",
+   .ops= &ci_ep_ops,
+   },
+   [3] = {
+   .maxpacket  = 512,
+   .name   = "ep3in-int",
+   .ops= &ci_ep_ops,
+   },
+   [4] = {
.maxpacket  = 512,
.name   = "ep-",
.ops= &ci_ep_ops,
@@ -197,6 +214,19 @@ static void ci_flush_qtd(int ep_num)
 }
 
 /**
+ * ci_flush_td - flush cache over queue item
+ * @td:td pointer
+ *
+ * This function flushes cache for particular transfer descriptor.
+ */
+static void ci_flush_td(struct ept_queue_item *td)
+{
+   const uint32_t  start = (uint32_t)td;
+   const uint32_t end = (uint32_t) td + ILIST_ENT_SZ;
+   flush_dcache_range(start, end);
+}
+
+/**
  * ci_invalidate_qtd - invalidate cache over queue item
  * @ep_num:Endpoint number
  *
@@ -211,6 +241,19 @@ static void ci_invalidate_qtd(int ep_num)
invalidate_dcache_range(start, end);
 }
 
+/**
+ * ci_invalidate_td - invalidate cache over queue item
+ * @td:td pointer
+ *
+ * This function invalidates cache for particular transfer descriptor.
+ */
+static void ci_invalidate_td(struct ept_queue_item *td)
+{
+   const uint32_t start = (uint32_t)td;
+   const uint32_t end = start + ILIST_ENT_SZ;
+   invalidate_dcache_range(start, end);
+}
+
 static struct usb_request *
 ci_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags)
 {
@@ -376,6 +419,9 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
struct ept_queue_head *head;
int bit, num, len, in;
struct ci_req *ci_req;
+   u8 *buf;
+   uint32_t length, actlen;
+   struct ept_queue_item *dtd, *qtd;
 
ci_ep->req_primed = true;
 
@@ -387,16 +433,41 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
ci_req = list_first_entry(&ci_ep->queue, struct ci_req, queue);
len = ci_req->req.length;
 
-   item->info = INFO_BYTES(len) | INFO_ACTIVE;
-   item->page0 = (unsigned long)ci_req->hw_buf;
-   item->page1 = ((unsigned long)ci_req->hw_buf & 0xf000) + 0x1000;
-   item->page2 = ((unsigned long)ci_req->hw_buf & 0xf000) + 0x2000;
-   item->page3 = ((unsigned long)ci_req->hw_buf & 0xf000) + 0x3000;
-   item->page4 = ((unsigned long)ci_req->hw_buf & 0xf000) + 0x4000;
-
head->next = (unsigned long)item;
head->info = 0;
 
+   ci_req->dtd_count = 0;
+   buf = ci_req->hw_buf;
+   actlen = 0;
+   dtd = item;
+
+   do {
+   length = min(ci_req->req.length - actlen,
+(unsigned)EP_MAX_LENGTH_TRANSFER);
+
+   dtd->info = INFO_BYTES(length) | INFO_ACTIVE;
+   dtd->page0 = (unsigned long)buf;
+   dtd->page1 = ((unsigned long)buf & 0xf000) + 0x1000;
+   dtd->page2 = ((unsigned long)buf & 0xf000) + 0x2000;
+   dtd->page3 = ((unsigned long)buf & 0xf000) + 0x3000;
+   dtd->page4 = ((unsigned long)buf & 0xf000) + 0x4000;
+
+   len -= length;
+   actlen += length;
+   buf += length;
+
+   if (len) {
+   qtd = (struct ept_queue_item *)
+  memalign(ILIST_ALIGN, ILIST_ENT_SZ);
+   dtd->next = (uint32_t)qtd;
+   dtd = qtd;
+   memset(dtd, 0

Re: [U-Boot] [PATCH v2 07/20] dm: Implement a CPU uclass

2015-04-28 Thread Bin Meng
Hi Simon,

On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> It is useful to be able to keep track of the available CPUs in a multi-CPU
> system. This uclass is mostly intended for use with SMP systems.
>
> The uclass provides methods for getting basic information about each CPU.
>
> Signed-off-by: Simon Glass 
> ---

Reviewed-by: Bin Meng 

But one comment raised previously not addressed below.

>
> Changes in v2:
> - Change header guard to capital letters
> - Change get_info() in function comment to cpu_get_info()
>
>  drivers/Kconfig  |  2 ++
>  drivers/Makefile |  1 +
>  drivers/cpu/Kconfig  |  8 +
>  drivers/cpu/Makefile |  7 
>  drivers/cpu/cpu-uclass.c | 61 +++
>  include/cpu.h| 84 
> 
>  include/dm/uclass-id.h   |  1 +
>  7 files changed, 164 insertions(+)
>  create mode 100644 drivers/cpu/Kconfig
>  create mode 100644 drivers/cpu/Makefile
>  create mode 100644 drivers/cpu/cpu-uclass.c
>  create mode 100644 include/cpu.h
>
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 941aa0c..1f40887 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -2,6 +2,8 @@ menu "Device Drivers"
>
>  source "drivers/core/Kconfig"
>
> +source "drivers/cpu/Kconfig"
> +
>  source "drivers/demo/Kconfig"
>
>  source "drivers/pci/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 5ef58c0..405b64b 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_DM_DEMO) += demo/
>  obj-$(CONFIG_BIOSEMU) += bios_emulator/
>  obj-y += block/
>  obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
> +obj-$(CONFIG_CPU) += cpu/
>  obj-y += crypto/
>  obj-$(CONFIG_FPGA) += fpga/
>  obj-y += hwmon/
> diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
> new file mode 100644
> index 000..0d1424d
> --- /dev/null
> +++ b/drivers/cpu/Kconfig
> @@ -0,0 +1,8 @@
> +config CPU

Should it be DM_CPU? Like other DM drivers (DM_SERIAL, DM_I2C, etc).

> +   bool "Enable CPU drivers using Driver Model"
> +   help
> + This allows drivers to be provided for CPUs and their type to be
> + specified in the board's device tree. For boards which support
> + multiple CPUs, then normally have to be set up in U-Boot so that
> + they can work correctly in the OS. This provides a framework for
> + finding out information about available CPUs and making changes.

[snip]

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 06/20] Add print_freq() to display frequencies nicely

2015-04-28 Thread Bin Meng
Hi Simon,

On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> Add a function similar to print_size() that works for frequencies. It can
> handle from Hz to GHz.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Correct bugs in number output
>
>  include/display_options.h | 11 +++
>  lib/display_options.c | 38 ++
>  2 files changed, 49 insertions(+)
>
> diff --git a/include/display_options.h b/include/display_options.h
> index 54bd41d..ac44c45 100644
> --- a/include/display_options.h
> +++ b/include/display_options.h
> @@ -23,6 +23,17 @@
>  void print_size(uint64_t size, const char *suffix);
>
>  /**
> + * print_freq() - Print a frequency with a suffix
> + *
> + * Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for
> + * optional trailing string (like "\n")
> + *
> + * @freq:  Frequency to print in Hz
> + * @suffix String to print after the frequency
> + */
> +void print_freq(uint64_t freq, const char *suffix);
> +
> +/**
>   * print_buffer() - Print data buffer in hex and ascii form
>   *
>   * Data reads are buffered so that each memory address is only read once.
> diff --git a/lib/display_options.c b/lib/display_options.c
> index 3f32bcd..3a70e14 100644
> --- a/lib/display_options.c
> +++ b/lib/display_options.c
> @@ -7,6 +7,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -22,6 +23,43 @@ int display_options (void)
> return 0;
>  }
>
> +void print_freq(uint64_t freq, const char *s)
> +{
> +   unsigned long m = 0, n;
> +   uint64_t f;
> +   static const char names[] = {'G', 'M', 'K'};
> +   unsigned long d = 1e9;
> +   char c = 0;
> +   unsigned int i;
> +
> +   for (i = 0; i < ARRAY_SIZE(names); i++, d /= 1000) {
> +   if (freq >= d) {
> +   c = names[i];
> +   break;
> +   }
> +   }
> +
> +   if (!c) {
> +   printf("%" PRIu64 " Hz%s", freq, s);
> +   return;
> +   }
> +
> +   f = do_div(freq, d);
> +   n = freq;
> +
> +   /* If there's a remainder, show the first few digits */
> +   if (f) {
> +   m = f % d;
> +   while (!(m % 10))
> +   m /= 10;
> +   }

This 'first few digits' issue is not fixed. Do you intend to print all
numbers after the radix point? If yes, then we need fix the comment to
say all numbers will be printed.

> +   printf("%lu", n);
> +   if (m)
> +   printf(".%ld", m);
> +   printf(" %cHz%s", c, s);
> +}
> +
>  void print_size(uint64_t size, const char *s)
>  {
> unsigned long m = 0, n;
> --

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 05/20] Move display_options functions to their own header

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> Before adding one more function, create a separate header to help reduce
> the size of common.h. Add the missing function comments and tidy up.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Use capitals for the header guard
> - Change 'print' to 'Print' in comment
>
>  include/common.h  | 16 +---
>  include/display_options.h | 48 
> +++
>  lib/display_options.c | 13 -
>  3 files changed, 49 insertions(+), 28 deletions(-)
>  create mode 100644 include/display_options.h
>
> diff --git a/include/common.h b/include/common.h
> index cde3474..d4d704a 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -192,22 +192,8 @@ intcpu_init(void);
>
>  /* */
>  phys_size_t initdram (int);
> -intdisplay_options (void);
>
> -/**
> - * print_size() - Print a size with a suffic
> - *
> - * print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB",
> - * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string
> - * (like "\n")
> - *
> - * @size:  Size to print
> - * @suffix String to print after the size
> - */
> -void print_size(uint64_t size, const char *suffix);
> -
> -int print_buffer(ulong addr, const void *data, uint width, uint count,
> -uint linelen);
> +#include 
>
>  /* common/main.c */
>  void   main_loop   (void);
> diff --git a/include/display_options.h b/include/display_options.h
> new file mode 100644
> index 000..54bd41d
> --- /dev/null
> +++ b/include/display_options.h
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright (c) 2015 Google, Inc
> + *
> + * (C) Copyright 2000-2002
> + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef __DISPLAY_OPTIONS_H
> +#define __DISPLAY_OPTIONS_H
> +
> +/**
> + * print_size() - Print a size with a suffix
> + *
> + * Print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB",
> + * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string
> + * (like "\n")
> + *
> + * @size:  Size to print
> + * @suffix String to print after the size
> + */
> +void print_size(uint64_t size, const char *suffix);
> +
> +/**
> + * print_buffer() - Print data buffer in hex and ascii form
> + *
> + * Data reads are buffered so that each memory address is only read once.
> + * This is useful when displaying the contents of volatile registers.
> + *
> + * @addr:  Starting address to display at start of line
> + * @data:  pointer to data buffer
> + * @width: data value width.  May be 1, 2, or 4.
> + * @count: number of values to display
> + * @linelen:   Number of values to print per line; specify 0 for default 
> length
> + */
> +int print_buffer(ulong addr, const void *data, uint width, uint count,
> +uint linelen);
> +
> +/**
> + * display_options() - display the version string / build tag
> + *
> + * This displays the U-Boot version string. If a build tag is available this
> + * is displayed also.
> + */
> +int display_options(void);
> +
> +#endif
> diff --git a/lib/display_options.c b/lib/display_options.c
> index d5d17b2..3f32bcd 100644
> --- a/lib/display_options.c
> +++ b/lib/display_options.c
> @@ -63,19 +63,6 @@ void print_size(uint64_t size, const char *s)
> printf (" %ciB%s", c, s);
>  }
>
> -/*
> - * Print data buffer in hex and ascii form to the terminal.
> - *
> - * data reads are buffered so that each memory address is only read once.
> - * Useful when displaying the contents of volatile registers.
> - *
> - * parameters:
> - *addr: Starting address to display at start of line
> - *data: pointer to data buffer
> - *width: data value width.  May be 1, 2, or 4.
> - *count: number of values to display
> - *linelen: Number of values to print per line; specify 0 for default 
> length
> - */
>  #define MAX_LINE_LENGTH_BYTES (64)
>  #define DEFAULT_LINE_LENGTH_BYTES (16)
>  int print_buffer(ulong addr, const void *data, uint width, uint count,
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] dm: core: Fix regression caused by c1d6f91

2015-04-28 Thread Joe Hershberger
The change to refactor these functions created a regression.

commit c1d6f91952d0761f61b0f0f96e4c7aa32eee2788
Author: Przemyslaw Marczak 
Date:   Wed Apr 15 13:07:17 2015 +0200
dm: core: add internal functions for getting the device without probe

With this change, the dm unit tests started failing with a probe error
-22 in the dm_test_children test.

Test: dm_test_children
test/dm/core.c:544, dm_test_children(): 0 == ret: Expected 0, got -22

This restores the original behavior which would avoid a probe on invalid
device pointers.

Signed-off-by: Joe Hershberger 
---

 drivers/core/uclass.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 04e939d..898c1fc 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -174,7 +174,7 @@ int uclass_find_first_device(enum uclass_id id, struct 
udevice **devp)
if (ret)
return ret;
if (list_empty(&uc->dev_head))
-   return 0;
+   return -ENODEV;
 
*devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node);
 
@@ -187,7 +187,7 @@ int uclass_find_next_device(struct udevice **devp)
 
*devp = NULL;
if (list_is_last(&dev->uclass_node, &dev->uclass->dev_head))
-   return 0;
+   return -ENODEV;
 
*devp = list_entry(dev->uclass_node.next, struct udevice, uclass_node);
 
@@ -342,6 +342,8 @@ int uclass_first_device(enum uclass_id id, struct udevice 
**devp)
 
*devp = NULL;
ret = uclass_find_first_device(id, &dev);
+   if (ret == -ENODEV)
+   return 0;
return uclass_get_device_tail(dev, ret, devp);
 }
 
@@ -352,6 +354,8 @@ int uclass_next_device(struct udevice **devp)
 
*devp = NULL;
ret = uclass_find_next_device(&dev);
+   if (ret == -ENODEV)
+   return 0;
return uclass_get_device_tail(dev, ret, devp);
 }
 
-- 
1.7.11.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/4] x86: quark: Use reset_cpu()

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:11 AM, Simon Glass  wrote:
> Now that reset_cpu() functions correctly, use it instead of directly
> accessing the port.
>
> Signed-off-by: Simon Glass 
> Reviewed-by: Bin Meng 
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/quark/quark.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c
> index 4ffa437..e78a271 100644
> --- a/arch/x86/cpu/quark/quark.c
> +++ b/arch/x86/cpu/quark/quark.c
> @@ -122,7 +122,7 @@ int print_cpuinfo(void)
>  void reset_cpu(ulong addr)
>  {
> /* cold reset */
> -   outb(0x08, PORT_RESET);
> +   x86_full_reset();
>  }
>
>  int cpu_mmc_init(bd_t *bis)
> --

Quark cf9 seems only support bit3, but testing shows that it works, so

Tested-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/4] x86: ivybridge: Use reset_cpu()

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:11 AM, Simon Glass  wrote:
> Now that reset_cpu() functions correctly, use it instead of directly
> accessing the port.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Correct call to reset_cpu() which was missing a parameter!
> - Tidy up reset calls to do the correct reset type
>
>  arch/x86/cpu/ivybridge/cpu.c  |  5 ++---
>  arch/x86/cpu/ivybridge/early_me.c | 13 +++--
>  arch/x86/cpu/ivybridge/sdram.c|  3 +--
>  3 files changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
> index 37f3731..cce5923 100644
> --- a/arch/x86/cpu/ivybridge/cpu.c
> +++ b/arch/x86/cpu/ivybridge/cpu.c
> @@ -92,7 +92,7 @@ static int set_flex_ratio_to_tdp_nominal(void)
>
> /* Issue warm reset, will be "CPU only" due to soft reset data */
> outb(0x0, PORT_RESET);
> -   outb(0x6, PORT_RESET);
> +   outb(SYS_RST | RST_CPU, PORT_RESET);
> cpu_hlt();
>
> /* Not reached */
> @@ -286,8 +286,7 @@ int print_cpuinfo(void)
>
> /* System is not happy after keyboard reset... */
> debug("Issuing CF9 warm reset\n");
> -   outb(0x6, 0xcf9);
> -   cpu_hlt();
> +   reset_cpu(0);
> }
>
> /* Early chipset init required before RAM init can work */
> diff --git a/arch/x86/cpu/ivybridge/early_me.c 
> b/arch/x86/cpu/ivybridge/early_me.c
> index 356bbb4..711470f 100644
> --- a/arch/x86/cpu/ivybridge/early_me.c
> +++ b/arch/x86/cpu/ivybridge/early_me.c
> @@ -117,7 +117,6 @@ static inline void set_global_reset(int enable)
>
>  int intel_early_me_init_done(u8 status)
>  {
> -   u8 reset;
> int count;
> u32 mebase_l, mebase_h;
> struct me_hfs hfs;
> @@ -156,7 +155,6 @@ int intel_early_me_init_done(u8 status)
> /* Check status after acknowledgement */
> intel_early_me_status();
>
> -   reset = 0;
> switch (hfs.ack_data) {
> case ME_HFS_ACK_CONTINUE:
> /* Continue to boot */
> @@ -164,17 +162,17 @@ int intel_early_me_init_done(u8 status)
> case ME_HFS_ACK_RESET:
> /* Non-power cycle reset */
> set_global_reset(0);
> -   reset = 0x06;
> +   reset_cpu(0);
> break;
> case ME_HFS_ACK_PWR_CYCLE:
> /* Power cycle reset */
> set_global_reset(0);
> -   reset = 0x0e;
> +   x86_full_reset();
> break;
> case ME_HFS_ACK_GBL_RESET:
> /* Global reset */
> set_global_reset(1);
> -   reset = 0x0e;
> +   x86_full_reset();
> break;
> case ME_HFS_ACK_S3:
> case ME_HFS_ACK_S4:
> @@ -182,10 +180,5 @@ int intel_early_me_init_done(u8 status)
> break;
> }
>
> -   /* Perform the requested reset */
> -   if (reset) {
> -   outb(reset, 0xcf9);
> -   cpu_hlt();
> -   }
> return -1;
>  }
> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
> index 9a6da37..af907c5 100644
> --- a/arch/x86/cpu/ivybridge/sdram.c
> +++ b/arch/x86/cpu/ivybridge/sdram.c
> @@ -393,8 +393,7 @@ int sdram_initialise(struct pei_data *pei_data)
> /* If MRC data is not found we cannot continue S3 resume. */
> if (pei_data->boot_mode == PEI_BOOT_RESUME && !pei_data->mrc_input) {
> debug("Giving up in sdram_initialize: No MRC data\n");
> -   outb(0x6, PORT_RESET);
> -   cpu_hlt();
> +   reset_cpu(0);
> }
>
> /* Pass console handler in pei_data */
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/4] x86: Implement reset_cpu() correctly for modern CPUs

2015-04-28 Thread Bin Meng
On Wed, Apr 29, 2015 at 10:11 AM, Simon Glass  wrote:
> The existing code is pretty ancient and is unreliable on modern hardware.
> Generally it will hang.
>
> We can use port 0xcf9 to initiate reset on more modern hardware (say in the
> last 10 years). Update the reset_cpu() function to do this, and add a new
> 'full reset' function to perform a full power cycle.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Update reset comments to indicate the datasheet section
> - Correct full reset code
>
>  arch/x86/cpu/cpu.c   | 22 +-
>  arch/x86/include/asm/processor.h | 19 +++
>  2 files changed, 28 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index c9614f1..02e66d8 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -380,21 +380,17 @@ void  flush_cache(unsigned long dummy1, unsigned long 
> dummy2)
> asm("wbinvd\n");
>  }
>
> -void __attribute__ ((regparm(0))) generate_gpf(void);
> -
> -/* segment 0x70 is an arbitrary segment which does not exist */
> -asm(".globl generate_gpf\n"
> -   ".hidden generate_gpf\n"
> -   ".type generate_gpf, @function\n"
> -   "generate_gpf:\n"
> -   "ljmp   $0x70, $0x47114711\n");
> -
>  __weak void reset_cpu(ulong addr)
>  {
> -   printf("Resetting using x86 Triple Fault\n");
> -   set_vector(13, generate_gpf);   /* general protection fault handler */
> -   set_vector(8, generate_gpf);/* double fault handler */
> -   generate_gpf(); /* start the show */
> +   /* Do a hard reset through the chipset's reset control register */
> +   outb(SYS_RST | RST_CPU, PORT_RESET);
> +   for (;;)
> +   cpu_hlt();
> +}
> +
> +void x86_full_reset(void)
> +{
> +   outb(FULL_RST | SYS_RST | RST_CPU, PORT_RESET);
>  }
>
>  int dcache_status(void)
> diff --git a/arch/x86/include/asm/processor.h 
> b/arch/x86/include/asm/processor.h
> index 3e26202..3575d34 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -25,8 +25,27 @@
>
>  #ifndef __ASSEMBLY__
>
> +/*
> + * This register is documented in (for example) the Intel Atom Processor 
> E3800
> + * Product Family Datasheet in "PCU - Power Management Controller (PMC)".
> + *
> + * RST_CNT: Reset Control Register (RST_CNT) Offset cf9.
> + *
> + * The naming follows Intel's naming.
> + */
>  #define PORT_RESET 0xcf9
>
> +enum {
> +   SYS_RST = 1 << 1,   /* 0 for soft reset, 1 for hard reset 
> */
> +   RST_CPU = 1 << 2,   /* initiate reset */
> +   FULL_RST= 1 << 3,   /* full power cycle */
> +};
> +
> +/**
> + * x86_full_reset() - reset everything: perform a full power cycle
> + */
> +void x86_full_reset(void);
> +
>  static inline __attribute__((always_inline)) void cpu_hlt(void)
>  {
> asm("hlt");
> --

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/20] x86: Add CPU uclass and multi-core support for Minnowboard MAX

2015-04-28 Thread Bin Meng
Hi Simon,

On Wed, Apr 29, 2015 at 10:25 AM, Simon Glass  wrote:
> This series adds a new CPU uclass which is intended to be useful on any
> architecture. So far it has a very simple interface and a command to show
> CPU details.
>
> This series also introduces multi-core init for x86. It is implemented and
> enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass is
> implemented for x86 and the Simple Firmware Interface provides these details
> to the kernel, since ACPI is not yet available.
>
> With these changes Minnowboard MAX can boot into Linux with both cores
> enabled.
>
> This series is available at u-boot-x86 branch 'cpu-working'.
>
> Changes in v2:
> - Use capitals for the header guard
> - Change 'print' to 'Print' in comment
> - Correct bugs in number output
> - Change header guard to capital letters
> - Change get_info() in function comment to cpu_get_info()
> - Rename CONFIG_SFI to CONFIG_GENERATE_SFI_TABLE and move within Kconfig
> - Correct Kconfig help indentation and text
> - Drop SFI_BASE config option
> - Always build sfi.o
> - Use SFI_TABLE_MAX_ENTRIES instead of 16 and ARRAY_SIZE()
> - Make get_entry_start() static
> - Use table_compute_checksum() to computer checksum
> - Add a few blank lines
> - Move patch to after the CPU uclass patch
> - Drop the RTC table as it is not needed
> - Move SFI calling code to write_tables()
> - Remove IDLE table
> - Remove SFI_SYST_SEARCH_BEGIN and SFI_SYST_SEARCH_END
> - Move '__packed' to immediately after 'struct'
> - Add SFI_DEV_TYPE_SD and convert to enum
> - Remove #ifdef CONFIG_SFI from hedaer file
> - Move sfi.h header file to arch/x86/include/asm
> - Remove unnecessary \t\n after mfence assembler instruction
>

This is quick! :) I have not finished reviewing the v1. I will
continue reviewing the v2.

> Simon Glass (20):
>   Fix comment nits in board_f.c
>   dm: core: Add a function to bind a driver for a device tree node
>   x86: Remove unwanted MMC debugging
>   x86: Disable -Werror
>   Move display_options functions to their own header
>   Add print_freq() to display frequencies nicely
>   dm: Implement a CPU uclass
>   x86: Add support for the Simple Firmware Interface (SFI)
>   Add a 'cpu' command to print CPU information
>   x86: Add atomic operations
>   x86: Add defines for fixed MTRRs
>   x86: Add an mfence macro
>   x86: Store the GDT pointer in global_data
>   x86: Provide access to the IDT
>   x86: Add multi-processor init
>   x86: Add functions to set and clear bits on MSRs
>   x86: Allow CPUs to be set up after relocation
>   x86: Add a CPU driver for baytrail
>   x86: Tidy up the LAPIC init code
>   x86: Enable multi-core init for Minnowboard MAX
>
>  arch/x86/Kconfig |  39 +++
>  arch/x86/cpu/Makefile|   2 +
>  arch/x86/cpu/baytrail/Makefile   |   1 +
>  arch/x86/cpu/baytrail/cpu.c  | 206 +
>  arch/x86/cpu/baytrail/valleyview.c   |   1 -
>  arch/x86/cpu/config.mk   |   2 +-
>  arch/x86/cpu/cpu.c   |  38 +++
>  arch/x86/cpu/interrupts.c|   5 +
>  arch/x86/cpu/ivybridge/model_206ax.c |   4 +-
>  arch/x86/cpu/lapic.c |  20 +-
>  arch/x86/cpu/mp_init.c   | 507 
> +++
>  arch/x86/cpu/sipi.S  | 215 +
>  arch/x86/dts/minnowmax.dts   |  20 ++
>  arch/x86/include/asm/arch-baytrail/msr.h |  30 ++
>  arch/x86/include/asm/atomic.h| 115 +++
>  arch/x86/include/asm/cpu.h   |  19 ++
>  arch/x86/include/asm/global_data.h   |   1 +
>  arch/x86/include/asm/interrupt.h |   2 +
>  arch/x86/include/asm/lapic.h |   7 -
>  arch/x86/include/asm/mp.h|  94 ++
>  arch/x86/include/asm/msr.h   |  19 ++
>  arch/x86/include/asm/mtrr.h  |  14 +
>  arch/x86/include/asm/sfi.h   | 137 +
>  arch/x86/include/asm/sipi.h  |  79 +
>  arch/x86/include/asm/smm.h   |  14 +
>  arch/x86/include/asm/u-boot-x86.h|   2 +
>  arch/x86/lib/Makefile|   1 +
>  arch/x86/lib/sfi.c   | 154 ++
>  arch/x86/lib/tables.c|   5 +
>  common/Kconfig   |   8 +
>  common/Makefile  |   1 +
>  common/board_f.c |   9 +-
>  common/board_r.c |   2 +-
>  common/cmd_cpu.c | 113 +++
>  configs/minnowmax_defconfig  |   4 +
>  drivers/Kconfig  |   2 +
>  drivers/Makefile |   1 +
>  drivers/core/lists.c |   9 +-
>  drivers/cpu/Kconfig  |   8 +
>  drivers/cpu/Makefile |   7 +
>  drivers/cpu/cpu-uclass.c |  61 
>  include/common.h |  16 +-
>  include

Re: [U-Boot] switching to single .config configuration issues

2015-04-28 Thread Simon Glass
+Masahiro (new address)

Hi Hanna,

On 27 April 2015 at 07:43, Hanna Hawa  wrote:
> Hi everyone,
>
>
>
> I’m working on the latest u-boot 2015.04 trying to rebase my repository to
> latest code.

I would suggest going with upstream/master (targeting 2015.07) since
there are several driver model changes since 2015.04 (USB, PCI,
Ethernet). There are still patches going in but the bulk of it should
be there.

>
> And I have question regarding patch e02ee2548afe (kconfig: switch to single
> .config configuration)
>
>
>
> Issues that I face in the current solution (single .config):
>
> For my usage most of the CONFIG options will not supported in the SPL, we
> need the SPL very tiny and most of the CONFIG will be enabled in the u-boot,
> need to undef/disable(set=n) for every CONFIG in scripts/Makefile.uncmd_spl/
> include/config_uncmd_spl.h
>
> Also for future usage if we want to delete the defines of the commands from
> the include file and move it to defconfig file, then need to undef them in
> the SPL code.

Masahiro is the expert here. The idea is to use SPL-specific options
for SPL. For example CONFIG_SPL_I2C_SUPPORT. This is much the same as
before.

I suggest you create some SPL options for your new features, so that
they are only enabled in SPL when you want them.

>
>
>
> Do you planning for another solution for this issue?

Also, if you push your tree to github (or somewhere) I or Masahiro
might be able to comment on specifics.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/20] dm: Implement a CPU uclass

2015-04-28 Thread Simon Glass
It is useful to be able to keep track of the available CPUs in a multi-CPU
system. This uclass is mostly intended for use with SMP systems.

The uclass provides methods for getting basic information about each CPU.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Change header guard to capital letters
- Change get_info() in function comment to cpu_get_info()

 drivers/Kconfig  |  2 ++
 drivers/Makefile |  1 +
 drivers/cpu/Kconfig  |  8 +
 drivers/cpu/Makefile |  7 
 drivers/cpu/cpu-uclass.c | 61 +++
 include/cpu.h| 84 
 include/dm/uclass-id.h   |  1 +
 7 files changed, 164 insertions(+)
 create mode 100644 drivers/cpu/Kconfig
 create mode 100644 drivers/cpu/Makefile
 create mode 100644 drivers/cpu/cpu-uclass.c
 create mode 100644 include/cpu.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 941aa0c..1f40887 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -2,6 +2,8 @@ menu "Device Drivers"
 
 source "drivers/core/Kconfig"
 
+source "drivers/cpu/Kconfig"
+
 source "drivers/demo/Kconfig"
 
 source "drivers/pci/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 5ef58c0..405b64b 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DM_DEMO) += demo/
 obj-$(CONFIG_BIOSEMU) += bios_emulator/
 obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
+obj-$(CONFIG_CPU) += cpu/
 obj-y += crypto/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += hwmon/
diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
new file mode 100644
index 000..0d1424d
--- /dev/null
+++ b/drivers/cpu/Kconfig
@@ -0,0 +1,8 @@
+config CPU
+   bool "Enable CPU drivers using Driver Model"
+   help
+ This allows drivers to be provided for CPUs and their type to be
+ specified in the board's device tree. For boards which support
+ multiple CPUs, then normally have to be set up in U-Boot so that
+ they can work correctly in the OS. This provides a framework for
+ finding out information about available CPUs and making changes.
diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile
new file mode 100644
index 000..8710160
--- /dev/null
+++ b/drivers/cpu/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2015 Google, Inc
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+obj-$(CONFIG_CPU) += cpu-uclass.o
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c
new file mode 100644
index 000..ab18ee2
--- /dev/null
+++ b/drivers/cpu/cpu-uclass.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int cpu_get_desc(struct udevice *dev, char *buf, int size)
+{
+   struct cpu_ops *ops = cpu_get_ops(dev);
+
+   if (!ops->get_desc)
+   return -ENOSYS;
+
+   return ops->get_desc(dev, buf, size);
+}
+
+int cpu_get_info(struct udevice *dev, struct cpu_info *info)
+{
+   struct cpu_ops *ops = cpu_get_ops(dev);
+
+   if (!ops->get_desc)
+   return -ENOSYS;
+
+   return ops->get_info(dev, info);
+}
+
+U_BOOT_DRIVER(cpu_bus) = {
+   .name   = "cpu_bus",
+   .id = UCLASS_SIMPLE_BUS,
+   .per_child_platdata_auto_alloc_size = sizeof(struct cpu_platdata),
+};
+
+static int uclass_cpu_init(struct uclass *uc)
+{
+   struct udevice *dev;
+   int node;
+   int ret;
+
+   node = fdt_path_offset(gd->fdt_blob, "/cpus");
+   if (node < 0)
+   return 0;
+
+   ret = device_bind_driver_to_node(dm_root(), "cpu_bus", "cpus", node,
+&dev);
+
+   return ret;
+}
+
+UCLASS_DRIVER(cpu) = {
+   .id = UCLASS_CPU,
+   .name   = "cpu",
+   .flags  = DM_UC_FLAG_SEQ_ALIAS,
+   .init   = uclass_cpu_init,
+};
diff --git a/include/cpu.h b/include/cpu.h
new file mode 100644
index 000..34c60bc
--- /dev/null
+++ b/include/cpu.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __CPU_H
+#define __CPU_H
+
+/**
+ * struct cpu_platdata - platform data for a CPU
+ *
+ * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
+ * device.
+ *
+ * @cpu_id:Platform-specific way of identifying the CPU.
+ */
+struct cpu_platdata {
+   int cpu_id;
+};
+
+/* CPU features - mostly just a placeholder for now */
+enum {
+   CPU_FEAT_L1_CACHE   = 0,/* Supports level 1 cache */
+   CPU_FEAT_MMU= 1,/* Supports virtual memory */
+
+   CPU_FEAT_COUNT,
+};
+
+/**
+ * struct cpu_info - Information about a CPU
+ *
+ * @cpu_freq:  Current CPU frequency in Hz
+ * @features:  Flags for supported CPU features
+ */
+struct cpu_info {
+   ulong cpu_fr

[U-Boot] [PATCH v2 14/20] x86: Provide access to the IDT

2015-04-28 Thread Simon Glass
Add a function to return the address of the Interrupt Descriptor Table.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/cpu/interrupts.c| 5 +
 arch/x86/include/asm/interrupt.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
index a21d2a6..c777d36 100644
--- a/arch/x86/cpu/interrupts.c
+++ b/arch/x86/cpu/interrupts.c
@@ -147,6 +147,11 @@ int cpu_init_interrupts(void)
return 0;
 }
 
+void *x86_get_idt(void)
+{
+   return &idt_ptr;
+}
+
 void __do_irq(int irq)
 {
printf("Unhandled IRQ : %d\n", irq);
diff --git a/arch/x86/include/asm/interrupt.h b/arch/x86/include/asm/interrupt.h
index 25abde7..0a75f89 100644
--- a/arch/x86/include/asm/interrupt.h
+++ b/arch/x86/include/asm/interrupt.h
@@ -38,4 +38,6 @@ extern char exception_stack[];
  */
 void configure_irq_trigger(int int_num, bool is_level_triggered);
 
+void *x86_get_idt(void);
+
 #endif
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 16/20] x86: Add functions to set and clear bits on MSRs

2015-04-28 Thread Simon Glass
Since we do these sorts of operations a lot, it is useful to have a simpler
API, similar to clrsetbits_le32().

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/include/asm/msr.h | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 1955a75..5349519 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -128,6 +128,25 @@ static inline void wrmsr(unsigned msr, unsigned low, 
unsigned high)
 #define wrmsrl(msr, val)   \
native_write_msr((msr), (u32)((u64)(val)), (u32)((u64)(val) >> 32))
 
+static inline void msr_clrsetbits_64(unsigned msr, u64 clear, u64 set)
+{
+   u64 val;
+
+   val = native_read_msr(msr);
+   val &= ~clear;
+   val |= set;
+   wrmsrl(msr, val);
+}
+
+static inline void msr_setbits_64(unsigned msr, u64 set)
+{
+   u64 val;
+
+   val = native_read_msr(msr);
+   val |= set;
+   wrmsrl(msr, val);
+}
+
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr, p1, p2)\
 ({ \
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 18/20] x86: Add a CPU driver for baytrail

2015-04-28 Thread Simon Glass
This driver supports multi-core init and sets up the CPU frequencies
correctly.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/cpu/baytrail/Makefile   |   1 +
 arch/x86/cpu/baytrail/cpu.c  | 206 +++
 arch/x86/include/asm/arch-baytrail/msr.h |  30 +
 3 files changed, 237 insertions(+)
 create mode 100644 arch/x86/cpu/baytrail/cpu.c
 create mode 100644 arch/x86/include/asm/arch-baytrail/msr.h

diff --git a/arch/x86/cpu/baytrail/Makefile b/arch/x86/cpu/baytrail/Makefile
index 8914e8b..c78b644 100644
--- a/arch/x86/cpu/baytrail/Makefile
+++ b/arch/x86/cpu/baytrail/Makefile
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+obj-y += cpu.o
 obj-y += early_uart.o
 obj-y += fsp_configs.o
 obj-y += pci.o
diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c
new file mode 100644
index 000..5a2a8ee
--- /dev/null
+++ b/arch/x86/cpu/baytrail/cpu.c
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ *
+ * Based on code from coreboot
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_SMP
+static int enable_smis(struct udevice *cpu, void *unused)
+{
+   return 0;
+}
+
+static struct mp_flight_record mp_steps[] = {
+   MP_FR_BLOCK_APS(mp_init_cpu, NULL, mp_init_cpu, NULL),
+   /* Wait for APs to finish initialization before proceeding. */
+   MP_FR_BLOCK_APS(NULL, NULL, enable_smis, NULL),
+};
+
+static int detect_num_cpus(void)
+{
+   int ecx = 0;
+
+   /*
+* Use the algorithm described in Intel 64 and IA-32 Architectures
+* Software Developer's Manual Volume 3 (3A, 3B & 3C): System
+* Programming Guide, Jan-2015. Section 8.9.2: Hierarchical Mapping
+* of CPUID Extended Topology Leaf.
+*/
+   while (1) {
+   struct cpuid_result leaf_b;
+
+   leaf_b = cpuid_ext(0xb, ecx);
+
+   /*
+* Bay Trail doesn't have hyperthreading so just determine the
+* number of cores by from level type (ecx[15:8] == * 2)
+*/
+   if ((leaf_b.ecx & 0xff00) == 0x0200)
+   return leaf_b.ebx & 0x;
+   ecx++;
+   }
+}
+
+static int baytrail_init_cpus(void)
+{
+   struct mp_params mp_params;
+
+   lapic_setup();
+
+   mp_params.num_cpus = detect_num_cpus();
+   mp_params.parallel_microcode_load = 0,
+   mp_params.flight_plan = &mp_steps[0];
+   mp_params.num_records = ARRAY_SIZE(mp_steps);
+   mp_params.microcode_pointer = 0;
+
+   if (mp_init(&mp_params)) {
+   printf("Warning: MP init failure\n");
+   return -EIO;
+   }
+
+   return 0;
+}
+#endif
+
+int x86_init_cpus(void)
+{
+#ifdef CONFIG_SMP
+   debug("Init additional CPUs\n");
+   baytrail_init_cpus();
+#endif
+
+   return 0;
+}
+
+void set_max_freq(void)
+{
+   msr_t perf_ctl;
+   msr_t msr;
+
+   /* Enable speed step */
+   msr = msr_read(MSR_IA32_MISC_ENABLES);
+   msr.lo |= (1 << 16);
+   msr_write(MSR_IA32_MISC_ENABLES, msr);
+
+   /*
+* Set guaranteed ratio [21:16] from IACORE_RATIOS to bits [15:8] of
+* the PERF_CTL
+*/
+   msr = msr_read(MSR_IACORE_RATIOS);
+   perf_ctl.lo = (msr.lo & 0x3f) >> 8;
+
+   /*
+* Set guaranteed vid [21:16] from IACORE_VIDS to bits [7:0] of
+* the PERF_CTL
+*/
+   msr = msr_read(MSR_IACORE_VIDS);
+   perf_ctl.lo |= (msr.lo & 0x7f) >> 16;
+   perf_ctl.hi = 0;
+
+   msr_write(MSR_IA32_PERF_CTL, perf_ctl);
+}
+
+static int cpu_x86_baytrail_probe(struct udevice *dev)
+{
+   debug("Init baytrail core\n");
+
+   /*
+* On bay trail the turbo disable bit is actually scoped at the
+* building-block level, not package. For non-BSP cores that are
+* within a building block, enable turbo. The cores within the BSP's
+* building block will just see it already enabled and move on.
+*/
+   if (lapicid())
+   turbo_enable();
+
+   /* Dynamic L2 shrink enable and threshold */
+   msr_clrsetbits_64(MSR_PMG_CST_CONFIG_CONTROL, 0x3f000f, 0xe0008),
+
+   /* Disable C1E */
+   msr_clrsetbits_64(MSR_POWER_CTL, 2, 0);
+   msr_setbits_64(MSR_POWER_MISC, 0x44);
+
+   /* Set this core to max frequency ratio */
+   set_max_freq();
+
+   return 0;
+}
+
+static unsigned bus_freq(void)
+{
+   msr_t clk_info = msr_read(MSR_BSEL_CR_OVERCLOCK_CONTROL);
+   switch (clk_info.lo & 0x3) {
+   case 0:
+   return 8333;
+   case 1:
+   return 1;
+   case 2:
+   return 1;
+   case 3:
+   return 11666;
+   default:
+   return 0;
+   }
+}
+
+static unsigned long tsc_freq(void)
+{
+   ms

[U-Boot] [PATCH v2 19/20] x86: Tidy up the LAPIC init code

2015-04-28 Thread Simon Glass
We don't need to support really old x86 CPUs, so drop this code.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/cpu/lapic.c | 20 
 arch/x86/include/asm/lapic.h |  7 ---
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/x86/cpu/lapic.c b/arch/x86/cpu/lapic.c
index 4690603..0c9c324 100644
--- a/arch/x86/cpu/lapic.c
+++ b/arch/x86/cpu/lapic.c
@@ -15,7 +15,6 @@
 
 void lapic_setup(void)
 {
-#if NEED_LAPIC == 1
/* Only Pentium Pro and later have those MSR stuff */
debug("Setting up local apic: ");
 
@@ -46,12 +45,17 @@ void lapic_setup(void)
(LAPIC_LVT_REMOTE_IRR | LAPIC_SEND_PENDING |
LAPIC_DELIVERY_MODE_NMI));
 
-   debug("apic_id: 0x%02lx, ", lapicid());
-#else /* !NEED_LLAPIC */
-   /* Only Pentium Pro and later have those MSR stuff */
-   debug("Disabling local apic: ");
-   disable_lapic();
-#endif /* !NEED_LAPIC */
-   debug("done.\n");
+   debug("apic_id: 0x%02lx\n", lapicid());
post_code(POST_LAPIC);
 }
+
+void lapic_enable(void)
+{
+   msr_t msr;
+
+   msr = msr_read(LAPIC_BASE_MSR);
+   msr.hi &= 0xff00;
+   msr.lo &= 0x07ff;
+   msr.lo |= LAPIC_DEFAULT_BASE | LAPIC_BASE_MSR_ENABLE;
+   msr_write(LAPIC_BASE_MSR, msr);
+}
diff --git a/arch/x86/include/asm/lapic.h b/arch/x86/include/asm/lapic.h
index 0a7f443..dff75c5 100644
--- a/arch/x86/include/asm/lapic.h
+++ b/arch/x86/include/asm/lapic.h
@@ -14,13 +14,6 @@
 #include 
 #include 
 
-/* See if I need to initialize the local apic */
-#if CONFIG_SMP || CONFIG_IOAPIC
-#  define NEED_LAPIC 1
-#else
-#  define NEED_LAPIC 0
-#endif
-
 static inline __attribute__((always_inline))
unsigned long lapic_read(unsigned long reg)
 {
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 12/20] x86: Add an mfence macro

2015-04-28 Thread Simon Glass
Provide access to this x86 instruction from C code.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Remove unnecessary \t\n after mfence assembler instruction

 arch/x86/include/asm/cpu.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index c839291..08284ee 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -151,6 +151,11 @@ static inline int flag_is_changeable_p(uint32_t flag)
return ((f1^f2) & flag) != 0;
 }
 
+static inline void mfence(void)
+{
+   __asm__ __volatile__("mfence" : : : "memory");
+}
+
 /**
  * cpu_enable_paging_pae() - Enable PAE-paging
  *
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/20] Add a 'cpu' command to print CPU information

2015-04-28 Thread Simon Glass
Add a simple command which provides access to a list of available CPUs along
with descriptions and basic information.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 common/Kconfig   |   8 
 common/Makefile  |   1 +
 common/cmd_cpu.c | 113 +++
 3 files changed, 122 insertions(+)
 create mode 100644 common/cmd_cpu.c

diff --git a/common/Kconfig b/common/Kconfig
index 5d7e48a..15759f7 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -31,6 +31,14 @@ config CMD_CONSOLE
help
  Print console devices and information.
 
+config CMD_CPU
+   bool "cpu"
+   help
+ Print information about available CPUs. This normally shows the
+ number of CPUs, type (e.g. manufacturer, architecture, product or
+ internal name) and clock frequency. Other information may be
+ available depending on the CPU driver.
+
 config CMD_LICENSE
bool "license"
help
diff --git a/common/Makefile b/common/Makefile
index fba3830..9084c73 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -74,6 +74,7 @@ obj-$(CONFIG_CMD_CBFS) += cmd_cbfs.o
 obj-$(CONFIG_CMD_CLK) += cmd_clk.o
 obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o
 obj-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
+obj-$(CONFIG_CMD_CPU) += cmd_cpu.o
 obj-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
 obj-$(CONFIG_CMD_DATE) += cmd_date.o
 obj-$(CONFIG_CMD_DEMO) += cmd_demo.o
diff --git a/common/cmd_cpu.c b/common/cmd_cpu.c
new file mode 100644
index 000..c3e229f
--- /dev/null
+++ b/common/cmd_cpu.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
+   "L1 cache",
+   "MMU",
+};
+
+static int print_cpu_list(bool detail)
+{
+   struct udevice *dev;
+   struct uclass *uc;
+   char buf[100];
+   int ret;
+
+   ret = uclass_get(UCLASS_CPU, &uc);
+   if (ret) {
+   printf("Cannot find CPU uclass\n");
+   return ret;
+   }
+   uclass_foreach_dev(dev, uc) {
+   struct cpu_platdata *plat = dev_get_parent_platdata(dev);
+   struct cpu_info info;
+   bool first;
+   int i;
+
+   ret = cpu_get_desc(dev, buf, sizeof(buf));
+   printf("%3d: %-10s %s\n", dev->seq, dev->name,
+  ret ? "" : buf);
+   if (!detail)
+   continue;
+   ret = cpu_get_info(dev, &info);
+   if (ret) {
+   printf("\t(no detail available");
+   if (ret != -ENOSYS)
+   printf(": err=%d\n", ret);
+   printf(")\n");
+   continue;
+   }
+   printf("\tID = %d, freq = ", plat->cpu_id);
+   print_freq(info.cpu_freq, "");
+   first = true;
+   for (i = 0; i < CPU_FEAT_COUNT; i++) {
+   if (info.features & (1 << i)) {
+   printf("%s%s", first ? ": " : ", ",
+  cpu_feature_name[i]);
+   first = false;
+   }
+   }
+   printf("\n");
+   }
+
+   return 0;
+}
+
+static int do_cpu_list(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[])
+{
+   if (print_cpu_list(false))
+   return CMD_RET_FAILURE;
+
+   return 0;
+}
+
+static int do_cpu_detail(cmd_tbl_t *cmdtp, int flag, int argc,
+char *const argv[])
+{
+   if (print_cpu_list(true))
+   return CMD_RET_FAILURE;
+
+   return 0;
+}
+
+static cmd_tbl_t cmd_cpu_sub[] = {
+   U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""),
+   U_BOOT_CMD_MKENT(detail, 4, 0, do_cpu_detail, "", ""),
+};
+
+/*
+ * Process a cpu sub-command
+ */
+static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   cmd_tbl_t *c = NULL;
+
+   /* Strip off leading 'cpu' command argument */
+   argc--;
+   argv++;
+
+   if (argc)
+   c = find_cmd_tbl(argv[0], cmd_cpu_sub, ARRAY_SIZE(cmd_cpu_sub));
+
+   if (c)
+   return c->cmd(cmdtp, flag, argc, argv);
+   else
+   return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+   cpu, 2, 1, do_cpu,
+   "display information about CPUs",
+   "list   - list available CPUs\n"
+   "cpu detail - show CPU detail"
+);
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 11/20] x86: Add defines for fixed MTRRs

2015-04-28 Thread Simon Glass
Add MSR numbers for the fixed MTRRs.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/mtrr.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index fda4eae..3841593 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -34,6 +34,20 @@
 /* Number of MTRRs supported */
 #define MTRR_COUNT 8
 
+#define NUM_FIXED_RANGES 88
+#define RANGES_PER_FIXED_MTRR 8
+#define MTRR_FIX_64K_0_MSR 0x250
+#define MTRR_FIX_16K_8_MSR 0x258
+#define MTRR_FIX_16K_A_MSR 0x259
+#define MTRR_FIX_4K_C_MSR 0x268
+#define MTRR_FIX_4K_C8000_MSR 0x269
+#define MTRR_FIX_4K_D_MSR 0x26a
+#define MTRR_FIX_4K_D8000_MSR 0x26b
+#define MTRR_FIX_4K_E_MSR 0x26c
+#define MTRR_FIX_4K_E8000_MSR 0x26d
+#define MTRR_FIX_4K_F_MSR 0x26e
+#define MTRR_FIX_4K_F8000_MSR 0x26f
+
 #if !defined(__ASSEMBLER__)
 
 /**
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 10/20] x86: Add atomic operations

2015-04-28 Thread Simon Glass
Add a subset of this header file from Linux 4.0 to support atomic operations
in U-Boot.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/include/asm/atomic.h | 115 ++
 1 file changed, 115 insertions(+)
 create mode 100644 arch/x86/include/asm/atomic.h

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
new file mode 100644
index 000..806f787
--- /dev/null
+++ b/arch/x86/include/asm/atomic.h
@@ -0,0 +1,115 @@
+#ifndef _ASM_X86_ATOMIC_H
+#define _ASM_X86_ATOMIC_H
+
+#include 
+#include 
+#include 
+
+typedef struct { volatile int counter; } atomic_t;
+
+/*
+ * Atomic operations that C can't guarantee us.  Useful for
+ * resource counting etc..
+ */
+
+#define ATOMIC_INIT(i) { (i) }
+
+/**
+ * atomic_read - read atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically reads the value of @v.
+ */
+static inline int atomic_read(const atomic_t *v)
+{
+   return ACCESS_ONCE((v)->counter);
+}
+
+/**
+ * atomic_set - set atomic variable
+ * @v: pointer of type atomic_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i.
+ */
+static inline void atomic_set(atomic_t *v, int i)
+{
+   v->counter = i;
+}
+
+/**
+ * atomic_add - add integer to atomic variable
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v.
+ */
+static inline void atomic_add(int i, atomic_t *v)
+{
+   asm volatile(LOCK_PREFIX "addl %1,%0"
+: "+m" (v->counter)
+: "ir" (i));
+}
+
+/**
+ * atomic_sub - subtract integer from atomic variable
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v.
+ */
+static inline void atomic_sub(int i, atomic_t *v)
+{
+   asm volatile(LOCK_PREFIX "subl %1,%0"
+: "+m" (v->counter)
+: "ir" (i));
+}
+
+/**
+ * atomic_inc - increment atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1.
+ */
+static inline void atomic_inc(atomic_t *v)
+{
+   asm volatile(LOCK_PREFIX "incl %0"
+: "+m" (v->counter));
+}
+
+/**
+ * atomic_dec - decrement atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1.
+ */
+static inline void atomic_dec(atomic_t *v)
+{
+   asm volatile(LOCK_PREFIX "decl %0"
+: "+m" (v->counter));
+}
+
+/**
+ * atomic_inc_short - increment of a short integer
+ * @v: pointer to type int
+ *
+ * Atomically adds 1 to @v
+ * Returns the new value of @u
+ */
+static inline short int atomic_inc_short(short int *v)
+{
+   asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
+   return *v;
+}
+
+/* These are x86-specific, used by some header files */
+#define atomic_clear_mask(mask, addr)  \
+   asm volatile(LOCK_PREFIX "andl %0,%1"   \
+: : "r" (~(mask)), "m" (*(addr)) : "memory")
+
+#define atomic_set_mask(mask, addr)\
+   asm volatile(LOCK_PREFIX "orl %0,%1"\
+: : "r" ((unsigned)(mask)), "m" (*(addr))  \
+: "memory")
+
+#endif /* _ASM_X86_ATOMIC_H */
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 17/20] x86: Allow CPUs to be set up after relocation

2015-04-28 Thread Simon Glass
This permits init of additional CPU cores after relocation and when driver
model is ready.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/cpu/cpu.c| 37 +
 arch/x86/include/asm/cpu.h| 14 ++
 arch/x86/include/asm/u-boot-x86.h |  2 ++
 common/board_r.c  |  2 +-
 4 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 78eb3fe..6263511 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -21,6 +21,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -518,6 +520,15 @@ char *cpu_get_name(char *name)
return ptr;
 }
 
+int x86_cpu_get_desc(struct udevice *dev, char *buf, int size)
+{
+   if (size < CPU_MAX_NAME_LEN)
+   return -ENOSPC;
+   cpu_get_name(buf);
+
+   return 0;
+}
+
 int default_print_cpuinfo(void)
 {
printf("CPU: %s, vendor %s, device %xh\n",
@@ -600,3 +611,29 @@ int last_stage_init(void)
return 0;
 }
 #endif
+
+__weak int x86_init_cpus(void)
+{
+   return 0;
+}
+
+int cpu_init_r(void)
+{
+   return x86_init_cpus();
+}
+
+static const struct cpu_ops cpu_x86_ops = {
+   .get_desc   = x86_cpu_get_desc,
+};
+
+static const struct udevice_id cpu_x86_ids[] = {
+   { .compatible = "cpu-x86" },
+   { }
+};
+
+U_BOOT_DRIVER(cpu_x86_drv) = {
+   .name   = "cpu_x86",
+   .id = UCLASS_CPU,
+   .of_match   = cpu_x86_ids,
+   .ops= &cpu_x86_ops,
+};
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index 08284ee..01bee52 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -197,6 +197,20 @@ const char *cpu_vendor_name(int vendor);
 char *cpu_get_name(char *name);
 
 /**
+ *
+* x86_cpu_get_desc() - Get a description string for an x86 CPU
+*
+* This uses cpu_get_name() and is suitable to use as the get_desc() method for
+* the I2C uclass.
+*
+* @dev:Device to check (UCLASS_CPU)
+* @buf:Buffer to place string
+* @size:   Size of string space
+* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
+*/
+int x86_cpu_get_desc(struct udevice *dev, char *buf, int size);
+
+/**
  * cpu_call64() - Jump to a 64-bit Linux kernel (internal function)
  *
  * The kernel is uncompressed and the 64-bit entry point is expected to be
diff --git a/arch/x86/include/asm/u-boot-x86.h 
b/arch/x86/include/asm/u-boot-x86.h
index 122e054..be103c0 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -69,6 +69,8 @@ uint64_t timer_get_tsc(void);
 
 void quick_ram_check(void);
 
+int x86_init_cpus(void);
+
 #define PCI_VGA_RAM_IMAGE_START0xc
 
 #endif /* _U_BOOT_I386_H_ */
diff --git a/common/board_r.c b/common/board_r.c
index 307124e..1a46f62 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -779,7 +779,7 @@ init_fnc_t init_sequence_r[] = {
initr_flash,
 #endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
 #endif
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 15/20] x86: Add multi-processor init

2015-04-28 Thread Simon Glass
Most modern x86 CPUs include more than one CPU core. The OS normally requires
that these 'Application Processors' (APs) be brought up by the boot loader.
Add the required support to U-Boot to init additional APs.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/Kconfig |  25 ++
 arch/x86/cpu/Makefile|   2 +
 arch/x86/cpu/ivybridge/model_206ax.c |   4 +-
 arch/x86/cpu/mp_init.c   | 507 +++
 arch/x86/cpu/sipi.S  | 215 +++
 arch/x86/include/asm/mp.h|  94 +++
 arch/x86/include/asm/sipi.h  |  79 ++
 arch/x86/include/asm/smm.h   |  14 +
 8 files changed, 938 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/cpu/mp_init.c
 create mode 100644 arch/x86/cpu/sipi.S
 create mode 100644 arch/x86/include/asm/mp.h
 create mode 100644 arch/x86/include/asm/sipi.h
 create mode 100644 arch/x86/include/asm/smm.h

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f38e9ba..f89ee5c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -361,6 +361,31 @@ config FSP_TEMP_RAM_ADDR
  Stack top address which is used in FspInit after DRAM is ready and
  CAR is disabled.
 
+config MAX_CPUS
+int "Maximum number of CPUs permitted"
+default 4
+help
+  When using multi-CPU chips it is possible for U-Boot to start up
+  more than one CPU. The stack memory used by all of these CPUs is
+  pre-allocated so at present U-Boot wants to know the maximum
+  number of CPUs that may be present. Set this to at least as high
+  as the number of CPUs in your system (it uses about 4KB of RAM for
+  each CPU).
+
+config SMP
+   bool "Enable Symmetric Multiprocessing"
+   default n
+   help
+ Enable use of more than one CPU in U-Boot and the Operating System
+ when loaded. Each CPU will be started up and information can be
+ obtained using the 'cpu' command. If this option is disabled, then
+ only one CPU will be enabled regardless of the number of CPUs
+ available.
+
+config STACK_SIZE
+   hex
+   default 0x1000
+
 config TSC_CALIBRATION_BYPASS
bool "Bypass Time-Stamp Counter (TSC) calibration"
default n
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 6ded0a7..9a08ab4 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -19,6 +19,8 @@ obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
 obj-$(CONFIG_INTEL_QUARK) += quark/
 obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/
 obj-y += lapic.o
+obj-$(CONFIG_SMP) += mp_init.o
 obj-y += mtrr.o
 obj-$(CONFIG_PCI) += pci.o
+obj-$(CONFIG_SMP) += sipi.o
 obj-y += turbo.o
diff --git a/arch/x86/cpu/ivybridge/model_206ax.c 
b/arch/x86/cpu/ivybridge/model_206ax.c
index 11dc625..8b08c40 100644
--- a/arch/x86/cpu/ivybridge/model_206ax.c
+++ b/arch/x86/cpu/ivybridge/model_206ax.c
@@ -435,8 +435,8 @@ static int intel_cores_init(struct x86_cpu_priv *cpu)
 
debug("CPU: %u has core %u\n", cpu->apic_id, new_cpu->apic_id);
 
-#if CONFIG_SMP && CONFIG_MAX_CPUS > 1
-   /* Start the new cpu */
+#if 0 && CONFIG_SMP && CONFIG_MAX_CPUS > 1
+   /* TODO(s...@chromium.org): Start the new cpu */
if (!start_cpu(new_cpu)) {
/* Record the error in cpu? */
printk(BIOS_ERR, "CPU %u would not start!\n",
diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
new file mode 100644
index 000..c1fd4e0
--- /dev/null
+++ b/arch/x86/cpu/mp_init.c
@@ -0,0 +1,507 @@
+/*
+ * Copyright (C) 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ *
+ * Based on code from the coreboot file of the same name
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* This also needs to match the sipi.S assembly code for saved MSR encoding */
+struct saved_msr {
+   uint32_t index;
+   uint32_t lo;
+   uint32_t hi;
+} __packed;
+
+
+/*
+ * The SIPI vector is loaded at the SMM_DEFAULT_BASE. The reason is at the
+ * memory range is already reserved so the OS cannot use it. That region is
+ * free to use for AP bringup before SMM is initialised.
+ */
+static const uint32_t sipi_vector_location = SMM_DEFAULT_BASE;
+static const int sipi_vector_location_size = SMM_DEFAULT_SIZE;
+
+struct mp_flight_plan {
+   int num_records;
+   struct mp_flight_record *records;
+};
+
+static struct mp_flight_plan mp_info;
+
+struct cpu_map {
+   struct udevice *dev;
+   int apic_id;
+   int err_code;
+};
+
+static inline void barrier_wait(atomic_t *b)
+{
+   while (atomic_read(b) == 0)
+   asm("pause");
+   mfence();
+}
+
+static inline void release_barrier(atomic_t *b)
+{
+   mfence();
+   atomic_set(b, 1);
+}
+
+/*

[U-Boot] [PATCH v2 13/20] x86: Store the GDT pointer in global_data

2015-04-28 Thread Simon Glass
When we start up additional CPUs we want them to use the same Global
Descriptor Table. Store the address of this in global_data so we can
reference it later.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/cpu/cpu.c | 1 +
 arch/x86/include/asm/global_data.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 02e66d8..78eb3fe 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -133,6 +133,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
 
 void setup_gdt(gd_t *id, u64 *gdt_addr)
 {
+   id->arch.gdt = gdt_addr;
/* CS: code, read/execute, 4 GB, base 0 */
gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xf);
 
diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index 5ee06eb..4d9eac6 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -68,6 +68,7 @@ struct arch_global_data {
/* MRC training data to save for the next boot */
char *mrc_output;
unsigned int mrc_output_len;
+   void *gdt;  /* Global descriptor table */
 };
 
 #endif
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 02/20] dm: core: Add a function to bind a driver for a device tree node

2015-04-28 Thread Simon Glass
Some device tree nodes do not have compatible strings but do require
drivers. This is pretty rare, and somewhat unfortunate. Add a function
to permit creation of a driver for any device tree node.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/core/lists.c |  9 -
 include/dm/lists.h   | 16 
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 647e390..0c49d99 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -74,6 +74,13 @@ int lists_bind_drivers(struct udevice *parent, bool 
pre_reloc_only)
 int device_bind_driver(struct udevice *parent, const char *drv_name,
   const char *dev_name, struct udevice **devp)
 {
+   return device_bind_driver_to_node(parent, drv_name, dev_name, -1, devp);
+}
+
+int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
+  const char *dev_name, int node,
+  struct udevice **devp)
+{
struct driver *drv;
int ret;
 
@@ -82,7 +89,7 @@ int device_bind_driver(struct udevice *parent, const char 
*drv_name,
printf("Cannot find driver '%s'\n", drv_name);
return -ENOENT;
}
-   ret = device_bind(parent, drv, dev_name, NULL, -1, devp);
+   ret = device_bind(parent, drv, dev_name, NULL, node, devp);
if (ret) {
printf("Cannot create device named '%s' (err=%d)\n",
   dev_name, ret);
diff --git a/include/dm/lists.h b/include/dm/lists.h
index 1b50af9..61610e6 100644
--- a/include/dm/lists.h
+++ b/include/dm/lists.h
@@ -73,4 +73,20 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, 
int offset,
 int device_bind_driver(struct udevice *parent, const char *drv_name,
   const char *dev_name, struct udevice **devp);
 
+/**
+ * device_bind_driver_to_node() - bind a device to a driver for a node
+ *
+ * This binds a new device to a driver for a given device tree node. This
+ * should only be needed if the node lacks a compatible strings.
+ *
+ * @parent:Parent device
+ * @drv_name:  Name of driver to attach to this parent
+ * @dev_name:  Name of the new device thus created
+ * @node:  Device tree node
+ * @devp:  Returns the newly bound device
+ */
+int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
+  const char *dev_name, int node,
+  struct udevice **devp);
+
 #endif
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/20] x86: Remove unwanted MMC debugging

2015-04-28 Thread Simon Glass
This printf() should not have made it into the code.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/cpu/baytrail/valleyview.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/cpu/baytrail/valleyview.c 
b/arch/x86/cpu/baytrail/valleyview.c
index a3e837d..9915da5 100644
--- a/arch/x86/cpu/baytrail/valleyview.c
+++ b/arch/x86/cpu/baytrail/valleyview.c
@@ -16,7 +16,6 @@ static struct pci_device_id mmc_supported[] = {
 
 int cpu_mmc_init(bd_t *bis)
 {
-   printf("mmc init\n");
return pci_mmc_init("ValleyView SDHCI", mmc_supported,
ARRAY_SIZE(mmc_supported));
 }
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 01/20] Fix comment nits in board_f.c

2015-04-28 Thread Simon Glass
Try to make it a little clearer.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 common/board_f.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 322e070..fbbad1b 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -73,7 +73,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 /*
- * sjg: IMO this code should be
+ * TODO(s...@chromium.org): IMO this code should be
  * refactored to a single function, something like:
  *
  * void led_set_state(enum led_colour_t colour, int on);
@@ -300,7 +300,7 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
 {
 #ifdef CONFIG_SYS_SDRAM_BASE
/*
-* Detect whether we have so much RAM it goes past the end of our
+* Detect whether we have so much RAM that it goes past the end of our
 * 32-bit address space. If so, clip the usable RAM so it doesn't.
 */
if (gd->ram_top < CONFIG_SYS_SDRAM_BASE)
@@ -507,7 +507,7 @@ static int reserve_global_data(void)
 static int reserve_fdt(void)
 {
/*
-* If the device tree is sitting immediate above our image then we
+* If the device tree is sitting immediately above our image then we
 * must relocate it. If it is embedded in the data section, then it
 * will be relocated with other data.
 */
@@ -535,7 +535,7 @@ static int reserve_stacks(void)
gd->start_addr_sp &= ~0xf;
 
/*
-* let the architecture specific code tailor gd->start_addr_sp and
+* let the architecture-specific code tailor gd->start_addr_sp and
 * gd->irq_sp
 */
return arch_reserve_stacks();
@@ -556,7 +556,6 @@ static int setup_board_part1(void)
/*
 * Save local variables to board info struct
 */
-
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;/* start of memory */
bd->bi_memsize = gd->ram_size;  /* size in bytes */
 
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 20/20] x86: Enable multi-core init for Minnowboard MAX

2015-04-28 Thread Simon Glass
Enable the CPU uclass and Simple Firmware interface for Minnowbaord MAX. This
enables multi-core support in Linux.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/x86/dts/minnowmax.dts  | 20 
 configs/minnowmax_defconfig |  4 
 2 files changed, 24 insertions(+)

diff --git a/arch/x86/dts/minnowmax.dts b/arch/x86/dts/minnowmax.dts
index 0233f61..7103bc5 100644
--- a/arch/x86/dts/minnowmax.dts
+++ b/arch/x86/dts/minnowmax.dts
@@ -68,6 +68,26 @@
stdout-path = "/serial";
};
 
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "intel,baytrail-cpu";
+   reg = <0>;
+   intel,apic-id = <0>;
+   };
+
+   cpu@1 {
+   device_type = "cpu";
+   compatible = "intel,baytrail-cpu";
+   reg = <1>;
+   intel,apic-id = <4>;
+   };
+
+   };
+
spi {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig
index c59f4ac..426fb52 100644
--- a/configs/minnowmax_defconfig
+++ b/configs/minnowmax_defconfig
@@ -8,3 +8,7 @@ CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
 CONFIG_MMCONF_BASE_ADDRESS=0xe000
 CONFIG_HAVE_INTEL_ME=y
+CONFIG_GENERATE_SFI_TABLE=y
+CONFIG_CPU=y
+CONFIG_CMD_CPU=y
+CONFIG_SMP=y
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 08/20] x86: Add support for the Simple Firmware Interface (SFI)

2015-04-28 Thread Simon Glass
This provides a way of passing information to Linux without requiring the
full ACPI horror. Provide a rudimentary implementation sufficient to be
recognised and parsed by Linux.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Rename CONFIG_SFI to CONFIG_GENERATE_SFI_TABLE and move within Kconfig
- Correct Kconfig help indentation and text
- Drop SFI_BASE config option
- Always build sfi.o
- Use SFI_TABLE_MAX_ENTRIES instead of 16 and ARRAY_SIZE()
- Make get_entry_start() static
- Use table_compute_checksum() to computer checksum
- Add a few blank lines
- Move patch to after the CPU uclass patch
- Drop the RTC table as it is not needed
- Move SFI calling code to write_tables()
- Remove IDLE table
- Remove SFI_SYST_SEARCH_BEGIN and SFI_SYST_SEARCH_END
- Move '__packed' to immediately after 'struct'
- Add SFI_DEV_TYPE_SD and convert to enum
- Remove #ifdef CONFIG_SFI from hedaer file
- Move sfi.h header file to arch/x86/include/asm

 arch/x86/Kconfig   |  14 +
 arch/x86/include/asm/sfi.h | 137 
 arch/x86/lib/Makefile  |   1 +
 arch/x86/lib/sfi.c | 154 +
 arch/x86/lib/tables.c  |   5 ++
 5 files changed, 311 insertions(+)
 create mode 100644 arch/x86/include/asm/sfi.h
 create mode 100644 arch/x86/lib/sfi.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f3a600e..f38e9ba 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -393,6 +393,20 @@ config GENERATE_PIRQ_TABLE
  It specifies the interrupt router information as well how all the PCI
  devices' interrupt pins are wired to PIRQs.
 
+config GENERATE_SFI_TABLE
+   bool "SFI (Simple Firmware Interface) Support"
+   help
+ The Simple Firmware Interface (SFI) provides a lightweight method
+ for platform firmware to pass information to the operating system
+ via static tables in memory.  Kernel SFI support is required to
+ boot on SFI-only platforms.  If you have ACPI tables then these are
+ used instead.
+
+ U-Boot writes this table in sfi_write_tables() just before booting
+ the OS.
+
+ For more information, see http://simplefirmware.org
+
 endmenu
 
 config MAX_PIRQ_LINKS
diff --git a/arch/x86/include/asm/sfi.h b/arch/x86/include/asm/sfi.h
new file mode 100644
index 000..d1f0f0c
--- /dev/null
+++ b/arch/x86/include/asm/sfi.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright(c) 2009 Intel Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier:GPL-2.0+BSD-3-Clause
+ */
+
+#ifndef _LINUX_SFI_H
+#define _LINUX_SFI_H
+
+#include 
+#include 
+
+/* Table signatures reserved by the SFI specification */
+#define SFI_SIG_SYST   "SYST"
+#define SFI_SIG_FREQ   "FREQ"
+#define SFI_SIG_CPUS   "CPUS"
+#define SFI_SIG_MTMR   "MTMR"
+#define SFI_SIG_MRTC   "MRTC"
+#define SFI_SIG_MMAP   "MMAP"
+#define SFI_SIG_APIC   "APIC"
+#define SFI_SIG_XSDT   "XSDT"
+#define SFI_SIG_WAKE   "WAKE"
+#define SFI_SIG_DEVS   "DEVS"
+#define SFI_SIG_GPIO   "GPIO"
+
+#define SFI_SIGNATURE_SIZE 4
+#define SFI_OEM_ID_SIZE6
+#define SFI_OEM_TABLE_ID_SIZE  8
+
+#define SFI_NAME_LEN   16
+#define SFI_TABLE_MAX_ENTRIES  16
+
+#define SFI_GET_NUM_ENTRIES(ptable, entry_type) \
+   ((ptable->header.len - sizeof(struct sfi_table_header)) / \
+   (sizeof(entry_type)))
+/*
+ * Table structures must be byte-packed to match the SFI specification,
+ * as they are provided by the BIOS.
+ */
+struct __packed sfi_table_header {
+   charsig[SFI_SIGNATURE_SIZE];
+   u32 len;
+   u8  rev;
+   u8  csum;
+   charoem_id[SFI_OEM_ID_SIZE];
+   charoem_table_id[SFI_OEM_TABLE_ID_SIZE];
+};
+
+struct __packed sfi_table_simple {
+   struct sfi_table_header header;
+   u64 pentry[1];
+};
+
+/* Comply with UEFI spec 2.1 */
+struct __packed sfi_mem_entry {
+   u32 type;
+   u64 phys_start;
+   u64 virt_start;
+   u64 pages;
+   u64 attrib;
+};
+
+struct __packed sfi_cpu_table_entry {
+   u32 apic_id;
+};
+
+struct __packed sfi_cstate_table_entry {
+   u32 hint;   /* MWAIT hint */
+   u32 latency;/* latency in ms */
+};
+
+struct __packed sfi_apic_table_entry {
+   u64 phys_addr;  /* phy base addr for APIC reg */
+};
+
+struct __packed sfi_freq_table_entry {
+   u32 freq_mhz;   /* in MHZ */
+   u32 latency;/* transition latency in ms */
+   u32 ctrl_val;   /* value to write to PERF_CTL */
+};
+
+struct __packed sfi_wake_table_entry {
+   u64 phys_addr;  /* pointer to where the wake vector locates */
+};
+
+struct __packed sfi_timer_table_entry {
+   u64 phys_addr;  /* phy base addr for the timer */
+   u32 freq_hz;/* in HZ */

[U-Boot] [PATCH v2 05/20] Move display_options functions to their own header

2015-04-28 Thread Simon Glass
Before adding one more function, create a separate header to help reduce
the size of common.h. Add the missing function comments and tidy up.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Use capitals for the header guard
- Change 'print' to 'Print' in comment

 include/common.h  | 16 +---
 include/display_options.h | 48 +++
 lib/display_options.c | 13 -
 3 files changed, 49 insertions(+), 28 deletions(-)
 create mode 100644 include/display_options.h

diff --git a/include/common.h b/include/common.h
index cde3474..d4d704a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -192,22 +192,8 @@ intcpu_init(void);
 
 /* */
 phys_size_t initdram (int);
-intdisplay_options (void);
 
-/**
- * print_size() - Print a size with a suffic
- *
- * print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB",
- * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string
- * (like "\n")
- *
- * @size:  Size to print
- * @suffix String to print after the size
- */
-void print_size(uint64_t size, const char *suffix);
-
-int print_buffer(ulong addr, const void *data, uint width, uint count,
-uint linelen);
+#include 
 
 /* common/main.c */
 void   main_loop   (void);
diff --git a/include/display_options.h b/include/display_options.h
new file mode 100644
index 000..54bd41d
--- /dev/null
+++ b/include/display_options.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015 Google, Inc
+ *
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef __DISPLAY_OPTIONS_H
+#define __DISPLAY_OPTIONS_H
+
+/**
+ * print_size() - Print a size with a suffix
+ *
+ * Print sizes as "xxx KiB", "xxx.y KiB", "xxx MiB", "xxx.y MiB",
+ * xxx GiB, xxx.y GiB, etc as needed; allow for optional trailing string
+ * (like "\n")
+ *
+ * @size:  Size to print
+ * @suffix String to print after the size
+ */
+void print_size(uint64_t size, const char *suffix);
+
+/**
+ * print_buffer() - Print data buffer in hex and ascii form
+ *
+ * Data reads are buffered so that each memory address is only read once.
+ * This is useful when displaying the contents of volatile registers.
+ *
+ * @addr:  Starting address to display at start of line
+ * @data:  pointer to data buffer
+ * @width: data value width.  May be 1, 2, or 4.
+ * @count: number of values to display
+ * @linelen:   Number of values to print per line; specify 0 for default length
+ */
+int print_buffer(ulong addr, const void *data, uint width, uint count,
+uint linelen);
+
+/**
+ * display_options() - display the version string / build tag
+ *
+ * This displays the U-Boot version string. If a build tag is available this
+ * is displayed also.
+ */
+int display_options(void);
+
+#endif
diff --git a/lib/display_options.c b/lib/display_options.c
index d5d17b2..3f32bcd 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -63,19 +63,6 @@ void print_size(uint64_t size, const char *s)
printf (" %ciB%s", c, s);
 }
 
-/*
- * Print data buffer in hex and ascii form to the terminal.
- *
- * data reads are buffered so that each memory address is only read once.
- * Useful when displaying the contents of volatile registers.
- *
- * parameters:
- *addr: Starting address to display at start of line
- *data: pointer to data buffer
- *width: data value width.  May be 1, 2, or 4.
- *count: number of values to display
- *linelen: Number of values to print per line; specify 0 for default length
- */
 #define MAX_LINE_LENGTH_BYTES (64)
 #define DEFAULT_LINE_LENGTH_BYTES (16)
 int print_buffer(ulong addr, const void *data, uint width, uint count,
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 06/20] Add print_freq() to display frequencies nicely

2015-04-28 Thread Simon Glass
Add a function similar to print_size() that works for frequencies. It can
handle from Hz to GHz.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Correct bugs in number output

 include/display_options.h | 11 +++
 lib/display_options.c | 38 ++
 2 files changed, 49 insertions(+)

diff --git a/include/display_options.h b/include/display_options.h
index 54bd41d..ac44c45 100644
--- a/include/display_options.h
+++ b/include/display_options.h
@@ -23,6 +23,17 @@
 void print_size(uint64_t size, const char *suffix);
 
 /**
+ * print_freq() - Print a frequency with a suffix
+ *
+ * Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for
+ * optional trailing string (like "\n")
+ *
+ * @freq:  Frequency to print in Hz
+ * @suffix String to print after the frequency
+ */
+void print_freq(uint64_t freq, const char *suffix);
+
+/**
  * print_buffer() - Print data buffer in hex and ascii form
  *
  * Data reads are buffered so that each memory address is only read once.
diff --git a/lib/display_options.c b/lib/display_options.c
index 3f32bcd..3a70e14 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -7,6 +7,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -22,6 +23,43 @@ int display_options (void)
return 0;
 }
 
+void print_freq(uint64_t freq, const char *s)
+{
+   unsigned long m = 0, n;
+   uint64_t f;
+   static const char names[] = {'G', 'M', 'K'};
+   unsigned long d = 1e9;
+   char c = 0;
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(names); i++, d /= 1000) {
+   if (freq >= d) {
+   c = names[i];
+   break;
+   }
+   }
+
+   if (!c) {
+   printf("%" PRIu64 " Hz%s", freq, s);
+   return;
+   }
+
+   f = do_div(freq, d);
+   n = freq;
+
+   /* If there's a remainder, show the first few digits */
+   if (f) {
+   m = f % d;
+   while (!(m % 10))
+   m /= 10;
+   }
+
+   printf("%lu", n);
+   if (m)
+   printf(".%ld", m);
+   printf(" %cHz%s", c, s);
+}
+
 void print_size(uint64_t size, const char *s)
 {
unsigned long m = 0, n;
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 04/20] x86: Disable -Werror

2015-04-28 Thread Simon Glass
This is annoying during development and serves no useful purpose since
warnings are clearly displayed now that we are using Kbuild. Remove this
option.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/cpu/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk
index 84aeaf3..4c4d0c7 100644
--- a/arch/x86/cpu/config.mk
+++ b/arch/x86/cpu/config.mk
@@ -7,7 +7,7 @@
 
 CROSS_COMPILE ?= i386-linux-
 
-PLATFORM_CPPFLAGS += -D__I386__ -Werror
+PLATFORM_CPPFLAGS += -D__I386__
 
 # DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!
 LDPPFLAGS += -DRESET_SEG_START=0x
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 00/20] x86: Add CPU uclass and multi-core support for Minnowboard MAX

2015-04-28 Thread Simon Glass
This series adds a new CPU uclass which is intended to be useful on any
architecture. So far it has a very simple interface and a command to show
CPU details.

This series also introduces multi-core init for x86. It is implemented and
enabled on Minnowboard MAX, a single/dual-core Atom board. The CPU uclass is
implemented for x86 and the Simple Firmware Interface provides these details
to the kernel, since ACPI is not yet available.

With these changes Minnowboard MAX can boot into Linux with both cores
enabled.

This series is available at u-boot-x86 branch 'cpu-working'.

Changes in v2:
- Use capitals for the header guard
- Change 'print' to 'Print' in comment
- Correct bugs in number output
- Change header guard to capital letters
- Change get_info() in function comment to cpu_get_info()
- Rename CONFIG_SFI to CONFIG_GENERATE_SFI_TABLE and move within Kconfig
- Correct Kconfig help indentation and text
- Drop SFI_BASE config option
- Always build sfi.o
- Use SFI_TABLE_MAX_ENTRIES instead of 16 and ARRAY_SIZE()
- Make get_entry_start() static
- Use table_compute_checksum() to computer checksum
- Add a few blank lines
- Move patch to after the CPU uclass patch
- Drop the RTC table as it is not needed
- Move SFI calling code to write_tables()
- Remove IDLE table
- Remove SFI_SYST_SEARCH_BEGIN and SFI_SYST_SEARCH_END
- Move '__packed' to immediately after 'struct'
- Add SFI_DEV_TYPE_SD and convert to enum
- Remove #ifdef CONFIG_SFI from hedaer file
- Move sfi.h header file to arch/x86/include/asm
- Remove unnecessary \t\n after mfence assembler instruction

Simon Glass (20):
  Fix comment nits in board_f.c
  dm: core: Add a function to bind a driver for a device tree node
  x86: Remove unwanted MMC debugging
  x86: Disable -Werror
  Move display_options functions to their own header
  Add print_freq() to display frequencies nicely
  dm: Implement a CPU uclass
  x86: Add support for the Simple Firmware Interface (SFI)
  Add a 'cpu' command to print CPU information
  x86: Add atomic operations
  x86: Add defines for fixed MTRRs
  x86: Add an mfence macro
  x86: Store the GDT pointer in global_data
  x86: Provide access to the IDT
  x86: Add multi-processor init
  x86: Add functions to set and clear bits on MSRs
  x86: Allow CPUs to be set up after relocation
  x86: Add a CPU driver for baytrail
  x86: Tidy up the LAPIC init code
  x86: Enable multi-core init for Minnowboard MAX

 arch/x86/Kconfig |  39 +++
 arch/x86/cpu/Makefile|   2 +
 arch/x86/cpu/baytrail/Makefile   |   1 +
 arch/x86/cpu/baytrail/cpu.c  | 206 +
 arch/x86/cpu/baytrail/valleyview.c   |   1 -
 arch/x86/cpu/config.mk   |   2 +-
 arch/x86/cpu/cpu.c   |  38 +++
 arch/x86/cpu/interrupts.c|   5 +
 arch/x86/cpu/ivybridge/model_206ax.c |   4 +-
 arch/x86/cpu/lapic.c |  20 +-
 arch/x86/cpu/mp_init.c   | 507 +++
 arch/x86/cpu/sipi.S  | 215 +
 arch/x86/dts/minnowmax.dts   |  20 ++
 arch/x86/include/asm/arch-baytrail/msr.h |  30 ++
 arch/x86/include/asm/atomic.h| 115 +++
 arch/x86/include/asm/cpu.h   |  19 ++
 arch/x86/include/asm/global_data.h   |   1 +
 arch/x86/include/asm/interrupt.h |   2 +
 arch/x86/include/asm/lapic.h |   7 -
 arch/x86/include/asm/mp.h|  94 ++
 arch/x86/include/asm/msr.h   |  19 ++
 arch/x86/include/asm/mtrr.h  |  14 +
 arch/x86/include/asm/sfi.h   | 137 +
 arch/x86/include/asm/sipi.h  |  79 +
 arch/x86/include/asm/smm.h   |  14 +
 arch/x86/include/asm/u-boot-x86.h|   2 +
 arch/x86/lib/Makefile|   1 +
 arch/x86/lib/sfi.c   | 154 ++
 arch/x86/lib/tables.c|   5 +
 common/Kconfig   |   8 +
 common/Makefile  |   1 +
 common/board_f.c |   9 +-
 common/board_r.c |   2 +-
 common/cmd_cpu.c | 113 +++
 configs/minnowmax_defconfig  |   4 +
 drivers/Kconfig  |   2 +
 drivers/Makefile |   1 +
 drivers/core/lists.c |   9 +-
 drivers/cpu/Kconfig  |   8 +
 drivers/cpu/Makefile |   7 +
 drivers/cpu/cpu-uclass.c |  61 
 include/common.h |  16 +-
 include/cpu.h|  84 +
 include/display_options.h|  59 
 include/dm/lists.h   |  16 +
 include/dm/uclass-id.h   |   1 +
 lib/display_options.c|  51 +++-
 47 files changed, 2151 insertions(+), 54 deletions(-)
 create mode 100644 arch/x86/cpu/baytrail/cpu.c
 create

[U-Boot] [PATCH v2 2/4] x86: ivybridge: Use reset_cpu()

2015-04-28 Thread Simon Glass
Now that reset_cpu() functions correctly, use it instead of directly
accessing the port.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Correct call to reset_cpu() which was missing a parameter!
- Tidy up reset calls to do the correct reset type

 arch/x86/cpu/ivybridge/cpu.c  |  5 ++---
 arch/x86/cpu/ivybridge/early_me.c | 13 +++--
 arch/x86/cpu/ivybridge/sdram.c|  3 +--
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
index 37f3731..cce5923 100644
--- a/arch/x86/cpu/ivybridge/cpu.c
+++ b/arch/x86/cpu/ivybridge/cpu.c
@@ -92,7 +92,7 @@ static int set_flex_ratio_to_tdp_nominal(void)
 
/* Issue warm reset, will be "CPU only" due to soft reset data */
outb(0x0, PORT_RESET);
-   outb(0x6, PORT_RESET);
+   outb(SYS_RST | RST_CPU, PORT_RESET);
cpu_hlt();
 
/* Not reached */
@@ -286,8 +286,7 @@ int print_cpuinfo(void)
 
/* System is not happy after keyboard reset... */
debug("Issuing CF9 warm reset\n");
-   outb(0x6, 0xcf9);
-   cpu_hlt();
+   reset_cpu(0);
}
 
/* Early chipset init required before RAM init can work */
diff --git a/arch/x86/cpu/ivybridge/early_me.c 
b/arch/x86/cpu/ivybridge/early_me.c
index 356bbb4..711470f 100644
--- a/arch/x86/cpu/ivybridge/early_me.c
+++ b/arch/x86/cpu/ivybridge/early_me.c
@@ -117,7 +117,6 @@ static inline void set_global_reset(int enable)
 
 int intel_early_me_init_done(u8 status)
 {
-   u8 reset;
int count;
u32 mebase_l, mebase_h;
struct me_hfs hfs;
@@ -156,7 +155,6 @@ int intel_early_me_init_done(u8 status)
/* Check status after acknowledgement */
intel_early_me_status();
 
-   reset = 0;
switch (hfs.ack_data) {
case ME_HFS_ACK_CONTINUE:
/* Continue to boot */
@@ -164,17 +162,17 @@ int intel_early_me_init_done(u8 status)
case ME_HFS_ACK_RESET:
/* Non-power cycle reset */
set_global_reset(0);
-   reset = 0x06;
+   reset_cpu(0);
break;
case ME_HFS_ACK_PWR_CYCLE:
/* Power cycle reset */
set_global_reset(0);
-   reset = 0x0e;
+   x86_full_reset();
break;
case ME_HFS_ACK_GBL_RESET:
/* Global reset */
set_global_reset(1);
-   reset = 0x0e;
+   x86_full_reset();
break;
case ME_HFS_ACK_S3:
case ME_HFS_ACK_S4:
@@ -182,10 +180,5 @@ int intel_early_me_init_done(u8 status)
break;
}
 
-   /* Perform the requested reset */
-   if (reset) {
-   outb(reset, 0xcf9);
-   cpu_hlt();
-   }
return -1;
 }
diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index 9a6da37..af907c5 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -393,8 +393,7 @@ int sdram_initialise(struct pei_data *pei_data)
/* If MRC data is not found we cannot continue S3 resume. */
if (pei_data->boot_mode == PEI_BOOT_RESUME && !pei_data->mrc_input) {
debug("Giving up in sdram_initialize: No MRC data\n");
-   outb(0x6, PORT_RESET);
-   cpu_hlt();
+   reset_cpu(0);
}
 
/* Pass console handler in pei_data */
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 4/4] x86: fsp: Use reset_cpu()

2015-04-28 Thread Simon Glass
Now that reset_cpu() functions correctly, use it instead of directly
accessing the port on boards that use a Firmware Support Package (FSP).

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/lib/fsp/fsp_common.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index f668259..001494d 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -17,13 +17,6 @@ int print_cpuinfo(void)
return default_print_cpuinfo();
 }
 
-void reset_cpu(ulong addr)
-{
-   /* cold reset */
-   outb(0x06, PORT_RESET);
-}
-
-
 int board_pci_post_scan(struct pci_controller *hose)
 {
u32 status;
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] x86: quark: Use reset_cpu()

2015-04-28 Thread Simon Glass
Now that reset_cpu() functions correctly, use it instead of directly
accessing the port.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v2: None

 arch/x86/cpu/quark/quark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c
index 4ffa437..e78a271 100644
--- a/arch/x86/cpu/quark/quark.c
+++ b/arch/x86/cpu/quark/quark.c
@@ -122,7 +122,7 @@ int print_cpuinfo(void)
 void reset_cpu(ulong addr)
 {
/* cold reset */
-   outb(0x08, PORT_RESET);
+   x86_full_reset();
 }
 
 int cpu_mmc_init(bd_t *bis)
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] x86: Implement reset_cpu() correctly for modern CPUs

2015-04-28 Thread Simon Glass
The existing code is pretty ancient and is unreliable on modern hardware.
Generally it will hang.

We can use port 0xcf9 to initiate reset on more modern hardware (say in the
last 10 years). Update the reset_cpu() function to do this, and add a new
'full reset' function to perform a full power cycle.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Update reset comments to indicate the datasheet section
- Correct full reset code

 arch/x86/cpu/cpu.c   | 22 +-
 arch/x86/include/asm/processor.h | 19 +++
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index c9614f1..02e66d8 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -380,21 +380,17 @@ void  flush_cache(unsigned long dummy1, unsigned long 
dummy2)
asm("wbinvd\n");
 }
 
-void __attribute__ ((regparm(0))) generate_gpf(void);
-
-/* segment 0x70 is an arbitrary segment which does not exist */
-asm(".globl generate_gpf\n"
-   ".hidden generate_gpf\n"
-   ".type generate_gpf, @function\n"
-   "generate_gpf:\n"
-   "ljmp   $0x70, $0x47114711\n");
-
 __weak void reset_cpu(ulong addr)
 {
-   printf("Resetting using x86 Triple Fault\n");
-   set_vector(13, generate_gpf);   /* general protection fault handler */
-   set_vector(8, generate_gpf);/* double fault handler */
-   generate_gpf(); /* start the show */
+   /* Do a hard reset through the chipset's reset control register */
+   outb(SYS_RST | RST_CPU, PORT_RESET);
+   for (;;)
+   cpu_hlt();
+}
+
+void x86_full_reset(void)
+{
+   outb(FULL_RST | SYS_RST | RST_CPU, PORT_RESET);
 }
 
 int dcache_status(void)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 3e26202..3575d34 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -25,8 +25,27 @@
 
 #ifndef __ASSEMBLY__
 
+/*
+ * This register is documented in (for example) the Intel Atom Processor E3800
+ * Product Family Datasheet in "PCU - Power Management Controller (PMC)".
+ *
+ * RST_CNT: Reset Control Register (RST_CNT) Offset cf9.
+ *
+ * The naming follows Intel's naming.
+ */
 #define PORT_RESET 0xcf9
 
+enum {
+   SYS_RST = 1 << 1,   /* 0 for soft reset, 1 for hard reset */
+   RST_CPU = 1 << 2,   /* initiate reset */
+   FULL_RST= 1 << 3,   /* full power cycle */
+};
+
+/**
+ * x86_full_reset() - reset everything: perform a full power cycle
+ */
+void x86_full_reset(void);
+
 static inline __attribute__((always_inline)) void cpu_hlt(void)
 {
asm("hlt");
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 14/20] x86: Provide access to the IDT

2015-04-28 Thread Simon Glass
Hi Bin,

On 28 April 2015 at 02:16, Bin Meng  wrote:
> Hi Simon,
>
> On Tue, Apr 28, 2015 at 6:48 AM, Simon Glass  wrote:
>> Add a function to return the address of the Interrupt Descriptor Table.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/x86/cpu/interrupts.c| 5 +
>>  arch/x86/include/asm/interrupt.h | 2 ++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
>> index a21d2a6..c777d36 100644
>> --- a/arch/x86/cpu/interrupts.c
>> +++ b/arch/x86/cpu/interrupts.c
>> @@ -147,6 +147,11 @@ int cpu_init_interrupts(void)
>> return 0;
>>  }
>>
>> +void *x86_get_idt(void)
>> +{
>> +   return &idt_ptr;
>> +}
>> +
>
> idt_ptr is not declared as static, so this is unneeded? Or should we
> change it to static?

I think it is better to access it via a function. It is used from
assembler so I would rather not make it static. Any thoughts?

>
>>  void __do_irq(int irq)
>>  {
>> printf("Unhandled IRQ : %d\n", irq);
>> diff --git a/arch/x86/include/asm/interrupt.h 
>> b/arch/x86/include/asm/interrupt.h
>> index 25abde7..0a75f89 100644
>> --- a/arch/x86/include/asm/interrupt.h
>> +++ b/arch/x86/include/asm/interrupt.h
>> @@ -38,4 +38,6 @@ extern char exception_stack[];
>>   */
>>  void configure_irq_trigger(int int_num, bool is_level_triggered);
>>
>> +void *x86_get_idt(void);
>> +
>>  #endif
>> --

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] x86: ivybridge: Use reset_cpu()

2015-04-28 Thread Simon Glass
Hi Bin,

On 26 April 2015 at 22:58, Bin Meng  wrote:
> Hi Simon,
>
> On Sat, Apr 25, 2015 at 11:04 PM, Simon Glass  wrote:
>> Now that reset_cpu() functions correctly, use it instead of directly
>> accessing the port.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/x86/cpu/ivybridge/cpu.c  | 5 ++---
>>  arch/x86/cpu/ivybridge/early_me.c | 7 +++
>>  arch/x86/cpu/ivybridge/sdram.c| 3 +--
>>  3 files changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
>> index 37f3731..a62b30e 100644
>> --- a/arch/x86/cpu/ivybridge/cpu.c
>> +++ b/arch/x86/cpu/ivybridge/cpu.c
>> @@ -92,7 +92,7 @@ static int set_flex_ratio_to_tdp_nominal(void)
>>
>> /* Issue warm reset, will be "CPU only" due to soft reset data */
>> outb(0x0, PORT_RESET);
>> -   outb(0x6, PORT_RESET);
>> +   outb(SYS_RST | RST_CPU, PORT_RESET);
>> cpu_hlt();
>>
>> /* Not reached */
>> @@ -286,8 +286,7 @@ int print_cpuinfo(void)
>>
>> /* System is not happy after keyboard reset... */
>> debug("Issuing CF9 warm reset\n");
>> -   outb(0x6, 0xcf9);
>> -   cpu_hlt();
>> +   reset_cpu();
>> }
>>
>> /* Early chipset init required before RAM init can work */
>> diff --git a/arch/x86/cpu/ivybridge/early_me.c 
>> b/arch/x86/cpu/ivybridge/early_me.c
>> index 356bbb4..0347197 100644
>> --- a/arch/x86/cpu/ivybridge/early_me.c
>> +++ b/arch/x86/cpu/ivybridge/early_me.c
>> @@ -183,9 +183,8 @@ int intel_early_me_init_done(u8 status)
>> }
>>
>> /* Perform the requested reset */
>> -   if (reset) {
>> -   outb(reset, 0xcf9);
>> -   cpu_hlt();
>> -   }
>> +   if (reset)
>> +   reset_cpu();
>> +
>
> I think the following codes before this code block need to be updated
> to use the reset bit enum to assign to the reset variable.

Ah yes, I didn't look very hard. I'll fix this.

>
> reset = 0;
> switch (hfs.ack_data) {
> case ME_HFS_ACK_CONTINUE:
> /* Continue to boot */
> return 0;
> case ME_HFS_ACK_RESET:
> /* Non-power cycle reset */
> set_global_reset(0);
> reset = 0x06;
> break;
> case ME_HFS_ACK_PWR_CYCLE:
> /* Power cycle reset */
> set_global_reset(0);
> reset = 0x0e;
> break;
> case ME_HFS_ACK_GBL_RESET:
> /* Global reset */
> set_global_reset(1);
> reset = 0x0e;
> break;
>
>> return -1;
>>  }
>> diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
>> index 9a6da37..42e1e60 100644
>> --- a/arch/x86/cpu/ivybridge/sdram.c
>> +++ b/arch/x86/cpu/ivybridge/sdram.c
>> @@ -393,8 +393,7 @@ int sdram_initialise(struct pei_data *pei_data)
>> /* If MRC data is not found we cannot continue S3 resume. */
>> if (pei_data->boot_mode == PEI_BOOT_RESUME && !pei_data->mrc_input) {
>> debug("Giving up in sdram_initialize: No MRC data\n");
>> -   outb(0x6, PORT_RESET);
>> -   cpu_hlt();
>> +   reset_cpu();
>> }
>>
>> /* Pass console handler in pei_data */
>> --

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] x86: Implement reset_cpu() correctly for modern CPUs

2015-04-28 Thread Simon Glass
Hi Bin,

On 26 April 2015 at 22:56, Bin Meng  wrote:
> Hi Simon,
>
> On Sat, Apr 25, 2015 at 11:04 PM, Simon Glass  wrote:
>> The existing code is pretty ancient and is unreliable on modern hardware.
>> Generally it will hang.
>>
>> We can use port 0xcf9 to initiate reset on more modern hardware (say in the
>> last 10 years). Update the reset_cpu() function to do this, and add a new
>> 'full reset' function to perform a full power cycle.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/x86/cpu/cpu.c   | 22 +-
>>  arch/x86/include/asm/processor.h | 11 +++
>>  2 files changed, 20 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
>> index c9614f1..13b3baa 100644
>> --- a/arch/x86/cpu/cpu.c
>> +++ b/arch/x86/cpu/cpu.c
>> @@ -380,21 +380,17 @@ void  flush_cache(unsigned long dummy1, unsigned long 
>> dummy2)
>> asm("wbinvd\n");
>>  }
>>
>> -void __attribute__ ((regparm(0))) generate_gpf(void);
>> -
>> -/* segment 0x70 is an arbitrary segment which does not exist */
>> -asm(".globl generate_gpf\n"
>> -   ".hidden generate_gpf\n"
>> -   ".type generate_gpf, @function\n"
>> -   "generate_gpf:\n"
>> -   "ljmp   $0x70, $0x47114711\n");
>> -
>>  __weak void reset_cpu(ulong addr)
>>  {
>> -   printf("Resetting using x86 Triple Fault\n");
>> -   set_vector(13, generate_gpf);   /* general protection fault handler 
>> */
>> -   set_vector(8, generate_gpf);/* double fault handler */
>> -   generate_gpf(); /* start the show */
>> +   /* Do a hard reset through the chipset's reset control register */
>> +   outb(SYS_RST | RST_CPU, PORT_RESET);
>> +   for (;;)
>> +   cpu_hlt();
>> +}
>> +
>> +void x86_full_reset(void)
>> +{
>> +   outb(FULL_RST, PORT_RESET);
>>  }
>>
>>  int dcache_status(void)
>> diff --git a/arch/x86/include/asm/processor.h 
>> b/arch/x86/include/asm/processor.h
>> index 3e26202..a24028d 100644
>> --- a/arch/x86/include/asm/processor.h
>> +++ b/arch/x86/include/asm/processor.h
>> @@ -27,6 +27,17 @@
>>
>>  #define PORT_RESET 0xcf9
>>
>> +enum {
>> +   SYS_RST = 1 << 1,   /* clear for soft reset, set for 
>> hard */
>
> The comment looks confusing. What does 'clear for soft reset' mean?
>
>> +   RST_CPU = 1 << 2,   /* initiate reset */
>
> CPU_RST? to follow the same convention as SYS_RST and FULL_RST?

It should do, but I want to follow Intel's register naming. I'll add a
bit more detail of where this came from.

>
>> +   FULL_RST= 1 << 3,   /* full power cycle */
>> +};
>> +
>> +/**
>> + * x86_full_reset() - reset everything: perform a full power cycle
>> + */
>> +void x86_full_reset(void);
>> +
>>  static inline __attribute__((always_inline)) void cpu_hlt(void)
>>  {
>> asm("hlt");
>> --
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] pepper: Add support for DDR3 variants

2015-04-28 Thread Ash Charles
Hi Tom,

There is actually an EEPROM on new boards that we'd like to use in the
future in order to detect that we should use DDR3 (and frankly,
everything will be DDR3 going forward).  We still don't have
everything sorted in hardware and at the factories for programming the
eeprom though.  This patch was a shot at capturing and makes generally
available the interim measure that has been carried for a bit on our
Gumstix tree.  If this is not appropriate for mainline, we can
certainly carry it until hardware gets settled.

--Ash

On Tue, Apr 28, 2015 at 5:24 PM, Tom Rini  wrote:
> On Tue, Apr 28, 2015 at 04:25:44PM -0700, Ash Charles wrote:
>
>> Some variants of the Gumstix Pepper board use DDR3 memory instead of
>> DDR2.  This adds a machine variant to support these DDR3-based boards
>> which can be built as 'pepper_ddr3_defconfig' rather than the normal
>> 'pepper_defconfig'.
>>
>> Signed-off-by: Ash Charles 
>
> There's no way to tell at run time which board we're on?
>
> --
> Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PULL] u-boot-socfpga/master

2015-04-28 Thread Marek Vasut
The following changes since commit 1733259d25015c28c47990ec11af99b3f62f811c:

  Merge branch 'master' of git://git.denx.de/u-boot-video (2015-04-20 09:13:52 
-0400)

are available in the git repository at:

  git://git.denx.de/u-boot-socfpga.git HEAD

for you to fetch changes up to e5c57eea4f4ac8c27343bde137b069ef816e69d7:

  socfpga: implement arria V socdk SPI flash config in dts (2015-04-27 03:08:43 
+0200)


Dinh Nguyen (15):
  arm: socfpga: spl: Add CONFIG_SPL_MAX_SIZE to be 64KB
  arm: socfpga: add functions to bring sdram, timer, and uart out of reset
  arm: socfpga: spl: enable sdram, timer and uart
  arm: socfpga: spl: Add call to timer_init
  arm: socfpga: spl: allow bootrom to enable IOs after warm reset
  arm: socfpga: spl: add sdram init and calibration
  arm: socfpga: spl: printout sdram size
  arm: socfpga: spl: Use common lowlevel_init
  arm: socfpga: spl: add CONFIG_SPL_STACK to socfpga_common.h
  arm: socfpga: spl: Adjust the SYS_INIT_RAM_SIZE to have room for the spl 
malloc
  arm: socfpga: spl: Add SDRAM check
  arm: socfpga: fix uart0 pin mux configuration
  arm: socfpga: spl: Add s_init stub
  arm: socfpga: spl: add board_init_f to SPL
  arm: socfpga: spl: update peripheral pll for dev kit

Marek Vasut (3):
  spi: Add Designware SPI controller Kconfig entry
  spi: Add Cadence QSPI controller Kconfig entry
  arm: socfpga: spl: Add stub sdram.h

Pavel Machek (2):
  socfpga: implement socdk SPI flash config in dts
  socfpga: implement arria V socdk SPI flash config in dts  
  

  
 arch/arm/cpu/armv7/Makefile|  2 +- 
  
 arch/arm/cpu/armv7/socfpga/Makefile|  1 -  
  
 arch/arm/cpu/armv7/socfpga/lowlevel_init.S | 45 
-   
 
 arch/arm/cpu/armv7/socfpga/reset_manager.c | 24 

 
 arch/arm/cpu/armv7/socfpga/spl.c   | 61 
+   
 
 arch/arm/cpu/armv7/socfpga/system_manager.c|  9 +  
  
 arch/arm/dts/socfpga_arria5_socdk.dts  | 24 

 arch/arm/dts/socfpga_cyclone5_socdk.dts| 24 

 arch/arm/include/asm/arch-socfpga/reset_manager.h  |  6 ++
 arch/arm/include/asm/arch-socfpga/sdram.h  | 19 +++
 arch/arm/include/asm/arch-socfpga/system_manager.h |  1 +
 board/altera/socfpga/pinmux_config.c   |  4 ++--
 board/altera/socfpga/pll_config.h  |  2 +-
 board/altera/socfpga/socfpga.c |  2 ++
 drivers/spi/Kconfig| 16 
 include/configs/socfpga_common.h   |  8 +++-
 16 files changed, 197 insertions(+), 51 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/socfpga/lowlevel_init.S
 create mode 100644 arch/arm/include/asm/arch-socfpga/sdram.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] pepper: Add support for DDR3 variants

2015-04-28 Thread Tom Rini
On Tue, Apr 28, 2015 at 04:25:44PM -0700, Ash Charles wrote:

> Some variants of the Gumstix Pepper board use DDR3 memory instead of
> DDR2.  This adds a machine variant to support these DDR3-based boards
> which can be built as 'pepper_ddr3_defconfig' rather than the normal
> 'pepper_defconfig'.
> 
> Signed-off-by: Ash Charles 

There's no way to tell at run time which board we're on?

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: Correct Minnowboard instructions to use the right descriptor

2015-04-28 Thread Tom Rini
On Mon, Apr 27, 2015 at 02:52:49PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On 25 April 2015 at 11:54, Tom Rini  wrote:
> > On Sat, Apr 25, 2015 at 11:46:43AM -0600, Simon Glass wrote:
> >> The descriptor provided with the FSP does not seem to work. Update the
> >> instructions to use the descriptor from the original Intel firmware.
> >>
> >> Signed-off-by: Simon Glass 
> >> ---
> >>
> >>  doc/README.x86 | 23 ---
> >>  1 file changed, 20 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/doc/README.x86 b/doc/README.x86
> >> index 0355d1c..fe31f3d 100644
> >> --- a/doc/README.x86
> >> +++ b/doc/README.x86
> >> @@ -127,15 +127,32 @@ board/intel/minnowmax/fsp.bin
> >>  Obtain the VGA RAM (Vga.dat at the time of writing) and put it into the 
> >> same
> >>  directory: board/intel/minnowmax/vga.bin
> >>
> >> -You still need two more binary blobs. These come from the sample SPI image
> >> -provided in the FSP (SPI.bin at the time of writing).
> >> +You still need two more binary blobs. The first comes from the original
> >> +firmware image available from:
> >> +
> >> +http://firmware.intel.com/sites/default/files/2014-WW42.4-MinnowBoardMax.73-64-bit.bin_Release.zip
> >> +
> >> +Unzip it:
> >> +
> >> +   $ unzip 2014-WW42.4-MinnowBoardMax.73-64-bit.bin_Release.zip
> >>
> >>  Use ifdtool in the U-Boot tools directory to extract the images from that
> >>  file, for example:
> >>
> >> +   $ ./tools/ifdtool -x MNW2MAX1.X64.0073.R02.1409160934.bin
> >> +
> >> +This will provide the descriptor file - copy this into the correct place:
> >> +
> >> +   $ cp flashregion_0_flashdescriptor.bin 
> >> board/intel/minnowmax/descriptor.bin
> >> +
> >> +Then do the same with the sample SPI image provided in the FSP (SPI.bin at
> >> +the time of writing) to obtain the last image. Note that this will also
> >> +produce a flash descriptor file, but it does not seem to work, probably
> >> +because it is not designed for the Minnowmax. That is why you need to get
> >> +the flash descriptor from the original firmware as above.
> >> +
> >> $ ./tools/ifdtool -x BayleyBay/SPI.bin
> >> $ cp flashregion_2_intel_me.bin board/intel/minnowmax/me.bin
> >> -   $ cp flashregion_0_flashdescriptor.bin 
> >> board/intel/minnowmax/descriptor.bin
> >>
> >>  Now you can build U-Boot and obtain u-boot.rom
> >
> > + Then you ... to flash u-boot.rom
> >
> > ? :)  Thanks!
> 
> There are some notes at the end about using a SPI emulator - em100.

I guess it reads well enough, reading it all again.

> Should I add something for another SPI tool also? What type of SPI
> programmer do you have?

Ahem, I need to work on something there :)

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] u-boot breaks for the Overo boards since the following commit: a6b541b09022acb6f7c2754100ae26bd44eed1d9

2015-04-28 Thread Arun Bharadwaj
This is because the gd pointer is not set early enough anymore,
such that the i2c_set_bus_num in get_board_revision can safely
execute. This results in a console hang at SPL and the boot does
not proceed.

This piece of code is anyway necessary only for really old Overo
boards with revision numbers <= 2410 and not required for the newer
boards. For these older boards, u-boot v2014.10 still works fine.

Signed-off-by: Arun Bharadwaj 
---
 board/overo/common.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/board/overo/common.c b/board/overo/common.c
index bdfa5ca..f6f6792 100644
--- a/board/overo/common.c
+++ b/board/overo/common.c
@@ -310,20 +310,6 @@ int get_board_revision(void)
 {
int revision;
 
-#ifdef CONFIG_SYS_I2C_OMAP34XX
-   unsigned char data;
-
-   /* board revisions <= R2410 connect 4030 irq_1 to gpio112 */
-   /* these boards should return a revision number of 0  */
-   /* the code below forces a 4030 RTC irq to ensure that gpio112 is low */
-   i2c_set_bus_num(TWL4030_I2C_BUS);
-   data = 0x01;
-   i2c_write(0x4B, 0x29, 1, &data, 1);
-   data = 0x0c;
-   i2c_write(0x4B, 0x2b, 1, &data, 1);
-   i2c_read(0x4B, 0x2a, 1, &data, 1);
-#endif
-
if (!gpio_request(112, "") &&
!gpio_request(113, "") &&
!gpio_request(115, "")) {
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] This separates the SPL-specific code from the u-boot-specific code for the Overo board following the discussion at http://lists.denx.de/pipermail/u-boot/2015-April/211622.html

2015-04-28 Thread Arun Bharadwaj
The code is split up into spl.c, overo.c and common.c (which
has the code common to both)

Signed-off-by: Arun Bharadwaj 
---
 board/overo/Makefile |   6 +-
 board/overo/common.c | 355 +++
 board/overo/overo.c  | 117 +
 board/overo/overo.h  | 266 +-
 board/overo/spl.c|  60 +
 5 files changed, 425 insertions(+), 379 deletions(-)
 create mode 100644 board/overo/common.c
 create mode 100644 board/overo/spl.c

diff --git a/board/overo/Makefile b/board/overo/Makefile
index 9109484..2189071 100644
--- a/board/overo/Makefile
+++ b/board/overo/Makefile
@@ -5,4 +5,8 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y  := overo.o
+ifdef CONFIG_SPL_BUILD
+obj-y  := spl.o common.o
+else
+obj-y  := overo.o common.o
+endif
diff --git a/board/overo/common.c b/board/overo/common.c
new file mode 100644
index 000..bdfa5ca
--- /dev/null
+++ b/board/overo/common.c
@@ -0,0 +1,355 @@
+/*
+ * Maintainer : Steve Sakoman 
+ *
+ * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
+ *  Richard Woodruff 
+ *  Syed Mohammed Khasim 
+ *  Sunil Kumar 
+ *  Shashi Ranjan 
+ *
+ * (C) Copyright 2004-2008
+ * Texas Instruments, 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TWL4030_I2C_BUS 0
+
+/*
+ * Routine: board_init
+ * Description: Early hardware init.
+ */
+int board_init(void)
+{
+   gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
+   /* board id for Linux */
+   gd->bd->bi_arch_number = MACH_TYPE_OVERO;
+   /* boot param addr */
+   gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
+
+   return 0;
+}
+
+#define MUX_OVERO() \
+ /*SDRC*/\
+   MUX_VAL(CP(SDRC_D0),(IEN  | PTD | DIS | M0)) /*SDRC_D0*/\
+   MUX_VAL(CP(SDRC_D1),(IEN  | PTD | DIS | M0)) /*SDRC_D1*/\
+   MUX_VAL(CP(SDRC_D2),(IEN  | PTD | DIS | M0)) /*SDRC_D2*/\
+   MUX_VAL(CP(SDRC_D3),(IEN  | PTD | DIS | M0)) /*SDRC_D3*/\
+   MUX_VAL(CP(SDRC_D4),(IEN  | PTD | DIS | M0)) /*SDRC_D4*/\
+   MUX_VAL(CP(SDRC_D5),(IEN  | PTD | DIS | M0)) /*SDRC_D5*/\
+   MUX_VAL(CP(SDRC_D6),(IEN  | PTD | DIS | M0)) /*SDRC_D6*/\
+   MUX_VAL(CP(SDRC_D7),(IEN  | PTD | DIS | M0)) /*SDRC_D7*/\
+   MUX_VAL(CP(SDRC_D8),(IEN  | PTD | DIS | M0)) /*SDRC_D8*/\
+   MUX_VAL(CP(SDRC_D9),(IEN  | PTD | DIS | M0)) /*SDRC_D9*/\
+   MUX_VAL(CP(SDRC_D10),   (IEN  | PTD | DIS | M0)) /*SDRC_D10*/\
+   MUX_VAL(CP(SDRC_D11),   (IEN  | PTD | DIS | M0)) /*SDRC_D11*/\
+   MUX_VAL(CP(SDRC_D12),   (IEN  | PTD | DIS | M0)) /*SDRC_D12*/\
+   MUX_VAL(CP(SDRC_D13),   (IEN  | PTD | DIS | M0)) /*SDRC_D13*/\
+   MUX_VAL(CP(SDRC_D14),   (IEN  | PTD | DIS | M0)) /*SDRC_D14*/\
+   MUX_VAL(CP(SDRC_D15),   (IEN  | PTD | DIS | M0)) /*SDRC_D15*/\
+   MUX_VAL(CP(SDRC_D16),   (IEN  | PTD | DIS | M0)) /*SDRC_D16*/\
+   MUX_VAL(CP(SDRC_D17),   (IEN  | PTD | DIS | M0)) /*SDRC_D17*/\
+   MUX_VAL(CP(SDRC_D18),   (IEN  | PTD | DIS | M0)) /*SDRC_D18*/\
+   MUX_VAL(CP(SDRC_D19),   (IEN  | PTD | DIS | M0)) /*SDRC_D19*/\
+   MUX_VAL(CP(SDRC_D20),   (IEN  | PTD | DIS | M0)) /*SDRC_D20*/\
+   MUX_VAL(CP(SDRC_D21),   (IEN  | PTD | DIS | M0)) /*SDRC_D21*/\
+   MUX_VAL(CP(SDRC_D22),   (IEN  | PTD | DIS | M0)) /*SDRC_D22*/\
+   MUX_VAL(CP(SDRC_D23),   (IEN  | PTD | DIS | M0)) /*SDRC_D23*/\
+   MUX_VAL(CP(SDRC_D24),   (IEN  | PTD | DIS | M0)) /*SDRC_D24*/\
+   MUX_VAL(CP(SDRC_D25),   (IEN  | PTD | DIS | M0)) /*SDRC_D25*/\
+   MUX_VAL(CP(SDRC_D26),   (IEN  | PTD | DIS | M0)) /*SDRC_D26*/\
+   MUX_VAL(CP(SDRC_D27),   (IEN  | PTD | DIS | M0)) /*SDRC_D27*/\
+   MUX_VAL(CP(SDRC_D28),   (IEN  | PTD | DIS | M0)) /*SDRC_D28*/\
+   MUX_VAL(CP(SDRC_D29),   (IEN  | PTD | DIS | M0)) /*SDRC_D29*/\
+   MUX_VAL(CP(SDRC_D30),   (IEN  | PTD | DIS | M0)) /*SDRC_D30*/\
+   MUX_VAL(CP(SDRC_D31),   (IEN  | PTD | DIS | M0)) /*SDRC_D31*/\
+   MUX_VAL(CP(SDRC_CLK),   (IEN  | PTD | DIS | M0)) /*SDRC_CLK*/\
+   MUX_VAL(CP(SDRC_DQS0),  (IEN  | PTD | DIS | M0)) /*SDRC_DQS0*/\
+   MUX_VAL(CP(SDRC_DQS1),  (IEN  | PTD | DIS | M0)) /*SDRC_DQS1*/\
+   MUX_VAL(CP(SDRC_DQS2),  (IEN  | PTD | DIS | M0)) /*SDRC_DQS2*/\
+   MUX_VAL(CP(SDRC_DQS3),  (IEN  | PTD | DIS | M0)) /*SDRC_DQS3*/\
+ /*GPMC*/\
+   MUX_VAL(CP(GPMC_A1),(IDIS | PTU | EN  | M0)) /*GPMC_A1*/\
+   MUX_VAL(CP(GPMC_A2),(IDIS | PTU | EN  | M0)) /*GPMC_A2*/\
+   MUX_VAL(CP(GPMC_A3),(IDIS | PTU | EN  | M0)) /*GPMC_A3*/\

[U-Boot] [v2 PATCH 0/2] omap3-overo: Code cleanup and reduce the size of MLO binary.

2015-04-28 Thread Arun Bharadwaj
This is the v2 of the two-patch series. v1 can be found here:
http://lists.denx.de/pipermail/u-boot/2015-April/211651.html

The only change in this version is that the earlier version missed printing
the board revision, so fixed that.

Arun Bharadwaj (2):
  This separates the SPL-specific code from the u-boot-specific code
for the Overo board following the discussion at
http://lists.denx.de/pipermail/u-boot/2015-April/211622.html
  u-boot breaks for the Overo boards since the following commit:
a6b541b09022acb6f7c2754100ae26bd44eed1d9

 board/overo/Makefile |   6 +-
 board/overo/common.c | 341 +++
 board/overo/overo.c  | 117 +-
 board/overo/overo.h  | 266 +---
 board/overo/spl.c|  60 +
 5 files changed, 411 insertions(+), 379 deletions(-)
 create mode 100644 board/overo/common.c
 create mode 100644 board/overo/spl.c

-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fdt: Fix handling of paths with options in them

2015-04-28 Thread Simon Glass
On 24 April 2015 at 07:34, Hans de Goede  wrote:
> Hi,
>
>
> On 24-04-15 14:42, Simon Glass wrote:
>>
>> Hi Hans,
>>
>> On 23 April 2015 at 10:15, Simon Glass  wrote:
>>>
>>> Hi Hans,
>>>
>>> On 23 April 2015 at 00:55, Hans de Goede  wrote:

 Hi,


 On 22-04-15 19:20, Simon Glass wrote:
>
>
> Hi Hans,
>
> On 20 April 2015 at 12:10, Hans de Goede  wrote:
>>
>>
>> Hi,
>>
>> On 20-04-15 17:39, Simon Glass wrote:
>>>
>>>
>>>
>>> Hi Hans,
>>>
>>> On 20 April 2015 at 03:13, Hans de Goede  wrote:



 After syncing the sunxi dts files with the upstream kernel dm/fdt
 sunxi
 builds would no longer boot.

 The problem is that stdout-path is now set like this in the upstream
 dts
 files: stdout-path = "serial0:115200n8". The use of options in
 of-paths,
 either after an alias name, or after a full path, e.g. stdout-path =
 "/soc@01c0/serial@01c28000:115200", is standard of usage, but
 something
 which the u-boot dts code so far did not handle.

 This commit fixes this, adding support for both path formats.

 Signed-off-by: Hans de Goede 
 ---
 arch/arm/dts/sun7i-a20-pcduino3.dts |  2 +-
 lib/libfdt/fdt_ro.c | 25
 ++---
>>>
>>>
>>>
>>>
>>> I haven't looked. but is this change in dtc upstream or just in the
>>> kernel?
>>
>>
>>
>>
>> This is just a change in the dts files shipped with the kernel not in
>> dtc,
>> the dts files for sunxi used to not set stdout-path, and you patched
>> in
>> a stdout-path setting for u-boot:
>
>
>
> In that case, can we change this in the fdt support /fdtdec code,
> instead of making a change to libfdt that will never go upstream?
>
> If that doesn't work or is too painful, then we should take this patch.



 Actually I started with fixing this the fdtdev level, but then I noticed
 that the kernel does this at the of_find_node_by_path level, so if we
 fix this for stdout-path only (which a fdtdec patch would do) then we
 may
 get bit by this again later.

 Also fixing it at the fdtdec level means adding a strdup + error
 checking
 since then we need to pass a truncated (options removed) copy of the
 path
 to fdt_path_offset(), while with the current patch we can keep using
 read only access to the fdt.

 So I've a slight preference for going this way. Why would libfdt
 upstream
 not
 take this patch ?
>>>
>>>
>>> I'm not sure, but please go ahead and send it upstream. Thanks for the
>>> explanation, I'll pick this up.
>>>
>>> Acked-by: Simon Glass 
>>>
>>
>> Can I just check if you are OK to send this upstream? We don't need to
>> wait for it to be accepted, just want to know it will be sent.
>
>
> Yes I will submit this upstream.

Applied to u-boot-fdt, thanks!

- Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: link: Add PCH driver to support SPI Flash

2015-04-28 Thread Simon Glass
On 20 April 2015 at 07:07, Simon Glass  wrote:
> U-Boot on coreboot does not have a driver for the PCH so cannot see the
> SPI peripheral now that it has moved inside the PCH. Add a simple driver so
> that SPI flash works again.
>
> Signed-off-by: Simon Glass 
> ---
>
>  arch/x86/cpu/coreboot/pci.c  | 11 +++
>  arch/x86/dts/chromebook_link.dts |  2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)

Applied to u-boot-x86.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] pepper: Add support for DDR3 variants

2015-04-28 Thread Ash Charles
Some variants of the Gumstix Pepper board use DDR3 memory instead of
DDR2.  This adds a machine variant to support these DDR3-based boards
which can be built as 'pepper_ddr3_defconfig' rather than the normal
'pepper_defconfig'.

Signed-off-by: Ash Charles 
---
 board/gumstix/pepper/MAINTAINERS |  1 +
 board/gumstix/pepper/board.c | 95 ++--
 configs/pepper_ddr3_defconfig|  4 ++
 3 files changed, 77 insertions(+), 23 deletions(-)
 create mode 100644 configs/pepper_ddr3_defconfig

diff --git a/board/gumstix/pepper/MAINTAINERS b/board/gumstix/pepper/MAINTAINERS
index ae860ec..7132095 100644
--- a/board/gumstix/pepper/MAINTAINERS
+++ b/board/gumstix/pepper/MAINTAINERS
@@ -4,3 +4,4 @@ S:  Maintained
 F: board/gumstix/pepper/
 F: include/configs/pepper.h
 F: configs/pepper_defconfig
+F: configs/pepper_ddr3_defconfig
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index f644f81..fbbca3b 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -33,13 +33,55 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_SPL_BUILD
-static const struct ddr_data ddr2_data = {
+#define OSC(V_OSCK/100)
+
+#ifdef CONFIG_USE_DDR3
+static const struct ddr_data ddr_data = {
+   .datardsratio0 = MT41K256M16HA125E_RD_DQS,
+   .datawdsratio0 = MT41K256M16HA125E_WR_DQS,
+   .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
+   .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
+};
+
+static const struct cmd_control ddr_cmd_ctrl_data = {
+   .cmd0csratio = MT41K256M16HA125E_RATIO,
+   .cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+   .cmd1csratio = MT41K256M16HA125E_RATIO,
+   .cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+
+   .cmd2csratio = MT41K256M16HA125E_RATIO,
+   .cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
+};
+
+static struct emif_regs ddr_emif_reg_data = {
+   .sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
+   .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
+   .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
+   .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
+   .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
+   .zq_config = MT41K256M16HA125E_ZQ_CFG,
+   .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
+};
+
+const struct dpll_params dpll_ddr = {400, OSC-1, 1, -1, -1, -1, -1};
+
+const struct ctrl_ioregs ioregs_ddr = {
+   .cm0ioctl   = MT41K256M16HA125E_IOCTRL_VALUE,
+   .cm1ioctl   = MT41K256M16HA125E_IOCTRL_VALUE,
+   .cm2ioctl   = MT41K256M16HA125E_IOCTRL_VALUE,
+   .dt0ioctl   = MT41K256M16HA125E_IOCTRL_VALUE,
+   .dt1ioctl   = MT41K256M16HA125E_IOCTRL_VALUE,
+};
+
+#else
+static const struct ddr_data ddr_data = {
.datardsratio0 = MT47H128M16RT25E_RD_DQS,
.datafwsratio0 = MT47H128M16RT25E_PHY_FIFO_WE,
.datawrsratio0 = MT47H128M16RT25E_PHY_WR_DATA,
 };
 
-static const struct cmd_control ddr2_cmd_ctrl_data = {
+static const struct cmd_control ddr_cmd_ctrl_data = {
.cmd0csratio = MT47H128M16RT25E_RATIO,
 
.cmd1csratio = MT47H128M16RT25E_RATIO,
@@ -47,7 +89,7 @@ static const struct cmd_control ddr2_cmd_ctrl_data = {
.cmd2csratio = MT47H128M16RT25E_RATIO,
 };
 
-static const struct emif_regs ddr2_emif_reg_data = {
+static const struct emif_regs ddr_emif_reg_data = {
.sdram_config = MT47H128M16RT25E_EMIF_SDCFG,
.ref_ctrl = MT47H128M16RT25E_EMIF_SDREF,
.sdram_tim1 = MT47H128M16RT25E_EMIF_TIM1,
@@ -56,6 +98,33 @@ static const struct emif_regs ddr2_emif_reg_data = {
.emif_ddr_phy_ctlr_1 = MT47H128M16RT25E_EMIF_READ_LATENCY,
 };
 
+const struct dpll_params dpll_ddr = {266, OSC-1, 1, -1, -1, -1, -1};
+
+const struct ctrl_ioregs ioregs_ddr = {
+   .cm0ioctl   = MT47H128M16RT25E_IOCTRL_VALUE,
+   .cm1ioctl   = MT47H128M16RT25E_IOCTRL_VALUE,
+   .cm2ioctl   = MT47H128M16RT25E_IOCTRL_VALUE,
+   .dt0ioctl   = MT47H128M16RT25E_IOCTRL_VALUE,
+   .dt1ioctl   = MT47H128M16RT25E_IOCTRL_VALUE,
+};
+#endif /* CONFIG_USE_DDR3 */
+
+const struct dpll_params *get_dpll_ddr_params(void)
+{
+   return &dpll_ddr;
+}
+
+void sdram_init(void)
+{
+#ifdef CONFIG_USE_DDR3
+   config_ddr(400, &ioregs_ddr, &ddr_data,
+  &ddr_cmd_ctrl_data, &ddr_emif_reg_data, 0);
+#else
+   config_ddr(266, &ioregs_ddr, &ddr_data,
+  &ddr_cmd_ctrl_data, &ddr_emif_reg_data, 0);
+#endif
+}
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
@@ -64,14 +133,6 @@ int spl_start_uboot(void)
 }
 #endif
 
-#define OSC(V_OSCK/100)
-const struct dpll_params dpll_ddr = {266, OSC-1, 1, -1, -1, -1, -1};
-
-const struct dpll_params *get_dpll_ddr_params(void)
-{
-   return &dpll_ddr;
-}
-
 void set_uart_mux_conf(void)
 {
enable_uart0_pin_mux();
@@ -82,19 +143,7 @@ void set_mux_conf_regs(void)
enable_board_pi

Re: [U-Boot] [PATCH 2/2] x86: Update chromebook_link instructions for binary blob

2015-04-28 Thread Simon Glass
On 19 April 2015 at 22:05, Simon Glass  wrote:
> The MRC image is incorrect, or at least this one now does not seem to
> work. Fix it.
>
> Signed-off-by: Simon Glass 
> ---
>
>  doc/README.x86 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-x86.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] davinci: restore CONFIG_SPL=y to configs/omapl138_lcdk_defconfig

2015-04-28 Thread Tom Rini
On Wed, Apr 29, 2015 at 09:05:57AM +1000, Peter Howard wrote:

> Signed-off-by: Peter Howard 
> ---
>  configs/omapl138_lcdk_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index 8f19721..4445c38 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -1,3 +1,4 @@
> +CONFIG_SPL=y
>  CONFIG_ARM=y
>  CONFIG_ARCH_DAVINCI=y
>  CONFIG_TARGET_OMAPL138_LCDK=y

So when I grabbed the patch the config file was somehow missing.  Sorry
I missed this part!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/6] omap3: overo: Allow boot with kernel in UBI rootfs

2015-04-28 Thread Ash Charles
If regular NAND booting fails to find a valid uImage in the
kernel partition in NAND, try to boot using a zImage and dtb found
in a UBI volume in the rootfs partition.  This is the NAND analog
of mmc zImage booting for device-tree based kernels.

Signed-off-by: Ash Charles 
Signed-off-by: Arun Bharadwaj 
---
 include/configs/omap3_overo.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 61213df..e1db29a 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -140,6 +140,8 @@
"bootm ${loadaddr}\0" \
"loadzimage=load mmc ${mmcdev}:2 ${loadaddr} ${bootdir}/${bootfile}\0" \
"loadfdt=load mmc ${mmcdev}:2 ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+   "loadubizimage=ubifsload ${loadaddr} ${bootdir}/${bootfile}\0" \
+   "loadubifdt=ubifsload ${fdtaddr} ${bootdir}/${fdtfile}\0" \
"mmcbootfdt=echo Booting with DT from mmc ...; " \
"run mmcargs; " \
"bootz ${loadaddr} - ${fdtaddr}\0" \
@@ -148,6 +150,13 @@
"if nand read ${loadaddr} linux; then " \
"bootm ${loadaddr};" \
"fi;\0" \
+   "nanddtsboot=echo Booting from nand with DTS...; " \
+   "run nandargs; " \
+   "ubi part rootfs; "\
+   "ubifsmount ubi0:rootfs; "\
+   "run loadubifdt; "\
+   "run loadubizimage; "\
+   "bootz ${loadaddr} - ${fdtaddr}\0" \
 
 #define CONFIG_BOOTCOMMAND \
"mmc dev ${mmcdev}; if mmc rescan; then " \
@@ -175,6 +184,10 @@
"fi;" \
"fi;" \
"run nandboot; " \
+   "if test -z \"${fdtfile}\"; then "\
+   "setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
+   "fi;" \
+   "run nanddtsboot; " \
 
 /*
  * Miscellaneous configurable options
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/6] omap3: overo: Use software BCH8 ECC for NAND

2015-04-28 Thread Ash Charles
Overo COMs have NAND flash that requires 4-bit ECC or better except for
the first sector which can use 1-bit ECC.  The boot ROM expects to load
a payload from NAND written using 1-bit hardware-based ECC.  In short,
write SPL to NAND something like this (4 times for redundancy):
 #> nandecc hw
 #> nand write ${loadaddr} 0x0 ${filesize}
 #> nand write ${loadaddr} 0x2 ${filesize}
 #> nand write ${loadaddr} 0x4 ${filesize}
 #> nand write ${loadaddr} 0x6 ${filesize}

Then, switch back to software-based BCH8 for everything else:
 #> nandecc sw bch8

After [1], enlarge the max size of the SPL so the BCH code can fit.

[1] https://www.mail-archive.com/u-boot@lists.denx.de/msg163912.html

Signed-off-by: Ash Charles 
---
 include/configs/omap3_overo.h | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index c58636a..61213df 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -11,6 +11,12 @@
 #define CONFIG_NAND
 
 #include 
+#undef CONFIG_SPL_MAX_SIZE
+#define CONFIG_SPL_MAX_SIZE(64*1024)
+#undef CONFIG_SPL_TEXT_BASE
+#define CONFIG_SPL_TEXT_BASE   0x4020
+
+#define CONFIG_BCH
 
 /* Display CPU and Board information */
 #define CONFIG_DISPLAY_CPUINFO
@@ -212,17 +218,22 @@
 
 /* NAND boot config */
 #define CONFIG_SYS_NAND_BUSWIDTH_16BIT 16
+#define CONFIG_SYS_NAND_MAX_ECCPOS  56
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT 64
 #define CONFIG_SYS_NAND_PAGE_SIZE  2048
 #define CONFIG_SYS_NAND_OOBSIZE64
 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
 #define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
-#define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9,\
-   10, 11, 12, 13}
+#define CONFIG_SYS_NAND_ECCPOS  {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
+   13, 14, 16, 17, 18, 19, 20, 21, 22, \
+   23, 24, 25, 26, 27, 28, 30, 31, 32, \
+   33, 34, 35, 36, 37, 38, 39, 40, 41, \
+   42, 44, 45, 46, 47, 48, 49, 50, 51, \
+   52, 53, 54, 55, 56}
 #define CONFIG_SYS_NAND_ECCSIZE512
-#define CONFIG_SYS_NAND_ECCBYTES   3
-#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_HAM1_CODE_HW
+#define CONFIG_SYS_NAND_ECCBYTES   13
+#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
 #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS0x8
 /* NAND: SPL falcon mode configs */
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/6] overo: Add support for Palo35 expansion board

2015-04-28 Thread Ash Charles
Signed-off-by: Ash Charles 
---
 board/overo/overo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 3f14b03..d5ac1ad 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -193,6 +193,7 @@ int misc_init_r(void)
expansion_config.fab_revision);
MUX_GUMSTIX();
setenv("defaultdisplay", "lcd35");
+   setenv("expansionname", "palo35");
break;
case GUMSTIX_PALO43:
printf("Recognized Palo43 expansion board (rev %d %s)\n",
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 6/6] overo: Override RAM setup for rev. 0 boards

2015-04-28 Thread Ash Charles
From: Arun Bharadwaj 

Overo boards with board revision 0 use a 256MB RAM + 256MB NAND chip.
For an unknown reason, these boards fail to boot a 3.17.8 kernel based
on the RAM size configuration in u-boot.  As a workaround, fake out the
RAM setting in u-boot (discussion [1]).

[1] http://gumstix.8.x6.nabble.com/running-built-images-tt4969794.html

Signed-off-by: Arun Bharadwaj 
Signed-off-by: Ash Charles 
---
 board/overo/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/overo/spl.c b/board/overo/spl.c
index 64c33d6..e1652c3 100644
--- a/board/overo/spl.c
+++ b/board/overo/spl.c
@@ -59,7 +59,7 @@ void get_board_mem_timings(struct board_sdrc_timings *timings)
 timings->mr = MICRON_V_MR_165;
 switch (get_board_revision()) {
 case REVISION_0: /* Micron 1286MB/256MB, 1/2 banks of 128MB */
-timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+timings->mcfg = MICRON_V_MCFG_165(256 << 20);
 timings->ctrla = MICRON_V_ACTIMA_165;
 timings->ctrlb = MICRON_V_ACTIMB_165;
 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/6] omap3: overo: Set the Arbor43C 'expansionname'

2015-04-28 Thread Ash Charles
The Gumstix Arbor43C expansion board [1] uses a customized device tree
file.  When this expansion board is detected, load this file.

[1] https://store.gumstix.com/index.php/products/635/

Signed-off-by: Ash Charles 
---
 board/overo/overo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 6253825..2845e7c 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -257,6 +257,7 @@ int misc_init_r(void)
MUX_GUMSTIX();
MUX_ARBOR43C();
setenv("defaultdisplay", "lcd43");
+   setenv("expansionname", "arbor43c");
break;
case ETTUS_USRP_E:
printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/6] omap3: overo: collected fixes

2015-04-28 Thread Ash Charles
This series collects several board-enablement fixes for the Gumstix
Overo as well as switching to BCH8 for NAND ECC, updating the UBI
boot sequence for DTB-based boots, and correcting a RAM configuration
for Overo COMs of Revision 0.

This series follows after the series previously submitted:
http://lists.denx.de/pipermail/u-boot/2015-April/211651.html

Arun Bharadwaj (2):
  omap3: overo: Add DTS support for TobiDuo expansion
  overo: Override RAM setup for rev. 0 boards

Ash Charles (4):
  omap3: overo: Set the Arbor43C 'expansionname'
  overo: Add support for Palo35 expansion board
  omap3: overo: Use software BCH8 ECC for NAND
  omap3: overo: Allow boot with kernel in UBI rootfs

 board/overo/overo.c   |  3 +++
 board/overo/spl.c |  2 +-
 include/configs/omap3_overo.h | 32 
 3 files changed, 32 insertions(+), 5 deletions(-)

-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/6] omap3: overo: Add DTS support for TobiDuo expansion

2015-04-28 Thread Ash Charles
From: Arun Bharadwaj 

Signed-off-by: Arun Bharadwaj 
Signed-off-by: Ash Charles 
---
 board/overo/overo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 2845e7c..3f14b03 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -185,6 +185,7 @@ int misc_init_r(void)
expansion_config.revision,
expansion_config.fab_revision);
MUX_GUMSTIX();
+   setenv("expansionname", "tobiduo");
break;
case GUMSTIX_PALO35:
printf("Recognized Palo35 expansion board (rev %d %s)\n",
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] davinci: restore CONFIG_SPL=y to configs/omapl138_lcdk_defconfig

2015-04-28 Thread Peter Howard
Signed-off-by: Peter Howard 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 8f19721..4445c38 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -1,3 +1,4 @@
+CONFIG_SPL=y
 CONFIG_ARM=y
 CONFIG_ARCH_DAVINCI=y
 CONFIG_TARGET_OMAPL138_LCDK=y
-- 
1.9.3


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread Wolfgang Denk
Dear Joe,

In message  
you wrote:
> 
> > I noticed you asked for a reference to the original hush code that is the
> > origin for U-Boot's adaptation. I couldn't find a reply to that question. I
> > also haven't been able to find anything with a quick we search. Do you know
> > where it did come from?
> 
> I never got a response, but it appears to be busybox...

Oops, sorry.  Yes, of course it is busybox.

As far as I can tell, it was added around October 2001 to the PPCBoot
project as part of the PPCBoot v1.1.0 release:

* Added "hush" shell (from Busybox) as alternative command line 
  interpreter, thus enabling powerful command line syntax like 
  if...then...else...fi conditionals or `&&' and '||' constructs
  ("shell scripts").

  See the README file for information about implementation and usage.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Winners never talk about glorious victories. That's  because  they're
the  ones  who  see  what the battlefield looks like afterwards. It's
only the losers who have glorious victories.
  - Terry Pratchett, _Small Gods_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-dm

2015-04-28 Thread Simon Glass
Hi Tom,

A few bug fixes.


The following changes since commit cc555bd4f40a652471df4a3621d45ee57df0ca11:

  Merge branch 'master' of git://git.denx.de/u-boot-spi (2015-04-28
07:28:43 -0400)

are available in the git repository at:

  http://git.denx.de/u-boot-dm.git

for you to fetch changes up to f66529f998e59acbd64ccce3adfce8eedfa52da8:

  dm: core: Correct bug introduced in uclass_first/next_device()
(2015-04-28 16:49:03 -0600)


Axel Lin (1):
  serial: ns16550: Remove hard-coded baud_divisor setting

Masahiro Yamada (1):
  dm: core: drop device removal error path correctly

Simon Glass (1):
  dm: core: Correct bug introduced in uclass_first/next_device()

 drivers/core/device.c| 6 +++---
 drivers/core/uclass.c| 5 +
 drivers/serial/ns16550.c | 1 -
 3 files changed, 8 insertions(+), 4 deletions(-)

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] fastboot boot base address behaviour

2015-04-28 Thread Rob Herring
On Wed, Apr 22, 2015 at 8:04 AM, Maxime Ripard
 wrote:
> Hi,
>
> I've been trying to use fastboot (and especially the boot command) on
> sunxi recently, and got it to work pretty fine (apart from PSCI, but
> that's another story).
>
> The only thing that worries me a bit is that by default, both the
> fastboot tool and mkbootimg will generate an image with the kernel
> address set to 0x10008000.
>
> While it might work on some targets, it obviously doesn't on the
> Allwinner SoCs that most of the time have the RAM mapped to 0x400,
> which result in the kernel being relocated to some address that is not
> in RAM, failing badly.
>
> I would expect U-Boot to relocate the kernel to some reasonable
> address, and not try to do something dumb by actually trusting
> completely the boot image.
>
> I guess one way to solve this would be to really treat 0x10008000 as
> the default, and relocate the kernel to whatever value make sense on
> the current platform (even though that needs to be defined).
>
> That way, "fastboot boot zImage" would actually work out of the box,
> without requiring to set the optional "-b" option to set the kernel
> base address to some decent value.
>
> The others implementation I could find seem to just ignore this field
> in the image header, and always load it to the same address, which
> might not really be what we're after here.
>
> What do you think?

Android boot image is pretty broken in a variety of ways and with
vendors doing their own extensions/hacks. The issues I see are:

- Addresses are 32-bit
- A boot image will only work on 1 platform (because of the kernel and
ramdisk addresses)
- Different kernel Image formats within boot.img: uImage, zImage, Image.gz, etc.
- No standard way to deal with dtb. arm32 is somewhat "standard" with
appended dtb. AOSP adds appended dtb for arm64, but it is never going
upstream.

For the kernel address, we should probably just ignore it. For zImage,
it doesn't really need to be moved from where ever the boot.img is
loaded to (assuming it is within the zImage address requirements). It
is going to relocate itself anyway. Putting in a correct kernel
address will just cause a double copy. For arm64 Image, the image
header defines the offset and u-boot must load it to that offset or
you won't boot. There's only 1 correct address and 2^32 - 1 wrong
addresses the boot.img could have.

Rob
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] driver/ddr/fsl: Remove deskew_cntrl register

2015-04-28 Thread York Sun
This register is reserved and shouldn't have been exposed.
Accessing it may have unexpected result on different SoCs.

Signed-off-by: York Sun 
---
 include/fsl_immap.h |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/fsl_immap.h b/include/fsl_immap.h
index d63cc19..e4addad 100644
--- a/include/fsl_immap.h
+++ b/include/fsl_immap.h
@@ -87,9 +87,7 @@ struct ccsr_ddr {
u32 timing_cfg_9;   /* SDRAM Timing Configuration 9 */
u8  res_258[0x260-0x258];
u32 sdram_cfg_3;
-   u8  res_264[0x2a0-0x264];
-   u32 deskew_cntl;
-   u8  res_2a4[0x400-0x2a4];
+   u8  res_264[0x400-0x264];
u32 dq_map_0;
u32 dq_map_1;
u32 dq_map_2;
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread Joe Hershberger
Hi James,

On Tue, Apr 28, 2015 at 2:13 PM, James Chargin  wrote:
> Dear Joe,
>
> On 04/28/2015 11:35 AM, Joe Hershberger wrote:
>>
>> Hi James,
>>
>> On Tue, Apr 28, 2015 at 1:19 PM, James Chargin 
>> wrote:
>>>
>>> Dear Joe Hershberger,
>>>
>>> On 04/28/2015 11:00 AM, Joe Hershberger wrote:


 Hi Joakim,

 On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
  wrote:
>
>
> Trying to get a better handle of HUSH shell expressions, this does not
> work as I expect:
> => false && true || echo ECHO
> => false && false || echo ECHO
>
>
> ...
>
>>
>> I always just assumed this was a limitation of hush, but it's now
>> looking like a bug instead.
>>
>> I haven't debugged into it, but I tend to stay away from hush these
>> days. When I've submitted a bug fix to this area I've been told that
>> we should upgrade wholesale instead, and I've haven't been up for that
>> task so far.
>> http://lists.denx.de/pipermail/u-boot/2012-November/139841.html
>
>
> That's a great conversation with Wolfgang, thanks for the reference.
>
> Like you, I have tended to use hush carefully. It is similar to sh/bash, but
> different enough that I never count on an easy port of bash script
> fragments.
>
> I noticed you asked for a reference to the original hush code that is the
> origin for U-Boot's adaptation. I couldn't find a reply to that question. I
> also haven't been able to find anything with a quick we search. Do you know
> where it did come from?

I never got a response, but it appears to be busybox...

http://git.busybox.net/busybox/tree/shell/hush.c

>>
>> Perhaps there is an easy, minor bugfix for this that would be
>> palette-able.
>
>
> I've been "afraid" of the hush code for a while. I don't think I want to
> mess with it now. I'll just continue to work with what we've got, carefully.
>
> Thanks again for your attention,

No problem...

Cheers,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread James Chargin

Dear Joe,

On 04/28/2015 11:35 AM, Joe Hershberger wrote:

Hi James,

On Tue, Apr 28, 2015 at 1:19 PM, James Chargin  wrote:

Dear Joe Hershberger,

On 04/28/2015 11:00 AM, Joe Hershberger wrote:


Hi Joakim,

On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
 wrote:


Trying to get a better handle of HUSH shell expressions, this does not
work as I expect:
=> false && true || echo ECHO
=> false && false || echo ECHO


...



I always just assumed this was a limitation of hush, but it's now
looking like a bug instead.

I haven't debugged into it, but I tend to stay away from hush these
days. When I've submitted a bug fix to this area I've been told that
we should upgrade wholesale instead, and I've haven't been up for that
task so far.  http://lists.denx.de/pipermail/u-boot/2012-November/139841.html


That's a great conversation with Wolfgang, thanks for the reference.

Like you, I have tended to use hush carefully. It is similar to sh/bash, 
but different enough that I never count on an easy port of bash script 
fragments.


I noticed you asked for a reference to the original hush code that is 
the origin for U-Boot's adaptation. I couldn't find a reply to that 
question. I also haven't been able to find anything with a quick we 
search. Do you know where it did come from?




Perhaps there is an easy, minor bugfix for this that would be palette-able.


I've been "afraid" of the hush code for a while. I don't think I want to 
mess with it now. I'll just continue to work with what we've got, carefully.


Thanks again for your attention,

Jim

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Fabio Estevam
On Tue, Apr 28, 2015 at 1:52 PM, Tom Rini  wrote:

>> Is CONFIG_SYS_USB_EVENT_POLL defined in the config?  I found that without
>> that usb input was not reliable.  Even with it enabled some wireless
>> keyboards behaved poorly.
>
> Just checked and yes it's set.  I think I also had these not working
> with the Solid Run tree either so I'll just call 'em both weird.

Does it improve if you remove CONFIG_SYS_USB_EVENT_POLL and use

#define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP , instead?

While at it, please also try to add:

#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread Joe Hershberger
Hi James,

On Tue, Apr 28, 2015 at 1:19 PM, James Chargin  wrote:
> Dear Joe Hershberger,
>
> On 04/28/2015 11:00 AM, Joe Hershberger wrote:
>>
>> Hi Joakim,
>>
>> On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
>>  wrote:
>>>
>>> Trying to get a better handle of HUSH shell expressions, this does not
>>> work as I expect:
>>> => false && true || echo ECHO
>>> => false && false || echo ECHO
>>>
>>> none prints ECHO, seems like a bug?
>>
>>
>> I think it works as it should. false followed by && will terminate always.
>>
>>> This the only one that prints ECHO

 = true && false || echo ECHO
>>
>>
>> This also seems correct. Passing true into && and false into || will
>> always continue.
>>
>
> I thought hush is supposed to be mostly similar to sh. On my Linux desktop,
> bash (which is supposed to be backward compatible with sh) says
>
> $ which sh
> /usr/bin/sh
> $ ls -l /usr/bin/sh
> lrwxrwxrwx 1 root root 4 Apr 17 14:43 /usr/bin/sh -> bash
> $ sh --version
> GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> 
>
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> $ sh
> sh-4.2$ false && true || echo ECHO
> ECHO
> sh-4.2$ false && false || echo ECHO
> ECHO
> sh-4.2$ true && false || echo ECHO
> ECHO
> sh-4.2$ exit
> exit
>
> Is this one of the places where hush and sh are not the same?

The way hush seems to work is it drops out of the entire command if a
case is false.

Looking at the code in the hush parser, it seems at face value like it
should be skipping the command and then picking up the next command
(echo), but it clearly doesn't.


if ( (rcode==EXIT_SUCCESS && pi->followup==PIPE_OR) ||
 (rcode!=EXIT_SUCCESS && pi->followup==PIPE_AND) )
skip_more_in_this_rmode=rmode;


I always just assumed this was a limitation of hush, but it's now
looking like a bug instead.

I haven't debugged into it, but I tend to stay away from hush these
days. When I've submitted a bug fix to this area I've been told that
we should upgrade wholesale instead, and I've haven't been up for that
task so far.  http://lists.denx.de/pipermail/u-boot/2012-November/139841.html

Perhaps there is an easy, minor bugfix for this that would be palette-able.

-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread James Chargin

Dear Joe Hershberger,
On 04/28/2015 11:00 AM, Joe Hershberger wrote:

Hi Joakim,

On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
 wrote:

Trying to get a better handle of HUSH shell expressions, this does not work as 
I expect:
=> false && true || echo ECHO
=> false && false || echo ECHO

none prints ECHO, seems like a bug?


I think it works as it should. false followed by && will terminate always.


This the only one that prints ECHO

= true && false || echo ECHO


This also seems correct. Passing true into && and false into || will
always continue.



I thought hush is supposed to be mostly similar to sh. On my Linux 
desktop, bash (which is supposed to be backward compatible with sh) says


$ which sh
/usr/bin/sh
$ ls -l /usr/bin/sh
lrwxrwxrwx 1 root root 4 Apr 17 14:43 /usr/bin/sh -> bash
$ sh --version
GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 



This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ sh
sh-4.2$ false && true || echo ECHO
ECHO
sh-4.2$ false && false || echo ECHO
ECHO
sh-4.2$ true && false || echo ECHO
ECHO
sh-4.2$ exit
exit

Is this one of the places where hush and sh are not the same?

Regards,
Jim
--
Jim Chargin
AJA Video Systems   j...@aja.com
(530) 271-3334  http://www.aja.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] HUSH logical AND/OR expressions

2015-04-28 Thread Joe Hershberger
Hi Joakim,

On Mon, Apr 27, 2015 at 8:39 AM, Joakim Tjernlund
 wrote:
> Trying to get a better handle of HUSH shell expressions, this does not work 
> as I expect:
> => false && true || echo ECHO
> => false && false || echo ECHO
>
> none prints ECHO, seems like a bug?

I think it works as it should. false followed by && will terminate always.

> This the only one that prints ECHO
>>= true && false || echo ECHO

This also seems correct. Passing true into && and false into || will
always continue.

Cheers,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] powerpc/mpc85xx: Fix compiling error for common/cmd_gpio.c

2015-04-28 Thread Oleksandr G Zhadan
To replicate:
1. add to include/configs/p1_p2_rdb_pc.h "#define CONFIG_CMD_GPIO"
2. run `make P1020RDB-PC_defconfig`
3. run CROSS_COMPILE=powerpc-linux- make

and you will get:
common/built-in.o: In function `do_gpio':
u-boot/common/cmd_gpio.c:186: undefined reference to `gpio_request'
u-boot/common/cmd_gpio.c:194: undefined reference to `gpio_direction_input'
u-boot/common/cmd_gpio.c:195: undefined reference to `gpio_get_value'
u-boot/common/cmd_gpio.c:200: undefined reference to `gpio_get_value'
u-boot/common/cmd_gpio.c:203: undefined reference to `gpio_direction_output'
u-boot/common/cmd_gpio.c:209: undefined reference to `gpio_free

Signed-off-by: Michael Durrant 
Signed-off-by: Oleksandr G Zhadan 
---

 arch/powerpc/include/asm/arch-mpc85xx/gpio.h | 2 ++
 arch/powerpc/include/asm/mpc85xx_gpio.h  | 6 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h 
b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
index 8beed30..71794a8 100644
--- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
+++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h
@@ -12,4 +12,6 @@
 #ifndef __ASM_ARCH_MX85XX_GPIO_H
 #define __ASM_ARCH_MX85XX_GPIO_H
 
+#include 
+
 #endif
diff --git a/arch/powerpc/include/asm/mpc85xx_gpio.h 
b/arch/powerpc/include/asm/mpc85xx_gpio.h
index 87bb4a0..1d0dad4 100644
--- a/arch/powerpc/include/asm/mpc85xx_gpio.h
+++ b/arch/powerpc/include/asm/mpc85xx_gpio.h
@@ -72,9 +72,10 @@ static inline int gpio_request(unsigned gpio, const char 
*label)
return 0;
 }
 
-static inline void gpio_free(unsigned gpio)
+static inline int gpio_free(unsigned gpio)
 {
/* Compatibility shim */
+   return 0;
 }
 
 static inline int gpio_direction_input(unsigned gpio)
@@ -97,12 +98,13 @@ static inline int gpio_get_value(unsigned gpio)
return !!mpc85xx_gpio_get(1U << gpio);
 }
 
-static inline void gpio_set_value(unsigned gpio, int value)
+static inline int gpio_set_value(unsigned gpio, int value)
 {
if (value)
mpc85xx_gpio_set_high(1U << gpio);
else
mpc85xx_gpio_set_low(1U << gpio);
+   return 0;
 }
 
 static inline int gpio_is_valid(int gpio)
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4]: imx: mx6: use OTP for temperature grade and freq grade

2015-04-28 Thread Tim Harvey
On Tue, Apr 28, 2015 at 10:11 AM, Stefan Roese  wrote:
> Hi Tim,
>
> On 28.04.2015 17:44, Tim Harvey wrote:
>>
>> The MX6 has OTP bits specifying the processor speed grade as well as
>> temperature grade.
>>
>> This series adds functions to return this information as well as adds the
>> details to the CPU info displayed.
>>
>> Additionally we use the temperature grade to replace the hard-coded limits
>> in imx_thermal.c
>>
>> I expect some possible discussion/debate regarding the displaying of this
>> info,
>> but perhaps adding the functions to obtain the info and use it for
>> imx_thermal
>> is beyond debate. Please let me know.
>
>
> Could you please send (or include in the commit text) an example, how these
> infos are displayed now in the bootup log? Best in comparison to the "old"
> log. To see the output change resulting from the patchset.
>
> Thanks,
> Stefan
>

Stefan,

Good point - as I am guessing there will be debate about the 'amount'
of info displayed and am open to suggestions on how to word it and/or
how to enable it. In future revs of the patchset I'll be more explicit
in the commit logs, but for now with the series applied I get this:

IMX6Q automotive (1GHz capable) powering up at 800MHz:
- before:
CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
- after Patch 1/4:
CPU:   Freescale i.MX6Q rev1.2 996 MHz (at 792 MHz)
- after Patch 3/4 (if CONFIG_IMX6_THERMAL defined)
CPU:   Freescale i.MX6Q rev1.2 automotive (-40C to 125C) 996 MHz (at 792 MHz)

IMX6S industrial (800MHz capable) powering up at 800MHz:
- before:
CPU:   Freescale i.MX6SOLO rev1.2 at 792 MHz
- after Patch 1/4: (max speed == cur speed)
CPU:   Freescale i.MX6SOLO rev1.2 792 MHz
- after Patch 3/4 (if CONFIG_IMX6_THERMAL defined)
CPU:   Freescale i.MX6SOLO rev1.2 industrial (-40C to 105C) 792 MHz

When I submit the next version I will split out adding the functions
to get speed-grade and temperature-grade from using those functions in
cpu_printinfo() as well as some may not be happy with adding more info
to cpu_printinfo() but may find value in setting the thermal limits of
imx_thermal properly based on temp-grade (Patch 4/4).

Tim
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4]: imx: mx6: use OTP for temperature grade and freq grade

2015-04-28 Thread Stefan Roese

Hi Tim,

On 28.04.2015 17:44, Tim Harvey wrote:

The MX6 has OTP bits specifying the processor speed grade as well as
temperature grade.

This series adds functions to return this information as well as adds the
details to the CPU info displayed.

Additionally we use the temperature grade to replace the hard-coded limits
in imx_thermal.c

I expect some possible discussion/debate regarding the displaying of this info,
but perhaps adding the functions to obtain the info and use it for imx_thermal
is beyond debate. Please let me know.


Could you please send (or include in the commit text) an example, how 
these infos are displayed now in the bootup log? Best in comparison to 
the "old" log. To see the output change resulting from the patchset.


Thanks,
Stefan

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Otavio Salvador
On Tue, Apr 28, 2015 at 1:52 PM, Tom Rini  wrote:
> On Tue, Apr 28, 2015 at 06:45:43PM +0200, Jon Nettleton wrote:
>> On Tue, Apr 28, 2015 at 6:39 PM, Tom Rini  wrote:
>>
>> > On Tue, Apr 28, 2015 at 12:20:46PM -0300, Fabio Estevam wrote:
>> > > On Tue, Apr 28, 2015 at 12:11 PM, Fabio Estevam 
>> > wrote:
>> > > > Hi Tom,
>> > > >
>> > > > On Tue, Apr 28, 2015 at 11:48 AM, Tom Rini  wrote:
>> > > >
>> > > >> Since we have FEC do we really need to add ASIX as well?  Also, what
>> > > >
>> > > > I can remove it if needed. Just kept the same as done in the
>> > Solidrun's U-boot.
>> > > >
>> > > >> devices did you test this with for USB?  I grabbed a Sandisk USB drive
>> > > >> and on the i2eX I have, the bottom USB port doesn't see it and on the
>> > > >> top I get:
>> > > >> scanning bus 1 for devices... failed to set default configuration len
>> > 0,
>> > > >> status 8000
>> > > >
>> > > > I tested with USB pen drive and USB keyboard and it could recognize
>> > them.
>> > > >
>> > > > Only the bottom top works for me and the same is seen on Solidrun's
>> > U-boot.
>> > >
>> > > Ops, I mean "Only the bottom USB port works for me".
>> >
>> > How many USB pen drives do you have handy?  I confirmed that my
>> > keyboards don't work on my Allwinner board (A20 OLinuXino Lime2) but the
>> > pen drive does (scanned, loaded and crc32'd a file).  I'll try and do
>> > the same test on my Sabrelite shortly.
>>
>> Is CONFIG_SYS_USB_EVENT_POLL defined in the config?  I found that without
>> that usb input was not reliable.  Even with it enabled some wireless
>> keyboards behaved poorly.
>
> Just checked and yes it's set.  I think I also had these not working
> with the Solid Run tree either so I'll just call 'em both weird.

In this case I think there is no reason to not merge this as is and
fix/improve it later.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Tom Rini
On Tue, Apr 28, 2015 at 06:45:43PM +0200, Jon Nettleton wrote:
> On Tue, Apr 28, 2015 at 6:39 PM, Tom Rini  wrote:
> 
> > On Tue, Apr 28, 2015 at 12:20:46PM -0300, Fabio Estevam wrote:
> > > On Tue, Apr 28, 2015 at 12:11 PM, Fabio Estevam 
> > wrote:
> > > > Hi Tom,
> > > >
> > > > On Tue, Apr 28, 2015 at 11:48 AM, Tom Rini  wrote:
> > > >
> > > >> Since we have FEC do we really need to add ASIX as well?  Also, what
> > > >
> > > > I can remove it if needed. Just kept the same as done in the
> > Solidrun's U-boot.
> > > >
> > > >> devices did you test this with for USB?  I grabbed a Sandisk USB drive
> > > >> and on the i2eX I have, the bottom USB port doesn't see it and on the
> > > >> top I get:
> > > >> scanning bus 1 for devices... failed to set default configuration len
> > 0,
> > > >> status 8000
> > > >
> > > > I tested with USB pen drive and USB keyboard and it could recognize
> > them.
> > > >
> > > > Only the bottom top works for me and the same is seen on Solidrun's
> > U-boot.
> > >
> > > Ops, I mean "Only the bottom USB port works for me".
> >
> > How many USB pen drives do you have handy?  I confirmed that my
> > keyboards don't work on my Allwinner board (A20 OLinuXino Lime2) but the
> > pen drive does (scanned, loaded and crc32'd a file).  I'll try and do
> > the same test on my Sabrelite shortly.
> 
> Is CONFIG_SYS_USB_EVENT_POLL defined in the config?  I found that without
> that usb input was not reliable.  Even with it enabled some wireless
> keyboards behaved poorly.

Just checked and yes it's set.  I think I also had these not working
with the Solid Run tree either so I'll just call 'em both weird.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Otavio Salvador
On Tue, Apr 28, 2015 at 1:45 PM, Jon Nettleton  wrote:
...
> Is CONFIG_SYS_USB_EVENT_POLL defined in the config?  I found that without
> that usb input was not reliable.  Even with it enabled some wireless
> keyboards behaved poorly.

For the keyboard it may indeed help but what about the USB pendrive?


-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Jon Nettleton
On Tue, Apr 28, 2015 at 6:39 PM, Tom Rini  wrote:

> On Tue, Apr 28, 2015 at 12:20:46PM -0300, Fabio Estevam wrote:
> > On Tue, Apr 28, 2015 at 12:11 PM, Fabio Estevam 
> wrote:
> > > Hi Tom,
> > >
> > > On Tue, Apr 28, 2015 at 11:48 AM, Tom Rini  wrote:
> > >
> > >> Since we have FEC do we really need to add ASIX as well?  Also, what
> > >
> > > I can remove it if needed. Just kept the same as done in the
> Solidrun's U-boot.
> > >
> > >> devices did you test this with for USB?  I grabbed a Sandisk USB drive
> > >> and on the i2eX I have, the bottom USB port doesn't see it and on the
> > >> top I get:
> > >> scanning bus 1 for devices... failed to set default configuration len
> 0,
> > >> status 8000
> > >
> > > I tested with USB pen drive and USB keyboard and it could recognize
> them.
> > >
> > > Only the bottom top works for me and the same is seen on Solidrun's
> U-boot.
> >
> > Ops, I mean "Only the bottom USB port works for me".
>
> How many USB pen drives do you have handy?  I confirmed that my
> keyboards don't work on my Allwinner board (A20 OLinuXino Lime2) but the
> pen drive does (scanned, loaded and crc32'd a file).  I'll try and do
> the same test on my Sabrelite shortly.
>

Is CONFIG_SYS_USB_EVENT_POLL defined in the config?  I found that without
that usb input was not reliable.  Even with it enabled some wireless
keyboards behaved poorly.

-Jon


>
> --
> Tom
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] mx6cuboxi: Add USB host support

2015-04-28 Thread Tom Rini
On Tue, Apr 28, 2015 at 12:39:41PM -0400, Tom Rini wrote:
> On Tue, Apr 28, 2015 at 12:20:46PM -0300, Fabio Estevam wrote:
> > On Tue, Apr 28, 2015 at 12:11 PM, Fabio Estevam  wrote:
> > > Hi Tom,
> > >
> > > On Tue, Apr 28, 2015 at 11:48 AM, Tom Rini  wrote:
> > >
> > >> Since we have FEC do we really need to add ASIX as well?  Also, what
> > >
> > > I can remove it if needed. Just kept the same as done in the Solidrun's 
> > > U-boot.
> > >
> > >> devices did you test this with for USB?  I grabbed a Sandisk USB drive
> > >> and on the i2eX I have, the bottom USB port doesn't see it and on the
> > >> top I get:
> > >> scanning bus 1 for devices... failed to set default configuration len 0,
> > >> status 8000
> > >
> > > I tested with USB pen drive and USB keyboard and it could recognize them.
> > >
> > > Only the bottom top works for me and the same is seen on Solidrun's 
> > > U-boot.
> > 
> > Ops, I mean "Only the bottom USB port works for me".
> 
> How many USB pen drives do you have handy?  I confirmed that my
> keyboards don't work on my Allwinner board (A20 OLinuXino Lime2) but the
> pen drive does (scanned, loaded and crc32'd a file).  I'll try and do
> the same test on my Sabrelite shortly.

Same drive is good in my Sabrelite btw.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2] arm: mx6: Clamp MMDC and DDR3 clocks for timing calculations

2015-04-28 Thread Stefano Babic
On 22/04/2015 17:37, Nikolay Dimitrov wrote:
> This is proposal for clamping the MMDC/DDR3 clocks to the maximum supported
> frequencies as per imx6 SOC models, and for dynamically calculating valid
> clock value based on mem_speed.
> 
> Currently the code uses impossible values for mem_speed (1333, 1600 MT/s) for
> calculating the DDR timings, and uses fixed clock (528 or 400 MHz) which
> doesn't take into account DDR3 memory limitations.
> 
> Signed-off-by: Nikolay Dimitrov 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> Cc: Tim Harvey 
> Cc: Eric Nelson 
> ---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >