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 25F38CD6E60 for ; Tue, 2 Jun 2026 12:18:57 +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=lTuG4K6HEaAbQ8c8ToIJ+JApl3UUQim2wYrQxauaNU4=; b=MiemHjgEnrvgQv IluOeh1yDJCeKl1beh0zNIE8T3Gn/y13e/4eKf0QAoR0fjiCNNDrvwTaZ1V3EJ0x5JStsBmT7Vkzu BW3BLl+SyHfTghw8QFp/9zvff+kLPAuu7CSydS4o8JefG8fbfdF+TSxqss+mqQQdHTDWvZrmoi2yM E9F+kxo/Qp+WTzXG17OBLESxZnR+WOytxFCZrJXpvy8KAr2xBPHhpRFhd1QP4TayflOKyr0TJxjch aJlPBRyOyipCiCTaddn1FlcOAKPZZoF7MP9b6q7E8xWwaykVkEgwjcJPvave0HY6tmX2cVyfos5p/ sdLfGvCU1QgcagV607Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wUO59-0000000CxjK-1QF7; Tue, 02 Jun 2026 12:18:55 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wUO56-0000000Cxit-1WQI for linux-mtd@lists.infradead.org; Tue, 02 Jun 2026 12:18:53 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7B0A04E42DCC; Tue, 2 Jun 2026 12:18:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 41356603BC; Tue, 2 Jun 2026 12:18:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B693110888429; Tue, 2 Jun 2026 14:18:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1780402729; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=LDb4o52DTUweCNoaveunh0r8+3SLZ3VLRjrgEU8ebf0=; b=F4ukxueRbcpmWVLMtCyjP8pu5HOz/aIu4z/6QeJu7cdoxhQ7cJDhxIu1oMOrZM1UAFwyob aTrZLusfl8KLnYxou0aIsz+BGN9PSb3Pqg3A3ygNJA0a3jXyyT2lXVAFsT9Tv4uNat8J0H b8Gc8eB+y6OiTIU8WL1Wk65mX2Bjv02CyJWSbw34U0xrtBn1PDJwVFjiReZfeRbdTeJwMC mgtmwgZj422X0cAIdfUxSuvPhljWjKxGy5pzSANENbAISkYtAonhN+xiodHUC0pT7OkQWx 2ZYqxq58hl545Fg1Jx/v6CsgOfHznY3XwrdzKKvZZ1m6YJ8N6RdCO/99a04X3g== From: Miquel Raynal To: Santhosh Kumar K Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 11/13] mtd: spinand: run PHY tuning after init and update dirmap frequencies In-Reply-To: <2f509130-491c-4a66-9156-39b01b40e65f@ti.com> (Santhosh Kumar K.'s message of "Mon, 1 Jun 2026 14:46:44 +0530") References: <20260527175527.2247679-1-s-k6@ti.com> <20260527175527.2247679-12-s-k6@ti.com> <87mrxjg9zi.fsf@bootlin.com> <2f509130-491c-4a66-9156-39b01b40e65f@ti.com> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Tue, 02 Jun 2026 14:18:37 +0200 Message-ID: <87y0gx16g2.fsf@bootlin.com> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260602_051852_560213_DAEA8125 X-CRM114-Status: GOOD ( 16.09 ) 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 SGVsbG8gU2FudGhvc2gsCgo+Pj4gKwkvKgo+Pj4gKwkgKiBEaXJtYXBzIHdlcmUgc2V0IHVwIGlu IHNwaW5hbmRfaW5pdCgpIGJlZm9yZSB0dW5pbmcgcmFuOyB1cGRhdGUKPj4+ICsJICogdGhlaXIg b3AgdGVtcGxhdGVzIHRvIHVzZSB0aGUgdmFsaWRhdGVkIGZyZXF1ZW5jeS4KPj4+ICsJICovCj4+ PiArCWlmICghcmV0KSB7Cj4+PiArCQlzdHJ1Y3QgbmFuZF9kZXZpY2UgKm5hbmQgPSBzcGluYW5k X3RvX25hbmQoc3BpbmFuZCk7Cj4+PiArCQlpbnQgaTsKPj4+ICsKPj4+ICsJCWZvciAoaSA9IDA7 IGkgPCBuYW5kLT5tZW1vcmcucGxhbmVzX3Blcl9sdW47IGkrKykgewo+Pj4gKwkJCWlmIChzcGlu YW5kLT5kaXJtYXBzW2ldLnJkZXNjKSB7Cj4+PiArCQkJCXNwaW5hbmQtPmRpcm1hcHNbaV0ucmRl c2MtPmlu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SBrbm93IHRoZSByZXN1bHRzIG9uY2UgSSd2ZQo+IHRl c3RlZCBpdC4KCklmIHRoaXMgaXMgZG9hYmxlLCBpdCBpcyBjbGVhcmx5IHRoZSBiZXN0IGFwcHJv YWNoLCBidXQgb24gdGhlIG90aGVyCnNpZGUgeW91IG1pZ2h0IG5lZWQgdG8ga25vdyB3aGF0IGlz IHRoZSByZWFkIHZhcmlhbnQgYmVmb3JlIHJ1bm5pbmcgdGhlCnR1bmluZyBhbGdvcml0aG0sIHNv IEkgYW0gbm90IHN1cmUgaXQgaXMgZmVhc2libGUuIEknbGwgbGV0IHlvdSBkaWcgdGhlCnRvcGlj IGFuZCBwcm9wb3NlIHRoZSBiZXN0IGFwcHJvYWNoIHlvdSBmaW5kIQoKVGhhbmtzLApNaXF1w6hs CgpfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18K TGludXggTVREIGRpc2N1c3Npb24gbWFpbGluZyBsaXN0Cmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQu b3JnL21haWxtYW4vbGlzdGluZm8vbGludXgtbXRkLwo= From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 B210B3CE088 for ; Tue, 2 Jun 2026 12:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780402732; cv=none; b=cD/V0GNdS2KBuiupLee5wYnvLYTTt4+zNCnUKyZdFek6ef1g/PGl3VAyEJuRLUnpNfdvS6nNrkY6P8scOmUvCpImQg1qH45zDG/r2EOuBhP1UQuhje151jkcPxdiw/gwDu1A55P1H38mN8HYntaVGYTf033FMbA2TyNXMN88n+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780402732; c=relaxed/simple; bh=kGsKCEXO0ZUzl+8w3uTBJNuhgkcJWQGWwJRl+g4zDAA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=GvHeUdCrNenY7JliE/FyI0RyjtGcDh+o1C9asMXNMOX6+QoUY8/WAfyvk17Rl6cWb3Q8gaVOrPwFHy/QOwCxMpPLDlCsCKWg6/m9DtE5dqWPRrqwT8tKmSj35m3ftuMZpsm9JN//rPSLP6URT0eiihtzpGgTTfmm/5BanvF130E= 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=F4ukxueR; arc=none smtp.client-ip=185.246.84.56 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="F4ukxueR" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 789991A37CD; Tue, 2 Jun 2026 12:18:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 41356603BC; Tue, 2 Jun 2026 12:18:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B693110888429; Tue, 2 Jun 2026 14:18:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1780402729; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=LDb4o52DTUweCNoaveunh0r8+3SLZ3VLRjrgEU8ebf0=; b=F4ukxueRbcpmWVLMtCyjP8pu5HOz/aIu4z/6QeJu7cdoxhQ7cJDhxIu1oMOrZM1UAFwyob aTrZLusfl8KLnYxou0aIsz+BGN9PSb3Pqg3A3ygNJA0a3jXyyT2lXVAFsT9Tv4uNat8J0H b8Gc8eB+y6OiTIU8WL1Wk65mX2Bjv02CyJWSbw34U0xrtBn1PDJwVFjiReZfeRbdTeJwMC mgtmwgZj422X0cAIdfUxSuvPhljWjKxGy5pzSANENbAISkYtAonhN+xiodHUC0pT7OkQWx 2ZYqxq58hl545Fg1Jx/v6CsgOfHznY3XwrdzKKvZZ1m6YJ8N6RdCO/99a04X3g== From: Miquel Raynal To: Santhosh Kumar K Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 11/13] mtd: spinand: run PHY tuning after init and update dirmap frequencies In-Reply-To: <2f509130-491c-4a66-9156-39b01b40e65f@ti.com> (Santhosh Kumar K.'s message of "Mon, 1 Jun 2026 14:46:44 +0530") References: <20260527175527.2247679-1-s-k6@ti.com> <20260527175527.2247679-12-s-k6@ti.com> <87mrxjg9zi.fsf@bootlin.com> <2f509130-491c-4a66-9156-39b01b40e65f@ti.com> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Tue, 02 Jun 2026 14:18:37 +0200 Message-ID: <87y0gx16g2.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-spi@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-Last-TLS-Session-Version: TLSv1.3 Hello Santhosh, >>> + /* >>> + * Dirmaps were set up in spinand_init() before tuning ran; update >>> + * their op templates to use the validated frequency. >>> + */ >>> + if (!ret) { >>> + struct nand_device *nand =3D spinand_to_nand(spinand); >>> + int i; >>> + >>> + for (i =3D 0; i < nand->memorg.planes_per_lun; i++) { >>> + if (spinand->dirmaps[i].rdesc) { >>> + spinand->dirmaps[i].rdesc->info.primary_op_tmpl.max_freq =3D >>> + spinand->max_read_op.max_freq; >>> + spinand->dirmaps[i].rdesc->info.secondary_op_tmpl.max_freq =3D >>> + spinand->max_read_op.max_freq; >>> + } >>> + if (spinand->dirmaps[i].wdesc) >>> + spinand->dirmaps[i].wdesc->info.primary_op_tmpl.max_freq =3D >>> + spinand->max_write_op.max_freq; >>> + } >>> + } >> Unfortunately, hot fixing the dirmaps is invalid. When we take the >> best >> variant, we select a maximum speed that may be lower than the tuned PHY >> speed. We cannot just overwrite that value without consequence, because >> depending on the boundaries we cross, extra dummy cycles may be >> required. >> I believe spinand_select_op_variant() shall be aware of the different >> possible speeds. It should look for the max_speed_hz capability and not >> for the base_speed_hz, and fallback to base_speed_hz in case of >> issue. >> Or otherwise, maybe we could go through the whole I/O variant >> selection again after tuning, with the actual maximum speed set. > > Good catch. Updating the dirmap templates after they have already been > created is indeed not correct, as the operation selection may depend on > the final frequency and associated parameters such as dummy cycles. > > Instead of patching the dirmaps after tuning, I'll move the > _execute_tuning() call before dirmap creation. This way, the validated > frequency can be written back into the selected read/write variant, and > the dirmaps will then be created using the final ops. > > I'll rework the flow accordingly and let you know the results once I've > tested it. If this is doable, it is clearly the best approach, but on the other side you might need to know what is the read variant before running the tuning algorithm, so I am not sure it is feasible. I'll let you dig the topic and propose the best approach you find! Thanks, Miqu=C3=A8l