env: factor out the env_get_char_spec() function

env_get_char_spec() function is duplicated across multiple environment
files.
Remove the duplication by providing a default implementation.
Add "weak" declaration, so the default implementation can be overridden.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
diff --git a/common/env_nvram.c b/common/env_nvram.c
index 726eaac..6483db3 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -59,18 +59,16 @@
 
 char *env_name_spec = "NVRAM";
 
+#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 uchar env_get_char_spec(int index)
 {
-#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
 	uchar c;
 
 	nvram_read(&c, CONFIG_ENV_ADDR + index, 1);
 
 	return c;
-#else
-	return *((uchar *)(gd->env_addr + index));
-#endif
 }
+#endif
 
 void env_relocate_spec(void)
 {