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: