From patchwork Mon Oct 17 08:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1690695 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=3sMIojIU; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MrVdS0JyXz23jp for ; Mon, 17 Oct 2022 19:33:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFFBF84F4F; Mon, 17 Oct 2022 10:33:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="3sMIojIU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCBF584C9F; Mon, 17 Oct 2022 10:33:26 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 CB41884F4F for ; Mon, 17 Oct 2022 10:33:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmasson@baylibre.com Received: by mail-wm1-x330.google.com with SMTP id az22-20020a05600c601600b003c6b72797fdso9421690wmb.5 for ; Mon, 17 Oct 2022 01:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:references:date:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=iANtsyZ3ofCX81hIqA5wmp9A0kgwvSJosDv/ZICQpo0=; b=3sMIojIUXeV3wykQLomU8afMi0RJ46EsAVYa7Y7tjGKSiYFfa5YmA13lLDBqm9GwVS 3/xJIGW2KPep3hDjCoT5u5/pMPwh4IFqbBBv8l6gbxeEX6+60MBO0qezjq/Oj+xEoaFz ps0G2JDSV542jZ/fWginGuKNS9de+mZbZISwrAKWysisroYO3oGKNwjpwglF8lA4K+/n 9Hlxdw0KZLGPb+5iRPbSNZTJc0RAyRlg5aeDhjJsIuRvEHtUSrmyK/tLeHps+jsoq25T JOM8i+zBEVfBg1nzWADSjaQ7XYRVAjf0SeQa8Yrym91aKXWVtUIRfmyKeu/5alchpWjp FdZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:references:date:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iANtsyZ3ofCX81hIqA5wmp9A0kgwvSJosDv/ZICQpo0=; b=rt8muFN1EQXz5fhSWBXvunNmBu4Dr0Bzai4PfyItT3tbkEHZIc3TRDDcX2On/TtFuf VN3g8pvfeWKbjWSAhHc3686TuJYAXWHchn7p0A4I62FnMVkFBYo7BgUrcmS7aN1Qw4QT rPCULVq7HOEFrRQSFO1jbShopjZceL3zK9V79hVy0//9SlgLlXP+evtaFM1h4UemRj4D rkSnCfKRbMK5pbh9mrAMjEctIPdT2WU7pfq7pHbdY3z51hheN5T6w7ECBJFOgIJPmw31 /TLCTbmcxHnmkWoauGlTBI4nDjUq5MEHQW+MoaWXRDoXWEaXNSPfEv2QDhz29t+nVu9f xAWg== X-Gm-Message-State: ACrzQf2l7BBXU5pRPV/2QgD8PfWjwkI/6Mcg0z1L9DDpDTCMKDem6LGZ p8zyC7ru+SpqnuD3N23jcO/AWr+H7JlKig== X-Google-Smtp-Source: AMsMyM7N0pU47NsMLNfaQCOQ4wL52LnguO6tgF9uBQ9pnQqMTreoXYuyQM+zqgKfF2N5KNKu741KiA== X-Received: by 2002:a05:600c:1906:b0:3c6:f83e:d15f with SMTP id j6-20020a05600c190600b003c6f83ed15fmr2159775wmq.205.1665995602579; Mon, 17 Oct 2022 01:33:22 -0700 (PDT) Received: from localhost (atoulouse-654-1-345-205.w90-55.abo.wanadoo.fr. [90.55.184.205]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c489400b003c6c2ff7f25sm9270690wmp.15.2022.10.17.01.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 01:33:21 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Simon Glass Subject: [PATCH v2 1/2] splash: support raw image from MMC In-Reply-To: <87fsfm6e9d.fsf@baylibre.com> Date: Mon, 17 Oct 2022 10:33:21 +0200 References: <87fsfm6e9d.fsf@baylibre.com> Message-ID: <87edv66e9a.fsf@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean The user has now the choice to specify the splash location in the MMC as a raw storage. Signed-off-by: Julien Masson Reviewed-by: Simon Glass --- Changes in v2: - splash_mmc_read_raw: return -EIO in case of errors - splash_mmc_read_raw: use IS_ENABLED(CONFIG_CMD_MMC) instead of #ifdef common/splash.c | 6 ++++++ common/splash_source.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/common/splash.c b/common/splash.c index 0e520cc103..5206e35f74 100644 --- a/common/splash.c +++ b/common/splash.c @@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = { .flags = SPLASH_STORAGE_FS, .devpart = "0:1", }, + { + .name = "mmc_raw", + .storage = SPLASH_STORAGE_MMC, + .flags = SPLASH_STORAGE_RAW, + .devpart = "0:1", + }, { .name = "usb_fs", .storage = SPLASH_STORAGE_USB, diff --git a/common/splash_source.c b/common/splash_source.c index 87e55a54f8..68c9fa371b 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -65,6 +65,30 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) } #endif +static int splash_mmc_read_raw(u32 bmp_load_addr, struct splash_location *location, + size_t read_size) +{ + struct disk_partition partition; + struct blk_desc *desc; + lbaint_t blkcnt; + int ret, n; + + if (!IS_ENABLED(CONFIG_CMD_MMC)) { + debug("%s: mmc support not available\n", __func__); + return -ENOSYS; + } + + ret = part_get_info_by_dev_and_name_or_num("mmc", location->devpart, &desc, + &partition, 1); + if (ret < 0) + return ret; + + blkcnt = DIV_ROUND_UP(read_size, partition.blksz); + n = blk_dread(desc, partition.start, blkcnt, (void *)(uintptr_t)bmp_load_addr); + + return (n == blkcnt) ? 0 : -EIO; +} + static int splash_storage_read_raw(struct splash_location *location, u32 bmp_load_addr, size_t read_size) { @@ -75,6 +99,8 @@ static int splash_storage_read_raw(struct splash_location *location, offset = location->offset; switch (location->storage) { + case SPLASH_STORAGE_MMC: + return splash_mmc_read_raw(bmp_load_addr, location, read_size); case SPLASH_STORAGE_NAND: return splash_nand_read_raw(bmp_load_addr, offset, read_size); case SPLASH_STORAGE_SF: From patchwork Mon Oct 17 08:33:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1690696 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=JeEnuIqe; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MrVdk5Z1lz23jp for ; Mon, 17 Oct 2022 19:34:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A75184F7E; Mon, 17 Oct 2022 10:33:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="JeEnuIqe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0D83284F78; Mon, 17 Oct 2022 10:33:29 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 373B684F6D for ; Mon, 17 Oct 2022 10:33:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmasson@baylibre.com Received: by mail-wm1-x32d.google.com with SMTP id y10so8196037wma.0 for ; Mon, 17 Oct 2022 01:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:references:date:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ok65PijNDBnsCtux213WNtApSDEjBixR/Mi4In7cSnc=; b=JeEnuIqe7bMJrYm0qAOI2Zylq8USudvCdyTloln8XTZrmkmboMBPEhmJek/NQZGpz0 y45I7sAEYS/VKmOLQIc8f3wzfDVnMgDQs15KJPzwgD63GOA5fnUcRFpb8xF5CzPusoX9 dD2kzap0iW5PsgJuQnxCui22poDj7bhpTL0Nj4kC3qJZIATWp5EtI477k9pNWHmj8m7G 3IVYEbXwH4iYLy+JxUPDk2PjPg0xn7DkZSC//3HZfxXknI3ugYcABTZRtjrcR71yDmZP /mnG2XUZqB6W3c4cGXThp2FsdfgSTaSkdWhTGe1iXiUBDbYjgy7Zba2/U1jMT6Zih5cs 0epg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:references:date:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ok65PijNDBnsCtux213WNtApSDEjBixR/Mi4In7cSnc=; b=szcvkXEaP4QHcdvC0s9CaXJ9VgPtFWMLXBvo8qiu4pbOzQAJBnZj7YJ1kRjvoPC2Tx JqTTwK2HSgBhhAR7IqgCCVKZCSx8gGVCRZxTWz7B1opZ3xOlURknVgbfPy1VWbEye8K4 6rErbvqdwsC+WZklj8EHIW8VRBJpeU8/GgsTqprvpcvED8OHjB/WuBBy+e62tUnqPofN hzeS4KS4b7NFTK+H7fzbK5R73ZcPDoas2X7COgnNh+pfyFbp2xGvZnD9SK2bFo+hjJPV O4ijkNsEJee/sXGELdTYJDDFH1yQYOnhWEPMSP5JhXO+NmgfEe7UA9e486yOmR1B/CYW 7bKw== X-Gm-Message-State: ACrzQf0BNMtVezKDRECsOFEn+I2Fe3gKeK5DjsPG+yrCLopaH6gC234E yHXOLKtah6BUnqzSOiouvlK6OcjzJqlQGQ== X-Google-Smtp-Source: AMsMyM7k4tnODt3yLZMU+08hDFvyaJI1yJlfGUmCkMogvSoD1OKvTXRoLiVbwIXGyydDkA/ehTulCw== X-Received: by 2002:a05:600c:4b95:b0:3c4:5806:103d with SMTP id e21-20020a05600c4b9500b003c45806103dmr18482983wmp.26.1665995604500; Mon, 17 Oct 2022 01:33:24 -0700 (PDT) Received: from localhost (atoulouse-654-1-345-205.w90-55.abo.wanadoo.fr. [90.55.184.205]) by smtp.gmail.com with ESMTPSA id g15-20020adfe40f000000b00226dfac0149sm7729189wrm.114.2022.10.17.01.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 01:33:24 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Simon Glass Subject: [PATCH v2 2/2] splash: get devpart from environment variable In-Reply-To: <87fsfm6e9d.fsf@baylibre.com> Date: Mon, 17 Oct 2022 10:33:22 +0200 References: <87fsfm6e9d.fsf@baylibre.com> Message-ID: <87czaq6e99.fsf@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean By default several types of splash locations are supported and the user can select one of them through environment var (splashsource). However the devpart is still hardcoded and we cannot change it from the environment. This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable. Example: image located in splashscreen partition (MMC as raw) ``` splashsource=mmc_raw splashdevpart=0#splashscreen ``` Reviewed-by: Simon Glass Signed-off-by: Julien Masson Reviewed-by: Simon Glass --- Changes in v2: - rename local var env_splashdevpart_value to devpart common/splash_source.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/splash_source.c b/common/splash_source.c index 68c9fa371b..a260137619 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -448,6 +448,7 @@ int splash_source_load(struct splash_location *locations, uint size) { struct splash_location *splash_location; char *env_splashimage_value; + char *devpart; u32 bmp_load_addr; env_splashimage_value = env_get("splashimage"); @@ -464,6 +465,10 @@ int splash_source_load(struct splash_location *locations, uint size) if (!splash_location) return -EINVAL; + devpart = env_get("splashdevpart"); + if (devpart) + splash_location->devpart = devpart; + if (splash_location->flags == SPLASH_STORAGE_RAW) return splash_load_raw(splash_location, bmp_load_addr); else if (splash_location->flags == SPLASH_STORAGE_FS)