From patchwork Wed Oct 12 11:38:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1689104 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=zX9Wju3H; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MnW0M0Smjz23jn for ; Wed, 12 Oct 2022 22:39:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6159584E67; Wed, 12 Oct 2022 13:39:24 +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="zX9Wju3H"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 204FD80446; Wed, 12 Oct 2022 13:38:58 +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-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (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 5CD0484E37 for ; Wed, 12 Oct 2022 13:38:55 +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-x334.google.com with SMTP id c7-20020a05600c0ac700b003c6cad86f38so1038700wmr.2 for ; Wed, 12 Oct 2022 04:38:55 -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=h7GUVxCiAa6/slIVTwgU3QwDWOn2jdT+tiszPPacTls=; b=zX9Wju3HQT6Egmg26KRjwgp3Qr7Or+aTk/WpcMDdTehS6JbQnSnAnLgXe7ftGVfx2W F+qjbs99j0jh1wF8b4KnQxZyVVz9DJ3e1T2lybuef1bJjpEbDmhANZLinciwV2eh9s4Q KOsdEDNjIpZa/a5K/ctT0irxBlekaxiSzAMcVaXrfsRk8LI94XlUS2LgJ4Ifews+leom TIhhsJl/Y9EeYuTPPoDktUkMmXSzJAPVu1/oKXeqxI91B3FkqLvtEwbd/7mlnyH1Qwxw OXY3nr8BBfY2qLj09SJgst/QMy9Vf8aGghVM6o3Vy89VLF7twJHcuDUrHBH+ByVrhjht A5DQ== 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=h7GUVxCiAa6/slIVTwgU3QwDWOn2jdT+tiszPPacTls=; b=6IVG5kRmW/oE8JDzJWk2qkoIiq+vnRRDLUTyxow7qL9US8lJvsOL/F8ByoVF+PJclP luDxtEcCDFlo9Q8SplPRK0Eh0tF//KHTuAwainZHioarzkNuVQWKIctJW+Jes+PXoul5 yUJh21SNx549RQCZchNJogtBf8org0VKu3D/GGlPntMLX3ODdP08FYtBS85H3VH+XeeV wUX1+TUOyE/UtqxYPpIqOcP98Xagb+YvM/Se7ZyRDr3HM6GpWosEqoC/S9qC3BCW3YwH 1dhh2lOZSbdjKJRgkm+024APeVuhbXMBzKXsgcxHM8SeQ5wID4s8qP721dQf6BkbpyM7 KgmQ== X-Gm-Message-State: ACrzQf3n9/OyCZLjEhU/TxJkGzejRwfDBgR/rMQ8Sj6e1xtskdxa4Vz2 dHm9siZ8LwAWw8ISzwGtgt9QV6mHFmQNeg== X-Google-Smtp-Source: AMsMyM6ziE9kj8fueZU7nLM6y8GqlqfplrOuEI/jkcoJOINgtqbdL0Bu6SBMVVw9R5791W+gpDnLBw== X-Received: by 2002:a05:600c:1c16:b0:3c6:bb05:702c with SMTP id j22-20020a05600c1c1600b003c6bb05702cmr2397595wms.203.1665574734698; Wed, 12 Oct 2022 04:38:54 -0700 (PDT) Received: from localhost (lfbn-tou-1-1062-54.w90-76.abo.wanadoo.fr. [90.76.131.54]) by smtp.gmail.com with ESMTPSA id m35-20020a05600c3b2300b003a1980d55c4sm1680934wms.47.2022.10.12.04.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 04:38:54 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Simon Glass Subject: [RESEND PATCH 1/2] splash: support raw image from MMC In-Reply-To: <87a661clvc.fsf@baylibre.com> Date: Wed, 12 Oct 2022 13:38:53 +0200 References: <87a661clvc.fsf@baylibre.com> Message-ID: <878rllclv6.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 --- common/splash.c | 6 ++++++ common/splash_source.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 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..b4bf6f1336 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) } #endif +#ifdef CONFIG_CMD_MMC +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; + + 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 : -EINVAL; +} +#else +static int splash_mmc_read_raw(u32 bmp_load_addr, int offset, size_t read_size) +{ + debug("%s: mmc support not available\n", __func__); + return -ENOSYS; +} +#endif + static int splash_storage_read_raw(struct splash_location *location, u32 bmp_load_addr, size_t read_size) { @@ -75,6 +102,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 Wed Oct 12 11:38:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1689105 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=dNyWIuZx; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MnW0Y5XhCz23jn for ; Wed, 12 Oct 2022 22:39:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4294784F00; Wed, 12 Oct 2022 13:39: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="dNyWIuZx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A323584E57; Wed, 12 Oct 2022 13:39:00 +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-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 8381A84E4E for ; Wed, 12 Oct 2022 13:38:56 +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-wr1-x435.google.com with SMTP id b4so25836507wrs.1 for ; Wed, 12 Oct 2022 04:38:56 -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=6lMdC/jmUHfnOU/5xHN37SBc/jfnz4uqoEOm2sjc3NE=; b=dNyWIuZxJPJU+U8CgV9+e+bIUICK0AC5W6axlyJluPGg3cLSjEmgoNhoUuLJJb2yez 7uWPiBnaQ7TakLsZGShc3ikBb3fug1tnWLgvIa7cv6uPLW/vVGFnrR9RnP1coLdLKfyC 9JYasfe+GaWIGliHsO0MqgfCA33fRT/CXuaWQHHsT36yPPc8353nljEUqjLWMXSFI24V wDjpdlqmHVrUev5/WHCokIjCzHa9dXW157jQeoczVStr8x5OcWOWwTkHyT+2vmbXxydy KIrMEA6fzmr5D1RrxCh3O4KQwXGn0PZ11OcQRxC7371y6YPeEWDJeBXGwDelm/HXlZ6A KaXQ== 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=6lMdC/jmUHfnOU/5xHN37SBc/jfnz4uqoEOm2sjc3NE=; b=4eC6YL18D8gVcFVImKegCdcI7iCnoV80/S2OI5Md09SAS8OxYk0bvcH5Q8psGhgH7b /GjpVgULHcx0RDcSdCFPajvw8nxdIiylQaMhoCkCVs46t/WJJH9VwW5jP5uyJbt4fH4p sroh3MOq5ma7AK+Aus6TsGbykLQIBJXP8+LnUbhhHpu/+LJukooykriwmjr3hLsePm4k cjKYqT8+FseJ+14dImGM6KzSeTU6U27GJs1PRCrAAZBt74RYQ7pOANI5+z7+7xICcWl+ zOhkSU/OdeHVJp/smJRJGfA/AfrHszgIwUUxeL2LCcQEaMxj6r4hEfjsH+1JpcgpFJ2F CAdw== X-Gm-Message-State: ACrzQf2EUsFC9fyL/SDC36CU+vUOa/JXEwDT7C76nM+Y4q4sQ+YdgBqW dJWnXXF3s/4Gbzu4i43iVVi5nK/ao9m5Dg== X-Google-Smtp-Source: AMsMyM5icwAmOm+DHFggG6ad1Ha9vROJxAQJvwNnEYo/PswIIOYXrPP2incaCT2Iz+QlruWBodHXLQ== X-Received: by 2002:a05:6000:711:b0:22e:7b01:db9f with SMTP id bs17-20020a056000071100b0022e7b01db9fmr18710239wrb.38.1665574735878; Wed, 12 Oct 2022 04:38:55 -0700 (PDT) Received: from localhost (lfbn-tou-1-1062-54.w90-76.abo.wanadoo.fr. [90.76.131.54]) by smtp.gmail.com with ESMTPSA id c3-20020a1c3503000000b003a6125562e1sm1526038wma.46.2022.10.12.04.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 04:38:55 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Simon Glass Subject: [RESEND PATCH 2/2] splash: get devpart from environment variable In-Reply-To: <87a661clvc.fsf@baylibre.com> Date: Wed, 12 Oct 2022 13:38:54 +0200 References: <87a661clvc.fsf@baylibre.com> Message-ID: <877d15clv5.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 ``` Signed-off-by: Julien Masson Reviewed-by: Simon Glass --- common/splash_source.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/splash_source.c b/common/splash_source.c index b4bf6f1336..1f99f44f78 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) { struct splash_location *splash_location; char *env_splashimage_value; + char *env_splashdevpart_value; u32 bmp_load_addr; env_splashimage_value = env_get("splashimage"); @@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size) if (!splash_location) return -EINVAL; + env_splashdevpart_value = env_get("splashdevpart"); + if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; + if (splash_location->flags == SPLASH_STORAGE_RAW) return splash_load_raw(splash_location, bmp_load_addr); else if (splash_location->flags == SPLASH_STORAGE_FS)