From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3C1DE3EE1FA; Wed, 20 May 2026 17:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298624; cv=none; b=iKIYovgOnu1nzkUZ2Kq5zB7xtk4z33f0ZRMTwPW/ipoD2j1uZ6Rz9NY5aNdUth4a0kxvHsy4awroZhrD9C6uESQIq/M83vX9b3r6ycd6ExeNRxqURGre0fZT7DiOykpHMYeFLoK6QYf72F1DdcgVvihCpOJdFtRUa5Gzp4v07aQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298624; c=relaxed/simple; bh=IdrWWFGsKzb9YNcYC8QDLqjHI7DwtyodSexINeySrnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MlKaKkAyyuPcQJ5T1HpPzhobo3LKzh3hdwfIAI9batHPIiArXz2G1vdEbmnqOr7g4w+IOsaiYzMCGLka2j8O5xFfYaCkMNXwJtNjMtw84NRuOPzbQPrdL2IrHl0VgGxasZc1UeSueafm3v82klCTHEBhYyJRkDIrI8pmryAvxhk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jFRmWDJ0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jFRmWDJ0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68CC1F00893; Wed, 20 May 2026 17:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779298620; bh=b7Nr0/prRxwBbSruk8ItC2CFjNItq8BozE4AN5RmntU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jFRmWDJ0XqVkils9PGA5OJbPw3yXzI2gyoH5YWsdgSQtT98u2fGXtze0YuRH+J/Hd mQhphvOFQwi4GVgpGuLhprimY9uunpBf9EspNruVgG8oZCXS86TBFYs4q3td7UUBNf sXfj3WTA59D8wcCDvBifu78f+PBTxaAubDJ3p/pk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miquel Raynal , Sasha Levin Subject: [PATCH 6.18 478/957] mtd: spinand: winbond: Configure the IO mode after the dummy cycles Date: Wed, 20 May 2026 18:16:01 +0200 Message-ID: <20260520162144.892664557@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miquel Raynal [ Upstream commit ef1ed296fb9d9246256e1b5b2cf2e86e85606ac3 ] When we will change the bus interface, the action that actually performs the transition is the IO mode register write. This means after the IO mode register write, we should use the new bus interface. But the ->configure_chip() hook itself is not responsible of making this change official, it is the caller that must act according to the return value. Reorganize this helper to first configure the dummy cycles before possibly switching to another bus interface. Signed-off-by: Miquel Raynal Stable-dep-of: 25a915fad503 ("mtd: spinand: winbond: Clarify when to enable the HS bit") Signed-off-by: Sasha Levin --- drivers/mtd/nand/spi/winbond.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c index 2361109101727..6cb5dd45e6fb7 100644 --- a/drivers/mtd/nand/spi/winbond.c +++ b/drivers/mtd/nand/spi/winbond.c @@ -357,21 +357,6 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spinand) op = spinand->op_templates->read_cache; - single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1); - dtr = (op->cmd.dtr || op->addr.dtr || op->data.dtr); - if (single && !dtr) - io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR; - else if (!single && !dtr) - io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR; - else if (!single && dtr) - io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR; - else - return -EINVAL; - - ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); - if (ret) - return ret; - dummy_cycles = ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); switch (dummy_cycles) { case 8: @@ -388,6 +373,21 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spinand) if (ret) return ret; + single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1); + dtr = (op->cmd.dtr && op->addr.dtr && op->data.dtr); + if (single && !dtr) + io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR; + else if (!single && !dtr) + io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR; + else if (!single && dtr) + io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR; + else + return -EINVAL; + + ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); + if (ret) + return ret; + return 0; } -- 2.53.0