From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v9 07/14] dm: Set up driver model after relocation
Date: Wed, 26 Feb 2014 15:59:20 -0700 [thread overview]
Message-ID: <1393455567-13378-8-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1393455567-13378-1-git-send-email-sjg@chromium.org>
Make driver model available after relocation, by setting up data structures
and scanning for devices using compiled-in platform_data and (when available)
the device tree.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- Rename platform_data to platdata
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/board_r.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/common/board_r.c b/common/board_r.c
index c2d0763..1f4345b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -18,6 +18,7 @@
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
+#include <dm.h>
#include <environment.h>
#include <fdtdec.h>
#if defined(CONFIG_CMD_IDE)
@@ -51,7 +52,9 @@
#ifdef CONFIG_X86
#include <asm/init_helpers.h>
#endif
+#include <dm/root.h>
#include <linux/compiler.h>
+#include <linux/err.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -263,6 +266,33 @@ static int initr_malloc(void)
return 0;
}
+#ifdef CONFIG_DM
+static int initr_dm(void)
+{
+ int ret;
+
+ ret = dm_init();
+ if (ret) {
+ debug("dm_init() failed: %d\n", ret);
+ return ret;
+ }
+ ret = dm_scan_platdata();
+ if (ret) {
+ debug("dm_scan_platdata() failed: %d\n", ret);
+ return ret;
+ }
+#ifdef CONFIG_OF_CONTROL
+ ret = dm_scan_fdt(gd->fdt_blob);
+ if (ret) {
+ debug("dm_scan_fdt() failed: %d\n", ret);
+ return ret;
+ }
+#endif
+
+ return 0;
+}
+#endif
+
__weak int power_init_board(void)
{
return 0;
@@ -761,6 +791,9 @@ init_fnc_t init_sequence_r[] = {
initr_barrier,
initr_malloc,
bootstage_relocate,
+#ifdef CONFIG_DM
+ initr_dm,
+#endif
#ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r,
#endif
--
1.9.0.rc1.175.g0b1dcb5
next prev parent reply other threads:[~2014-02-26 22:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 22:59 [U-Boot] [PATCH v9 0/14] Driver model implementation, tests, demo and GPIO Simon Glass
2014-02-26 22:59 ` [U-Boot] [PATCH v9 01/14] sandbox: Build a device tree file for sandbox Simon Glass
2014-03-04 19:16 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 02/14] Add cmd_process_error() to report and process errors Simon Glass
2014-03-04 19:16 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 03/14] yaffs: Remove private list implementation Simon Glass
2014-03-04 19:16 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 04/14] dm: Add README for driver model Simon Glass
2014-03-04 19:16 ` [U-Boot] [U-Boot,v9,04/14] " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 05/14] dm: Add base driver model support Simon Glass
2014-03-04 19:16 ` [U-Boot] [U-Boot,v9,05/14] " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 06/14] sandbox: config: Enable driver model Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` Simon Glass [this message]
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, 07/14] dm: Set up driver model after relocation Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 08/14] dm: Add basic tests Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot,v9,08/14] " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 09/14] dm: Add a 'dm' command for testing Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot,v9,09/14] " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 10/14] dm: Add a demonstration/example driver Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 11/14] dm: Add GPIO support and tests Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot,v9,11/14] " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 12/14] sandbox: Convert GPIOs to use driver model Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 13/14] dm: Enable gpio command to support " Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 22:59 ` [U-Boot] [PATCH v9 14/14] dm: Remove old driver model documentation Simon Glass
2014-03-04 19:17 ` [U-Boot] [U-Boot, v9, " Tom Rini
2014-02-26 23:01 ` [U-Boot] [PATCH v9 0/14] Driver model implementation, tests, demo and GPIO Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393455567-13378-8-git-send-email-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox