From patchwork Thu Mar 5 19:25:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 446857 X-Patchwork-Delegate: sjg@chromium.org 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 A7BB51400DE for ; Fri, 6 Mar 2015 06:26:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D1C8AA7425; Thu, 5 Mar 2015 20:26:15 +0100 (CET) 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 MXGFeSZZPtzn; Thu, 5 Mar 2015 20:26:15 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34AF6A742A; Thu, 5 Mar 2015 20:26:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 70B99A7420 for ; Thu, 5 Mar 2015 20:26:06 +0100 (CET) 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 jC8LhhpGs3aS for ; Thu, 5 Mar 2015 20:26:06 +0100 (CET) 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-ob0-f201.google.com (mail-ob0-f201.google.com [209.85.214.201]) by theia.denx.de (Postfix) with ESMTPS id 0F476A741D for ; Thu, 5 Mar 2015 20:26:03 +0100 (CET) Received: by obbnt9 with SMTP id nt9so3906261obb.1 for ; Thu, 05 Mar 2015 11:26:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7n/Bh/UrkhbD+zqqQk/jfTN9rxjLpSOk2GjABcHfNL4=; b=HhyDUIb3VPdOGxnyhD0Qd9JyEYrVvcNWy2xl21Nhs0vn4rtuHaz4Td1nU4ZiETCQ+s wAG8KsvMxAlGUf1vexKK6Z6x16rmXk5KUo8PX/QqWABIyNX0F3oB/u0kfy1sM01PXPhP jj2SpMEt5TFBSUVtZ+FGbE1WTA0tRyHDDnQ80ipdPTOWS//pxeixdipZTTq2TPZceJ7E M885cxyWbmi2OPObhvPQ9/dKZj0vKX9Vw/DhnaQjtTKonsLr2F5WkAXwcW4KgfDGXbIn ThS49RKSU8VkrTovVrIPARImX+F9zLDXRf/0IPkHQMP0TtVzA+tHPaK1Gvn3/FtQo0L8 nebA== X-Gm-Message-State: ALoCoQmitsY8t/gm3+YYZxKw06NzX1gmNMCvs75aAxCfH+vLhoK89ZyQhCNgQyVBI85lsi73Ehs3 X-Received: by 10.182.98.230 with SMTP id el6mr12187236obb.49.1425583562056; Thu, 05 Mar 2015 11:26:02 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id l42si553775yhq.1.2015.03.05.11.26.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 11:26:02 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id Wd8XdaGT.1; Thu, 05 Mar 2015 11:26:01 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 4DF88220B64; Thu, 5 Mar 2015 12:26:01 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 5 Mar 2015 12:25:16 -0700 Message-Id: <1425583534-2238-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1425583534-2238-1-git-send-email-sjg@chromium.org> References: <1425583534-2238-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , Masahiro Yamada Subject: [U-Boot] [PATCH v2 04/22] dm: Add a new CPU init function which can use driver model X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since driver model is set up after arch_cpu_init(), that function cannot use drivers. Add a new arch_cpu_init_dm() function which is called immediately after driver model is ready, and can reference devices. This can be used to probe essential devices for the CPU. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Add a new patch with a CPU init function which can use driver model common/board_f.c | 6 ++++++ include/common.h | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/common/board_f.c b/common/board_f.c index 4d8b8a6..8bbece2 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -787,6 +787,11 @@ __weak int reserve_arch(void) return 0; } +__weak int arch_cpu_init_dm(void) +{ + return 0; +} + static init_fnc_t init_sequence_f[] = { #ifdef CONFIG_SANDBOX setup_ram_buf, @@ -807,6 +812,7 @@ static init_fnc_t init_sequence_f[] = { fdtdec_check_fdt, #endif initf_dm, + arch_cpu_init_dm, #if defined(CONFIG_BOARD_EARLY_INIT_F) board_early_init_f, #endif diff --git a/include/common.h b/include/common.h index 77c55c6..f9aaaa5 100644 --- a/include/common.h +++ b/include/common.h @@ -253,6 +253,17 @@ int update_flash_size(int flash_size); int arch_early_init_r(void); /** + * arch_cpu_init_dm() - init CPU after driver model is available + * + * This is called immediately after driver model is available before + * relocation. This is similar to arch_cpu_init() but is able to reference + * devices + * + * @return 0 if OK, -ve on error + */ +int arch_cpu_init_dm(void); + +/** * Reserve all necessary stacks * * This is used in generic board init sequence in common/board_f.c. Each