From patchwork Mon Sep 19 13:36:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1679424 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=I9omSHg1; 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 4MWQhW1k6jz1ypH for ; Mon, 19 Sep 2022 23:37:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F04784C23; Mon, 19 Sep 2022 15:37:05 +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="I9omSHg1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D0C584C39; Mon, 19 Sep 2022 15:37:01 +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 DC29E84C28 for ; Mon, 19 Sep 2022 15:36:58 +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 c2-20020a1c3502000000b003b2973dafb7so4695733wma.2 for ; Mon, 19 Sep 2022 06:36:58 -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; bh=vxrnlz/nOy4VhdpWy3aQ8BT1aCKg7D5l1L3wEejusOI=; b=I9omSHg1xSJLyv582n1+k1Yv6f8Sn4H6A2U+u36oCADblNHk9RXIC07pUW/sMuBYzE 9Rt+eVqqOMQwNcPzXyufy5MzLx5P5aJLmLBGtZbXi1H9/8o/8g//X2NmD8xwmZLpruLw Wvp2pRI7bd2jOo9rgB77Rwn3l8/B43uBVjfpPEC1xp1GguLFlUccDLJ1IrTLk1Y3TXYc bpTESOPAyURBQBGvFqs8d0+dmyT1aXeN0n9usCNewrA0cWYk4bP8yvZdxfumbRQGdeLB W9k8RiUf6OSI6i49TTGZmBwSyHZpsJ5RAf7whg+/xp1LdEy3F56GawcXU0cJ6vxUYt7b FkZw== 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; bh=vxrnlz/nOy4VhdpWy3aQ8BT1aCKg7D5l1L3wEejusOI=; b=O4vzqccFLB9wOA0TfPVbq2MquUNEaJcJEYWYaYyN2dCQa6Z7N8hbKyKM5c7AozHFZT BDi+hmAYXgV2vOclgcgkrZwbyi0KShyoLEE2if/3Z/jq6gtV1unbqn62zou3o8Oxn04/ CFi84e3BA3bxdFcfqroBXB1RDK9LsWbJn7cXYuLJBsv4+mQ6JrxXSEFxuyCmEH6R7BS4 dIij2vkiMUZCj7viQNY9q/sC08dulVEH6l2DS5m4jDrzbN+JwZn7/Ui99zFgAoWi3Yfr wv7yaMKStdRGGHiJfSPO15XlrVJuAgvh9XFsUfJZqGLK8BW8XiOnuotdbgjqIlzfFvRw j3Vw== X-Gm-Message-State: ACrzQf0q/eXE1Iwp+Zpiy/G7t/P/ZbAnhiYQfrn1pCctybFI96NHgpNt ort46086ptVXgtyUilOnIYOQyhHztctiFg== X-Google-Smtp-Source: AMsMyM5PO1/S0XwtbVKQuHUGRzPibloDn1xWFIT+Ybs4zKXu9Kf2PLaYL7aGmBSMdhlz+Db8cUZQyw== X-Received: by 2002:a05:600c:1f05:b0:3b4:ae0a:b2e5 with SMTP id bd5-20020a05600c1f0500b003b4ae0ab2e5mr12635717wmb.104.1663594617926; Mon, 19 Sep 2022 06:36:57 -0700 (PDT) Received: from localhost (atoulouse-654-1-345-94.w90-55.abo.wanadoo.fr. [90.55.184.94]) by smtp.gmail.com with ESMTPSA id 12-20020a05600c24cc00b003b339438733sm13473237wmu.19.2022.09.19.06.36.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 06:36:57 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Subject: [PATCH 1/2] splash: support raw image from MMC In-Reply-To: <87k05zo58p.fsf@baylibre.com> Date: Mon, 19 Sep 2022 15:36:56 +0200 References: <87k05zo58p.fsf@baylibre.com> Message-ID: <87illjo58n.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 2c03cbdf92..c512aa0196 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 Mon Sep 19 13:36:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1679425 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=2jrNGd8Z; 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 4MWQhk3Wy5z1ypH for ; Mon, 19 Sep 2022 23:37:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEA6F84C45; Mon, 19 Sep 2022 15:37:07 +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="2jrNGd8Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DEAE84C2A; Mon, 19 Sep 2022 15:37:02 +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-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 0777884C1B for ; Mon, 19 Sep 2022 15:37:00 +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-x430.google.com with SMTP id n10so16978875wrw.12 for ; Mon, 19 Sep 2022 06:37:00 -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; bh=g9pe1+/knD9NGYe5ZWhanh7d2jF9o16ZxegZdTC1ZvA=; b=2jrNGd8ZkD38m/YMa9+fldc9r0wLrE7ktfHF/6eCqpGCMdce+SlWj4ZyGahtCg0VrK 7VFOwwRlcxUMreHCrK4Q4zsg4vBzfia8MedtGFwP6EU5FfGAQG/npwpdxMB7oV/AuGFW Db2gea3unauTiih5HxfwNVuhwQtz0RDR2QC6uN531yRPFE8f+37vuKS6FEtf0FE+R8F/ HorD0a82ykpBjA2M1QE/ApCOwlbij5QPuit1lZOI+A6H+G9Quq1axcYr5QXar+LKqVsI s51FfDjcmjJ38dwd6Lz4ZmP2981smUswz2y/qvDfPGI90WT4zHGJdY+ZCmEq2bue2qx4 rC+A== 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; bh=g9pe1+/knD9NGYe5ZWhanh7d2jF9o16ZxegZdTC1ZvA=; b=7R22UBHw2D2zTxH9cUzuE5O+mqsfk5mqYT9UDo+yoz0pwsD2bnSwBDGK/eL3DkTDry i/0fZiqMudY4ovpb7KXy2JR4ucItR8O2N8fiNLRRQ9VXBA3Fu7iDfpuWDXpzWCxntw+u D7WNMHupuC8OuivtqJ49gTUWWoEi9BATSPVgxTehSGkRszGhlteP8GrziblAfBW06I5r FuiBUBc3OEtyvKcwUS4+ueiIA+SiEIF0SNut8cItnnD6mjdXnGmnEDJyhwtn3WPrTGNZ pMNWlfJ3hykkI4gizgRe/HBvCCvV9ULllf9HPVy9PMec2+wEUXuRURsE2Fm5XWh4rhDK J4eQ== X-Gm-Message-State: ACrzQf2z5OtWwMIMeTmxDSHj5V+bF82WJuWCtIbDGuanN7bE0uakRGxt uJw5DomwKSPkjeTAI7pP1Dnj3jrtS0Qf/w== X-Google-Smtp-Source: AMsMyM6IfnsXMFbyFTeij5WByrKISiTa3T73TeMNb6/hWQTA/0GzABZZykubFDPeOjRCQlSI3G6N9Q== X-Received: by 2002:adf:f4cf:0:b0:228:63bd:da33 with SMTP id h15-20020adff4cf000000b0022863bdda33mr10715748wrp.181.1663594619182; Mon, 19 Sep 2022 06:36:59 -0700 (PDT) Received: from localhost (atoulouse-654-1-345-94.w90-55.abo.wanadoo.fr. [90.55.184.94]) by smtp.gmail.com with ESMTPSA id r13-20020a5d4e4d000000b0022ae4f8395dsm8967695wrt.96.2022.09.19.06.36.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 06:36:58 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Subject: [PATCH 2/2] splash: get devpart from environment variable In-Reply-To: <87k05zo58p.fsf@baylibre.com> Date: Mon, 19 Sep 2022 15:36:58 +0200 References: <87k05zo58p.fsf@baylibre.com> Message-ID: <87h713o58l.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 --- common/splash_source.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/splash_source.c b/common/splash_source.c index c512aa0196..a7764ff16f 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)