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 3CB23C43334 for ; Mon, 4 Jul 2022 06:13:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C9EE84518; Mon, 4 Jul 2022 08:13:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bC+K2Nsk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0ED098451E; Mon, 4 Jul 2022 08:13:03 +0200 (CEST) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7DBEB844FE for ; Mon, 4 Jul 2022 08:13:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jaimeliao.tw@gmail.com Received: by mail-pf1-x434.google.com with SMTP id a15so8033417pfv.13 for ; Sun, 03 Jul 2022 23:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AeRSHOLLZPjp6Otps70Da+hHnKtp1tinhxqPy+hILtw=; b=bC+K2NskMuNa73ljRH62iQ4WzL/NDQCmNXwO/obBOacsHKJyCyjeB5A14Hs7DEw0/L zBYV5AqcJQMVcjluV8QnIqM+3TtBCFzxo44bxdY2v+KxByO5E8QEJzbjBofx+SON1BWt EO7T0GXPkpuxQPLjieb76Qm8y/Z6sb0vrPF7G8EUVisxwHkZLcV0Kgcv433sLKq+PRk4 5HplxUIV+72CaXtrAP9aBMCejr9bjiYwV3CYDuQIiKan4pqL+sloPMHxjPUTUCYn5QXq i5IGjeuT5DjFz0AqxTchI97TnI1uorkQl/8nXeZmWPOPHkWBUcqshXVqKFqm8TPLFSKC MhrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AeRSHOLLZPjp6Otps70Da+hHnKtp1tinhxqPy+hILtw=; b=e5aJBxl6W6qx5K0CorgnbHxTUEtvZqCh9RoKQm+Gj5IVinni6sEsxZIbYjR5ZymLn/ QXLNRwyuYZd0mu05sENJl+cIsEcV0qiTT+jMWOx8KXmZMN15DRq8JxIUiaxA8JiaXx+5 Vz9AoobGlMabaGyaQHDtXCnxtU/QkgrJAfuMMaVqrWCxCejS+iaqU3FbVWH70tc97oQz uVk/3l3bG/bQZY5yVSR4A+OmaeSRsYrA6nDmyryz9Qn+uoe1lxXCvrVcx/7i9CfkPiLn ci0Ik+xax2xjOjBr29zw7pAxX2b79DAK7sFfhjN9iD447Drgku4XzYBqIFu6GlF/LF2s naLg== X-Gm-Message-State: AJIora/KaReJKVdup3mOiyWNrOfqYabu/1Cfpd2dqrDkINJt81n8yxwr B9Q0jBSI7a6CkB5OY59WMMwmkLozEWU= X-Google-Smtp-Source: AGRyM1vyFgFscJ9nz3Y8SI6E1A0sSoEVL+e/h0SugPbr97zU1TFSohPjJD6AJ4g4Tp49bA6NE8fRcQ== X-Received: by 2002:a05:6a00:24c1:b0:51c:784:cb59 with SMTP id d1-20020a056a0024c100b0051c0784cb59mr33798764pfv.57.1656915178659; Sun, 03 Jul 2022 23:12:58 -0700 (PDT) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id w6-20020a17090a6b8600b001ef86f71721sm1411548pjj.31.2022.07.03.23.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 23:12:58 -0700 (PDT) From: JaimeLiao To: u-boot@lists.denx.de, jagan@amarulasolutions.com, vigneshr@ti.com, miquel.raynal@bootlin.com Cc: zhengxunli@mxic.com.tw, jaimeliao@mxic.com.tw, JaimeLiao Subject: [PATCH v8 2/4] mtd: spi-nor-core: Adding different type of command extension in Soft Reset Date: Mon, 4 Jul 2022 14:12:40 +0800 Message-Id: <20220704061242.21487-3-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220704061242.21487-1-jaimeliao.tw@gmail.com> References: <20220704061242.21487-1-jaimeliao.tw@gmail.com> 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.6 at phobos.denx.de X-Virus-Status: Clean Power-on-Reset is a method to restore flash back to 1S-1S-1S mode from 8D-8D-8D in the begging of probe. Command extension type is not standardized across flash vendors in DTR mode. For suiting different vendor flash devices, adding a flag to seperate types for soft reset on boot. Signed-off-by: JaimeLiao --- drivers/mtd/spi/Kconfig | 7 +++++++ drivers/mtd/spi/spi-nor-core.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index f350c7e5dc..5bb1baa019 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -97,6 +97,13 @@ config SPI_FLASH_SMART_HWCAPS can support a type of operation in a much more refined way compared to using flags like SPI_RX_DUAL, SPI_TX_QUAD, etc. +config SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT + bool "Command extension type is INVERT for Software Reset on boot" + default n + help + Because of SFDP information can not be get before boot. + So define command extension type is INVERT when Software Reset on boot only. + config SPI_FLASH_SOFT_RESET bool "Software Reset support for SPI NOR flashes" help diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 5d319e4c0f..50460feaf8 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3697,7 +3697,12 @@ static int spi_nor_soft_reset(struct spi_nor *nor) enum spi_nor_cmd_ext ext; ext = nor->cmd_ext_type; - nor->cmd_ext_type = SPI_NOR_EXT_REPEAT; + if (nor->cmd_ext_type == SPI_NOR_EXT_NONE) { + nor->cmd_ext_type = SPI_NOR_EXT_REPEAT; +#if CONFIG_IS_ENABLED(SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT) + nor->cmd_ext_type = SPI_NOR_EXT_INVERT; +#endif /* SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT */ + } op = (struct spi_mem_op)SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_SRSTEN, 0), SPI_MEM_OP_NO_DUMMY, -- 2.17.1