From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96326C28B22 for ; Thu, 6 Mar 2025 09:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4X+FnHVpWzWW4W0hGDVyaY0sBAjRDXZg/ShUEe46pbo=; b=xLvzt2+L4nSNMA0xrndT/AtPHl rP+RJ7wUJzhT6J2kS9i8GwxLtzFSmzoxzDtdIcojdxO1ZKuh/Z/SYslN9XLBSoHu6oRuRTvJ8Qs8b AKN4VR3bHkWkeFjmWtKb6IGrNq6Rl2D+jWLaxVBLpwPcIqarb6zHrarAYo790EVbZUwSJ2LkWSXIt GrhocVa2oSuQHwYHy+uSMvaba89mn4SjNJy01LjDjRXE+JyaO7j1pLkCDc1uWZ39KL7XB3QIkxRUI +bXjqSK7aergTLgMf3Zy6WWgukdPQkSNCawSURuOtwwaTwi823KvCMMxfBK8kZmYDi1KqJfNs/mcn FOh5SwHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tq7qX-0000000AXPI-451c; Thu, 06 Mar 2025 09:48:54 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tq6go-0000000ALw1-37Sy; Thu, 06 Mar 2025 08:34:47 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 435F744267; Thu, 6 Mar 2025 08:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741250083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4X+FnHVpWzWW4W0hGDVyaY0sBAjRDXZg/ShUEe46pbo=; b=mF8P6ZyAPX08OLt4l16Kpo2v7XG2grorpNpUUF2ND52CndXRHfjFV0oy/0WjBehTD5VZE7 f+mraZVyAQQPAt4SFEev/YX24UWI4LhjvB3GTRNaQ4YNrbhNUIVGK3QsMawpwpYOW9obEh RsMG6stsKk68DAv6eZY+InvMQF3LSz7/wKKtC+ZkE41HylBQNUuEYyUYSSnscCKfXdnNsV DWqFrp872aRrtLF8IuGFzj8oqNxq61u+Kl1ye0+RDclKmW4kGejtdp8d/4RwrLRPeiOhiS DLrtSBWgq6iM6miU7AmQNzvXBkHjT5nT88HacGvinpbJAQMAPOlu57ikZO4d+A== From: Miquel Raynal To: Subject: Re: [PATCH 1/2] mtd: spi-nor: sst: register SFDP region into NVMEM framework to read MAC Address In-Reply-To: <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> (Manikandan M.'s message of "Thu, 6 Mar 2025 07:09:44 +0000") References: <20250305100134.1171124-1-manikandan.m@microchip.com> <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Thu, 06 Mar 2025 09:34:41 +0100 Message-ID: <87eczawo9q.fsf@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-State: clean X-GND-Score: 0 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdejvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreejnecuhfhrohhmpefoihhquhgvlhcutfgrhihnrghluceomhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepffeghfejtdefieeguddukedujeektdeihfelleeuieeuveehkedvleduheeivdefnecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudejpdhrtghpthhtohepofgrnhhikhgrnhgurghnrdfosehmihgtrhhotghhihhprdgtohhmpdhrtghpthhtohepmhifrghllhgvsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehrohgshheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepkhhriihkodgutheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheptghonhhorhdoughtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopefpihgtohhlrghsrdfhvghrrhgvsehmihgtrhhotghhihhprdgto hhmpdhrtghpthhtoheprghlvgigrghnughrvgdrsggvlhhlohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopegtlhgruhguihhurdgsvgiinhgvrgesthhugihonhdruggvvh X-GND-Sasl: miquel.raynal@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_003446_911920_4A4087F4 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robh@kernel.org, conor+dt@kernel.org, mwalle@kernel.org, vigneshr@ti.com, devicetree@vger.kernel.org, richard@nod.at, linux-kernel@vger.kernel.org, alexandre.belloni@bootlin.com, tudor.ambarus@linaro.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, claudiu.beznea@tuxon.dev, Varshini.Rajendran@microchip.com, krzk+dt@kernel.org, pratyush@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org >>> +static int sst26vf_nor_post_sfdp(struct spi_nor *nor) >>> +{ >>> + struct nvmem_device *nvmem; >>> + >>> + sst26vf_sfdp_nvmem_config.dev =3D nor->dev; >>> + sst26vf_sfdp_nvmem_config.size =3D nor->sfdp->num_dwords * sizeof= (*nor->sfdp->dwords); >>> + sst26vf_sfdp_nvmem_config.priv =3D nor; >>> + sst26vf_sfdp_nvmem_config.reg_read =3D sst26vf_sfdp_mac_addr_read; >>> + >>> + nvmem =3D devm_nvmem_register(nor->dev, &sst26vf_sfdp_nvmem_confi= g); >>> + if (IS_ERR(nvmem)) { >>> + dev_err(nor->dev, "failed to register NVMEM device: %ld\n= ", PTR_ERR(nvmem)); >>> + return PTR_ERR(nvmem); >>=20 >> I don't think it makes sense to have this one-off in a particular >> driver. If at all, this should be handled in the core. Sorry, but >> this really looks like an ugly hack. >>=20 > > Because the EUI identifier within the SFDP is unique to the=20 > SST26VF064BEUI flash, I opted to handle it here rather than in the core. > > Also here the MAC address data resides within the 0x260-0x26F range, I=20 > will resize the nvmem_config.size to 0x10 instead of registering the=20 > full SFDP region as NVMEM. Open question to all parties in this thread: how do we give an offset in the device tree that is relative to the sfdp region and not the data region? I believe we care not to mix these areas while describing. Thanks, Miqu=C3=A8l From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F8CFC282D1 for ; Thu, 6 Mar 2025 09:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xjVNnr4IJ0KNB5qQ/o7Swt9jn3dqAW7pnCiVW4xDeSY=; b=MMbzWRhqVy6Uxh HLMpOsN8DuEQvgg52FBg1VdYbK6ZVs08GLuElzTLp4FqE3igwCiPD58WR4UMehP0mP63UW2BPUoyq /Jh9UcvaHaKcK7LUtDrgOxClxX0MyxHZ+bgZAUTGmbE/zu4A4vNhcSnxCv78yl6U4vigvqT7AJKws LgDXS5mzAh4EBCPPm7VVBlJ4wPrxvOj3eBCJZhQZykx/FWLNlrHwnmPuTpB9L64YC8TS/Fz9rR4ve WpABOl7rwIUiGwP+nGaOGbtu4gfo861f0LzPz0lZfDif0YPHQYBiu6a76PiRp2zKEgAnQOOWfQpZM 0+3KXJPqPootupJHMzCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tq7qY-0000000AXPo-2xdH; Thu, 06 Mar 2025 09:48:54 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tq6go-0000000ALw1-37Sy; Thu, 06 Mar 2025 08:34:47 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 435F744267; Thu, 6 Mar 2025 08:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741250083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4X+FnHVpWzWW4W0hGDVyaY0sBAjRDXZg/ShUEe46pbo=; b=mF8P6ZyAPX08OLt4l16Kpo2v7XG2grorpNpUUF2ND52CndXRHfjFV0oy/0WjBehTD5VZE7 f+mraZVyAQQPAt4SFEev/YX24UWI4LhjvB3GTRNaQ4YNrbhNUIVGK3QsMawpwpYOW9obEh RsMG6stsKk68DAv6eZY+InvMQF3LSz7/wKKtC+ZkE41HylBQNUuEYyUYSSnscCKfXdnNsV DWqFrp872aRrtLF8IuGFzj8oqNxq61u+Kl1ye0+RDclKmW4kGejtdp8d/4RwrLRPeiOhiS DLrtSBWgq6iM6miU7AmQNzvXBkHjT5nT88HacGvinpbJAQMAPOlu57ikZO4d+A== From: Miquel Raynal To: Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH 1/2] mtd: spi-nor: sst: register SFDP region into NVMEM framework to read MAC Address In-Reply-To: <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> (Manikandan M.'s message of "Thu, 6 Mar 2025 07:09:44 +0000") References: <20250305100134.1171124-1-manikandan.m@microchip.com> <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Thu, 06 Mar 2025 09:34:41 +0100 Message-ID: <87eczawo9q.fsf@bootlin.com> MIME-Version: 1.0 X-GND-State: clean X-GND-Score: 0 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdejvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreejnecuhfhrohhmpefoihhquhgvlhcutfgrhihnrghluceomhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepffeghfejtdefieeguddukedujeektdeihfelleeuieeuveehkedvleduheeivdefnecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudejpdhrtghpthhtohepofgrnhhikhgrnhgurghnrdfosehmihgtrhhotghhihhprdgtohhmpdhrtghpthhtohepmhifrghllhgvsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehrohgshheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepkhhriihkodgutheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheptghonhhorhdoughtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopefpihgtohhlrghsrdfhvghrrhgvsehmihgtrhhotghhihhprdgto hhmpdhrtghpthhtoheprghlvgigrghnughrvgdrsggvlhhlohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopegtlhgruhguihhurdgsvgiinhgvrgesthhugihonhdruggvvh X-GND-Sasl: miquel.raynal@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250306_003446_911920_4A4087F4 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org Cj4+PiArc3RhdGljIGludCBzc3QyNnZmX25vcl9wb3N0X3NmZHAoc3RydWN0IHNwaV9ub3IgKm5v cikKPj4+ICt7Cj4+PiArICAgICBzdHJ1Y3QgbnZtZW1fZGV2aWNlICpudm1lbTsKPj4+ICsKPj4+ ICsgICAgIHNzdDI2dmZfc2ZkcF9udm1lbV9jb25maWcuZGV2ID0gbm9yLT5kZXY7Cj4+PiArICAg ICBzc3QyNnZmX3NmZHBfbnZtZW1fY29uZmlnLnNpemUgPSBub3ItPnNmZHAtPm51bV9kd29yZHMg KiBzaXplb2YoKm5vci0+c2ZkcC0+ZHdvcmRzKTsKPj4+ICsgICAgIHNzdDI2dmZfc2ZkcF9udm1l bV9jb25maWcucHJpdiA9IG5vcjsKPj4+ICsgICAgIHNzdDI2dmZfc2ZkcF9udm1lbV9jb25maWcu cmVnX3JlYWQgPSBzc3QyNnZmX3NmZHBfbWFjX2FkZHJfcmVhZDsKPj4+ICsKPj4+ICsgICAgIG52 bWVtID0gZGV2bV9udm1lbV9yZWdpc3Rlcihub3ItPmRldiwgJnNzdDI2dmZfc2ZkcF9udm1lbV9j b25maWcpOwo+Pj4gKyAgICAgaWYgKElTX0VSUihudm1lbSkpIHsKPj4+ICsgICAgICAgICAgICAg ZGV2X2Vycihub3ItPmRldiwgImZhaWxlZCB0byByZWdpc3RlciBOVk1FTSBkZXZpY2U6ICVsZFxu IiwgUFRSX0VSUihudm1lbSkpOwo+Pj4gKyAgICAgICAgICAgICByZXR1cm4gUFRSX0VSUihudm1l bSk7Cj4+IAo+PiBJIGRvbid0IHRoaW5rIGl0IG1ha2VzIHNlbnNlIHRvIGhhdmUgdGhpcyBvbmUt b2ZmIGluIGEgcGFydGljdWxhcgo+PiBkcml2ZXIuIElmIGF0IGFsbCwgdGhpcyBzaG91bGQgYmUg aGFuZGxlZCBpbiB0aGUgY29yZS4gU29ycnksIGJ1dAo+PiB0aGlzIHJlYWxseSBsb29rcyBsaWtl IGFuIHVnbHkgaGFjay4KPj4gCj4KPiBCZWNhdXNlIHRoZSBFVUkgaWRlbnRpZmllciB3aXRoaW4g dGhlIFNGRFAgaXMgdW5pcXVlIHRvIHRoZSAKPiBTU1QyNlZGMDY0QkVVSSBmbGFzaCwgSSBvcHRl ZCB0byBoYW5kbGUgaXQgaGVyZSByYXRoZXIgdGhhbiBpbiB0aGUgY29yZS4KPgo+IEFsc28gaGVy ZSB0aGUgTUFDIGFkZHJlc3MgZGF0YSByZXNpZGVzIHdpdGhpbiB0aGUgMHgyNjAtMHgyNkYgcmFu Z2UsIEkgCj4gd2lsbCByZXNpemUgdGhlIG52bWVtX2NvbmZpZy5zaXplIHRvIDB4MTAgaW5zdGVh ZCBvZiByZWdpc3RlcmluZyB0aGUgCj4gZnVsbCBTRkRQIHJlZ2lvbiBhcyBOVk1FTS4KCk9wZW4g cXVlc3Rpb24gdG8gYWxsIHBhcnRpZXMgaW4gdGhpcyB0aHJlYWQ6IGhvdyBkbyB3ZSBnaXZlIGFu IG9mZnNldCBpbgp0aGUgZGV2aWNlIHRyZWUgdGhhdCBpcyByZWxhdGl2ZSB0byB0aGUgc2ZkcCBy ZWdpb24gYW5kIG5vdCB0aGUgZGF0YQpyZWdpb24/IEkgYmVsaWV2ZSB3ZSBjYXJlIG5vdCB0byBt aXggdGhlc2UgYXJlYXMgd2hpbGUgZGVzY3JpYmluZy4KClRoYW5rcywKTWlxdcOobAoKX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCkxpbnV4IE1U RCBkaXNjdXNzaW9uIG1haWxpbmcgbGlzdApodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9tYWls bWFuL2xpc3RpbmZvL2xpbnV4LW10ZC8K From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 E7F1C19C54C; Thu, 6 Mar 2025 08:34:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741250087; cv=none; b=agbD6cDchAX6IXpSnL3hHBAamGQvLZq034GWGTAnxNDgE0AMccaoosSD8AhcjlBh1MWmk6gDDCXHgpfYx4VbZZdZjkHX5qgQpWrEThxrNF4uPyaESUuYcD3Kpa3FrBRUM0PgUURtlpxVxbsuAvfn338OCDzqgKa3iYYMPQ7lFAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741250087; c=relaxed/simple; bh=gBbw0fjQDznlJtTVw1BdqqMtyMCcthJvjl2WCmyzYyU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=enK1d1v64yVmfeRsCsU1lAtkbQlNTr4CAK7pM5DfarXoY/2ZW/zeB5wEbLoicmV4XlEzNodsNLp3BP8uT6VJC313dvd57Wq0lPG5O7U8df8hv1IOTLdZch/h0mNODFJpi1e+Fin/cZH52dNcp3dwQNw/t3RvHXQXa0hZN4og1O8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=mF8P6ZyA; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="mF8P6ZyA" Received: by mail.gandi.net (Postfix) with ESMTPSA id 435F744267; Thu, 6 Mar 2025 08:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741250083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4X+FnHVpWzWW4W0hGDVyaY0sBAjRDXZg/ShUEe46pbo=; b=mF8P6ZyAPX08OLt4l16Kpo2v7XG2grorpNpUUF2ND52CndXRHfjFV0oy/0WjBehTD5VZE7 f+mraZVyAQQPAt4SFEev/YX24UWI4LhjvB3GTRNaQ4YNrbhNUIVGK3QsMawpwpYOW9obEh RsMG6stsKk68DAv6eZY+InvMQF3LSz7/wKKtC+ZkE41HylBQNUuEYyUYSSnscCKfXdnNsV DWqFrp872aRrtLF8IuGFzj8oqNxq61u+Kl1ye0+RDclKmW4kGejtdp8d/4RwrLRPeiOhiS DLrtSBWgq6iM6miU7AmQNzvXBkHjT5nT88HacGvinpbJAQMAPOlu57ikZO4d+A== From: Miquel Raynal To: Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH 1/2] mtd: spi-nor: sst: register SFDP region into NVMEM framework to read MAC Address In-Reply-To: <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> (Manikandan M.'s message of "Thu, 6 Mar 2025 07:09:44 +0000") References: <20250305100134.1171124-1-manikandan.m@microchip.com> <6fee6e71-106f-474b-9a0c-5df5fb0caa00@microchip.com> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Thu, 06 Mar 2025 09:34:41 +0100 Message-ID: <87eczawo9q.fsf@bootlin.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-State: clean X-GND-Score: 0 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdejvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvvefujghffgffkfggtgfgsehtqhertddtreejnecuhfhrohhmpefoihhquhgvlhcutfgrhihnrghluceomhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepffeghfejtdefieeguddukedujeektdeihfelleeuieeuveehkedvleduheeivdefnecukfhppeeltddrkeelrdduieefrdduvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledtrdekledrudeifedruddvjedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhiqhhuvghlrdhrrgihnhgrlhessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepudejpdhrtghpthhtohepofgrnhhikhgrnhgurghnrdfosehmihgtrhhotghhihhprdgtohhmpdhrtghpthhtohepmhifrghllhgvsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehrohgshheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepkhhriihkodgutheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheptghonhhorhdoughtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopefpihgtohhlrghsrdfhvghrrhgvsehmihgtrhhotghhihhprdgto hhmpdhrtghpthhtoheprghlvgigrghnughrvgdrsggvlhhlohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopegtlhgruhguihhurdgsvgiinhgvrgesthhugihonhdruggvvh X-GND-Sasl: miquel.raynal@bootlin.com >>> +static int sst26vf_nor_post_sfdp(struct spi_nor *nor) >>> +{ >>> + struct nvmem_device *nvmem; >>> + >>> + sst26vf_sfdp_nvmem_config.dev =3D nor->dev; >>> + sst26vf_sfdp_nvmem_config.size =3D nor->sfdp->num_dwords * sizeof= (*nor->sfdp->dwords); >>> + sst26vf_sfdp_nvmem_config.priv =3D nor; >>> + sst26vf_sfdp_nvmem_config.reg_read =3D sst26vf_sfdp_mac_addr_read; >>> + >>> + nvmem =3D devm_nvmem_register(nor->dev, &sst26vf_sfdp_nvmem_confi= g); >>> + if (IS_ERR(nvmem)) { >>> + dev_err(nor->dev, "failed to register NVMEM device: %ld\n= ", PTR_ERR(nvmem)); >>> + return PTR_ERR(nvmem); >>=20 >> I don't think it makes sense to have this one-off in a particular >> driver. If at all, this should be handled in the core. Sorry, but >> this really looks like an ugly hack. >>=20 > > Because the EUI identifier within the SFDP is unique to the=20 > SST26VF064BEUI flash, I opted to handle it here rather than in the core. > > Also here the MAC address data resides within the 0x260-0x26F range, I=20 > will resize the nvmem_config.size to 0x10 instead of registering the=20 > full SFDP region as NVMEM. Open question to all parties in this thread: how do we give an offset in the device tree that is relative to the sfdp region and not the data region? I believe we care not to mix these areas while describing. Thanks, Miqu=C3=A8l