Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9974EC47079 for ; Tue, 9 Jan 2024 17:41:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FF1A87A71; Tue, 9 Jan 2024 18:40:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=salutedevices.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=salutedevices.com header.i=@salutedevices.com header.b="lryiKOVv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6C79879E4; Tue, 9 Jan 2024 18:32:52 +0100 (CET) Received: from mx1.sberdevices.ru (mx1.sberdevices.ru [37.18.73.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 13806878E7 for ; Tue, 9 Jan 2024 18:32:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=salutedevices.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=avromanov@salutedevices.com Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 7771310000F; Tue, 9 Jan 2024 20:32:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 7771310000F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1704821568; bh=yQ7xT2RbwzAy787xriPpGwxc5cNdvmJ6A1uY6TaXVAo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=lryiKOVvq0ECd39jjzjsPgdV9z2x+8vFruFcMNnDcqVI6v1QJc7/VzWBE0gvnch11 sW6pr9yTGSEkYu0B2z1ub9PIpn3ZdDySiVsG5xLuboXqhort343T19tDTP4ltP19zs HjbzyGGhNs+4rxKqcX4sCHNGzvh2YYrhZZATuzfUEmd906LtHb7+o0K+FgwFOnIdrO sbQ7RERr03I9kWAx883TBsD0nbuqEYSxO24jqQkLmt3m6DitkeYzQYiwAl2YBcii77 XWTl79qDqQXD2Bl/kBBafVrurnOuw7+x1Cl6zA4ep1MqwU0D8ilDeHKvXvVgS2CMTq POPrGaA77VPjA== Received: from smtp.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Tue, 9 Jan 2024 20:32:48 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 9 Jan 2024 20:32:48 +0300 From: Alexey Romanov To: , , , , , , , , , , , , , , , , , , CC: , , Alexey Romanov Subject: [PATCH v2 05/14] spi: add board_nand_init() function Date: Tue, 9 Jan 2024 20:32:17 +0300 Message-ID: <20240109173231.78920-6-avromanov@salutedevices.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240109173231.78920-1-avromanov@salutedevices.com> References: <20240109173231.78920-1-avromanov@salutedevices.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 182518 [Jan 09 2024] X-KSMG-AntiSpam-Version: 6.1.0.3 X-KSMG-AntiSpam-Envelope-From: avromanov@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a, {Tracking_from_domain_doesnt_match_to}, smtp.sberdevices.ru:5.0.1,7.1.1; salutedevices.com:7.1.1; 100.64.160.123:7.1.2; 127.0.0.199:7.1.2; d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/01/09 15:14:00 #23039571 X-KSMG-AntiVirus-Status: Clean, skipped X-Mailman-Approved-At: Tue, 09 Jan 2024 18:40:45 +0100 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.8 at phobos.denx.de X-Virus-Status: Clean By analogy with RAW NAND drivers, select SYS_NAND_SELF_INIT option and implement board_nand_init() function. It will be called from nand_init(). Signed-off-by: Alexey Romanov --- drivers/mtd/nand/spi/Kconfig | 1 + drivers/mtd/nand/spi/core.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/mtd/nand/spi/Kconfig b/drivers/mtd/nand/spi/Kconfig index 0777dfdf0a..c9ca76a1c9 100644 --- a/drivers/mtd/nand/spi/Kconfig +++ b/drivers/mtd/nand/spi/Kconfig @@ -2,6 +2,7 @@ menuconfig MTD_SPI_NAND bool "SPI NAND device Support" depends on DM_MTD && DM_SPI select MTD_NAND_CORE + select SYS_NAND_SELF_INIT select SPI_MEM help This is the framework for the SPI NAND device drivers. diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 8ca33459f9..07e521dbf5 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1287,3 +1288,16 @@ U_BOOT_DRIVER(spinand) = { .priv_auto = sizeof(struct spinand_device), .probe = spinand_probe, }; + +void board_nand_init(void) +{ + struct udevice *dev; + int ret; + + ret = uclass_get_device_by_driver(UCLASS_SPI, + DM_DRIVER_GET(spinand), + &dev); + if (ret && ret != -ENODEV) + log_err("Failed to initialize SPI NAND driver. (error %d)\n", + ret); +} -- 2.30.1