From patchwork Thu Sep 16 14:01:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 1528858 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=kjI4GbHQ; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H9JfZ63Bnz9svs for ; Fri, 17 Sep 2021 00:01:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE02E83129; Thu, 16 Sep 2021 16:01:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.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=foss.st.com header.i=@foss.st.com header.b="kjI4GbHQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C6DA983124; Thu, 16 Sep 2021 16:01:32 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 DB81C8314A for ; Thu, 16 Sep 2021 16:01:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=3893bebd9f=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18GCL68w029363; Thu, 16 Sep 2021 16:01:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=j+RHXFIcqGGoca0nwFDsyohCJ/TZecZ4hc/nw82uHks=; b=kjI4GbHQUQcYKvbg3dV8+9WKxcW9dOboDkex8EDLWnS/RjHao/ZfTdxdL7Jq0bUKeEjJ VNfwmLgCGJkTCaax357xZiN8VGIjIr9CyF5abLDt9DCoK8dtFLBlnbINUzriPeGmtvvA eHWovFhoACX13BTJtoNCTcpCJxSDWyyLGmZmRwvCVwBVSGxNmwwT+EN1XE/gBrVfrkoC 13YbGPNlTKWxYFiYIAt8haDlGFZ6zVYttohRTVSCOoMvkYuSevf+x3iy3vViJeP1kzV2 RQvL/CHEq+xk8ZjHxuW95CTWl7BDkxKX1R+wj8hI79ML+o3JTRB3df0Z1kcPiePGOV1r ZA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 3b41kutcud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Sep 2021 16:01:22 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0E0DD100034; Thu, 16 Sep 2021 16:01:22 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0464020FA59; Thu, 16 Sep 2021 16:01:22 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Sep 2021 16:01:22 +0200 From: Patrick Delaunay To: CC: Priyanka Jain , Heiko Schocher , Marek Vasut , Jagan Teki , Miquel Raynal , Christophe KERELLO , Patrice Chotard , =?utf-8?q?Pali_Roh=C3=A1r?= , Patrick Delaunay , U-Boot STM32 Subject: [PATCH v3 1/2] mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported Date: Thu, 16 Sep 2021 16:01:17 +0200 Message-ID: <20210916155040.v3.1.I81b4f1edfe925b001299e3b7ba0cf602d9268d59@changeid> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916140118.874028-1-patrick.delaunay@foss.st.com> References: <20210916140118.874028-1-patrick.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-16_04,2021-09-16_01,2020-04-07_01 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 When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated, CONFIG_SYS_MAX_FLASH_BANKS is replaced by cfi_flash_num_flash_banks, but this variable is defined in drivers/mtd/cfi_flash.c, which is compiled only when CONFIG_FLASH_CFI_DRIVER is activated, in U-Boot or in SPL when CONFIG_SPL_MTD_SUPPORT is activated. This patch deactivates this feature CONFIG_SYS_MAX_FLASH_BANKS_DETECT when flash cfi driver is not activated to avoid compilation issue in the next patch, when CONFIG_SYS_MAX_FLASH_BANKS is used in spi_nor_scan(). Signed-off-by: Patrick Delaunay --- see error in https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138 drivers/mtd/spi/spi-nor-core.o: in function `spi_nor_scan': drivers/mtd/spi/spi-nor-core.c:3672: undefined reference to `cfi_flash_num_flash_banks' compilation issue for the boards: - j721e_hs_evm_r5 - j721e_evm_r5j - j721e_hs_evm_a72 - j721e_evm_a72 - sagem_f@st1704_ram Changes in v3: - NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used include/mtd/cfi_flash.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h index 4963c89642..a1af6fc200 100644 --- a/include/mtd/cfi_flash.h +++ b/include/mtd/cfi_flash.h @@ -157,11 +157,17 @@ struct cfi_pri_hdr { * Use CONFIG_SYS_MAX_FLASH_BANKS_DETECT if defined */ #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT) -#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks) #define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT +/* map to cfi_flash_num_flash_banks only when supported */ +#if IS_ENABLED(CONFIG_FLASH_CFI_DRIVER) && \ + (!IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_SPL_MTD_SUPPORT)) +#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks) /* board code can update this variable before CFI detection */ extern int cfi_flash_num_flash_banks; #else +#define CONFIG_SYS_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT +#endif +#else #define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS #endif