From patchwork Wed Jun 19 03:52:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 252469 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4D6922C034A for ; Wed, 19 Jun 2013 13:54:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 892BA4A0B9; Wed, 19 Jun 2013 05:54:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id icSOQSg1hLSz; Wed, 19 Jun 2013 05:54:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C10D14A03B; Wed, 19 Jun 2013 05:53:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DEEB4A021 for ; Wed, 19 Jun 2013 05:53:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NU1tWVCnPct3 for ; Wed, 19 Jun 2013 05:53:07 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qe0-f73.google.com (mail-qe0-f73.google.com [209.85.128.73]) by theia.denx.de (Postfix) with ESMTPS id D06424A018 for ; Wed, 19 Jun 2013 05:53:04 +0200 (CEST) Received: by mail-qe0-f73.google.com with SMTP id 1so551054qee.2 for ; Tue, 18 Jun 2013 20:53:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=nK2uXc+CYgoXFY58cXngfx8Zp2C1oMEtsCEq7Ztx4Rw=; b=AJ59kuxQDVB/ar/oLZ8iaPvF3JIAFP/V/Mi0AeEwOH578fWfYUBftcv5CcS2GeVzl/ 4xpU2L0FDb+L5wuCAOtNf/Db57b5GVxfZHd/RtFWQ4mGcVS0qsNqpqi570UjLgyNIOWS 7V/LpHwt7n9gmEZjfWBwpXPpIIfEwNiB0nT+HTuliTk3la2TuZRFRkljxAkPNVPHEy5w d2Uc/OagILvFC21CC83sfhwzaLRNyWhf63pb+bqMT/KMoW7D9kt7PSnJKOg04wqxJOmH 4I6cDAz1OomfY5BWdtXqmqx2V5cZeY4LNZaCodKGz1ZVSxrFPlwa04a34jkApCgIsxTQ ReNQ== X-Received: by 10.236.55.129 with SMTP id k1mr631096yhc.1.1371613983625; Tue, 18 Jun 2013 20:53:03 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id y4si1349775yhi.3.2013.06.18.20.53.03 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 18 Jun 2013 20:53:03 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 763B231C016; Tue, 18 Jun 2013 20:53:03 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 52C02160C66; Tue, 18 Jun 2013 20:53:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 18 Jun 2013 20:52:32 -0700 Message-Id: <1371613960-28678-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1371613960-28678-1-git-send-email-sjg@chromium.org> References: <1371613960-28678-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkpFS4XeHb+R21U51w66vp7ykaKdgBDE9JdVFlM2mNfCxkTKo1RGAzydBZxLg30HjZNYvSGVSyN1+bmzGE8+nj1F6TYZy62QSnLQKCGmDfFXczqz0KuLdS9gB40HAQjVjA4veupEQwjcmfWbuLxYDCgMpdcXeAlUyu2YvwCl+m8q1aUAl2Y8wkFH0pDnVZTOWVJD6Ef Cc: Tom Rini , u-boot-review@google.com Subject: [U-Boot] [PATCH v3 08/16] dm: Set up driver model after relocation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- 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 f5649c9..5fe86ef 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -34,6 +34,7 @@ #ifdef CONFIG_HAS_DATAFLASH #include #endif +#include #include #include #if defined(CONFIG_CMD_IDE) @@ -66,7 +67,9 @@ #ifdef CONFIG_X86 #include #endif +#include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -269,6 +272,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_platform_data(); + if (ret) { + debug("dm_scan_platform_data() 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; @@ -766,6 +796,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