From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC879356A24 for ; Mon, 23 Feb 2026 10:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841878; cv=none; b=mVSUrgqx7hmVknWmYoWmtVFJ7UuaSK5tzWEI9Tw4p90aUYAjee6yWHeLwYek68KyUfy5+O/b7FYrcBGKzylf38QCYLmVtfSCR2SLlSZbyg9TjYrDix6V2HMV94NYUFwH/U7RapNFYuH1TwrJLCUeZA12lqiThyKgviTz7HvFcO4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771841878; c=relaxed/simple; bh=JDc/qo7rkUOcZGNhJ0Wl/HeJIKj7/AleosrYhzqya/c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XVxP0YwOG4dIlMNTnX0VnASunEYT4Lh7aSg4RzCYDop/vq8lI1hio101nI6cc8/GlvieCjppRviM9jNvpe7duz+0VbXYTksmw5u0MiajdRjlYLUxzDJiiMLmNQ5mQ213gvD2lfuqukcBq2eWNAIhUurHId0Zejt/gueQBd/eYgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LfAPOLYH; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LfAPOLYH" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2aaed195901so19540075ad.0 for ; Mon, 23 Feb 2026 02:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771841876; x=1772446676; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZxR8y+DDVU/sD2lLySC6/WbxsSmg5U6pRubVnyPkrSo=; b=LfAPOLYH6/CYmyGD7y4Gx0nzk6YR60hu8x8bNhN9eHhmgHw8AKeWeSjbFYxfNGOF7y PSLRHi7NwZMGQNxMuzaeUQ3Bk5CtRIl9J/R2KUPpuksndQKe1+67t+jG16kpqYNnUYcM Vx+Mvx2zPXp7xSkGWtL121S0fuVWFkpWVJF5RBvVXbncaTyTV6EJreHK5eQpkChjKJjO E15Y7c41PukhNxqe4QThS9lsby/UeqSWovmDilGFYmJ+jhD3/n6asTMFJn8k5URXiBS4 AMRMDX+2i8GocCiuRHrP54kNAz3UKQxG/OZK1GVSDj6hBuZFaY5prAxGvpAQZS77Kd5X /lUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771841876; x=1772446676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZxR8y+DDVU/sD2lLySC6/WbxsSmg5U6pRubVnyPkrSo=; b=Vu8HsGny9fQHmIs0Ln8X5Pk5rpbYCk65vAg4dPmu2zSfAfgN/l/RVASOc0n7pCUOxG OiE58syIHicgFsINrvzCMBlWj8ph+e/Vf0wF8V91QnySWgJBjUHrY+wbkXkLogS2Y9Zl a2Xp80wsmZOOgQCglNFc6dQiOwwcN7K3oDfBc7VeHVguBLGVIURP5j5ylbDUknWcTHBu b19hoC9ZsQ8VG1e8zdbSyeNaEC1nePRqC1/N36qVYMy55Aymk/Iv0eUvDBPM3v8nPifE UMN0Jk6/4xf5aeK6gCYEAouScOH3x5fiXj6P0oCPGeQAQ6i6E2Kf4mlgo2sc8X1ikcPo D7QA== X-Gm-Message-State: AOJu0Yy9jWTfl9uFimY69jP6qHl+3KvP/U4Bj4GOYWMD+/+gN79l4yws QinlQqGWcuyWXDBuE81fS2sEravo2oOUL3pkJNf2pUzqKK6lBk00UB/n X-Gm-Gg: ATEYQzxcpFFV/BLiKWr8JHC1lZylt1xU80IhiaherXd2fUii4M6puLGdx72gxg2ze6w UPG+gy70rQHNpEGvc25hj3VTc3A8iJ45rlRWAAo5sTkIrRhMN37NDjdA07EZQxuKo34eBdOAzfG xKy4Z631DaU6G0iFXG8PjNCPo2n5/eA4pnw1E0j2213Rhni744HgOXTsbpuaDVfcmoqWkJ/saDD tNTHAc5OEoSdc25/+2hZbwnwUFu8+jsvf9LIYg6wRsfJgXntO/mrbKZp4shTFD/UIJrDl9SfUNJ 17yGHIlvTfgK76ohypfscuAoYmyVQH37j1halP4vAmVKwkpQio4U5ggI8rq3gpdcUx8l4JnG9nn hKOj+jD4Fd1OvfpfohSSYGvXT93zv+e//GgThzK5fcJcRP/JqWjpunYJo11yXJwvYoatRJJ9nf9 hZ9/ueD2k9hrJBgyyPyRtopCP/GSVSzQ== X-Received: by 2002:a17:902:d4d2:b0:2a7:c2d5:bcd7 with SMTP id d9443c01a7336-2ad74464b22mr67997785ad.20.1771841876019; Mon, 23 Feb 2026 02:17:56 -0800 (PST) Received: from c6dfb3cc7c9a ([115.245.213.202]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ad74e3425dsm66574795ad.16.2026.02.23.02.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 02:17:55 -0800 (PST) From: Sanjaikumar V S To: mwalle@kernel.org Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, pratyush@kernel.org, richard@nod.at, sanjaikumarvs@gmail.com, sanjaikumar.vs@dicortech.com, tudor.ambarus@linaro.org, stable@vger.kernel.org, vigneshr@ti.com Subject: [PATCH v3 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available Date: Mon, 23 Feb 2026 10:17:18 +0000 Message-ID: <20260223101718.89-3-sanjaikumarvs@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260223101718.89-1-sanjaikumarvs@gmail.com> References: <20260220094236.28-1-sanjaikumarvs@gmail.com> <20260223101718.89-1-sanjaikumarvs@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sanjaikumar V S When the SPI controller does not support direct mapping (nodirmap=true), spi_nor_spimem_write_data() calls spi_mem_dirmap_write() which falls back to spi_mem_no_dirmap_write(). This fallback uses the operation template created at probe time with the standard page program opcode. For SST flashes using AAI mode, this fails because the template cannot handle the dynamic opcode and address byte changes required by AAI. Fix by checking nodirmap and using spi_nor_spimem_exec_op() directly, which uses the runtime-built operation with correct AAI configuration. Cc: stable@vger.kernel.org Signed-off-by: Sanjaikumar V S --- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index d3f8a78efd3b..7caeb508d628 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -281,7 +281,7 @@ static ssize_t spi_nor_spimem_write_data(struct spi_nor *nor, loff_t to, if (spi_nor_spimem_bounce(nor, &op)) memcpy(nor->bouncebuf, buf, op.data.nbytes); - if (nor->dirmap.wdesc) { + if (nor->dirmap.wdesc && !nor->dirmap.wdesc->nodirmap) { nbytes = spi_mem_dirmap_write(nor->dirmap.wdesc, op.addr.val, op.data.nbytes, op.data.buf.out); } else { -- 2.43.0