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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 481C8C433EF for ; Wed, 29 Sep 2021 05:23:02 +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 59E54613A9 for ; Wed, 29 Sep 2021 05:23:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 59E54613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 B1E75831D8; Wed, 29 Sep 2021 07:22:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="IlzA2Kow"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B041831E7; Wed, 29 Sep 2021 07:22:56 +0200 (CEST) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (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 E8390831D6 for ; Wed, 29 Sep 2021 07:22:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tkuw584924@gmail.com Received: by mail-pl1-x62c.google.com with SMTP id j15so710770plh.7 for ; Tue, 28 Sep 2021 22:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6uJ/eQXHdFcu4s/QhOXBe68uO2Ob8pJ+f+a/MhzHEn0=; b=IlzA2Kow4ZON0Km6M21KX6wckHT8FMKdDu1SHnWuNlAwTUzYwLK327UhOIkj0I6tm0 mNlMFsf3Ms1EZZToTnST7mzcX9JO83cANAMdeRH1Ltg8LQpBeVQXj3nllf0alNTuHwn2 D7jx36lt1g6ubU9qT0VgYTG9Dp2EyyYvAp2DM/0Y3xvbQed8ZfaHzDYJWwk7t7aXWVJq 4+WA0Iyvl/KrHVnELhECTlFv0ptTVtR/pJqlruCt5td2t9u+Y0NY5syT9rpGByJTU/KN AjBsx2pdk2LRhxU0i+fm/2cXaIBZLNpmIRpfcCW/9IQXdOtnZzyptk2j6fmOejZKitH9 5oZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6uJ/eQXHdFcu4s/QhOXBe68uO2Ob8pJ+f+a/MhzHEn0=; b=7UDWn5xuafnyFf7eOAAhoI5E2A3/FeBUNTGJdCDupk1qSiKASYuRYLaUDgc94JUXr7 HbRg01odio9hoO/J1e3Y4Hk0o8FCMha0es6aaqewZdma/CfR4+kc01GbKduzUNZso9KH phU+TyFWMGwMQl6Z07y0uB7boWdCF/dnQMyCXn/V2cdBxTPpIUEptwkSqGOizEFaoWo+ ZOzOzwDpendQnbGoS/RIvJXP+TBF57YAJJbv9DsBUmCUFdflfOuvVISYrtDMy1e+52JC E+D2EPyfrbQiQxyIBoMZZ3jXWtMCzGXKM0/wedso1kEQtS8II8KTtX0h6ELjmV0ThTmV irQA== X-Gm-Message-State: AOAM530CKZYPem/0XVfVxJIlpB4pCvQ1x0VWDkWZQ2fO7+kwruR27PVd qddQjEk/CQBdrU764o+vE7M= X-Google-Smtp-Source: ABdhPJxYzdFtNnxnk/tje2yMhcS2goC7lq0X+Gy15udqZZGKwg73lWimLrsvzfd9VBHbTsPxwg4Eng== X-Received: by 2002:a17:90b:1e4d:: with SMTP id pi13mr4381074pjb.96.1632892971003; Tue, 28 Sep 2021 22:22:51 -0700 (PDT) Received: from [192.168.1.3] (fp76ee264d.knge102.ap.nuro.jp. [118.238.38.77]) by smtp.gmail.com with ESMTPSA id k1sm443305pjj.54.2021.09.28.22.22.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Sep 2021 22:22:50 -0700 (PDT) Subject: Re: [PATCH 2/2] mtd: spi-nor-core: Add fixups for Spansion S25FL256L To: Pratyush Yadav Cc: u-boot@lists.denx.de, jagan@amarulasolutions.com, vigneshr@ti.com, Bacem.Daassi@infineon.com, Takahiro Kuwano References: <518a2f98449bc956e0e3d6b19ff60b18b08d973a.1631088494.git.Takahiro.Kuwano@infineon.com> <20210917165114.uikwq65qrypidfug@ti.com> From: Takahiro Kuwano Message-ID: <5c517434-2cfd-185b-d675-7acc5c2a5b14@gmail.com> Date: Wed, 29 Sep 2021 14:22:35 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210917165114.uikwq65qrypidfug@ti.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 9/18/2021 1:51 AM, Pratyush Yadav wrote: > On 08/09/21 05:47PM, tkuw584924@gmail.com wrote: >> From: Takahiro Kuwano >> >> The S25FL256L is 32MB NOR Flash that does not support Bank Address >> Register. This fixup is activated if CONFIG_SPI_FLASH_BAR is enabled and >> returns ENOTSUPP in setup() hook to avoid further ops. >> >> Signed-off-by: Takahiro Kuwano >> --- >> drivers/mtd/spi/spi-nor-core.c | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c >> index d5d905fa5a..4940b35682 100644 >> --- a/drivers/mtd/spi/spi-nor-core.c >> +++ b/drivers/mtd/spi/spi-nor-core.c >> @@ -3222,6 +3222,23 @@ static struct spi_nor_fixups s25hx_t_fixups = { >> .post_bfpt = s25hx_t_post_bfpt_fixup, >> .post_sfdp = s25hx_t_post_sfdp_fixup, >> }; >> + >> +#ifdef CONFIG_SPI_FLASH_BAR >> +static int s25fl256l_setup(struct spi_nor *nor, const struct flash_info *info, >> + const struct spi_nor_flash_parameter *params) >> +{ >> + return -ENOTSUPP; /* Bank Address Register is not supported */ > > I am not very familiar with BAR. Can you please explain what would > happen if we don't do this? > The Bank Address Register (BAR) enables the 3-byte addressing opcodes to access beyond 16MB memory space by switching 16MB banks. If we don't do this, the spi-nor tries to use BAR with 3-byte addressing and the ops to the second half of 32MB will be performed in the first half of 32MB. >> +} >> + >> +static void s25fl256l_default_init(struct spi_nor *nor) >> +{ >> + nor->setup = s25fl256l_setup; >> +} >> + >> +static struct spi_nor_fixups s25fl256l_fixups = { >> + .default_init = s25fl256l_default_init, >> +}; >> +#endif >> #endif >> >> #ifdef CONFIG_SPI_FLASH_S28HS512T >> @@ -3644,6 +3661,10 @@ void spi_nor_set_fixups(struct spi_nor *nor) >> break; >> } >> } >> +#ifdef CONFIG_SPI_FLASH_BAR > > We should avoid using #ifdef as much as possible. Change this to > > if (CONFIG_IS_ENABLED(SPI_FLASH_BAR) && !strcmp()) > >> + if (!strcmp(nor->info->name, "s25fl256l")) >> + nor->fixups = &s25fl256l_fixups; >> +#endif > > *sigh* we really need to find a better way to specify fixups. Let me see > if I can figure something out. In the meantime, this should be fine. > >> #endif >> >> #ifdef CONFIG_SPI_FLASH_S28HS512T >> -- >> 2.25.1 >> >