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 7CABDC433F5 for ; Wed, 29 Dec 2021 05:56:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0F52830D5; Wed, 29 Dec 2021 06:56:46 +0100 (CET) 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="D9ubz+cT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 649FB8307C; Wed, 29 Dec 2021 06:56:39 +0100 (CET) Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (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 05B5E83094 for ; Wed, 29 Dec 2021 06:56:35 +0100 (CET) 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-pg1-x52e.google.com with SMTP id 7so5021621pgn.0 for ; Tue, 28 Dec 2021 21:56:34 -0800 (PST) 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=AqF1f/V3yfq9U9ksUmXslOLjvgdvXKwbwrnhKg3y5+k=; b=D9ubz+cTyWmTbzJB+ty1Uy0w1CdNRju4lUwy3wHacxKvkVakpBtZrOLNDPGJOY7EH4 L+xJK981mlQkZAgNygf0K454C7BdZUOZvsej8/ZqPvKwY5COLUBE7KBykfgJFv+bZaBF 6cMaeqn464KJ/SH9TmRzLTHCznSpqi7Cyj5sDggz8HO67biX1Su3eJcUugxWcS65ARAV oYXDBvNmPtzzFgkA4pkJrxpkrVDjMUmaSep0rSUss7tBeNQbLlWfJMgjw9wfAw1gT5JL uJ0Yb47HmvBwRYSahOwpvrKEgpo0xosiPBn48CARBDusMoLgzj9Qj1L3bQ0WWdCJYkUY PxwA== 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=AqF1f/V3yfq9U9ksUmXslOLjvgdvXKwbwrnhKg3y5+k=; b=0+MeJS2DexG9CR6E99EZSjIxGgOU1EZdebxyRfEWWPIBcwKjtktM4yqaY7Zus4kW7H D3Md9hoqJ2u7MotQWxnOB6xoC0k9CLQGWJPggFQfOOx7tD9vjhl+l0mL9T9O0oFkK8JG H7+amfIZzf/1/ZYxNXhpE7h1+tDZW1zvRXvhHGllTM54gHpNQeKW38PVWbFY+s6wMdJH roMhYKkytiA7buklavPYJ+T1SA41vw15NKw6Y1HzNhDE046NdkDJNSm3R+BXhW8e1AYc TPoCfJol3NEao0E1KZdg1Wm+uT56nR9rbugfjeDTEkI4Hy9eX3RhXY71ORjChD7pC/dM pp+Q== X-Gm-Message-State: AOAM531kzeIGhMTtr8jWOX+hdA2CR/M1LOVpVvCubA061qinQTkcDQKz YTWnsvZ4SpHbOhFsqrmLIC65EfzKMO4= X-Google-Smtp-Source: ABdhPJwn3Ahwd8QbyF9j1X3weAtXnrgIGdMYJMU3sBU2u2qkD7gBSOExVYxcZXTWPjbAqAm8W2ADPA== X-Received: by 2002:a05:6a00:16d3:b0:4ba:4aee:2e34 with SMTP id l19-20020a056a0016d300b004ba4aee2e34mr25213792pfc.82.1640757393092; Tue, 28 Dec 2021 21:56:33 -0800 (PST) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id oa9sm22156096pjb.31.2021.12.28.21.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 21:56:32 -0800 (PST) From: JaimeLiao To: u-boot@lists.denx.de, jagan@amarulasoutions.com, vigneshr@ti.com, miquel.raynal@bootlin.com Cc: zhengxunli@mxic.com.tw, jaimeliao@mxic.com.tw, JaimeLiao Subject: [PATCH v6 2/4] mtd: spi-nor-core: Adding different type of command extension in Soft Reset Date: Wed, 29 Dec 2021 13:56:18 +0800 Message-Id: <20211229055620.1466-3-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211229055620.1466-1-jaimeliao.tw@gmail.com> References: <20211229055620.1466-1-jaimeliao.tw@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 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 1b2ef37e92..9b7d195770 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" default n diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 0a6550984b..2b6947cefc 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3661,7 +3661,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