From patchwork Tue May 19 19:23:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293693 X-Patchwork-Delegate: jagannadh.teki@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=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=cvm8jLjP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 49RQnD3Fhbz9sPK for ; Wed, 20 May 2020 05:24:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 660FD81584; Tue, 19 May 2020 21:24:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="cvm8jLjP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5222881584; Tue, 19 May 2020 21:24:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (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 4B37281584 for ; Tue, 19 May 2020 21:24:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1042.google.com with SMTP id s69so106779pjb.4 for ; Tue, 19 May 2020 12:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ug5Mn9JNdBHG8t5caMWjKTyxBhHTQ22TxGk0ePPcLl4=; b=cvm8jLjP1qvHTEajelP1Sh1SniXk00AXlv7C6oL0TpfIBryrGRyhT/b1Cl/CwonATI Ag3M8dpBc+6h7oXYd3UubgIbidkQ4ZR2hJ6be4j7KU1FRERgogQJ37/DtyTcVKa5RDGv sgJcm3vFF1hO0Ns9VHMHWiYHLX6zbFKtlc6Us= 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=Ug5Mn9JNdBHG8t5caMWjKTyxBhHTQ22TxGk0ePPcLl4=; b=tkK8na+2FylY0GZcCZRs31CrBrGjT64iUTf580iKTQ/ez2ZboI9wpbzyNbslf7AZEa Ajovh0CWvEUgg6QWzze5qqkI9npXKK91SJBt/rWqvdQxWhuoXRiwUCWvRpTlD4FWbvFo BxnJqwOPFxQF/1vn+v1k3bM9Oy0om4Lyovfg6Got74Ui0P8W8UYvegs0Nv/lVV8mnmNG Hpv1boVXqMfklDuPE6dN6mWoh0Ktu+/fVJM0eVtLD6BOW2MWsvqYpJQs94wWu0QY6f6S HxfovyoTsjTveSzy22MzZHVlJoDB0ODOnAzLjZotEQzeCcgl3HDe8Dh9Do0hNFjHGE1f M0oA== X-Gm-Message-State: AOAM5335y65YeNfZfx1yPkDMSx+OkHqZv67HJg5RpSXmyVKr4+d3hksA zhoyg+nY0udx2LWInQ7vEHU/xg== X-Google-Smtp-Source: ABdhPJxzUBC9BMRhJ2VHbzpA4s3PwaevB8Klq+4Tqh+uJLBmJJvSc0+Q1KUWVXcF82vP6jkARHvUMg== X-Received: by 2002:a17:902:fe06:: with SMTP id g6mr973149plj.118.1589916267718; Tue, 19 May 2020 12:24:27 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:26 -0700 (PDT) From: Jagan Teki To: Rick Chen , Atish Patra , Palmer Dabbelt , Bin Meng , Paul Walmsley , Anup Patel , Sagar Kadam Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki , Mario Six , Tom Rini , Simon Glass , Jean-Jacques Hiblot Subject: [PATCH v2 1/9] spl: Try to get SPL boot device via board_get_int Date: Wed, 20 May 2020 00:53:32 +0530 Message-Id: <20200519192340.16624-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean Usually, the associated board would supply spl boot device using spl_boot_device() but some boards have board driver that are possible to supply boot device via board_get_int with BOARD_SPL_BOOT_DEVICE id. This patch add support for those. Cc: Mario Six Cc: Tom Rini Cc: Simon Glass Cc: Jean-Jacques Hiblot Signed-off-by: Jagan Teki --- Changes for v2: - new patch common/spl/spl.c | 14 +++++++++++++- include/board.h | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index fc5cbbbeba..a07b71b3c1 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -483,9 +484,20 @@ int spl_init(void) #define BOOT_DEVICE_NONE 0xdeadbeef #endif +__weak u32 spl_boot_device(void) +{ + return 0; +} + __weak void board_boot_order(u32 *spl_boot_list) { - spl_boot_list[0] = spl_boot_device(); + struct udevice *board; + + if (!board_get(&board)) + board_get_int(board, BOARD_SPL_BOOT_DEVICE, + (int *)&spl_boot_list[0]); + else + spl_boot_list[0] = spl_boot_device(); } static struct spl_image_loader *spl_ll_find_loader(uint boot_device) diff --git a/include/board.h b/include/board.h index 678b652b0a..ce4eaba38d 100644 --- a/include/board.h +++ b/include/board.h @@ -211,3 +211,12 @@ static inline int board_get_fit_loadable(struct udevice *dev, int index, } #endif + +/** + * Common board unique identifier + * + * @BOARD_SPL_BOOT_DEVICE: id to get SPL boot device. + */ +enum common_ids { + BOARD_SPL_BOOT_DEVICE, +};