From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1616C433F5 for ; Tue, 14 Sep 2021 03:29:05 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF9E5610CE for ; Tue, 14 Sep 2021 03:29:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EF9E5610CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 08D4B83B01; Tue, 14 Sep 2021 05:29:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631590143; bh=rk1lPLsIgUBGfc3NA9nmVDsbp8Y49AgNUUaexdpGabQ=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=QbV1zbA0LQKU2vXSf/h6GI+J0lTndyv01tSjqVMnJsiDQxAYFIYIg8Jz1LbzTnDcL 6HY0EtwN8TE9o4YAUI5fGnmszW6YdI2AGNg7HiRiatZulWmk6+b/NtTfuzUiZvq22Q IHKedTBjfia8ycvNTcbCSVGKayEktvXM8qDmjUQSOrxwrfPz/sOT+BBqujztKJRlRV 5bx7w3ca4ZD0u2aFI68Mf8lSlXANRetTA3wuAdRFr/XrGQd/NVSAbx5Wqk69vlkCu5 z/Xwffu4GSFi7ymqbw1SOg8snuQzoeigOUGUG/44nt3hrb0DeTBahH0dhhVRLQ7gK+ RGBLpCjEBsedg== Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id CE67A835AF; Tue, 14 Sep 2021 05:28:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1631590140; bh=rk1lPLsIgUBGfc3NA9nmVDsbp8Y49AgNUUaexdpGabQ=; h=From:To:Cc:Subject:Date:From; b=SLfP37nLjWpNUp1Mn0WDk2r61+IbFsDBuShQzgSdS4Z0PS8HstKGjNWaET6gD4rNI MbZpJO2mQ0fdSEjK6YDhxao24qubcAc0YCHv36nF5RT/PNCVlOsxBh7SAQWRrhBoVM lw13i0JCW2DoZ6kL7RfQKfCUKJmzKSowX3P6hNtzMwM0QIcLZULhV7UXZfpvkLgMbe GX82nqWM2M+EU/silIPIJCvf1JayrysrK41kBrxihBqZLMjVAraviRm+Fjd/lnyT3W i6SDer+LVsblEX8tQwL2ugoFHTdH6mzTsk2XmB8fOZ8SLziB/AXngdvr+KWWbai3z4 WGSusGpK5Rsdw== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Jagan Teki , Vignesh R Subject: [PATCH] mtd: sf: Set SF parameters as env variables Date: Tue, 14 Sep 2021 05:28:49 +0200 Message-Id: <20210914032849.273625-1-marex@denx.de> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Set the SF page size, erase block size and total size as an environment variable after "sf probe". This lets us discern boards with multiple distinct SPI flash options and also e.g. set mtdparts accordingly. Signed-off-by: Marek Vasut Cc: Jagan Teki Cc: Vignesh R --- drivers/mtd/spi/spi-nor-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index d5d905fa5a1..448653b9931 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -3829,8 +3830,11 @@ int spi_nor_scan(struct spi_nor *nor) #ifndef CONFIG_SPL_BUILD printf("SF: Detected %s with page size ", nor->name); print_size(nor->page_size, ", erase size "); + env_set_hex("sf_pagesize", nor->page_size); print_size(nor->erase_size, ", total "); + env_set_hex("sf_erasesize", nor->erase_size); print_size(nor->size, ""); + env_set_hex("sf_size", nor->size); puts("\n"); #endif -- 2.33.0