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: