From patchwork Sat Dec 7 04:41:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1205346 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SuhzZxym"; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47VH5R0t6pz9sPL for ; Sat, 7 Dec 2019 15:48:11 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72BE3816AD; Sat, 7 Dec 2019 05:46:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SuhzZxym"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4CC6280E97; Sat, 7 Dec 2019 05:46:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EC14680E97 for ; Sat, 7 Dec 2019 05:46:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id z193so9502592iof.1 for ; Fri, 06 Dec 2019 20:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZF0zZkqvvz/wzlpUQBfmacORWPbO5JFpL+RG/GuIb8I=; b=SuhzZxym49rPGo4PX6KSJ6W2xtbm8xK18tOuJLMSnn3Q1Y1Fs7uiyzlgiGqOMR1kYo 2+ueoDPA+iIkg7L8IC2cmOtNYn0kL8+bkIXZy9Rqvwlf5rxgPp/r9eARxhojNpX8SoPv 2dpabqlPdG2Iv8DoA+C8H6UnVE1c/MSK0YrFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZF0zZkqvvz/wzlpUQBfmacORWPbO5JFpL+RG/GuIb8I=; b=WJflElHEAAM5Omm3NPrBa+GJcPJkxBXJKffb6G8BDyF+m40DS0c6hY3Q5dlzwUs+Q4 RJ2IQ12o0lOqh9sCzZ1pu3C905I/CPtOomrJX9Ke4vrXurzN3SpwVM7Lc2gBPbB8GkHe HR2GvqXEdUTaIAhcFqD2k+PEIKSuGh2Xtu+9f0j5Qv7yH8ai2f2K3bQBlmsO8NBaGlHs EAVTKPeBy15EHCD6Ar+AFT5J8H8RCdeoj4MDZxl7zsQyCnflLiyrMGBzHwWqDIrOPDtR 3TIEt2+U9Z0cl7xVNY3YvlaeHAnS0NFN6AMErAEOOAFPwtBpzIMGp2HVJwXGrNaBCs8g AhiQ== X-Gm-Message-State: APjAAAWCZXjvhkxy2NqEHCI8ctn6gKKUYj94Vicwwb4uGWthfhLEAydM wHMGmnqw9TWuc4oaSYjdkHKAhDSAt+w= X-Google-Smtp-Source: APXvYqwImoUlztPKisB6GcI3CHByKbTYaOvLWD8DInPS6hH9QK52ORxAhl8cQOsI/SIsKIxs8D9slQ== X-Received: by 2002:a5e:c20b:: with SMTP id v11mr12952017iop.56.1575693997734; Fri, 06 Dec 2019 20:46:37 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id o7sm4549410ilo.58.2019.12.06.20.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 20:46:37 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Subject: [PATCH v6 013/102] board_r: Move early-timer init later Date: Fri, 6 Dec 2019 21:41:46 -0700 Message-Id: <20191206213936.v6.13.I512896ca7c3c572ad77920cc5c42b9bc223c274a@changeid> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191207044315.51770-1-sjg@chromium.org> References: <20191207044315.51770-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean At present the early timer init happens as soon as driver model is set up. This makes it impossible to do anything that needs driver model but must run before devices are probed (as needed with Intel's FSP-S, for example). In any case it is not a good idea to tie probing of particular drivers too closely to the DM init. Create a new function to init the timer and put it a bit later in the sequence. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v6: None Changes in v5: None Changes in v4: - Add new patch to move early-timer init later Changes in v3: None Changes in v2: None common/board_r.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 9902c51c5e..9a25f6ec28 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -311,16 +311,24 @@ static int initr_dm(void) bootstage_accum(BOOTSTATE_ID_ACCUM_DM_R); if (ret) return ret; -#ifdef CONFIG_TIMER_EARLY - ret = dm_timer_init(); - if (ret) - return ret; -#endif return 0; } #endif +static int initr_dm_devices(void) +{ + int ret; + + if (IS_ENABLED(CONFIG_TIMER_EARLY)) { + ret = dm_timer_init(); + if (ret) + return ret; + } + + return 0; +} + static int initr_bootstage(void) { bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r"); @@ -707,6 +715,7 @@ static init_fnc_t init_sequence_r[] = { efi_memory_init, #endif initr_binman, + initr_dm_devices, stdio_init_tables, initr_serial, initr_announce,