Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp720543lqb; Wed, 17 Apr 2024 08:54:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSMrIYRscX+09x5vdQb+sVs4EcFrFyPwF611WwpaMjY9AR3oLzlhlJnDNPecfmgndZmmgdPstgWAxtjjRrcqpzLAJqOp2aGwNnwG7gDw== X-Google-Smtp-Source: AGHT+IHANFyUQtEsYQlgB72eNnxicwsVQ0p2+B9LyA6FFPyAfEYhaQXE50JVBYWfqHDPtqJQSQrP X-Received: by 2002:a17:902:ce0e:b0:1e4:7ca3:8a33 with SMTP id k14-20020a170902ce0e00b001e47ca38a33mr18549938plg.17.1713369279687; Wed, 17 Apr 2024 08:54:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713369279; cv=pass; d=google.com; s=arc-20160816; b=L2OlMHcL8om7cLMXcO1fC147kkDlUyGHieRVEKmKArXGb1o0nUpjjtauwndPMwX6jT aFSZgDDABXfIeonXLYIDu6PiMQ59rjigg5IEDvA2NFLINrD55HzcSazojc2vZRJDs5oy bbQyBqP5QcUYsWKPK5Vqgw5IWg/kCP+GW0y0uKkaYOXlFWYfoYvORVU1U8Q4TqolvDE1 vLe1Q/6plRt7oiyI2PATyTlBLyYH2MnEmlit1WKAKe/T+OjKWKd7RYZYfFrQkhWcTdWS iD0PjYWtfzrBt6hfnJAFw1HYxGD+8wo3SzhJW2ihdDd+MnzyDEalHETwXGLEuAC6Tg9k cG+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=SNlZSFEJjYJto6hln/JY/17CSGbrwXclo3FEtIYOJAs=; fh=r8L5bXDsBG/bRUCI0fySNuvIQQUALttCCAl1LUs2PY8=; b=RxXQNcnWmLEF/2MXxE4CQIlcS3Vh2iB6GErbCm6WDYxyCGdX3ZIsHUhtwbeLCtKUnl JNJ8AO0kpFFOE6koWV8cUvjRbjhb9X380hDx4APJSCKu7bT+zAkyA3Y6wmT6ysFCI+HS YA5NdRqPrX/MvuWqPj42I7eImSE76U27NpNCmAVseNaHpnqQUL/qc1TGbqTUEZuRNLXS GT77PGD34rriyBKD/QnhOZUNDHJTGm170UEwfEAFKgD2aF1tdil2hjgCcRISVVqWosxU qbZphL713WFyp1KvNX3AGwJE3yWsKHprgPuv3NVIM/EFS8CHv1yBKw+b1Jg/rGtFS5+Y uMSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ciwVHW4n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148858-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b5-20020a170902d50500b001e3e0286372si11876052plg.69.2024.04.17.08.54.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 08:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148858-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ciwVHW4n; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148858-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 86970284B10 for ; Wed, 17 Apr 2024 15:53:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 735FE1487CF; Wed, 17 Apr 2024 15:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ciwVHW4n" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8457313F42C for ; Wed, 17 Apr 2024 15:52:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369171; cv=none; b=cGXYdDWcFKXyIA9POhab04NWbtPg3C9bmMLI5lu6ph3x196IeC5mhqK4/sdTaz9bl+yp4W2Oge1AQahLpKqVleKeePlWC8AKP07ENv1nXkrfEx4729tMBXZkNvO0pJSmatoZEn8yD7sYv4suHmFnJZ8n1uhrE8LN7etdSDUJ/cE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369171; c=relaxed/simple; bh=PPbz4GQko4hF53ZUDpAq+ldibdDOErHuto8pYcPk6q4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Ap0LeXU4gAzTvLamMQTxPPVU8QcmTZn4Cr3vzg/DX21OuRz30da2BNygyUJKmMEf9y4ixeeXQMnvPSB+5tIhzwculqzsIsKqpitUuOpmChSJMhGHDpYl6x28Qy2DRz7s5MAXTY2/WBVKxBJCh2F18sudZNoFQRC3cQW/nhOIuTA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ciwVHW4n; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD53DC072AA; Wed, 17 Apr 2024 15:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713369171; bh=PPbz4GQko4hF53ZUDpAq+ldibdDOErHuto8pYcPk6q4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ciwVHW4n6USeccR2haG+D9uXoealdrd0Z+p3ZSgcrNU41N+kELim1UB/hvy0LvOcz LeHPNW3ddo4z4H0/t2ZtSd24wleMkGWd7wAujY42CmqIxhNEdZPorzVjueE5CHtTpx u6nDRs7PIkmzrg4ilIPlsYIOZ/0hP46tVzjVhGnw3BOMD62Tj1+Y2QDMniZpY7mXN5 5jr2vHcCOFF/mMMY+5WMXiltp2w1pPb22BZkUNwerGMrPhPDHAGWvduDGP4f2dJY/O 9dK5gZFCrBUPRtkigrvWm78FqcL2KeVulVIl+PnfOLcnt7uYy+oHH5iK9FZUYvS8Q4 8qSJKPs4YDNbw== From: Pratyush Yadav To: "Michael Walle" Cc: "Pratyush Yadav" , "Tudor Ambarus" , "Miquel Raynal" , "Richard Weinberger" , "Vignesh Raghavendra" , , Subject: Re: [RFC PATCH v1 6/6] mtd: spi-nor: introduce support for displaying deprecation message In-Reply-To: (Michael Walle's message of "Wed, 17 Apr 2024 16:52:42 +0200") References: <20240412134405.381832-1-mwalle@kernel.org> <20240412134405.381832-7-mwalle@kernel.org> Date: Wed, 17 Apr 2024 17:52:48 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Wed, Apr 17 2024, Michael Walle wrote: > Hi, > > On Wed Apr 17, 2024 at 4:36 PM CEST, Pratyush Yadav wrote: >> On Fri, Apr 12 2024, Michael Walle wrote: >> >> > SPI-NOR will automatically detect the attached flash device most of the >> > time. We cannot easily find out if boards are using a given flash. >> > Therefore, introduce a (temporary) flag to display a message on boot if >> >> Why temporary? There will always be a need to deprecate one flash or >> another. Might as well keep the flag around. > > Mh, yes I agree. That also means that this flag will not have any > users (most) of the time (hopefully ;) ). > >> Also, this patch/series does not add any users of the deprecated flag. >> If you have some flashes in mind, it would be good to add them to the >> patch/series. > > This is just an RFC to see if whether you Tudor agree with me :) But > I was about to add it to the evervision/cypress FRAMs. > >> I like the idea in general. Do you think we should also print a rough >> date for the deprecation as well? > > Might make sense, any suggestions? How about a simple string to flash_info? /** * struct flash_info - SPI NOR flash_info entry. * @id: pointer to struct spi_nor_id or NULL, which means "no ID" (mostly * older chips). * @name: (obsolete) the name of the flash. Do not set it for new additions. * @size: the size of the flash in bytes. * @deprecation_date: The date after which the support for this flash will be * removed. * [...] */ struct flash_info { char *name; const struct spi_nor_id *id; char *deprecation_date; [...] } And then in everspin.c for example, { .name = "mr25h128", .size = SZ_16K, .sector_size = SZ_16K, .addr_nbytes = 2, .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, .deprecation_date = "2025-01-01", }, { And in spi_nor_get_flash_info() (changed some wording of the message): info = jinfo ?: info; if (info->deprecation_date) pr_warn("Your board or device tree is using a SPI NOR flash (%s) with\n" "deprecated driver support. It can be removed in any kernel\n" "version after %s. If you feel this shouldn't be the case, please contact\n" "us at linux-mtd@lists.infradead.org\n", info->name, info->deprecation_date); return info; This would also remove the need for SPI_NOR_DEPRECATED. But it would make the flash_info 4 or 8 bytes larger. What do you think? > >> > support for a given flash device is scheduled to be removed in the >> > future. >> > >> > Signed-off-by: Michael Walle >> > --- >> > drivers/mtd/spi-nor/core.c | 12 ++++++++++++ >> > drivers/mtd/spi-nor/core.h | 1 + >> > 2 files changed, 13 insertions(+) >> > >> > diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c >> > index 58d310427d35..a294eef2e34a 100644 >> > --- a/drivers/mtd/spi-nor/core.c >> > +++ b/drivers/mtd/spi-nor/core.c >> > @@ -3312,6 +3312,7 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, >> > const char *name) >> > { >> > const struct flash_info *jinfo = NULL, *info = NULL; >> > + const char *deprecated = NULL; >> > >> > if (name) >> > info = spi_nor_match_name(nor, name); >> > @@ -3326,6 +3327,17 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor, >> > return jinfo; >> > } >> > >> > + if (info && (info->flags & SPI_NOR_DEPRECATED)) >> > + deprecated = info->name; >> > + else if (jinfo && (jinfo->flags & SPI_NOR_DEPRECATED)) >> > + deprecated = jinfo->name; >> > + >> > + if (deprecated) >> > + pr_warn("Your board or device tree is using a SPI NOR flash (%s) with\n" >> > + "deprecated driver support. It will be removed in future kernel\n" >> >> Nit: "removed in a future kernel version" >> >> > + "version. If you feel this shouldn't be the case, please contact\n" >> > + "us at linux-mtd@lists.infradead.org\n", deprecated); >> > + >> >> Hmm, this isn't so nice. I'd suggest doing something like: >> >> /* >> * If caller has specified name of flash model that can normally be >> * ... >> */ >> info = jinfo ?: info; >> >> if (info->flags & SPI_NOR_DEPRECATED) >> pr_warn(...); > > Actually, I had that, *but* I was thinking we might only check the > detected flash and not the one specified in the device tree. But > thinking about that again, I guess it makes sense because: > - that's the actually used flash driver > - having jinfo != info will print that other warning, thus this > case is hopefully very unlikely. > >> >> return info; >> >> > /* >> > * If caller has specified name of flash model that can normally be >> > * detected using JEDEC, let's verify it. >> > diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h >> > index 8552e31b1b07..0317d8e253f4 100644 >> > --- a/drivers/mtd/spi-nor/core.h >> > +++ b/drivers/mtd/spi-nor/core.h >> > @@ -524,6 +524,7 @@ struct flash_info { >> > #define SPI_NOR_NO_ERASE BIT(6) >> > #define SPI_NOR_QUAD_PP BIT(8) >> > #define SPI_NOR_RWW BIT(9) >> > +#define SPI_NOR_DEPRECATED BIT(15) >> >> If you do agree with my suggestion of making it permanent, would it make >> more sense to make it BIT(10) instead. Or BIT(9) once you move up the >> others because we no longer have BIT(7). > > Or just BIT(7) and avoid any code churn :) Yep, that works. > > -michael > >> >> > >> > u8 no_sfdp_flags; >> > #define SPI_NOR_SKIP_SFDP BIT(0) > -- Regards, Pratyush Yadav