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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 545ADC4320A for ; Fri, 13 Aug 2021 12:20:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CA676610CF for ; Fri, 13 Aug 2021 12:20:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CA676610CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD08582E04; Fri, 13 Aug 2021 14:19:44 +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="oA/viCNm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DAE2882D95; Fri, 13 Aug 2021 09:26:27 +0200 (CEST) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 5E16C82D95 for ; Fri, 13 Aug 2021 09:26:24 +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-pl1-x62b.google.com with SMTP id a5so10741133plh.5 for ; Fri, 13 Aug 2021 00:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0xe7NuZtcJ5xiNb3h0hABA8+KLoo8aUSnBy0rNDV2s0=; b=oA/viCNmEnVGCTfr9ERQEKyb4m2ez20eE35/rHZLjKOCi8G1kQt6JbfIdFWNRcz3Zw OySFXeXbfh4qBo7+I+amHRVUnMKqgzg7nEqirxrO8mUVGVAFVKI+RwKLSukvVzPY6bST DotmUGXV7pasDyydFr6dtZE59l+WtY3MVA76COSU2nBIPNlmRFt484wEbiiJ9clso9pc dLrDVXfZvG5hkJaYm/EGZCx51sWt1BxozKGQSpDdjFOxErluE/okCTV9ty1KYouLMp5H hMJuKhiwPvizk/3wy6EqycXVVyN8GivtMpzYMTw1Jmrhgq4KDNetOq5rz4hqPH7K63PO OMUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0xe7NuZtcJ5xiNb3h0hABA8+KLoo8aUSnBy0rNDV2s0=; b=To5XDP/uNlXZqVLfFsGk1sUH3bru51lLxbdanQnJ+EcZ9ku2mA1CM1AmJKWa9HxKbQ 05DK+TKnlEgoYVW72MOf0x94sLvC9tJHoK2gQNN37h3Z+VUtjJTGd0W3J5ljxfEc5Gn5 +lQah4nvGejwrHY4RVfx/iGKYhNKnGT2xKcNnGNqm0p1SSmVwZ8R4F0bdiZQNqODieVb gFiySi1a3Nrd0zqY+r1eSBFr6dWXNt/q9oz+FTGAm30Ov+KF/o/M72R4hw7XJTI/0edz byZTgBUlLSYfE0uBDQ4q1YgQTES/kJefEo8XobkvX3E/IF2f6irdGGG5yFaROIj1YNs0 zEug== X-Gm-Message-State: AOAM532iJ+vvUf7tT90gByw7xHhiyd1DIcPAdS7HBGy2OIdAFb+sQVQS cj8Y2F+Bt0k2qVUGTcZYQiyNaggMFoc= X-Google-Smtp-Source: ABdhPJzrqS79R/1VEhTgGHnR7sHNph1C9OfhI/FgkyJ0mM7gj5auLLy1UNAfFm5W4Craoih0t9zQPw== X-Received: by 2002:a17:90a:5994:: with SMTP id l20mr1206558pji.201.1628839582627; Fri, 13 Aug 2021 00:26:22 -0700 (PDT) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id x20sm1081119pfh.188.2021.08.13.00.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 00:26:22 -0700 (PDT) From: JaimeLiao To: u-boot@lists.denx.de, jagan@amarulasolutions.com, vigneshr@ti.com, p.yadav@ti.com Cc: zhengxunli@mxic.com.tw, ycllin@mxic.com.tw, jaimeliao@mxic.com.tw, JaimeLiao Subject: [PATCH 2/4] mtd: spi-nor-core: Adding different type of command extension in Soft Reset Date: Fri, 13 Aug 2021 15:25:50 +0800 Message-Id: <20210813072552.21772-3-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210813072552.21772-1-jaimeliao.tw@gmail.com> References: <20210813072552.21772-1-jaimeliao.tw@gmail.com> X-Mailman-Approved-At: Fri, 13 Aug 2021 14:19:30 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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, having second times Softreset with different types is clumsy but useful in the begging of probe. Signed-off-by: JaimeLiao --- drivers/mtd/spi/spi-nor-core.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 6b195b1fd3..be6c58ad40 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3684,6 +3684,36 @@ static int spi_nor_soft_reset(struct spi_nor *nor) */ udelay(SPI_NOR_SRST_SLEEP_LEN); + /* Manufacturers with different command extension type. For suitting + * different flash devices, using command extension type is equal "INVERT" + * when second time Software Reset. + */ + + nor->cmd_ext_type = SPI_NOR_EXT_INVERT; + op = (struct spi_mem_op)SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_SRSTEN, 0), + SPI_MEM_OP_NO_DUMMY, + SPI_MEM_OP_NO_ADDR, + SPI_MEM_OP_NO_DATA); + spi_nor_setup_op(nor, &op, SNOR_PROTO_8_8_8_DTR); + ret = spi_mem_exec_op(nor->spi, &op); + if (ret) { + dev_warn(nor->dev, "Software reset enable failed: %d\n", ret); + goto out; + } + + op = (struct spi_mem_op)SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_SRST, 0), + SPI_MEM_OP_NO_DUMMY, + SPI_MEM_OP_NO_ADDR, + SPI_MEM_OP_NO_DATA); + spi_nor_setup_op(nor, &op, SNOR_PROTO_8_8_8_DTR); + ret = spi_mem_exec_op(nor->spi, &op); + if (ret) { + dev_warn(nor->dev, "Software reset failed: %d\n", ret); + goto out; + } + + udelay(SPI_NOR_SRST_SLEEP_LEN); + out: nor->cmd_ext_type = ext; return ret; -- 2.17.1