dm: Support parent devices with of-platdata

At present of-platdata does not provide parent information. But this is
useful for I2C devices, for example, since it allows them to determine
which bus they are on.

Add support for setting the parent correctly, by storing the parent
driver_info index in dtoc and reading this in lists_bind_drivers(). This
needs multiple passes since we must process children after their parents
already have been bound.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 2c3cc90..f800a866 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -22,15 +22,23 @@
  * @name:	Driver name
  * @platdata:	Driver-specific platform data
  * @platdata_size: Size of platform data structure
+ * @parent_idx:	Index of the parent driver_info structure
  */
 struct driver_info {
 	const char *name;
 	const void *platdata;
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
-	uint platdata_size;
+	unsigned short platdata_size;
+	short parent_idx;
 #endif
 };
 
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#define driver_info_parent_id(driver_info)	driver_info->parent_idx
+#else
+#define driver_info_parent_id(driver_info)	(-1)
+#endif
+
 /**
  * driver_rt - runtime information set up by U-Boot
  *