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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5FE7C433EF for ; Tue, 24 May 2022 05:59:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 964BC84293; Tue, 24 May 2022 07:58:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=aspeedtech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id E04B2841F3; Tue, 24 May 2022 07:58:26 +0200 (CEST) Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C08A28429F for ; Tue, 24 May 2022 07:58:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=aspeedtech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=chin-ting_kuo@aspeedtech.com Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 24O5h54E062557; Tue, 24 May 2022 13:43:06 +0800 (GMT-8) (envelope-from chin-ting_kuo@aspeedtech.com) Received: from localhost.localdomain (192.168.10.10) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 24 May 2022 13:57:07 +0800 From: Chin-Ting Kuo To: , , , , , , , , , Subject: [v4 12/12] spi: aspeed: Fix bug when SPI_NOR_4B_OPCODES flag is set Date: Tue, 24 May 2022 13:56:50 +0800 Message-ID: <20220524055650.1115899-13-chin-ting_kuo@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220524055650.1115899-1-chin-ting_kuo@aspeedtech.com> References: <20220524055650.1115899-1-chin-ting_kuo@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [192.168.10.10] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 24O5h54E062557 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean When SPI_NOR_4B_OPCODES flag is set for a specific flash in spi_nor_ids[] table, EN4B command will not be issued and 4-byte dedicated commands will be used to access SPI flash. Thus, instead of EN4B command, address length is more suitable for deciding whether the controller should be set to 4-byte mode. Signed-off-by: Chin-Ting Kuo --- drivers/spi/spi-aspeed.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-aspeed.c b/drivers/spi/spi-aspeed.c index e5e348eb7b..687ddc370b 100644 --- a/drivers/spi/spi-aspeed.c +++ b/drivers/spi/spi-aspeed.c @@ -504,10 +504,6 @@ static int aspeed_spi_exec_op_user_mode(struct spi_slave *slave, /* Restore controller setting. */ writel(flash->ce_ctrl_read, ctrl_reg); - /* Set controller to 4-byte mode when flash is in 4-byte mode. */ - if (op->cmd.opcode == SPINOR_OP_EN4B) - priv->info->set_4byte(bus, cs); - return 0; } @@ -561,6 +557,9 @@ static int aspeed_spi_dirmap_create(struct spi_mem_dirmap_desc *desc) plat->ctrl_base + REG_CE0_CTRL_REG + cs * 4); priv->flashes[cs].ce_ctrl_read = reg_val; + if (op_tmpl.addr.nbytes == 4) + priv->info->set_4byte(bus, cs); + dev_dbg(dev, "read bus width: %d [0x%08x]\n", op_tmpl.data.buswidth, priv->flashes[cs].ce_ctrl_read); } else { -- 2.25.1