Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp677758lqb; Wed, 17 Apr 2024 07:53:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+WwGDpE2bVZ8ftf6FzrXt6ou7hrQBTpaitUUl5zwFVPKriSkcvQ3XRBNKSxc0LwwaN63Ronu0QjjPVkFBul5HraQbQwJWUWJvRMKUFQ== X-Google-Smtp-Source: AGHT+IH0DLuyTeM2Oz6w1IID64uRwPMqRsAuhbvzNeYc4sK7rDPGerjcG7MS2UuHqD7xaLqfUs5l X-Received: by 2002:ac2:520d:0:b0:516:c3ee:5c79 with SMTP id a13-20020ac2520d000000b00516c3ee5c79mr9608918lfl.37.1713365610236; Wed, 17 Apr 2024 07:53:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713365610; cv=pass; d=google.com; s=arc-20160816; b=VSTPQ5mJeqBbEUixEge5AT+NLmWXm4kupJPHzZO15XqtLJ6/oR1vREijJgSJ/ICI7r NbW0DuDjenu8e4FJgPZD9XvuHqg6RzFK8SpMJHdblnPX2LFiGe5PuH1clSJ5u1FA079O PvxTwQJHUrVXt1ES+J2UqfWQzt4Ym8+zjuo2Gp42S3L3q9dpdJLgiN5/1o8xUHHJb7Zp ZlE8QdT/i2BLipsQBJ9IlZzOuRj4fTP3xbapuwBnFvP+JBhAb+yjmZjYVgHa967liwyb VcpeWuuZO0yE2dzkJrcBUZmhUbxA49GmSbtLOD/MEnwKt4dp6ogR86U58aCj3i7VSKdK GjBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to :references:cc:subject:to:from:message-id:date:dkim-signature; bh=09zSr89jTMy9IhkoaMEasAlCNiouIlFBY9dcUEbOWaM=; fh=1SDVfkBGDA342wMI4LZQ8OJJBKd5uYMDJncmsiNwQ9g=; b=yXpl1r9ipD/bo6XAMbjKP335Jqni18qT8DYNkwSM+3tCae46nGSPu/AMmU1FEK5Uew VDdK64+pVi7bxoP2QUs0zfNF1VYKjQvz/i8UiX5rBm6bMrzZuaAr1bJR3k/tl2iRsqKu idpDV/gGO+6ljGtSqGyf53RzmyjFJWAaGOqUmoiA7JpTtOsUU9Y93bh0fSWgOqY0oBf9 VdsbGTIWzc+acQA/QdMPb6aF4OES9mgVPVJQ2/ls8Sgq60nV6xGpO6ZinxD/EaJrWzey YyE/JkW8kuWKJsdx0I/9BuC5eogAopGZ/9DqTqYZ1/gpxtuvKOqGO4AcnymwbwJ4SS/p uFDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oqea5TbB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bj22-20020a170906b05600b00a55577bf9e9si771716ejb.283.2024.04.17.07.53.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oqea5TbB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148733-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C2EF21F22206 for ; Wed, 17 Apr 2024 14:53:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E2EE1422D1; Wed, 17 Apr 2024 14:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oqea5TbB" 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 296031411CA for ; Wed, 17 Apr 2024 14:52:46 +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=1713365566; cv=none; b=g1zEZquf/2eJeW8GwMvfS4VkkmfPwd9PH0nU7d/5I09QRDwFskCIbv/9jjVxWycTOlWGDuhRF2TZWw16HsBkBd2bAj8wrGNy5vTeqw6GjtAMrlhDM8wZiI+Er69UPrQkTPWbUYj8rv49gugFa1fp04O9z2rlH3oNqJKVqCJor3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713365566; c=relaxed/simple; bh=1HgaS+nDZFRHl/RIdVOdvy6E21/5+MqUrX5IPEQaVJ8=; h=Content-Type:Date:Message-Id:From:To:Subject:Cc:References: In-Reply-To; b=lHp9iiJQvYkurr/sDNtLHbxl50zj/Nes/1T9D4XxoBfRD0LJli3ISdLz6V+g5r6mvoyJwtgAkogkWwvWuR85Gn/EDbxtnEMXrRY4Fjv/5Pila0AoPgZYkGGG16EyjI/bIeefwC91LLsqu6LjMazX2GJi5ifnLLsZ81hzvCGujvM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oqea5TbB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9F89C072AA; Wed, 17 Apr 2024 14:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713365566; bh=1HgaS+nDZFRHl/RIdVOdvy6E21/5+MqUrX5IPEQaVJ8=; h=Date:From:To:Subject:Cc:References:In-Reply-To:From; b=oqea5TbBb5nNM25HaRBloDKRmLJmRPyMGQpkY01KHNsWgfF09RTGH0uApUt07Yd7y Ksh5u1LKo085w9zJVJI376QMlCzKFTe2ua2fdMzKfpeUSQVO/bbtZ3G8xiZGRRzR8h K3V3CuosWh4bTPKNYP9BTr/IkA2peCvrX2aBcPJmzUYvHMa++X1F2cRS1BD/p2v121 mAK0OO07GNlT1nNkrxVyTDZcHwGk+Tc+Jj6tivM6gGEMhmmI+1rBq5ljXPRqhHPDJP yPJb4gWmObyYHB1g8SAElyW9JlyXcj7vWSTNrP/eVf6rbCOsK/jVI0xX4X0yM3kJOd pBA4WWkVa5Ruw== Content-Type: multipart/signed; boundary=708fc41844f140b3d840031632678d0e44008df68536d14dad2e9ff8531b; micalg=pgp-sha384; protocol="application/pgp-signature" Date: Wed, 17 Apr 2024 16:52:42 +0200 Message-Id: From: "Michael Walle" To: "Pratyush Yadav" Subject: Re: [RFC PATCH v1 6/6] mtd: spi-nor: introduce support for displaying deprecation message Cc: "Tudor Ambarus" , "Miquel Raynal" , "Richard Weinberger" , "Vignesh Raghavendra" , , X-Mailer: aerc 0.16.0 References: <20240412134405.381832-1-mwalle@kernel.org> <20240412134405.381832-7-mwalle@kernel.org> In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: --708fc41844f140b3d840031632678d0e44008df68536d14dad2e9ff8531b Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 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? > > 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 =3D NULL, *info =3D NULL; > > + const char *deprecated =3D NULL; > > =20 > > if (name) > > info =3D spi_nor_match_name(nor, name); > > @@ -3326,6 +3327,17 @@ static const struct flash_info *spi_nor_get_flas= h_info(struct spi_nor *nor, > > return jinfo; > > } > > =20 > > + if (info && (info->flags & SPI_NOR_DEPRECATED)) > > + deprecated =3D info->name; > > + else if (jinfo && (jinfo->flags & SPI_NOR_DEPRECATED)) > > + deprecated =3D jinfo->name; > > + > > + if (deprecated) > > + pr_warn("Your board or device tree is using a SPI NOR flash (%s) wit= h\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 =3D 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 !=3D 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 :) -michael > > > =20 > > u8 no_sfdp_flags; > > #define SPI_NOR_SKIP_SFDP BIT(0) --708fc41844f140b3d840031632678d0e44008df68536d14dad2e9ff8531b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iKgEABMJADAWIQTIVZIcOo5wfU/AngkSJzzuPgIf+AUCZh/iOhIcbXdhbGxlQGtl cm5lbC5vcmcACgkQEic87j4CH/jTJwF+MfXaY0rJxf8esRAeR/YyzqP24TH0YPAh rK75nCQk3ECO68GvG9Pk9Cj8/1uETtabAX97iBpwzQ1wB70yIGZin+I20ATWcX1W hLecMdn8ML3b9cyRUNpKYaAxe2fUQLjZPZA= =237x -----END PGP SIGNATURE----- --708fc41844f140b3d840031632678d0e44008df68536d14dad2e9ff8531b--