From patchwork Mon Sep 13 05:42:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liao jaime X-Patchwork-Id: 1527395 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bEoxekvp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H7SZD3Mtmz9vJJ for ; Mon, 13 Sep 2021 23:51:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 40AF883A89; Mon, 13 Sep 2021 15:51:03 +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="bEoxekvp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15E57839B9; Mon, 13 Sep 2021 07:42:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 76C35839B7 for ; Mon, 13 Sep 2021 07:42:47 +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-pj1-x102d.google.com with SMTP id f3-20020a17090a638300b00199097ddf1aso5773324pjj.0 for ; Sun, 12 Sep 2021 22:42:47 -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=YJbBzzmChr9VLcZRdoCV2m4zOHyTiGMr+Lk7KSiwurY=; b=bEoxekvpQYyCDod4eTx0HIye0Bs34b2iyP6xuQlGwgtk4LqUSzJp9EisXYA85RtacI /lr3vE0GNtbxWU/o/1q7VaEPG7ubSmo3sACRXXuXHCV6GDsVXmu+f3vlYMHrE6MuNZH7 WkdYQdpTeqR3altUpmi05cYYBJtL7SKyw7bIsNYhH7mimZw7MxPE0Cdh6EHw5ZRe49fy v7PF37g/DsZFh+Pj55/w94pqB8zzatbZrUruayn2lSU+RUMfHbPcPAgF/HAcO+Esb8FQ ke/s8Ye3ZAdQUcsG0y5YV8KBnjJCcXDsq7o6qnEwRYzS59wpGWSsukIqBhfDn/JuRgOi Sg0A== 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=YJbBzzmChr9VLcZRdoCV2m4zOHyTiGMr+Lk7KSiwurY=; b=cyOtqKc/aZudodGiCIKRH/wkJjfv4D9QJY+9EZ0ZEySh6ou5A3geIceLjWHjR/nS10 yAAQtRoTHbwwcYYoxx3/hElyegLOi3GG+hNBTpukxScCU9/Fv50udCZOi+VqMPuVNheZ +JBOo3bChjfkYKjOHzoS60jSyCaUKKlGLCfYAYX0ymm9nHfiIu8D5NzgQJaz5W99FX1r 6qlK1Qz3p+Wgkuh4MdKLhXgEBWzQPfSa0cwAiu+yBj7cCwnGmd7t5cc9w8YK4ufBcBfp u+rKhsuo0eYXozydKyJUA/RItClWDSHsrpIMGMYlITR37YkN7sIuIp0t4K1MVlvZUgc+ V7bA== X-Gm-Message-State: AOAM533N30y1m2RAqIvrZg0Etbkd5ODzUK6GefPpn2LOmQZnlzVCfoXM nTZ6lOCBa6ayjMieEK6NTzbfRtJaXGQ= X-Google-Smtp-Source: ABdhPJwVd6kr1hekD1C8nx89U/V04j647iy79if6wk2FsZEykv4PoV23AxJLEgbhFU2R7ZMBlcEv5w== X-Received: by 2002:a17:902:6848:b0:13a:4ffd:202e with SMTP id f8-20020a170902684800b0013a4ffd202emr8768291pln.79.1631511765620; Sun, 12 Sep 2021 22:42:45 -0700 (PDT) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id d20sm5590139pfu.36.2021.09.12.22.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 22:42:45 -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 v3 3/4] mtd: spi-nor-core: set 4byte opcode when possible Date: Mon, 13 Sep 2021 13:42:22 +0800 Message-Id: <20210913054223.25209-4-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210913054223.25209-1-jaimeliao.tw@gmail.com> References: <20210913054223.25209-1-jaimeliao.tw@gmail.com> X-Mailman-Approved-At: Mon, 13 Sep 2021 15:50:43 +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 Following linux kernel to check address width and 4byte flag to enable 4byte opcode setting. Signed-off-by: JaimeLiao --- drivers/mtd/spi/spi-nor-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 4bcd58d839..81c61d87bc 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3902,6 +3902,10 @@ int spi_nor_scan(struct spi_nor *nor) return -EINVAL; } + /* Set 4byte opcodes when possible. */ + if (nor->addr_width == 4 && info->flags & SPI_NOR_4B_OPCODES) + spi_nor_set_4byte_opcodes(nor, info); + /* Send all the required SPI flash commands to initialize device */ ret = spi_nor_init(nor); if (ret)