powerpc: updates for the keymile boards

- CONFIG_SYS_MAX_I2C_BUS changed to 1
  We use only one I2C hardwarecontroller on this boards, so
  change the CONFIG_SYS_MAX_I2C_BUS to 1.
- common: dont print errormsg if second IVM Block lacks.
- 82xx, mgcoge: fix double mtdpart entry in environment
- 82xx, mgcoge: activate on second Flash the second bank.
- common: CONFIG_ENV_SIZE 0x4000 for all keymile boards
- common: Change malloc size to 1MByte for all Keymile boards
    We need a bigger malloc area for the environment support (128k)
    on some Keymile boards (kmeter1) and the upcoming UBI support.
    Change it to 1MB for all Keymile boards to be on the save side.
    Also define CONFIG_SYS_64BIT_VSPRINTF which is needed for
    UBI/UBIFS support.
- Add UBI support to all Keymile boards
- change manner of writing "/localbus/ranges" node
    instead of writting the complete "/localbus/ranges" node
    before booting Linux, only update the ranges entries
    which gets dynamical detected (size of flashes).
    This is needed, because keymile adds in the DTS
    "/localbus/ranges" node entries, which u-boot must
    not overwrite/delete.
- kmeter, mgcoge: define 2 seperate regions needed for the Intel P30 chips
    The Intel P30 chip has 2 non-identical chips on
    one die, so we need to define 2 seperate regions
    that are scanned by physmap_of independantly.
- kmeter1: Add MTD concat support to Keymile boards
- 82xx, mgcoge: add "unlock=yes" to default environment
- added CONFIG_MTD_DEVICE to get in sync with mainline code

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index b2bd7fd..2594623 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -203,8 +203,9 @@
 	crceeprom = (buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 1] + \
 			buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN - 2] * 256);
 	if (crc != crceeprom) {
-		printf ("Error CRC Block: %d EEprom: calculated: %lx EEprom: %lx\n",
-			block, crc, crceeprom);
+		if (block == 0)
+			printf ("Error CRC Block: %d EEprom: calculated: \
+			%lx EEprom: %lx\n", block, crc, crceeprom);
 		return -1;
 	}
 	return 0;
@@ -287,7 +288,7 @@
 	GET_STRING("IVM_CustomerProductID", IVM_POS_CUSTOMER_PROD_ID, 32)
 
 	if (ivm_check_crc (&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], 2) != 0)
-		return -2;
+		return 0;
 	ivm_analyze_block2 (&buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2], CONFIG_SYS_IVM_EEPROM_PAGE_LEN);
 
 	return 0;
@@ -527,6 +528,34 @@
 	}
 	return ret;
 }
+int fdt_get_node_and_value (void *blob,
+				char *nodename,
+				char *propname,
+				void **var)
+{
+	int len;
+	int nodeoffset = 0;
+
+	nodeoffset = fdt_path_offset (blob, nodename);
+	if (nodeoffset >= 0) {
+		*var = (void *)fdt_getprop (blob, nodeoffset, propname, &len);
+		if (len == 0) {
+			/* no value */
+			printf ("%s no value\n", __FUNCTION__);
+			return -1;
+		} else if (len > 0) {
+			return len;
+		} else {
+			printf ("libfdt fdt_getprop(): %s\n",
+				fdt_strerror(len));
+			return -2;
+		}
+	} else {
+		printf("%s: cannot find %s node err:%s\n", __FUNCTION__,
+			nodename, fdt_strerror (nodeoffset));
+		return -3;
+	}
+}
 #endif
 
 int ethernet_present (void)
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index d3d6814..a38c727 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -17,4 +17,14 @@
 #ifdef CONFIG_KEYMILE_HDLC_ENET
 int keymile_hdlc_enet_initialize (bd_t *bis);
 #endif
+
+int fdt_set_node_and_value (void *blob,
+			char *nodename,
+			char *regname,
+			void *var,
+			int size);
+int fdt_get_node_and_value (void *blob,
+				char *nodename,
+				char *propname,
+				void **var);
 #endif /* __KEYMILE_COMMON_H */